added a command line argument, some code style changes

This commit is contained in:
Volker Fischer 2011-04-05 18:38:22 +00:00
parent 74ac1d075f
commit 36d13454b3
5 changed files with 54 additions and 42 deletions

View File

@ -35,6 +35,7 @@
#include "channel.h"
#include "util.h"
#include "serverlogging.h"
#include "serverlist.h"
/* Definitions ****************************************************************/
@ -106,7 +107,9 @@ public:
const quint16 iPortNumber,
const QString& strHTMLStatusFileName,
const QString& strHistoryFileName,
const QString& strServerNameForHTMLStatusFile );
const QString& strServerNameForHTMLStatusFile,
const bool bIsCentralServer,
const QString& strCentralServer );
void Start();
void Stop();
@ -178,6 +181,9 @@ protected:
CHighPrecisionTimer HighPrecisionTimer;
CVector<short> vecsSendData;
// server list
CServerListManager ServerListManager;
public slots:
void OnTimer();
void OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage );

View File

@ -33,7 +33,7 @@ CServerListManager::CServerListManager ( const bool NbEbld )
// never be deleted
ServerList.clear();
// per definition the client substitudes the IP address of the master server
// per definition the client substitudes the IP address of the central server
// itself for his server list
ServerList.append ( CServerListEntry (
CHostAddress(),
@ -47,10 +47,11 @@ ServerList.append ( CServerListEntry (
// connections -------------------------------------------------------------
// Connections -------------------------------------------------------------
QObject::connect ( &TimerPollList, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPollList() ) );
// Timers ------------------------------------------------------------------
// start timer for polling the server list
if ( bEnabled )
@ -64,7 +65,7 @@ void CServerListManager::OnTimerPollList()
{
QMutexLocker locker ( &Mutex );
// check all list entries except of the very first one (which is the master
// check all list entries except of the very first one (which is the central
// server entry) if they are still valid
for ( int iIdx = 1; iIdx < ServerList.size(); iIdx++ )
{
@ -83,12 +84,15 @@ void CServerListManager::RegisterServer ( const CHostAddress& InetAddr,
{
QMutexLocker locker ( &Mutex );
if ( bEnabled )
{
// define invalid index used as a flag
const int ciInvalidIdx = -1;
// Check if server is already registered. Use IP number and port number to
// fully identify a server. The very first list entry must not be checked
// since this is per definition the master server (i.e., this server)
// Check if server is already registered. Use IP number and port number
// to fully identify a server. The very first list entry must not be
// checked since this is per definition the central server (i.e., this
// server)
int iSelIdx = ciInvalidIdx; // initialize with an illegal value
for ( int iIdx = 1; iIdx < ServerList.size(); iIdx++ )
{
@ -120,4 +124,5 @@ void CServerListManager::RegisterServer ( const CHostAddress& InetAddr,
ServerList[iSelIdx].bPermanentOnline = ServerInfo.bPermanentOnline;
ServerList[iSelIdx].UpdateRegistration();
}
}
}

View File

@ -62,7 +62,8 @@ CHistoryGraph::CHistoryGraph() :
PlotPixmap = PlotPixmap.scaled (
PlotCanvasRect.width(), PlotCanvasRect.height() );
// connections
// Connections -------------------------------------------------------------
QObject::connect ( &TimerDailyUpdate, SIGNAL ( timeout() ),
this, SLOT ( OnTimerDailyUpdate() ) );
}
@ -100,7 +101,7 @@ void CHistoryGraph::DrawFrame ( const int iNewNumTicksX )
QPainter PlotPainter ( &PlotPixmap );
// create actual plot region (grid frame) ----------------------------------
// Create actual plot region (grid frame) ----------------------------------
PlotPainter.setPen ( PlotFrameColor );
PlotPainter.drawRect ( PlotGridFrame );

View File

@ -44,7 +44,7 @@ void CSettings::ReadIniFile ( const QString& sFileName )
}
// actual settings data ---------------------------------------------------
// Actual settings data ---------------------------------------------------
// IP addresses
for ( int iIPAddrIdx = 0; iIPAddrIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIPAddrIdx++ )
{
@ -191,7 +191,7 @@ void CSettings::WriteIniFile ( const QString& sFileName )
QDomDocument IniXMLDocument;
// actual settings data ---------------------------------------------------
// Actual settings data ---------------------------------------------------
// IP addresses
for ( int iIPAddrIdx = 0; iIPAddrIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIPAddrIdx++ )
{