diff -r fe094d0687ad -r c27612f0eac0 src/libraries.h --- a/src/libraries.h Wed Jun 22 23:51:06 2022 +0300 +++ b/src/libraries.h Sun Jun 26 19:44:45 2022 +0300 @@ -45,8 +45,10 @@ QDataStream &operator<<(QDataStream&, const Library&); QDataStream &operator>>(QDataStream&, Library&); -using Libraries = QVector; -Q_DECLARE_METATYPE(Libraries) +using Libraries = QList; +//QDataStream &operator<<(QDataStream&, const Libraries&); +//QDataStream &operator>>(QDataStream&, Libraries&); +//Q_DECLARE_METATYPE(Libraries) class Configuration; @@ -55,18 +57,18 @@ Q_OBJECT public: LibrariesModel(QObject* parent = nullptr); - QVector::const_iterator begin() const; - QVector::const_iterator end() const; + auto begin() const { return this->libraries.begin(); } + auto end() const { return this->libraries.end(); } QString findFile(QString fileName) const; void addLibrary(const Library& library); - void removeLibrary(const int libraryIndex); - const Library& library(int libraryIndex) const; - void setLibraryPath(int libraryIndex, const QDir& path); - void setLibraryRole(int libraryIndex, const Library::Role role); + void removeLibrary(const std::size_t libraryIndex); + const Library& library(std::size_t libraryIndex) const; + void setLibraryPath(std::size_t libraryIndex, const QDir& path); + void setLibraryRole(std::size_t libraryIndex, const Library::Role role); void restoreFromSettings(); void storeToSettings(); - int count() const; - void moveLibrary(const int libraryFromIndex, const int libraryToIndex); + std::size_t count() const; + void moveLibrary(const std::size_t libraryFromIndex, const std::size_t libraryToIndex); // Definitions for QAbstractTableModel Qt::ItemFlags flags(const QModelIndex& index) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; @@ -76,7 +78,7 @@ int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex&) const override; int columnCount(const QModelIndex&) const override; - bool isValidIndex(const int libraryIndex) const; + bool isValidIndex(const std::size_t libraryIndex) const; ColorTable loadColorTable(QTextStream& errors) const; private: enum Column @@ -84,6 +86,6 @@ RoleColumn, PathColumn }; - void signalLibraryChange(int library); + void signalLibraryChange(std::size_t library); Libraries libraries; };