|
24 | 24 |
|
25 | 25 | #include "connectdlg.h" |
26 | 26 |
|
| 27 | +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) |
| 28 | +# include <QAccessible> |
| 29 | +# include <QAccessibleAnnouncementEvent> |
| 30 | +#endif |
| 31 | + |
27 | 32 | /* Implementation *************************************************************/ |
28 | 33 |
|
29 | 34 | // mapVersionStr - converts a version number to a sortable string |
@@ -243,6 +248,7 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR |
243 | 248 |
|
244 | 249 | // to get default return key behaviour working |
245 | 250 | QObject::connect ( lvwServers, &QTreeWidget::activated, this, &CConnectDlg::OnConnectClicked ); |
| 251 | + QObject::connect ( lvwServers, &QTreeWidget::currentItemChanged, this, &CConnectDlg::OnCurrentServerItemChanged ); |
246 | 252 |
|
247 | 253 | // line edit |
248 | 254 | QObject::connect ( edtFilter, &QLineEdit::textEdited, this, &CConnectDlg::OnFilterTextEdited ); |
@@ -567,6 +573,7 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr, const CVect |
567 | 573 |
|
568 | 574 | if ( vecChanInfo[i].eCountry != QLocale::AnyCountry ) |
569 | 575 | { |
| 576 | + pNewChildListViewItem->setData ( LVC_NAME, Qt::UserRole, QLocale::countryToString ( vecChanInfo[i].eCountry ) ); |
570 | 577 | // try to load the country flag icon |
571 | 578 | QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( vecChanInfo[i].eCountry ) ); |
572 | 579 |
|
@@ -1106,3 +1113,30 @@ void CConnectDlg::UpdateDirectoryComboBox() |
1106 | 1113 | } |
1107 | 1114 | } |
1108 | 1115 | } |
| 1116 | + |
| 1117 | +void CConnectDlg::OnCurrentServerItemChanged ( QTreeWidgetItem* current, QTreeWidgetItem* ) |
| 1118 | +{ |
| 1119 | +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) |
| 1120 | + if ( !current ) |
| 1121 | + return; |
| 1122 | + |
| 1123 | + QString announcement; |
| 1124 | + if ( current->parent() ) |
| 1125 | + { |
| 1126 | + // It's a client |
| 1127 | + announcement = current->text ( LVC_NAME ); |
| 1128 | + QVariant countryData = current->data ( LVC_NAME, Qt::UserRole ); |
| 1129 | + if ( countryData.isValid() ) |
| 1130 | + { |
| 1131 | + announcement += ", " + countryData.toString(); |
| 1132 | + } |
| 1133 | + } |
| 1134 | + else |
| 1135 | + { |
| 1136 | + // It's a server |
| 1137 | + announcement = current->text ( LVC_NAME ) + ", " + current->text ( LVC_CLIENTS ) + ", " + current->text ( LVC_LOCATION ) + ", " + |
| 1138 | + tr ( "Ping" ) + " " + current->text ( LVC_PING ); |
| 1139 | + } |
| 1140 | + QAccessible::updateAccessibility ( new QAccessibleAnnouncementEvent ( lvwServers, announcement ) ); |
| 1141 | +#endif |
| 1142 | +} |
0 commit comments