summaryrefslogtreecommitdiff
path: root/src/modconflicticondelegate.h
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-10 10:25:37 +0100
committerGitHub <noreply@github.com>2021-01-10 10:25:37 +0100
commit80e44a9e3ade61695b4807a3a900d2866138ecac (patch)
tree1ef9904664d8d34dba6692bbf5325aea8c199d08 /src/modconflicticondelegate.h
parenteaec140f7c823012c09536175d8917dddcacdb7c (diff)
parent4a0ce804ea486744e5f6140a0ce4538d99e21ce3 (diff)
Merge pull request #1338 from Holt59/collapsible-separators
Collapsible separators (and refactoring).
Diffstat (limited to 'src/modconflicticondelegate.h')
-rw-r--r--src/modconflicticondelegate.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/modconflicticondelegate.h b/src/modconflicticondelegate.h
index 8645da12..a44ce89b 100644
--- a/src/modconflicticondelegate.h
+++ b/src/modconflicticondelegate.h
@@ -1,33 +1,49 @@
#ifndef MODCONFLICTICONDELEGATE_H
#define MODCONFLICTICONDELEGATE_H
+#include <array>
+
#include "icondelegate.h"
+class ModListView;
+
class ModConflictIconDelegate : public IconDelegate
{
Q_OBJECT;
public:
- explicit ModConflictIconDelegate(QObject *parent = 0, int logicalIndex = -1, int compactSize = 80);
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
- static QList<QString> getIconsForFlags(
- std::vector<ModInfo::EConflictFlag> flags, bool compact);
-
- static QString getFlagIcon(ModInfo::EConflictFlag flag);
+ explicit ModConflictIconDelegate(ModListView* parent = nullptr, int logicalIndex = -1, int compactSize = 80);
+ QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex &index) const override;
public slots:
void columnResized(int logicalIndex, int oldSize, int newSize);
protected:
- virtual QList<QString> getIcons(const QModelIndex &index) const;
- virtual size_t getNumIcons(const QModelIndex &index) const;
+
+ static QList<QString> getIconsForFlags(std::vector<ModInfo::EConflictFlag> flags, bool compact);
+ static QString getFlagIcon(ModInfo::EConflictFlag flag);
+
+ QList<QString> getIcons(const QModelIndex &index) const override;
+ size_t getNumIcons(const QModelIndex &index) const override;
private:
- static ModInfo::EConflictFlag m_ConflictFlags[4];
- static ModInfo::EConflictFlag m_ArchiveLooseConflictFlags[2];
- static ModInfo::EConflictFlag m_ArchiveConflictFlags[3];
+ static constexpr std::array s_ConflictFlags{
+ ModInfo::FLAG_CONFLICT_MIXED,
+ ModInfo::FLAG_CONFLICT_OVERWRITE,
+ ModInfo::FLAG_CONFLICT_OVERWRITTEN,
+ ModInfo::FLAG_CONFLICT_REDUNDANT
+ };
+ static constexpr std::array s_ArchiveLooseConflictFlags{
+ ModInfo::FLAG_ARCHIVE_LOOSE_CONFLICT_OVERWRITE,
+ ModInfo::FLAG_ARCHIVE_LOOSE_CONFLICT_OVERWRITTEN
+ };
+ static constexpr std::array s_ArchiveConflictFlags{
+ ModInfo::FLAG_ARCHIVE_CONFLICT_MIXED,
+ ModInfo::FLAG_ARCHIVE_CONFLICT_OVERWRITE,
+ ModInfo::FLAG_ARCHIVE_CONFLICT_OVERWRITTEN
+ };
+ ModListView* m_View;
int m_LogicalIndex;
int m_CompactSize;
bool m_Compact;