main.cpp 1.6 KB
Newer Older
丁劲犇's avatar
丁劲犇 已提交
1 2
#include "zpmainframe.h"
#include <QApplication>
丁劲犇's avatar
丁劲犇 已提交
3 4
#include <QTranslator>
#include <QLibraryInfo>
丁劲犇's avatar
丁劲犇 已提交
5 6
int main(int argc, char *argv[])
{
丁劲犇's avatar
丁劲犇 已提交
7
	QApplication app(argc, argv);
丁劲犇's avatar
丁劲犇 已提交
8

丁劲犇's avatar
丁劲犇 已提交
9 10 11 12
	QTranslator qtTranslator;
	qtTranslator.load("qt_" + QLocale::system().name(),
					  QLibraryInfo::location(QLibraryInfo::TranslationsPath));
	app.installTranslator(&qtTranslator);
丁劲犇's avatar
丁劲犇 已提交
13

丁劲犇's avatar
丁劲犇 已提交
14 15 16 17 18 19 20
	QTranslator appTranslator;
	QString strTransLocalFile =
			QCoreApplication::applicationDirPath()+"/" +
			QCoreApplication::applicationName()+"_"+
			QLocale::system().name()+".qm";
	appTranslator.load(strTransLocalFile );
	app.installTranslator(&appTranslator);
丁劲犇's avatar
丁劲犇 已提交
21

丁劲犇's avatar
丁劲犇 已提交
22
	ZPMainFrame w;
23 24 25 26 27 28 29 30 31 32 33 34

	//!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.
35 36
	if (argc>1)
	{
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
		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);
52 53
	}

丁劲犇's avatar
丁劲犇 已提交
54 55 56
	w.show();
	int pp = app.exec();
	return pp;
丁劲犇's avatar
丁劲犇 已提交
57
}