15 #include <QStringList>
21 #include "TApplication.h"
22 #include "TInterpreter.h"
44 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
45 #include <QtWebEngine>
52 std::cout <<
" Go4 " <<
__GO4RELEASE__ <<
", build with ROOT " << ROOT_RELEASE;
53 if (dabc_vers) std::cout <<
", DABC " << dabc_vers;
54 std::cout <<
" and Qt " << QT_VERSION_STR << std::endl;
63 std::cout <<
"Usage: " << std::endl;
64 std::cout <<
" go4 [args] - start go4 GUI" << std::endl;
65 std::cout <<
" go4 file1.root - load ROOT file(s) at start" << std::endl;
66 std::cout <<
" go4 filename[.hotstart] - process hotstart file" << std::endl;
67 std::cout <<
" go4 -observer hostname port - connect with running analysis server" << std::endl;
68 std::cout <<
" go4 -controller hostname port" << std::endl;
69 std::cout <<
" go4 -admin hostname port" << std::endl;
70 std::cout <<
" go4 -prepare - prepare for analysis client connection" << std::endl;
71 std::cout <<
" go4 -usergui - activate usergui" << std::endl;
73 std::cout <<
" go4 -web - activate web-based canvas" << std::endl;
76 std::cout <<
" go4 dabc://server[:port] - connect with DABC server" << std::endl;
77 std::cout <<
" go4 http://server[:port] - connect with ROOT-based HTTP server" << std::endl;
78 std::cout <<
" go4 -debug - enable GUI debug output" << std::endl;
79 std::cout <<
" go4 -gdebug [lvl] - set ROOT gDebug value (default 1)" << std::endl;
80 std::cout <<
" go4 -help - show this help information" << std::endl;
85 int main(
int argc,
char **argv)
87 if ((argc==2) && (!strcmp(argv[1],
"?") || !strcmp(argv[1],
"-h") || !strcmp(argv[1],
"-help") || !strcmp(argv[1],
"--help")))
return go4_usage();
89 setlocale(LC_ALL,
"C");
93 gEnv->SetValue(
"X11.XInitThread", 0);
109 std::cerr <<
"Please configure your system correctly and restart go4 again" << std::endl;
114 const char* loghost =
"localhost";
116 const char* logpass = 0;
118 bool prepare_for_client(
false), traceon(
false), usergui(
false), useweb(
false);
124 std::cerr <<
"Failure, go4 build without x11 and without web support" << std::endl;
129 QString hotstart(
""), dabcnode(
"");
130 QStringList files, httpnodes;
132 for(
int narg=1;narg<argc;narg++) {
133 if (strlen(argv[narg])==0)
continue;
135 QString curr(argv[narg]);
137 if (argv[narg][0]==
'-') {
138 if ((curr ==
"--web") || (curr ==
"-web")) {
140 }
else if (curr ==
"-debug") {
141 std::cout <<
"G-OOOO-> MainGo4GUI switched on debug output" << std::endl;
143 }
else if (curr ==
"-gdebug") {
144 if ((narg+1 < argc) && (strlen(argv[narg+1]) > 0) && (argv[narg+1][0]!=
'-'))
145 gDebug = TString(argv[++narg]).Atoi();
148 }
else if ((curr ==
"-observer") || (curr ==
"-controller") || (curr ==
"-admin")) {
150 if (curr ==
"-observer") dologin = 0;
151 if (curr ==
"-controller") dologin = 1;
152 if (curr ==
"-admin") dologin = 2;
154 if ((narg+1<argc) && (argv[narg+1][0]!=
'-'))
155 loghost = argv[++narg];
157 if ((narg+1<argc) && (argv[narg+1][0]!=
'-') && (argv[narg+1][0]>=
'0') && (argv[narg+1][0]<=
'9'))
158 logport = QString(argv[++narg]).toInt();
160 if ((narg+1<argc) && (argv[narg+1][0]!=
'-')) logpass = argv[++narg];
161 }
else if (curr ==
"-prepare") {
162 prepare_for_client =
true;
163 }
else if (curr ==
"-usergui") {
166 }
else if (curr.contains(
".root")) {
167 files.append(argv[narg]);
168 }
else if (curr.contains(
"dabc://")) {
169 dabcnode = argv[narg];
170 }
else if (curr.contains(
"http://") || curr.contains(
"https://")) {
171 httpnodes.append(argv[narg]);
172 }
else if (hotstart.length()==0) {
173 hotstart = argv[narg];
174 if(!curr.contains(
".hotstart")) hotstart.append(
".hotstart");
192 const char* _env = gSystem->Getenv(
"GO4SETTINGS");
195 if (_env!=0) settfile = _env;
197 if(iswin32 || settfile.isEmpty() || settfile.contains(
"ACCOUNT")) {
201 if (settfile.contains(
"LOCAL")) settfile = QDir::currentPath() +
"/go4.conf";
202 QString subdir = QFileInfo(settfile).absolutePath();
205 if (gSystem->AccessPathName(subdir.toLatin1().constData(),kWritePermission))
220 #if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
224 std::cout <<
"Use Screen scale factor " << scalefactor <<
" from settings." << std::endl;
225 gSystem->Setenv(
"QT_SCALE_FACTOR",QString(
"%1").arg(scalefactor).toLatin1 ().constData ());
229 TApplication app(
"uno", &argc, argv);
234 argv2[argc++] = (
char *)
"--ignore-gpu-blacklist";
238 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
239 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
241 QApplication::setColorSpec( QApplication::ManyColor );
245 QApplication::setColorSpec( QApplication::NormalColor);
248 Q_INIT_RESOURCE(go4icons);
251 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
252 #if QT_VERSION >= QT_VERSION_CHECK(5,13,0)
254 if (useweb) QtWebEngine::initialize();
262 #if QT_VERSION < QT_VERSION_CHECK(5,13,0)
264 if (useweb) QtWebEngine::initialize();
269 ::setlocale(LC_ALL,
"C");
281 #if ROOT_VERSION_CODE < ROOT_VERSION(6,12,0)
282 gInterpreter->SetProcessLineLock(kFALSE);
287 gInterpreter->SetProcessLineLock(kTRUE);
292 if (go4inc.Length()>0)
293 gInterpreter->AddIncludePath(go4inc.Data());
296 gEnv->SetValue(
"Canvas.ShowGuideLines", 0);
301 myapp.connect(&myapp, SIGNAL(lastWindowClosed()), &myapp, SLOT(quit()));
303 Go4MainGUI->ensurePolished();
307 QApplication::setDoubleClickInterval(400);
308 QApplication::setStartDragTime(150);
310 for (
int i = 0; i < files.size(); ++i)
313 if (dabcnode.length() > 0)
316 for (
int i = 0; i < httpnodes.size(); ++i)
319 if (hotstart.length() > 0)
320 Go4MainGUI->
HotStart(hotstart.toLatin1().constData());
331 }
else if (prepare_for_client) {
335 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()
void setWebBasedCanvas(bool on=true)
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)