Skip to content

Commit 5a9715d

Browse files
committed
Define OpenStreetMap actions in .ui file and make Vector menu permanent
1 parent 3cf8840 commit 5a9715d

File tree

3 files changed

+39
-45
lines changed

3 files changed

+39
-45
lines changed

src/app/qgisapp.cpp

+5-39
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
530530
mSaveRollbackInProgress = false;
531531
activateDeactivateLayerRelatedActions( NULL );
532532

533-
QAction* actionOSMDownload = new QAction( tr( "Download data" ), this );
534-
connect( actionOSMDownload, SIGNAL( triggered() ), this, SLOT( osmDownloadDialog() ) );
535-
QAction* actionOSMImport = new QAction( tr( "Import topology from XML" ), this );
536-
connect( actionOSMImport, SIGNAL( triggered() ), this, SLOT( osmImportDialog() ) );
537-
QAction* actionOSMExport = new QAction( tr( "Export topology to SpatiaLite" ), this );
538-
connect( actionOSMExport, SIGNAL( triggered() ), this, SLOT( osmExportDialog() ) );
539-
addPluginToVectorMenu( "OpenStreetMap", actionOSMDownload );
540-
addPluginToVectorMenu( "OpenStreetMap", actionOSMImport );
541-
addPluginToVectorMenu( "OpenStreetMap", actionOSMExport );
542-
543533
addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
544534
mUndoWidget->hide();
545535

@@ -1061,6 +1051,11 @@ void QgisApp::createActions()
10611051
connect( mActionLocalCumulativeCutStretch, SIGNAL( triggered() ), this, SLOT( localCumulativeCutStretch() ) );
10621052
connect( mActionFullCumulativeCutStretch, SIGNAL( triggered() ), this, SLOT( fullCumulativeCutStretch() ) );
10631053

1054+
// Vector Menu Items
1055+
connect( mActionOSMDownload, SIGNAL( triggered() ), this, SLOT( osmDownloadDialog() ) );
1056+
connect( mActionOSMImport, SIGNAL( triggered() ), this, SLOT( osmImportDialog() ) );
1057+
connect( mActionOSMExport, SIGNAL( triggered() ), this, SLOT( osmExportDialog() ) );
1058+
10641059
// Help Menu Items
10651060

10661061
#ifdef Q_WS_MAC
@@ -1312,10 +1307,6 @@ void QgisApp::createMenus()
13121307
// don't add it yet, wait for a plugin
13131308
mDatabaseMenu = new QMenu( tr( "&Database" ), menuBar() );
13141309
mDatabaseMenu->setObjectName( "mDatabaseMenu" );
1315-
// Vector Menu
1316-
// don't add it yet, wait for a plugin
1317-
mVectorMenu = new QMenu( tr( "Vect&or" ), menuBar() );
1318-
mVectorMenu->setObjectName( "mVectorMenu" );
13191310
// Web Menu
13201311
// don't add it yet, wait for a plugin
13211312
mWebMenu = new QMenu( tr( "&Web" ), menuBar() );
@@ -7101,31 +7092,6 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
71017092
{
71027093
QMenu* menu = getVectorMenu( name );
71037094
menu->addAction( action );
7104-
7105-
// add the Vector menu to the menuBar if not added yet
7106-
if ( mVectorMenu->actions().count() != 1 )
7107-
return;
7108-
7109-
QAction* before = NULL;
7110-
QList<QAction*> actions = menuBar()->actions();
7111-
for ( int i = 0; i < actions.count(); i++ )
7112-
{
7113-
if ( actions.at( i )->menu() == mVectorMenu )
7114-
return;
7115-
7116-
// goes before Raster menu, which is already in qgisapp.ui
7117-
if ( actions.at( i )->menu() == mRasterMenu )
7118-
{
7119-
before = actions.at( i );
7120-
break;
7121-
}
7122-
}
7123-
7124-
if ( before )
7125-
menuBar()->insertMenu( before, mVectorMenu );
7126-
else
7127-
// fallback insert
7128-
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mVectorMenu );
71297095
}
71307096

71317097
void QgisApp::addPluginToWebMenu( QString name, QAction* action )

src/app/qgisapp.h

-2
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
12571257
QMenu * mPopupMenu;
12581258
//! Top level database menu
12591259
QMenu *mDatabaseMenu;
1260-
//! Top level vector menu
1261-
QMenu *mVectorMenu;
12621260
//! Top level web menu
12631261
QMenu *mWebMenu;
12641262
//! Popup menu for the map overview tools

src/ui/qgisapp.ui

+34-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>1052</width>
10-
<height>489</height>
9+
<width>1050</width>
10+
<height>487</height>
1111
</rect>
1212
</property>
1313
<widget class="QWidget" name="centralwidget"/>
@@ -16,8 +16,8 @@
1616
<rect>
1717
<x>0</x>
1818
<y>0</y>
19-
<width>1052</width>
20-
<height>24</height>
19+
<width>1050</width>
20+
<height>23</height>
2121
</rect>
2222
</property>
2323
<widget class="QMenu" name="mEditMenu">
@@ -224,12 +224,27 @@
224224
</property>
225225
<addaction name="mActionShowRasterCalculator"/>
226226
</widget>
227+
<widget class="QMenu" name="mVectorMenu">
228+
<property name="title">
229+
<string>Vect&amp;or</string>
230+
</property>
231+
<widget class="QMenu" name="menuOpenStreetMap">
232+
<property name="title">
233+
<string>&amp;OpenStreetMap</string>
234+
</property>
235+
<addaction name="mActionOSMDownload"/>
236+
<addaction name="mActionOSMImport"/>
237+
<addaction name="mActionOSMExport"/>
238+
</widget>
239+
<addaction name="menuOpenStreetMap"/>
240+
</widget>
227241
<addaction name="mFileMenu"/>
228242
<addaction name="mEditMenu"/>
229243
<addaction name="mViewMenu"/>
230244
<addaction name="mLayerMenu"/>
231245
<addaction name="mSettingsMenu"/>
232246
<addaction name="mPluginMenu"/>
247+
<addaction name="mVectorMenu"/>
233248
<addaction name="mRasterMenu"/>
234249
<addaction name="mHelpMenu"/>
235250
</widget>
@@ -1984,6 +1999,21 @@ Acts on currently active editable layer</string>
19841999
<string>Rotate Feature(s)</string>
19852000
</property>
19862001
</action>
2002+
<action name="mActionOSMDownload">
2003+
<property name="text">
2004+
<string>&amp;Download data</string>
2005+
</property>
2006+
</action>
2007+
<action name="mActionOSMImport">
2008+
<property name="text">
2009+
<string>&amp;Import topology from XML</string>
2010+
</property>
2011+
</action>
2012+
<action name="mActionOSMExport">
2013+
<property name="text">
2014+
<string>&amp;Export topology to SpatiaLite</string>
2015+
</property>
2016+
</action>
19872017
</widget>
19882018
<resources>
19892019
<include location="../../images/images.qrc"/>

0 commit comments

Comments
 (0)