fix for server GUI, connect dlg fix

This commit is contained in:
Volker Fischer 2011-05-01 19:33:29 +00:00
parent 29a185da97
commit 50cf3e54dc
6 changed files with 97 additions and 71 deletions

View File

@ -65,6 +65,10 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// list view // list view
QObject::connect ( ListViewServers,
SIGNAL ( itemClicked ( QTreeWidgetItem*, int ) ),
this, SLOT ( OnServerListItemClicked ( QTreeWidgetItem*, int ) ) );
QObject::connect ( ListViewServers, QObject::connect ( ListViewServers,
SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ),
this, SLOT ( OnServerListItemDoubleClicked ( 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 ); 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, void CConnectDlg::OnServerListItemDoubleClicked ( QTreeWidgetItem* Item,
int ) int )
{ {

View File

@ -84,6 +84,7 @@ protected:
bool bServerListItemWasChosen; bool bServerListItemWasChosen;
public slots: public slots:
void OnServerListItemClicked ( QTreeWidgetItem* Item, int );
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnConnectButtonClicked(); void OnConnectButtonClicked();
void OnTimerPing(); void OnTimerPing();

View File

@ -54,7 +54,7 @@
<item> <item>
<widget class="QLabel" name="TextLabelServerAddr" > <widget class="QLabel" name="TextLabelServerAddr" >
<property name="text" > <property name="text" >
<string>Server Address</string> <string>Server Name/Address</string>
</property> </property>
<property name="alignment" > <property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -26,78 +26,80 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent ) CLlconServerDlg::CLlconServerDlg ( CServer* pNServP,
: QDialog ( parent ), pServer ( pNServP ) QWidget* parent,
Qt::WindowFlags f )
: QDialog ( parent, f ), pServer ( pNServP )
{ {
setupUi ( this ); setupUi ( this );
// Add help text to controls ----------------------------------------------- // Add help text to controls -----------------------------------------------
// client list // client list
ListViewClients->setWhatsThis ( tr ( "<b>Client List:</b> The client list " ListViewClients->setWhatsThis ( tr ( "<b>Client List:</b> The client list "
"shows all clients which are currently connected to this server. Some " "shows all clients which are currently connected to this server. Some "
"informations about the clients like the IP address, name, buffer " "informations about the clients like the IP address, name, buffer "
"state are given for each connected client." ) ); "state are given for each connected client." ) );
ListViewClients->setAccessibleName ( tr ( "Connected clients list view" ) ); ListViewClients->setAccessibleName ( tr ( "Connected clients list view" ) );
// register server flag // register server flag
cbRegisterServer->setWhatsThis ( tr ( "<b>Register Server Status:</b> If " cbRegisterServer->setWhatsThis ( tr ( "<b>Register Server Status:</b> If "
"the register server check box is checked, this server registers " "the register server check box is checked, this server registers "
"itself at the central server so that all " ) + APP_NAME + "itself at the central server so that all " ) + APP_NAME +
tr ( " users can see the server in the connect dialog server list and " tr ( " users can see the server in the connect dialog server list and "
"connect to it. The registering of the server is renewed periodically " "connect to it. The registering of the server is renewed periodically "
"to make sure that all servers in the connect dialog server list are " "to make sure that all servers in the connect dialog server list are "
"actually available." ) ); "actually available." ) );
// central server address // central server address
QString strCentrServAddr = tr ( "<b>Central Server Address:</b> The " QString strCentrServAddr = tr ( "<b>Central Server Address:</b> The "
"Central server address is the IP address or URL of the central server " "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 " "at which this server is registered. If the Default check box is "
"checked, the default central server address is shown read-only." ); "checked, the default central server address is shown read-only." );
LabelCentralServerAddress->setWhatsThis ( strCentrServAddr ); LabelCentralServerAddress->setWhatsThis ( strCentrServAddr );
cbDefaultCentralServer->setWhatsThis ( strCentrServAddr ); cbDefaultCentralServer->setWhatsThis ( strCentrServAddr );
LineEditCentralServerAddress->setWhatsThis ( strCentrServAddr ); LineEditCentralServerAddress->setWhatsThis ( strCentrServAddr );
cbDefaultCentralServer->setAccessibleName ( cbDefaultCentralServer->setAccessibleName (
tr ( "Default central server check box" ) ); tr ( "Default central server check box" ) );
LineEditCentralServerAddress->setAccessibleName ( LineEditCentralServerAddress->setAccessibleName (
tr ( "Central server address line edit" ) ); tr ( "Central server address line edit" ) );
// server name // server name
QString strServName = tr ( "<b>Server Name:</b> The server name identifies " QString strServName = tr ( "<b>Server Name:</b> The server name identifies "
"your server in the connect dialog server list at the clients. If no " "your server in the connect dialog server list at the clients. If no "
"name is given, the IP address is shown instead." ); "name is given, the IP address is shown instead." );
LabelServerName->setWhatsThis ( strServName ); LabelServerName->setWhatsThis ( strServName );
LineEditServerName->setWhatsThis ( strServName ); LineEditServerName->setWhatsThis ( strServName );
LineEditServerName->setAccessibleName ( tr ( "Server name line edit" ) ); LineEditServerName->setAccessibleName ( tr ( "Server name line edit" ) );
// location city // location city
QString strLocCity = tr ( "<b>Location City:</b> The city in which this " QString strLocCity = tr ( "<b>Location City:</b> The city in which this "
"server is located can be set here. If a city name is entered, it " "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." ); "will be shown in the connect dialog server list at the clients." );
LabelLocationCity->setWhatsThis ( strLocCity ); LabelLocationCity->setWhatsThis ( strLocCity );
LineEditLocationCity->setWhatsThis ( strLocCity ); LineEditLocationCity->setWhatsThis ( strLocCity );
LineEditLocationCity->setAccessibleName ( tr ( LineEditLocationCity->setAccessibleName ( tr (
"City where the server is located line edit" ) ); "City where the server is located line edit" ) );
// location country // location country
QString strLocCountry = tr ( "<b>Location country:</b> The country in " QString strLocCountry = tr ( "<b>Location country:</b> The country in "
"which this server is located can be set here. If a country is " "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 " "entered, it will be shown in the connect dialog server list at the "
"clients." ); "clients." );
LabelLocationCountry->setWhatsThis ( strLocCountry ); LabelLocationCountry->setWhatsThis ( strLocCountry );
ComboBoxLocationCountry->setWhatsThis ( strLocCountry ); ComboBoxLocationCountry->setWhatsThis ( strLocCountry );
ComboBoxLocationCountry->setAccessibleName ( tr ( ComboBoxLocationCountry->setAccessibleName ( tr (
"Country where the server is located combo box" ) ); "Country where the server is located combo box" ) );
// set text for version and application name // set text for version and application name

View File

@ -55,7 +55,9 @@ class CLlconServerDlg : public QDialog, private Ui_CLlconServerDlgBase
Q_OBJECT Q_OBJECT
public: public:
CLlconServerDlg ( CServer* pNServP, QWidget* parent = 0 ); CLlconServerDlg ( CServer* pNServP,
QWidget* parent = 0,
Qt::WindowFlags f = 0 );
protected: protected:
QTimer Timer; QTimer Timer;

View File

@ -363,7 +363,14 @@ int main ( int argc, char** argv )
Server.UpdateServerList(); Server.UpdateServerList();
// GUI object for the server // 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 // set main window
pMainWindow = &ServerDlg; pMainWindow = &ServerDlg;