aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.cpp100
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.h19
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.ui121
-rw-r--r--launcher/ui/dialogs/ExportInstanceDialog.cpp9
4 files changed, 194 insertions, 55 deletions
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp
index 9ec341bc..3f5122f6 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.cpp
+++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp
@@ -44,7 +44,6 @@
#include "BaseVersion.h"
#include "icons/IconList.h"
-#include "tasks/Task.h"
#include "BaseInstance.h"
#include "InstanceList.h"
@@ -78,8 +77,14 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
}
ui->groupBox->setCurrentIndex(index);
ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
- ui->copySavesCheckbox->setChecked(m_copySaves);
- ui->keepPlaytimeCheckbox->setChecked(m_keepPlaytime);
+ ui->copySavesCheckbox->setChecked(m_selectedOptions.isCopySavesEnabled());
+ ui->keepPlaytimeCheckbox->setChecked(m_selectedOptions.isKeepPlaytimeEnabled());
+ ui->copyGameOptionsCheckbox->setChecked(m_selectedOptions.isCopyGameOptionsEnabled());
+ ui->copyResPacksCheckbox->setChecked(m_selectedOptions.isCopyResourcePacksEnabled());
+ ui->copyShaderPacksCheckbox->setChecked(m_selectedOptions.isCopyShaderPacksEnabled());
+ ui->copyServersCheckbox->setChecked(m_selectedOptions.isCopyServersEnabled());
+ ui->copyModsCheckbox->setChecked(m_selectedOptions.isCopyModsEnabled());
+ ui->copyScreenshotsCheckbox->setChecked(m_selectedOptions.isCopyScreenshotsEnabled());
}
CopyInstanceDialog::~CopyInstanceDialog()
@@ -117,6 +122,31 @@ QString CopyInstanceDialog::instGroup() const
return ui->groupBox->currentText();
}
+const InstanceCopyPrefs& CopyInstanceDialog::getChosenOptions() const
+{
+ return m_selectedOptions;
+}
+
+void CopyInstanceDialog::checkAllCheckboxes(const bool& b)
+{
+ ui->keepPlaytimeCheckbox->setChecked(b);
+ ui->copySavesCheckbox->setChecked(b);
+ ui->copyGameOptionsCheckbox->setChecked(b);
+ ui->copyResPacksCheckbox->setChecked(b);
+ ui->copyShaderPacksCheckbox->setChecked(b);
+ ui->copyServersCheckbox->setChecked(b);
+ ui->copyModsCheckbox->setChecked(b);
+ ui->copyScreenshotsCheckbox->setChecked(b);
+}
+
+// Check the "Select all" checkbox if all options are already selected:
+void CopyInstanceDialog::updateSelectAllCheckbox()
+{
+ ui->selectAllCheckbox->blockSignals(true);
+ ui->selectAllCheckbox->setChecked(m_selectedOptions.allTrue());
+ ui->selectAllCheckbox->blockSignals(false);
+}
+
void CopyInstanceDialog::on_iconButton_clicked()
{
IconPickerDialog dlg(this);
@@ -129,42 +159,64 @@ void CopyInstanceDialog::on_iconButton_clicked()
}
}
+
void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
{
updateDialogState();
}
-bool CopyInstanceDialog::shouldCopySaves() const
+void CopyInstanceDialog::on_selectAllCheckbox_stateChanged(int state)
{
- return m_copySaves;
+ bool checked;
+ checked = (state == Qt::Checked);
+ checkAllCheckboxes(checked);
}
void CopyInstanceDialog::on_copySavesCheckbox_stateChanged(int state)
{
- if(state == Qt::Unchecked)
- {
- m_copySaves = false;
- }
- else if(state == Qt::Checked)
- {
- m_copySaves = true;
- }
+ m_selectedOptions.enableCopySaves(state == Qt::Checked);
+ updateSelectAllCheckbox();
}
-bool CopyInstanceDialog::shouldKeepPlaytime() const
+
+void CopyInstanceDialog::on_keepPlaytimeCheckbox_stateChanged(int state)
{
- return m_keepPlaytime;
+ m_selectedOptions.enableKeepPlaytime(state == Qt::Checked);
+ updateSelectAllCheckbox();
}
+void CopyInstanceDialog::on_copyGameOptionsCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableCopyGameOptions(state == Qt::Checked);
+ updateSelectAllCheckbox();
+}
-void CopyInstanceDialog::on_keepPlaytimeCheckbox_stateChanged(int state)
+void CopyInstanceDialog::on_copyResPacksCheckbox_stateChanged(int state)
{
- if(state == Qt::Unchecked)
- {
- m_keepPlaytime = false;
- }
- else if(state == Qt::Checked)
- {
- m_keepPlaytime = true;
- }
+ m_selectedOptions.enableCopyResourcePacks(state == Qt::Checked);
+ updateSelectAllCheckbox();
+}
+
+void CopyInstanceDialog::on_copyShaderPacksCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableCopyShaderPacks(state == Qt::Checked);
+ updateSelectAllCheckbox();
+}
+
+void CopyInstanceDialog::on_copyServersCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableCopyServers(state == Qt::Checked);
+ updateSelectAllCheckbox();
+}
+
+void CopyInstanceDialog::on_copyModsCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableCopyMods(state == Qt::Checked);
+ updateSelectAllCheckbox();
+}
+
+void CopyInstanceDialog::on_copyScreenshotsCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableCopyScreenshots(state == Qt::Checked);
+ updateSelectAllCheckbox();
}
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.h b/launcher/ui/dialogs/CopyInstanceDialog.h
index bf3cd920..884501d1 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.h
+++ b/launcher/ui/dialogs/CopyInstanceDialog.h
@@ -17,7 +17,7 @@
#include <QDialog>
#include "BaseVersion.h"
-#include <BaseInstance.h>
+#include "InstanceCopyPrefs.h"
class BaseInstance;
@@ -39,20 +39,29 @@ public:
QString instName() const;
QString instGroup() const;
QString iconKey() const;
- bool shouldCopySaves() const;
- bool shouldKeepPlaytime() const;
+ const InstanceCopyPrefs& getChosenOptions() const;
private
slots:
void on_iconButton_clicked();
void on_instNameTextBox_textChanged(const QString &arg1);
+ // Checkboxes
+ void on_selectAllCheckbox_stateChanged(int state);
void on_copySavesCheckbox_stateChanged(int state);
void on_keepPlaytimeCheckbox_stateChanged(int state);
+ void on_copyGameOptionsCheckbox_stateChanged(int state);
+ void on_copyResPacksCheckbox_stateChanged(int state);
+ void on_copyShaderPacksCheckbox_stateChanged(int state);
+ void on_copyServersCheckbox_stateChanged(int state);
+ void on_copyModsCheckbox_stateChanged(int state);
+ void on_copyScreenshotsCheckbox_stateChanged(int state);
private:
+ void checkAllCheckboxes(const bool& b);
+ void updateSelectAllCheckbox();
+ /* data */
Ui::CopyInstanceDialog *ui;
QString InstIconKey;
InstancePtr m_original;
- bool m_copySaves = true;
- bool m_keepPlaytime = true;
+ InstanceCopyPrefs m_selectedOptions;
};
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.ui b/launcher/ui/dialogs/CopyInstanceDialog.ui
index f4b191e2..b7828fe3 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.ui
+++ b/launcher/ui/dialogs/CopyInstanceDialog.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>345</width>
- <height>323</height>
+ <width>341</width>
+ <height>399</height>
</rect>
</property>
<property name="windowTitle">
@@ -33,7 +33,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>60</width>
<height>20</height>
</size>
</property>
@@ -60,7 +60,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>60</width>
<height>20</height>
</size>
</property>
@@ -83,7 +83,10 @@
</widget>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout">
+ <layout class="QGridLayout" name="groupDropdownLayout">
+ <property name="verticalSpacing">
+ <number>6</number>
+ </property>
<item row="0" column="0">
<widget class="QLabel" name="labelVersion_3">
<property name="text">
@@ -110,18 +113,96 @@
</layout>
</item>
<item>
- <widget class="QCheckBox" name="copySavesCheckbox">
- <property name="text">
- <string>Copy saves</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="selectAllButtonLayout">
+ <item>
+ <widget class="QCheckBox" name="selectAllCheckbox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Select all</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <widget class="QCheckBox" name="keepPlaytimeCheckbox">
- <property name="text">
- <string>Keep play time</string>
- </property>
- </widget>
+ <layout class="QGridLayout" name="copyOptionsLayout">
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="copyModsCheckbox">
+ <property name="toolTip">
+ <string>Disabling this will still keep the mod loader (ex: Fabric, Quilt, etc.) but erase the mods folder and their configs.</string>
+ </property>
+ <property name="text">
+ <string>Copy mods</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="copyGameOptionsCheckbox">
+ <property name="toolTip">
+ <string>Copy the in-game options like FOV, max framerate, etc.</string>
+ </property>
+ <property name="text">
+ <string>Copy game options</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="copySavesCheckbox">
+ <property name="text">
+ <string>Copy saves</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="copyShaderPacksCheckbox">
+ <property name="text">
+ <string>Copy shader packs</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QCheckBox" name="copyServersCheckbox">
+ <property name="text">
+ <string>Copy servers</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QCheckBox" name="copyResPacksCheckbox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Copy resource packs</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="keepPlaytimeCheckbox">
+ <property name="text">
+ <string>Keep play time</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="copyScreenshotsCheckbox">
+ <property name="text">
+ <string>Copy screenshots</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
@@ -139,8 +220,6 @@
<tabstop>iconButton</tabstop>
<tabstop>instNameTextBox</tabstop>
<tabstop>groupBox</tabstop>
- <tabstop>copySavesCheckbox</tabstop>
- <tabstop>keepPlaytimeCheckbox</tabstop>
</tabstops>
<resources>
<include location="../../graphics.qrc"/>
@@ -153,8 +232,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
+ <x>254</x>
+ <y>316</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@@ -169,8 +248,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
+ <x>322</x>
+ <y>316</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp
index 9f32dd8e..88552b23 100644
--- a/launcher/ui/dialogs/ExportInstanceDialog.cpp
+++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp
@@ -39,13 +39,12 @@
#include <MMCZip.h>
#include <QFileDialog>
#include <QMessageBox>
-#include <qfilesystemmodel.h>
+#include <QFileSystemModel>
#include <QSortFilterProxyModel>
#include <QDebug>
-#include <qstack.h>
#include <QSaveFile>
-#include "MMCStrings.h"
+#include "StringUtils.h"
#include "SeparatorPrefixTree.h"
#include "Application.h"
#include <icons/IconList.h>
@@ -85,7 +84,7 @@ public:
// sort and proxy model breaks the original model...
if (sortColumn() == 0)
{
- return Strings::naturalCompare(leftFileInfo.fileName(), rightFileInfo.fileName(),
+ return StringUtils::naturalCompare(leftFileInfo.fileName(), rightFileInfo.fileName(),
Qt::CaseInsensitive) < 0;
}
if (sortColumn() == 1)
@@ -94,7 +93,7 @@ public:
auto rightSize = rightFileInfo.size();
if ((leftSize == rightSize) || (leftFileInfo.isDir() && rightFileInfo.isDir()))
{
- return Strings::naturalCompare(leftFileInfo.fileName(),
+ return StringUtils::naturalCompare(leftFileInfo.fileName(),
rightFileInfo.fileName(),
Qt::CaseInsensitive) < 0
? asc