Skip to content

Commit df95777

Browse files
committed
Add --accessible toggle for connectdlg
1 parent 73df00c commit df95777

File tree

5 files changed

+91
-53
lines changed

5 files changed

+91
-53
lines changed

src/clientdlg.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,20 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
3333
const bool bShowAnalyzerConsole,
3434
const bool bMuteStream,
3535
const bool bNEnableIPv6,
36+
const bool bNEnableAccessiblePushButtonUi,
3637
QWidget* parent ) :
3738
CBaseDlg ( parent, Qt::Window ), // use Qt::Window to get min/max window buttons
3839
pClient ( pNCliP ),
3940
pSettings ( pNSetP ),
4041
bConnectDlgWasShown ( false ),
4142
bDetectFeedback ( false ),
4243
bEnableIPv6 ( bNEnableIPv6 ),
44+
bEnableAccessiblePushButtonUi ( bNEnableAccessiblePushButtonUi ),
4345
eLastRecorderState ( RS_UNDEFINED ), // for SetMixerBoardDeco
4446
eLastDesign ( GD_ORIGINAL ), // "
4547
ClientSettingsDlg ( pNCliP, pNSetP, parent ),
4648
ChatDlg ( parent ),
47-
ConnectDlg ( pNSetP, bNewShowComplRegConnList, parent ),
49+
ConnectDlg ( pNSetP, bNewShowComplRegConnList, bNEnableIPv6, bNEnableAccessiblePushButtonUi, parent ),
4850
AnalyzerConsole ( pNCliP, parent )
4951
{
5052
setupUi ( this );
@@ -1286,11 +1288,11 @@ void CClientDlg::Disconnect()
12861288
TimerDetectFeedback.stop();
12871289
bDetectFeedback = false;
12881290

1289-
//### TODO: BEGIN ###//
1290-
// is this still required???
1291-
// immediately update status bar
1291+
// ### TODO: BEGIN ###//
1292+
// is this still required???
1293+
// immediately update status bar
12921294
OnTimerStatus();
1293-
//### TODO: END ###//
1295+
// ### TODO: END ###//
12941296

12951297
// reset LEDs
12961298
ledBuffers->Reset();

src/clientdlg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
8585
const bool bShowAnalyzerConsole,
8686
const bool bMuteStream,
8787
const bool bNEnableIPv6,
88+
const bool bNEnableAccessiblePushButtonUi,
8889
QWidget* parent = nullptr );
8990

9091
protected:
@@ -110,6 +111,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
110111
bool bConnectDlgWasShown;
111112
bool bDetectFeedback;
112113
bool bEnableIPv6;
114+
bool bEnableAccessiblePushButtonUi;
113115
ERecorderState eLastRecorderState;
114116
EGUIDesign eLastDesign;
115117
QTimer TimerSigMet;

src/connectdlg.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
#include "connectdlg.h"
2626

2727
/* Implementation *************************************************************/
28-
CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent ) :
28+
CConnectDlg::CConnectDlg ( CClientSettings* pNSetP,
29+
const bool bNewShowCompleteRegList,
30+
const bool bNEnableIPv6,
31+
const bool bNEnableAccessiblePushButtonUi,
32+
QWidget* parent ) :
2933
CBaseDlg ( parent, Qt::Dialog ),
3034
pSettings ( pNSetP ),
3135
strSelectedAddress ( "" ),
@@ -36,7 +40,8 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
3640
bServerListItemWasChosen ( false ),
3741
bListFilterWasActive ( false ),
3842
bShowAllMusicians ( true ),
39-
bEnableIPv6 ( bNEnableIPv6 )
43+
bEnableIPv6 ( bNEnableIPv6 ),
44+
bEnableAccessiblePushButtonUi ( bNEnableAccessiblePushButtonUi )
4045
{
4146
setupUi ( this );
4247

@@ -461,10 +466,13 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, const CVector<CS
461466
lvwServers->expandItem ( pNewListViewItem );
462467
}
463468

464-
// accessibility
465-
for ( int i = 0; i < lvwServers->columnCount(); i++ )
469+
// accessibility: use Push Buttons to allow screen readers to see the fields
470+
if ( bEnableAccessiblePushButtonUi )
466471
{
467-
lvwServers->setItemWidget ( pNewListViewItem, i, new QPushButton ( pNewListViewItem->text ( i ) ) );
472+
for ( int i = 0; i < lvwServers->columnCount(); i++ )
473+
{
474+
lvwServers->setItemWidget ( pNewListViewItem, i, new QPushButton ( pNewListViewItem->text ( i ) ) );
475+
}
468476
}
469477
}
470478

