Skip to content

Commit

Permalink
Merge pull request #92 from gymnast86/main
Browse files Browse the repository at this point in the history
Fix some preference stuff
  • Loading branch information
gymnast86 authored Jun 25, 2024
2 parents 55cf4fd + d0e5853 commit 9c81382
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
22 changes: 10 additions & 12 deletions gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,23 +1048,21 @@ void MainWindow::on_permalink_textEdited(const QString &newPermalink)

void MainWindow::on_reset_settings_to_default_clicked()
{
// Keep anything that's in preferences.yaml saved
auto oldConfig = config;

delete_and_create_default_config();

// Don't reset any paths the user has specified
auto previousGameBaseDir = config.gameBaseDir;
auto previousOutputDir = config.outputDir;
auto previousSeed = config.seed;
auto previousPlandomizerFile = config.settings.plandomizerFile;
auto err = oldConfig.writePreferences(Utility::get_preferences_path() + "preferences.yaml");
if (err != ConfigError::NONE)
{
show_warning_dialog("Could not keep preferences when resetting all settings.\nYou will have to reset your preferences (model colors, in-game options, and paths).");
}

// Load new config
load_config_into_ui();

// Restore previous paths
config.gameBaseDir = previousGameBaseDir;
config.outputDir = previousOutputDir;
config.seed = previousSeed;
config.settings.plandomizerFile = previousPlandomizerFile;
apply_config_settings();
// Also keep the previous seed
ui->seed->setText(oldConfig.seed.c_str());
}

void MainWindow::on_randomize_button_clicked()
Expand Down
9 changes: 5 additions & 4 deletions gui/player_customization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@ void MainWindow::setup_color_options() {
// If we have a specific preset selected, then keep those colors
else if (curPreset != "Custom" && lastModel == curModel) {
model.loadPreset(curPreset, true);
auto colors = model.getSetColorsMap();
for (auto& [optionName, defaultColor] : baseColors) {
defaultColor = colors[optionName];
}
}

auto colors = model.getSetColorsMap();
for (auto& [optionName, defaultColor] : baseColors) {
defaultColor = colors[optionName];
}

for (auto& customColorName : model.getDefaultColorsOrdering()) {
Expand Down

0 comments on commit 9c81382

Please sign in to comment.