summaryrefslogtreecommitdiff
path: root/src/modlistsortproxy.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-04-04 21:49:44 +0200
committerTannin <devnull@localhost>2013-04-04 21:49:44 +0200
commitde27ab391f5c56db9532e7cbc32145d21e5df97c (patch)
tree349ad259558322936381297a77b207c65ed87de3 /src/modlistsortproxy.cpp
parentd9a6dbb916236531a96b9b84b06e7be666c05d56 (diff)
- creating mods from overwrite
- moving files from overwrite to mods - offline mode - several fixes to the grouping system - fix to "duplicate translation" errors
Diffstat (limited to 'src/modlistsortproxy.cpp')
-rw-r--r--src/modlistsortproxy.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index 071e0384..11b3f69a 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -57,21 +57,20 @@ void ModListSortProxy::setCategoryFilter(int category)
this->invalidate();
}
-
Qt::ItemFlags ModListSortProxy::flags(const QModelIndex &modelIndex) const
{
Qt::ItemFlags flags = sourceModel()->flags(mapToSource(modelIndex));
if (sortColumn() != ModList::COL_PRIORITY) {
flags &= ~Qt::ItemIsDragEnabled;
}
+
return flags;
}
-
void ModListSortProxy::displayColumnSelection(const QPoint &pos)
{
- QMenu menu;
+ QMenu menu;
for (int i = 0; i <= ModList::COL_LASTCOLUMN; ++i) {
QCheckBox *checkBox = new QCheckBox(&menu);
@@ -105,7 +104,7 @@ void ModListSortProxy::enableAllVisible()
if (m_Profile == NULL) return;
for (int i = 0; i < this->rowCount(); ++i) {
- int modID = mapToSource(index(i, 0)).row();
+ int modID = mapToSource(index(i, 0)).data(Qt::UserRole + 1).toInt();
m_Profile->setModEnabled(modID, true);
}
invalidate();
@@ -115,18 +114,25 @@ void ModListSortProxy::enableAllVisible()
void ModListSortProxy::disableAllVisible()
{
if (m_Profile == NULL) return;
+
for (int i = 0; i < this->rowCount(); ++i) {
- int modID = mapToSource(index(i, 0)).row();
+ int modID = mapToSource(index(i, 0)).data(Qt::UserRole + 1).toInt();
m_Profile->setModEnabled(modID, false);
}
+ invalidate();
}
bool ModListSortProxy::lessThan(const QModelIndex &left,
const QModelIndex &right) const
{
- int leftIndex = left.row();
- int rightIndex = right.row();
+ bool lOk, rOk;
+ int leftIndex = left.data(Qt::UserRole + 1).toInt(&lOk);
+ int rightIndex = right.data(Qt::UserRole + 1).toInt(&rOk);
+ if (!lOk || !rOk) {
+ return false;
+ }
+
ModInfo::Ptr leftMod = ModInfo::getByIndex(leftIndex);
ModInfo::Ptr rightMod = ModInfo::getByIndex(rightIndex);