Skip to content

Commit

Permalink
[log message] changing the message log icon in order to warning the u…
Browse files Browse the repository at this point in the history
…ser when a log message has been received
  • Loading branch information
slarosa committed Sep 13, 2015
1 parent e186331 commit 0c58f9c
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 2 deletions.
3 changes: 2 additions & 1 deletion images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@
<file>themes/default/mIconZip.png</file>
<file>themes/default/mIconZoom.svg</file>
<file>themes/default/mMapserverExport.png</file>
<file>themes/default/mMessageLog.svg</file>
<file>themes/default/mMessageLogRead.svg</file>
<file>themes/default/north_arrow.png</file>
<file>themes/default/pie-chart.png</file>
<file>themes/default/plugin.png</file>
Expand Down Expand Up @@ -504,7 +506,6 @@
<file>themes/default/cadtools/parallel.png</file>
<file>themes/default/cadtools/perpendicular.png</file>
<file>themes/default/mIconSuccess.png</file>
<file>themes/default/bubble.svg</file>
<file>themes/default/mIconClear.png</file>
<file>flags/zh.png</file>
<file>themes/default/mIconPaintEffects.svg</file>
Expand Down
92 changes: 92 additions & 0 deletions images/themes/default/mMessageLog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
16 changes: 15 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mLogDock->hide();
connect( mMessageButton, SIGNAL( toggled( bool ) ), mLogDock, SLOT( setVisible( bool ) ) );
connect( mLogDock, SIGNAL( visibilityChanged( bool ) ), mMessageButton, SLOT( setChecked( bool ) ) );
connect( QgsMessageLog::instance(), SIGNAL( messageReceived( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) );
connect( mMessageButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleLogMessageIcon( bool ) ) );
mVectorLayerTools = new QgsGuiVectorLayerTools();

// Init the editor widget types
Expand Down Expand Up @@ -2009,7 +2011,7 @@ void QgisApp::createStatusBar()

mMessageButton = new QToolButton( statusBar() );
mMessageButton->setAutoRaise( true );
mMessageButton->setIcon( QgsApplication::getThemeIcon( "bubble.svg" ) );
mMessageButton->setIcon( QgsApplication::getThemeIcon( "/mMessageLogRead.svg" ) );
mMessageButton->setToolTip( tr( "Messages" ) );
mMessageButton->setWhatsThis( tr( "Messages" ) );
mMessageButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
Expand Down Expand Up @@ -2539,6 +2541,18 @@ QgsMessageBar* QgisApp::messageBar()
return mInfoBar;
}

void QgisApp::toggleLogMessageIcon( bool hasLogMessage )
{
if ( hasLogMessage && !mLogDock->isVisible() )
{
mMessageButton->setIcon( QgsApplication::getThemeIcon( "/mMessageLog.svg" ) );
}
else
{
mMessageButton->setIcon( QgsApplication::getThemeIcon( "/mMessageLogRead.svg" ) );
}
}

void QgisApp::addUserInputWidget( QWidget *widget )
{
mUserInputDockWidget->addUserInputWidget( widget );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! map layers changed
void showMapCanvas();

//! change log message icon in statusbar
void toggleLogMessageIcon( bool hasLogMessage );

/** Called when some layer's editing mode was toggled on/off */
void layerEditStateChanged();

Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsmessagelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ void QgsMessageLog::logMessage( QString message, QString tag, QgsMessageLog::Mes
void QgsMessageLog::emitMessage( QString message, QString tag, QgsMessageLog::MessageLevel level )
{
emit messageReceived( message, tag, level );
if ( level != QgsMessageLog::INFO )
{
emit messageReceived( true );
}
}

QgsMessageLogConsole::QgsMessageLogConsole()
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsmessagelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class CORE_EXPORT QgsMessageLog : public QObject
signals:
void messageReceived( QString message, QString tag, QgsMessageLog::MessageLevel level );

void messageReceived( bool received );

private:
QgsMessageLog();

Expand Down

0 comments on commit 0c58f9c

Please sign in to comment.