Skip to content

Commit 750e6f6

Browse files
committed
[WARP] Make the sidebar highlights not blinding
It is apparently "too bright" and I need to get "my eyes checked"
1 parent 7aa57d9 commit 750e6f6

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

plugins/warp/ui/shared/constraint.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <QGridLayout>
44
#include <QHeaderView>
55

6+
#include "theme.h"
7+
68
WarpConstraintItem::WarpConstraintItem(const Warp::Constraint &constraint) : m_constraint(constraint)
79
{
810
QString guidStr = QString::fromStdString(constraint.guid.ToString());
@@ -39,11 +41,16 @@ QVariant WarpConstraintItemModel::data(const QModelIndex &index, int role) const
3941
{
4042
auto itemConstraint = item->GetConstraint();
4143
// TODO: We really should store the guid in a hashmap or something instead of looping over it for every item.
42-
// TODO: A less intense green?
4344
// TODO: Take into account the constraint offset.
4445
for (const auto &constraint: m_matchedConstraints)
45-
if (constraint.guid == itemConstraint.guid)
46-
return QBrush(Qt::green);
46+
{
47+
if (constraint.offset == itemConstraint.offset)
48+
{
49+
static QColor matchedColor = getThemeColor(GreenStandardHighlightColor);
50+
matchedColor.setAlpha(128);
51+
return matchedColor;
52+
}
53+
}
4754
}
4855
}
4956

@@ -83,6 +90,11 @@ WarpConstraintTableWidget::WarpConstraintTableWidget(QWidget *parent)
8390
m_table->horizontalHeader()->hide();
8491
// Decrease row height to make it look nice.
8592
m_table->verticalHeader()->setDefaultSectionSize(30);
93+
94+
// Make the highlight less bright.
95+
QPalette palette = m_table->palette();
96+
palette.setColor(QPalette::Highlight, getThemeColor(SelectionColor));
97+
m_table->setPalette(palette);
8698
}
8799

88100
void WarpConstraintTableWidget::SetConstraints(QVector<WarpConstraintItem *> constraints)

plugins/warp/ui/shared/function.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ QVariant WarpFunctionItemModel::data(const QModelIndex &index, int role) const
120120
if (BNWARPFunctionsEqual(itemFunction->GetFunction()->m_object, m_matchedFunction->m_object))
121121
{
122122
// TODO: Better color?
123-
QColor matchedColor = getThemeColor(BlueStandardHighlightColor);
123+
static QColor matchedColor = getThemeColor(BlueStandardHighlightColor);
124124
matchedColor.setAlpha(128);
125125
return matchedColor;
126126
}
@@ -202,6 +202,11 @@ WarpFunctionTableWidget::WarpFunctionTableWidget(QWidget *parent) : QWidget(pare
202202
// Decrease row height to make it look nice.
203203
m_table->verticalHeader()->setDefaultSectionSize(30);
204204

205+
// Make the highlight less bright.
206+
QPalette palette = m_table->palette();
207+
palette.setColor(QPalette::Highlight, getThemeColor(SelectionColor));
208+
m_table->setPalette(palette);
209+
205210
TokenDataDelegate *tokenDelegate = new TokenDataDelegate(this);
206211
// NOTE: Column 0 is assumed to be the function with the token data.
207212
m_table->setItemDelegateForColumn(0, tokenDelegate);

0 commit comments

Comments
 (0)