fix: clean up initial review comments (flowin)

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-02-22 17:40:07 -07:00
parent e0ef86340f
commit ae289c923c
5 changed files with 84 additions and 82 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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

View File

@ -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">
@ -112,35 +112,19 @@
</item>
</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,20 +169,10 @@
</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>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="keepPlaytimeCheckbox">
<property name="text">
<string>Keep play time</string>
<string>Copy saves</string>
</property>
</widget>
</item>
@ -206,9 +183,35 @@
</property>
</widget>
</item>
<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>Select all</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</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">
@ -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">
<property name="text">
<string>Use symbolic links</string>
<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 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>

View File

@ -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();
}