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
|
||||
network conditions
|
||||
|
||||
- support client operation without using a GUI frontend
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
CClient::CClient ( const quint16 iPortNumber ) :
|
||||
CClient::CClient ( const quint16 iPortNumber,
|
||||
const QString& strConnOnStartupAddress ) :
|
||||
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
|
||||
ChannelInfo (),
|
||||
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
|
||||
// initializations and connections)
|
||||
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 )
|
||||
|
|
|
@ -114,7 +114,8 @@ class CClient : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CClient ( const quint16 iPortNumber );
|
||||
CClient ( const quint16 iPortNumber,
|
||||
const QString& strConnOnStartupAddress );
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/* Implementation *************************************************************/
|
||||
CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||
CSettings* pNSetP,
|
||||
const bool bNewConnectOnStartup,
|
||||
const QString& strConnOnStartupAddress,
|
||||
const bool bNewShowComplRegConnList,
|
||||
const bool bShowAnalyzerConsole,
|
||||
QWidget* parent,
|
||||
|
@ -225,19 +225,11 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
|
||||
|
||||
// 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
|
||||
// (no alias))
|
||||
Connect ( strSelectedAddress, strSelectedAddress );
|
||||
}
|
||||
// initiate connection (always show the address in the mixer board
|
||||
// (no alias))
|
||||
Connect ( strConnOnStartupAddress, strConnOnStartupAddress );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1001,7 +993,10 @@ void CClientDlg::Connect ( const QString& strSelectedAddress,
|
|||
// running state but show error message
|
||||
try
|
||||
{
|
||||
pClient->Start();
|
||||
if ( !pClient->IsRunning() )
|
||||
{
|
||||
pClient->Start();
|
||||
}
|
||||
}
|
||||
|
||||
catch ( CGenErr generr )
|
||||
|
|
|
@ -71,7 +71,7 @@ class CClientDlg : public QDialog, private Ui_CClientDlgBase
|
|||
public:
|
||||
CClientDlg ( CClient* pNCliP,
|
||||
CSettings* pNSetP,
|
||||
const bool bNewConnectOnStartup,
|
||||
const QString& strConnOnStartupAddress,
|
||||
const bool bNewShowComplRegConnList,
|
||||
const bool bShowAnalyzerConsole,
|
||||
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 bUseGUI = true;
|
||||
bool bStartMinimized = false;
|
||||
bool bConnectOnStartup = false;
|
||||
bool bShowComplRegConnList = false;
|
||||
bool bShowAnalyzerConsole = false;
|
||||
bool bCentServPingServerInList = false;
|
||||
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
||||
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
|
||||
ELicenceType eLicenceType = LT_NO_LICENCE;
|
||||
QString strConnOnStartupAddress = "";
|
||||
QString strIniFileName = "";
|
||||
QString strHTMLStatusFileName = "";
|
||||
QString strServerName = "";
|
||||
|
@ -324,13 +324,16 @@ int main ( int argc, char** argv )
|
|||
|
||||
|
||||
// Connect on startup --------------------------------------------------
|
||||
if ( GetFlagArgument ( argv,
|
||||
i,
|
||||
"-c",
|
||||
"--connect" ) )
|
||||
if ( GetStringArgument ( tsConsole,
|
||||
argc,
|
||||
argv,
|
||||
i,
|
||||
"-c",
|
||||
"--connect",
|
||||
strArgument ) )
|
||||
{
|
||||
bConnectOnStartup = true;
|
||||
tsConsole << "- connect on startup enabled" << endl;
|
||||
strConnOnStartupAddress = strArgument;
|
||||
tsConsole << "- connect on startup to address: " << strConnOnStartupAddress << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -397,28 +400,39 @@ int main ( int argc, char** argv )
|
|||
{
|
||||
// Client:
|
||||
// actual client object
|
||||
CClient Client ( iPortNumber );
|
||||
CClient Client ( iPortNumber,
|
||||
strConnOnStartupAddress );
|
||||
|
||||
// load settings from init-file
|
||||
CSettings Settings ( &Client, strIniFileName );
|
||||
Settings.Load();
|
||||
|
||||
// GUI object
|
||||
CClientDlg ClientDlg ( &Client,
|
||||
&Settings,
|
||||
bConnectOnStartup,
|
||||
bShowComplRegConnList,
|
||||
bShowAnalyzerConsole,
|
||||
0,
|
||||
Qt::Window );
|
||||
if ( bUseGUI )
|
||||
{
|
||||
// GUI object
|
||||
CClientDlg ClientDlg ( &Client,
|
||||
&Settings,
|
||||
strConnOnStartupAddress,
|
||||
bShowComplRegConnList,
|
||||
bShowAnalyzerConsole,
|
||||
0,
|
||||
Qt::Window );
|
||||
|
||||
// set main window
|
||||
pMainWindow = &ClientDlg;
|
||||
pApp = &app; // Needed for post-event routine
|
||||
// set main window
|
||||
pMainWindow = &ClientDlg;
|
||||
pApp = &app; // needed for post-event routine
|
||||
|
||||
// show dialog
|
||||
ClientDlg.show();
|
||||
app.exec();
|
||||
// show dialog
|
||||
ClientDlg.show();
|
||||
app.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
// only start application without using the GUI
|
||||
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;
|
||||
|
||||
app.exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -514,8 +528,8 @@ QString UsageArguments ( char **argv )
|
|||
"\nRecognized options:\n"
|
||||
" -a, --servername server name, required for HTML status (server\n"
|
||||
" only)\n"
|
||||
" -c, --connect connect to last server on startup (client\n"
|
||||
" only)\n"
|
||||
" -c, --connect connect to given server address on startup\n"
|
||||
" (client only)\n"
|
||||
" -e, --centralserver address of the central server (server only)\n"
|
||||
" -g, --pingservers ping servers in list to keep NAT port open\n"
|
||||
" (central server only)\n"
|
||||
|
|
Loading…
Reference in a new issue