added new command line argument for connecting on startup, fix for window title buttons on Ubuntu

This commit is contained in:
Volker Fischer 2009-05-26 20:01:23 +00:00
parent 280f0091f3
commit c49434e3b6
3 changed files with 52 additions and 7 deletions

View file

@ -26,11 +26,22 @@
/* Implementation *************************************************************/
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
Qt::WindowFlags f ) :
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
const bool bNewConnectOnStartup,
QWidget* parent, Qt::WindowFlags f ) :
pClient ( pNCliP ), QDialog ( parent, f ),
ClientSettingsDlg ( pNCliP, parent, Qt::WindowMinMaxButtonsHint ),
ChatDlg ( parent, Qt::WindowMinMaxButtonsHint )
ClientSettingsDlg ( pNCliP, parent
#ifdef _WIN32
// this somehow only works reliable on Windows
, Qt::WindowMinMaxButtonsHint
#endif
),
ChatDlg ( parent
#ifdef _WIN32
// this somehow only works reliable on Windows
, Qt::WindowMinMaxButtonsHint
#endif
)
{
setupUi ( this );
@ -143,6 +154,16 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
}
// connect on startup ---
if ( bNewConnectOnStartup )
{
// since the software starts up right now, the previous state was
// "not connected" so that a call to "OnConnectDisconBut()" will
// start the connection
OnConnectDisconBut();
}
// Settings menu ----------------------------------------------------------
pSettingsMenu = new QMenu ( "&View", this );
pSettingsMenu->addAction ( tr ( "&Chat..." ), this,

View file

@ -66,8 +66,8 @@ class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
Q_OBJECT
public:
CLlconClientDlg ( CClient* pNCliP, QWidget* parent = 0,
Qt::WindowFlags f = 0 );
CLlconClientDlg ( CClient* pNCliP, const bool bNewConnectOnStartup,
QWidget* parent = 0, Qt::WindowFlags f = 0 );
virtual ~CLlconClientDlg();
protected:

View file

@ -52,6 +52,7 @@ int main ( int argc, char** argv )
// check if server or client application shall be started
bool bIsClient = true;
bool bUseGUI = true;
bool bConnectOnStartup = false;
int iUploadRateLimitKbps = DEF_MAX_UPLOAD_RATE_KBPS;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
std::string strIniFileName = "";
@ -72,6 +73,7 @@ int main ( int argc, char** argv )
continue;
}
// use GUI flag --------------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-n", "--nogui" ) )
{
@ -80,6 +82,7 @@ int main ( int argc, char** argv )
continue;
}
// use logging ---------------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-l", "--log", strArgument ) )
{
@ -88,6 +91,7 @@ int main ( int argc, char** argv )
continue;
}
// force low upload data rate flag -------------------------------------
if ( GetNumericArgument ( argc, argv, i, "-u", "--maxuploadrate",
100, 1000000, rDbleArgument ) )
@ -98,6 +102,7 @@ int main ( int argc, char** argv )
continue;
}
// port number ---------------------------------------------------------
if ( GetNumericArgument ( argc, argv, i, "-p", "--port",
0, 65535, rDbleArgument ) )
@ -107,6 +112,7 @@ int main ( int argc, char** argv )
continue;
}
// HTML status file ----------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-m", "--htmlstatus", strArgument ) )
{
@ -122,6 +128,7 @@ int main ( int argc, char** argv )
continue;
}
// initialization file -------------------------------------------------
if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) )
{
@ -130,6 +137,16 @@ int main ( int argc, char** argv )
continue;
}
// connect on startup --------------------------------------------------
if ( GetFlagArgument ( argc, argv, i, "-c", "--connect" ) )
{
bConnectOnStartup = true;
cout << "connect on startup enabled" << std::endl;
continue;
}
// help (usage) flag ---------------------------------------------------
if ( ( !strcmp ( argv[i], "--help" ) ) ||
( !strcmp ( argv[i], "-h" ) ) || ( !strcmp ( argv[i], "-?" ) ) )
@ -182,7 +199,13 @@ int main ( int argc, char** argv )
// GUI object
CLlconClientDlg ClientDlg (
&Client, 0, Qt::WindowMinMaxButtonsHint );
&Client, bConnectOnStartup,
0
#ifdef _WIN32
// this somehow only works reliable on Windows
, Qt::WindowMinMaxButtonsHint
#endif
);
// set main window
pMainWindow = &ClientDlg;
@ -269,6 +292,7 @@ std::string UsageArguments ( char **argv )
" -p, --port local port number (only avaiable for server)\n"
" -m, --htmlstatus enable HTML status file, set file name (only avaiable for server)\n"
" -u, --maxuploadrate maximum upload rate (only avaiable for server)\n"
" -c, --connect connect to last server on startup (only available for client)\n"
" -h, -?, --help this help text\n"
"Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n";
}