Skip to content

Truly independent web browser

UI/Qt: Put the Feedback button's amber dot before the crash report count

Andreas Klingff2a323795a8
diff --git a/UI/Qt/ChromeStyle.cpp b/UI/Qt/ChromeStyle.cpp
index 1333ec4ab07..6da98118e6a 100644
--- a/UI/Qt/ChromeStyle.cpp
+++ b/UI/Qt/ChromeStyle.cpp
@@ -89,6 +89,11 @@ QColor chrome_sidebar_background(QPalette const& palette)
return Theme::chrome(palette).sidebar;
}
+QColor crash_reports_dot_color(QPalette const& palette)
+{
+ return is_dark(palette) ? QColor(0xF2, 0xA3, 0x3A) : QColor(0xD9, 0x80, 0x0F);
+}
+
QColor chrome_background(QPalette const& palette)
{
return Theme::chrome(palette).toolbar;
diff --git a/UI/Qt/ChromeStyle.h b/UI/Qt/ChromeStyle.h
index bf77495ac29..8692f0f7b7f 100644
--- a/UI/Qt/ChromeStyle.h
+++ b/UI/Qt/ChromeStyle.h
@@ -69,6 +69,8 @@ QColor chrome_separator(QPalette const&);
QColor chrome_window_outline(QPalette const&);
QColor chrome_accent();
QColor chrome_muted_text(QPalette const&);
+// The amber dot that tells of waiting crash reports.
+QColor crash_reports_dot_color(QPalette const&);
QFont chrome_title_font(QFont);
QString style_sheet_color(QColor const&);
diff --git a/UI/Qt/FeedbackPopover.cpp b/UI/Qt/FeedbackPopover.cpp
index f6d1d0b804d..fbdb53a45b7 100644
--- a/UI/Qt/FeedbackPopover.cpp
+++ b/UI/Qt/FeedbackPopover.cpp
@@ -23,6 +23,7 @@ static constexpr int POPOVER_WIDTH = 300;
static constexpr int ROW_HEIGHT = 32;
static constexpr int ROW_WITH_DETAIL_HEIGHT = 46;
static constexpr int CRASH_REPORTS_DOT_SIZE = 7;
+static constexpr int CRASH_REPORTS_DOT_GAP = 6;
static constexpr int EXTERNAL_LINK_ICON_SIZE = 14;
static constexpr int CHEVRON_ICON_SIZE = 12;
@@ -120,12 +121,17 @@ FeedbackPopover::FeedbackPopover(QWidget* parent)
separator_row->addWidget(separator);
section_layout->addLayout(separator_row);
+ // NB: The Feedback button's dot sits right before the count, which keeps the row's title in line with the others.
auto* crash_reports_row = create_row(*m_crash_reports_section, "Crash reports", ROW_HEIGHT);
- m_crash_reports_dot = create_row_icon(*crash_reports_row, CRASH_REPORTS_DOT_SIZE);
- crash_reports_row->layout()->addWidget(m_crash_reports_dot);
create_row_text(*crash_reports_row, "Crash reports");
+ auto* count_layout = new QHBoxLayout;
+ count_layout->setContentsMargins(0, 0, 0, 0);
+ count_layout->setSpacing(CRASH_REPORTS_DOT_GAP);
+ m_crash_reports_dot = create_row_icon(*crash_reports_row, CRASH_REPORTS_DOT_SIZE);
+ count_layout->addWidget(m_crash_reports_dot);
m_crash_reports_count = create_detail_label({}, *crash_reports_row);
- crash_reports_row->layout()->addWidget(m_crash_reports_count);
+ count_layout->addWidget(m_crash_reports_count);
+ static_cast<QHBoxLayout*>(crash_reports_row->layout())->addLayout(count_layout);
m_crash_reports_chevron = create_row_icon(*crash_reports_row, CHEVRON_ICON_SIZE);
crash_reports_row->layout()->addWidget(m_crash_reports_chevron);
QObject::connect(crash_reports_row, &QPushButton::clicked, this, [this] {
@@ -153,7 +159,7 @@ void FeedbackPopover::update_chrome_style(QPalette const& palette)
QPainter painter(&dot);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(Qt::NoPen);
- painter.setBrush(panel.text);
+ painter.setBrush(ChromeStyle::crash_reports_dot_color(palette));
painter.drawEllipse(QRectF(0, 0, CRASH_REPORTS_DOT_SIZE, CRASH_REPORTS_DOT_SIZE));
painter.end();
m_crash_reports_dot->setPixmap(dot);
diff --git a/UI/Qt/WindowToolbar.cpp b/UI/Qt/WindowToolbar.cpp
index 3f7cf9ad1de..e6bb1f10ae7 100644
--- a/UI/Qt/WindowToolbar.cpp
+++ b/UI/Qt/WindowToolbar.cpp
@@ -585,7 +585,7 @@ private:
painter.setBrush(Theme::chrome(palette).toolbar);
painter.drawEllipse(dot_center, 5.5 * m_dot_scale, 5.5 * m_dot_scale);
// NB: In the icon's color, the dot would fuse with the glyph it sits on.
- painter.setBrush(ChromeStyle::is_dark(palette) ? QColor(0xF2, 0xA3, 0x3A) : QColor(0xD9, 0x80, 0x0F));
+ painter.setBrush(ChromeStyle::crash_reports_dot_color(palette));
painter.drawEllipse(dot_center, 3.5 * m_dot_scale, 3.5 * m_dot_scale);
}