Skip to content

Commit a2a93da

Browse files
Add numerical_labels setting to UserInterface settings
1 parent f9c7df2 commit a2a93da

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

qt/DeviceView.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DeviceView::DeviceView(QWidget *parent) :
2121
mouseDown(false)
2222
{
2323
controller = NULL;
24+
numerical_labels = false;
2425
setMouseTracking(1);
2526

2627
size = width();
@@ -317,7 +318,7 @@ void DeviceView::setController(RGBController * controller_ptr)
317318
{
318319
led_labels[led_idx] = it->second.label_utf8;
319320
}
320-
else
321+
else if(numerical_labels)
321322
{
322323
led_labels[led_idx] = QString::number(led_idx);
323324
}
@@ -336,6 +337,11 @@ void DeviceView::setController(RGBController * controller_ptr)
336337
}
337338
}
338339

340+
void DeviceView::setNumericalLabels(bool enable)
341+
{
342+
numerical_labels = enable;
343+
}
344+
339345
QSize DeviceView::sizeHint () const
340346
{
341347
return QSize(height() - 1, height() - 1);

qt/DeviceView.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class DeviceView : public QWidget
2222
virtual QSize minimumSizeHint () const;
2323

2424
void setController(RGBController * controller_ptr);
25+
void setNumericalLabels(bool enable);
2526

2627
protected:
2728
void mousePressEvent(QMouseEvent *event);
@@ -50,6 +51,8 @@ class DeviceView : public QWidget
5051

5152
float matrix_h;
5253

54+
bool numerical_labels;
55+
5356
RGBController* controller;
5457

5558
QColor posColor(const QPoint &point);

qt/OpenRGBDevicePage.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,26 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
6666
\*-----------------------------------------------------*/
6767
connect(ui->DeviceViewBox, &DeviceView::selectionChanged, this, &OpenRGBDevicePage::on_DeviceViewBox_selectionChanged);
6868

69+
/*-----------------------------------------------------*\
70+
| Get the UserInterface settings and check the |
71+
| numerical labels setting |
72+
\*-----------------------------------------------------*/
73+
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
74+
std::string ui_string = "UserInterface";
75+
json ui_settings;
76+
77+
ui_settings = settings_manager->GetSettings(ui_string);
78+
79+
if(ui_settings.contains("numerical_labels"))
80+
{
81+
bool numerical_labels = ui_settings["numerical_labels"];
82+
83+
ui->DeviceViewBox->setNumericalLabels(numerical_labels);
84+
}
85+
6986
ui->DeviceViewBox->setController(device);
7087
ui->DeviceViewBox->hide();
71-
88+
7289
/*-----------------------------------------------------*\
7390
| Set up the color palette buttons |
7491
\*-----------------------------------------------------*/

0 commit comments

Comments
 (0)