diff --git a/map/framework.cpp b/map/framework.cpp index 9fcc720e9c..400b3644a6 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2715,7 +2715,7 @@ void Framework::Load3dMode(bool & allow3d, bool & allow3dBuildings) bool Framework::LoadTrafficEnabled() { - bool enabled = true; //TODO(@rokuz): temporary. It has to be false by default. + bool enabled = false; settings::Get(kTrafficEnabledKey, enabled); return enabled; } diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index a233206e34..3f197a57eb 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -277,6 +277,12 @@ void MainWindow::CreateNavigationBar() } { + m_trafficEnableAction = pToolBar->addAction(QIcon(":/navig64/traffic.png"), tr("Show traffic"), + this, SLOT(OnTrafficEnabled())); + m_trafficEnableAction->setCheckable(true); + m_trafficEnableAction->setChecked(m_pDrawWidget->GetFramework().LoadTrafficEnabled()); + pToolBar->addSeparator(); + // TODO(AlexZ): Replace icon. m_pCreateFeatureAction = pToolBar->addAction(QIcon(":/navig64/select.png"), tr("Create Feature"), this, SLOT(OnCreateFeatureClicked())); @@ -588,4 +594,11 @@ void MainWindow::OnRetryDownloadClicked() m_pDrawWidget->RetryToDownloadCountry(m_lastCountry); } +void MainWindow::OnTrafficEnabled() +{ + bool const enabled = m_trafficEnableAction->isChecked(); + m_pDrawWidget->GetFramework().GetTrafficManager().SetEnabled(enabled); + m_pDrawWidget->GetFramework().SaveTrafficEnabled(enabled); +} + } diff --git a/qt/mainwindow.hpp b/qt/mainwindow.hpp index 0812beb2a2..7f8a8f9f46 100644 --- a/qt/mainwindow.hpp +++ b/qt/mainwindow.hpp @@ -31,6 +31,7 @@ namespace qt QAction * m_selectionMode; QAction * m_clearSelection; QAction * m_pSearchAction; + QAction * m_trafficEnableAction; DrawWidget * m_pDrawWidget; QDockWidget * m_Docks[1]; @@ -89,5 +90,7 @@ namespace qt void OnSwitchSelectionMode(); void OnClearSelection(); + + void OnTrafficEnabled(); }; } diff --git a/qt/res/resources.qrc b/qt/res/resources.qrc index 5f53a1fe33..f76648f7da 100644 --- a/qt/res/resources.qrc +++ b/qt/res/resources.qrc @@ -14,6 +14,7 @@ select.png selectmode.png clear.png + traffic.png logo.png diff --git a/qt/res/traffic.png b/qt/res/traffic.png new file mode 100644 index 0000000000..add88ebfba Binary files /dev/null and b/qt/res/traffic.png differ