Commit 6a6ad7b5 authored by Dirk Wilden's avatar Dirk Wilden
Browse files

colorstatusbar

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6196 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e78fb828
#include "ColorStatusBar.hh"
ColorStatusBar::ColorStatusBar(QWidget* parent) : QStatusBar(parent)
{
connect (this, SIGNAL(messageChanged(const QString&)), this, SLOT(slotMessageChanged(const QString &)) );
colored_ = false;
}
void ColorStatusBar::showMessage(const QString & message, int timeout)
{
QStatusBar::showMessage(message, timeout);
}
void ColorStatusBar::showMessage(const QString & message, QColor _color, int timeout)
{
QPalette pal = palette();
pal.setColor(QPalette::Active, QPalette::WindowText, _color );
setPalette(pal);
colored_ = true;
QStatusBar::showMessage(message, timeout);
}
void ColorStatusBar::slotMessageChanged(const QString & message)
{
if ( !colored_ ){
QPalette pal = palette();
pal.setColor(QPalette::Active, QPalette::WindowText, QColor(Qt::black) );
setPalette(pal);
} else
colored_ = false;
}
#ifndef COLORSTATUSBAR_HH
#define COLORSTATUSBAR_HH
#include <QStatusBar>
class ColorStatusBar : public QStatusBar
{
Q_OBJECT
public:
ColorStatusBar(QWidget* parent = 0 );
public slots:
void showMessage ( const QString& message, int timeout = 0 );
void showMessage ( const QString& message, QColor _color, int timeout = 0 );
private slots:
void slotMessageChanged ( const QString & message );
private:
bool colored_;
};
#endif //COLORSTATUSBAR_HH
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh> #include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/widgets/coreWidget/SideArea.hh> #include <OpenFlipper/widgets/coreWidget/SideArea.hh>
#include <OpenFlipper/widgets/coreWidget/ColorStatusBar.hh>
#include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh> #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
#include <OpenFlipper/widgets/glWidget/QtGLGraphicsScene.hh> #include <OpenFlipper/widgets/glWidget/QtGLGraphicsScene.hh>
...@@ -765,7 +766,7 @@ public: ...@@ -765,7 +766,7 @@ public:
void setupStatusBar(); void setupStatusBar();
private : private :
QStatusBar* statusBar_; ColorStatusBar* statusBar_;
QLabel* statusIcon_; QLabel* statusIcon_;
......
...@@ -63,26 +63,33 @@ ...@@ -63,26 +63,33 @@
void void
CoreWidget:: CoreWidget::
slotLog(Logtype _type, QString _message) { slotLog(Logtype _type, QString _message) {
QColor textColor;
switch (_type) { switch (_type) {
case LOGINFO: case LOGINFO:
logWidget_->setTextColor(QColor(0,160,0)); textColor = QColor(0,160,0);
break; break;
case LOGOUT: case LOGOUT:
logWidget_->setTextColor(QColor(0,0,0)); textColor = QColor(0,0,0);
break; break;
case LOGWARN: case LOGWARN:
logWidget_->setTextColor(QColor(160,160,0)); textColor = QColor(160,160,0);
break; break;
case LOGERR: case LOGERR:
logWidget_->setTextColor(QColor(250,0,0)); textColor = QColor(250,0,0);
break; break;
} }
logWidget_->setTextColor( textColor );
logWidget_->append(_message); logWidget_->append(_message);
QScrollBar* bar = logWidget_->verticalScrollBar(); QScrollBar* bar = logWidget_->verticalScrollBar();
bar->setValue(bar->maximum()); bar->setValue(bar->maximum());
if (_type == LOGERR)
statusBar_->showMessage(_message,textColor, 4000);
// Make shure, we see the message // Make shure, we see the message
// QApplication::processEvents(); // QApplication::processEvents();
} }
......
...@@ -59,8 +59,10 @@ void CoreWidget::statusMessage(QString _message, int _timeout) { ...@@ -59,8 +59,10 @@ void CoreWidget::statusMessage(QString _message, int _timeout) {
void CoreWidget::setupStatusBar() void CoreWidget::setupStatusBar()
{ {
statusBar_ = statusBar(); statusBar_ = new ColorStatusBar();
setStatusBar( statusBar_ );
QPixmap pix; QPixmap pix;
pix.load(OpenFlipper::Options::iconDirStr() + pix.load(OpenFlipper::Options::iconDirStr() +
OpenFlipper::Options::dirSeparator() + OpenFlipper::Options::dirSeparator() +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment