diff options
-rw-r--r-- | launcher/FileSystem.cpp | 15 | ||||
-rw-r--r-- | launcher/FileSystem.h | 6 | ||||
-rw-r--r-- | launcher/InstanceCopyTask.cpp | 6 | ||||
-rw-r--r-- | launcher/ui/dialogs/CopyInstanceDialog.ui | 129 | ||||
-rw-r--r-- | tests/FileSystem_test.cpp | 6 |
5 files changed, 82 insertions, 80 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index 45c73d24..2bd0cf52 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -36,10 +36,6 @@ */ #include "FileSystem.h" -#include <qdebug.h> -#include <qfileinfo.h> -#include <qnamespace.h> -#include <qstorageinfo.h> #include "BuildConfig.h" @@ -48,6 +44,7 @@ #include <QDirIterator> #include <QFile> #include <QFileInfo> +#include <QStorageInfo> #include <QSaveFile> #include <QStandardPaths> #include <QTextStream> @@ -435,7 +432,7 @@ bool create_link::make_links() return true; } -void create_link::runPrivlaged(const QString& offset) +void create_link::runPrivileged(const QString& offset) { m_linked = 0; // reset counter m_path_results.clear(); @@ -506,10 +503,10 @@ void create_link::runPrivlaged(const QString& offset) in >> err_value; result.err_value = err_value; if (result.err_value) { - qDebug() << "privlaged link fail" << result.src << "to" << result.dst << "code" << result.err_value << result.err_msg; + qDebug() << "privileged link fail" << result.src << "to" << result.dst << "code" << result.err_value << result.err_msg; emit linkFailed(result.src, result.dst, result.err_msg, result.err_value); } else { - qDebug() << "privlaged link success" << result.src << "to" << result.dst; + qDebug() << "privileged link success" << result.src << "to" << result.dst; m_linked++; emit fileLinked(result.src, result.dst); } @@ -533,7 +530,7 @@ void create_link::runPrivlaged(const QString& offset) } ExternalLinkFileProcess* linkFileProcess = new ExternalLinkFileProcess(serverName, m_useHardLinks, this); - connect(linkFileProcess, &ExternalLinkFileProcess::processExited, this, [&]() { emit finishedPrivlaged(gotResults); }); + connect(linkFileProcess, &ExternalLinkFileProcess::processExited, this, [&]() { emit finishedPrivileged(gotResults); }); connect(linkFileProcess, &ExternalLinkFileProcess::finished, linkFileProcess, &QObject::deleteLater); linkFileProcess->start(); @@ -1041,7 +1038,7 @@ FilesystemInfo statFS(const QString& path) QStorageInfo storage_info(NearestExistentAncestor(path)); - info.fsTypeName = QString::fromStdString(storage_info.fileSystemType().toStdString()); + info.fsTypeName = storage_info.fileSystemType(); info.fsType = getFilesystemTypeFuzzy(info.fsTypeName); diff --git a/launcher/FileSystem.h b/launcher/FileSystem.h index 84526c11..71175bb4 100644 --- a/launcher/FileSystem.h +++ b/launcher/FileSystem.h @@ -220,8 +220,8 @@ class create_link : public QObject { int totalLinked() { return m_linked; } - void runPrivlaged() { runPrivlaged(QString()); } - void runPrivlaged(const QString& offset); + void runPrivileged() { runPrivileged(QString()); } + void runPrivileged(const QString& offset); QList<LinkResult> getResults() { return m_path_results; } @@ -230,7 +230,7 @@ class create_link : public QObject { void fileLinked(const QString& srcName, const QString& dstName); void linkFailed(const QString& srcName, const QString& dstName, const QString& err_msg, int err_value); void finished(); - void finishedPrivlaged(bool gotResults); + void finishedPrivileged(bool gotResults); private: diff --git a/launcher/InstanceCopyTask.cpp b/launcher/InstanceCopyTask.cpp index e0a4de0b..5ef7a7fd 100644 --- a/launcher/InstanceCopyTask.cpp +++ b/launcher/InstanceCopyTask.cpp @@ -72,14 +72,14 @@ void InstanceCopyTask::executeTask() QEventLoop loop; bool got_priv_results = false; - connect(&folderLink, &FS::create_link::finishedPrivlaged, this, [&](bool gotResults){ + connect(&folderLink, &FS::create_link::finishedPrivileged, this, [&](bool gotResults){ if (!gotResults) { - qDebug() << "Privlaged run exited without results!"; + qDebug() << "Privileged run exited without results!"; } got_priv_results = gotResults; loop.quit(); }); - folderLink.runPrivlaged(); + folderLink.runPrivileged(); loop.exec(); // wait for the finished signal diff --git a/launcher/ui/dialogs/CopyInstanceDialog.ui b/launcher/ui/dialogs/CopyInstanceDialog.ui index 009f5b88..3101acec 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>527</width> - <height>699</height> + <width>531</width> + <height>653</height> </rect> </property> <property name="windowTitle"> @@ -113,34 +113,18 @@ </layout> </item> <item> - <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="QGroupBox" name="copyOptionsGroup"> <property name="title"> <string>Instance Copy Options</string> </property> <layout class="QGridLayout" name="copyOptionsLayout"> + <item row="1" column="0"> + <widget class="QCheckBox" name="keepPlaytimeCheckbox"> + <property name="text"> + <string>Keep play time</string> + </property> + </widget> + </item> <item row="6" column="1"> <widget class="QCheckBox" name="copyModsCheckbox"> <property name="toolTip"> @@ -151,6 +135,16 @@ </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="5" column="0"> <widget class="QCheckBox" name="copyGameOptionsCheckbox"> <property name="toolTip"> @@ -161,13 +155,6 @@ </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"> @@ -182,27 +169,36 @@ </property> </widget> </item> - <item row="6" column="0"> - <widget class="QCheckBox" name="copyResPacksCheckbox"> - <property name="enabled"> - <bool>true</bool> - </property> + <item row="3" column="0"> + <widget class="QCheckBox" name="copySavesCheckbox"> <property name="text"> - <string>Copy resource packs</string> + <string>Copy saves</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="keepPlaytimeCheckbox"> + <item row="1" column="1"> + <widget class="QCheckBox" name="copyScreenshotsCheckbox"> <property name="text"> - <string>Keep play time</string> + <string>Copy screenshots</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="copyScreenshotsCheckbox"> + <item row="7" column="1"> + <widget class="QCheckBox" name="selectAllCheckbox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> <property name="text"> - <string>Copy screenshots</string> + <string>Select all</string> + </property> + <property name="checked"> + <bool>false</bool> </property> </widget> </item> @@ -210,6 +206,13 @@ </widget> </item> <item> + <widget class="Line" name="line_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="advancedOptionsLabel"> <property name="text"> <string>Advanced Copy Options</string> @@ -250,7 +253,7 @@ </widget> </item> <item> - <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"> + <layout class="QGridLayout" name="linkOptionsGridLayout" rowstretch="0,0,0,0" columnstretch="0,0" rowminimumheight="0,0,0,0" columnminimumwidth="0,0"> <property name="leftMargin"> <number>6</number> </property> @@ -263,24 +266,14 @@ <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="toolTip"> + <string>Link each resource individually instead of linking whole folders at once</string> + </property> <property name="text"> <string>Link files recursively</string> </property> @@ -302,14 +295,27 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="symbolicLinksCheckbox"> + <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 copying files.</string> + </property> <property name="text"> - <string>Use symbolic links</string> + <string>Use hard links</string> </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="symbolicLinksCheckbox"> <property name="toolTip"> <string>Use symbolic links instead of copying files.</string> </property> + <property name="text"> + <string>Use symbolic links</string> + </property> </widget> </item> </layout> @@ -373,7 +379,6 @@ <tabstop>iconButton</tabstop> <tabstop>instNameTextBox</tabstop> <tabstop>groupBox</tabstop> - <tabstop>selectAllCheckbox</tabstop> <tabstop>keepPlaytimeCheckbox</tabstop> <tabstop>copyScreenshotsCheckbox</tabstop> <tabstop>copySavesCheckbox</tabstop> diff --git a/tests/FileSystem_test.cpp b/tests/FileSystem_test.cpp index 169f0669..19565a99 100644 --- a/tests/FileSystem_test.cpp +++ b/tests/FileSystem_test.cpp @@ -72,15 +72,15 @@ class LinkTask : public Task { qDebug() << "EXPECTED: Link failure, Windows requires permissions for symlinks"; qDebug() << "atempting to run with privelage"; - connect(m_lnk, &FS::create_link::finishedPrivlaged, this, [&](bool gotResults){ + connect(m_lnk, &FS::create_link::finishedPrivileged, this, [&](bool gotResults){ if (gotResults) { emitSucceeded(); } else { - qDebug() << "Privlaged run exited without results!"; + qDebug() << "Privileged run exited without results!"; emitFailed(); } }); - m_lnk->runPrivlaged(); + m_lnk->runPrivileged(); } else { qDebug() << "Link Failed!" << m_lnk->getOSError().value() << m_lnk->getOSError().message().c_str(); } |