@@ -889,7 +897,6 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr,
889897
// 4 is sufficient since the maximum width is ">500") (#201)
890898
pCurListViewItem->setText ( LVC_PING, QString ( "%1 ms" ).arg ( iMinPingTime, 4, 10, QLatin1Char ( ' ' ) ) );
891899
}
892-
dynamic_cast<QPushButton*> ( lvwServers->itemWidget ( pCurListViewItem, 1 ) )->setText ( pCurListViewItem->text ( 1 ) );
893900

894901
// update number of clients text
895902
if ( pCurListViewItem->text ( LVC_CLIENTS_MAX_HIDDEN ).toInt() == 0 )
@@ -905,7 +912,16 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr,
905912
{
906913
pCurListViewItem->setText ( LVC_CLIENTS, QString().setNum ( iNumClients ) + "/" + pCurListViewItem->text ( LVC_CLIENTS_MAX_HIDDEN ) );
907914
}
908-
dynamic_cast<QPushButton*> ( lvwServers->itemWidget ( pCurListViewItem, 2 ) )->setText ( pCurListViewItem->text ( 2 ) );
915+
916+
if ( bEnableAccessiblePushButtonUi )
917+
{
918+
// apply text to accessible ui
919+
dynamic_cast<QPushButton*> ( lvwServers->itemWidget ( pCurListViewItem, LVC_PING ) )->setText ( pCurListViewItem->text ( LVC_PING ) );
920+
dynamic_cast<QPushButton*> ( lvwServers->itemWidget ( pCurListViewItem, LVC_CLIENTS ) )
921+
->setText ( pCurListViewItem->text ( LVC_CLIENTS ) );
922+
dynamic_cast<QPushButton*> ( lvwServers->itemWidget ( pCurListViewItem, LVC_VERSION ) )
923+
->setText ( pCurListViewItem->text ( LVC_VERSION ) );
924+
}
909925

910926
// check if the number of child list items matches the number of
911927
// connected clients, if not then request the client names

src/connectdlg.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase
4949
Q_OBJECT
5050

5151
public:
52-
CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent = nullptr );
52+
CConnectDlg ( CClientSettings* pNSetP,
53+
const bool bNewShowCompleteRegList,
54+
const bool bNEnableIPv6,
55+
const bool bNEnableAccessiblePushButtonUi,
56+
QWidget* parent = nullptr );
5357

5458
void SetShowAllMusicians ( const bool bState ) { ShowAllMusicians ( bState ); }
5559
bool GetShowAllMusicians() { return bShowAllMusicians; }
@@ -107,6 +111,7 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase
107111
bool bListFilterWasActive;
108112
bool bShowAllMusicians;
109113
bool bEnableIPv6;
114+
bool bEnableAccessiblePushButtonUi;
110115

111116
public slots:
112117
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );

