diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/interface_frame.cpp | 24 | ||||
-rw-r--r-- | ui/qt/main_status_bar.cpp | 8 | ||||
-rw-r--r-- | ui/qt/rtp_stream_dialog.cpp | 6 | ||||
-rw-r--r-- | ui/qt/time_shift_dialog.cpp | 8 | ||||
-rw-r--r-- | ui/qt/utils/color_utils.cpp | 8 | ||||
-rw-r--r-- | ui/qt/utils/color_utils.h | 6 | ||||
-rw-r--r-- | ui/qt/utils/tango_colors.h | 3 | ||||
-rw-r--r-- | ui/qt/widgets/label_stack.cpp | 8 |
8 files changed, 38 insertions, 33 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp index b1784929e3..e06fdf6ab7 100644 --- a/ui/qt/interface_frame.cpp +++ b/ui/qt/interface_frame.cpp @@ -24,7 +24,7 @@ #include <ui/qt/models/interface_tree_model.h> #include <ui/qt/models/sparkline_delegate.h> -#include <ui/qt/utils/tango_colors.h> +#include <ui/qt/utils/color_utils.h> #include "extcap.h" @@ -68,17 +68,7 @@ InterfaceFrame::InterfaceFrame(QWidget * parent) "QTreeView {" " border: 0;" "}" - "QLabel {" - " border-radius: 0.5em;" - " padding: 0.33em;" - " margin-bottom: 0.25em;" - // We might want to transition this to normal colors this after a timeout. - " color: #%1;" - " background-color: #%2;" - "}" - ) - .arg(ws_css_warn_text, 6, 16, QChar('0')) - .arg(ws_css_warn_background, 6, 16, QChar('0'))); + )); ui->warningLabel->hide(); @@ -278,6 +268,16 @@ void InterfaceFrame::resetInterfaceTreeDisplay() ui->warningLabel->hide(); ui->warningLabel->clear(); + ui->warningLabel->setStyleSheet(QString( + "QLabel {" + " border-radius: 0.5em;" + " padding: 0.33em;" + " margin-bottom: 0.25em;" + // We might want to transition this to normal colors this after a timeout. + " background-color: %2;" + "}" + ).arg(ColorUtils::warningBackground().name())); + #ifdef HAVE_LIBPCAP #ifdef Q_OS_WIN if (!has_wpcap) { diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp index 0ecd509d23..db483d9511 100644 --- a/ui/qt/main_status_bar.cpp +++ b/ui/qt/main_status_bar.cpp @@ -27,7 +27,7 @@ #include "main_status_bar.h" #include "profile_dialog.h" #include <ui/qt/utils/stock_icon.h> -#include <ui/qt/utils/tango_colors.h> +#include <ui/qt/utils/color_utils.h> #include <ui/qt/capture_file.h> #include <ui/qt/widgets/clickable_label.h> @@ -595,12 +595,10 @@ void MainStatusBar::toggleBackground(bool enabled) if (enabled) { setStyleSheet(QString( "QStatusBar {" - " color: #%1;" - " background-color: #%2;" + " background-color: %2;" "}" ) - .arg(ws_css_warn_text, 6, 16, QChar('0')) - .arg(ws_css_warn_background, 6, 16, QChar('0'))); + .arg(ColorUtils::warningBackground().name())); } else { setStyleSheet(QString()); } diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp index 39e2020627..e40835ea26 100644 --- a/ui/qt/rtp_stream_dialog.cpp +++ b/ui/qt/rtp_stream_dialog.cpp @@ -30,7 +30,7 @@ #include <QTreeWidgetItem> #include <QTreeWidgetItemIterator> -#include <ui/qt/utils/tango_colors.h> +#include <ui/qt/utils/color_utils.h> /* * @file RTP stream dialog @@ -105,8 +105,8 @@ public: if (calc.problem) { setText(status_col_, UTF8_BULLET); setTextAlignment(status_col_, Qt::AlignCenter); - QColor bgColor(ws_css_warn_background); - QColor textColor(ws_css_warn_text); + QColor bgColor(ColorUtils::warningBackground()); + QColor textColor(QApplication::palette().text().color()); for (int i = 0; i < columnCount(); i++) { QBrush bgBrush = background(i); bgBrush.setColor(bgColor); diff --git a/ui/qt/time_shift_dialog.cpp b/ui/qt/time_shift_dialog.cpp index fd94ebc43e..8141a6afdd 100644 --- a/ui/qt/time_shift_dialog.cpp +++ b/ui/qt/time_shift_dialog.cpp @@ -13,7 +13,7 @@ #include "wireshark_application.h" #include <ui/time_shift.h> -#include <ui/qt/utils/tango_colors.h> +#include <ui/qt/utils/color_utils.h> #include <QStyleOption> @@ -104,12 +104,10 @@ void TimeShiftDialog::enableWidgets() ts_ui_->errorLabel->setStyleSheet(QString( "QLabel {" " margin-top: 0.5em;" - " color: #%1;" - " background-color: #%2;" + " background-color: %2;" "}" ) - .arg(ws_css_warn_text, 6, 16, QChar('0')) - .arg(ws_css_warn_background, 6, 16, QChar('0')) + .arg(ColorUtils::warningBackground().name()) ); } apply_button_->setEnabled(enable_apply); diff --git a/ui/qt/utils/color_utils.cpp b/ui/qt/utils/color_utils.cpp index e8972a5679..1e65984f74 100644 --- a/ui/qt/utils/color_utils.cpp +++ b/ui/qt/utils/color_utils.cpp @@ -188,6 +188,14 @@ const QColor ColorUtils::contrastingTextColor(const QColor color) return QApplication::palette().base().color(); } +const QColor ColorUtils::warningBackground() +{ + if (themeIsDark()) { + return QColor(tango_butter_6); + } + return QColor(tango_butter_2); +} + /* * Editor modelines * diff --git a/ui/qt/utils/color_utils.h b/ui/qt/utils/color_utils.h index 660ef87309..0e343fb553 100644 --- a/ui/qt/utils/color_utils.h +++ b/ui/qt/utils/color_utils.h @@ -71,6 +71,12 @@ public: */ static const QColor contrastingTextColor(const QColor color); + /** + * Returns an appropriate warning background color for the current mode. + * @return The background color. + */ + static const QColor warningBackground(); + signals: public slots: diff --git a/ui/qt/utils/tango_colors.h b/ui/qt/utils/tango_colors.h index d2bd3e3928..1a08ec4182 100644 --- a/ui/qt/utils/tango_colors.h +++ b/ui/qt/utils/tango_colors.h @@ -71,7 +71,4 @@ const QRgb tango_sky_blue_4 = 0x3465a4; const QRgb tango_sky_blue_5 = 0x204a87; const QRgb tango_sky_blue_6 = 0x0a3050; -const QRgb ws_css_warn_background = tango_butter_2; -const QRgb ws_css_warn_text = tango_aluminium_6; - #endif // __TANGO_COLORS_H__ diff --git a/ui/qt/widgets/label_stack.cpp b/ui/qt/widgets/label_stack.cpp index 65d281f5f8..c8c3a845be 100644 --- a/ui/qt/widgets/label_stack.cpp +++ b/ui/qt/widgets/label_stack.cpp @@ -14,7 +14,7 @@ #include <QMouseEvent> #include <QStyleOption> -#include <ui/qt/utils/tango_colors.h> +#include <ui/qt/utils/color_utils.h> /* Temporary message timeouts */ const int temporary_interval_ = 1000; @@ -57,11 +57,9 @@ void LabelStack::fillLabel() { if (si.ctx == temporary_ctx_) { style_sheet += QString( " border-radius: 0.25em;" - " color: #%1;" - " background-color: #%2;" + " background-color: %2;" ) - .arg(ws_css_warn_text, 6, 16, QChar('0')) - .arg(ws_css_warn_background, 6, 16, QChar('0')); + .arg(ColorUtils::warningBackground().name()); } style_sheet += "}"; |