add name for server in HTML status file
This commit is contained in:
parent
9d3793d0d8
commit
74d838999d
3 changed files with 25 additions and 5 deletions
12
src/main.cpp
12
src/main.cpp
|
@ -49,6 +49,7 @@ int main ( int argc, char** argv )
|
|||
quint16 iPortNumber = LLCON_PORT_NUMBER;
|
||||
std::string strIniFileName = "";
|
||||
std::string strHTMLStatusFileName = "";
|
||||
std::string strServerName = "";
|
||||
|
||||
/* QT docu: argv()[0] is the program name, argv()[1] is the first
|
||||
argument and argv()[argc()-1] is the last argument.
|
||||
|
@ -96,6 +97,13 @@ int main ( int argc, char** argv )
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( GetStringArgument ( argc, argv, i, "-a", "--servername", strArgument ) )
|
||||
{
|
||||
strServerName = strArgument;
|
||||
cerr << "server name for HTML status file: " << strServerName << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Initialization file ---------------------------------------------------- */
|
||||
if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) )
|
||||
{
|
||||
|
@ -168,7 +176,9 @@ int main ( int argc, char** argv )
|
|||
|
||||
// TODO use QString
|
||||
|
||||
CServer Server ( bUseServerLogging, iPortNumber, strHTMLStatusFileName.c_str() );
|
||||
CServer Server ( bUseServerLogging, iPortNumber,
|
||||
strHTMLStatusFileName.c_str(),
|
||||
strServerName.c_str() );
|
||||
|
||||
if ( bUseGUI )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
/* Implementation *************************************************************/
|
||||
CServer::CServer ( const bool bUseLogging, const quint16 iPortNumber,
|
||||
const QString& strHTMLStatusFileName ) :
|
||||
const QString& strHTMLStatusFileName,
|
||||
const QString& strServerNameForHTMLStatusFile ) :
|
||||
Socket ( &ChannelSet, this, iPortNumber )
|
||||
{
|
||||
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
|
||||
|
@ -59,11 +60,19 @@ CServer::CServer ( const bool bUseLogging, const quint16 iPortNumber,
|
|||
// HTML status file writing
|
||||
if ( !strHTMLStatusFileName.isEmpty() )
|
||||
{
|
||||
// TEST only use port number as the server name right now
|
||||
QString strCurServerNameForHTMLStatusFile = strServerNameForHTMLStatusFile;
|
||||
|
||||
// if server name is empty, substitude a default name
|
||||
if ( strCurServerNameForHTMLStatusFile.isEmpty() )
|
||||
{
|
||||
strCurServerNameForHTMLStatusFile = "[server address]";
|
||||
}
|
||||
|
||||
// (the static cast to integer of the port number is required so that it
|
||||
// works correctly under Linux)
|
||||
ChannelSet.StartStatusHTMLFileWriting ( strHTMLStatusFileName,
|
||||
"[server address]:" + QString().number( static_cast<int> ( iPortNumber ) ) );
|
||||
strCurServerNameForHTMLStatusFile + ":" +
|
||||
QString().number( static_cast<int> ( iPortNumber ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class CServer : public QObject
|
|||
|
||||
public:
|
||||
CServer ( const bool bUseLogging, const quint16 iPortNumber,
|
||||
const QString& strHTMLStatusFileName );
|
||||
const QString& strHTMLStatusFileName,
|
||||
const QString& strServerNameForHTMLStatusFile );
|
||||
virtual ~CServer() {}
|
||||
|
||||
void Start();
|
||||
|
|
Loading…
Reference in a new issue