Skip to content

Commit

Permalink
added QgsMessageBar::SUCCESS
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernasocchi committed Dec 14, 2014
1 parent fc00baf commit b6632a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion python/gui/qgsmessagebar.sip
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class QgsMessageBar: QFrame
INFO,
WARNING,
CRITICAL,
SUCCESS
};

QgsMessageBar( QWidget *parent = 0 );
Expand All @@ -24,7 +25,7 @@ class QgsMessageBar: QFrame
/*! display a widget as a message on the bar after hiding the currently visible one
* and putting it in a stack.
* @param widget message widget to display
* @param level is QgsMessageBar::INFO, WARNING or CRITICAL
* @param level is QgsMessageBar::INFO, WARNING, CRITICAL or SUCCESS
* @param duration timeout duration of message in seconds, 0 value indicates no timeout
*/
QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, MessageLevel level = INFO, int duration = 0 );
Expand Down
5 changes: 3 additions & 2 deletions src/gui/qgsmessagebar.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class GUI_EXPORT QgsMessageBar: public QFrame
{
INFO = 0,
WARNING = 1,
CRITICAL = 2
CRITICAL = 2,
SUCCESS = 3
};

QgsMessageBar( QWidget *parent = 0 );
Expand All @@ -63,7 +64,7 @@ class GUI_EXPORT QgsMessageBar: public QFrame
/*! display a widget as a message on the bar after hiding the currently visible one
* and putting it in a stack.
* @param widget message widget to display
* @param level is QgsMessageBar::INFO, WARNING or CRITICAL
* @param level is QgsMessageBar::INFO, WARNING, CRITICAL or SUCCESS
* @param duration timeout duration of message in seconds, 0 value indicates no timeout
*/
QgsMessageBarItem *pushWidget( QWidget *widget, MessageLevel level = INFO, int duration = 0 );
Expand Down
12 changes: 10 additions & 2 deletions src/gui/qgsmessagebaritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ void QgsMessageBarItem::writeContent()
case QgsMessageBar::WARNING:
msgIcon = QString( "/mIconWarn.png" );
break;
case QgsMessageBar::SUCCESS:
msgIcon = QString( "/mActionCheckQgisVersion.png" );
break;
default:
break;
}
Expand Down Expand Up @@ -167,7 +170,12 @@ void QgsMessageBarItem::writeContent()
}

// STYLESHEET
if ( mLevel >= QgsMessageBar::CRITICAL )
if ( mLevel == QgsMessageBar::SUCCESS )
{
mStyleSheet = "QgsMessageBar { background-color: #dff0d8; border: 1px solid #8e998a; } "
"QLabel,QTextEdit { color: black; } ";
}
else if ( mLevel == QgsMessageBar::CRITICAL )
{
mStyleSheet = "QgsMessageBar { background-color: #d65253; border: 1px solid #9b3d3d; } "
"QLabel,QTextEdit { color: white; } ";
Expand All @@ -177,7 +185,7 @@ void QgsMessageBarItem::writeContent()
mStyleSheet = "QgsMessageBar { background-color: #ffc800; border: 1px solid #e0aa00; } "
"QLabel,QTextEdit { color: black; } ";
}
else if ( mLevel <= QgsMessageBar::INFO )
else if ( mLevel == QgsMessageBar::INFO )
{
mStyleSheet = "QgsMessageBar { background-color: #e7f5fe; border: 1px solid #b9cfe4; } "
"QLabel,QTextEdit { color: #2554a1; } ";
Expand Down

0 comments on commit b6632a8

Please sign in to comment.