summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-11 18:58:24 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-11 19:05:22 +0200
commit7e78a422e8bb22572706b7fadb58fc45e7b8a7db (patch)
treee91e2aa3364d1a5cb8329a6b7e49b7a46e720ab5 /gui
parente5dc113bfceb1e9b52535b7d1abd6f0ec51e1332 (diff)
downloadMultiMC-7e78a422e8bb22572706b7fadb58fc45e7b8a7db.tar
MultiMC-7e78a422e8bb22572706b7fadb58fc45e7b8a7db.tar.gz
MultiMC-7e78a422e8bb22572706b7fadb58fc45e7b8a7db.tar.lz
MultiMC-7e78a422e8bb22572706b7fadb58fc45e7b8a7db.tar.xz
MultiMC-7e78a422e8bb22572706b7fadb58fc45e7b8a7db.zip
Version filtering and general related code sanitization.
Version list dialog has alternating row background set. Nostalgia versions, based on OneSix.
Diffstat (limited to 'gui')
-rw-r--r--gui/mainwindow.cpp2
-rw-r--r--gui/newinstancedialog.cpp13
-rw-r--r--gui/newinstancedialog.h10
-rw-r--r--gui/versionselectdialog.cpp10
-rw-r--r--gui/versionselectdialog.h4
-rw-r--r--gui/versionselectdialog.ui3
6 files changed, 19 insertions, 23 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index bed2b35f..6187de93 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -534,7 +534,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
VersionSelectDialog vselect(inst->versionList(), this);
if (vselect.exec() && vselect.selectedVersion())
{
- inst->setIntendedVersionId(vselect.selectedVersion()->descriptor());
+ inst->setIntendedVersionId(vselect.selectedVersion()->descriptor);
}
}
diff --git a/gui/newinstancedialog.cpp b/gui/newinstancedialog.cpp
index 38fbc2e3..4f19e9a2 100644
--- a/gui/newinstancedialog.cpp
+++ b/gui/newinstancedialog.cpp
@@ -37,8 +37,6 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewInstanceDialog)
{
- m_selectedVersion = NULL;
-
ui->setupUi(this);
resize(minimumSizeHint());
layout()->setSizeConstraint(QLayout::SetFixedSize);
@@ -64,17 +62,16 @@ NewInstanceDialog::~NewInstanceDialog()
void NewInstanceDialog::updateDialogState()
{
- ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
- !instName().isEmpty() && m_selectedVersion);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty() && m_selectedVersion);
}
-void NewInstanceDialog::setSelectedVersion(const InstVersion *version)
+void NewInstanceDialog::setSelectedVersion(InstVersionPtr version)
{
m_selectedVersion = version;
if (m_selectedVersion)
{
- ui->versionTextBox->setText(version->name());
+ ui->versionTextBox->setText(version->name);
}
else
{
@@ -94,7 +91,7 @@ QString NewInstanceDialog::iconKey() const
return InstIconKey;
}
-const InstVersion *NewInstanceDialog::selectedVersion() const
+InstVersionPtr NewInstanceDialog::selectedVersion() const
{
return m_selectedVersion;
}
@@ -105,7 +102,7 @@ void NewInstanceDialog::on_btnChangeVersion_clicked()
vselect.exec();
if (vselect.result() == QDialog::Accepted)
{
- const InstVersion *version = vselect.selectedVersion();
+ InstVersionPtr version = vselect.selectedVersion();
if (version)
setSelectedVersion(version);
}
diff --git a/gui/newinstancedialog.h b/gui/newinstancedialog.h
index 3e99c76a..07267e19 100644
--- a/gui/newinstancedialog.h
+++ b/gui/newinstancedialog.h
@@ -17,9 +17,7 @@
#define NEWINSTANCEDIALOG_H
#include <QDialog>
-
-class InstanceTypeInterface;
-class InstVersion;
+#include "InstanceVersion.h"
namespace Ui {
class NewInstanceDialog;
@@ -35,13 +33,13 @@ public:
void updateDialogState();
- void setSelectedVersion(const InstVersion *version);
+ void setSelectedVersion(InstVersionPtr version);
void loadVersionList();
QString instName() const;
QString iconKey() const;
- const InstVersion *selectedVersion() const;
+ InstVersionPtr selectedVersion() const;
private slots:
void on_btnChangeVersion_clicked();
@@ -51,7 +49,7 @@ private slots:
private:
Ui::NewInstanceDialog *ui;
- const InstVersion *m_selectedVersion;
+ InstVersionPtr m_selectedVersion;
QString InstIconKey;
};
diff --git a/gui/versionselectdialog.cpp b/gui/versionselectdialog.cpp
index b3a14db1..33aedc71 100644
--- a/gui/versionselectdialog.cpp
+++ b/gui/versionselectdialog.cpp
@@ -68,13 +68,11 @@ void VersionSelectDialog::loadList()
taskDlg->exec(loadTask);
}
-const InstVersion *VersionSelectDialog::selectedVersion() const
+InstVersionPtr VersionSelectDialog::selectedVersion() const
{
- const InstVersion *versionPtr = (const InstVersion *)
- m_proxyModel->data(ui->listView->selectionModel()->currentIndex(),
- InstVersionList::VersionPointerRole).value<void *>();
-
- return versionPtr;
+ auto currentIndex = ui->listView->selectionModel()->currentIndex();
+ auto variant = m_proxyModel->data(currentIndex, InstVersionList::VersionPointerRole);
+ return variant.value<InstVersionPtr>();
}
void VersionSelectDialog::on_refreshButton_clicked()
diff --git a/gui/versionselectdialog.h b/gui/versionselectdialog.h
index 0f45d8e5..752c937b 100644
--- a/gui/versionselectdialog.h
+++ b/gui/versionselectdialog.h
@@ -19,9 +19,9 @@
#include <QDialog>
#include <QSortFilterProxyModel>
+#include <InstanceVersion.h>
class InstVersionList;
-class InstVersion;
namespace Ui
{
@@ -41,7 +41,7 @@ public:
//! Starts a task that loads the list.
void loadList();
- const InstVersion *selectedVersion() const;
+ InstVersionPtr selectedVersion() const;
private slots:
void on_refreshButton_clicked();
diff --git a/gui/versionselectdialog.ui b/gui/versionselectdialog.ui
index 5cb0ebad..02937794 100644
--- a/gui/versionselectdialog.ui
+++ b/gui/versionselectdialog.ui
@@ -19,6 +19,9 @@
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>