Add numerical_labels setting to UserInterface settings
This commit is contained in:
parent
f9c7df21f1
commit
a2a93daaab
3 changed files with 28 additions and 2 deletions
|
|
@ -21,6 +21,7 @@ DeviceView::DeviceView(QWidget *parent) :
|
|||
mouseDown(false)
|
||||
{
|
||||
controller = NULL;
|
||||
numerical_labels = false;
|
||||
setMouseTracking(1);
|
||||
|
||||
size = width();
|
||||
|
|
@ -317,7 +318,7 @@ void DeviceView::setController(RGBController * controller_ptr)
|
|||
{
|
||||
led_labels[led_idx] = it->second.label_utf8;
|
||||
}
|
||||
else
|
||||
else if(numerical_labels)
|
||||
{
|
||||
led_labels[led_idx] = QString::number(led_idx);
|
||||
}
|
||||
|
|
@ -336,6 +337,11 @@ void DeviceView::setController(RGBController * controller_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
void DeviceView::setNumericalLabels(bool enable)
|
||||
{
|
||||
numerical_labels = enable;
|
||||
}
|
||||
|
||||
QSize DeviceView::sizeHint () const
|
||||
{
|
||||
return QSize(height() - 1, height() - 1);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public:
|
|||
virtual QSize minimumSizeHint () const;
|
||||
|
||||
void setController(RGBController * controller_ptr);
|
||||
void setNumericalLabels(bool enable);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
|
@ -50,6 +51,8 @@ private:
|
|||
|
||||
float matrix_h;
|
||||
|
||||
bool numerical_labels;
|
||||
|
||||
RGBController* controller;
|
||||
|
||||
QColor posColor(const QPoint &point);
|
||||
|
|
|
|||
|
|
@ -66,9 +66,26 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
|
|||
\*-----------------------------------------------------*/
|
||||
connect(ui->DeviceViewBox, &DeviceView::selectionChanged, this, &OpenRGBDevicePage::on_DeviceViewBox_selectionChanged);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the UserInterface settings and check the |
|
||||
| numerical labels setting |
|
||||
\*-----------------------------------------------------*/
|
||||
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
|
||||
std::string ui_string = "UserInterface";
|
||||
json ui_settings;
|
||||
|
||||
ui_settings = settings_manager->GetSettings(ui_string);
|
||||
|
||||
if(ui_settings.contains("numerical_labels"))
|
||||
{
|
||||
bool numerical_labels = ui_settings["numerical_labels"];
|
||||
|
||||
ui->DeviceViewBox->setNumericalLabels(numerical_labels);
|
||||
}
|
||||
|
||||
ui->DeviceViewBox->setController(device);
|
||||
ui->DeviceViewBox->hide();
|
||||
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up the color palette buttons |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue