aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.cpp50
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.h6
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.ui111
3 files changed, 116 insertions, 51 deletions
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp
index c51bc067..c6cbefcf 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.cpp
+++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp
@@ -87,21 +87,26 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
ui->copyModsCheckbox->setChecked(m_selectedOptions.isCopyModsEnabled());
ui->copyScreenshotsCheckbox->setChecked(m_selectedOptions.isCopyScreenshotsEnabled());
- ui->linkFilesGroup->setChecked(m_selectedOptions.isLinkFilesEnabled());
- ui->recursiveLinkCheckbox->setChecked(m_selectedOptions.isLinkRecursivelyEnabled());
+ ui->symbolicLinksCheckbox->setChecked(m_selectedOptions.isUseSymLinksEnabled());
ui->hardLinksCheckbox->setChecked(m_selectedOptions.isUseHardLinksEnabled());
+
+ ui->recursiveLinkCheckbox->setChecked(m_selectedOptions.isLinkRecursivelyEnabled());
ui->dontLinkSavesCheckbox->setChecked(m_selectedOptions.isDontLinkSavesEnabled());
auto detectedOS = FS::statFS(m_original->instanceRoot()).fsType;
+
m_cloneSupported = FS::canCloneOnFS(detectedOS);
+ m_linkSupported = FS::canLinkOnFS(detectedOS);
if (m_cloneSupported) {
- ui->cloneSupportedLabel->setText(tr("Clone / Reflink is supported on (%1)").arg(FS::getFilesystemTypeName(detectedOS)));
+ ui->cloneSupportedLabel->setText(tr("Reflinks are supported on %1").arg(FS::getFilesystemTypeName(detectedOS)));
} else {
- ui->cloneSupportedLabel->setText(tr("Clone / Reflink not supported on (%1)").arg(FS::getFilesystemTypeName(detectedOS)));
+ ui->cloneSupportedLabel->setText(tr("Reflinks aren't supported on %1").arg(FS::getFilesystemTypeName(detectedOS)));
}
+ updateLinkOptions();
updateUseCloneCheckbox();
+
}
CopyInstanceDialog::~CopyInstanceDialog()
@@ -170,6 +175,21 @@ void CopyInstanceDialog::updateUseCloneCheckbox()
ui->useCloneCheckbox->setChecked(m_cloneSupported && m_selectedOptions.isUseCloneEnabled());
}
+void CopyInstanceDialog::updateLinkOptions()
+{
+ ui->symbolicLinksCheckbox->setEnabled(m_linkSupported && !ui->hardLinksCheckbox->isChecked());
+ ui->hardLinksCheckbox->setEnabled(m_linkSupported && !ui->symbolicLinksCheckbox->isChecked());
+
+ ui->symbolicLinksCheckbox->setChecked(m_linkSupported && m_selectedOptions.isUseSymLinksEnabled());
+ ui->hardLinksCheckbox->setChecked(m_linkSupported && m_selectedOptions.isUseHardLinksEnabled());
+
+ bool linksInUse = (ui->symbolicLinksCheckbox->isChecked() || ui->hardLinksCheckbox->isChecked());
+ ui->recursiveLinkCheckbox->setEnabled(m_linkSupported && linksInUse && !ui->hardLinksCheckbox->isChecked());
+ ui->dontLinkSavesCheckbox->setEnabled(m_linkSupported && linksInUse);
+ ui->recursiveLinkCheckbox->setChecked(m_linkSupported && linksInUse && m_selectedOptions.isLinkRecursivelyEnabled());
+ ui->dontLinkSavesCheckbox->setChecked(m_linkSupported && linksInUse && m_selectedOptions.isDontLinkSavesEnabled());
+}
+
void CopyInstanceDialog::on_iconButton_clicked()
{
IconPickerDialog dlg(this);
@@ -245,10 +265,20 @@ void CopyInstanceDialog::on_copyScreenshotsCheckbox_stateChanged(int state)
updateSelectAllCheckbox();
}
-void CopyInstanceDialog::on_linkFilesGroup_toggled(bool checked)
+void CopyInstanceDialog::on_symbolicLinksCheckbox_stateChanged(int state)
{
- m_selectedOptions.enableLinkFiles(checked);
+ m_selectedOptions.enableUseSymLinks(state == Qt::Checked);
updateUseCloneCheckbox();
+ updateLinkOptions();
+}
+
+void CopyInstanceDialog::on_hardLinksCheckbox_stateChanged(int state)
+{
+ m_selectedOptions.enableUseHardLinks(state == Qt::Checked);
+ if (state == Qt::Checked && !ui->recursiveLinkCheckbox->isChecked()) {
+ ui->recursiveLinkCheckbox->setChecked(true);
+ }
+ updateLinkOptions();
}
void CopyInstanceDialog::on_recursiveLinkCheckbox_stateChanged(int state)
@@ -261,14 +291,6 @@ void CopyInstanceDialog::on_recursiveLinkCheckbox_stateChanged(int state)
}
-void CopyInstanceDialog::on_hardLinksCheckbox_stateChanged(int state)
-{
- m_selectedOptions.enableUseHardLinks(state == Qt::Checked);
- if (state == Qt::Checked && !ui->recursiveLinkCheckbox->isChecked()) {
- ui->recursiveLinkCheckbox->setChecked(true);
- }
-}
-
void CopyInstanceDialog::on_dontLinkSavesCheckbox_stateChanged(int state)
{
m_selectedOptions.enableDontLinkSaves(state == Qt::Checked);
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.h b/launcher/ui/dialogs/CopyInstanceDialog.h
index 859c643c..2dea3795 100644
--- a/launcher/ui/dialogs/CopyInstanceDialog.h
+++ b/launcher/ui/dialogs/CopyInstanceDialog.h
@@ -56,9 +56,9 @@ slots:
void on_copyServersCheckbox_stateChanged(int state);
void on_copyModsCheckbox_stateChanged(int state);
void on_copyScreenshotsCheckbox_stateChanged(int state);
- void on_linkFilesGroup_toggled(bool checked);
- void on_recursiveLinkCheckbox_stateChanged(int state);
+ void on_symbolicLinksCheckbox_stateChanged(int state);
void on_hardLinksCheckbox_stateChanged(int state);
+ void on_recursiveLinkCheckbox_stateChanged(int state);
void on_dontLinkSavesCheckbox_stateChanged(int state);
void on_useCloneCheckbox_stateChanged(int state);
@@ -66,6 +66,7 @@ private:
void checkAllCheckboxes(const bool& b);
void updateSelectAllCheckbox();
void updateUseCloneCheckbox();
+ void updateLinkOptions();
/* data */
Ui::CopyInstanceDialog *ui;
@@ -73,4 +74,5 @@ private:
InstancePtr m_original;
InstanceCopyPrefs m_selectedOptions;
bool m_cloneSupported = false;
+ bool m_linkSupported = false;
};
diff --git a/launcher/ui/dialogs/CopyInstanceDialog.ui b/launcher/ui/dialogs/CopyInstanceDialog.ui
index ce8657f6..7bf75c2d 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>531</width>
- <height>640</height>
+ <width>527</width>
+ <height>699</height>
</rect>
</property>
<property name="windowTitle">
@@ -138,7 +138,7 @@
<item>
<widget class="QGroupBox" name="copyOptionsGroup">
<property name="title">
- <string>Instance copy options</string>
+ <string>Instance Copy Options</string>
</property>
<layout class="QGridLayout" name="copyOptionsLayout">
<item row="6" column="1">
@@ -224,53 +224,92 @@
<item>
<widget class="QGroupBox" name="linkFilesGroup">
<property name="toolTip">
- <string>Use symbolic links instead of copying files.</string>
+ <string>Use symbolic or hard links instead of copying files.</string>
</property>
<property name="title">
- <string>Link files instead of copying them</string>
+ <string>Symbolic and Hard Link Options</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="linkOptionsLayout">
<item>
- <widget class="QCheckBox" name="recursiveLinkCheckbox">
+ <widget class="QLabel" name="linkOptionsLabel">
<property name="text">
- <string>Link files recursively</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="hardLinksCheckbox">
- <property name="enabled">
- <bool>false</bool>
+ <string>Links are supported on most filesystems except FAT</string>
</property>
- <property name="toolTip">
- <string>Use hard links instead of symbolic links</string>
- </property>
- <property name="text">
- <string>Use hard links</string>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="dontLinkSavesCheckbox">
- <property name="toolTip">
- <string>If &quot;copy saves&quot; is selected world save data will be copied instead of linked and thus not shared between instances.</string>
+ <layout class="QGridLayout" name="linkOptionsGridLayout" rowstretch="0,0,0,0,0,0" columnstretch="0,0" rowminimumheight="0,0,0,0,0,0" columnminimumwidth="0,0">
+ <property name="leftMargin">
+ <number>6</number>
</property>
- <property name="text">
- <string>Don't link saves</string>
+ <property name="topMargin">
+ <number>6</number>
</property>
- <property name="checked">
- <bool>false</bool>
+ <property name="rightMargin">
+ <number>6</number>
</property>
- </widget>
+ <property name="bottomMargin">
+ <number>6</number>
+ </property>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="hardLinksCheckbox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Use hard links instead of symbolic links</string>
+ </property>
+ <property name="text">
+ <string>Use hard links</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="recursiveLinkCheckbox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Link files recursively</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="dontLinkSavesCheckbox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>If &quot;copy saves&quot; is selected world save data will be copied instead of linked and thus not shared between instances.</string>
+ </property>
+ <property name="text">
+ <string>Don't link saves</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="symbolicLinksCheckbox">
+ <property name="text">
+ <string>Use symbloic links</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
@@ -278,7 +317,7 @@
<item>
<widget class="QGroupBox" name="horizontalGroupBox">
<property name="title">
- <string>Clone / Reflink (Copy On Write) Options</string>
+ <string>CoW (Copy-on-Write) Options</string>
</property>
<layout class="QHBoxLayout" name="useCloneLayout">
<item>
@@ -287,7 +326,7 @@
<bool>false</bool>
</property>
<property name="text">
- <string>Use Clone / Reflink</string>
+ <string>Clone instead of copying</string>
</property>
</widget>
</item>
@@ -300,7 +339,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Clone / Reflink not supported on this filesystem</string>
+ <string>Your filesystem and/or OS doesn't support reflinks</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -340,9 +379,11 @@
<tabstop>copyServersCheckbox</tabstop>
<tabstop>copyResPacksCheckbox</tabstop>
<tabstop>copyModsCheckbox</tabstop>
+ <tabstop>symbolicLinksCheckbox</tabstop>
<tabstop>recursiveLinkCheckbox</tabstop>
<tabstop>hardLinksCheckbox</tabstop>
<tabstop>dontLinkSavesCheckbox</tabstop>
+ <tabstop>useCloneCheckbox</tabstop>
</tabstops>
<resources/>
<connections>
@@ -353,8 +394,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>263</x>
- <y>571</y>
+ <x>269</x>
+ <y>692</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@@ -369,8 +410,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>331</x>
- <y>571</y>
+ <x>337</x>
+ <y>692</y>
</hint>
<hint type="destinationlabel">
<x>286</x>