mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-06 12:34:24 +00:00
[desktop] Removed redundant NightMode setting.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
b195059fb6
commit
905a823490
@@ -23,7 +23,6 @@ using namespace std;
|
|||||||
std::string_view kMeasurementUnits = "Units";
|
std::string_view kMeasurementUnits = "Units";
|
||||||
std::string_view kMapLanguageCode = "MapLanguageCode";
|
std::string_view kMapLanguageCode = "MapLanguageCode";
|
||||||
std::string_view kDeveloperMode = "DeveloperMode";
|
std::string_view kDeveloperMode = "DeveloperMode";
|
||||||
std::string_view kNightMode = "NightMode";
|
|
||||||
std::string_view kDonateUrl = "DonateUrl";
|
std::string_view kDonateUrl = "DonateUrl";
|
||||||
std::string_view kNY = "NY";
|
std::string_view kNY = "NY";
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ namespace settings
|
|||||||
extern std::string_view kMeasurementUnits;
|
extern std::string_view kMeasurementUnits;
|
||||||
extern std::string_view kDeveloperMode;
|
extern std::string_view kDeveloperMode;
|
||||||
extern std::string_view kMapLanguageCode;
|
extern std::string_view kMapLanguageCode;
|
||||||
extern std::string_view kNightMode;
|
|
||||||
// The following two settings are configured externally at the metaserver.
|
// The following two settings are configured externally at the metaserver.
|
||||||
extern std::string_view kDonateUrl;
|
extern std::string_view kDonateUrl;
|
||||||
extern std::string_view kNY;
|
extern std::string_view kNY;
|
||||||
|
|||||||
@@ -152,20 +152,15 @@ namespace qt
|
|||||||
|
|
||||||
nightModeRadioBox->setLayout(layout);
|
nightModeRadioBox->setLayout(layout);
|
||||||
|
|
||||||
int i;
|
int const btn = MapStyleIsDark(framework.GetMapStyle()) ? 1 : 0;
|
||||||
if (!settings::Get(settings::kNightMode, i))
|
nightModeGroup->button(btn)->setChecked(true);
|
||||||
{
|
|
||||||
i = static_cast<int>(MapStyleIsDark(framework.GetMapStyle()) ? NightMode::On : NightMode::Off);
|
|
||||||
settings::Set(settings::kNightMode, i);
|
|
||||||
}
|
|
||||||
nightModeGroup->button(i)->setChecked(true);
|
|
||||||
|
|
||||||
void (QButtonGroup::* buttonClicked)(int) = &QButtonGroup::idClicked;
|
void (QButtonGroup::* buttonClicked)(int) = &QButtonGroup::idClicked;
|
||||||
connect(nightModeGroup, buttonClicked, [&framework](int i)
|
connect(nightModeGroup, buttonClicked, [&framework](int i)
|
||||||
{
|
{
|
||||||
NightMode nightMode = static_cast<NightMode>(i);
|
auto const currStyle = framework.GetMapStyle();
|
||||||
settings::Set(settings::kNightMode, i);
|
framework.SetMapStyle((i == 0) ? GetLightMapStyleVariant(currStyle) :
|
||||||
framework.SetMapStyle((nightMode == NightMode::Off) ? GetLightMapStyleVariant(framework.GetMapStyle()) : GetDarkMapStyleVariant(framework.GetMapStyle()));
|
GetDarkMapStyleVariant(currStyle));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user