From ae4939e0d2e8774b823865cce0a8e822d04673a5 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Mon, 25 Oct 2021 23:51:42 +0200 Subject: GH-4164 Assign instances to groups using drag & drop --- launcher/InstanceProxyModel.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 launcher/InstanceProxyModel.cpp (limited to 'launcher/InstanceProxyModel.cpp') 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 -#include - -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(left.internalPointer()); - BaseInstance *pdataRight = static_cast(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; - } -} -- cgit