refactor: ActionDialog, Use Combobox for action trigger

This commit is contained in:
sithlord48
2025-01-04 21:40:05 -05:00
committed by Nick Bolton
parent 1386ac91dc
commit 04f73cfcb7
2 changed files with 17 additions and 165 deletions

View File

@ -60,10 +60,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
ui->m_pComboSwitchInDirection->setCurrentIndex(m_action.switchDirection());
ui->m_pComboLockCursorToScreen->setCurrentIndex(m_action.lockCursorMode());
if (m_action.activeOnRelease())
ui->m_pRadioHotkeyReleased->setChecked(true);
else
ui->m_pRadioHotkeyPressed->setChecked(true);
ui->comboTriggerOn->setCurrentIndex(m_action.haveScreens());
ui->m_pGroupBoxScreens->setChecked(m_action.haveScreens());
@ -99,7 +96,7 @@ void ActionDialog::accept()
m_action.setSwitchScreenName(ui->m_pComboSwitchToScreen->currentText());
m_action.setSwitchDirection(ui->m_pComboSwitchInDirection->currentIndex());
m_action.setLockCursorMode(ui->m_pComboLockCursorToScreen->currentIndex());
m_action.setActiveOnRelease(ui->m_pRadioHotkeyReleased->isChecked());
m_action.setActiveOnRelease(ui->comboTriggerOn->currentIndex());
m_action.setRestartServer(ui->m_pRadioRestartAllConnections->isChecked());
QDialog::accept();

View File

@ -13,7 +13,21 @@
<property name="windowTitle">
<string>Configure Action</string>
</property>
<layout class="QVBoxLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="comboTriggerOn">
<item>
<property name="text">
<string>When the hotkey is pressed</string>
</property>
</item>
<item>
<property name="text">
<string>When the hotkey is released</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupType">
<property name="font">
@ -258,37 +272,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="font">
<font>
<kerning>false</kerning>
</font>
</property>
<property name="title">
<string>This action is performed when</string>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QRadioButton" name="m_pRadioHotkeyPressed">
<property name="text">
<string>the hotkey is pressed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioHotkeyReleased">
<property name="text">
<string>the hotkey is released</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
@ -310,118 +293,6 @@
</customwidgets>
<resources/>
<connections>
<connection>
<sender>m_pGroupType</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>104</x>
<y>194</y>
</hint>
<hint type="destinationlabel">
<x>110</x>
<y>132</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchInDirection</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>118</x>
<y>322</y>
</hint>
<hint type="destinationlabel">
<x>81</x>
<y>129</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioLockCursorToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>101</x>
<y>353</y>
</hint>
<hint type="destinationlabel">
<x>68</x>
<y>126</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioRestartAllConnections</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>101</x>
<y>353</y>
</hint>
<hint type="destinationlabel">
<x>68</x>
<y>126</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPress</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>48</x>
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>45</x>
<y>129</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioRelease</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>135</x>
<y>70</y>
</hint>
<hint type="destinationlabel">
<x>148</x>
<y>125</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioPressAndRelease</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>194</x>
<y>100</y>
</hint>
<hint type="destinationlabel">
<x>201</x>
<y>125</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchToScreen</sender>
<signal>toggled(bool)</signal>
@ -582,21 +453,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_pRadioSwitchToScreen</sender>
<signal>toggled(bool)</signal>
<receiver>keySequenceWidget</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>84</x>
<y>280</y>
</hint>
<hint type="destinationlabel">
<x>185</x>
<y>123</y>
</hint>
</hints>
</connection>
</connections>
</ui>