diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-05 19:09:10 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-05 19:09:10 +0300 |
commit | b2fdd8359405c93d0d93aa8c68971c986a1f68cb (patch) | |
tree | 59859119373213ce04b2f5e2d7a95227b57be609 /launcher/VersionProxyModel.h | |
parent | 149b6d59cf848a3b3cd50b3aee1c112e9c47e633 (diff) | |
parent | ae793f6cf11658c9abc5111e82d5ba7b3e6af127 (diff) | |
download | PrismLauncher-b2fdd8359405c93d0d93aa8c68971c986a1f68cb.tar.gz PrismLauncher-b2fdd8359405c93d0d93aa8c68971c986a1f68cb.tar.bz2 PrismLauncher-b2fdd8359405c93d0d93aa8c68971c986a1f68cb.zip |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into download_threads
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/VersionProxyModel.h')
-rw-r--r-- | launcher/VersionProxyModel.h | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/launcher/VersionProxyModel.h b/launcher/VersionProxyModel.h index 6434376c..c7d5fd94 100644 --- a/launcher/VersionProxyModel.h +++ b/launcher/VersionProxyModel.h @@ -6,64 +6,53 @@ class VersionFilterModel; -class VersionProxyModel: public QAbstractProxyModel -{ +class VersionProxyModel : public QAbstractProxyModel { Q_OBJECT -public: - - enum Column - { - Name, - ParentVersion, - Branch, - Type, - Architecture, - Path, - Time - }; + public: + enum Column { Name, ParentVersion, Branch, Type, Architecture, Path, Time }; typedef QHash<BaseVersionList::ModelRoles, std::shared_ptr<Filter>> FilterMap; -public: - VersionProxyModel ( QObject* parent = 0 ); - virtual ~VersionProxyModel() {}; + public: + VersionProxyModel(QObject* parent = 0); + virtual ~VersionProxyModel(){}; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; - virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; - virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; - virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override; + virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; + virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; + virtual QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; + virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; + virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - virtual QModelIndex parent(const QModelIndex &child) const override; - virtual void setSourceModel(QAbstractItemModel *sourceModel) override; + virtual QModelIndex parent(const QModelIndex& child) const override; + virtual void setSourceModel(QAbstractItemModel* sourceModel) override; - const FilterMap &filters() const; - const QString &search() const; - void setFilter(const BaseVersionList::ModelRoles column, Filter * filter); - void setSearch(const QString &search); + const FilterMap& filters() const; + const QString& search() const; + void setFilter(const BaseVersionList::ModelRoles column, Filter* filter); + void setSearch(const QString& search); void clearFilters(); QModelIndex getRecommended() const; - QModelIndex getVersion(const QString & version) const; - void setCurrentVersion(const QString &version); -private slots: + QModelIndex getVersion(const QString& version) const; + void setCurrentVersion(const QString& version); + private slots: - void sourceDataChanged(const QModelIndex &source_top_left,const QModelIndex &source_bottom_right); + void sourceDataChanged(const QModelIndex& source_top_left, const QModelIndex& source_bottom_right); void sourceAboutToBeReset(); void sourceReset(); - void sourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last); - void sourceRowsInserted(const QModelIndex &parent, int first, int last); + void sourceRowsAboutToBeInserted(const QModelIndex& parent, int first, int last); + void sourceRowsInserted(const QModelIndex& parent, int first, int last); - void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); - void sourceRowsRemoved(const QModelIndex &parent, int first, int last); + void sourceRowsAboutToBeRemoved(const QModelIndex& parent, int first, int last); + void sourceRowsRemoved(const QModelIndex& parent, int first, int last); -private: + private: QList<Column> m_columns; FilterMap m_filters; QString m_search; BaseVersionList::RoleList roles; - VersionFilterModel * filterModel; + VersionFilterModel* filterModel; bool hasRecommended = false; bool hasLatest = false; QString m_currentVersion; |