Rename Config::Sort to Config::FileBrowserSort

This commit is contained in:
Aaron van Geffen 2025-01-04 16:24:00 +01:00
parent aede038ba3
commit ee561adc4c
4 changed files with 23 additions and 24 deletions

View file

@ -131,13 +131,13 @@ namespace OpenRCT2::Ui::Windows
switch (Config::Get().general.LoadSaveSort)
{
case Sort::NameAscending:
case FileBrowserSort::NameAscending:
return String::logicalCmp(a.name.c_str(), b.name.c_str()) < 0;
case Sort::NameDescending:
case FileBrowserSort::NameDescending:
return -String::logicalCmp(a.name.c_str(), b.name.c_str()) < 0;
case Sort::DateDescending:
case FileBrowserSort::DateDescending:
return -difftime(a.date_modified, b.date_modified) < 0;
case Sort::DateAscending:
case FileBrowserSort::DateAscending:
return difftime(a.date_modified, b.date_modified) < 0;
}
return String::logicalCmp(a.name.c_str(), b.name.c_str()) < 0;
@ -838,9 +838,9 @@ namespace OpenRCT2::Ui::Windows
// Name button text
StringId id = STR_NONE;
if (Config::Get().general.LoadSaveSort == Sort::NameAscending)
if (Config::Get().general.LoadSaveSort == FileBrowserSort::NameAscending)
id = STR_UP;
else if (Config::Get().general.LoadSaveSort == Sort::NameDescending)
else if (Config::Get().general.LoadSaveSort == FileBrowserSort::NameDescending)
id = STR_DOWN;
// Draw name button indicator.
@ -852,9 +852,9 @@ namespace OpenRCT2::Ui::Windows
{ COLOUR_GREY });
// Date button text
if (Config::Get().general.LoadSaveSort == Sort::DateAscending)
if (Config::Get().general.LoadSaveSort == FileBrowserSort::DateAscending)
id = STR_UP;
else if (Config::Get().general.LoadSaveSort == Sort::DateDescending)
else if (Config::Get().general.LoadSaveSort == FileBrowserSort::DateDescending)
id = STR_DOWN;
else
id = STR_NONE;
@ -917,13 +917,13 @@ namespace OpenRCT2::Ui::Windows
break;
case WIDX_SORT_NAME:
if (Config::Get().general.LoadSaveSort == Sort::NameAscending)
if (Config::Get().general.LoadSaveSort == FileBrowserSort::NameAscending)
{
Config::Get().general.LoadSaveSort = Sort::NameDescending;
Config::Get().general.LoadSaveSort = FileBrowserSort::NameDescending;
}
else
{
Config::Get().general.LoadSaveSort = Sort::NameAscending;
Config::Get().general.LoadSaveSort = FileBrowserSort::NameAscending;
}
Config::Save();
SortList();
@ -931,13 +931,13 @@ namespace OpenRCT2::Ui::Windows
break;
case WIDX_SORT_DATE:
if (Config::Get().general.LoadSaveSort == Sort::DateDescending)
if (Config::Get().general.LoadSaveSort == FileBrowserSort::DateDescending)
{
Config::Get().general.LoadSaveSort = Sort::DateAscending;
Config::Get().general.LoadSaveSort = FileBrowserSort::DateAscending;
}
else
{
Config::Get().general.LoadSaveSort = Sort::DateDescending;
Config::Get().general.LoadSaveSort = FileBrowserSort::DateDescending;
}
Config::Save();
SortList();

View file

@ -111,11 +111,11 @@ namespace OpenRCT2::Config
ConfigEnumEntry<TemperatureUnit>("FAHRENHEIT", TemperatureUnit::Fahrenheit),
});
static const auto Enum_Sort = ConfigEnum<Sort>({
ConfigEnumEntry<Sort>("NAME_ASCENDING", Sort::NameAscending),
ConfigEnumEntry<Sort>("NAME_DESCENDING", Sort::NameDescending),
ConfigEnumEntry<Sort>("DATE_ASCENDING", Sort::DateAscending),
ConfigEnumEntry<Sort>("DATE_DESCENDING", Sort::DateDescending),
static const auto Enum_FileBrowserSort = ConfigEnum<FileBrowserSort>({
ConfigEnumEntry<FileBrowserSort>("NAME_ASCENDING", FileBrowserSort::NameAscending),
ConfigEnumEntry<FileBrowserSort>("NAME_DESCENDING", FileBrowserSort::NameDescending),
ConfigEnumEntry<FileBrowserSort>("DATE_ASCENDING", FileBrowserSort::DateAscending),
ConfigEnumEntry<FileBrowserSort>("DATE_DESCENDING", FileBrowserSort::DateDescending),
});
static const auto Enum_VirtualFloorStyle = ConfigEnum<VirtualFloorStyles>({
@ -200,7 +200,7 @@ namespace OpenRCT2::Config
model->DefaultInspectionInterval = reader->GetInt32("default_inspection_interval", 2);
model->LastRunVersion = reader->GetString("last_run_version", "");
model->InvertViewportDrag = reader->GetBoolean("invert_viewport_drag", false);
model->LoadSaveSort = reader->GetEnum<Sort>("load_save_sort", Sort::NameAscending, Enum_Sort);
model->LoadSaveSort = reader->GetEnum<FileBrowserSort>("load_save_sort", FileBrowserSort::NameAscending, Enum_FileBrowserSort);
model->MinimizeFullscreenFocusLoss = reader->GetBoolean("minimize_fullscreen_focus_loss", true);
model->DisableScreensaver = reader->GetBoolean("disable_screensaver", true);
@ -298,7 +298,7 @@ namespace OpenRCT2::Config
writer->WriteInt32("default_inspection_interval", model->DefaultInspectionInterval);
writer->WriteString("last_run_version", model->LastRunVersion);
writer->WriteBoolean("invert_viewport_drag", model->InvertViewportDrag);
writer->WriteEnum<Sort>("load_save_sort", model->LoadSaveSort, Enum_Sort);
writer->WriteEnum<FileBrowserSort>("load_save_sort", model->LoadSaveSort, Enum_FileBrowserSort);
writer->WriteBoolean("minimize_fullscreen_focus_loss", model->MinimizeFullscreenFocusLoss);
writer->WriteBoolean("disable_screensaver", model->DisableScreensaver);
writer->WriteBoolean("day_night_cycle", model->DayNightCycle);

View file

@ -109,7 +109,7 @@ namespace OpenRCT2::Config
// Loading and saving
bool ConfirmationPrompt;
Sort LoadSaveSort;
FileBrowserSort LoadSaveSort;
u8string LastSaveGameDirectory;
u8string LastSaveLandscapeDirectory;
u8string LastSaveScenarioDirectory;

View file

@ -15,12 +15,11 @@ enum class MeasurementFormat : int32_t;
enum class TemperatureUnit : int32_t;
enum class CurrencyType : uint8_t;
enum class ScaleQuality : int32_t;
enum class Sort : int32_t;
enum class VirtualFloorStyles : int32_t;
enum class DrawingEngine : int32_t;
enum class TitleMusicKind : int32_t;
enum class Sort : int32_t
enum class FileBrowserSort : int32_t
{
NameAscending,
NameDescending,