From de27ab391f5c56db9532e7cbc32145d21e5df97c Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 4 Apr 2013 21:49:44 +0200 Subject: - creating mods from overwrite - moving files from overwrite to mods - offline mode - several fixes to the grouping system - fix to "duplicate translation" errors --- src/modlistsortproxy.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/modlistsortproxy.cpp') 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); -- cgit v1.3.1