* 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:
Petr Mrázek
2014-11-08 21:17:28 +01:00
parent 7d1dd2a32f
commit 992ba0c3f8
8 changed files with 120 additions and 14 deletions

View File

@ -751,6 +751,8 @@ void MainWindow::on_actionAddInstance_triggered()
if (!newInstDlg.exec())
return;
MMC->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup());
InstancePtr newInstance;
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
@ -764,10 +766,14 @@ void MainWindow::on_actionAddInstance_triggered()
switch (error)
{
case InstanceFactory::NoCreateError:
{
newInstance->setName(newInstDlg.instName());
newInstance->setIconKey(newInstDlg.iconKey());
newInstance->setGroupInitial(newInstDlg.instGroup());
MMC->instances()->add(InstancePtr(newInstance));
stringToIntList(MMC->settings()->get("ShownNotifications").toString());
break;
}
case InstanceFactory::InstExists:
{
@ -836,6 +842,7 @@ void MainWindow::on_actionCopyInstance_triggered()
{
case InstanceFactory::NoCreateError:
newInstance->setName(copyInstDlg.instName());
newInstance->setGroupInitial(copyInstDlg.instGroup());
newInstance->setIconKey(copyInstDlg.iconKey());
MMC->instances()->add(newInstance);
return;