mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-30 18:36:58 +03:00
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
This commit is contained in:
parent
7d1dd2a32f
commit
992ba0c3f8
8 changed files with 120 additions and 14 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue