15 #include <QStringList> 20 #include "TApplication.h" 21 #include "TInterpreter.h" 43 #if QT_VERSION < QT_VERSION_CHECK(6,0,0) 44 #include <QtWebEngine> 51 std::cout <<
" Go4 " <<
__GO4RELEASE__ <<
", build with ROOT " << ROOT_RELEASE;
52 if (dabc_vers) std::cout <<
", DABC " << dabc_vers;
53 std::cout <<
" and Qt " << QT_VERSION_STR << std::endl;
62 std::cout <<
"Usage: " << std::endl;
63 std::cout <<
" go4 [args] - start go4 GUI" << std::endl;
64 std::cout <<
" go4 file1.root - load ROOT file(s) at start" << std::endl;
65 std::cout <<
" go4 filename[.hotstart] - process hotstart file" << std::endl;
66 std::cout <<
" go4 -observer hostname port - connect with running analysis server" << std::endl;
67 std::cout <<
" go4 -controller hostname port" << std::endl;
68 std::cout <<
" go4 -admin hostname port" << std::endl;
69 std::cout <<
" go4 -prepare - prepare for analysis client connection" << std::endl;
70 std::cout <<
" go4 -usergui - activate usergui" << std::endl;
72 std::cout <<
" go4 -web - activate web-based canvas" << std::endl;
75 std::cout <<
" go4 dabc://server[:port] - connect with DABC server" << std::endl;
76 std::cout <<
" go4 http://server[:port] - connect with ROOT-based HTTP server" << std::endl;
77 std::cout <<
" go4 -debug - enable GUI debug output" << std::endl;
78 std::cout <<
" go4 -gdebug [lvl] - set ROOT gDebug value (default 1)" << std::endl;
79 std::cout <<
" go4 -help - show this help information" << std::endl;
84 int main(
int argc,
char **argv)
86 if ((argc==2) && (!strcmp(argv[1],
"?") || !strcmp(argv[1],
"-h") || !strcmp(argv[1],
"-help") || !strcmp(argv[1],
"--help")))
return go4_usage();
88 setlocale(LC_ALL,
"C");
92 gEnv->SetValue(
"X11.XInitThread", 0);
108 std::cerr <<
"Please configure your system correctly and restart go4 again" << std::endl;
113 const char *loghost =
"localhost";
115 const char *logpass =
nullptr;
117 bool prepare_for_client =
false, traceon =
false, usergui =
false;
127 std::cerr <<
"Failure, go4 build without x11 and without web support" << std::endl;
132 QString hotstart, dabcnode;
133 QStringList files, httpnodes;
135 for (
int narg = 1; narg < argc; narg++) {
136 if (strlen(argv[narg]) == 0)
139 QString curr(argv[narg]);
141 if (argv[narg][0]==
'-') {
142 if ((curr ==
"--web") || (curr ==
"-web")) {
146 }
else if (curr ==
"-debug") {
147 std::cout <<
"G-OOOO-> MainGo4GUI switched on debug output" << std::endl;
149 }
else if (curr ==
"-gdebug") {
150 if ((narg+1 < argc) && (strlen(argv[narg+1]) > 0) && (argv[narg+1][0]!=
'-'))
151 gDebug = TString(argv[++narg]).Atoi();
154 }
else if ((curr ==
"-observer") || (curr ==
"-controller") || (curr ==
"-admin")) {
156 if (curr ==
"-observer") dologin = 0;
157 if (curr ==
"-controller") dologin = 1;
158 if (curr ==
"-admin") dologin = 2;
160 if ((narg+1<argc) && (argv[narg+1][0]!=
'-'))
161 loghost = argv[++narg];
163 if ((narg+1<argc) && (argv[narg+1][0]!=
'-') && (argv[narg+1][0]>=
'0') && (argv[narg+1][0]<=
'9'))
164 logport = QString(argv[++narg]).toInt();
166 if ((narg+1<argc) && (argv[narg+1][0]!=
'-')) logpass = argv[++narg];
167 }
else if (curr ==
"-prepare") {
168 prepare_for_client =
true;
169 }
else if (curr ==
"-usergui") {
172 }
else if (curr.contains(
".root")) {
173 files.append(argv[narg]);
174 }
else if (curr.contains(
"dabc://")) {
175 dabcnode = argv[narg];
176 }
else if (curr.contains(
"http://") || curr.contains(
"https://")) {
177 httpnodes.append(argv[narg]);
178 }
else if (hotstart.isEmpty()) {
179 hotstart = argv[narg];
180 if(!curr.contains(
".hotstart")) hotstart.append(
".hotstart");
198 const char *_env = gSystem->Getenv(
"GO4SETTINGS");
201 if (_env) settfile = _env;
203 if(iswin32 || settfile.isEmpty() || settfile.contains(
"ACCOUNT")) {
207 if (settfile.contains(
"LOCAL")) settfile = QDir::currentPath() +
"/go4.conf";
208 QString subdir = QFileInfo(settfile).absolutePath();
211 if (gSystem->AccessPathName(subdir.toLatin1().constData(),kWritePermission))
229 std::cout <<
"Use Screen scale factor " << scalefactor <<
" from settings." << std::endl;
230 gSystem->Setenv(
"QT_SCALE_FACTOR",QString(
"%1").arg(scalefactor).toLatin1 ().constData ());
232 TApplication app(
"uno", &argc, argv);
237 argv2[argc++] = (
char *)
"--ignore-gpu-blacklist";
239 argv2[argc] =
nullptr;
241 Q_INIT_RESOURCE(go4icons);
244 #if QT_VERSION < QT_VERSION_CHECK(6,0,0) 245 #if QT_VERSION >= QT_VERSION_CHECK(5,13,0) 247 if (useweb) QtWebEngine::initialize();
255 #if QT_VERSION < QT_VERSION_CHECK(5,13,0) 257 if (useweb) QtWebEngine::initialize();
262 ::setlocale(LC_ALL,
"C");
274 gInterpreter->SetProcessLineLock(kTRUE);
279 if (!go4inc.IsNull())
280 gInterpreter->AddIncludePath(go4inc.Data());
283 gEnv->SetValue(
"Canvas.ShowGuideLines", 0);
290 Go4MainGUI->ensurePolished();
293 QApplication::setDoubleClickInterval(400);
294 QApplication::setStartDragTime(150);
296 for (
int i = 0; i < files.size(); ++i)
299 if (dabcnode.length() > 0)
302 for (
int i = 0; i < httpnodes.size(); ++i)
305 if (hotstart.length() > 0)
306 Go4MainGUI->
HotStart(hotstart.toLatin1().constData());
317 }
else if (prepare_for_client) {
321 int res = myapp.exec();
void setClientControllerMode(int)
TGo4ServerProxy * ConnectHttpServer(const char *addr=nullptr, const char *user=nullptr, const char *pass=nullptr, bool with_qt_process=false, bool get_analysis_config=false)
void OpenFile(const char *fname)
static TGo4Log * Instance()
void HotStart(const char *fname)
void PrepareForClientConnection(bool interactive=true)
double getScreenScaleFactor()
void ConnectServer(bool interactive=true, const char *password="")
static Bool_t CheckVersion(Int_t version)
static void SetIgnoreLevel(Int_t level)
static void SetInitSharedLibs(const char *libs=nullptr)
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 &)
static const char * GetDabcVersion()
void setClientDefaultPass(bool)
static void LogfileEnable(Bool_t on=kTRUE)
int main(int argc, char **argv)