support client operation without using a GUI frontend
This commit is contained in:
parent
79c83a4c13
commit
a46ea26cd8
6 changed files with 60 additions and 41 deletions
|
@ -3,6 +3,7 @@
|
||||||
- another improvement of auto jitter buffer detection in very bad
|
- another improvement of auto jitter buffer detection in very bad
|
||||||
network conditions
|
network conditions
|
||||||
|
|
||||||
|
- support client operation without using a GUI frontend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CClient::CClient ( const quint16 iPortNumber ) :
|
CClient::CClient ( const quint16 iPortNumber,
|
||||||
|
const QString& strConnOnStartupAddress ) :
|
||||||
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
|
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
|
||||||
ChannelInfo (),
|
ChannelInfo (),
|
||||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
|
||||||
|
@ -227,6 +228,13 @@ QObject::connect ( &Channel, SIGNAL ( OpusSupported() ),
|
||||||
// start the socket (it is important to start the socket after all
|
// start the socket (it is important to start the socket after all
|
||||||
// initializations and connections)
|
// initializations and connections)
|
||||||
Socket.Start();
|
Socket.Start();
|
||||||
|
|
||||||
|
// do an immediate start if a server address is given
|
||||||
|
if ( !strConnOnStartupAddress.isEmpty() )
|
||||||
|
{
|
||||||
|
SetServerAddr ( strConnOnStartupAddress );
|
||||||
|
Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::OnSendProtMessage ( CVector<uint8_t> vecMessage )
|
void CClient::OnSendProtMessage ( CVector<uint8_t> vecMessage )
|
||||||
|
|
|
@ -114,7 +114,8 @@ class CClient : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CClient ( const quint16 iPortNumber );
|
CClient ( const quint16 iPortNumber,
|
||||||
|
const QString& strConnOnStartupAddress );
|
||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CClientDlg::CClientDlg ( CClient* pNCliP,
|
CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
CSettings* pNSetP,
|
CSettings* pNSetP,
|
||||||
const bool bNewConnectOnStartup,
|
const QString& strConnOnStartupAddress,
|
||||||
const bool bNewShowComplRegConnList,
|
const bool bNewShowComplRegConnList,
|
||||||
const bool bShowAnalyzerConsole,
|
const bool bShowAnalyzerConsole,
|
||||||
QWidget* parent,
|
QWidget* parent,
|
||||||
|
@ -225,19 +225,11 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
|
|
||||||
|
|
||||||
// Connect on startup ------------------------------------------------------
|
// Connect on startup ------------------------------------------------------
|
||||||
if ( bNewConnectOnStartup )
|
if ( !strConnOnStartupAddress.isEmpty() )
|
||||||
{
|
|
||||||
// per definition use the last connection (first entry in the
|
|
||||||
// stored address list)
|
|
||||||
const QString strSelectedAddress = pClient->vstrIPAddress[0];
|
|
||||||
|
|
||||||
// only if address is not empty, start the client
|
|
||||||
if ( !strSelectedAddress.isEmpty() )
|
|
||||||
{
|
{
|
||||||
// initiate connection (always show the address in the mixer board
|
// initiate connection (always show the address in the mixer board
|
||||||
// (no alias))
|
// (no alias))
|
||||||
Connect ( strSelectedAddress, strSelectedAddress );
|
Connect ( strConnOnStartupAddress, strConnOnStartupAddress );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1000,9 +992,12 @@ void CClientDlg::Connect ( const QString& strSelectedAddress,
|
||||||
// try to start client, if error occurred, do not go in
|
// try to start client, if error occurred, do not go in
|
||||||
// running state but show error message
|
// running state but show error message
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if ( !pClient->IsRunning() )
|
||||||
{
|
{
|
||||||
pClient->Start();
|
pClient->Start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
catch ( CGenErr generr )
|
catch ( CGenErr generr )
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ class CClientDlg : public QDialog, private Ui_CClientDlgBase
|
||||||
public:
|
public:
|
||||||
CClientDlg ( CClient* pNCliP,
|
CClientDlg ( CClient* pNCliP,
|
||||||
CSettings* pNSetP,
|
CSettings* pNSetP,
|
||||||
const bool bNewConnectOnStartup,
|
const QString& strConnOnStartupAddress,
|
||||||
const bool bNewShowComplRegConnList,
|
const bool bNewShowComplRegConnList,
|
||||||
const bool bShowAnalyzerConsole,
|
const bool bShowAnalyzerConsole,
|
||||||
QWidget* parent = 0,
|
QWidget* parent = 0,
|
||||||
|
|
34
src/main.cpp
34
src/main.cpp
|
@ -56,13 +56,13 @@ int main ( int argc, char** argv )
|
||||||
bool bIsClient = true;
|
bool bIsClient = true;
|
||||||
bool bUseGUI = true;
|
bool bUseGUI = true;
|
||||||
bool bStartMinimized = false;
|
bool bStartMinimized = false;
|
||||||
bool bConnectOnStartup = false;
|
|
||||||
bool bShowComplRegConnList = false;
|
bool bShowComplRegConnList = false;
|
||||||
bool bShowAnalyzerConsole = false;
|
bool bShowAnalyzerConsole = false;
|
||||||
bool bCentServPingServerInList = false;
|
bool bCentServPingServerInList = false;
|
||||||
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
||||||
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
||||||
ELicenceType eLicenceType = LT_NO_LICENCE;
|
ELicenceType eLicenceType = LT_NO_LICENCE;
|
||||||
|
QString strConnOnStartupAddress = "";
|
||||||
QString strIniFileName = "";
|
QString strIniFileName = "";
|
||||||
QString strHTMLStatusFileName = "";
|
QString strHTMLStatusFileName = "";
|
||||||
QString strServerName = "";
|
QString strServerName = "";
|
||||||
|
@ -324,13 +324,16 @@ int main ( int argc, char** argv )
|
||||||
|
|
||||||
|
|
||||||
// Connect on startup --------------------------------------------------
|
// Connect on startup --------------------------------------------------
|
||||||
if ( GetFlagArgument ( argv,
|
if ( GetStringArgument ( tsConsole,
|
||||||
|
argc,
|
||||||
|
argv,
|
||||||
i,
|
i,
|
||||||
"-c",
|
"-c",
|
||||||
"--connect" ) )
|
"--connect",
|
||||||
|
strArgument ) )
|
||||||
{
|
{
|
||||||
bConnectOnStartup = true;
|
strConnOnStartupAddress = strArgument;
|
||||||
tsConsole << "- connect on startup enabled" << endl;
|
tsConsole << "- connect on startup to address: " << strConnOnStartupAddress << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,16 +400,19 @@ int main ( int argc, char** argv )
|
||||||
{
|
{
|
||||||
// Client:
|
// Client:
|
||||||
// actual client object
|
// actual client object
|
||||||
CClient Client ( iPortNumber );
|
CClient Client ( iPortNumber,
|
||||||
|
strConnOnStartupAddress );
|
||||||
|
|
||||||
// load settings from init-file
|
// load settings from init-file
|
||||||
CSettings Settings ( &Client, strIniFileName );
|
CSettings Settings ( &Client, strIniFileName );
|
||||||
Settings.Load();
|
Settings.Load();
|
||||||
|
|
||||||
|
if ( bUseGUI )
|
||||||
|
{
|
||||||
// GUI object
|
// GUI object
|
||||||
CClientDlg ClientDlg ( &Client,
|
CClientDlg ClientDlg ( &Client,
|
||||||
&Settings,
|
&Settings,
|
||||||
bConnectOnStartup,
|
strConnOnStartupAddress,
|
||||||
bShowComplRegConnList,
|
bShowComplRegConnList,
|
||||||
bShowAnalyzerConsole,
|
bShowAnalyzerConsole,
|
||||||
0,
|
0,
|
||||||
|
@ -414,13 +420,21 @@ int main ( int argc, char** argv )
|
||||||
|
|
||||||
// set main window
|
// set main window
|
||||||
pMainWindow = &ClientDlg;
|
pMainWindow = &ClientDlg;
|
||||||
pApp = &app; // Needed for post-event routine
|
pApp = &app; // needed for post-event routine
|
||||||
|
|
||||||
// show dialog
|
// show dialog
|
||||||
ClientDlg.show();
|
ClientDlg.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// only start application without using the GUI
|
||||||
|
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;
|
||||||
|
|
||||||
|
app.exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Server:
|
// Server:
|
||||||
// actual server object
|
// actual server object
|
||||||
|
@ -514,8 +528,8 @@ QString UsageArguments ( char **argv )
|
||||||
"\nRecognized options:\n"
|
"\nRecognized options:\n"
|
||||||
" -a, --servername server name, required for HTML status (server\n"
|
" -a, --servername server name, required for HTML status (server\n"
|
||||||
" only)\n"
|
" only)\n"
|
||||||
" -c, --connect connect to last server on startup (client\n"
|
" -c, --connect connect to given server address on startup\n"
|
||||||
" only)\n"
|
" (client only)\n"
|
||||||
" -e, --centralserver address of the central server (server only)\n"
|
" -e, --centralserver address of the central server (server only)\n"
|
||||||
" -g, --pingservers ping servers in list to keep NAT port open\n"
|
" -g, --pingservers ping servers in list to keep NAT port open\n"
|
||||||
" (central server only)\n"
|
" (central server only)\n"
|
||||||
|
|
Loading…
Reference in a new issue