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
|
// initiate connection (always show the address in the mixer board
|
||||||
// stored address list)
|
// (no alias))
|
||||||
const QString strSelectedAddress = pClient->vstrIPAddress[0];
|
Connect ( strConnOnStartupAddress, strConnOnStartupAddress );
|
||||||
|
|
||||||
// only if address is not empty, start the client
|
|
||||||
if ( !strSelectedAddress.isEmpty() )
|
|
||||||
{
|
|
||||||
// initiate connection (always show the address in the mixer board
|
|
||||||
// (no alias))
|
|
||||||
Connect ( strSelectedAddress, strSelectedAddress );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1001,7 +993,10 @@ void CClientDlg::Connect ( const QString& strSelectedAddress,
|
||||||
// running state but show error message
|
// running state but show error message
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pClient->Start();
|
if ( !pClient->IsRunning() )
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
62
src/main.cpp
62
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,
|
||||||
i,
|
argc,
|
||||||
"-c",
|
argv,
|
||||||
"--connect" ) )
|
i,
|
||||||
|
"-c",
|
||||||
|
"--connect",
|
||||||
|
strArgument ) )
|
||||||
{
|
{
|
||||||
bConnectOnStartup = true;
|
strConnOnStartupAddress = strArgument;
|
||||||
tsConsole << "- connect on startup enabled" << endl;
|
tsConsole << "- connect on startup to address: " << strConnOnStartupAddress << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,28 +400,39 @@ 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();
|
||||||
|
|
||||||
// GUI object
|
if ( bUseGUI )
|
||||||
CClientDlg ClientDlg ( &Client,
|
{
|
||||||
&Settings,
|
// GUI object
|
||||||
bConnectOnStartup,
|
CClientDlg ClientDlg ( &Client,
|
||||||
bShowComplRegConnList,
|
&Settings,
|
||||||
bShowAnalyzerConsole,
|
strConnOnStartupAddress,
|
||||||
0,
|
bShowComplRegConnList,
|
||||||
Qt::Window );
|
bShowAnalyzerConsole,
|
||||||
|
0,
|
||||||
|
Qt::Window );
|
||||||
|
|
||||||
// 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
|
||||||
|
{
|
||||||
|
// only start application without using the GUI
|
||||||
|
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;
|
||||||
|
|
||||||
|
app.exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -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