refactor: Don't use autoconnect slots for the button box

This commit is contained in:
sithlord48 2025-02-01 08:54:42 -05:00 committed by Nick Bolton
parent 774f1fded9
commit 816d66b703
2 changed files with 24 additions and 54 deletions

View file

@ -34,6 +34,8 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config, Ap
m_appConfig(appConfig) m_appConfig(appConfig)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ServerConfigDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ServerConfigDialog::reject);
ui->m_pButtonBrowseConfigFile->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen)); ui->m_pButtonBrowseConfigFile->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen));
ui->m_pTrashScreenWidget->setPixmap(QIcon::fromTheme("user-trash").pixmap(QSize(64, 64))); ui->m_pTrashScreenWidget->setPixmap(QIcon::fromTheme("user-trash").pixmap(QSize(64, 64)));
@ -475,6 +477,6 @@ void ServerConfigDialog::onChange()
{ {
bool isAppConfigDataEqual = m_OriginalServerConfigIsExternal == serverConfig().useExternalConfig() && bool isAppConfigDataEqual = m_OriginalServerConfigIsExternal == serverConfig().useExternalConfig() &&
m_OriginalServerConfigUsesExternalFile == serverConfig().configFile(); m_OriginalServerConfigUsesExternalFile == serverConfig().configFile();
ui->m_pButtonBox->button(QDialogButtonBox::Ok) ui->buttonBox->button(QDialogButtonBox::Ok)
->setEnabled(!isAppConfigDataEqual || !(m_OriginalServerConfig == m_ServerConfig)); ->setEnabled(!isAppConfigDataEqual || !(m_OriginalServerConfig == m_ServerConfig));
} }

View file

@ -1133,7 +1133,7 @@ Enabling this setting will disable the server config GUI.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="m_pButtonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Orientation::Horizontal</enum> <enum>Qt::Orientation::Horizontal</enum>
</property> </property>
@ -1189,38 +1189,6 @@ Enabling this setting will disable the server config GUI.</string>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>m_pButtonBox</sender>
<signal>accepted()</signal>
<receiver>ServerConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>572</x>
<y>424</y>
</hint>
<hint type="destinationlabel">
<x>377</x>
<y>-8</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_pButtonBox</sender>
<signal>rejected()</signal>
<receiver>ServerConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>641</x>
<y>424</y>
</hint>
<hint type="destinationlabel">
<x>595</x>
<y>1</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>m_pCheckBoxSwitchDelay</sender> <sender>m_pCheckBoxSwitchDelay</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -1228,12 +1196,12 @@ Enabling this setting will disable the server config GUI.</string>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>110</x> <x>76</x>
<y>63</y> <y>88</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>110</x> <x>86</x>
<y>63</y> <y>88</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -1244,12 +1212,12 @@ Enabling this setting will disable the server config GUI.</string>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>110</x> <x>76</x>
<y>63</y> <y>81</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>110</x> <x>86</x>
<y>63</y> <y>81</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -1260,12 +1228,12 @@ Enabling this setting will disable the server config GUI.</string>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>110</x> <x>32</x>
<y>63</y> <y>91</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>110</x> <x>44</x>
<y>63</y> <y>91</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -1276,12 +1244,12 @@ Enabling this setting will disable the server config GUI.</string>
<slot>click()</slot> <slot>click()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>197</x> <x>35</x>
<y>115</y> <y>84</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>304</x> <x>45</x>
<y>115</y> <y>80</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -1292,12 +1260,12 @@ Enabling this setting will disable the server config GUI.</string>
<slot>click()</slot> <slot>click()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>505</x> <x>79</x>
<y>120</y> <y>84</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>677</x> <x>89</x>
<y>118</y> <y>80</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>