prepared for the combo box functionality for server names
This commit is contained in:
parent
899d11fa4b
commit
944639e7ee
4 changed files with 96 additions and 20 deletions
|
@ -34,10 +34,38 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
|
|
||||||
|
|
||||||
// Add help text to controls -----------------------------------------------
|
// Add help text to controls -----------------------------------------------
|
||||||
|
// server address
|
||||||
|
QString strServAddrH = tr ( "<b>Server Address:</b> The IP address or URL "
|
||||||
|
"of the server running the llcon server software must be set here. "
|
||||||
|
"A list of the most recent used server URLs is available for "
|
||||||
|
"selection. If an invalid address was chosen, an error message is "
|
||||||
|
"shown in the status bar." );
|
||||||
|
|
||||||
|
TextLabelServerAddr->setWhatsThis ( strServAddrH );
|
||||||
|
LineEditServerAddr->setWhatsThis ( strServAddrH );
|
||||||
|
|
||||||
|
LineEditServerAddr->setAccessibleName ( tr ( "Server address edit box" ) );
|
||||||
|
LineEditServerAddr->setAccessibleDescription ( tr ( "Holds the current server "
|
||||||
|
"URL. It also stores old URLs in the combo box list." ) );
|
||||||
|
|
||||||
|
|
||||||
|
// init server address combo box (max MAX_NUM_SERVER_ADDR_ITEMS entries)
|
||||||
|
LineEditServerAddr->setMaxCount ( MAX_NUM_SERVER_ADDR_ITEMS );
|
||||||
|
LineEditServerAddr->setInsertPolicy ( QComboBox::InsertAtTop );
|
||||||
|
|
||||||
|
// load data from ini file
|
||||||
|
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
|
||||||
|
{
|
||||||
|
// if ( !pClient->vstrIPAddress[iLEIdx].isEmpty() )
|
||||||
|
{
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
// LineEditServerAddr->addItem ( pClient->vstrIPAddress[iLEIdx] );
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set up list view for connected clients
|
// set up list view for connected clients
|
||||||
ListViewServers->setColumnWidth ( 0, 170 );
|
ListViewServers->setColumnWidth ( 0, 170 );
|
||||||
ListViewServers->setColumnWidth ( 1, 130 );
|
ListViewServers->setColumnWidth ( 1, 130 );
|
||||||
|
@ -48,6 +76,13 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
|
|
||||||
|
|
||||||
// Connections -------------------------------------------------------------
|
// Connections -------------------------------------------------------------
|
||||||
|
// line edits
|
||||||
|
QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ),
|
||||||
|
this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ),
|
||||||
|
this, SLOT ( OnLineEditServerAddrActivated ( int ) ) );
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerPing() ) );
|
this, SLOT ( OnTimerPing() ) );
|
||||||
|
@ -177,6 +212,26 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
|
||||||
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
|
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConnectDlg::OnLineEditServerAddrTextChanged ( const QString )
|
||||||
|
{
|
||||||
|
// if the maximum number of items in the combo box is reached,
|
||||||
|
// delete the last item so that the new item can be added (first
|
||||||
|
// in - first out)
|
||||||
|
if ( LineEditServerAddr->count() == MAX_NUM_SERVER_ADDR_ITEMS )
|
||||||
|
{
|
||||||
|
LineEditServerAddr->removeItem ( MAX_NUM_SERVER_ADDR_ITEMS - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConnectDlg::OnLineEditServerAddrActivated ( int index )
|
||||||
|
{
|
||||||
|
// move activated list item to the top
|
||||||
|
const QString strCurIPAddress = LineEditServerAddr->itemText ( index );
|
||||||
|
LineEditServerAddr->removeItem ( index );
|
||||||
|
LineEditServerAddr->insertItem ( 0, strCurIPAddress );
|
||||||
|
LineEditServerAddr->setCurrentIndex ( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
void CConnectDlg::OnTimerPing()
|
void CConnectDlg::OnTimerPing()
|
||||||
{
|
{
|
||||||
// send ping messages to the servers in the list
|
// send ping messages to the servers in the list
|
||||||
|
|
|
@ -73,6 +73,8 @@ protected:
|
||||||
bool bServerListReceived;
|
bool bServerListReceived;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void OnLineEditServerAddrTextChanged ( const QString );
|
||||||
|
void OnLineEditServerAddrActivated ( int index );
|
||||||
void OnTimerPing();
|
void OnTimerPing();
|
||||||
void OnTimerReRequestServList();
|
void OnTimerReRequestServList();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>584</width>
|
<width>584</width>
|
||||||
<height>355</height>
|
<height>256</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
|
@ -55,18 +55,25 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="TextLabelServerAddr" >
|
<layout class="QHBoxLayout" >
|
||||||
<property name="text" >
|
<item>
|
||||||
<string>Server Address</string>
|
<widget class="QLabel" name="TextLabelServerAddr" >
|
||||||
</property>
|
<property name="text" >
|
||||||
</widget>
|
<string>Server Address</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="alignment" >
|
||||||
<widget class="QComboBox" name="LineEditServerAddr" >
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
<property name="editable" >
|
</property>
|
||||||
<bool>true</bool>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
|
<widget class="QComboBox" name="LineEditServerAddr" >
|
||||||
|
<property name="editable" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
|
@ -77,16 +84,26 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>351</width>
|
||||||
<height>20</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton" >
|
<widget class="QPushButton" name="CancelButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>PushButton</string>
|
<string>C&ancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ConnectButton" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Connect</string>
|
||||||
|
</property>
|
||||||
|
<property name="default" >
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -74,9 +74,11 @@ class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLlconClientDlg ( CClient* pNCliP, const bool bNewConnectOnStartup,
|
CLlconClientDlg ( CClient* pNCliP,
|
||||||
const bool bNewDisalbeLEDs,
|
const bool bNewConnectOnStartup,
|
||||||
QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
const bool bNewDisalbeLEDs,
|
||||||
|
QWidget* parent = 0,
|
||||||
|
Qt::WindowFlags f = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
void SetGUIDesign ( const EGUIDesign eNewDesign );
|
||||||
|
|
Loading…
Reference in a new issue