Qt 3d preferences #9923
|
@ -430,17 +430,20 @@ MapStyle Framework::GetMapStyle() const
|
|||
|
||||
void Framework::Save3dMode(bool allow3d, bool allow3dBuildings)
|
||||
{
|
||||
m_work.Save3dMode(allow3d, allow3dBuildings);
|
||||
bool _allow3dAlways = false;
|
||||
m_work.Save3dMode(_allow3dAlways, allow3d, allow3dBuildings);
|
||||
}
|
||||
|
||||
void Framework::Set3dMode(bool allow3d, bool allow3dBuildings)
|
||||
{
|
||||
m_work.Allow3dMode(allow3d, allow3dBuildings);
|
||||
bool _allow3dAlways = false;
|
||||
m_work.Allow3dMode(_allow3dAlways, allow3d, allow3dBuildings);
|
||||
}
|
||||
|
||||
void Framework::Get3dMode(bool & allow3d, bool & allow3dBuildings)
|
||||
{
|
||||
m_work.Load3dMode(allow3d, allow3dBuildings);
|
||||
bool _allow3dAlways = false;
|
||||
m_work.Load3dMode(_allow3dAlways, allow3d, allow3dBuildings);
|
||||
}
|
||||
|
||||
void Framework::SetMapLanguageCode(std::string const & languageCode)
|
||||
|
|
|
@ -637,14 +637,15 @@ void DrapeEngine::AllowAutoZoom(bool allowAutoZoom)
|
|||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
void DrapeEngine::Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings)
|
||||
void DrapeEngine::Allow3dMode(bool allowPerspectiveAlways, bool allowPerspectiveInNavigation, bool allow3dBuildings)
|
||||
{
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
make_unique_dp<Allow3dBuildingsMessage>(allow3dBuildings),
|
||||
MessagePriority::Normal);
|
||||
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<Allow3dModeMessage>(allowPerspectiveInNavigation,
|
||||
make_unique_dp<Allow3dModeMessage>(allowPerspectiveAlways,
|
||||
allowPerspectiveInNavigation,
|
||||
allow3dBuildings),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
|
||||
void AllowAutoZoom(bool allowAutoZoom);
|
||||
|
||||
void Allow3dMode(bool allowPerspectiveInNavigation, bool allow3dBuildings);
|
||||
void Allow3dMode(bool allowPerspectiveAlways, bool allowPerspectiveInNavigation, bool allow3dBuildings);
|
||||
void EnablePerspective();
|
||||
|
||||
void UpdateGpsTrackPoints(std::vector<df::GpsTrackPoint> && toAdd,
|
||||
|
|
|
@ -738,14 +738,6 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
|
|||
ref_ptr<Allow3dModeMessage> const msg = message;
|
||||
ScreenBase const & screen = m_userEventStream.GetCurrentScreen();
|
||||
|
||||
#ifdef OMIM_OS_DESKTOP
|
||||
if (m_enablePerspectiveInNavigation == msg->AllowPerspective() &&
|
||||
m_enablePerspectiveInNavigation != screen.isPerspective())
|
||||
{
|
||||
AddUserEvent(make_unique_dp<SetAutoPerspectiveEvent>(m_enablePerspectiveInNavigation));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_enable3dBuildings != msg->Allow3dBuildings())
|
||||
{
|
||||
m_enable3dBuildings = msg->Allow3dBuildings();
|
||||
|
@ -753,9 +745,16 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
|
|||
m_forceUpdateScene = true;
|
||||
}
|
||||
|
||||
if (m_enablePerspectiveInNavigation != msg->AllowPerspective())
|
||||
if (m_enablePerspectiveAlways != msg->AllowPerspectiveAlways()) // &&
|
||||
// m_enablePerspectiveInNavigation != screen.isPerspective())
|
||||
{
|
||||
m_enablePerspectiveInNavigation = msg->AllowPerspective();
|
||||
m_enablePerspectiveAlways = msg->AllowPerspectiveAlways();
|
||||
AddUserEvent(make_unique_dp<SetAutoPerspectiveEvent>(m_enablePerspectiveAlways));
|
||||
}
|
||||
|
||||
if (m_enablePerspectiveInNavigation != msg->AllowPerspectiveInNavigation())
|
||||
{
|
||||
m_enablePerspectiveInNavigation = msg->AllowPerspectiveInNavigation();
|
||||
m_myPositionController->EnablePerspectiveInRouting(m_enablePerspectiveInNavigation);
|
||||
|
||||
if (m_myPositionController->IsInRouting())
|
||||
{
|
||||
|
|
|
@ -323,6 +323,7 @@ private:
|
|||
|
||||
FrameValues m_frameValues;
|
||||
|
||||
bool m_enablePerspectiveAlways;
|
||||
bool m_enablePerspectiveInNavigation;
|
||||
bool m_enable3dBuildings;
|
||||
bool m_isIsometry;
|
||||
|
|
|
@ -850,18 +850,21 @@ public:
|
|||
class Allow3dModeMessage : public Message
|
||||
{
|
||||
public:
|
||||
Allow3dModeMessage(bool allowPerspective, bool allow3dBuildings)
|
||||
: m_allowPerspective(allowPerspective)
|
||||
Allow3dModeMessage(bool allowPerspectiveAlways, bool allowPerspectiveInNavigation, bool allow3dBuildings)
|
||||
: m_allowPerspectiveAlways(allowPerspectiveAlways)
|
||||
, m_allowPerspectiveInNavigation(allowPerspectiveInNavigation)
|
||||
, m_allow3dBuildings(allow3dBuildings)
|
||||
{}
|
||||
|
||||
Type GetType() const override { return Type::Allow3dMode; }
|
||||
|
||||
bool AllowPerspective() const { return m_allowPerspective; }
|
||||
bool AllowPerspectiveAlways() const { return m_allowPerspectiveAlways; }
|
||||
bool AllowPerspectiveInNavigation() const { return m_allowPerspectiveInNavigation; }
|
||||
bool Allow3dBuildings() const { return m_allow3dBuildings; }
|
||||
|
||||
private:
|
||||
bool const m_allowPerspective;
|
||||
bool const m_allowPerspectiveAlways;
|
||||
bool const m_allowPerspectiveInNavigation;
|
||||
bool const m_allow3dBuildings;
|
||||
};
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ static NSString * const kUDDidShowICloudSynchronizationEnablingAlert = @"kUDDidS
|
|||
|
||||
[self.zoomButtonsCell configWithDelegate:self title:L(@"pref_zoom_title") isOn:[MWMSettings zoomButtonsEnabled]];
|
||||
|
||||
bool on = true, _ = true;
|
||||
GetFramework().Load3dMode(_, on);
|
||||
bool _a = false, _ = true, on = true;
|
||||
GetFramework().Load3dMode(_a, _, on);
|
||||
if (GetFramework().GetPowerManager().GetScheme() == Scheme::EconomyMaximum)
|
||||
{
|
||||
self.is3dCell.isEnabled = false;
|
||||
|
@ -218,9 +218,9 @@ static NSString * const kUDDidShowICloudSynchronizationEnablingAlert = @"kUDDidS
|
|||
}
|
||||
|
||||
- (void)configNavigationSection {
|
||||
bool _ = true, on = true;
|
||||
bool _a = false, _ = true, on = true;
|
||||
auto &f = GetFramework();
|
||||
f.Load3dMode(on, _);
|
||||
f.Load3dMode(_a, on, _);
|
||||
[self.perspectiveViewCell configWithDelegate:self title:L(@"pref_map_3d_title") isOn:on];
|
||||
|
||||
[self.autoZoomCell configWithDelegate:self title:L(@"pref_map_auto_zoom") isOn:GetFramework().LoadAutoZoom()];
|
||||
|
@ -300,11 +300,11 @@ static NSString * const kUDDidShowICloudSynchronizationEnablingAlert = @"kUDDidS
|
|||
[MWMSettings setZoomButtonsEnabled:value];
|
||||
} else if (cell == self.is3dCell) {
|
||||
auto &f = GetFramework();
|
||||
bool _ = true, is3dBuildings = true;
|
||||
f.Load3dMode(_, is3dBuildings);
|
||||
bool _a = false, _ = true, is3dBuildings = true;
|
||||
f.Load3dMode(_a, _, is3dBuildings);
|
||||
is3dBuildings = static_cast<bool>(value);
|
||||
f.Save3dMode(_, is3dBuildings);
|
||||
f.Allow3dMode(_, is3dBuildings);
|
||||
f.Save3dMode(_a, _, is3dBuildings);
|
||||
f.Allow3dMode(_a, _, is3dBuildings);
|
||||
} else if (cell == self.autoDownloadCell) {
|
||||
[MWMSettings setAutoDownloadEnabled:value];
|
||||
} else if (cell == self.fontScaleCell) {
|
||||
|
@ -315,11 +315,11 @@ static NSString * const kUDDidShowICloudSynchronizationEnablingAlert = @"kUDDidS
|
|||
[MWMSettings setCompassCalibrationEnabled:value];
|
||||
} else if (cell == self.perspectiveViewCell) {
|
||||
auto &f = GetFramework();
|
||||
bool _ = true, is3d = true;
|
||||
f.Load3dMode(is3d, _);
|
||||
bool _a = false, _ = true, is3d = true;
|
||||
f.Load3dMode(_a, is3d, _);
|
||||
is3d = static_cast<bool>(value);
|
||||
f.Save3dMode(is3d, _);
|
||||
f.Allow3dMode(is3d, _);
|
||||
f.Save3dMode(_a, is3d, _);
|
||||
f.Allow3dMode(_a, is3d, _);
|
||||
} else if (cell == self.autoZoomCell) {
|
||||
auto &f = GetFramework();
|
||||
f.AllowAutoZoom(value);
|
||||
|
|
|
@ -89,7 +89,8 @@ Framework::FixedPosition::FixedPosition()
|
|||
namespace
|
||||
{
|
||||
std::string_view constexpr kMapStyleKey = "MapStyleKeyV1";
|
||||
std::string_view constexpr kAllow3dKey = "Allow3d";
|
||||
std::string_view constexpr kAllow3dAlwaysKey = "Allow3dAlways";
|
||||
std::string_view constexpr kAllow3dInNavigationKey = "allow3dInNavigation";
|
||||
std::string_view constexpr kAllow3dBuildingsKey = "Buildings3d";
|
||||
pastk
commented
Start it with Caps too Start it with Caps too
![]() Valid point. Done. Valid point. Done.
|
||||
std::string_view constexpr kAllowAutoZoom = "AutoZoom";
|
||||
std::string_view constexpr kTrafficEnabledKey = "TrafficEnabled";
|
||||
|
@ -1534,9 +1535,10 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac
|
|||
auto isCountryLoadedByNameFn = bind(&Framework::IsCountryLoadedByName, this, _1);
|
||||
auto updateCurrentCountryFn = bind(&Framework::OnUpdateCurrentCountry, this, _1, _2);
|
||||
|
||||
bool allow3d;
|
||||
bool allow3dAlways;
|
||||
bool allow3dInNavigation;
|
||||
bool allow3dBuildings;
|
||||
Load3dMode(allow3d, allow3dBuildings);
|
||||
Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
|
||||
auto const isAutozoomEnabled = LoadAutoZoom();
|
||||
|
||||
|
@ -1580,7 +1582,7 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac
|
|||
|
||||
OnSize(params.m_surfaceWidth, params.m_surfaceHeight);
|
||||
|
||||
Allow3dMode(allow3d, allow3dBuildings);
|
||||
Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
|
||||
ApplyMapLanguageCode(GetMapLanguageCode());
|
||||
|
||||
|
@ -1591,7 +1593,7 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac
|
|||
|
||||
GetBookmarkManager().SetDrapeEngine(make_ref(m_drapeEngine));
|
||||
m_drapeApi.SetDrapeEngine(make_ref(m_drapeEngine));
|
||||
m_routingManager.SetDrapeEngine(make_ref(m_drapeEngine), allow3d);
|
||||
m_routingManager.SetDrapeEngine(make_ref(m_drapeEngine), allow3dInNavigation);
|
||||
m_trafficManager.SetDrapeEngine(make_ref(m_drapeEngine));
|
||||
m_transitManager.SetDrapeEngine(make_ref(m_drapeEngine));
|
||||
m_isolinesManager.SetDrapeEngine(make_ref(m_drapeEngine));
|
||||
|
@ -2483,30 +2485,35 @@ void Framework::ApplyMapLanguageCode(std::string const & langCode)
|
|||
m_drapeEngine->SetMapLangIndex(langIndex);
|
||||
}
|
||||
|
||||
void Framework::Allow3dMode(bool allow3d, bool allow3dBuildings)
|
||||
void Framework::Allow3dMode(bool allow3dAlways, bool allow3dInNavigation, bool allow3dBuildings)
|
||||
{
|
||||
if (m_drapeEngine == nullptr)
|
||||
return;
|
||||
|
||||
if (!m_powerManager.IsFacilityEnabled(power_management::Facility::PerspectiveView))
|
||||
allow3d = false;
|
||||
allow3dAlways = false, allow3dInNavigation = false;
|
||||
|
||||
if (!m_powerManager.IsFacilityEnabled(power_management::Facility::Buildings3d))
|
||||
allow3dBuildings = false;
|
||||
|
||||
m_drapeEngine->Allow3dMode(allow3d, allow3dBuildings);
|
||||
m_drapeEngine->Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
Save3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
}
|
||||
|
||||
void Framework::Save3dMode(bool allow3d, bool allow3dBuildings)
|
||||
void Framework::Save3dMode(bool allow3dAlways, bool allow3dInNavigation, bool allow3dBuildings)
|
||||
{
|
||||
settings::Set(kAllow3dKey, allow3d);
|
||||
settings::Set(kAllow3dAlwaysKey, allow3dAlways);
|
||||
settings::Set(kAllow3dInNavigationKey, allow3dInNavigation);
|
||||
settings::Set(kAllow3dBuildingsKey, allow3dBuildings);
|
||||
}
|
||||
|
||||
void Framework::Load3dMode(bool & allow3d, bool & allow3dBuildings)
|
||||
void Framework::Load3dMode(bool & allow3dAlways, bool & allow3dInNavigation, bool & allow3dBuildings)
|
||||
{
|
||||
if (!settings::Get(kAllow3dKey, allow3d))
|
||||
allow3d = true;
|
||||
if (!settings::Get(kAllow3dAlwaysKey, allow3dAlways))
|
||||
allow3dAlways = true;
|
||||
|
||||
if (!settings::Get(kAllow3dInNavigationKey, allow3dInNavigation))
|
||||
allow3dInNavigation = true;
|
||||
|
||||
if (!settings::Get(kAllow3dBuildingsKey, allow3dBuildings))
|
||||
allow3dBuildings = true;
|
||||
|
@ -3318,15 +3325,15 @@ void Framework::OnPowerFacilityChanged(power_management::Facility const facility
|
|||
if (facility == power_management::Facility::PerspectiveView ||
|
||||
facility == power_management::Facility::Buildings3d)
|
||||
{
|
||||
bool allow3d = true, allow3dBuildings = true;
|
||||
Load3dMode(allow3d, allow3dBuildings);
|
||||
bool allow3dAlways = true, allow3dInNavigation = true, allow3dBuildings = true;
|
||||
Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
|
||||
if (facility == power_management::Facility::PerspectiveView)
|
||||
allow3d = allow3d && enabled;
|
||||
allow3dAlways = allow3dAlways && enabled, allow3dInNavigation = allow3dInNavigation && enabled;
|
||||
else
|
||||
allow3dBuildings = allow3dBuildings && enabled;
|
||||
|
||||
Allow3dMode(allow3d, allow3dBuildings);
|
||||
Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
}
|
||||
else if (facility == power_management::Facility::TrafficJams)
|
||||
{
|
||||
|
|
|
@ -687,9 +687,9 @@ public:
|
|||
bool LoadTransliteration();
|
||||
void SaveTransliteration(bool allowTranslit);
|
||||
|
||||
void Allow3dMode(bool allow3d, bool allow3dBuildings);
|
||||
void Save3dMode(bool allow3d, bool allow3dBuildings);
|
||||
void Load3dMode(bool & allow3d, bool & allow3dBuildings);
|
||||
void Allow3dMode(bool allow3dAlways, bool allow3dInNavigation, bool allow3dBuildings);
|
||||
void Save3dMode(bool allow3dAlways, bool allow3dInNavigation, bool allow3dBuildings);
|
||||
void Load3dMode(bool & allow3dAlways, bool & allow3dInNavigation, bool & allow3dBuildings);
|
||||
|
||||
private:
|
||||
void ApplyMapLanguageCode(std::string const & langCode);
|
||||
|
|
|
@ -78,6 +78,40 @@ namespace qt
|
|||
});
|
||||
}
|
||||
|
||||
QCheckBox * a3dAlwaysCheckBox = new QCheckBox("3D view always (experimental)");
|
||||
QCheckBox * a3dInNavigationCheckBox = new QCheckBox("3D view during navigation");
|
||||
QCheckBox * a3dBuildingsCheckBox = new QCheckBox("3D buildings");
|
||||
{
|
||||
{
|
||||
bool allow3dAlways, allow3dInNavigation, allow3dBuildings;
|
||||
framework.Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
a3dAlwaysCheckBox->setChecked(allow3dAlways);
|
||||
a3dInNavigationCheckBox->setChecked(allow3dInNavigation);
|
||||
a3dBuildingsCheckBox->setChecked(allow3dBuildings);
|
||||
}
|
||||
connect(a3dAlwaysCheckBox, &QCheckBox::stateChanged, [&framework](int i)
|
||||
{
|
||||
bool allow3dAlways, allow3dInNavigation, allow3dBuildings;
|
||||
framework.Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
allow3dAlways = static_cast<bool>(i);
|
||||
framework.Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
});
|
||||
connect(a3dInNavigationCheckBox, &QCheckBox::stateChanged, [&framework](int i)
|
||||
{
|
||||
bool allow3dAlways, allow3dInNavigation, allow3dBuildings;
|
||||
framework.Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
allow3dInNavigation = static_cast<bool>(i);
|
||||
framework.Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
});
|
||||
connect(a3dBuildingsCheckBox, &QCheckBox::stateChanged, [&framework](int i)
|
||||
{
|
||||
bool allow3dAlways, allow3dInNavigation, allow3dBuildings;
|
||||
framework.Load3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
pastk
commented
Would it make sense to decompose Load3dMode/Allow3dMode into Load3dAlways, Load3dBuildings, etc.? Now it seems like there is a lot of redundant code just because these settings are coupled. Would it make sense to decompose Load3dMode/Allow3dMode into Load3dAlways, Load3dBuildings, etc.?
Now it seems like there is a lot of redundant code just because these settings are coupled.
![]() It would make sense, and I agree this is a bit messy. But this PR is already pretty big and I would rather not start such a refactoring now. Perhaps in a later PR, provided that this even makes it to master. It would make sense, and I agree this is a bit messy. But this PR is already pretty big and I would rather not start such a refactoring now. Perhaps in a later PR, provided that this even makes it to master.
|
||||
allow3dBuildings = static_cast<bool>(i);
|
||||
framework.Allow3dMode(allow3dAlways, allow3dInNavigation, allow3dBuildings);
|
||||
});
|
||||
}
|
||||
|
||||
QCheckBox * largeFontCheckBox = new QCheckBox("Use larger font on the map");
|
||||
{
|
||||
largeFontCheckBox->setChecked(framework.LoadLargeFontsSize());
|
||||
|
@ -197,6 +231,9 @@ namespace qt
|
|||
|
||||
QVBoxLayout * finalLayout = new QVBoxLayout();
|
||||
finalLayout->addWidget(unitsRadioBox);
|
||||
finalLayout->addWidget(a3dAlwaysCheckBox);
|
||||
finalLayout->addWidget(a3dInNavigationCheckBox);
|
||||
finalLayout->addWidget(a3dBuildingsCheckBox);
|
||||
finalLayout->addWidget(largeFontCheckBox);
|
||||
finalLayout->addWidget(transliterationCheckBox);
|
||||
finalLayout->addWidget(developerModeCheckBox);
|
||||
|
|
|
@ -188,8 +188,7 @@ bool SearchPanel::Try3dModeCmd(std::string const & str)
|
|||
if (!is3dModeOn && !is3dBuildingsOn && !is3dModeOff)
|
||||
return false;
|
||||
|
||||
GetFramework().Save3dMode(is3dModeOn || is3dBuildingsOn, is3dBuildingsOn);
|
||||
GetFramework().Allow3dMode(is3dModeOn || is3dBuildingsOn, is3dBuildingsOn);
|
||||
GetFramework().Allow3dMode(false, is3dModeOn, is3dBuildingsOn);
|
||||
|
||||
return true;
|
||||
pastk
commented
Add a switch for the "3d mode always"? Also is it possible to have a 3d mode without 3d buildings? Add a switch for the "3d mode always"?
Also is it possible to have a 3d mode without 3d buildings?
![]()
IMHO these switches here are all hacks, and perhaps they should be rather removed completely. IMHO, the UI elements on the preferences dialog should be used exclusively.
Yes absolutely possible. You can try it out on the preferences dialog. > Add a switch for the "3d mode always"?
IMHO these switches here are all hacks, and perhaps they should be rather removed completely. IMHO, the UI elements on the preferences dialog should be used exclusively.
> Also is it possible to have a 3d mode without 3d buildings?
Yes absolutely possible. You can try it out on the preferences dialog.
|
||||
}
|
||||
|
|
Why commented? It doesn't work as intended?