mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-30 14:44:31 +02:00
Adjust instance view sorting mode to QComboBox and add renaming behavior
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
1c0c247631
commit
0da645594f
@ -709,7 +709,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
|
|
||||||
m_settings->registerSetting("ToolbarsLocked", false);
|
m_settings->registerSetting("ToolbarsLocked", false);
|
||||||
|
|
||||||
|
// Instance
|
||||||
m_settings->registerSetting("InstSortMode", "Name");
|
m_settings->registerSetting("InstSortMode", "Name");
|
||||||
|
m_settings->registerSetting("InstRenamingMode", "AskEverytime");
|
||||||
m_settings->registerSetting("SelectedInstance", QString());
|
m_settings->registerSetting("SelectedInstance", QString());
|
||||||
|
|
||||||
// Window state and geometry
|
// Window state and geometry
|
||||||
|
@ -65,13 +65,19 @@ enum InstSortMode {
|
|||||||
Sort_LastLaunch
|
Sort_LastLaunch
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum InstRenamingMode {
|
||||||
|
// Rename metadata only.
|
||||||
|
Rename_Metadata,
|
||||||
|
// Rename physical directory too.
|
||||||
|
Rename_Physical,
|
||||||
|
// Ask everytime.
|
||||||
|
Rename_Ask
|
||||||
|
};
|
||||||
|
|
||||||
LauncherPage::LauncherPage(QWidget* parent) : QWidget(parent), ui(new Ui::LauncherPage)
|
LauncherPage::LauncherPage(QWidget* parent) : QWidget(parent), ui(new Ui::LauncherPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name);
|
|
||||||
ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch);
|
|
||||||
|
|
||||||
defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat());
|
defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat());
|
||||||
|
|
||||||
m_languageModel = APPLICATION->translations();
|
m_languageModel = APPLICATION->translations();
|
||||||
@ -234,7 +240,8 @@ void LauncherPage::applySettings()
|
|||||||
s->set("DownloadsDirWatchRecursive", ui->downloadsDirWatchRecursiveCheckBox->isChecked());
|
s->set("DownloadsDirWatchRecursive", ui->downloadsDirWatchRecursiveCheckBox->isChecked());
|
||||||
s->set("MoveModsFromDownloadsDir", ui->downloadsDirMoveCheckBox->isChecked());
|
s->set("MoveModsFromDownloadsDir", ui->downloadsDirMoveCheckBox->isChecked());
|
||||||
|
|
||||||
auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId();
|
// Instance
|
||||||
|
auto sortMode = (InstSortMode) ui->viewSortingComboBox->currentIndex();
|
||||||
switch (sortMode) {
|
switch (sortMode) {
|
||||||
case Sort_LastLaunch:
|
case Sort_LastLaunch:
|
||||||
s->set("InstSortMode", "LastLaunch");
|
s->set("InstSortMode", "LastLaunch");
|
||||||
@ -245,6 +252,20 @@ void LauncherPage::applySettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto renamingMode = (InstRenamingMode) ui->renamingBehaviorComboBox->currentIndex();
|
||||||
|
switch (renamingMode) {
|
||||||
|
case Rename_Metadata:
|
||||||
|
s->set("InstRenamingMode", "MetadataOnly");
|
||||||
|
break;
|
||||||
|
case Rename_Physical:
|
||||||
|
s->set("InstRenamingMode", "PhysicalDir");
|
||||||
|
break;
|
||||||
|
case Rename_Ask:
|
||||||
|
default:
|
||||||
|
s->set("InstRenamingMode", "AskEverytime");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Cat
|
// Cat
|
||||||
s->set("CatOpacity", ui->catOpacitySpinBox->value());
|
s->set("CatOpacity", ui->catOpacitySpinBox->value());
|
||||||
|
|
||||||
@ -299,13 +320,26 @@ void LauncherPage::loadSettings()
|
|||||||
ui->downloadsDirWatchRecursiveCheckBox->setChecked(s->get("DownloadsDirWatchRecursive").toBool());
|
ui->downloadsDirWatchRecursiveCheckBox->setChecked(s->get("DownloadsDirWatchRecursive").toBool());
|
||||||
ui->downloadsDirMoveCheckBox->setChecked(s->get("MoveModsFromDownloadsDir").toBool());
|
ui->downloadsDirMoveCheckBox->setChecked(s->get("MoveModsFromDownloadsDir").toBool());
|
||||||
|
|
||||||
|
// Instance
|
||||||
QString sortMode = s->get("InstSortMode").toString();
|
QString sortMode = s->get("InstSortMode").toString();
|
||||||
|
InstSortMode sortModeEnum;
|
||||||
if (sortMode == "LastLaunch") {
|
if (sortMode == "LastLaunch") {
|
||||||
ui->sortLastLaunchedBtn->setChecked(true);
|
sortModeEnum = Sort_LastLaunch;
|
||||||
} else {
|
} else {
|
||||||
ui->sortByNameBtn->setChecked(true);
|
sortModeEnum = Sort_Name;
|
||||||
}
|
}
|
||||||
|
ui->viewSortingComboBox->setCurrentIndex(sortModeEnum);
|
||||||
|
|
||||||
|
QString renamingMode = s->get("InstRenamingMode").toString();
|
||||||
|
InstRenamingMode renamingModeEnum;
|
||||||
|
if (renamingMode == "MetadataOnly") {
|
||||||
|
renamingModeEnum = Rename_Metadata;
|
||||||
|
} else if (renamingMode == "PhysicalDir"){
|
||||||
|
renamingModeEnum = Rename_Physical;
|
||||||
|
} else {
|
||||||
|
renamingModeEnum = Rename_Ask;
|
||||||
|
}
|
||||||
|
ui->renamingBehaviorComboBox->setCurrentIndex(renamingModeEnum);
|
||||||
|
|
||||||
// Cat
|
// Cat
|
||||||
ui->catOpacitySpinBox->setValue(s->get("CatOpacity").toInt());
|
ui->catOpacitySpinBox->setValue(s->get("CatOpacity").toInt());
|
||||||
|
@ -401,32 +401,59 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="sortingModeBox">
|
<widget class="QGroupBox" name="instanceBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Instance view sorting mode</string>
|
<string>Instance</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="sortingModeBoxLayout">
|
<layout class="QGridLayout" name="instanceBoxLayout">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QRadioButton" name="sortLastLaunchedBtn">
|
<widget class="QLabel" name="labelSortingMode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&By last launched</string>
|
<string>Instance view sorting mode</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
|
||||||
<string notr="true">sortingModeGroup</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QRadioButton" name="sortByNameBtn">
|
<widget class="QComboBox" name="viewSortingComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>By last launched</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>By name</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelRenamingBehavior">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>By &name</string>
|
<string>Instance renaming behavior</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
</widget>
|
||||||
<string notr="true">sortingModeGroup</string>
|
</item>
|
||||||
</attribute>
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="renamingBehaviorComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rename metadata only</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rename physical directory</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ask everytime</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -674,7 +701,7 @@
|
|||||||
<tabstop>numberOfConcurrentDownloadsSpinBox</tabstop>
|
<tabstop>numberOfConcurrentDownloadsSpinBox</tabstop>
|
||||||
<tabstop>numberOfManualRetriesSpinBox</tabstop>
|
<tabstop>numberOfManualRetriesSpinBox</tabstop>
|
||||||
<tabstop>timeoutSecondsSpinBox</tabstop>
|
<tabstop>timeoutSecondsSpinBox</tabstop>
|
||||||
<tabstop>sortLastLaunchedBtn</tabstop>
|
<tabstop>sortLastLaunchedComboBox</tabstop>
|
||||||
<tabstop>sortByNameBtn</tabstop>
|
<tabstop>sortByNameBtn</tabstop>
|
||||||
<tabstop>catOpacitySpinBox</tabstop>
|
<tabstop>catOpacitySpinBox</tabstop>
|
||||||
<tabstop>preferMenuBarCheckBox</tabstop>
|
<tabstop>preferMenuBarCheckBox</tabstop>
|
||||||
@ -686,7 +713,4 @@
|
|||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
|
||||||
<buttongroup name="sortingModeGroup"/>
|
|
||||||
</buttongroups>
|
|
||||||
</ui>
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user