20 #include <QStringList>
25 #include "TApplication.h"
27 #include "TInterpreter.h"
39 #include "Riostream.h"
50 std::cout <<
" Go4 " <<
__GO4RELEASE__ <<
", build with ROOT " << ROOT_RELEASE;
51 if (dabc_vers) std::cout <<
", DABC " << dabc_vers;
52 std::cout <<
" and Qt " << QT_VERSION_STR << std::endl;
61 std::cout <<
"Usage: " << std::endl;
62 std::cout <<
" go4 [args] - start go4 GUI" << std::endl;
63 std::cout <<
" go4 file1.root - load ROOT file(s) at start" << std::endl;
64 std::cout <<
" go4 filename[.hotstart] - process hotstart file" << std::endl;
65 std::cout <<
" go4 -observer hostname port - connect with running analysis server" << std::endl;
66 std::cout <<
" go4 -controller hostname port" << std::endl;
67 std::cout <<
" go4 -admin hostname port" << std::endl;
68 std::cout <<
" go4 -prepare - prepare for analysis client connection" << std::endl;
70 std::cout <<
" go4 dabc://server[:port] - connect with DABC server" << std::endl;
71 std::cout <<
" go4 http://server[:port] - connect with ROOT-based HTTP server" << std::endl;
72 std::cout <<
" go4 -debug - enable GUI debug output" << std::endl;
73 std::cout <<
" go4 -gdebug [lvl] - set ROOT gDebug value (default 1)" << std::endl;
74 std::cout <<
" go4 -help - show this help information" << std::endl;
79 int main(
int argc,
char **argv)
81 if ((argc==2) && (!strcmp(argv[1],
"?") || !strcmp(argv[1],
"-h") || !strcmp(argv[1],
"-help") || !strcmp(argv[1],
"--help")))
return go4_usage();
83 setlocale(LC_ALL,
"C");
86 gEnv->SetValue(
"X11.XInitThread", 0);
101 std::cerr <<
"Please configure your system correctly and restart go4 again" << std::endl;
106 const char* loghost =
"localhost";
108 const char* logpass = 0;
110 bool prepare_for_client =
false;
112 bool traceon =
false;
113 QString hotstart(
""), dabcnode(
"");
114 QStringList files, httpnodes;
116 for(
int narg=1;narg<argc;narg++) {
117 if (strlen(argv[narg])==0)
continue;
119 if (argv[narg][0]==
'-') {
120 if(!strcmp(argv[narg],
"-debug")) {
121 std::cout <<
"G-OOOO-> MainGo4GUI switched on debug output" << std::endl;
124 if(strcmp(argv[narg],
"-gdebug")==0) {
125 if ((narg+1 < argc) && (strlen(argv[narg+1]) > 0) && (argv[narg+1][0]!=
'-'))
126 gDebug = TString(argv[++narg]).Atoi();
130 if((strcmp(argv[narg],
"-observer")==0) ||
131 (strcmp(argv[narg],
"-controller")==0) ||
132 (strcmp(argv[narg],
"-admin")==0)) {
134 if(strcmp(argv[narg],
"-observer")==0) dologin = 0;
135 if(strcmp(argv[narg],
"-controller")==0) dologin = 1;
136 if(strcmp(argv[narg],
"-admin")==0) dologin = 2;
138 if ((narg+1<argc) && (argv[narg+1][0]!=
'-'))
139 loghost = argv[++narg];
141 if ((narg+1<argc) && (argv[narg+1][0]!=
'-') && (argv[narg+1][0]>=
'0') && (argv[narg+1][0]<=
'9'))
142 logport = QString(argv[++narg]).toInt();
144 if ((narg+1<argc) && (argv[narg+1][0]!=
'-')) logpass = argv[++narg];
146 if (strcmp(argv[narg],
"-prepare")==0) {
147 prepare_for_client =
true;
150 if (QString(argv[narg]).contains(
".root")) {
151 files.append(argv[narg]);
153 if (QString(argv[narg]).contains(
"dabc://")) {
154 dabcnode = argv[narg];
156 if (QString(argv[narg]).contains(
"http://") || QString(argv[narg]).contains(
"https://")) {
157 httpnodes.append(argv[narg]);
159 if (hotstart.length()==0) {
160 hotstart = argv[narg];
161 if(!QString(argv[narg]).contains(
".hotstart")) hotstart.append(
".hotstart");
180 const char* _env = gSystem->Getenv(
"GO4SETTINGS");
183 if (_env!=0) settfile = _env;
185 if(iswin32 || settfile.isEmpty() || settfile.contains(
"ACCOUNT")) {
189 if (settfile.contains(
"LOCAL")) settfile = QDir::currentPath() +
"/go4.conf";
190 QString subdir = QFileInfo(settfile).absolutePath();
193 if (gSystem->AccessPathName(subdir.toLatin1().constData(),kWritePermission))
206 #if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
210 std::cout <<
"Use Screen scale factor "<<scalefactor<<
" from settings." << std::endl;
211 gSystem->Setenv(
"QT_SCALE_FACTOR",QString(
"%1").arg(scalefactor).toLatin1 ().constData ());
216 TApplication app(
"uno", &argc, argv);
218 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
220 QApplication::setColorSpec( QApplication::ManyColor );
223 QApplication::setColorSpec( QApplication::NormalColor);
226 Q_INIT_RESOURCE(go4icons);
233 ::setlocale(LC_ALL,
"C");
245 #if ROOT_VERSION_CODE < ROOT_VERSION(6,12,0)
246 gInterpreter->SetProcessLineLock(kFALSE);
251 gInterpreter->SetProcessLineLock(kTRUE);
257 if (go4inc.Length()>0)
258 gInterpreter->AddIncludePath(go4inc.Data());
261 gEnv->SetValue(
"Canvas.ShowGuideLines", 0);
268 myapp.connect(&myapp, SIGNAL(lastWindowClosed()), &myapp, SLOT(quit()));
270 Go4MainGUI->ensurePolished();
274 QApplication::setDoubleClickInterval(400);
275 QApplication::setStartDragTime(150);
277 for (
int i = 0; i < files.size(); ++i)
280 if (dabcnode.length()>0)
283 for (
int i = 0; i < httpnodes.size(); ++i)
286 if (hotstart.length()>0)
287 Go4MainGUI->
HotStart(hotstart.toLatin1().constData());
296 if (prepare_for_client) {
300 int res = myapp.exec();
void setClientControllerMode(int)
void OpenFile(const char *fname)
static TGo4Log * Instance()
void HotStart(const char *fname)
double getScreenScaleFactor()
static Bool_t CheckVersion(Int_t version)
static void SetInitSharedLibs(const char *libs=0)
static void SetIgnoreLevel(Int_t level)
void ConnectServerSlot(bool interactive=true, const char *password="")
TGo4BrowserProxy * Browser()
static const char * GO4INCPATH()
#define __GO4BUILDVERSION__
Bool_t ConnectDabc(const char *nodename)
static TString subGO4SYS(const char *subdir)
void setClientNode(const QString &)
TGo4ServerProxy * ConnectHttpSlot(const char *addr=0, const char *user=0, const char *pass=0, bool with_qt_process=false, bool get_analysis_config=false)
static const char * GetDabcVersion()
void setClientDefaultPass(bool)
void PrepareForClientConnectionSlot(bool interactive=true)
static void LogfileEnable(Bool_t on=kTRUE)
int main(int argc, char **argv)