src/main.cpp

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,48 +81,50 @@ int main ( int argc, char** argv )
8181
#else
8282
bool bIsClient = true;
8383
#endif
84-
bool bUseGUI = true;
85-
bool bStartMinimized = false;
86-
bool bShowComplRegConnList = false;
87-
bool bDisconnectAllClientsOnQuit = false;
88-
bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size
89-
bool bUseMultithreading = false;
90-
bool bShowAnalyzerConsole = false;
91-
bool bMuteStream = false;
92-
bool bMuteMeInPersonalMix = false;
93-
bool bDisableRecording = false;
94-
bool bDelayPan = false;
95-
bool bNoAutoJackConnect = false;
96-
bool bUseTranslation = true;
97-
bool bCustomPortNumberGiven = false;
98-
bool bEnableIPv6 = false;
99-
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
100-
quint16 iPortNumber = DEFAULT_PORT_NUMBER;
101-
int iJsonRpcPortNumber = INVALID_PORT;
102-
QString strJsonRpcBindIP = DEFAULT_JSON_RPC_LISTEN_ADDRESS;
103-
quint16 iQosNumber = DEFAULT_QOS_NUMBER;
104-
ELicenceType eLicenceType = LT_NO_LICENCE;
105-
QString strMIDISetup = "";
106-
QString strConnOnStartupAddress = "";
107-
QString strIniFileName = "";
108-
QString strHTMLStatusFileName = "";
109-
QString strLoggingFileName = "";
110-
QString strRecordingDirName = "";
111-
QString strDirectoryAddress = "";
112-
QString strServerListFileName = "";
113-
QString strServerInfo = "";
114-
QString strServerPublicIP = "";
115-
QString strServerBindIP = "";
116-
QString strServerListFilter = "";
117-
QString strWelcomeMessage = "";
118-
QString strClientName = "";
119-
QString strJsonRpcSecretFileName = "";
84+
bool bUseGUI = true;
85+
bool bStartMinimized = false;
86+
bool bShowComplRegConnList = false;
87+
bool bDisconnectAllClientsOnQuit = false;
88+
bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size
89+
bool bUseMultithreading = false;
90+
bool bShowAnalyzerConsole = false;
91+
bool bMuteStream = false;
92+
bool bMuteMeInPersonalMix = false;
93+
bool bDisableRecording = false;
94+
bool bDelayPan = false;
95+
bool bNoAutoJackConnect = false;
96+
bool bUseTranslation = true;
97+
bool bCustomPortNumberGiven = false;
98+
bool bEnableIPv6 = false;
99+
bool bEnableAccessiblePushButtonUi = false;
100+
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
101+
quint16 iPortNumber = DEFAULT_PORT_NUMBER;
102+
int iJsonRpcPortNumber = INVALID_PORT;
103+
QString strJsonRpcBindIP = DEFAULT_JSON_RPC_LISTEN_ADDRESS;
104+
quint16 iQosNumber = DEFAULT_QOS_NUMBER;
105+
ELicenceType eLicenceType = LT_NO_LICENCE;
106+
QString strMIDISetup = "";
107+
QString strConnOnStartupAddress = "";
108+
QString strIniFileName = "";
109+
QString strHTMLStatusFileName = "";
110+
QString strLoggingFileName = "";
111+
QString strRecordingDirName = "";
112+
QString strDirectoryAddress = "";
113+
QString strServerListFileName = "";
114+
QString strServerInfo = "";
115+
QString strServerPublicIP = "";
116+
QString strServerBindIP = "";
117+
QString strServerListFilter = "";
118+
QString strWelcomeMessage = "";
119+
QString strClientName = "";
120+
QString strJsonRpcSecretFileName = "";
120121

121122
#if defined( HEADLESS ) || defined( SERVER_ONLY )
122123
Q_UNUSED ( bStartMinimized )
123124
Q_UNUSED ( bUseTranslation )
124125
Q_UNUSED ( bShowComplRegConnList )
125126
Q_UNUSED ( bShowAnalyzerConsole )
127+
Q_UNUSED ( bEnableAccessiblePushButtonUi )
126128
Q_UNUSED ( bMuteStream )
127129
#endif
128130
#if defined( SERVER_ONLY )
@@ -246,6 +248,15 @@ int main ( int argc, char** argv )
246248
continue;
247249
}
248250

251+
// Enable Accessible server list --------------------------------------
252+
if ( GetFlagArgument ( argv, i, "--accessible", "--accessible" ) )
253+
{
254+
bEnableAccessiblePushButtonUi = true;
255+
qInfo() << "- Accessible server list enabled";
256+
CommandLineOptions << "--accessible";
257+
continue;
258+
}
259+
249260
// Server only:
250261

251262
// Disconnect all clients on quit --------------------------------------
@@ -865,10 +876,10 @@ int main ( int argc, char** argv )
865876
Q_INIT_RESOURCE ( resources );
866877

867878
#ifndef SERVER_ONLY
868-
//### TEST: BEGIN ###//
869-
// activate the following line to activate the test bench,
870-
// CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER );
871-
//### TEST: END ###//
879+
// ### TEST: BEGIN ###//
880+
// activate the following line to activate the test bench,
881+
// CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER );
882+
// ### TEST: END ###//
872883
#endif
873884

874885
#ifdef NO_JSON_RPC
@@ -961,6 +972,7 @@ int main ( int argc, char** argv )
961972
bShowAnalyzerConsole,
962973
bMuteStream,
963974
bEnableIPv6,
975+
bEnableAccessiblePushButtonUi,
964976
nullptr );
965977

966978
// show dialog
@@ -1139,6 +1151,7 @@ QString UsageArguments ( char** argv )
11391151
" --mutemyown prevent me from hearing what I play in the server mix (headless only)\n"
11401152
" --clientname client name (window title and JACK client name)\n"
11411153
" --ctrlmidich configure MIDI controller\n"
1154+
" --accessible run Client UI in more accessible mode for screen reader users\n"
11421155
"\n"
11431156
"Example: %1 -s --inifile myinifile.ini\n"
11441157
"\n"

0 commit comments

Comments
 (0)