Change global folders to shared folders

- For each instance, a custom (shared) screenshots/worlds/resourcepacks folder can be set
- Remove ability to set shared folders for all instances (Might add later in different form)

Signed-off-by: Naomi <103967@gmail.com>
This commit is contained in:
Naomi 2025-06-22 14:23:08 +02:00
parent aafd8be7e7
commit d6aaee6ea6
17 changed files with 95 additions and 105 deletions

View File

@ -894,14 +894,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
// Custom Technic Client ID // Custom Technic Client ID
m_settings->registerSetting("TechnicClientID", ""); m_settings->registerSetting("TechnicClientID", "");
// Global folders
m_settings->registerSetting("UseGlobalScreenshotsFolder", false);
m_settings->registerSetting("GlobalScreenshotsPath", FS::PathCombine(APPLICATION->dataRoot(), "screenshots"));
m_settings->registerSetting("UseGlobalSavesFolder", false);
m_settings->registerSetting("GlobalSavesPath", FS::PathCombine(APPLICATION->dataRoot(), "saves"));
m_settings->registerSetting("UseGlobalResourcePacksFolder", false);
m_settings->registerSetting("GlobalResourcePacksPath", FS::PathCombine(APPLICATION->dataRoot(), "resourcepacks"));
// Init page provider // Init page provider
{ {
m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings"));

View File

@ -126,16 +126,13 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_settings->registerSetting("Profiler", ""); m_settings->registerSetting("Profiler", "");
// Global folders // Shared folders
auto globalScreenshotsSetting = m_settings->registerSetting("OverrideGlobalScreenshots", false); m_settings->registerSetting("UseSharedScreenshotsFolder", false);
m_settings->registerOverride(globalSettings->getSetting("UseGlobalScreenshotsFolder"), globalScreenshotsSetting); m_settings->registerSetting("SharedScreenshotsPath", FS::PathCombine(APPLICATION->dataRoot(), "screenshots"));
m_settings->registerOverride(globalSettings->getSetting("GlobalScreenshotsPath"), globalScreenshotsSetting); m_settings->registerSetting("UseSharedSavesFolder", false);
auto globalSavesSetting = m_settings->registerSetting("OverrideGlobalSaves", false); m_settings->registerSetting("SharedSavesPath", FS::PathCombine(APPLICATION->dataRoot(), "saves"));
m_settings->registerOverride(globalSettings->getSetting("UseGlobalSavesFolder"), globalSavesSetting); m_settings->registerSetting("UseSharedResourcePacksFolder", false);
m_settings->registerOverride(globalSettings->getSetting("GlobalSavesPath"), globalSavesSetting); m_settings->registerSetting("SharedResourcePacksPath", FS::PathCombine(APPLICATION->dataRoot(), "resourcepacks"));
auto globalResourcePacksSetting = m_settings->registerSetting("OverrideGlobalResourcePacks", false);
m_settings->registerOverride(globalSettings->getSetting("UseGlobalResourcePacksFolder"), globalResourcePacksSetting);
m_settings->registerOverride(globalSettings->getSetting("GlobalResourcePacksPath"), globalResourcePacksSetting);
} }
QString BaseInstance::getPreLaunchCommand() QString BaseInstance::getPreLaunchCommand()

View File

