From 2518722aded4a721a6bb640598ba89252dcee677 Mon Sep 17 00:00:00 2001 From: Matthias Puchner <github@mpuchner.de> Date: Tue, 15 Feb 2022 07:33:54 +0100 Subject: [PATCH] rename (not a model anymore) --- GUI/Model/Device/InstrumentLibrary.cpp | 24 +++++++++---------- GUI/Model/Device/InstrumentLibrary.h | 4 ++-- .../Instrument/InstrumentLibraryEditor.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/GUI/Model/Device/InstrumentLibrary.cpp b/GUI/Model/Device/InstrumentLibrary.cpp index e11743493c5..d6619ba0997 100644 --- a/GUI/Model/Device/InstrumentLibrary.cpp +++ b/GUI/Model/Device/InstrumentLibrary.cpp @@ -34,7 +34,7 @@ QString instrumentLibraryFilePath() InstrumentLibrary::InstrumentLibrary() - : m_ec(&m_model) + : m_ec(&m_instrumentItems) , m_modified(false) { QObject::connect(&m_ec, &InstrumentsEditController::instrumentChanged, @@ -45,7 +45,7 @@ InstrumentLibrary::InstrumentLibrary() QString InstrumentLibrary::suggestName(const QString& name) const { - return m_model.suggestInstrumentName(name); + return m_instrumentItems.suggestInstrumentName(name); } InstrumentItem* InstrumentLibrary::add(const QString& name, const InstrumentItem& itemToCopy) @@ -55,12 +55,12 @@ InstrumentItem* InstrumentLibrary::add(const QString& name, const InstrumentItem bool InstrumentLibrary::isEmpty() const { - return m_model.instrumentItems().isEmpty(); + return m_instrumentItems.instrumentItems().isEmpty(); } QList<InstrumentItem*> InstrumentLibrary::instrumentItems() const { - return m_model.instrumentItems().toList(); + return m_instrumentItems.instrumentItems().toList(); } bool InstrumentLibrary::saveIfModified() @@ -79,7 +79,7 @@ bool InstrumentLibrary::saveIfModified() writer.writeAttribute(XML_VERSION_TAG, "2"); Serializer sInstruments(&writer); - m_model.serialize(sInstruments); + m_instrumentItems.serialize(sInstruments); writer.writeEndElement(); writer.writeEndDocument(); @@ -92,7 +92,7 @@ bool InstrumentLibrary::saveIfModified() bool InstrumentLibrary::load() { m_modified = false; - m_model.clear(); + m_instrumentItems.clear(); QFile file(instrumentLibraryFilePath()); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -111,28 +111,28 @@ bool InstrumentLibrary::load() return false; Serializer sInstruments(&reader); - m_model.serialize(sInstruments); + m_instrumentItems.serialize(sInstruments); } } } if (reader.hasError()) { - m_model.clear(); + m_instrumentItems.clear(); return false; } file.close(); return true; } catch (const std::exception&) { - m_model.clear(); + m_instrumentItems.clear(); return false; } catch (const DeserializationException&) { - m_model.clear(); + m_instrumentItems.clear(); return false; } } -InstrumentItems* InstrumentLibrary::model() +InstrumentItems* InstrumentLibrary::instrumentItems() { - return &m_model; + return &m_instrumentItems; } diff --git a/GUI/Model/Device/InstrumentLibrary.h b/GUI/Model/Device/InstrumentLibrary.h index c9645f82521..85ec5762112 100644 --- a/GUI/Model/Device/InstrumentLibrary.h +++ b/GUI/Model/Device/InstrumentLibrary.h @@ -32,10 +32,10 @@ public: bool saveIfModified(); bool load(); - InstrumentItems* model(); + InstrumentItems* instrumentItems(); private: - InstrumentItems m_model; + InstrumentItems m_instrumentItems; InstrumentsEditController m_ec; bool m_modified; }; diff --git a/GUI/View/Instrument/InstrumentLibraryEditor.cpp b/GUI/View/Instrument/InstrumentLibraryEditor.cpp index 4dd7e3b4e39..0184f79a067 100644 --- a/GUI/View/Instrument/InstrumentLibraryEditor.cpp +++ b/GUI/View/Instrument/InstrumentLibraryEditor.cpp @@ -30,7 +30,7 @@ InstrumentLibraryEditor::InstrumentLibraryEditor(QWidget* parent) : QDialog(parent) , m_ui(new Ui::InstrumentLibraryEditor) - , m_treeModel(new TreeModel(this, gSessionData->instrumentLibrary.model())) + , m_treeModel(new TreeModel(this, gSessionData->instrumentLibrary.instrumentItems())) , m_chosenItem(nullptr) { m_ui->setupUi(this); -- GitLab