提交 5f07525d 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Add a commandline auto start action, perpared for batch server forking.

上级 d7dc24bd
...@@ -20,15 +20,37 @@ int main(int argc, char *argv[]) ...@@ -20,15 +20,37 @@ int main(int argc, char *argv[])
app.installTranslator(&appTranslator); app.installTranslator(&appTranslator);
ZPMainFrame w; ZPMainFrame w;
//Command Line Args
//!the main program arg formats:
/*! ZoomPipeline_FuncSvr [[options] <config file name> [options]]
* When start with no commandline arguments, the server will enter a dialog-controlled UI model.
* If the commandline args has been specified, this server will enter an aut-config and start model.
* Cmdline formats:
* --ui (default) the program will start with an UI
* --noui the program will start without an UI
* config file has a same format with UI-Saved ini file. this file name should be surrounded with ""
* if there are spaces in filename.
*/
//Command Line Args, support batch auto-config and auto start.
if (argc>1) if (argc>1)
{ {
bool bHasUI = false;
QString configfile;
for (int i=1;i < argc;++i)
{
QString strArg = argv[i];
if (-1!=strArg.indexOf("--ui"))
bHasUI = true;
else if (-1!=strArg.indexOf("--noui"))
;
else
{
configfile = strArg;
}
}
w.LoadSettingsAndForkServer(configfile);
} }
else
{
}
w.show(); w.show();
int pp = app.exec(); int pp = app.exec();
return pp; return pp;
......
...@@ -864,3 +864,14 @@ void ZPMainFrame::on_pushButton_join_clicked() ...@@ -864,3 +864,14 @@ void ZPMainFrame::on_pushButton_join_clicked()
m_pClusterTerm->JoinCluster(QHostAddress(inputdlg.addr()),inputdlg.port().toInt()); m_pClusterTerm->JoinCluster(QHostAddress(inputdlg.addr()),inputdlg.port().toInt());
} }
} }
void ZPMainFrame::LoadSettingsAndForkServer(const QString & configfile)
{
if (configfile.length()>2)
this->m_currentConffile = configfile;
LoadSettings(m_currentConffile);
if (ui->action_Start_Stop->isChecked()==true)
on_action_Start_Stop_triggered(false);
on_action_Start_Stop_triggered(true);
ui->action_Start_Stop->setChecked(true);
}
...@@ -23,7 +23,8 @@ public: ...@@ -23,7 +23,8 @@ public:
explicit ZPMainFrame(QWidget *parent = 0); explicit ZPMainFrame(QWidget *parent = 0);
~ZPMainFrame(); ~ZPMainFrame();
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *);
//Auto start support
void LoadSettingsAndForkServer(const QString & configfile);
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
QStandardItemModel * m_pMsgModelNetwork; QStandardItemModel * m_pMsgModelNetwork;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册