Skip to content

Commit

Permalink
added Database toolbar in addition to the Database menu
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Dec 20, 2011
1 parent aa2e69a commit 4dc50e7
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class QgisInterface : QObject
//! Remove an action (icon) from the Vector toolbar
//! @note added in 2.0
virtual void removeVectorToolBarIcon(QAction *qAction) = 0;
//! Add an icon to the Database toolbar
//! @note added in 2.0
virtual int addDatabaseToolBarIcon(QAction *qAction) =0;
//! Remove an action (icon) from the Database toolbar
//! @note added in 2.0
virtual void removeDatabaseToolBarIcon(QAction *qAction) = 0;

//! Add toolbar with specified name
virtual QToolBar* addToolBar(QString name)=0 /Factory/;
Expand Down Expand Up @@ -201,6 +207,7 @@ class QgisInterface : QObject
virtual QMenu *settingsMenu() = 0;
virtual QMenu *pluginMenu() = 0;
virtual QMenu *rasterMenu() = 0;
//** @note added in 2.0
virtual QMenu *vectorMenu() = 0;
virtual QMenu *databaseMenu() = 0;
virtual QMenu *firstRightStandardMenu() = 0;
Expand All @@ -217,7 +224,10 @@ class QgisInterface : QObject
virtual QToolBar *pluginToolBar() = 0;
virtual QToolBar *helpToolBar() = 0;
virtual QToolBar *rasterToolBar() = 0;
//** @note added in 2.0
virtual QToolBar *vectorToolBar() = 0;
//** @note added in 2.0
virtual QToolBar *databaseToolBar() = 0;

//! File menu actions
virtual QAction *actionNewProject() = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ void QgisApp::createToolBars()
<< mHelpToolBar
<< mRasterToolBar
<< mVectorToolBar
<< mDatabaseToolBar
<< mLabelToolBar;

QList<QAction*> toolbarMenuActions;
Expand Down Expand Up @@ -5549,6 +5550,17 @@ void QgisApp::removeVectorToolBarIcon( QAction *qAction )
mVectorToolBar->removeAction( qAction );
}

int QgisApp::addDatabaseToolBarIcon( QAction * qAction )
{
mDatabaseToolBar->addAction( qAction );
return 0;
}

void QgisApp::removeDatabaseToolBarIcon( QAction *qAction )
{
mDatabaseToolBar->removeAction( qAction );
}

void QgisApp::updateCRSStatusBar()
{
mOnTheFlyProjectionStatusLabel->setText( mMapCanvas->mapRenderer()->destinationCrs().authid() );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QToolBar *helpToolBar() { return mHelpToolBar; }
QToolBar *rasterToolBar() { return mRasterToolBar; }
QToolBar *vectorToolBar() { return mVectorToolBar; }
QToolBar *databaseToolBar() { return mDatabaseToolBar; }

//! show layer properties
void showLayerProperties( QgsMapLayer *ml );
Expand Down Expand Up @@ -558,6 +559,10 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
int addVectorToolBarIcon( QAction * qAction );
//! Remove an icon from the Vector toolbar
void removeVectorToolBarIcon( QAction *qAction );
//! Add an icon to the Database toolbar
int addDatabaseToolBarIcon( QAction * qAction );
//! Remove an icon from the Database toolbar
void removeDatabaseToolBarIcon( QAction *qAction );
//! Save window state
void saveWindowState();
//! Restore the window and toolbar state
Expand Down
11 changes: 11 additions & 0 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ void QgisAppInterface::removeVectorToolBarIcon( QAction *qAction )
qgis->removeVectorToolBarIcon( qAction );
}

int QgisAppInterface::addDatabaseToolBarIcon( QAction * qAction )
{
return qgis->addDatabaseToolBarIcon( qAction );
}

void QgisAppInterface::removeDatabaseToolBarIcon( QAction *qAction )
{
qgis->removeDatabaseToolBarIcon( qAction );
}

QToolBar* QgisAppInterface::addToolBar( QString name )
{
return qgis->addToolBar( name );
Expand Down Expand Up @@ -336,6 +346,7 @@ QToolBar *QgisAppInterface::pluginToolBar() { return qgis->pluginToolBar(); }
QToolBar *QgisAppInterface::helpToolBar() { return qgis->helpToolBar(); }
QToolBar *QgisAppInterface::rasterToolBar() { return qgis->rasterToolBar(); }
QToolBar *QgisAppInterface::vectorToolBar() { return qgis->vectorToolBar(); }
QToolBar *QgisAppInterface::databaseToolBar() { return qgis->databaseToolBar(); }

//! File menu actions
QAction *QgisAppInterface::actionNewProject() { return qgis->actionNewProject(); }
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisappinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class QgisAppInterface : public QgisInterface
int addVectorToolBarIcon( QAction *qAction );
//! Remove an icon (action) from the Vector toolbar
void removeVectorToolBarIcon( QAction *qAction );
//! Add an icon to the Database toolbar
int addDatabaseToolBarIcon( QAction *qAction );
//! Remove an icon (action) from the Database toolbar
void removeDatabaseToolBarIcon( QAction *qAction );

//! Add toolbar with specified name
QToolBar* addToolBar( QString name );
Expand Down Expand Up @@ -204,6 +208,7 @@ class QgisAppInterface : public QgisInterface
virtual QToolBar *helpToolBar();
virtual QToolBar *rasterToolBar();
virtual QToolBar *vectorToolBar();
virtual QToolBar *databaseToolBar();

//! File menu actions
virtual QAction *actionNewProject();
Expand Down
11 changes: 11 additions & 0 deletions src/gui/qgisinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ class GUI_EXPORT QgisInterface : public QObject
//! @note added in 2.0
virtual void removeVectorToolBarIcon( QAction *qAction ) = 0;

//! Add an icon to the Database toolbar
//! @note added in 2.0
virtual int addDatabaseToolBarIcon( QAction *qAction ) = 0;

//! Remove an action (icon) from the Database toolbar
//! @note added in 2.0
virtual void removeDatabaseToolBarIcon( QAction *qAction ) = 0;

//! Add toolbar with specified name
virtual QToolBar * addToolBar( QString name ) = 0;

Expand Down Expand Up @@ -286,6 +294,9 @@ class GUI_EXPORT QgisInterface : public QObject
/** \note added in 2.0
*/
virtual QToolBar *vectorToolBar() = 0;
/** \note added in 2.0
*/
virtual QToolBar *databaseToolBar() = 0;

//! File menu actions
virtual QAction *actionNewProject() = 0;
Expand Down
11 changes: 11 additions & 0 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="mDatabaseToolBar">
<property name="windowTitle">
<string>Database</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="mActionNewProject">
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand Down

0 comments on commit 4dc50e7

Please sign in to comment.