Added traffic button to Qt-app

This commit is contained in:
r.kuznetsov 2016-12-06 11:29:10 +03:00
parent 60e63c885e
commit 42475f3386
5 changed files with 18 additions and 1 deletions

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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();
};
}

View file

@ -14,6 +14,7 @@
<file>select.png</file>
<file>selectmode.png</file>
<file>clear.png</file>
<file>traffic.png</file>
</qresource>
<qresource prefix="/ui">
<file>logo.png</file>

BIN
qt/res/traffic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB