From 04c094ca37af0d2a22d99412df157adeff8f05bc Mon Sep 17 00:00:00 2001 From: Chi Kim <22120994+chigkim@users.noreply.github.com> Date: Sun, 25 Jan 2026 09:07:54 -0500 Subject: [PATCH 1/5] Make the server list accessible. --- src/connectdlg.cpp | 34 ++++++++++++++++++++++++++++++++++ src/connectdlg.h | 1 + 2 files changed, 35 insertions(+) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index c0a2b8c17f..959fb34371 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -24,6 +24,11 @@ #include "connectdlg.h" +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +# include +# include +#endif + /* Implementation *************************************************************/ // mapVersionStr - converts a version number to a sortable string @@ -243,6 +248,7 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR // to get default return key behaviour working QObject::connect ( lvwServers, &QTreeWidget::activated, this, &CConnectDlg::OnConnectClicked ); + QObject::connect ( lvwServers, &QTreeWidget::currentItemChanged, this, &CConnectDlg::OnCurrentServerItemChanged ); // line edit QObject::connect ( edtFilter, &QLineEdit::textEdited, this, &CConnectDlg::OnFilterTextEdited ); @@ -567,6 +573,7 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr, const CVect if ( vecChanInfo[i].eCountry != QLocale::AnyCountry ) { + pNewChildListViewItem->setData ( LVC_NAME, Qt::UserRole, QLocale::countryToString ( vecChanInfo[i].eCountry ) ); // try to load the country flag icon QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( vecChanInfo[i].eCountry ) ); @@ -1106,3 +1113,30 @@ void CConnectDlg::UpdateDirectoryComboBox() } } } + +void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWidgetItem* ) +{ +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + if ( !current ) + return; + + QString announcement; + if ( current->parent() ) + { + // It's a client + announcement = current->text ( LVC_NAME ); + QVariant countryData = current->data ( LVC_NAME, Qt::UserRole ); + if ( countryData.isValid() ) + { + announcement += ", " + countryData.toString(); + } + } + else + { + // It's a server + announcement = current->text ( LVC_NAME ) + ", " + current->text ( LVC_CLIENTS ) + ", " + current->text ( LVC_LOCATION ) + ", " + + tr ( "Ping" ) + " " + current->text ( LVC_PING ); + } + QAccessible::updateAccessibility ( new QAccessibleAnnouncementEvent ( lvwServers, announcement ) ); +#endif +} diff --git a/src/connectdlg.h b/src/connectdlg.h index 1aa4de359d..435169edf7 100644 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -132,6 +132,7 @@ public slots: void OnDeleteServerAddrClicked(); void OnTimerPing(); void OnTimerReRequestServList(); + void OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWidgetItem* previous ); signals: void ReqServerListQuery ( CHostAddress InetAddr ); From f902bc21ef847b5720cc24569d8be0cdafb5e343 Mon Sep 17 00:00:00 2001 From: Chi Kim <22120994+chigkim@users.noreply.github.com> Date: Sun, 25 Jan 2026 10:29:58 -0500 Subject: [PATCH 2/5] clang-format --- src/connectdlg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 959fb34371..621226dd74 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -24,7 +24,7 @@ #include "connectdlg.h" -#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 8, 0 ) # include # include #endif @@ -1116,7 +1116,7 @@ void CConnectDlg::UpdateDirectoryComboBox() void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWidgetItem* ) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 8, 0 ) if ( !current ) return; @@ -1124,7 +1124,7 @@ void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWi if ( current->parent() ) { // It's a client - announcement = current->text ( LVC_NAME ); + announcement = current->text ( LVC_NAME ); QVariant countryData = current->data ( LVC_NAME, Qt::UserRole ); if ( countryData.isValid() ) { From 37c3226a516ec6236591c88b95db5792bcec563b Mon Sep 17 00:00:00 2001 From: Chi Kim <22120994+chigkim@users.noreply.github.com> Date: Sun, 25 Jan 2026 14:25:22 -0500 Subject: [PATCH 3/5] Announce the information in right order. Reports correct number of musicians. --- src/connectdlg.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 621226dd74..42825ef04b 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -988,6 +988,11 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr, if ( bIsFirstPing ) { pCurListViewItem->setHidden ( false ); + + if ( pCurListViewItem == lvwServers->currentItem() ) + { + OnCurrentServerItemChanged ( pCurListViewItem, nullptr ); + } } // Update sorting. Note that the sorting must be the last action for the @@ -1037,6 +1042,11 @@ void CConnectDlg::SetServerVersionResult ( const CHostAddress& InetAddr, const Q // and store sortable mapped version number pCurListViewItem->setData ( LVC_VERSION, Qt::UserRole, mapVersionStr ( strVersion ) ); + + if ( pCurListViewItem == lvwServers->currentItem() ) + { + OnCurrentServerItemChanged ( pCurListViewItem, nullptr ); + } } } @@ -1120,6 +1130,11 @@ void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWi if ( !current ) return; + if ( !current->parent() && current->text ( LVC_PING ).isEmpty() ) + { + return; + } + QString announcement; if ( current->parent() ) { @@ -1134,8 +1149,8 @@ void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWi else { // It's a server - announcement = current->text ( LVC_NAME ) + ", " + current->text ( LVC_CLIENTS ) + ", " + current->text ( LVC_LOCATION ) + ", " + - tr ( "Ping" ) + " " + current->text ( LVC_PING ); + announcement = current->text ( LVC_NAME ) + ", " + tr ( "Ping" ) + " " + current->text ( LVC_PING ) + ", " + current->text ( LVC_CLIENTS ) + ", " + + current->text ( LVC_LOCATION ) + ", " + current->text ( LVC_VERSION ); } QAccessible::updateAccessibility ( new QAccessibleAnnouncementEvent ( lvwServers, announcement ) ); #endif From a7cff8c7f8baa61da87a0ee9f89cea116e9f2cc6 Mon Sep 17 00:00:00 2001 From: Chi Kim <22120994+chigkim@users.noreply.github.com> Date: Sun, 25 Jan 2026 14:26:33 -0500 Subject: [PATCH 4/5] clang-format --- src/connectdlg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 42825ef04b..4da17bec5c 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -1149,8 +1149,8 @@ void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWi else { // It's a server - announcement = current->text ( LVC_NAME ) + ", " + tr ( "Ping" ) + " " + current->text ( LVC_PING ) + ", " + current->text ( LVC_CLIENTS ) + ", " + - current->text ( LVC_LOCATION ) + ", " + current->text ( LVC_VERSION ); + announcement = current->text ( LVC_NAME ) + ", " + tr ( "Ping" ) + " " + current->text ( LVC_PING ) + ", " + current->text ( LVC_CLIENTS ) + + ", " + current->text ( LVC_LOCATION ) + ", " + current->text ( LVC_VERSION ); } QAccessible::updateAccessibility ( new QAccessibleAnnouncementEvent ( lvwServers, announcement ) ); #endif From 6d02ccdb201f352c8cc0f6666ba77d94f8a0e035 Mon Sep 17 00:00:00 2001 From: Chi Kim <22120994+chigkim@users.noreply.github.com> Date: Sun, 25 Jan 2026 23:06:00 -0500 Subject: [PATCH 5/5] Added anbrief description about the OnCurrentServerItemChanged function. --- src/connectdlg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 4da17bec5c..03392a8a48 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -1126,6 +1126,7 @@ void CConnectDlg::UpdateDirectoryComboBox() void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWidgetItem* ) { + // Announce the currently selected server or client to screen readers. #if QT_VERSION >= QT_VERSION_CHECK( 6, 8, 0 ) if ( !current ) return;