diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-10-25 23:51:42 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-10-25 23:51:42 +0200 |
commit | ae4939e0d2e8774b823865cce0a8e822d04673a5 (patch) | |
tree | 921873298ec1d39cedb68e1d64c3340122620a93 /launcher/InstanceProxyModel.cpp | |
parent | 85ecbad46755d42e3e0682dfe24e587ee3157565 (diff) | |
download | PrismLauncher-ae4939e0d2e8774b823865cce0a8e822d04673a5.tar.gz PrismLauncher-ae4939e0d2e8774b823865cce0a8e822d04673a5.tar.bz2 PrismLauncher-ae4939e0d2e8774b823865cce0a8e822d04673a5.zip |
GH-4164 Assign instances to groups using drag & drop
Diffstat (limited to 'launcher/InstanceProxyModel.cpp')
-rw-r--r-- | launcher/InstanceProxyModel.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/launcher/InstanceProxyModel.cpp b/launcher/InstanceProxyModel.cpp deleted file mode 100644 index 9ee38a65..00000000 --- a/launcher/InstanceProxyModel.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "InstanceProxyModel.h" -#include "Launcher.h" -#include <BaseInstance.h> -#include <icons/IconList.h> - -InstanceProxyModel::InstanceProxyModel(QObject *parent) : GroupedProxyModel(parent) -{ - m_naturalSort.setNumericMode(true); - m_naturalSort.setCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive); - // FIXME: use loaded translation as source of locale instead, hook this up to translation changes - m_naturalSort.setLocale(QLocale::system()); -} - -QVariant InstanceProxyModel::data(const QModelIndex & index, int role) const -{ - QVariant data = QSortFilterProxyModel::data(index, role); - if(role == Qt::DecorationRole) - { - return QVariant(LAUNCHER->icons()->getIcon(data.toString())); - } - return data; -} - -bool InstanceProxyModel::subSortLessThan(const QModelIndex &left, - const QModelIndex &right) const -{ - BaseInstance *pdataLeft = static_cast<BaseInstance *>(left.internalPointer()); - BaseInstance *pdataRight = static_cast<BaseInstance *>(right.internalPointer()); - QString sortMode = LAUNCHER->settings()->get("InstSortMode").toString(); - if (sortMode == "LastLaunch") - { - return pdataLeft->lastLaunch() > pdataRight->lastLaunch(); - } - else - { - return m_naturalSort.compare(pdataLeft->name(), pdataRight->name()) < 0; - } -} |