Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add QgisApp::messageTimeout() to iface sip file
- [API] Remove recently added, and unnecessary, mMessageTimeout and setMessageTimeout() from QgisApp
  • Loading branch information
dakcarto committed Jan 14, 2013
1 parent e435762 commit b288b3a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
4 changes: 4 additions & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -398,6 +398,10 @@ class QgisInterface : QObject
* @note added in 1.9 */
virtual QList<QgsMapLayer *> editableLayers( bool modified = false ) const = 0;

/** Get timeout for timed messages: default of 5 seconds
* @note added in 1.9 */
virtual int messageTimeout() = 0;

signals:
/** Emited whenever current (selected) layer changes.
* The pointer to layer can be null if no layer is selected
Expand Down
7 changes: 6 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -488,7 +488,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mInfoBar = new QgsMessageBar( centralWidget );
mInfoBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
centralLayout->addWidget( mInfoBar, 0, 0, 1, 1 );
mMessageTimeout = settings.value( "/qgis/messageTimeout", 5 ).toInt();

//set the focus to the map canvas
mMapCanvas->setFocus();
Expand Down Expand Up @@ -1218,6 +1217,12 @@ void QgisApp::setAppStyleSheet()
}
}

int QgisApp::messageTimeout()
{
QSettings settings;
return settings.value( "/qgis/messageTimeout", 5 ).toInt();
}

void QgisApp::createMenus()
{
/*
Expand Down
10 changes: 1 addition & 9 deletions src/app/qgisapp.h
Expand Up @@ -400,7 +400,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

/** Get timeout for timed messages: default of 5 seconds
* @note added in 1.9 */
int messageTimeout() { return mMessageTimeout; }
int messageTimeout();

#ifdef Q_OS_WIN
//! ugly hack
Expand Down Expand Up @@ -543,11 +543,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! layer selection changed
void legendLayerSelectionChanged( void );

/** Set timeout for timed messages
* @param t timeout in seconds
* @note added in 1.9 */
void setMessageTimeout( int t ) { mMessageTimeout = t; }

//! Watch for QFileOpenEvent.
virtual bool event( QEvent * event );

Expand Down Expand Up @@ -1342,9 +1337,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QgsMessageBar *mInfoBar;
QWidget *mMacrosWarn;

//! timeout for timed messages
int mMessageTimeout;

#ifdef HAVE_TOUCH
bool gestureEvent( QGestureEvent *event );
void tapAndHoldTriggered( QTapAndHoldGesture *gesture );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -485,3 +485,8 @@ QList<QgsMapLayer *> QgisAppInterface::editableLayers( bool modified ) const
{
return qgis->editableLayers( modified );
}

int QgisAppInterface::messageTimeout()
{
return qgis->messageTimeout();
}
4 changes: 4 additions & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -353,6 +353,10 @@ class QgisAppInterface : public QgisInterface
* @note added in 1.9 */
virtual QList<QgsMapLayer *> editableLayers( bool modified = false ) const;

/** Get timeout for timed messages: default of 5 seconds
* @note added in 1.9 */
virtual int messageTimeout();

signals:
void currentThemeChanged( QString );

Expand Down
1 change: 0 additions & 1 deletion src/app/qgsoptions.cpp
Expand Up @@ -1081,7 +1081,6 @@ void QgsOptions::saveOptions()
QgisApp::instance()->setAppStyleSheet();

settings.setValue( "/qgis/messageTimeout", mMessageTimeoutSpnBx->value() );
QgisApp::instance()->setMessageTimeout( mMessageTimeoutSpnBx->value() );

// rasters settings
settings.setValue( "/Raster/defaultRedBand", spnRed->value() );
Expand Down
4 changes: 4 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -446,6 +446,10 @@ class GUI_EXPORT QgisInterface : public QObject
* @note added in 1.9 */
virtual QList<QgsMapLayer *> editableLayers( bool modified = false ) const = 0;

/** Get timeout for timed messages: default of 5 seconds
* @note added in 1.9 */
virtual int messageTimeout() = 0;

signals:
/** Emited whenever current (selected) layer changes.
* The pointer to layer can be null if no layer is selected
Expand Down

0 comments on commit b288b3a

Please sign in to comment.