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 -------------------------------------------------------------
// 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 )
{

View File

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

View File

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

View File

@ -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 ( "<b>Client List:</b> 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 ( "<b>Register Server Status:</b> 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 ( "<b>Central Server Address:</b> 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 ( "<b>Server Name:</b> 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 ( "<b>Location City:</b> 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 ( "<b>Location country:</b> 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 ( "<b>Client List:</b> 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 ( "<b>Register Server Status:</b> 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 ( "<b>Central Server Address:</b> 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 ( "<b>Server Name:</b> 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 ( "<b>Location City:</b> 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 ( "<b>Location country:</b> 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

View File

@ -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;

View File

@ -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;