@ -315,8 +315,8 @@ set(MINECRAFT_SOURCES
minecraft/Library.cpp minecraft/Library.cpp
minecraft/Library.h minecraft/Library.h
minecraft/MojangDownloadInfo.h minecraft/MojangDownloadInfo.h
minecraft/UpdateGlobalDirectoriesTask.cpp minecraft/UpdateSharedDirectoriesTask.cpp
minecraft/UpdateGlobalDirectoriesTask.h minecraft/UpdateSharedDirectoriesTask.h
minecraft/VanillaInstanceCreationTask.cpp minecraft/VanillaInstanceCreationTask.cpp
minecraft/VanillaInstanceCreationTask.h minecraft/VanillaInstanceCreationTask.h
minecraft/VersionFile.cpp minecraft/VersionFile.cpp
@ -1126,8 +1126,8 @@ SET(LAUNCHER_SOURCES
ui/widgets/CustomCommands.h ui/widgets/CustomCommands.h
ui/widgets/EnvironmentVariables.cpp ui/widgets/EnvironmentVariables.cpp
ui/widgets/EnvironmentVariables.h ui/widgets/EnvironmentVariables.h
ui/widgets/GlobalFolderWidget.cpp ui/widgets/SharedFolderWidget.cpp
ui/widgets/GlobalFolderWidget.h ui/widgets/SharedFolderWidget.h
ui/widgets/IconLabel.cpp ui/widgets/IconLabel.cpp
ui/widgets/IconLabel.h ui/widgets/IconLabel.h
ui/widgets/JavaWizardWidget.cpp ui/widgets/JavaWizardWidget.cpp
@ -1235,7 +1235,7 @@ qt_wrap_ui(LAUNCHER_UI
ui/pages/modplatform/technic/TechnicPage.ui ui/pages/modplatform/technic/TechnicPage.ui
ui/widgets/CustomCommands.ui ui/widgets/CustomCommands.ui
ui/widgets/EnvironmentVariables.ui ui/widgets/EnvironmentVariables.ui
ui/widgets/GlobalFolderWidget.ui ui/widgets/SharedFolderWidget.ui
ui/widgets/InfoFrame.ui ui/widgets/InfoFrame.ui
ui/widgets/ModFilterWidget.ui ui/widgets/ModFilterWidget.ui
ui/widgets/SubTaskProgressBar.ui ui/widgets/SubTaskProgressBar.ui

View File

@ -85,7 +85,7 @@
#include "AssetsUtils.h" #include "AssetsUtils.h"
#include "MinecraftLoadAndCheck.h" #include "MinecraftLoadAndCheck.h"
#include "PackProfile.h" #include "PackProfile.h"
#include "minecraft/UpdateGlobalDirectoriesTask.h" #include "minecraft/UpdateSharedDirectoriesTask.h"
#include "minecraft/gameoptions/GameOptions.h" #include "minecraft/gameoptions/GameOptions.h"
#include "minecraft/update/FoldersTask.h" #include "minecraft/update/FoldersTask.h"
@ -1316,9 +1316,9 @@ QList<Mod*> MinecraftInstance::getJarMods() const
void MinecraftInstance::applySettings() void MinecraftInstance::applySettings()
{ {
// Global directories // Shared directories
m_update_global_directories_task = std::make_shared<UpdateGlobalDirectoriesTask>(this, nullptr); m_update_shared_directories_task = std::make_shared<UpdateSharedDirectoriesTask>(this, nullptr);
m_update_global_directories_task->start(); m_update_shared_directories_task->start();
} }
#include "MinecraftInstance.moc" #include "MinecraftInstance.moc"

View File

@ -52,7 +52,7 @@ class WorldList;
class GameOptions; class GameOptions;
class LaunchStep; class LaunchStep;
class PackProfile; class PackProfile;
class UpdateGlobalDirectoriesTask; class UpdateSharedDirectoriesTask;
class MinecraftInstance : public BaseInstance { class MinecraftInstance : public BaseInstance {
Q_OBJECT Q_OBJECT
@ -167,7 +167,7 @@ class MinecraftInstance : public BaseInstance {
protected: // data protected: // data
std::shared_ptr<PackProfile> m_components; std::shared_ptr<PackProfile> m_components;
std::shared_ptr<UpdateGlobalDirectoriesTask> m_update_global_directories_task; std::shared_ptr<UpdateSharedDirectoriesTask> m_update_shared_directories_task;
mutable std::shared_ptr<ModFolderModel> m_loader_mod_list; mutable std::shared_ptr<ModFolderModel> m_loader_mod_list;
mutable std::shared_ptr<ModFolderModel> m_core_mod_list; mutable std::shared_ptr<ModFolderModel> m_core_mod_list;
mutable std::shared_ptr<ModFolderModel> m_nil_mod_list; mutable std::shared_ptr<ModFolderModel> m_nil_mod_list;

View File

@ -1,4 +1,4 @@
#include "UpdateGlobalDirectoriesTask.h" #include "UpdateSharedDirectoriesTask.h"
#include <QDirIterator> #include <QDirIterator>
@ -84,7 +84,7 @@ class TryCreateSymlinkTask : public Task {
// Make sure that symbolic links are supported. // Make sure that symbolic links are supported.
if (!FS::canLink(m_source, m_destination)) { if (!FS::canLink(m_source, m_destination)) {
fail(tr("Failed to create global folder.\nSymbolic links are not supported on the filesystem")); fail(tr("Failed to create shared folder.\nSymbolic links are not supported on the filesystem"));
return; return;
} }
@ -101,7 +101,7 @@ class TryCreateSymlinkTask : public Task {
} else if (FS::checkFolderPathExists(m_destination)) { } else if (FS::checkFolderPathExists(m_destination)) {
if (!FS::checkFolderPathEmpty(m_destination)) { if (!FS::checkFolderPathEmpty(m_destination)) {
if (!interactiveMove(m_destination, m_source, true, m_parent)) { if (!interactiveMove(m_destination, m_source, true, m_parent)) {
fail(tr("Failed to create global folder.\nEnsure that \"%1\" is empty.").arg(m_destination)); fail(tr("Failed to create shared folder.\nEnsure that \"%1\" is empty.").arg(m_destination));
return; return;
} }
} }
@ -111,7 +111,7 @@ class TryCreateSymlinkTask : public Task {
// Make sure the source folder exists // Make sure the source folder exists
if (!FS::ensureFolderPathExists(m_source)) { if (!FS::ensureFolderPathExists(m_source)) {
fail(tr("Failed to create global folder.\nEnsure that \"%1\" exists.").arg(m_source)); fail(tr("Failed to create shared folder.\nEnsure that \"%1\" exists.").arg(m_source));
return; return;
} }
@ -121,7 +121,7 @@ class TryCreateSymlinkTask : public Task {
if (folderLink()) { if (folderLink()) {
emitSucceeded(); emitSucceeded();
} else { } else {
fail(tr("Failed to create global folder. Error %1: %2") fail(tr("Failed to create shared folder. Error %1: %2")
.arg(folderLink.getOSError().value()) .arg(folderLink.getOSError().value())
.arg(folderLink.getOSError().message().c_str())); .arg(folderLink.getOSError().message().c_str()));
} }
@ -143,44 +143,44 @@ class TryCreateSymlinkTask : public Task {
QWidget* m_parent; QWidget* m_parent;
}; };
UpdateGlobalDirectoriesTask::UpdateGlobalDirectoriesTask(MinecraftInstance* inst, QWidget* parent) UpdateSharedDirectoriesTask::UpdateSharedDirectoriesTask(MinecraftInstance* inst, QWidget* parent)
: Task(parent), m_inst(inst), m_parent(parent) : Task(parent), m_inst(inst), m_parent(parent)
{} {}
UpdateGlobalDirectoriesTask::~UpdateGlobalDirectoriesTask() {} UpdateSharedDirectoriesTask::~UpdateSharedDirectoriesTask() {}
void UpdateGlobalDirectoriesTask::executeTask() void UpdateSharedDirectoriesTask::executeTask()
{ {
auto tasks = makeShared<ConcurrentTask>("UpdateGlobalDirectoriesTask"); auto tasks = makeShared<ConcurrentTask>("UpdateSharedDirectoriesTask");
auto screenshotsTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("GlobalScreenshotsPath").toString(), auto screenshotsTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("SharedScreenshotsPath").toString(),
m_inst->screenshotsDir(), m_inst, "UseGlobalScreenshotsFolder", m_parent); m_inst->screenshotsDir(), m_inst, "UseSharedScreenshotsFolder", m_parent);
connect(screenshotsTask.get(), &Task::failed, this, &UpdateGlobalDirectoriesTask::notifyFailed); connect(screenshotsTask.get(), &Task::failed, this, &UpdateSharedDirectoriesTask::notifyFailed);
tasks->addTask(screenshotsTask); tasks->addTask(screenshotsTask);
auto savesTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("GlobalSavesPath").toString(), m_inst->worldDir(), m_inst, auto savesTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("SharedSavesPath").toString(), m_inst->worldDir(), m_inst,
"UseGlobalSavesFolder", m_parent); "UseSharedSavesFolder", m_parent);
connect(savesTask.get(), &Task::failed, this, &UpdateGlobalDirectoriesTask::notifyFailed); connect(savesTask.get(), &Task::failed, this, &UpdateSharedDirectoriesTask::notifyFailed);
tasks->addTask(savesTask); tasks->addTask(savesTask);
auto resoucePacksTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("GlobalResourcePacksPath").toString(), auto resoucePacksTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("SharedResourcePacksPath").toString(),
m_inst->resourcePacksDir(), m_inst, "UseGlobalResourcePacksFolder", m_parent); m_inst->resourcePacksDir(), m_inst, "UseSharedResourcePacksFolder", m_parent);
connect(resoucePacksTask.get(), &Task::failed, this, &UpdateGlobalDirectoriesTask::notifyFailed); connect(resoucePacksTask.get(), &Task::failed, this, &UpdateSharedDirectoriesTask::notifyFailed);
tasks->addTask(resoucePacksTask); tasks->addTask(resoucePacksTask);
auto texturePacksTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("GlobalResourcePacksPath").toString(), auto texturePacksTask = makeShared<TryCreateSymlinkTask>(m_inst->settings()->get("SharedResourcePacksPath").toString(),
m_inst->texturePacksDir(), m_inst, "UseGlobalResourcePacksFolder", m_parent); m_inst->texturePacksDir(), m_inst, "UseSharedResourcePacksFolder", m_parent);
connect(texturePacksTask.get(), &Task::failed, this, &UpdateGlobalDirectoriesTask::notifyFailed); connect(texturePacksTask.get(), &Task::failed, this, &UpdateSharedDirectoriesTask::notifyFailed);
tasks->addTask(texturePacksTask); tasks->addTask(texturePacksTask);
m_tasks = tasks; m_tasks = tasks;
connect(m_tasks.get(), &Task::succeeded, this, &UpdateGlobalDirectoriesTask::emitSucceeded); connect(m_tasks.get(), &Task::succeeded, this, &UpdateSharedDirectoriesTask::emitSucceeded);
m_tasks->start(); m_tasks->start();
} }
void UpdateGlobalDirectoriesTask::notifyFailed(QString reason) void UpdateSharedDirectoriesTask::notifyFailed(QString reason)
{ {
CustomMessageBox::selectable(m_parent, tr("Failed"), reason, QMessageBox::Warning, QMessageBox::Ok)->exec(); CustomMessageBox::selectable(m_parent, tr("Failed"), reason, QMessageBox::Warning, QMessageBox::Ok)->exec();
emit failed(reason); emit failed(reason);

View File

@ -4,10 +4,10 @@
class MinecraftInstance; class MinecraftInstance;
class UpdateGlobalDirectoriesTask : public Task { class UpdateSharedDirectoriesTask : public Task {
public: public:
explicit UpdateGlobalDirectoriesTask(MinecraftInstance* inst, QWidget* parent = 0); explicit UpdateSharedDirectoriesTask(MinecraftInstance* inst, QWidget* parent = 0);
virtual ~UpdateGlobalDirectoriesTask(); virtual ~UpdateSharedDirectoriesTask();
protected: protected:
virtual void executeTask() override; virtual void executeTask() override;

View File

@ -70,7 +70,7 @@
<item row="0" column="1" colspan="3"> <item row="0" column="1" colspan="3">
<widget class="QLabel" name="isSymlinkWarning"> <widget class="QLabel" name="isSymlinkWarning">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;Warning: This is the global folder&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: This is a shared folder and potentially shared with multiple instances&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -565,7 +565,7 @@ void ScreenshotsPage::openedImpl()
ui->toolBar->setVisibilityState(QByteArray::fromBase64(m_wide_bar_setting->get().toString().toUtf8())); ui->toolBar->setVisibilityState(QByteArray::fromBase64(m_wide_bar_setting->get().toString().toUtf8()));
// Enable the symbolic link warning when the screenshots folder is a symbolic link // Enable the symbolic link warning when the screenshots folder is a symbolic link
ui->globalScreenshotsFolderWarninglabel->setVisible(FS::isSymLink(m_folder)); ui->sharedScreenshotsFolderWarninglabel->setVisible(FS::isSymLink(m_folder));
} }
void ScreenshotsPage::closedImpl() void ScreenshotsPage::closedImpl()

View File

@ -25,12 +25,12 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="globalScreenshotsFolderWarninglabel"> <widget class="QLabel" name="sharedScreenshotsFolderWarninglabel">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: This is the global screenshots folder&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: This is a shared folder and potentially shared with multiple instances&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>

View File

@ -128,7 +128,7 @@ void WorldListPage::openedImpl()
ui->toolBar->setVisibilityState(QByteArray::fromBase64(m_wide_bar_setting->get().toString().toUtf8())); ui->toolBar->setVisibilityState(QByteArray::fromBase64(m_wide_bar_setting->get().toString().toUtf8()));
// Enable the symbolic link warning when the saves folder is a symbolic link // Enable the symbolic link warning when the saves folder is a symbolic link
ui->globalSavesFolderWarninglabel->setVisible(FS::isSymLink(FS::PathCombine(m_inst->gameRoot(), "saves"))); ui->sharedSavesFolderWarninglabel->setVisible(FS::isSymLink(FS::PathCombine(m_inst->gameRoot(), "saves")));
} }
void WorldListPage::closedImpl() void WorldListPage::closedImpl()

View File

@ -25,9 +25,9 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="globalSavesFolderWarninglabel"> <widget class="QLabel" name="sharedSavesFolderWarninglabel">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;Warning: This is the global saves folder&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: This is a shared folder and potentially shared with multiple instances&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -53,7 +53,8 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance,
m_ui->setupUi(this); m_ui->setupUi(this);
if (m_instance == nullptr) { if (m_instance == nullptr) {
m_ui->settingsTabs->removeTab(1); m_ui->settingsTabs->removeTab(m_ui->settingsTabs->indexOf(m_ui->javaPage));
m_ui->settingsTabs->removeTab(m_ui->settingsTabs->indexOf(m_ui->sharedFoldersTab));
m_ui->openGlobalSettingsButton->setVisible(false); m_ui->openGlobalSettingsButton->setVisible(false);
m_ui->instanceAccountGroupBox->hide(); m_ui->instanceAccountGroupBox->hide();
@ -282,11 +283,11 @@ void MinecraftSettingsWidget::loadSettings()
m_ui->quilt->blockSignals(false); m_ui->quilt->blockSignals(false);
m_ui->liteLoader->blockSignals(false); m_ui->liteLoader->blockSignals(false);
// Global folders // Shared folders
m_ui->globalScreenshotsFolder->initialize(settings->get("UseGlobalScreenshotsFolder").toBool(), settings->get("GlobalScreenshotsPath").toString()); m_ui->sharedScreenshotsFolder->initialize(settings->get("UseSharedScreenshotsFolder").toBool(), settings->get("SharedScreenshotsPath").toString());
m_ui->globalSavesFolder->initialize(settings->get("UseGlobalSavesFolder").toBool(), settings->get("GlobalSavesPath").toString()); m_ui->sharedSavesFolder->initialize(settings->get("UseSharedSavesFolder").toBool(), settings->get("SharedSavesPath").toString());
m_ui->globalResourcePacksFolder->initialize(settings->get("UseGlobalResourcePacksFolder").toBool(), m_ui->sharedResourcePacksFolder->initialize(settings->get("UseSharedResourcePacksFolder").toBool(),
settings->get("GlobalResourcePacksPath").toString()); settings->get("SharedResourcePacksPath").toString());
} }
m_ui->legacySettingsGroupBox->setChecked(settings->get("OverrideLegacySettings").toBool()); m_ui->legacySettingsGroupBox->setChecked(settings->get("OverrideLegacySettings").toBool());
@ -477,13 +478,13 @@ void MinecraftSettingsWidget::saveSettings()
} }
if (m_instance != nullptr) { if (m_instance != nullptr) {
// Global folders // Shared folders
settings->set("UseGlobalScreenshotsFolder", m_ui->globalScreenshotsFolder->isEnabled()); settings->set("UseSharedScreenshotsFolder", m_ui->sharedScreenshotsFolder->isEnabled());
settings->set("GlobalScreenshotsPath", m_ui->globalScreenshotsFolder->getPath()); settings->set("SharedScreenshotsPath", m_ui->sharedScreenshotsFolder->getPath());
settings->set("UseGlobalSavesFolder", m_ui->globalSavesFolder->isEnabled()); settings->set("UseSharedSavesFolder", m_ui->sharedSavesFolder->isEnabled());
settings->set("GlobalSavesPath", m_ui->globalSavesFolder->getPath()); settings->set("SharedSavesPath", m_ui->sharedSavesFolder->getPath());
settings->set("UseGlobalResourcePacksFolder", m_ui->globalResourcePacksFolder->isEnabled()); settings->set("UseSharedResourcePacksFolder", m_ui->sharedResourcePacksFolder->isEnabled());
settings->set("GlobalResourcePacksPath", m_ui->globalResourcePacksFolder->getPath()); settings->set("SharedResourcePacksPath", m_ui->sharedResourcePacksFolder->getPath());
} }
} }

