DolphinQt: Query mapping indicator colors using QPalette for better behavior with alternative themes.

This commit is contained in:
Jordan Woyak 2019-02-17 17:58:43 -06:00
parent 2fb6c45015
commit a9ef110349
2 changed files with 124 additions and 68 deletions

View File

@ -27,29 +27,73 @@
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
// Color constants to keep things looking consistent: namespace
// TODO: could we maybe query theme colors from Qt for the bounding box? {
const QColor BBOX_PEN_COLOR = Qt::darkGray;
const QColor BBOX_BRUSH_COLOR = Qt::white;
const QColor RAW_INPUT_COLOR = Qt::darkGray;
const QColor ADJ_INPUT_COLOR = Qt::red;
const QPen INPUT_SHAPE_PEN(RAW_INPUT_COLOR, 1.0, Qt::DashLine);
const QColor DEADZONE_COLOR = Qt::darkGray;
const QBrush DEADZONE_BRUSH(DEADZONE_COLOR, Qt::BDiagPattern);
const QColor TEXT_COLOR = Qt::darkGray;
// Text color that is visible atop ADJ_INPUT_COLOR:
const QColor TEXT_ALT_COLOR = Qt::white;
const QColor STICK_GATE_COLOR = Qt::lightGray;
const QColor C_STICK_GATE_COLOR = Qt::yellow; const QColor C_STICK_GATE_COLOR = Qt::yellow;
const QColor CURSOR_TV_COLOR = 0xaed6f1; const QColor CURSOR_TV_COLOR = 0xaed6f1;
const QColor TILT_GATE_COLOR = 0xa2d9ce; const QColor TILT_GATE_COLOR = 0xa2d9ce;
const QColor SWING_GATE_COLOR = 0xcea2d9; const QColor SWING_GATE_COLOR = 0xcea2d9;
constexpr int INPUT_DOT_RADIUS = 2; constexpr int INPUT_DOT_RADIUS = 2;
} // namespace
QPen MappingIndicator::GetBBoxPen() const
{
return palette().shadow().color();
}
QBrush MappingIndicator::GetBBoxBrush() const
{
return palette().base();
}
QColor MappingIndicator::GetRawInputColor() const
{
return palette().shadow().color();
}
QPen MappingIndicator::GetInputShapePen() const
{
return QPen{GetRawInputColor(), 1.0, Qt::DashLine};
}
QColor MappingIndicator::GetAdjustedInputColor() const
{
// Using highlight color works (typically blue) but the contrast is pretty low.
// return palette().highlight().color();
return Qt::red;
}
QColor MappingIndicator::GetDeadZoneColor() const
{
return palette().shadow().color();
}
QPen MappingIndicator::GetDeadZonePen() const
{
return GetDeadZoneColor();
}
QBrush MappingIndicator::GetDeadZoneBrush() const
{
return QBrush{GetDeadZoneColor(), Qt::BDiagPattern};
}
QColor MappingIndicator::GetTextColor() const
{
return palette().text().color();
}
// Text color that is visible atop GetAdjustedInputColor():
QColor MappingIndicator::GetAltTextColor() const
{
return palette().highlightedText().color();
}
QColor MappingIndicator::GetGateColor() const
{
return palette().mid().color();
}
MappingIndicator::MappingIndicator(ControllerEmu::ControlGroup* group) : m_group(group) MappingIndicator::MappingIndicator(ControllerEmu::ControlGroup* group) : m_group(group)
{ {
@ -140,8 +184,8 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
p.translate(width() / 2, height() / 2); p.translate(width() / 2, height() / 2);
// Bounding box. // Bounding box.
p.setBrush(BBOX_BRUSH_COLOR); p.setBrush(GetBBoxBrush());
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1); p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1);
// UI y-axis is opposite that of stick. // UI y-axis is opposite that of stick.
@ -161,21 +205,21 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
const double deadzone = cursor.GetDeadzonePercentage(); const double deadzone = cursor.GetDeadzonePercentage();
if (deadzone > 0.0) if (deadzone > 0.0)
{ {
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawRect(QRectF(-scale, -deadzone * scale, scale * 2, deadzone * scale * 2)); p.drawRect(QRectF(-scale, -deadzone * scale, scale * 2, deadzone * scale * 2));
} }
// Raw Z: // Raw Z:
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawRect( p.drawRect(
QRectF(-scale, raw_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS)); QRectF(-scale, raw_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS));
// Adjusted Z (if not hidden): // Adjusted Z (if not hidden):
if (adj_coord.z && adj_coord.x < 10000) if (adj_coord.z && adj_coord.x < 10000)
{ {
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawRect( p.drawRect(
QRectF(-scale, adj_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS)); QRectF(-scale, adj_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS));
} }
@ -189,27 +233,27 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
[&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale * TV_SCALE)); [&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale * TV_SCALE));
// Deadzone. // Deadzone.
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&cursor](double ang) { return cursor.GetDeadzoneRadiusAtAngle(ang); }, scale)); [&cursor](double ang) { return cursor.GetDeadzoneRadiusAtAngle(ang); }, scale));
// Input shape. // Input shape.
p.setPen(INPUT_SHAPE_PEN); p.setPen(GetInputShapePen());
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&cursor](double ang) { return cursor.GetInputRadiusAtAngle(ang); }, scale)); [&cursor](double ang) { return cursor.GetInputRadiusAtAngle(ang); }, scale));
// Raw stick position. // Raw stick position.
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
// Adjusted cursor position (if not hidden): // Adjusted cursor position (if not hidden):
if (adj_coord.x < 10000) if (adj_coord.x < 10000)
{ {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale * TV_SCALE, INPUT_DOT_RADIUS, p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale * TV_SCALE, INPUT_DOT_RADIUS,
INPUT_DOT_RADIUS); INPUT_DOT_RADIUS);
} }
@ -221,7 +265,7 @@ void MappingIndicator::DrawReshapableInput(ControllerEmu::ReshapableInput& stick
const bool is_c_stick = m_group->name == "C-Stick"; const bool is_c_stick = m_group->name == "C-Stick";
const bool is_tilt = m_group->name == "Tilt"; const bool is_tilt = m_group->name == "Tilt";
QColor gate_brush_color = STICK_GATE_COLOR; QColor gate_brush_color = GetGateColor();
if (is_c_stick) if (is_c_stick)
gate_brush_color = C_STICK_GATE_COLOR; gate_brush_color = C_STICK_GATE_COLOR;
@ -253,8 +297,8 @@ void MappingIndicator::DrawReshapableInput(ControllerEmu::ReshapableInput& stick
p.translate(width() / 2, height() / 2); p.translate(width() / 2, height() / 2);
// Bounding box. // Bounding box.
p.setBrush(BBOX_BRUSH_COLOR); p.setBrush(GetBBoxBrush());
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1); p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1);
// UI y-axis is opposite that of stick. // UI y-axis is opposite that of stick.
@ -277,27 +321,27 @@ void MappingIndicator::DrawReshapableInput(ControllerEmu::ReshapableInput& stick
[&stick](double ang) { return stick.GetGateRadiusAtAngle(ang); }, scale)); [&stick](double ang) { return stick.GetGateRadiusAtAngle(ang); }, scale));
// Deadzone. // Deadzone.
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&stick](double ang) { return stick.GetDeadzoneRadiusAtAngle(ang); }, scale)); [&stick](double ang) { return stick.GetDeadzoneRadiusAtAngle(ang); }, scale));
// Input shape. // Input shape.
p.setPen(INPUT_SHAPE_PEN); p.setPen(GetInputShapePen());
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&stick](double ang) { return stick.GetInputRadiusAtAngle(ang); }, scale)); [&stick](double ang) { return stick.GetInputRadiusAtAngle(ang); }, scale));
// Raw stick position. // Raw stick position.
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
// Adjusted stick position. // Adjusted stick position.
if (adj_coord.x || adj_coord.y) if (adj_coord.x || adj_coord.y)
{ {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
} }
} }
@ -329,7 +373,7 @@ void MappingIndicator::DrawMixedTriggers()
// Bounding box background: // Bounding box background:
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(BBOX_BRUSH_COLOR); p.setBrush(GetBBoxBrush());
p.drawRect(0, 0, trigger_width, trigger_height * TRIGGER_COUNT); p.drawRect(0, 0, trigger_width, trigger_height * TRIGGER_COUNT);
for (int t = 0; t != TRIGGER_COUNT; ++t) for (int t = 0; t != TRIGGER_COUNT; ++t)
@ -345,48 +389,48 @@ void MappingIndicator::DrawMixedTriggers()
const QRectF analog_rect(0, 0, trigger_analog_width, trigger_height); const QRectF analog_rect(0, 0, trigger_analog_width, trigger_height);
// Unactivated analog text: // Unactivated analog text:
p.setPen(TEXT_COLOR); p.setPen(GetTextColor());
p.drawText(analog_rect, Qt::AlignCenter, analog_name); p.drawText(analog_rect, Qt::AlignCenter, analog_name);
const QRectF adj_analog_rect(0, 0, adj_analog * trigger_analog_width, trigger_height); const QRectF adj_analog_rect(0, 0, adj_analog * trigger_analog_width, trigger_height);
// Trigger analog: // Trigger analog:
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawEllipse(QPoint(raw_analog * trigger_analog_width, trigger_height - INPUT_DOT_RADIUS), p.drawEllipse(QPoint(raw_analog * trigger_analog_width, trigger_height - INPUT_DOT_RADIUS),
INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawRect(adj_analog_rect); p.drawRect(adj_analog_rect);
// Deadzone: // Deadzone:
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawRect(0, 0, trigger_analog_width * deadzone, trigger_height); p.drawRect(0, 0, trigger_analog_width * deadzone, trigger_height);
// Threshold setting: // Threshold setting:
const int threshold_x = trigger_analog_width * threshold; const int threshold_x = trigger_analog_width * threshold;
p.setPen(INPUT_SHAPE_PEN); p.setPen(GetInputShapePen());
p.drawLine(threshold_x, 0, threshold_x, trigger_height); p.drawLine(threshold_x, 0, threshold_x, trigger_height);
const QRectF button_rect(trigger_analog_width, 0, trigger_button_width, trigger_height); const QRectF button_rect(trigger_analog_width, 0, trigger_button_width, trigger_height);
// Trigger button: // Trigger button:
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.setBrush(trigger_button ? ADJ_INPUT_COLOR : BBOX_BRUSH_COLOR); p.setBrush(trigger_button ? GetAdjustedInputColor() : GetBBoxBrush());
p.drawRect(button_rect); p.drawRect(button_rect);
// Bounding box outline: // Bounding box outline:
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawRect(trigger_rect); p.drawRect(trigger_rect);
// Button text: // Button text:
p.setPen(TEXT_COLOR); p.setPen(GetTextColor());
p.setPen(trigger_button ? TEXT_ALT_COLOR : TEXT_COLOR); p.setPen(trigger_button ? GetAltTextColor() : GetTextColor());
p.drawText(button_rect, Qt::AlignCenter, button_name); p.drawText(button_rect, Qt::AlignCenter, button_name);
// Activated analog text: // Activated analog text:
p.setPen(TEXT_ALT_COLOR); p.setPen(GetAltTextColor());
p.setClipping(true); p.setClipping(true);
p.setClipRect(adj_analog_rect); p.setClipRect(adj_analog_rect);
p.drawText(analog_rect, Qt::AlignCenter, analog_name); p.drawText(analog_rect, Qt::AlignCenter, analog_name);
@ -415,8 +459,8 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
p.translate(width() / 2, height() / 2); p.translate(width() / 2, height() / 2);
// Bounding box. // Bounding box.
p.setBrush(BBOX_BRUSH_COLOR); p.setBrush(GetBBoxBrush());
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1); p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1);
// UI y-axis is opposite that of stick. // UI y-axis is opposite that of stick.
@ -436,21 +480,21 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
const double deadzone = force.GetDeadzonePercentage(); const double deadzone = force.GetDeadzonePercentage();
if (deadzone > 0.0) if (deadzone > 0.0)
{ {
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawRect(QRectF(-scale, -deadzone * scale, scale * 2, deadzone * scale * 2)); p.drawRect(QRectF(-scale, -deadzone * scale, scale * 2, deadzone * scale * 2));
} }
// Raw Z: // Raw Z:
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawRect( p.drawRect(
QRectF(-scale, raw_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS)); QRectF(-scale, raw_coord.z * scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS));
// Adjusted Z: // Adjusted Z:
if (adj_coord.y) if (adj_coord.y)
{ {
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawRect( p.drawRect(
QRectF(-scale, adj_coord.y * -scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS)); QRectF(-scale, adj_coord.y * -scale - INPUT_DOT_RADIUS / 2, scale * 2, INPUT_DOT_RADIUS));
} }
@ -462,27 +506,27 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
[&force](double ang) { return force.GetGateRadiusAtAngle(ang); }, scale)); [&force](double ang) { return force.GetGateRadiusAtAngle(ang); }, scale));
// Deadzone. // Deadzone.
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZoneColor());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&force](double ang) { return force.GetDeadzoneRadiusAtAngle(ang); }, scale)); [&force](double ang) { return force.GetDeadzoneRadiusAtAngle(ang); }, scale));
// Input shape. // Input shape.
p.setPen(INPUT_SHAPE_PEN); p.setPen(GetInputShapePen());
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[&force](double ang) { return force.GetInputRadiusAtAngle(ang); }, scale)); [&force](double ang) { return force.GetInputRadiusAtAngle(ang); }, scale));
// Raw stick position. // Raw stick position.
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{raw_coord.x, raw_coord.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
// Adjusted position: // Adjusted position:
if (adj_coord.x || adj_coord.z) if (adj_coord.x || adj_coord.z)
{ {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawEllipse(QPointF{-adj_coord.x, adj_coord.z} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{-adj_coord.x, adj_coord.z} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
} }
} }
@ -546,8 +590,8 @@ void ShakeMappingIndicator::DrawShake()
p.translate(width() / 2, height() / 2); p.translate(width() / 2, height() / 2);
// Bounding box. // Bounding box.
p.setBrush(BBOX_BRUSH_COLOR); p.setBrush(GetBBoxBrush());
p.setPen(BBOX_PEN_COLOR); p.setPen(GetBBoxPen());
p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1); p.drawRect(-scale - 1, -scale - 1, scale * 2 + 1, scale * 2 + 1);
// UI y-axis is opposite that of acceleration Z. // UI y-axis is opposite that of acceleration Z.
@ -558,14 +602,14 @@ void ShakeMappingIndicator::DrawShake()
p.setRenderHint(QPainter::SmoothPixmapTransform, true); p.setRenderHint(QPainter::SmoothPixmapTransform, true);
// Deadzone. // Deadzone.
p.setPen(DEADZONE_COLOR); p.setPen(GetDeadZonePen());
p.setBrush(DEADZONE_BRUSH); p.setBrush(GetDeadZoneBrush());
p.drawRect(-scale, 0, scale * 2, m_shake_group.GetDeadzone() * scale); p.drawRect(-scale, 0, scale * 2, m_shake_group.GetDeadzone() * scale);
// Raw input. // Raw input.
const auto raw_coord = m_shake_group.GetState(false); const auto raw_coord = m_shake_group.GetState(false);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(RAW_INPUT_COLOR); p.setBrush(GetRawInputColor());
for (std::size_t c = 0; c != raw_coord.data.size(); ++c) for (std::size_t c = 0; c != raw_coord.data.size(); ++c)
{ {
p.drawEllipse(QPointF{-0.5 + c * 0.5, raw_coord.data[c]} * scale, INPUT_DOT_RADIUS, p.drawEllipse(QPointF{-0.5 + c * 0.5, raw_coord.data[c]} * scale, INPUT_DOT_RADIUS,
@ -581,7 +625,7 @@ void ShakeMappingIndicator::DrawShake()
m_grid_line_position = (m_grid_line_position + 1) % HISTORY_COUNT; m_grid_line_position = (m_grid_line_position + 1) % HISTORY_COUNT;
} }
const double grid_line_x = 1.0 - m_grid_line_position * 2.0 / HISTORY_COUNT; const double grid_line_x = 1.0 - m_grid_line_position * 2.0 / HISTORY_COUNT;
p.setPen(RAW_INPUT_COLOR); p.setPen(GetRawInputColor());
p.drawLine(QPointF{grid_line_x, -1.0} * scale, QPointF{grid_line_x, 1.0} * scale); p.drawLine(QPointF{grid_line_x, -1.0} * scale, QPointF{grid_line_x, 1.0} * scale);
// Position history. // Position history.
@ -609,7 +653,7 @@ void MappingIndicator::DrawCalibration(QPainter& p, Common::DVec2 point)
const double scale = height() / 2.5; const double scale = height() / 2.5;
// Input shape. // Input shape.
p.setPen(INPUT_SHAPE_PEN); p.setPen(GetInputShapePen());
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawPolygon(GetPolygonFromRadiusGetter( p.drawPolygon(GetPolygonFromRadiusGetter(
[this](double angle) { return m_calibration_widget->GetCalibrationRadiusAtAngle(angle); }, [this](double angle) { return m_calibration_widget->GetCalibrationRadiusAtAngle(angle); },
@ -617,7 +661,7 @@ void MappingIndicator::DrawCalibration(QPainter& p, Common::DVec2 point)
// Stick position. // Stick position.
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(ADJ_INPUT_COLOR); p.setBrush(GetAdjustedInputColor());
p.drawEllipse(QPointF{point.x, point.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); p.drawEllipse(QPointF{point.x, point.y} * scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
} }

View File

@ -36,6 +36,18 @@ public:
protected: protected:
WiimoteEmu::MotionState m_motion_state{}; WiimoteEmu::MotionState m_motion_state{};
QPen GetBBoxPen() const;
QBrush GetBBoxBrush() const;
QColor GetRawInputColor() const;
QPen GetInputShapePen() const;
QColor GetAdjustedInputColor() const;
QColor GetDeadZoneColor() const;
QPen GetDeadZonePen() const;
QBrush GetDeadZoneBrush() const;
QColor GetTextColor() const;
QColor GetAltTextColor() const;
QColor GetGateColor() const;
private: private:
void DrawCursor(ControllerEmu::Cursor& cursor); void DrawCursor(ControllerEmu::Cursor& cursor);
void DrawReshapableInput(ControllerEmu::ReshapableInput& stick); void DrawReshapableInput(ControllerEmu::ReshapableInput& stick);