Merge pull request #242 from marcelohdez/more-copy-options
This commit is contained in:
@ -1651,7 +1651,7 @@ void MainWindow::on_actionCopyInstance_triggered()
|
||||
if (!copyInstDlg.exec())
|
||||
return;
|
||||
|
||||
auto copyTask = new InstanceCopyTask(m_selectedInstance, copyInstDlg.shouldCopySaves(), copyInstDlg.shouldKeepPlaytime());
|
||||
auto copyTask = new InstanceCopyTask(m_selectedInstance, copyInstDlg.getChosenOptions());
|
||||
copyTask->setName(copyInstDlg.instName());
|
||||
copyTask->setGroup(copyInstDlg.instGroup());
|
||||
copyTask->setIcon(copyInstDlg.iconKey());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
bool CopyInstanceDialog::shouldKeepPlaytime() const
|
||||
{
|
||||
return m_keepPlaytime;
|
||||
m_selectedOptions.enableCopySaves(state == Qt::Checked);
|
||||
updateSelectAllCheckbox();
|
||||
}
|
||||
|
||||
|
||||
void CopyInstanceDialog::on_keepPlaytimeCheckbox_stateChanged(int state)
|
||||
{
|
||||
if(state == Qt::Unchecked)
|
||||
{
|
||||
m_keepPlaytime = false;
|
||||
}
|
||||
else if(state == Qt::Checked)
|
||||
{
|
||||
m_keepPlaytime = true;
|
||||
}
|
||||
m_selectedOptions.enableKeepPlaytime(state == Qt::Checked);
|
||||
updateSelectAllCheckbox();
|
||||
}
|
||||
|
||||
void CopyInstanceDialog::on_copyGameOptionsCheckbox_stateChanged(int state)
|
||||
{
|
||||
m_selectedOptions.enableCopyGameOptions(state == Qt::Checked);
|
||||
updateSelectAllCheckbox();
|
||||
}
|
||||
|
||||
void CopyInstanceDialog::on_copyResPacksCheckbox_stateChanged(int state)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user