Add a UI option to disable expanding keys in the device view
This commit is contained in:
parent
a9fca21544
commit
94ca670cbe
4 changed files with 222 additions and 178 deletions
|
|
@ -7,8 +7,10 @@
|
|||
\*-----------------------------------------------------*/
|
||||
|
||||
#include "DeviceView.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "RGBControllerKeyNames.h"
|
||||
#include "RGBController.h"
|
||||
#include "SettingsManager.h"
|
||||
#include <QPainter>
|
||||
#include <QResizeEvent>
|
||||
#include <QStyleOption>
|
||||
|
|
@ -251,6 +253,22 @@ void DeviceView::InitDeviceView()
|
|||
unsigned int segment_count = 0;
|
||||
float totalHeight = 0;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get device view settings |
|
||||
\*-----------------------------------------------------*/
|
||||
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
|
||||
std::string ui_string = "UserInterface";
|
||||
json ui_settings;
|
||||
|
||||
bool disable_expansion = false;
|
||||
|
||||
ui_settings = settings_manager->GetSettings(ui_string);
|
||||
|
||||
if(ui_settings.contains("disable_key_expansion"))
|
||||
{
|
||||
disable_expansion = ui_settings["disable_key_expansion"];
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Determine the total height (in LEDs) of all zones |
|
||||
\*-----------------------------------------------------*/
|
||||
|
|
@ -342,60 +360,63 @@ void DeviceView::InitDeviceView()
|
|||
led_pos[color_idx].matrix_w = (1 - (2 * PAD_LED));
|
||||
led_pos[color_idx].matrix_h = (1 - (2 * PAD_LED));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Expand large keys to fill empty spaces in matrix, if |
|
||||
| possible. Large keys can fill left, down, up, or wide|
|
||||
| Fill Left: |
|
||||
| Tab |
|
||||
| Caps Lock |
|
||||
| Left Shift |
|
||||
| Right Shift |
|
||||
| Backspace |
|
||||
| Number Pad 0 |
|
||||
| |
|
||||
| Fill Up or Down: |
|
||||
| Number Pad Enter |
|
||||
| Number Pad + |
|
||||
| |
|
||||
| Fill Wide: |
|
||||
| Space |
|
||||
\*-----------------------------------------------------*/
|
||||
if(led_x < map->width - 1 && map->map[map_idx + 1] == 0xFFFFFFFF)
|
||||
if(!disable_expansion)
|
||||
{
|
||||
if( ( controller->leds[color_idx].name == KEY_EN_TAB )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_CAPS_LOCK )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_LEFT_SHIFT )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_RIGHT_SHIFT)
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_BACKSPACE )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_NUMPAD_0 ) )
|
||||
/*-----------------------------------------------------*\
|
||||
| Expand large keys to fill empty spaces in matrix, if |
|
||||
| possible. Large keys can fill left, down, up, or wide|
|
||||
| Fill Left: |
|
||||
| Tab |
|
||||
| Caps Lock |
|
||||
| Left Shift |
|
||||
| Right Shift |
|
||||
| Backspace |
|
||||
| Number Pad 0 |
|
||||
| |
|
||||
| Fill Up or Down: |
|
||||
| Number Pad Enter |
|
||||
| Number Pad + |
|
||||
| |
|
||||
| Fill Wide: |
|
||||
| Space |
|
||||
\*-----------------------------------------------------*/
|
||||
if(led_x < map->width - 1 && map->map[map_idx + 1] == 0xFFFFFFFF)
|
||||
{
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
if( ( controller->leds[color_idx].name == KEY_EN_TAB )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_CAPS_LOCK )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_LEFT_SHIFT )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_RIGHT_SHIFT)
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_BACKSPACE )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_NUMPAD_0 ) )
|
||||
{
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( ( controller->leds[color_idx].name == KEY_EN_NUMPAD_ENTER )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_NUMPAD_PLUS ) )
|
||||
{
|
||||
if(led_y < map->height - 1 && map->map[map_idx + map->width] == 0xFFFFFFFF)
|
||||
if( ( controller->leds[color_idx].name == KEY_EN_NUMPAD_ENTER )
|
||||
|| ( controller->leds[color_idx].name == KEY_EN_NUMPAD_PLUS ) )
|
||||
{
|
||||
led_pos[color_idx].matrix_h += 1;
|
||||
if(led_y < map->height - 1 && map->map[map_idx + map->width] == 0xFFFFFFFF)
|
||||
{
|
||||
led_pos[color_idx].matrix_h += 1;
|
||||
}
|
||||
/* TODO: check if there isn't another widened key above */
|
||||
else if(led_y > 0 && map->map[map_idx - map->width] == 0xFFFFFFFF)
|
||||
{
|
||||
led_pos[color_idx].matrix_y -= 1;
|
||||
led_pos[color_idx].matrix_h += 1;
|
||||
}
|
||||
}
|
||||
/* TODO: check if there isn't another widened key above */
|
||||
else if(led_y > 0 && map->map[map_idx - map->width] == 0xFFFFFFFF)
|
||||
else if(controller->leds[color_idx].name == KEY_EN_SPACE)
|
||||
{
|
||||
led_pos[color_idx].matrix_y -= 1;
|
||||
led_pos[color_idx].matrix_h += 1;
|
||||
}
|
||||
}
|
||||
else if(controller->leds[color_idx].name == KEY_EN_SPACE)
|
||||
{
|
||||
for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * map->width && map->map[map_idx2] == 0xFFFFFFFF; --map_idx2)
|
||||
{
|
||||
led_pos[color_idx].matrix_x -= 1;
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
}
|
||||
for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * map->width && map->map[map_idx2] == 0xFFFFFFFF; ++map_idx2)
|
||||
{
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * map->width && map->map[map_idx2] == 0xFFFFFFFF; --map_idx2)
|
||||
{
|
||||
led_pos[color_idx].matrix_x -= 1;
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
}
|
||||
for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * map->width && map->map[map_idx2] == 0xFFFFFFFF; ++map_idx2)
|
||||
{
|
||||
led_pos[color_idx].matrix_w += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,6 +129,15 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
|||
ui->CheckboxRunZoneChecks->setChecked(true);
|
||||
}
|
||||
|
||||
if(ui_settings.contains("disable_key_expansion"))
|
||||
{
|
||||
ui->CheckboxDisableKeyExpansion->setChecked(ui_settings["disable_key_expansion"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->CheckboxDisableKeyExpansion->setChecked(false);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load LogManager settings |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
@ -796,4 +805,10 @@ void Ui::OpenRGBSettingsPage::on_CheckboxSharedSMBusAccess_clicked()
|
|||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
void Ui::OpenRGBSettingsPage::on_CheckboxDisableKeyExpansion_clicked()
|
||||
{
|
||||
json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface");
|
||||
ui_settings["disable_key_expansion"] = ui->CheckboxDisableKeyExpansion->isChecked();
|
||||
ResourceManager::get()->GetSettingsManager()->SetSettings("UserInterface", ui_settings);
|
||||
SaveSettings();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ private slots:
|
|||
|
||||
void on_CheckboxSetOnExit_clicked(bool checked);
|
||||
void on_ComboBoxExitProfile_currentTextChanged(const QString exit_profile_name);
|
||||
void on_CheckboxDisableKeyExpansion_clicked();
|
||||
};
|
||||
|
||||
#endif // OPENRGBSETTINGSPAGE_H
|
||||
|
|
|
|||
|
|
@ -31,56 +31,59 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>427</width>
|
||||
<height>764</height>
|
||||
<width>395</width>
|
||||
<height>654</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="10" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="DriversSettingsLabel">
|
||||
<property name="text">
|
||||
<string>Drivers Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="1">
|
||||
<widget class="QLineEdit" name="TextServerHost"/>
|
||||
</item>
|
||||
<item row="27" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
|
||||
</item>
|
||||
<item row="24" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartSetServerPort">
|
||||
<property name="text">
|
||||
<string>Set Server Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1">
|
||||
<widget class="QLineEdit" name="TextCustomArgs"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxRunZoneChecks">
|
||||
<property name="text">
|
||||
<string>Run zone checks on rescan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="LogManagerSettingsLabel">
|
||||
<property name="text">
|
||||
<string>Log Manager Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="1">
|
||||
<widget class="QLineEdit" name="TextServerHost"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="UserInterfaceSettingsLabel">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="LabelLanguage">
|
||||
<property name="text">
|
||||
<string>User Interface Settings:</string>
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxLogConsole">
|
||||
<item row="29" column="0">
|
||||
<widget class="QLabel" name="AutoStartStatusLabel">
|
||||
<property name="text">
|
||||
<string>Enable Log Console (restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartServer">
|
||||
<property name="text">
|
||||
<string>Start Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStart">
|
||||
<property name="text">
|
||||
<string>Start At Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="AutoStartLabel">
|
||||
<property name="text">
|
||||
<string>Start At Login Settings:</string>
|
||||
<string>Start at Login Status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -91,14 +94,51 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="DriversSettingsLabel">
|
||||
<item row="25" column="1">
|
||||
<widget class="QLineEdit" name="TextClientHost"/>
|
||||
</item>
|
||||
<item row="28" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSetOnExit">
|
||||
<property name="text">
|
||||
<string>Drivers Settings</string>
|
||||
<string>Set Profile on Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="29" column="0">
|
||||
<item row="22" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartServer">
|
||||
<property name="text">
|
||||
<string>Start Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1">
|
||||
<widget class="QLineEdit" name="TextServerPort">
|
||||
<property name="inputMask">
|
||||
<string>90000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartClient">
|
||||
<property name="text">
|
||||
<string>Start Client</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartSetServerHost">
|
||||
<property name="text">
|
||||
<string>Set Server Host</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="30" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
@ -114,6 +154,33 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStart">
|
||||
<property name="text">
|
||||
<string>Start At Login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSharedSMBusAccess">
|
||||
<property name="text">
|
||||
<string>Shared SMBus Access (restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxExitProfile"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxLanguage"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="UserInterfaceSettingsLabel">
|
||||
<property name="text">
|
||||
<string>User Interface Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSaveGeometry">
|
||||
<property name="text">
|
||||
|
|
@ -121,48 +188,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartClient">
|
||||
<property name="text">
|
||||
<string>Start Client</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="1">
|
||||
<widget class="QLineEdit" name="TextCustomArgs"/>
|
||||
</item>
|
||||
<item row="26" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxTrayIconGreyscale">
|
||||
<property name="text">
|
||||
<string>Greyscale Tray Icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="0">
|
||||
<widget class="QLabel" name="AutoStartStatusLabel">
|
||||
<property name="text">
|
||||
<string>Start at Login Status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAMDSMBusReduceCPU">
|
||||
<property name="text">
|
||||
<string>AMD SMBus: Reduce CPU Usage (restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
|
||||
<property name="text">
|
||||
<string>Start Minimized</string>
|
||||
<string>Custom Arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -173,36 +202,24 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxAutoStartProfile"/>
|
||||
</item>
|
||||
<item row="23" column="1">
|
||||
<widget class="QLineEdit" name="TextServerPort">
|
||||
<property name="inputMask">
|
||||
<string>90000</string>
|
||||
</property>
|
||||
<item row="12" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxLogConsole">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
<string>Enable Log Console (restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1">
|
||||
<widget class="QLineEdit" name="TextClientHost"/>
|
||||
</item>
|
||||
<item row="27" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSetOnExit">
|
||||
<item row="21" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartMinimized">
|
||||
<property name="text">
|
||||
<string>Set Profile on Exit</string>
|
||||
<string>Start Minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartCustom">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="AutoStartLabel">
|
||||
<property name="text">
|
||||
<string>Custom Arguments</string>
|
||||
<string>Start At Login Settings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -213,47 +230,37 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxTheme"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxTrayIconGreyscale">
|
||||
<property name="text">
|
||||
<string>Greyscale Tray Icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxSharedSMBusAccess">
|
||||
<widget class="QCheckBox" name="CheckboxAMDSMBusReduceCPU">
|
||||
<property name="text">
|
||||
<string>Shared SMBus Access (restart required)</string>
|
||||
<string>AMD SMBus: Reduce CPU Usage (restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="27" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxExitProfile"/>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartSetServerHost">
|
||||
<item row="27" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartProfile">
|
||||
<property name="text">
|
||||
<string>Set Server Host</string>
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxAutoStartSetServerPort">
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxDisableKeyExpansion">
|
||||
<property name="text">
|
||||
<string>Set Server Port</string>
|
||||
<string>Disable key expansion in device view</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="CheckboxRunZoneChecks">
|
||||
<property name="text">
|
||||
<string>Run zone checks on rescan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="LabelLanguage">
|
||||
<property name="text">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="ComboBoxLanguage"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue