|
|
|
|
@@ -2541,10 +2541,18 @@ void MainWindow::changeEvent(QEvent* e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void setStatusBarForeground(QStatusBar* bar, const QColor& color)
|
|
|
|
|
{
|
|
|
|
|
QPalette pal = bar->palette();
|
|
|
|
|
pal.setColor(QPalette::WindowText, color);
|
|
|
|
|
bar->setPalette(pal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::clearStatus()
|
|
|
|
|
{
|
|
|
|
|
d->currentStatusType = 100;
|
|
|
|
|
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
|
|
|
|
|
// Reset to default foreground from the stylesheet/theme
|
|
|
|
|
statusBar()->setPalette(QPalette());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::statusMessageChanged()
|
|
|
|
|
@@ -2607,16 +2615,16 @@ void MainWindow::showStatus(int type, const QString& message)
|
|
|
|
|
QString msg = fm.elidedText(message, Qt::ElideMiddle, this->d->actionLabel->width());
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MainWindow::Err:
|
|
|
|
|
statusBar()->setStyleSheet(d->status->err);
|
|
|
|
|
setStatusBarForeground(statusBar(), d->status->err);
|
|
|
|
|
break;
|
|
|
|
|
case MainWindow::Wrn:
|
|
|
|
|
statusBar()->setStyleSheet(d->status->wrn);
|
|
|
|
|
setStatusBarForeground(statusBar(), d->status->wrn);
|
|
|
|
|
break;
|
|
|
|
|
case MainWindow::Pane:
|
|
|
|
|
statusBar()->setStyleSheet(QStringLiteral("#statusBar{}"));
|
|
|
|
|
statusBar()->setPalette(QPalette());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
statusBar()->setStyleSheet(d->status->msg);
|
|
|
|
|
setStatusBarForeground(statusBar(), d->status->msg);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
d->currentStatusType = -type;
|
|
|
|
|
@@ -2739,9 +2747,9 @@ void MainWindow::setWindowTitle(const QString& string)
|
|
|
|
|
StatusBarObserver::StatusBarObserver()
|
|
|
|
|
: WindowParameter("OutputWindow")
|
|
|
|
|
{
|
|
|
|
|
msg = QStringLiteral("#statusBar{color: #000000}"); // black
|
|
|
|
|
wrn = QStringLiteral("#statusBar{color: #ffaa00}"); // orange
|
|
|
|
|
err = QStringLiteral("#statusBar{color: #ff0000}"); // red
|
|
|
|
|
msg = QColor(0, 0, 0); // black
|
|
|
|
|
wrn = QColor(0xff, 0xaa, 0); // orange
|
|
|
|
|
err = QColor(0xff, 0, 0); // red
|
|
|
|
|
Base::Console().attachObserver(this);
|
|
|
|
|
getWindowParameter()->Attach(this);
|
|
|
|
|
getWindowParameter()->NotifyAll();
|
|
|
|
|
@@ -2756,24 +2764,21 @@ StatusBarObserver::~StatusBarObserver()
|
|
|
|
|
void StatusBarObserver::OnChange(Base::Subject<const char*>& rCaller, const char* sReason)
|
|
|
|
|
{
|
|
|
|
|
ParameterGrp& rclGrp = ((ParameterGrp&)rCaller);
|
|
|
|
|
auto format = QStringLiteral("#statusBar{color: %1}");
|
|
|
|
|
if (strcmp(sReason, "colorText") == 0) {
|
|
|
|
|
unsigned long col = rclGrp.GetUnsigned(sReason);
|
|
|
|
|
this->msg = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
|
|
|
|
this->msg = Base::Color::fromPackedRGB<QColor>(col);
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(sReason, "colorWarning") == 0) {
|
|
|
|
|
unsigned long col = rclGrp.GetUnsigned(sReason);
|
|
|
|
|
this->wrn = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
|
|
|
|
this->wrn = Base::Color::fromPackedRGB<QColor>(col);
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(sReason, "colorError") == 0) {
|
|
|
|
|
unsigned long col = rclGrp.GetUnsigned(sReason);
|
|
|
|
|
this->err = format.arg(Base::Color::fromPackedRGB<QColor>(col).name());
|
|
|
|
|
this->err = Base::Color::fromPackedRGB<QColor>(col);
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(sReason, "colorCritical") == 0) {
|
|
|
|
|
unsigned long col = rclGrp.GetUnsigned(sReason);
|
|
|
|
|
this->critical = format.arg(
|
|
|
|
|
QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff).name()
|
|
|
|
|
);
|
|
|
|
|
this->critical = QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|