2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
2011-02-22 19:56:52 +01:00
|
|
|
* Copyright (c) 2004-2011
|
2006-12-18 15:39:33 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
2008-03-28 22:46:13 +01:00
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
2006-12-18 15:39:33 +01:00
|
|
|
* version.
|
|
|
|
*
|
2008-03-28 22:46:13 +01:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2006-12-18 15:39:33 +01:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2008-03-28 22:46:13 +01:00
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
2006-12-18 15:39:33 +01:00
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
2008-03-28 22:46:13 +01:00
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2006-12-18 15:39:33 +01:00
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
|
|
|
#include "llconserverdlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
2011-05-01 21:33:29 +02:00
|
|
|
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP,
|
|
|
|
QWidget* parent,
|
|
|
|
Qt::WindowFlags f )
|
2011-05-06 22:18:20 +02:00
|
|
|
: QDialog ( parent, f ),
|
|
|
|
pServer ( pNServP ),
|
|
|
|
BitmapSystemTrayInactive ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreyArrow.png" ) ),
|
|
|
|
BitmapSystemTrayActive ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreenArrow.png" ) )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2008-01-22 20:58:53 +01:00
|
|
|
setupUi ( this );
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
|
2011-05-01 21:33:29 +02:00
|
|
|
// 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" ) );
|
2011-04-30 21:51:49 +02:00
|
|
|
|
|
|
|
|
2011-05-06 22:18:20 +02:00
|
|
|
// check if system tray icon can be used
|
|
|
|
bSystemTrayIconAvaialbe = SystemTrayIcon.isSystemTrayAvailable();
|
|
|
|
|
|
|
|
// init system tray icon
|
|
|
|
if ( bSystemTrayIconAvaialbe )
|
|
|
|
{
|
|
|
|
// prepare context menu to be added to the system tray icon
|
|
|
|
pSystemTrayIconMenu = new QMenu ( this );
|
|
|
|
|
|
|
|
pSystemTrayIconMenu->addAction ( tr ( "E&xit" ),
|
|
|
|
this, SLOT ( OnSysTrayMenuExit() ) );
|
|
|
|
|
|
|
|
pSystemTrayIconMenu->addSeparator();
|
|
|
|
|
|
|
|
pSystemTrayIconMenu->setDefaultAction ( pSystemTrayIconMenu->addAction (
|
|
|
|
tr ( "&Open " ) + APP_NAME + tr ( " server" ),
|
|
|
|
this, SLOT ( OnSysTrayMenuOpen() ) ) );
|
|
|
|
|
|
|
|
SystemTrayIcon.setContextMenu ( pSystemTrayIconMenu );
|
|
|
|
|
|
|
|
// show icon of state "inactive"
|
|
|
|
SystemTrayIcon.setIcon ( QIcon ( BitmapSystemTrayInactive ) );
|
|
|
|
SystemTrayIcon.show();
|
|
|
|
}
|
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// set text for version and application name
|
2006-12-29 11:52:25 +01:00
|
|
|
TextLabelNameVersion->setText ( QString ( APP_NAME ) +
|
|
|
|
tr ( " server " ) + QString ( VERSION ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-15 23:54:04 +01:00
|
|
|
// set up list view for connected clients
|
2006-12-29 11:52:25 +01:00
|
|
|
ListViewClients->setColumnWidth ( 0, 170 );
|
2009-03-10 11:47:55 +01:00
|
|
|
ListViewClients->setColumnWidth ( 1, 130 );
|
2011-04-14 21:40:12 +02:00
|
|
|
ListViewClients->setColumnWidth ( 2, 60 );
|
2006-12-18 15:39:33 +01:00
|
|
|
ListViewClients->clear();
|
|
|
|
|
2009-03-01 12:17:35 +01:00
|
|
|
// insert items in reverse order because in Windows all of them are
|
|
|
|
// always visible -> put first item on the top
|
|
|
|
vecpListViewItems.Init ( USED_NUM_CHANNELS );
|
|
|
|
for ( int i = USED_NUM_CHANNELS - 1; i >= 0; i-- )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
vecpListViewItems[i] = new CServerListViewItem ( ListViewClients );
|
2008-03-28 22:46:13 +01:00
|
|
|
vecpListViewItems[i]->setHidden ( true );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
2011-04-30 15:01:26 +02:00
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
// update default central server address check box
|
|
|
|
if ( pServer->GetUseDefaultCentralServerAddress() )
|
|
|
|
{
|
|
|
|
cbDefaultCentralServer->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbDefaultCentralServer->setCheckState ( Qt::Unchecked );
|
|
|
|
}
|
|
|
|
|
2011-04-26 22:31:30 +02:00
|
|
|
// update server name line edit
|
|
|
|
LineEditServerName->setText ( pServer->GetServerName() );
|
|
|
|
|
|
|
|
// update server city line edit
|
|
|
|
LineEditLocationCity->setText ( pServer->GetServerCity() );
|
|
|
|
|
|
|
|
// load country combo box with all available countries
|
|
|
|
ComboBoxLocationCountry->setInsertPolicy ( QComboBox::NoInsert );
|
|
|
|
ComboBoxLocationCountry->clear();
|
|
|
|
|
|
|
|
for ( int iCurCntry = static_cast<int> ( QLocale::AnyCountry );
|
|
|
|
iCurCntry < static_cast<int> ( QLocale::LastCountry ); iCurCntry++ )
|
|
|
|
{
|
|
|
|
// add all countries except of the "Default" country
|
|
|
|
if ( static_cast<QLocale::Country> ( iCurCntry ) != QLocale::AnyCountry )
|
|
|
|
{
|
|
|
|
// store the country enum index together with the string (this is
|
|
|
|
// important since we sort the combo box items later on)
|
|
|
|
ComboBoxLocationCountry->addItem ( QLocale::countryToString (
|
|
|
|
static_cast<QLocale::Country> ( iCurCntry ) ), iCurCntry );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sort country combo box items in alphabetical order
|
|
|
|
ComboBoxLocationCountry->model()->sort ( 0, Qt::AscendingOrder );
|
|
|
|
|
|
|
|
// select current country
|
|
|
|
ComboBoxLocationCountry->setCurrentIndex (
|
|
|
|
ComboBoxLocationCountry->findData (
|
|
|
|
static_cast<int> ( pServer->GetServerCountry() ) ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2011-04-30 15:01:26 +02:00
|
|
|
// update register server check box
|
2011-04-30 21:51:49 +02:00
|
|
|
if ( pServer->GetServerListEnabled() )
|
2011-04-30 18:04:22 +02:00
|
|
|
{
|
|
|
|
cbRegisterServer->setCheckState ( Qt::Checked );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cbRegisterServer->setCheckState ( Qt::Unchecked );
|
2011-04-30 15:01:26 +02:00
|
|
|
}
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
// update GUI dependencies
|
|
|
|
UpdateGUIDependencies();
|
2011-04-30 18:04:22 +02:00
|
|
|
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Main menu bar -----------------------------------------------------------
|
2007-09-08 12:45:14 +02:00
|
|
|
pMenu = new QMenuBar ( this );
|
2008-01-15 23:54:04 +01:00
|
|
|
pMenu->addMenu ( new CLlconHelpMenu ( this ) );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2008-01-15 23:54:04 +01:00
|
|
|
// Now tell the layout about the menu
|
|
|
|
layout()->setMenuBar ( pMenu );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Connections -------------------------------------------------------------
|
2011-04-30 15:01:26 +02:00
|
|
|
// check boxes
|
2011-04-30 18:04:22 +02:00
|
|
|
QObject::connect ( cbRegisterServer, SIGNAL ( stateChanged ( int ) ),
|
2011-04-30 15:01:26 +02:00
|
|
|
this, SLOT ( OnRegisterServerStateChanged ( int ) ) );
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
QObject::connect ( cbDefaultCentralServer, SIGNAL ( stateChanged ( int ) ),
|
|
|
|
this, SLOT ( OnDefaultCentralServerStateChanged ( int ) ) );
|
|
|
|
|
2011-04-30 18:04:22 +02:00
|
|
|
// line edits
|
|
|
|
QObject::connect ( LineEditCentralServerAddress,
|
2011-04-30 21:51:49 +02:00
|
|
|
SIGNAL ( editingFinished() ),
|
|
|
|
this, SLOT ( OnLineEditCentralServerAddressEditingFinished() ) );
|
2011-04-30 15:01:26 +02:00
|
|
|
|
2011-04-30 18:04:22 +02:00
|
|
|
QObject::connect ( LineEditServerName, SIGNAL ( textChanged ( const QString& ) ),
|
2011-04-30 15:01:26 +02:00
|
|
|
this, SLOT ( OnLineEditServerNameTextChanged ( const QString& ) ) );
|
|
|
|
|
2011-04-30 18:04:22 +02:00
|
|
|
QObject::connect ( LineEditLocationCity, SIGNAL ( textChanged ( const QString& ) ),
|
2011-04-30 15:01:26 +02:00
|
|
|
this, SLOT ( OnLineEditLocationCityTextChanged ( const QString& ) ) );
|
|
|
|
|
2011-04-30 18:04:22 +02:00
|
|
|
// combo boxes
|
|
|
|
QObject::connect ( ComboBoxLocationCountry, SIGNAL ( activated ( int ) ),
|
2011-04-30 15:01:26 +02:00
|
|
|
this, SLOT ( OnComboBoxLocationCountryActivated ( int ) ) );
|
|
|
|
|
2008-01-15 23:54:04 +01:00
|
|
|
// timers
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2011-05-07 13:46:02 +02:00
|
|
|
// other
|
|
|
|
QObject::connect ( pServer, SIGNAL ( Started() ),
|
2011-05-06 22:18:20 +02:00
|
|
|
this, SLOT ( OnServerStarted() ) );
|
2011-05-07 13:46:02 +02:00
|
|
|
|
|
|
|
QObject::connect ( pServer, SIGNAL ( Stopped() ),
|
2011-05-06 22:18:20 +02:00
|
|
|
this, SLOT ( OnServerStopped() ) );
|
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Timers ------------------------------------------------------------------
|
2008-01-15 23:54:04 +01:00
|
|
|
// start timer for GUI controls
|
2007-09-08 12:45:14 +02:00
|
|
|
Timer.start ( GUI_CONTRL_UPDATE_TIME );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
void CLlconServerDlg::OnDefaultCentralServerStateChanged ( int value )
|
2011-04-30 15:01:26 +02:00
|
|
|
{
|
2011-04-30 21:51:49 +02:00
|
|
|
// apply new setting to the server and update it
|
|
|
|
pServer->SetUseDefaultCentralServerAddress ( value == Qt::Checked );
|
|
|
|
pServer->UpdateServerList();
|
2011-04-30 15:01:26 +02:00
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
// update GUI dependencies
|
|
|
|
UpdateGUIDependencies();
|
|
|
|
}
|
2011-04-30 15:01:26 +02:00
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
void CLlconServerDlg::OnRegisterServerStateChanged ( int value )
|
|
|
|
{
|
2011-05-04 09:15:50 +02:00
|
|
|
const bool bRegState = ( value == Qt::Checked );
|
|
|
|
|
2011-04-30 15:01:26 +02:00
|
|
|
// apply new setting to the server and update it
|
2011-05-04 09:15:50 +02:00
|
|
|
pServer->SetServerListEnabled ( bRegState );
|
|
|
|
|
|
|
|
// If registering is enabled, update data. If registering is disabled,
|
|
|
|
// unregister slave server
|
|
|
|
if ( bRegState )
|
|
|
|
{
|
|
|
|
pServer->UpdateServerList();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pServer->UnregisterSlaveServer();
|
|
|
|
}
|
2011-04-30 21:51:49 +02:00
|
|
|
|
|
|
|
// update GUI dependencies
|
|
|
|
UpdateGUIDependencies();
|
2011-04-30 15:01:26 +02:00
|
|
|
}
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
void CLlconServerDlg::OnLineEditCentralServerAddressEditingFinished()
|
2011-04-30 15:01:26 +02:00
|
|
|
{
|
|
|
|
// apply new setting to the server and update it
|
2011-04-30 21:51:49 +02:00
|
|
|
pServer->SetServerListCentralServerAddress (
|
|
|
|
LineEditCentralServerAddress->text() );
|
2011-04-30 18:04:22 +02:00
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
pServer->UpdateServerList();
|
2011-04-30 15:01:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconServerDlg::OnLineEditServerNameTextChanged ( const QString& strNewName )
|
|
|
|
{
|
2011-04-30 21:51:49 +02:00
|
|
|
// check length
|
|
|
|
if ( strNewName.length() <= MAX_LEN_SERVER_NAME )
|
|
|
|
{
|
2011-04-30 18:04:22 +02:00
|
|
|
// apply new setting to the server and update it
|
|
|
|
pServer->SetServerName ( strNewName );
|
|
|
|
pServer->UpdateServerList();
|
2011-04-30 21:51:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// text is too long, update control with shortend text
|
|
|
|
LineEditServerName->setText ( strNewName.left ( MAX_LEN_SERVER_NAME ) );
|
2011-04-30 18:04:22 +02:00
|
|
|
}
|
2011-04-30 15:01:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconServerDlg::OnLineEditLocationCityTextChanged ( const QString& strNewCity )
|
|
|
|
{
|
2011-04-30 21:51:49 +02:00
|
|
|
// check length
|
|
|
|
if ( strNewCity.length() <= MAX_LEN_SERVER_CITY )
|
|
|
|
{
|
2011-04-30 18:04:22 +02:00
|
|
|
// apply new setting to the server and update it
|
|
|
|
pServer->SetServerCity ( strNewCity );
|
|
|
|
pServer->UpdateServerList();
|
2011-04-30 21:51:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// text is too long, update control with shortend text
|
|
|
|
LineEditLocationCity->setText ( strNewCity.left ( MAX_LEN_SERVER_CITY ) );
|
2011-04-30 18:04:22 +02:00
|
|
|
}
|
2011-04-30 15:01:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconServerDlg::OnComboBoxLocationCountryActivated ( int iCntryListItem )
|
|
|
|
{
|
|
|
|
// apply new setting to the server and update it
|
|
|
|
pServer->SetServerCountry ( static_cast<QLocale::Country> (
|
|
|
|
ComboBoxLocationCountry->itemData ( iCntryListItem ).toInt() ) );
|
|
|
|
|
|
|
|
pServer->UpdateServerList();
|
|
|
|
}
|
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
void CLlconServerDlg::OnTimer()
|
|
|
|
{
|
2009-08-11 11:10:23 +02:00
|
|
|
CVector<CHostAddress> vecHostAddresses;
|
|
|
|
CVector<QString> vecsName;
|
|
|
|
CVector<int> veciJitBufNumFrames;
|
|
|
|
CVector<int> veciNetwFrameSizeFact;
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
ListViewMutex.lock();
|
|
|
|
{
|
2011-04-14 21:40:12 +02:00
|
|
|
pServer->GetConCliParam ( vecHostAddresses,
|
|
|
|
vecsName,
|
|
|
|
veciJitBufNumFrames,
|
|
|
|
veciNetwFrameSizeFact );
|
2006-09-16 13:26:15 +02:00
|
|
|
|
2011-04-14 21:40:12 +02:00
|
|
|
// fill list with connected clients
|
|
|
|
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
|
2006-11-25 15:46:57 +01:00
|
|
|
{
|
2011-04-14 21:40:12 +02:00
|
|
|
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
|
|
|
|
{
|
|
|
|
// IP, port number
|
2011-05-05 22:54:04 +02:00
|
|
|
vecpListViewItems[i]->setText ( 0,
|
|
|
|
vecHostAddresses[i].toString ( CHostAddress::SM_IP_PORT ) );
|
2011-04-14 21:40:12 +02:00
|
|
|
|
|
|
|
// name
|
|
|
|
vecpListViewItems[i]->setText ( 1, vecsName[i] );
|
|
|
|
|
|
|
|
// jitter buffer size (polling for updates)
|
|
|
|
vecpListViewItems[i]->setText ( 3,
|
|
|
|
QString().setNum ( veciJitBufNumFrames[i] ) );
|
|
|
|
|
|
|
|
// out network block size
|
|
|
|
vecpListViewItems[i]->setText ( 4,
|
|
|
|
QString().setNum ( static_cast<double> (
|
|
|
|
veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT
|
|
|
|
), 'f', 2 ) );
|
|
|
|
|
|
|
|
vecpListViewItems[i]->setHidden ( false );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vecpListViewItems[i]->setHidden ( true );
|
|
|
|
}
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
ListViewMutex.unlock();
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-30 21:51:49 +02:00
|
|
|
void CLlconServerDlg::UpdateGUIDependencies()
|
2011-04-30 18:04:22 +02:00
|
|
|
{
|
2011-04-30 21:51:49 +02:00
|
|
|
// get the states which define the GUI dependencies from the server
|
|
|
|
const bool bCurSerListEnabled = pServer->GetServerListEnabled();
|
|
|
|
|
|
|
|
const bool bCurUseDefCentServAddr =
|
|
|
|
pServer->GetUseDefaultCentralServerAddress();
|
|
|
|
|
2011-04-30 18:04:22 +02:00
|
|
|
// if register server is not enabled, we disable all the configuration
|
|
|
|
// controls for the server list
|
2011-05-02 21:48:36 +02:00
|
|
|
cbDefaultCentralServer->setEnabled ( bCurSerListEnabled );
|
|
|
|
GroupBoxServerInfo->setEnabled ( bCurSerListEnabled );
|
2011-04-30 21:51:49 +02:00
|
|
|
|
|
|
|
// If the default central server address is enabled, the line edit shows
|
|
|
|
// the default server and is not editable. Make sure the line edit does not
|
|
|
|
// fire signals when we update the text.
|
|
|
|
LineEditCentralServerAddress->blockSignals ( true );
|
|
|
|
{
|
|
|
|
if ( bCurUseDefCentServAddr )
|
|
|
|
{
|
|
|
|
LineEditCentralServerAddress->setText ( DEFAULT_SERVER_ADDRESS );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LineEditCentralServerAddress->setText (
|
|
|
|
pServer->GetServerListCentralServerAddress() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LineEditCentralServerAddress->blockSignals ( false );
|
|
|
|
|
|
|
|
// the line edit of the central server address is only enabled, if the
|
|
|
|
// server list is enabled and not the default address is used
|
|
|
|
LineEditCentralServerAddress->setEnabled (
|
|
|
|
!bCurUseDefCentServAddr && bCurSerListEnabled );
|
2011-04-30 18:04:22 +02:00
|
|
|
}
|
|
|
|
|
2011-05-06 22:18:20 +02:00
|
|
|
void CLlconServerDlg::UpdateSystemTrayIcon ( const bool bIsActive )
|
|
|
|
{
|
|
|
|
if ( bSystemTrayIconAvaialbe )
|
|
|
|
{
|
|
|
|
if ( bIsActive )
|
|
|
|
{
|
|
|
|
SystemTrayIcon.setIcon ( QIcon ( BitmapSystemTrayActive ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SystemTrayIcon.setIcon ( QIcon ( BitmapSystemTrayInactive ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconServerDlg::hideEvent ( QHideEvent* )
|
|
|
|
{
|
|
|
|
// TODO seems not to work correctly...
|
|
|
|
/*
|
|
|
|
// if we have a system tray icon, we make the window invisible if it is
|
|
|
|
// minimized
|
|
|
|
if ( bSystemTrayIconAvaialbe )
|
|
|
|
{
|
|
|
|
setVisible ( false );
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2008-01-15 21:07:55 +01:00
|
|
|
void CLlconServerDlg::customEvent ( QEvent* Event )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
if ( Event->type() == QEvent::User + 11 )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
ListViewMutex.lock();
|
|
|
|
{
|
2011-04-14 21:40:12 +02:00
|
|
|
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
|
|
|
|
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
|
|
|
|
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
|
|
|
|
|
|
|
|
switch(iMessType)
|
|
|
|
{
|
|
|
|
case MS_JIT_BUF_PUT:
|
|
|
|
case MS_JIT_BUF_GET:
|
|
|
|
vecpListViewItems[iChanNum]->SetLight ( iStatus );
|
|
|
|
break;
|
|
|
|
}
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
ListViewMutex.unlock();
|
|
|
|
}
|
|
|
|
}
|