diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp index 886075624..92353da10 100644 --- a/launcher/BaseInstance.cpp +++ b/launcher/BaseInstance.cpp @@ -336,6 +336,7 @@ bool BaseInstance::updateInstanceRoot(QWidget* parent) return false; auto oldRoot = instanceRoot(); + auto oldName = QFileInfo(oldRoot).baseName(); auto newRoot = FS::PathCombine(QFileInfo(oldRoot).dir().absolutePath(), name()); if (oldRoot == newRoot) return false; @@ -350,11 +351,8 @@ bool BaseInstance::updateInstanceRoot(QWidget* parent) // Ask if we should rename if (renamingMode == "AskEverytime") { QMessageBox messageBox(parent); - messageBox.setText(tr("Do you want to also rename the instance\'s physical directory?")); - messageBox.setInformativeText(tr("The following renaming operation will be performed:
" - " - Old instance root: %1
" - " - New instance root: %2") - .arg(oldRoot, newRoot)); + messageBox.setText(tr("Would you also like to rename the instance folder?")); + messageBox.setInformativeText(tr("Renaming \'%1\' -> \'%2\'").arg(oldName, name())); messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); messageBox.setDefaultButton(QMessageBox::Yes); messageBox.setIcon(QMessageBox::Question); diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index db37d548a..d89a65a85 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -67,17 +67,20 @@ enum InstSortMode { enum InstRenamingMode { // Rename metadata only. - Rename_Metadata, - // Rename physical directory too. - Rename_Physical, + Rename_Always, // Ask everytime. - Rename_Ask + Rename_Ask, + // Rename physical directory too. + Rename_Never }; LauncherPage::LauncherPage(QWidget* parent) : QWidget(parent), ui(new Ui::LauncherPage) { ui->setupUi(this); + ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name); + ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch); + defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat()); m_languageModel = APPLICATION->translations(); @@ -241,7 +244,7 @@ void LauncherPage::applySettings() s->set("MoveModsFromDownloadsDir", ui->downloadsDirMoveCheckBox->isChecked()); // Instance - auto sortMode = (InstSortMode)ui->viewSortingComboBox->currentIndex(); + auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId(); switch (sortMode) { case Sort_LastLaunch: s->set("InstSortMode", "LastLaunch"); @@ -254,10 +257,10 @@ void LauncherPage::applySettings() auto renamingMode = (InstRenamingMode)ui->renamingBehaviorComboBox->currentIndex(); switch (renamingMode) { - case Rename_Metadata: + case Rename_Always: s->set("InstRenamingMode", "MetadataOnly"); break; - case Rename_Physical: + case Rename_Never: s->set("InstRenamingMode", "PhysicalDir"); break; case Rename_Ask: @@ -322,20 +325,18 @@ void LauncherPage::loadSettings() // Instance QString sortMode = s->get("InstSortMode").toString(); - InstSortMode sortModeEnum; if (sortMode == "LastLaunch") { - sortModeEnum = Sort_LastLaunch; + ui->sortLastLaunchedBtn->setChecked(true); } else { - sortModeEnum = Sort_Name; + ui->sortByNameBtn->setChecked(true); } - ui->viewSortingComboBox->setCurrentIndex(sortModeEnum); QString renamingMode = s->get("InstRenamingMode").toString(); InstRenamingMode renamingModeEnum; if (renamingMode == "MetadataOnly") { - renamingModeEnum = Rename_Metadata; + renamingModeEnum = Rename_Always; } else if (renamingMode == "PhysicalDir") { - renamingModeEnum = Rename_Physical; + renamingModeEnum = Rename_Never; } else { renamingModeEnum = Rename_Ask; } diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index c1ba1d428..7942f4f4f 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -112,40 +112,76 @@ Folders - - + + - &Downloads: + I&nstances: - downloadsDirTextBox + instDirTextBox - - + + + + + Browse - - - - - - - - + + + - &Skins: - - - skinsDirTextBox + Rename instance folders + + + + + Never + + + + + Ask + + + + + Always + + + + + + + + &Mods: + + + modsDirTextBox + + + + + + + + + + Browse + + + + + &Icons: @@ -155,7 +191,81 @@ - + + + + + + + Browse + + + + + + + + &Java: + + + javaDirTextBox + + + + + + + + + + Browse + + + + + + + + &Skins: + + + skinsDirTextBox + + + + + + + + + + Browse + + + + + + + + &Downloads: + + + downloadsDirTextBox + + + + + + + + + + Browse + + + + + @@ -179,83 +289,6 @@ - - - - - - - &Java: - - - javaDirTextBox - - - - - - - &Mods: - - - modsDirTextBox - - - - - - - - - - - - - - - - Browse - - - - - - - Browse - - - - - - - Browse - - - - - - - I&nstances: - - - instDirTextBox - - - - - - - Browse - - - - - - - Browse - - - @@ -401,59 +434,32 @@ - + true - Instance + Instance view sorting mode - - - + + + - Instance view sorting mode + &By last launched + + sortingModeGroup + - - - - - By last launched - - - - - By name - - - - - - + + - Instance renaming behavior + By &name - - - - - - - Rename metadata only - - - - - Rename physical directory - - - - - Ask everytime - - + + sortingModeGroup + @@ -701,6 +707,8 @@ numberOfConcurrentDownloadsSpinBox numberOfManualRetriesSpinBox timeoutSecondsSpinBox + sortLastLaunchedBtn + sortByNameBtn catOpacitySpinBox preferMenuBarCheckBox lineLimitSpinBox @@ -711,4 +719,7 @@ + + + \ No newline at end of file