summaryrefslogtreecommitdiff
path: root/src/modlistbypriorityproxy.h
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2022-05-17 11:47:01 +0200
committerMikaël Capelle <capelle.mikael@gmail.com>2023-07-09 17:20:40 +0200
commitd13f6bb870cdda71257f665367be8ef9fca86255 (patch)
tree52e214718478f1e52856572f5aa1a2ac58537f9f /src/modlistbypriorityproxy.h
parent86bb01ba9eac879d3685c439ac9da0028bc4bc80 (diff)
Apply clang-format.
Diffstat (limited to 'src/modlistbypriorityproxy.h')
-rw-r--r--src/modlistbypriorityproxy.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/modlistbypriorityproxy.h b/src/modlistbypriorityproxy.h
index 0629bef7..5617d222 100644
--- a/src/modlistbypriorityproxy.h
+++ b/src/modlistbypriorityproxy.h
@@ -6,11 +6,11 @@
#include <vector>
#include <QAbstractProxyModel>
+#include <QIcon>
#include <QModelIndex>
#include <QMultiHash>
-#include <QStringList>
-#include <QIcon>
#include <QSet>
+#include <QStringList>
#include "modinfo.h"
#include "modlistview.h"
@@ -24,7 +24,8 @@ class ModListByPriorityProxy : public QAbstractProxyModel
Q_OBJECT
public:
- explicit ModListByPriorityProxy(Profile* profile, OrganizerCore& core, QObject* parent = nullptr);
+ explicit ModListByPriorityProxy(Profile* profile, OrganizerCore& core,
+ QObject* parent = nullptr);
~ModListByPriorityProxy();
void setProfile(Profile* profile);
@@ -37,29 +38,35 @@ public:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
- QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
+ QModelIndex index(int row, int column,
+ const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& index) const override;
bool hasChildren(const QModelIndex& parent) const override;
- bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const override;
- bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
+ bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row,
+ int column, const QModelIndex& parent) const override;
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
+ const QModelIndex& parent) override;
QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override;
QModelIndex mapToSource(const QModelIndex& proxyIndex) const override;
public slots:
- void onDropEnter(const QMimeData* data, bool dropExpanded, ModListView::DropPosition dropPosition);
+ void onDropEnter(const QMimeData* data, bool dropExpanded,
+ ModListView::DropPosition dropPosition);
protected slots:
void onModelRowsRemoved(const QModelIndex& parent, int first, int last);
- void onModelLayoutChanged(const QList<QPersistentModelIndex>& parents = {}, LayoutChangeHint hint = LayoutChangeHint::NoLayoutChangeHint);
+ void
+ onModelLayoutChanged(const QList<QPersistentModelIndex>& parents = {},
+ LayoutChangeHint hint = LayoutChangeHint::NoLayoutChangeHint);
void onModelReset();
- void onModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles = QVector<int>());
+ void onModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight,
+ const QVector<int>& roles = QVector<int>());
private:
-
// fill the mapping from index to item (required by buildTree), should
// only be used for full model reset because it destroys existing references
// to tree items
@@ -71,13 +78,15 @@ private:
//
void buildTree();
- struct TreeItem {
+ struct TreeItem
+ {
ModInfo::Ptr mod;
unsigned int index;
std::vector<TreeItem*> children;
TreeItem* parent;
- std::size_t childIndex(TreeItem* child) const {
+ std::size_t childIndex(TreeItem* child) const
+ {
for (std::size_t i = 0; i < children.size(); ++i) {
if (children[i] == child) {
return i;
@@ -86,9 +95,10 @@ private:
return -1;
}
- TreeItem() : TreeItem(nullptr, -1) { }
- TreeItem(ModInfo::Ptr mod, unsigned int index, TreeItem* parent = nullptr) :
- mod(mod), index(index), parent(parent) { }
+ TreeItem() : TreeItem(nullptr, -1) {}
+ TreeItem(ModInfo::Ptr mod, unsigned int index, TreeItem* parent = nullptr)
+ : mod(mod), index(index), parent(parent)
+ {}
};
TreeItem m_Root;
@@ -98,9 +108,9 @@ private:
OrganizerCore& m_core;
Profile* m_profile;
- Qt::SortOrder m_sortOrder = Qt::AscendingOrder;
- bool m_dropExpanded = false;
+ Qt::SortOrder m_sortOrder = Qt::AscendingOrder;
+ bool m_dropExpanded = false;
ModListView::DropPosition m_dropPosition = ModListView::DropPosition::OnItem;
};
-#endif //GROUPINGPROXY_H
+#endif // GROUPINGPROXY_H