mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-30 06:34:27 +02:00
Add settings to control the if prism should move the downloaded mods
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
0b6ce5525d
commit
7dde35fef2
@ -616,6 +616,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
m_settings->registerSetting("IconsDir", "icons");
|
m_settings->registerSetting("IconsDir", "icons");
|
||||||
m_settings->registerSetting("DownloadsDir", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
m_settings->registerSetting("DownloadsDir", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
m_settings->registerSetting("DownloadsDirWatchRecursive", false);
|
m_settings->registerSetting("DownloadsDirWatchRecursive", false);
|
||||||
|
m_settings->registerSetting("MoveModsFromDownloadsDir", false);
|
||||||
m_settings->registerSetting("SkinsDir", "skins");
|
m_settings->registerSetting("SkinsDir", "skins");
|
||||||
m_settings->registerSetting("JavaDir", "java");
|
m_settings->registerSetting("JavaDir", "java");
|
||||||
|
|
||||||
|
@ -597,9 +597,15 @@ void FlameCreationTask::copyBlockedMods(QList<BlockedMod> const& blocked_mods)
|
|||||||
|
|
||||||
qDebug() << "Will try to copy" << mod.localPath << "to" << destPath;
|
qDebug() << "Will try to copy" << mod.localPath << "to" << destPath;
|
||||||
|
|
||||||
|
if (mod.move) {
|
||||||
|
if (!FS::move(mod.localPath, destPath)) {
|
||||||
|
qDebug() << "Move of" << mod.localPath << "to" << destPath << "Failed";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (!FS::copy(mod.localPath, destPath)()) {
|
if (!FS::copy(mod.localPath, destPath)()) {
|
||||||
qDebug() << "Copy of" << mod.localPath << "to" << destPath << "Failed";
|
qDebug() << "Copy of" << mod.localPath << "to" << destPath << "Failed";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
setProgress(i, total);
|
setProgress(i, total);
|
||||||
|
@ -288,6 +288,8 @@ void BlockedModsDialog::checkMatchHash(QString hash, QString path)
|
|||||||
|
|
||||||
qDebug() << "[Blocked Mods Dialog] Checking for match on hash: " << hash << "| From path:" << path;
|
qDebug() << "[Blocked Mods Dialog] Checking for match on hash: " << hash << "| From path:" << path;
|
||||||
|
|
||||||
|
auto downloadDir = QFileInfo(APPLICATION->settings()->get("DownloadsDir").toString()).absoluteFilePath();
|
||||||
|
auto moveFiles = APPLICATION->settings()->get("MoveModsFromDownloadsDir").toBool();
|
||||||
for (auto& mod : m_mods) {
|
for (auto& mod : m_mods) {
|
||||||
if (mod.matched) {
|
if (mod.matched) {
|
||||||
continue;
|
continue;
|
||||||
@ -295,6 +297,9 @@ void BlockedModsDialog::checkMatchHash(QString hash, QString path)
|
|||||||
if (mod.hash.compare(hash, Qt::CaseInsensitive) == 0) {
|
if (mod.hash.compare(hash, Qt::CaseInsensitive) == 0) {
|
||||||
mod.matched = true;
|
mod.matched = true;
|
||||||
mod.localPath = path;
|
mod.localPath = path;
|
||||||
|
if (moveFiles) {
|
||||||
|
mod.move = QFileInfo(path).absoluteFilePath().startsWith(downloadDir);
|
||||||
|
}
|
||||||
match = true;
|
match = true;
|
||||||
|
|
||||||
qDebug() << "[Blocked Mods Dialog] Hash match found:" << mod.name << hash << "| From path:" << path;
|
qDebug() << "[Blocked Mods Dialog] Hash match found:" << mod.name << hash << "| From path:" << path;
|
||||||
@ -346,6 +351,8 @@ bool BlockedModsDialog::checkValidPath(QString path)
|
|||||||
return fsName.compare(metaName) == 0;
|
return fsName.compare(metaName) == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto downloadDir = QFileInfo(APPLICATION->settings()->get("DownloadsDir").toString()).absoluteFilePath();
|
||||||
|
auto moveFiles = APPLICATION->settings()->get("MoveModsFromDownloadsDir").toBool();
|
||||||
for (auto& mod : m_mods) {
|
for (auto& mod : m_mods) {
|
||||||
if (compare(filename, mod.name)) {
|
if (compare(filename, mod.name)) {
|
||||||
// if the mod is not yet matched and doesn't have a hash then
|
// if the mod is not yet matched and doesn't have a hash then
|
||||||
@ -353,6 +360,9 @@ bool BlockedModsDialog::checkValidPath(QString path)
|
|||||||
if (!mod.matched && mod.hash.isEmpty()) {
|
if (!mod.matched && mod.hash.isEmpty()) {
|
||||||
mod.matched = true;
|
mod.matched = true;
|
||||||
mod.localPath = path;
|
mod.localPath = path;
|
||||||
|
if (moveFiles) {
|
||||||
|
mod.move = QFileInfo(path).absoluteFilePath().startsWith(downloadDir);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
|
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
|
||||||
|
@ -42,6 +42,7 @@ struct BlockedMod {
|
|||||||
bool matched;
|
bool matched;
|
||||||
QString localPath;
|
QString localPath;
|
||||||
QString targetFolder;
|
QString targetFolder;
|
||||||
|
bool move = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -235,6 +235,7 @@ void LauncherPage::applySettings()
|
|||||||
s->set("SkinsDir", ui->skinsDirTextBox->text());
|
s->set("SkinsDir", ui->skinsDirTextBox->text());
|
||||||
s->set("JavaDir", ui->javaDirTextBox->text());
|
s->set("JavaDir", ui->javaDirTextBox->text());
|
||||||
s->set("DownloadsDirWatchRecursive", ui->downloadsDirWatchRecursiveCheckBox->isChecked());
|
s->set("DownloadsDirWatchRecursive", ui->downloadsDirWatchRecursiveCheckBox->isChecked());
|
||||||
|
s->set("MoveModsFromDownloadsDir", ui->downloadsDirMoveCheckBox->isChecked());
|
||||||
|
|
||||||
auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId();
|
auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId();
|
||||||
switch (sortMode) {
|
switch (sortMode) {
|
||||||
@ -302,6 +303,7 @@ void LauncherPage::loadSettings()
|
|||||||
ui->skinsDirTextBox->setText(s->get("SkinsDir").toString());
|
ui->skinsDirTextBox->setText(s->get("SkinsDir").toString());
|
||||||
ui->javaDirTextBox->setText(s->get("JavaDir").toString());
|
ui->javaDirTextBox->setText(s->get("JavaDir").toString());
|
||||||
ui->downloadsDirWatchRecursiveCheckBox->setChecked(s->get("DownloadsDirWatchRecursive").toBool());
|
ui->downloadsDirWatchRecursiveCheckBox->setChecked(s->get("DownloadsDirWatchRecursive").toBool());
|
||||||
|
ui->downloadsDirMoveCheckBox->setChecked(s->get("MoveModsFromDownloadsDir").toBool());
|
||||||
|
|
||||||
QString sortMode = s->get("InstSortMode").toString();
|
QString sortMode = s->get("InstSortMode").toString();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabShape">
|
<property name="tabShape">
|
||||||
<enum>QTabWidget::TabShape::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="horizontalScrollBarPolicy">
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -156,6 +156,8 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1" colspan="2">
|
<item row="9" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="downloadModsCheckLayout">
|
||||||
|
<item>
|
||||||
<widget class="QCheckBox" name="downloadsDirWatchRecursiveCheckBox">
|
<widget class="QCheckBox" name="downloadsDirWatchRecursiveCheckBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>When enabled, in addition to the downloads folder, its sub folders will also be searched when looking for resources (e.g. when looking for blocked mods on CurseForge).</string>
|
<string>When enabled, in addition to the downloads folder, its sub folders will also be searched when looking for resources (e.g. when looking for blocked mods on CurseForge).</string>
|
||||||
@ -165,6 +167,18 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="downloadsDirMoveCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>When enabled, it will move blocked resources instead of copying them.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Move blocked resources</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QLineEdit" name="downloadsDirTextBox"/>
|
<widget class="QLineEdit" name="downloadsDirTextBox"/>
|
||||||
</item>
|
</item>
|
||||||
@ -365,7 +379,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_FeaturesTab">
|
<spacer name="verticalSpacer_FeaturesTab">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@ -465,7 +479,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@ -506,7 +520,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_UserInterfaceTab">
|
<spacer name="verticalSpacer_UserInterfaceTab">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@ -615,13 +629,13 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="horizontalScrollBarPolicy">
|
<property name="horizontalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="undoRedoEnabled">
|
<property name="undoRedoEnabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user