summaryrefslogtreecommitdiffstats
path: root/gui/dialogs
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-11-08 21:17:28 +0100
committerPetr Mrázek <peterix@gmail.com>2014-11-08 21:17:28 +0100
commit992ba0c3f8ae65d25503b74c62c3cdf4668635d3 (patch)
tree26c3b08e466f74231bf5b0e0bb6aca0123bd83ab /gui/dialogs
parent7d1dd2a32f95eacaaea7d808cd07faf99e425977 (diff)
downloadMultiMC-992ba0c3f8ae65d25503b74c62c3cdf4668635d3.tar
MultiMC-992ba0c3f8ae65d25503b74c62c3cdf4668635d3.tar.gz
MultiMC-992ba0c3f8ae65d25503b74c62c3cdf4668635d3.tar.lz
MultiMC-992ba0c3f8ae65d25503b74c62c3cdf4668635d3.tar.xz
MultiMC-992ba0c3f8ae65d25503b74c62c3cdf4668635d3.zip
Implement #545
* Instance group can be selected when creating and copying instances * Original group is pre-selected when copying * Last used group is pre-selected when creating new instances
Diffstat (limited to 'gui/dialogs')
-rw-r--r--gui/dialogs/CopyInstanceDialog.cpp19
-rw-r--r--gui/dialogs/CopyInstanceDialog.h1
-rw-r--r--gui/dialogs/CopyInstanceDialog.ui31
-rw-r--r--gui/dialogs/NewInstanceDialog.cpp22
-rw-r--r--gui/dialogs/NewInstanceDialog.h1
-rw-r--r--gui/dialogs/NewInstanceDialog.ui50
6 files changed, 110 insertions, 14 deletions
diff --git a/gui/dialogs/CopyInstanceDialog.cpp b/gui/dialogs/CopyInstanceDialog.cpp
index de8cf3ce..6625460b 100644
--- a/gui/dialogs/CopyInstanceDialog.cpp
+++ b/gui/dialogs/CopyInstanceDialog.cpp
@@ -30,6 +30,7 @@
#include "logic/icons/IconList.h"
#include "logic/tasks/Task.h"
#include "logic/BaseInstance.h"
+#include <logic/InstanceList.h>
CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
:QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original)
@@ -43,6 +44,19 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
ui->instNameTextBox->setText(original->name());
ui->instNameTextBox->setFocus();
+ auto groups = MMC->instances()->getGroups().toSet();
+ auto groupList = QStringList(groups.toList());
+ groupList.sort(Qt::CaseInsensitive);
+ groupList.removeOne("");
+ groupList.push_front("");
+ ui->groupBox->addItems(groupList);
+ int index = groupList.indexOf(m_original->group());
+ if(index == -1)
+ {
+ index = 0;
+ }
+ ui->groupBox->setCurrentIndex(index);
+ ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
}
CopyInstanceDialog::~CopyInstanceDialog()
@@ -65,6 +79,11 @@ QString CopyInstanceDialog::iconKey() const
return InstIconKey;
}
+QString CopyInstanceDialog::instGroup() const
+{
+ return ui->groupBox->currentText();
+}
+
void CopyInstanceDialog::on_iconButton_clicked()
{
IconPickerDialog dlg(this);
diff --git a/gui/dialogs/CopyInstanceDialog.h b/gui/dialogs/CopyInstanceDialog.h
index a8a4c3e4..0f3a2d48 100644
--- a/gui/dialogs/CopyInstanceDialog.h
+++ b/gui/dialogs/CopyInstanceDialog.h
@@ -37,6 +37,7 @@ public:
void updateDialogState();
QString instName() const;
+ QString instGroup() const;
QString iconKey() const;
private
diff --git a/gui/dialogs/CopyInstanceDialog.ui b/gui/dialogs/CopyInstanceDialog.ui
index 4aa1cb27..2615168c 100644
--- a/gui/dialogs/CopyInstanceDialog.ui
+++ b/gui/dialogs/CopyInstanceDialog.ui
@@ -17,7 +17,7 @@
<string>Copy Instance</string>
</property>
<property name="windowIcon">
- <iconset resource="../../graphics.qrc">
+ <iconset>
<normaloff>:/icons/toolbar/copy</normaloff>:/icons/toolbar/copy</iconset>
</property>
<property name="modal">
@@ -42,7 +42,7 @@
<item>
<widget class="QToolButton" name="iconButton">
<property name="icon">
- <iconset resource="../../graphics.qrc">
+ <iconset>
<normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
</property>
<property name="iconSize">
@@ -83,6 +83,33 @@
</widget>
</item>
<item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelVersion_3">
+ <property name="text">
+ <string>Group</string>
+ </property>
+ <property name="buddy">
+ <cstring>groupBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QComboBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/gui/dialogs/NewInstanceDialog.cpp b/gui/dialogs/NewInstanceDialog.cpp
index 721d7931..aeaa7e4a 100644
--- a/gui/dialogs/NewInstanceDialog.cpp
+++ b/gui/dialogs/NewInstanceDialog.cpp
@@ -22,6 +22,7 @@
#include "logic/icons/IconList.h"
#include "logic/minecraft/MinecraftVersionList.h"
#include "logic/tasks/Task.h"
+#include <logic/InstanceList.h>
#include "gui/Platform.h"
#include "VersionSelectDialog.h"
@@ -41,6 +42,21 @@ NewInstanceDialog::NewInstanceDialog(QWidget *parent)
setSelectedVersion(MMC->minecraftlist()->getLatestStable(), true);
InstIconKey = "infinity";
ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey));
+ auto groups = MMC->instances()->getGroups().toSet();
+ auto groupList = QStringList(groups.toList());
+ groupList.sort(Qt::CaseInsensitive);
+ groupList.removeOne("");
+ QString oldValue = MMC->settings()->get("LastUsedGroupForNewInstance").toString();
+ groupList.push_front(oldValue);
+ groupList.push_front("");
+ ui->groupBox->addItems(groupList);
+ int index = groupList.indexOf(oldValue);
+ if(index == -1)
+ {
+ index = 0;
+ }
+ ui->groupBox->setCurrentIndex(index);
+ ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
}
NewInstanceDialog::~NewInstanceDialog()
@@ -79,6 +95,11 @@ QString NewInstanceDialog::instName() const
return ui->instNameTextBox->text();
}
+QString NewInstanceDialog::instGroup() const
+{
+ return ui->groupBox->currentText();
+}
+
QString NewInstanceDialog::iconKey() const
{
return InstIconKey;
@@ -118,3 +139,4 @@ void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
{
updateDialogState();
}
+
diff --git a/gui/dialogs/NewInstanceDialog.h b/gui/dialogs/NewInstanceDialog.h
index 90c85144..83cd78b3 100644
--- a/gui/dialogs/NewInstanceDialog.h
+++ b/gui/dialogs/NewInstanceDialog.h
@@ -39,6 +39,7 @@ public:
void loadVersionList();
QString instName() const;
+ QString instGroup() const;
QString iconKey() const;
BaseVersionPtr selectedVersion() const;
diff --git a/gui/dialogs/NewInstanceDialog.ui b/gui/dialogs/NewInstanceDialog.ui
index 00544463..be4642aa 100644
--- a/gui/dialogs/NewInstanceDialog.ui
+++ b/gui/dialogs/NewInstanceDialog.ui
@@ -9,15 +9,15 @@
<rect>
<x>0</x>
<y>0</y>
- <width>220</width>
- <height>234</height>
+ <width>345</width>
+ <height>261</height>
</rect>
</property>
<property name="windowTitle">
<string>New Instance</string>
</property>
<property name="windowIcon">
- <iconset resource="../../graphics.qrc">
+ <iconset>
<normaloff>:/icons/toolbar/new</normaloff>:/icons/toolbar/new</iconset>
</property>
<property name="modal">
@@ -42,7 +42,7 @@
<item>
<widget class="QToolButton" name="iconButton">
<property name="icon">
- <iconset resource="../../graphics.qrc">
+ <iconset>
<normaloff>:/icons/instances/infinity</normaloff>:/icons/instances/infinity</iconset>
</property>
<property name="iconSize">
@@ -83,25 +83,51 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="labelVersion">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="2">
+ <widget class="QToolButton" name="btnChangeVersion">
<property name="text">
- <string>Version:</string>
+ <string>...</string>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="1">
<widget class="QLineEdit" name="versionTextBox">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="btnChangeVersion">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelVersion">
<property name="text">
- <string>...</string>
+ <string>Version:</string>
+ </property>
+ <property name="buddy">
+ <cstring>versionTextBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelVersion_3">
+ <property name="text">
+ <string>Group:</string>
+ </property>
+ <property name="buddy">
+ <cstring>groupBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QComboBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
</property>
</widget>
</item>