summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-11-04 00:11:20 +0100
committerPetr Mrázek <peterix@gmail.com>2013-11-04 00:11:20 +0100
commitd6e4fb29713d6ce55b092c0e22412f6121e7f516 (patch)
treece4c2c3a2786bdbb9752c26d6feaab3735ba9bd6 /gui
parent44669290747b1d254d10c130e4e728051c8c4c5d (diff)
downloadMultiMC-d6e4fb29713d6ce55b092c0e22412f6121e7f516.tar
MultiMC-d6e4fb29713d6ce55b092c0e22412f6121e7f516.tar.gz
MultiMC-d6e4fb29713d6ce55b092c0e22412f6121e7f516.tar.lz
MultiMC-d6e4fb29713d6ce55b092c0e22412f6121e7f516.tar.xz
MultiMC-d6e4fb29713d6ce55b092c0e22412f6121e7f516.zip
Implement instance sorting options.
Diffstat (limited to 'gui')
-rw-r--r--gui/mainwindow.cpp7
-rw-r--r--gui/settingsdialog.cpp27
2 files changed, 32 insertions, 2 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index fd086f11..20a2b84b 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -129,8 +129,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
view->installEventFilter(this);
proxymodel = new InstanceProxyModel(this);
- proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
- proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
+// proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
+ //proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
// proxymodel->setDynamicSortFilter ( true );
// FIXME: instList should be global-ish, or at least not tied to the main window...
@@ -420,6 +420,9 @@ void MainWindow::on_actionSettings_triggered()
{
SettingsDialog dialog(this);
dialog.exec();
+ //FIXME: quick HACK to make this work. improve, optimize.
+ proxymodel->invalidate();
+ proxymodel->sort(0);
}
void MainWindow::on_actionReportBug_triggered()
diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp
index 703ade31..bf331fc0 100644
--- a/gui/settingsdialog.cpp
+++ b/gui/settingsdialog.cpp
@@ -33,6 +33,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
+ ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name);
+ ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch);
loadSettings(MMC->settings().get());
updateCheckboxStuff();
@@ -165,6 +167,20 @@ void SettingsDialog::applySettings(SettingsObject *s)
// Custom Commands
s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text());
s->set("PostExitCommand", ui->postExitCmdTextBox->text());
+
+ auto sortMode = (InstSortMode) ui->sortingModeGroup->checkedId();
+ switch(sortMode)
+ {
+ case Sort_LastLaunch:
+ s->set("InstSortMode", "LastLaunch");
+ break;
+ case Sort_Name:
+ default:
+ s->set("InstSortMode", "Name");
+ break;
+ }
+
+ s->set("PostExitCommand", ui->postExitCmdTextBox->text());
}
void SettingsDialog::loadSettings(SettingsObject *s)
@@ -195,6 +211,17 @@ void SettingsDialog::loadSettings(SettingsObject *s)
ui->maxMemSpinBox->setValue(s->get("MaxMemAlloc").toInt());
ui->permGenSpinBox->setValue(s->get("PermGen").toInt());
+ QString sortMode = s->get("InstSortMode").toString();
+
+ if(sortMode == "LastLaunch")
+ {
+ ui->sortLastLaunchedBtn->setChecked(true);
+ }
+ else
+ {
+ ui->sortByNameBtn->setChecked(true);
+ }
+
// Java Settings
ui->javaPathTextBox->setText(s->get("JavaPath").toString());
ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString());