From 50cf3e54dcdaff46b85fa4ed851d752274649f1c Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 1 May 2011 19:33:29 +0000 Subject: [PATCH] fix for server GUI, connect dlg fix --- src/connectdlg.cpp | 14 +++++ src/connectdlg.h | 1 + src/connectdlgbase.ui | 2 +- src/llconserverdlg.cpp | 138 +++++++++++++++++++++-------------------- src/llconserverdlg.h | 4 +- src/main.cpp | 9 ++- 6 files changed, 97 insertions(+), 71 deletions(-) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 8dfcdb74..39892d80 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -65,6 +65,10 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f ) // Connections ------------------------------------------------------------- // list view + QObject::connect ( ListViewServers, + SIGNAL ( itemClicked ( QTreeWidgetItem*, int ) ), + this, SLOT ( OnServerListItemClicked ( QTreeWidgetItem*, int ) ) ); + QObject::connect ( ListViewServers, SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), this, SLOT ( OnServerListItemDoubleClicked ( QTreeWidgetItem*, int ) ) ); @@ -259,6 +263,16 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS ); } +void CConnectDlg::OnServerListItemClicked ( QTreeWidgetItem* Item, + int ) +{ + // if an item is clicked, copy the server name to the combo box + if ( Item != 0 ) + { + LineEditServerAddr->setEditText ( Item->text ( 0 ) ); + } +} + void CConnectDlg::OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ) { diff --git a/src/connectdlg.h b/src/connectdlg.h index 1aa7a73d..03be9a9f 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -84,6 +84,7 @@ protected: bool bServerListItemWasChosen; public slots: + void OnServerListItemClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); void OnConnectButtonClicked(); void OnTimerPing(); diff --git a/src/connectdlgbase.ui b/src/connectdlgbase.ui index 75509c9d..f24f8a53 100755 --- a/src/connectdlgbase.ui +++ b/src/connectdlgbase.ui @@ -54,7 +54,7 @@ - Server Address + Server Name/Address Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/llconserverdlg.cpp b/src/llconserverdlg.cpp index 840bcea3..ffa1c6a4 100755 --- a/src/llconserverdlg.cpp +++ b/src/llconserverdlg.cpp @@ -26,78 +26,80 @@ /* Implementation *************************************************************/ -CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent ) - : QDialog ( parent ), pServer ( pNServP ) +CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, + QWidget* parent, + Qt::WindowFlags f ) + : QDialog ( parent, f ), pServer ( pNServP ) { setupUi ( this ); - // Add help text to controls ----------------------------------------------- - // client list - ListViewClients->setWhatsThis ( tr ( "Client List: The client list " - "shows all clients which are currently connected to this server. Some " - "informations about the clients like the IP address, name, buffer " - "state are given for each connected client." ) ); - - ListViewClients->setAccessibleName ( tr ( "Connected clients list view" ) ); - - // register server flag - cbRegisterServer->setWhatsThis ( tr ( "Register Server Status: If " - "the register server check box is checked, this server registers " - "itself at the central server so that all " ) + APP_NAME + - tr ( " users can see the server in the connect dialog server list and " - "connect to it. The registering of the server is renewed periodically " - "to make sure that all servers in the connect dialog server list are " - "actually available." ) ); - - // central server address - QString strCentrServAddr = tr ( "Central Server Address: The " - "Central server address is the IP address or URL of the central server " - "at which this server is registered. If the Default check box is " - "checked, the default central server address is shown read-only." ); - - LabelCentralServerAddress->setWhatsThis ( strCentrServAddr ); - cbDefaultCentralServer->setWhatsThis ( strCentrServAddr ); - LineEditCentralServerAddress->setWhatsThis ( strCentrServAddr ); - - cbDefaultCentralServer->setAccessibleName ( - tr ( "Default central server check box" ) ); - - LineEditCentralServerAddress->setAccessibleName ( - tr ( "Central server address line edit" ) ); - - // server name - QString strServName = tr ( "Server Name: The server name identifies " - "your server in the connect dialog server list at the clients. If no " - "name is given, the IP address is shown instead." ); - - LabelServerName->setWhatsThis ( strServName ); - LineEditServerName->setWhatsThis ( strServName ); - - LineEditServerName->setAccessibleName ( tr ( "Server name line edit" ) ); - - // location city - QString strLocCity = tr ( "Location City: The city in which this " - "server is located can be set here. If a city name is entered, it " - "will be shown in the connect dialog server list at the clients." ); - - LabelLocationCity->setWhatsThis ( strLocCity ); - LineEditLocationCity->setWhatsThis ( strLocCity ); - - LineEditLocationCity->setAccessibleName ( tr ( - "City where the server is located line edit" ) ); - - // location country - QString strLocCountry = tr ( "Location country: The country in " - "which this server is located can be set here. If a country is " - "entered, it will be shown in the connect dialog server list at the " - "clients." ); - - LabelLocationCountry->setWhatsThis ( strLocCountry ); - ComboBoxLocationCountry->setWhatsThis ( strLocCountry ); - - ComboBoxLocationCountry->setAccessibleName ( tr ( - "Country where the server is located combo box" ) ); + // Add help text to controls ----------------------------------------------- + // client list + ListViewClients->setWhatsThis ( tr ( "Client List: The client list " + "shows all clients which are currently connected to this server. Some " + "informations about the clients like the IP address, name, buffer " + "state are given for each connected client." ) ); + + ListViewClients->setAccessibleName ( tr ( "Connected clients list view" ) ); + + // register server flag + cbRegisterServer->setWhatsThis ( tr ( "Register Server Status: If " + "the register server check box is checked, this server registers " + "itself at the central server so that all " ) + APP_NAME + + tr ( " users can see the server in the connect dialog server list and " + "connect to it. The registering of the server is renewed periodically " + "to make sure that all servers in the connect dialog server list are " + "actually available." ) ); + + // central server address + QString strCentrServAddr = tr ( "Central Server Address: The " + "Central server address is the IP address or URL of the central server " + "at which this server is registered. If the Default check box is " + "checked, the default central server address is shown read-only." ); + + LabelCentralServerAddress->setWhatsThis ( strCentrServAddr ); + cbDefaultCentralServer->setWhatsThis ( strCentrServAddr ); + LineEditCentralServerAddress->setWhatsThis ( strCentrServAddr ); + + cbDefaultCentralServer->setAccessibleName ( + tr ( "Default central server check box" ) ); + + LineEditCentralServerAddress->setAccessibleName ( + tr ( "Central server address line edit" ) ); + + // server name + QString strServName = tr ( "Server Name: The server name identifies " + "your server in the connect dialog server list at the clients. If no " + "name is given, the IP address is shown instead." ); + + LabelServerName->setWhatsThis ( strServName ); + LineEditServerName->setWhatsThis ( strServName ); + + LineEditServerName->setAccessibleName ( tr ( "Server name line edit" ) ); + + // location city + QString strLocCity = tr ( "Location City: The city in which this " + "server is located can be set here. If a city name is entered, it " + "will be shown in the connect dialog server list at the clients." ); + + LabelLocationCity->setWhatsThis ( strLocCity ); + LineEditLocationCity->setWhatsThis ( strLocCity ); + + LineEditLocationCity->setAccessibleName ( tr ( + "City where the server is located line edit" ) ); + + // location country + QString strLocCountry = tr ( "Location country: The country in " + "which this server is located can be set here. If a country is " + "entered, it will be shown in the connect dialog server list at the " + "clients." ); + + LabelLocationCountry->setWhatsThis ( strLocCountry ); + ComboBoxLocationCountry->setWhatsThis ( strLocCountry ); + + ComboBoxLocationCountry->setAccessibleName ( tr ( + "Country where the server is located combo box" ) ); // set text for version and application name diff --git a/src/llconserverdlg.h b/src/llconserverdlg.h index 36aba428..68d5d1cd 100755 --- a/src/llconserverdlg.h +++ b/src/llconserverdlg.h @@ -55,7 +55,9 @@ class CLlconServerDlg : public QDialog, private Ui_CLlconServerDlgBase Q_OBJECT public: - CLlconServerDlg ( CServer* pNServP, QWidget* parent = 0 ); + CLlconServerDlg ( CServer* pNServP, + QWidget* parent = 0, + Qt::WindowFlags f = 0 ); protected: QTimer Timer; diff --git a/src/main.cpp b/src/main.cpp index b1ded77d..97bed536 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -363,7 +363,14 @@ int main ( int argc, char** argv ) Server.UpdateServerList(); // GUI object for the server - CLlconServerDlg ServerDlg ( &Server, 0 ); + CLlconServerDlg ServerDlg ( + &Server, + 0 +#ifdef _WIN32 + // this somehow only works reliable on Windows + , Qt::WindowMinMaxButtonsHint +#endif + ); // set main window pMainWindow = &ServerDlg;