load stored IP addresses in connect dialog

This commit is contained in:
Volker Fischer 2011-04-22 18:33:40 +00:00
parent f2d4229a88
commit 0dae88285a
3 changed files with 1381 additions and 1368 deletions

View file

@ -53,19 +53,6 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
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
// LineEditServerAddr->addItem ( pClient->vstrIPAddress[iLEIdx] );
}
}
// set up list view for connected clients
ListViewServers->setColumnWidth ( 0, 170 );
ListViewServers->setColumnWidth ( 1, 130 );
@ -91,6 +78,18 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
this, SLOT ( OnTimerReRequestServList() ) );
}
void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddress )
{
// load stored IP addresses in combo box
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
{
if ( !vstrIPAddress[iLEIdx].isEmpty() )
{
LineEditServerAddr->addItem ( vstrIPAddress[iLEIdx] );
}
}
}
void CConnectDlg::showEvent ( QShowEvent* )
{
// reset flag (on opening the connect dialg, we always want to request a new
@ -122,6 +121,17 @@ void CConnectDlg::hideEvent ( QHideEvent* )
// if window is closed, stop timers
TimerPing.stop();
TimerReRequestServList.stop();
// TODO
/*
// store IP addresses
for ( int iLEIdx = 0; iLEIdx < LineEditServerAddr->count(); iLEIdx++ )
{
pClient->vstrIPAddress[iLEIdx] =
LineEditServerAddr->itemText ( iLEIdx );
}
*/
}
void CConnectDlg::OnTimerReRequestServList()

View file

@ -59,6 +59,8 @@ public:
void SetServerList ( const CHostAddress& InetAddr,
const CVector<CServerInfo>& vecServerInfo );
void LoadStoredServers ( const CVector<QString>& vstrIPAddress );
void SetPingTimeResult ( CHostAddress& InetAddr,
const int iPingTime,
const int iPingTimeLEDColor );

View file

@ -456,6 +456,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// TEST
ConnectDlg.LoadStoredServers ( pClient->vstrIPAddress );
ConnectDlg.show();
}