15 #include <QStringList>
21 #include "TApplication.h"
22 #include "TInterpreter.h"
44 #include <QtWebEngine>
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;
69 std::cout <<
" go4 -usergui - activate usergui" << std::endl;
71 std::cout <<
" go4 -web - activate web-based canvas" << std::endl;
74 std::cout <<
" go4 dabc://server[:port] - connect with DABC server" << std::endl;
75 std::cout <<
" go4 http://server[:port] - connect with ROOT-based HTTP server" << std::endl;
76 std::cout <<
" go4 -debug - enable GUI debug output" << std::endl;
77 std::cout <<
" go4 -gdebug [lvl] - set ROOT gDebug value (default 1)" << std::endl;
78 std::cout <<
" go4 -help - show this help information" << std::endl;
83 int main(
int argc,
char **argv)
85 if ((argc==2) && (!strcmp(argv[1],
"?") || !strcmp(argv[1],
"-h") || !strcmp(argv[1],
"-help") || !strcmp(argv[1],
"--help")))
return go4_usage();
87 setlocale(LC_ALL,
"C");
91 gEnv->SetValue(
"X11.XInitThread", 0);
107 std::cerr <<
"Please configure your system correctly and restart go4 again" << std::endl;
112 const char* loghost =
"localhost";
114 const char* logpass = 0;
116 bool prepare_for_client(
false), traceon(
false), usergui(
false), useweb(
false);
122 std::cerr <<
"Failure, go4 build without x11 and without web support" << std::endl;
127 QString hotstart(
""), dabcnode(
"");
128 QStringList files, httpnodes;
130 for(
int narg=1;narg<argc;narg++) {
131 if (strlen(argv[narg])==0)
continue;
133 QString curr(argv[narg]);
135 if (argv[narg][0]==
'-') {
136 if ((curr ==
"--web") || (curr ==
"-web")) {
138 }
else if (curr ==
"-debug") {
139 std::cout <<
"G-OOOO-> MainGo4GUI switched on debug output" << std::endl;
141 }
else if (curr ==
"-gdebug") {
142 if ((narg+1 < argc) && (strlen(argv[narg+1]) > 0) && (argv[narg+1][0]!=
'-'))
143 gDebug = TString(argv[++narg]).Atoi();
146 }
else if ((curr ==
"-observer") || (curr ==
"-controller") || (curr ==
"-admin")) {
148 if (curr ==
"-observer") dologin = 0;
149 if (curr ==
"-controller") dologin = 1;
150 if (curr ==
"-admin") dologin = 2;
152 if ((narg+1<argc) && (argv[narg+1][0]!=
'-'))
153 loghost = argv[++narg];
155 if ((narg+1<argc) && (argv[narg+1][0]!=
'-') && (argv[narg+1][0]>=
'0') && (argv[narg+1][0]<=
'9'))
156 logport = QString(argv[++narg]).toInt();
158 if ((narg+1<argc) && (argv[narg+1][0]!=
'-')) logpass = argv[++narg];
159 }
else if (curr ==
"-prepare") {
160 prepare_for_client =
true;
161 }
else if (curr ==
"-usergui") {
164 }
else if (curr.contains(
".root")) {
165 files.append(argv[narg]);
166 }
else if (curr.contains(
"dabc://")) {
167 dabcnode = argv[narg];
168 }
else if (curr.contains(
"http://") || curr.contains(
"https://")) {
169 httpnodes.append(argv[narg]);
170 }
else if (hotstart.length()==0) {
171 hotstart = argv[narg];
172 if(!curr.contains(
".hotstart")) hotstart.append(
".hotstart");
190 const char* _env = gSystem->Getenv(
"GO4SETTINGS");
193 if (_env!=0) settfile = _env;
195 if(iswin32 || settfile.isEmpty() || settfile.contains(
"ACCOUNT")) {
199 if (settfile.contains(
"LOCAL")) settfile = QDir::currentPath() +
"/go4.conf";
200 QString subdir = QFileInfo(settfile).absolutePath();
203 if (gSystem->AccessPathName(subdir.toLatin1().constData(),kWritePermission))
218 #if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
222 std::cout <<
"Use Screen scale factor " << scalefactor <<
" from settings." << std::endl;
223 gSystem->Setenv(
"QT_SCALE_FACTOR",QString(
"%1").arg(scalefactor).toLatin1 ().constData ());
227 TApplication app(
"uno", &argc, argv);
232 argv2[argc++] = (
char *)
"--ignore-gpu-blacklist";
236 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
237 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
239 QApplication::setColorSpec( QApplication::ManyColor );
243 QApplication::setColorSpec( QApplication::NormalColor);
246 Q_INIT_RESOURCE(go4icons);
249 #if QT_VERSION >= QT_VERSION_CHECK(5,13,0)
251 if (useweb) QtWebEngine::initialize();
258 #if QT_VERSION < QT_VERSION_CHECK(5,13,0)
260 if (useweb) QtWebEngine::initialize();
265 ::setlocale(LC_ALL,
"C");
277 #if ROOT_VERSION_CODE < ROOT_VERSION(6,12,0)
278 gInterpreter->SetProcessLineLock(kFALSE);
283 gInterpreter->SetProcessLineLock(kTRUE);
288 if (go4inc.Length()>0)
289 gInterpreter->AddIncludePath(go4inc.Data());
292 gEnv->SetValue(
"Canvas.ShowGuideLines", 0);
297 myapp.connect(&myapp, SIGNAL(lastWindowClosed()), &myapp, SLOT(quit()));
299 Go4MainGUI->ensurePolished();
303 QApplication::setDoubleClickInterval(400);
304 QApplication::setStartDragTime(150);
306 for (
int i = 0; i < files.size(); ++i)
309 if (dabcnode.length() > 0)
312 for (
int i = 0; i < httpnodes.size(); ++i)
315 if (hotstart.length() > 0)
316 Go4MainGUI->
HotStart(hotstart.toLatin1().constData());
327 }
else if (prepare_for_client) {
331 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)