summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Bugrov <[email protected]>2015-07-25 07:42:07 +0200
committerDennis Nienhüser <[email protected]>2015-07-25 07:42:07 +0200
commit7f63f9c9c8e1987d581015a222e192cd832c607e (patch)
tree5845bbefba9d2fb05ed68efcf3efe3ef92a7d08f
parent12c2f58bcd77c208787ca93472310ea490ad25ea (diff)
Allow changing angle unit with right click on status bar (Qt Marble)
CCBUG: 344364 REVIEW: 124287
-rw-r--r--src/apps/marble-qt/QtMainWindow.cpp48
-rw-r--r--src/apps/marble-qt/QtMainWindow.h5
-rw-r--r--src/lib/marble/QtMarbleConfigDialog.cpp7
-rw-r--r--src/lib/marble/QtMarbleConfigDialog.h1
4 files changed, 61 insertions, 0 deletions
diff --git a/src/apps/marble-qt/QtMainWindow.cpp b/src/apps/marble-qt/QtMainWindow.cpp
index b3f4ee3..3ae8471 100644
--- a/src/apps/marble-qt/QtMainWindow.cpp
+++ b/src/apps/marble-qt/QtMainWindow.cpp
@@ -164,6 +164,10 @@ MainWindow::MainWindow(const QString& marbleDataPath, const QVariantMap& cmdLine
m_clockLabel( 0 ),
m_downloadProgressBar( 0 ),
m_toggleTileLevelAction( 0 ),
+ m_angleDisplayUnitActionGroup( 0 ),
+ m_dmsDegreeAction( 0 ),
+ m_decimalDegreeAction( 0 ),
+ m_utmAction( 0 ),
//Bookmark Menu
m_addBookmarkAction( 0 ),
@@ -424,6 +428,26 @@ void MainWindow::createActions()
connect( m_toggleTileLevelAction, SIGNAL(triggered(bool)),
this, SLOT(showZoomLevel(bool)) );
+ m_angleDisplayUnitActionGroup = new QActionGroup( statusBar() );
+
+ m_dmsDegreeAction = new QAction( tr( "Degree (DMS)" ), statusBar() );
+ m_dmsDegreeAction->setCheckable( true );
+ m_dmsDegreeAction->setData( (int)DMSDegree );
+ m_angleDisplayUnitActionGroup->addAction(m_dmsDegreeAction);
+
+ m_decimalDegreeAction = new QAction( tr( "Degree (Decimal)" ), statusBar() );
+ m_decimalDegreeAction->setCheckable( true );
+ m_decimalDegreeAction->setData( (int)DecimalDegree );
+ m_angleDisplayUnitActionGroup->addAction(m_decimalDegreeAction);
+
+ m_utmAction = new QAction( tr( "Universal Transverse Mercator (UTM)" ), statusBar() );
+ m_utmAction->setCheckable( true );
+ m_utmAction->setData( (int)UTM );
+ m_angleDisplayUnitActionGroup->addAction(m_utmAction);
+
+ connect( m_angleDisplayUnitActionGroup, SIGNAL(triggered(QAction*)),
+ this, SLOT(changeAngleDisplayUnit(QAction*)) );
+
// View size actions
m_viewSizeActsGroup = ControlView::createViewSizeActionGroup( this );
connect( m_viewSizeActsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeViewSize(QAction*)) );
@@ -953,6 +977,18 @@ void MainWindow::updateStatusBar()
if ( m_clockLabel )
m_clockLabel->setText( QString( "%1 %2" )
.arg( tr( DATETIME_STRING ) ).arg( m_clock ) );
+
+ switch ( m_configDialog->angleUnit() ) {
+ case DMSDegree:
+ m_dmsDegreeAction->setChecked( true );
+ break;
+ case DecimalDegree:
+ m_decimalDegreeAction->setChecked( true );
+ break;
+ case UTM:
+ m_utmAction->setChecked( true );
+ break;
+ }
}
void MainWindow::openFile()
@@ -996,6 +1032,13 @@ void MainWindow::setupStatusBar()
statusBar()->setContextMenuPolicy( Qt::ActionsContextMenu );
statusBar()->addAction( m_toggleTileLevelAction );
+
+ QMenu *angleDisplayUnitMenu = new QMenu( );
+ angleDisplayUnitMenu->addActions( m_angleDisplayUnitActionGroup->actions() );
+ QAction *angleDisplayUnitMenuAction = new QAction( tr("&Angle Display Unit"), statusBar() );
+ angleDisplayUnitMenuAction->setMenu( angleDisplayUnitMenu );
+ statusBar()->addAction( angleDisplayUnitMenuAction );
+
setupDownloadProgressBar();
m_positionLabel = new QLabel( );
@@ -1612,6 +1655,11 @@ void MainWindow::showZoomLevel(bool show)
m_toggleTileLevelAction->setChecked( show );
}
+void MainWindow::changeAngleDisplayUnit( QAction *action )
+{
+ m_configDialog->setAngleUnit((Marble::AngleUnit)action->data().toInt());
+}
+
void MainWindow::fallBackToDefaultTheme()
{
m_controlView->marbleWidget()->setMapThemeId( m_controlView->defaultMapThemeId() );
diff --git a/src/apps/marble-qt/QtMainWindow.h b/src/apps/marble-qt/QtMainWindow.h
index 612abcf..ff82641 100644
--- a/src/apps/marble-qt/QtMainWindow.h
+++ b/src/apps/marble-qt/QtMainWindow.h
@@ -139,6 +139,7 @@ private Q_SLOTS:
void downloadRegion();
void showZoomLevel( bool show );
+ void changeAngleDisplayUnit( QAction *action );
void handleProgress( int, int );
void removeProgressItem();
@@ -215,6 +216,10 @@ private:
QLabel *m_clockLabel;
QProgressBar *m_downloadProgressBar;
QAction *m_toggleTileLevelAction;
+ QActionGroup *m_angleDisplayUnitActionGroup;
+ QAction *m_dmsDegreeAction;
+ QAction *m_decimalDegreeAction;
+ QAction *m_utmAction;
void updateStatusBar();
//Bookmark Menu
diff --git a/src/lib/marble/QtMarbleConfigDialog.cpp b/src/lib/marble/QtMarbleConfigDialog.cpp
index 77fb7d5..8c989dc 100644
--- a/src/lib/marble/QtMarbleConfigDialog.cpp
+++ b/src/lib/marble/QtMarbleConfigDialog.cpp
@@ -516,6 +516,13 @@ Marble::AngleUnit QtMarbleConfigDialog::angleUnit() const
return (Marble::AngleUnit) d->m_settings.value( "View/angleUnit", Marble::DMSDegree ).toInt();
}
+void QtMarbleConfigDialog::setAngleUnit(Marble::AngleUnit unit)
+{
+ d->m_settings.setValue( "View/angleUnit", (int)unit );
+ d->ui_viewSettings.kcfg_angleUnit->setCurrentIndex( angleUnit() );
+ emit settingsChanged();
+}
+
Marble::MapQuality QtMarbleConfigDialog::stillQuality() const
{
return (Marble::MapQuality) d->m_settings.value( "View/stillQuality",
diff --git a/src/lib/marble/QtMarbleConfigDialog.h b/src/lib/marble/QtMarbleConfigDialog.h
index 1fbee43..7d3f152 100644
--- a/src/lib/marble/QtMarbleConfigDialog.h
+++ b/src/lib/marble/QtMarbleConfigDialog.h
@@ -39,6 +39,7 @@ class MARBLE_EXPORT QtMarbleConfigDialog : public QDialog
MarbleLocale::MeasurementSystem measurementSystem() const;
Marble::AngleUnit angleUnit() const;
+ void setAngleUnit(Marble::AngleUnit unit);
Marble::MapQuality stillQuality() const;
Marble::MapQuality animationQuality() const;
QFont mapFont() const;