diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-18 04:53:14 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-18 04:53:14 -0400 |
| commit | b91dbba734f45f1cc1a42f86d9141bb272de0564 (patch) | |
| tree | ec752efd717330e7c8a4e28a32eebc1feef927ba /src/modinfodialogconflictsmodels.h | |
| parent | c47ab23f9593d384a1b5106f79d41228fc8c8f59 (diff) | |
fixed warnings about Q_OBJECT and thousand separators
had to move some classes to header files
Diffstat (limited to 'src/modinfodialogconflictsmodels.h')
| -rw-r--r-- | src/modinfodialogconflictsmodels.h | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/modinfodialogconflictsmodels.h b/src/modinfodialogconflictsmodels.h new file mode 100644 index 00000000..a37e85c8 --- /dev/null +++ b/src/modinfodialogconflictsmodels.h @@ -0,0 +1,118 @@ +#include "shared/fileentry.h" + +class PluginContainer; + +class ConflictItem +{ +public: + ConflictItem( + QString before, QString relativeName, QString after, + MOShared::FileIndex index, QString fileName, + bool hasAltOrigins, QString altOrigin, bool archive); + + const QString& before() const; + const QString& relativeName() const; + const QString& after() const; + + const QString& fileName() const; + const QString& altOrigin() const; + + bool hasAlts() const; + bool isArchive() const; + + MOShared::FileIndex fileIndex() const; + + bool canHide() const; + bool canUnhide() const; + bool canRun() const; + bool canOpen() const; + bool canPreview(PluginContainer& pluginContainer) const; + bool canExplore() const; + +private: + QString m_before; + QString m_relativeName; + QString m_after; + MOShared::FileIndex m_index; + QString m_fileName; + bool m_hasAltOrigins; + QString m_altOrigin; + bool m_isArchive; +}; + + +class ConflictListModel : public QAbstractItemModel +{ + Q_OBJECT; + +public: + struct Column + { + QString caption; + const QString& (ConflictItem::*getText)() const; + }; + + ConflictListModel(QTreeView* tree, std::vector<Column> columns); + + void clear(); + void reserve(std::size_t s); + + QModelIndex index(int row, int col, const QModelIndex& ={}) const override; + QModelIndex parent(const QModelIndex&) const override; + int rowCount(const QModelIndex& parent={}) const override; + int columnCount(const QModelIndex& ={}) const override; + QVariant data(const QModelIndex& index, int role) const override; + QVariant headerData(int col, Qt::Orientation, int role) const; + + void sort(int colIndex, Qt::SortOrder order=Qt::AscendingOrder); + void add(ConflictItem item); + + void finished(); + + const ConflictItem* getItem(std::size_t row) const; + +private: + QTreeView* m_tree; + std::vector<Column> m_columns; + std::vector<ConflictItem> m_items; + int m_sortColumn; + Qt::SortOrder m_sortOrder; + + void doSort(); +}; + + +class OverwriteConflictListModel : public ConflictListModel +{ + Q_OBJECT; + +public: + OverwriteConflictListModel(QTreeView* tree); +}; + + +class OverwrittenConflictListModel : public ConflictListModel +{ + Q_OBJECT; + +public: + OverwrittenConflictListModel(QTreeView* tree); +}; + + +class NoConflictListModel : public ConflictListModel +{ + Q_OBJECT; + +public: + NoConflictListModel(QTreeView* tree); +}; + + +class AdvancedConflictListModel : public ConflictListModel +{ + Q_OBJECT; + +public: + AdvancedConflictListModel(QTreeView* tree); +}; |
