diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 98b557fd3d..6ff5f63213 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -33,6 +33,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP, const bool bShowAnalyzerConsole, const bool bMuteStream, const bool bNEnableIPv6, + const bool bNEnableAccessiblePushButtonUi, QWidget* parent ) : CBaseDlg ( parent, Qt::Window ), // use Qt::Window to get min/max window buttons pClient ( pNCliP ), @@ -40,11 +41,12 @@ CClientDlg::CClientDlg ( CClient* pNCliP, bConnectDlgWasShown ( false ), bDetectFeedback ( false ), bEnableIPv6 ( bNEnableIPv6 ), + bEnableAccessiblePushButtonUi ( bNEnableAccessiblePushButtonUi ), eLastRecorderState ( RS_UNDEFINED ), // for SetMixerBoardDeco eLastDesign ( GD_ORIGINAL ), // " ClientSettingsDlg ( pNCliP, pNSetP, parent ), ChatDlg ( parent ), - ConnectDlg ( pNSetP, bNewShowComplRegConnList, parent ), + ConnectDlg ( pNSetP, bNewShowComplRegConnList, bNEnableIPv6, bNEnableAccessiblePushButtonUi, parent ), AnalyzerConsole ( pNCliP, parent ) { setupUi ( this ); @@ -1286,11 +1288,11 @@ void CClientDlg::Disconnect() TimerDetectFeedback.stop(); bDetectFeedback = false; - //### TODO: BEGIN ###// - // is this still required??? - // immediately update status bar + // ### TODO: BEGIN ###// + // is this still required??? + // immediately update status bar OnTimerStatus(); - //### TODO: END ###// + // ### TODO: END ###// // reset LEDs ledBuffers->Reset(); diff --git a/src/clientdlg.h b/src/clientdlg.h index 378a85c12e..876dee8bf0 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -85,6 +85,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase const bool bShowAnalyzerConsole, const bool bMuteStream, const bool bNEnableIPv6, + const bool bNEnableAccessiblePushButtonUi, QWidget* parent = nullptr ); protected: @@ -110,6 +111,7 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase bool bConnectDlgWasShown; bool bDetectFeedback; bool bEnableIPv6; + bool bEnableAccessiblePushButtonUi; ERecorderState eLastRecorderState; EGUIDesign eLastDesign; QTimer TimerSigMet; diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index a83d499b7d..8c8c2109bb 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -25,7 +25,11 @@ #include "connectdlg.h" /* Implementation *************************************************************/ -CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent ) : +CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, + const bool bNewShowCompleteRegList, + const bool bNEnableIPv6, + const bool bNEnableAccessiblePushButtonUi, + QWidget* parent ) : CBaseDlg ( parent, Qt::Dialog ), pSettings ( pNSetP ), strSelectedAddress ( "" ), @@ -36,7 +40,8 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR bServerListItemWasChosen ( false ), bListFilterWasActive ( false ), bShowAllMusicians ( true ), - bEnableIPv6 ( bNEnableIPv6 ) + bEnableIPv6 ( bNEnableIPv6 ), + bEnableAccessiblePushButtonUi ( bNEnableAccessiblePushButtonUi ) { setupUi ( this ); @@ -460,6 +465,15 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, const CVectorexpandItem ( pNewListViewItem ); } + + // accessibility: use Push Buttons to allow screen readers to see the fields + if ( bEnableAccessiblePushButtonUi ) + { + for ( int i = 0; i < lvwServers->columnCount(); i++ ) + { + lvwServers->setItemWidget ( pNewListViewItem, i, new QPushButton ( pNewListViewItem->text ( i ) ) ); + } + } } // immediately issue the ping measurements and start the ping timer since @@ -899,6 +913,16 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr, pCurListViewItem->setText ( LVC_CLIENTS, QString().setNum ( iNumClients ) + "/" + pCurListViewItem->text ( LVC_CLIENTS_MAX_HIDDEN ) ); } + if ( bEnableAccessiblePushButtonUi ) + { + // apply text to accessible ui + dynamic_cast ( lvwServers->itemWidget ( pCurListViewItem, LVC_PING ) )->setText ( pCurListViewItem->text ( LVC_PING ) ); + dynamic_cast ( lvwServers->itemWidget ( pCurListViewItem, LVC_CLIENTS ) ) + ->setText ( pCurListViewItem->text ( LVC_CLIENTS ) ); + dynamic_cast ( lvwServers->itemWidget ( pCurListViewItem, LVC_VERSION ) ) + ->setText ( pCurListViewItem->text ( LVC_VERSION ) ); + } + // check if the number of child list items matches the number of // connected clients, if not then request the client names if ( iNumClients != pCurListViewItem->childCount() ) diff --git a/src/connectdlg.h b/src/connectdlg.h index 62cb2dcfdf..84d2188f83 100644 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -49,7 +49,11 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase Q_OBJECT public: - CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent = nullptr ); + CConnectDlg ( CClientSettings* pNSetP, + const bool bNewShowCompleteRegList, + const bool bNEnableIPv6, + const bool bNEnableAccessiblePushButtonUi, + QWidget* parent = nullptr ); void SetShowAllMusicians ( const bool bState ) { ShowAllMusicians ( bState ); } bool GetShowAllMusicians() { return bShowAllMusicians; } @@ -107,6 +111,7 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase bool bListFilterWasActive; bool bShowAllMusicians; bool bEnableIPv6; + bool bEnableAccessiblePushButtonUi; public slots: void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); diff --git a/src/main.cpp b/src/main.cpp index cb81b387ca..1edca9b80e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -81,48 +81,50 @@ int main ( int argc, char** argv ) #else bool bIsClient = true; #endif - bool bUseGUI = true; - bool bStartMinimized = false; - bool bShowComplRegConnList = false; - bool bDisconnectAllClientsOnQuit = false; - bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size - bool bUseMultithreading = false; - bool bShowAnalyzerConsole = false; - bool bMuteStream = false; - bool bMuteMeInPersonalMix = false; - bool bDisableRecording = false; - bool bDelayPan = false; - bool bNoAutoJackConnect = false; - bool bUseTranslation = true; - bool bCustomPortNumberGiven = false; - bool bEnableIPv6 = false; - int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; - quint16 iPortNumber = DEFAULT_PORT_NUMBER; - int iJsonRpcPortNumber = INVALID_PORT; - QString strJsonRpcBindIP = DEFAULT_JSON_RPC_LISTEN_ADDRESS; - quint16 iQosNumber = DEFAULT_QOS_NUMBER; - ELicenceType eLicenceType = LT_NO_LICENCE; - QString strMIDISetup = ""; - QString strConnOnStartupAddress = ""; - QString strIniFileName = ""; - QString strHTMLStatusFileName = ""; - QString strLoggingFileName = ""; - QString strRecordingDirName = ""; - QString strDirectoryAddress = ""; - QString strServerListFileName = ""; - QString strServerInfo = ""; - QString strServerPublicIP = ""; - QString strServerBindIP = ""; - QString strServerListFilter = ""; - QString strWelcomeMessage = ""; - QString strClientName = ""; - QString strJsonRpcSecretFileName = ""; + bool bUseGUI = true; + bool bStartMinimized = false; + bool bShowComplRegConnList = false; + bool bDisconnectAllClientsOnQuit = false; + bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size + bool bUseMultithreading = false; + bool bShowAnalyzerConsole = false; + bool bMuteStream = false; + bool bMuteMeInPersonalMix = false; + bool bDisableRecording = false; + bool bDelayPan = false; + bool bNoAutoJackConnect = false; + bool bUseTranslation = true; + bool bCustomPortNumberGiven = false; + bool bEnableIPv6 = false; + bool bEnableAccessiblePushButtonUi = false; + int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; + quint16 iPortNumber = DEFAULT_PORT_NUMBER; + int iJsonRpcPortNumber = INVALID_PORT; + QString strJsonRpcBindIP = DEFAULT_JSON_RPC_LISTEN_ADDRESS; + quint16 iQosNumber = DEFAULT_QOS_NUMBER; + ELicenceType eLicenceType = LT_NO_LICENCE; + QString strMIDISetup = ""; + QString strConnOnStartupAddress = ""; + QString strIniFileName = ""; + QString strHTMLStatusFileName = ""; + QString strLoggingFileName = ""; + QString strRecordingDirName = ""; + QString strDirectoryAddress = ""; + QString strServerListFileName = ""; + QString strServerInfo = ""; + QString strServerPublicIP = ""; + QString strServerBindIP = ""; + QString strServerListFilter = ""; + QString strWelcomeMessage = ""; + QString strClientName = ""; + QString strJsonRpcSecretFileName = ""; #if defined( HEADLESS ) || defined( SERVER_ONLY ) Q_UNUSED ( bStartMinimized ) Q_UNUSED ( bUseTranslation ) Q_UNUSED ( bShowComplRegConnList ) Q_UNUSED ( bShowAnalyzerConsole ) + Q_UNUSED ( bEnableAccessiblePushButtonUi ) Q_UNUSED ( bMuteStream ) #endif #if defined( SERVER_ONLY ) @@ -246,6 +248,15 @@ int main ( int argc, char** argv ) continue; } + // Enable Accessible server list -------------------------------------- + if ( GetFlagArgument ( argv, i, "--accessible", "--accessible" ) ) + { + bEnableAccessiblePushButtonUi = true; + qInfo() << "- Accessible server list enabled"; + CommandLineOptions << "--accessible"; + continue; + } + // Server only: // Disconnect all clients on quit -------------------------------------- @@ -865,10 +876,10 @@ int main ( int argc, char** argv ) Q_INIT_RESOURCE ( resources ); #ifndef SERVER_ONLY - //### TEST: BEGIN ###// - // activate the following line to activate the test bench, - // CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER ); - //### TEST: END ###// + // ### TEST: BEGIN ###// + // activate the following line to activate the test bench, + // CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER ); + // ### TEST: END ###// #endif #ifdef NO_JSON_RPC @@ -961,6 +972,7 @@ int main ( int argc, char** argv ) bShowAnalyzerConsole, bMuteStream, bEnableIPv6, + bEnableAccessiblePushButtonUi, nullptr ); // show dialog @@ -1139,6 +1151,7 @@ QString UsageArguments ( char** argv ) " --mutemyown prevent me from hearing what I play in the server mix (headless only)\n" " --clientname client name (window title and JACK client name)\n" " --ctrlmidich configure MIDI controller\n" + " --accessible run Client UI in more accessible mode for screen reader users\n" "\n" "Example: %1 -s --inifile myinifile.ini\n" "\n"