--- a/src/libraries.cpp Sat Feb 01 17:20:10 2020 +0200 +++ b/src/libraries.cpp Sun Feb 02 00:30:48 2020 +0200 @@ -18,6 +18,7 @@ #include <QSettings> #include "libraries.h" +#include "configuration.h" /** * @brief Constructs a new library manager @@ -33,7 +34,7 @@ * @param settings Settings to construct from * @param parent Parent object */ -LibraryManager::LibraryManager(QSettings* settings, QObject* parent) : +LibraryManager::LibraryManager(Configuration* settings, QObject* parent) : QAbstractTableModel{parent} { this->restoreFromSettings(settings); @@ -160,19 +161,18 @@ * changes are lost. * @param settings Settings object to restore from. */ -void LibraryManager::restoreFromSettings(QSettings* settings) +void LibraryManager::restoreFromSettings(Configuration* settings) { - this->libraries = settings->value("libraries").value<Libraries>(); + this->libraries = settings->libraries(); } /** * @brief Saves the libraries to the specified settings object. * @param settings Settings object to modify. */ -void LibraryManager::storeToSettings(QSettings* settings) +void LibraryManager::storeToSettings(Configuration* settings) { - QVariant librariesValue = QVariant::fromValue(this->libraries); - settings->setValue("libraries", librariesValue); + settings->setLibraries(this->libraries); } /** @@ -380,3 +380,8 @@ library.role = static_cast<Library::Role>(role); return result; } + +bool operator==(const Library& one, const Library& other) +{ + return one.role == other.role and one.path == other.path; +}