QT: Fix PR 2662 (#2676)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
DanielSvoboda 2025-03-23 18:25:11 -03:00 committed by GitHub
parent 99332e4ec2
commit 10bf3d383c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 6 deletions

View file

@ -82,6 +82,7 @@ static std::string trophyKey;
// Gui
static bool load_game_size = true;
static std::vector<GameInstallDir> settings_install_dirs = {};
std::vector<bool> install_dirs_enabled = {};
std::filesystem::path settings_addon_install_dir = {};
std::filesystem::path save_data_path = {};
u32 main_window_geometry_x = 400;
@ -643,8 +644,8 @@ const std::vector<std::filesystem::path> getGameInstallDirs() {
return enabled_dirs;
}
const std::vector<GameInstallDir>& getAllGameInstallDirs() {
return settings_install_dirs;
const std::vector<bool> getGameInstallDirsEnabled() {
return install_dirs_enabled;
}
std::filesystem::path getAddonInstallDir() {
@ -839,7 +840,6 @@ void load(const std::filesystem::path& path) {
const auto install_dir_array =
toml::find_or<std::vector<std::string>>(gui, "installDirs", {});
std::vector<bool> install_dirs_enabled;
try {
install_dirs_enabled = toml::find<std::vector<bool>>(gui, "installDirsEnabled");
} catch (...) {

View file

@ -161,7 +161,7 @@ u32 getMainWindowGeometryY();
u32 getMainWindowGeometryW();
u32 getMainWindowGeometryH();
const std::vector<std::filesystem::path> getGameInstallDirs();
const std::vector<GameInstallDir>& getAllGameInstallDirs();
const std::vector<bool> getGameInstallDirsEnabled();
std::filesystem::path getAddonInstallDir();
u32 getMainWindowTheme();
u32 getIconSize();

View file

@ -157,8 +157,13 @@ int main(int argc, char* argv[]) {
}
}
bool allInstallDirsDisabled =
std::all_of(Config::getGameInstallDirsEnabled().begin(),
Config::getGameInstallDirsEnabled().end(), [](bool val) { return !val; });
// If no game directory is set and no command line argument, prompt for it
if (Config::getGameInstallDirs().empty() && !has_command_line_argument) {
if (Config::getGameInstallDirs().empty() && allInstallDirsDisabled &&
!has_command_line_argument) {
GameInstallDialog dlg;
dlg.exec();
}

View file

@ -821,7 +821,7 @@ void SettingsDialog::ResetInstallFolders() {
std::vector<bool> install_dirs_enabled;
try {
install_dirs_enabled = toml::find<std::vector<bool>>(gui, "installDirsEnabled");
install_dirs_enabled = Config::getGameInstallDirsEnabled();
} catch (...) {
// If it does not exist, assume that all are enabled.
install_dirs_enabled.resize(install_dir_array.size(), true);