Skip to content

Commit

Permalink
Convert delete buttons to QToolButton
Browse files Browse the repository at this point in the history
This fixes the width problem on Mac, and also makes them consistent
with the delete buttons in the Server GUI Options dialog.
  • Loading branch information
softins committed Jun 30, 2024
1 parent 784d7b7 commit d0a262d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 54 deletions.
8 changes: 5 additions & 3 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,10 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
cbxCustomDirectories->setWhatsThis ( strCustomDirectories );
cbxCustomDirectories->setAccessibleName ( tr ( "Custom Directories combo box" ) );

butDeleteCustomDirectory->setAccessibleName ( tr ( "Delete custom directory button" ) );
butDeleteCustomDirectory->setWhatsThis ( "<b>" + tr ( "Delete Custom Directory" ) + ":</b> " +
tbtDeleteCustomDirectory->setAccessibleName ( tr ( "Delete custom directory button" ) );
tbtDeleteCustomDirectory->setWhatsThis ( "<b>" + tr ( "Delete Custom Directory" ) + ":</b> " +
tr ( "Click the button to delete the currently selected custom directory." ) );
tbtDeleteCustomDirectory->setText ( u8"\u232B" );

// current connection status parameter
QString strConnStats = "<b>" + tr ( "Audio Upstream Rate" ) + ":</b> " +
Expand Down Expand Up @@ -710,7 +711,8 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
QObject::connect ( butDriverSetup, &QPushButton::clicked, this, &CClientSettingsDlg::OnDriverSetupClicked );
#endif

QObject::connect ( butDeleteCustomDirectory, &QPushButton::clicked, this, [this] { CClientSettingsDlg::OnCustomDirectoriesChanged ( true ); } );
// tool buttons
QObject::connect ( tbtDeleteCustomDirectory, &QToolButton::clicked, this, [this] { CClientSettingsDlg::OnCustomDirectoriesChanged ( true ); } );

// misc
// sliders
Expand Down
27 changes: 1 addition & 26 deletions src/clientsettingsdlgbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1048,32 +1048,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="butDeleteCustomDirectory">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">⌫</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
<widget class="QToolButton" name="tbtDeleteCustomDirectory"/>
</item>
</layout>
</item>
Expand Down
7 changes: 4 additions & 3 deletions src/connectdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
cbxServerAddr->setAccessibleName ( tr ( "Server address edit box" ) );
cbxServerAddr->setAccessibleDescription ( tr ( "Holds the current server address. It also stores old addresses in the combo box list." ) );

butDeleteServerAddr->setAccessibleName ( tr ( "Delete server address button" ) );
butDeleteServerAddr->setWhatsThis ( "<b>" + tr ( "Delete Server Address" ) + ":</b> " +
tbtDeleteServerAddr->setAccessibleName ( tr ( "Delete server address button" ) );
tbtDeleteServerAddr->setWhatsThis ( "<b>" + tr ( "Delete Server Address" ) + ":</b> " +
tr ( "Click the button to clear the currently selected server address "
"and delete it from the list of stored servers." ) );
tbtDeleteServerAddr->setText ( u8"\u232B" );

UpdateDirectoryComboBox();

Expand Down Expand Up @@ -185,7 +186,7 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
QObject::connect ( butConnect, &QPushButton::clicked, this, &CConnectDlg::OnConnectClicked );

// tool buttons
QObject::connect ( butDeleteServerAddr, &QPushButton::clicked, this, &CConnectDlg::OnDeleteServerAddrClicked );
QObject::connect ( tbtDeleteServerAddr, &QToolButton::clicked, this, &CConnectDlg::OnDeleteServerAddrClicked );

// timers
QObject::connect ( &TimerPing, &QTimer::timeout, this, &CConnectDlg::OnTimerPing );
Expand Down
23 changes: 1 addition & 22 deletions src/connectdlgbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="butDeleteServerAddr">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">⌫</string>
</property>
</widget>
<widget class="QToolButton" name="tbtDeleteServerAddr"/>
</item>
</layout>
</item>
Expand Down

0 comments on commit d0a262d

Please sign in to comment.