Commit d835f935 authored by Dirk Wilden's avatar Dirk Wilden
Browse files

colored statusbar

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6077 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 691ba389
#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 @@
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/widgets/coreWidget/SideArea.hh>
#include <OpenFlipper/widgets/coreWidget/ColorStatusBar.hh>
#include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
#include <OpenFlipper/widgets/glWidget/QtGLGraphicsScene.hh>
......@@ -765,7 +766,7 @@ public:
void setupStatusBar();
private :
QStatusBar* statusBar_;
ColorStatusBar* statusBar_;
QLabel* statusIcon_;
......
......@@ -63,26 +63,32 @@
void
CoreWidget::
slotLog(Logtype _type, QString _message) {
QColor textColor;
switch (_type) {
case LOGINFO:
logWidget_->setTextColor(QColor(0,160,0));
textColor = QColor(0,160,0);
break;
case LOGOUT:
logWidget_->setTextColor(QColor(0,0,0));
textColor = QColor(0,0,0);
break;
case LOGWARN:
logWidget_->setTextColor(QColor(160,160,0));
textColor = QColor(160,160,0);
break;
case LOGERR:
logWidget_->setTextColor(QColor(250,0,0));
textColor = QColor(250,0,0);
break;
}
logWidget_->setTextColor( textColor );
logWidget_->append(_message);
QScrollBar* bar = logWidget_->verticalScrollBar();
bar->setValue(bar->maximum());
statusBar_->showMessage(_message,textColor, 4000);
// Make shure, we see the message
// QApplication::processEvents();
}
......
......@@ -59,8 +59,10 @@ void CoreWidget::statusMessage(QString _message, int _timeout) {
void CoreWidget::setupStatusBar()
{
statusBar_ = statusBar();
statusBar_ = new ColorStatusBar();
setStatusBar( statusBar_ );
QPixmap pix;
pix.load(OpenFlipper::Options::iconDirStr() +
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