View File

@ -801,7 +801,7 @@ It is most likely you will need to change the path - please refer to the mod's w
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="globalFoldersTab"> <widget class="QWidget" name="sharedFoldersTab">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -809,11 +809,11 @@ It is most likely you will need to change the path - please refer to the mod's w
</sizepolicy> </sizepolicy>
</property> </property>
<attribute name="title"> <attribute name="title">
<string>Global Folders</string> <string>Shared Folders</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="globalFoldersVerticalLayout"> <layout class="QVBoxLayout" name="sharedFoldersVerticalLayout">
<item> <item>
<widget class="QGroupBox" name="globalFoldersGroupBox"> <widget class="QGroupBox" name="sharedFoldersGroupBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -826,28 +826,28 @@ It is most likely you will need to change the path - please refer to the mod's w
<property name="alignment"> <property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property> </property>
<layout class="QVBoxLayout" name="globalFoldersSettingsVerticalLayout"> <layout class="QVBoxLayout" name="sharedFoldersSettingsVerticalLayout">
<item> <item>
<widget class="QLabel" name="globalFoldersWarning"> <widget class="QLabel" name="sharedFoldersWarning">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: After enabling files cannot be automatically restored to their original folder.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#f5c211;&quot;&gt;Warning&lt;/span&gt;&lt;span style=&quot; color:#f5c211;&quot;&gt;: After enabling files cannot be automatically restored to their original folder.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="GlobalFolderWidget" name="globalScreenshotsFolder" native="true"/> <widget class="SharedFolderWidget" name="sharedScreenshotsFolder" native="true"/>
</item> </item>
<item> <item>
<widget class="GlobalFolderWidget" name="globalSavesFolder" native="true"/> <widget class="SharedFolderWidget" name="sharedSavesFolder" native="true"/>
</item> </item>
<item> <item>
<widget class="GlobalFolderWidget" name="globalResourcePacksFolder" native="true"/> <widget class="SharedFolderWidget" name="sharedResourcePacksFolder" native="true"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="globalFoldersLabel"> <widget class="QLabel" name="sharedFoldersLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -855,7 +855,7 @@ It is most likely you will need to change the path - please refer to the mod's w
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A global folder is a folder that is shared across instances.&lt;/p&gt;&lt;p&gt;For example: If two instances share the same global saves folder, they can both play on the same worlds without having to copy the world over.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A shared folder is a folder that can be shared across instances.&lt;/p&gt;&lt;p&gt;For example: If two instances share the same shared saves folder, they can both play on the same worlds without having to copy the world over.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>false</bool> <bool>false</bool>
@ -888,9 +888,9 @@ It is most likely you will need to change the path - please refer to the mod's w
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>GlobalFolderWidget</class> <class>SharedFolderWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>ui/widgets/GlobalFolderWidget.h</header> <header>ui/widgets/SharedFolderWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View File

@ -1,21 +1,21 @@
#include "GlobalFolderWidget.h" #include "SharedFolderWidget.h"
#include "ui_GlobalFolderWidget.h" #include "ui_SharedFolderWidget.h"
#include <QFileDialog> #include <QFileDialog>
#include "FileSystem.h" #include "FileSystem.h"
GlobalFolderWidget::GlobalFolderWidget(QWidget* parent) : QWidget(parent), ui(new Ui::GlobalFolderWidget) SharedFolderWidget::SharedFolderWidget(QWidget* parent) : QWidget(parent), ui(new Ui::SharedFolderWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
} }
GlobalFolderWidget::~GlobalFolderWidget() SharedFolderWidget::~SharedFolderWidget()
{ {
delete ui; delete ui;
} }
void GlobalFolderWidget::initialize(bool enabled, const QString& path, const QString& label) void SharedFolderWidget::initialize(bool enabled, const QString& path, const QString& label)
{ {
ui->enabledCheckBox->setChecked(enabled); ui->enabledCheckBox->setChecked(enabled);
ui->enabledCheckBox->setText(label); ui->enabledCheckBox->setText(label);
@ -26,25 +26,25 @@ void GlobalFolderWidget::initialize(bool enabled, const QString& path, const QSt
ui->pathBrowseBtn->setEnabled(enabled); ui->pathBrowseBtn->setEnabled(enabled);
} }
bool GlobalFolderWidget::isEnabled() const bool SharedFolderWidget::isEnabled() const
{ {
return ui->enabledCheckBox->isChecked(); return ui->enabledCheckBox->isChecked();
} }
QString GlobalFolderWidget::getPath() const QString SharedFolderWidget::getPath() const
{ {
return ui->pathTextBox->text(); return ui->pathTextBox->text();
} }
void GlobalFolderWidget::on_enabledCheckBox_toggled(bool checked) void SharedFolderWidget::on_enabledCheckBox_toggled(bool checked)
{ {
ui->pathTextBox->setEnabled(checked); ui->pathTextBox->setEnabled(checked);
ui->pathBrowseBtn->setEnabled(checked); ui->pathBrowseBtn->setEnabled(checked);
} }
void GlobalFolderWidget::on_pathBrowseBtn_clicked() void SharedFolderWidget::on_pathBrowseBtn_clicked()
{ {
QString path = QFileDialog::getExistingDirectory(this, tr("Select global folder"), ui->pathTextBox->text()); QString path = QFileDialog::getExistingDirectory(this, tr("Select shared folder"), ui->pathTextBox->text());
if (path.isEmpty()) { if (path.isEmpty()) {
return; return;
} }

View File

@ -3,15 +3,15 @@
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
class GlobalFolderWidget; class SharedFolderWidget;
} }
class GlobalFolderWidget : public QWidget { class SharedFolderWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit GlobalFolderWidget(QWidget* parent = 0); explicit SharedFolderWidget(QWidget* parent = 0);
virtual ~GlobalFolderWidget(); virtual ~SharedFolderWidget();
void initialize(bool enabled, const QString& path, const QString& label = ""); void initialize(bool enabled, const QString& path, const QString& label = "");
bool isEnabled() const; bool isEnabled() const;
@ -22,5 +22,5 @@ class GlobalFolderWidget : public QWidget {
void on_pathBrowseBtn_clicked(); void on_pathBrowseBtn_clicked();
private: private:
Ui::GlobalFolderWidget* ui; Ui::SharedFolderWidget* ui;
}; };

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>GlobalFolderWidget</class> <class>SharedFolderWidget</class>
<widget class="QWidget" name="GlobalFolderWidget"> <widget class="QWidget" name="SharedFolderWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>