// $Id$ //----------------------------------------------------------------------- // The GSI Online Offline Object Oriented (Go4) Project // Experiment Data Processing at EE department, GSI //----------------------------------------------------------------------- // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH // Planckstr. 1, 64291 Darmstadt, Germany // Contact: http://go4.gsi.de //----------------------------------------------------------------------- // This software can be used under the license agreements as stated // in Go4License.txt file which is part of the distribution. //----------------------------------------------------------------------- #include #include #include #include #include #include #include "TSystem.h" #include "RVersion.h" #include "TEnv.h" #include "TApplication.h" #include "QRootApplication.h" #include "TGo4Log.h" #include "TGo4Version.h" #include "TGo4MainWindow.h" #include "TGo4BrowserProxy.h" #include "TGo4DabcProxy.h" #include "TGo4BufferQueue.h" #include "TGo4QSettings.h" #include "TGo4AbstractInterface.h" #include "TROOT.h" #include "Riostream.h" #ifndef WIN32 #include "TGX11.h" //extern void qt_x11_set_global_double_buffer(bool); #endif int main(int argc, char **argv) { setlocale(LC_ALL, "C"); #ifndef WIN32 gEnv->SetValue("X11.XInitThread", 0); // required to avoid conflicts with Qt4 // qt_x11_set_global_double_buffer(false); // improves qtroot canvas update bool iswin32 = false; #else bool iswin32 = true; { // work around for client connection problem in windows // One should create several buffers and call WriteObjects before // any kind of connection will be done TGo4BufferQueue dummy("dummyQueue"); } #endif if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) { std::cerr << "Please configure your system correctly and restart go4 again" << std::endl; return -1; } int dologin = -1; const char* loghost = "localhost"; int logport = 5000; const char* logpass = 0; bool prepare_for_client = false; bool traceon = false; QString hotstart = ""; QString dabcnode = ""; QStringList files; for(int narg=1;narg MainGo4GUI switched on debug output" << std::endl; traceon = true; } else if((strcmp(argv[narg], "-observer")==0) || (strcmp(argv[narg], "-controller")==0) || (strcmp(argv[narg], "-admin")==0)) { if(strcmp(argv[narg], "-observer")==0) dologin = 0; if(strcmp(argv[narg], "-controller")==0) dologin = 1; if(strcmp(argv[narg], "-admin")==0) dologin = 2; if ((narg+1='0') && (argv[narg+1][0]<='9')) logport = QString(argv[++narg]).toInt(); if ((narg+1Getenv("GO4SETTINGS"); QString settfile; if (_env!=0) settfile = _env; if(iswin32 || settfile.isEmpty() || settfile.contains("ACCOUNT")) { settfile = ""; // do nothing, it is default location in .config/GSI/go4.conf } else { if (settfile.contains("LOCAL")) settfile = QDir::currentPath() + "/go4.conf"; QString subdir = QFileInfo(settfile).absolutePath(); // if there is no write access to directory where setting file should be placed, // default directory will be used if (gSystem->AccessPathName(subdir.toLatin1().constData(),kWritePermission)) settfile = ""; } go4sett = new TGo4QSettings(settfile); /////// end settings setup /////////////////////////////// if(traceon) TGo4Log::SetIgnoreLevel(0); else TGo4Log::SetIgnoreLevel(1); const char* dabc_vers = TGo4DabcProxy::GetDabcVersion(); std::cout << " Go4 " << __GO4RELEASE__ << ", build with ROOT " << ROOT_RELEASE; if (dabc_vers) std::cout << ", DABC " << dabc_vers; std::cout << " and Qt " << QT_VERSION_STR << std::endl; // create instance, which should be used everywhere TGo4MainWindow* Go4MainGUI = new TGo4MainWindow(&myapp); myapp.connect(&myapp, SIGNAL(lastWindowClosed()), &myapp, SLOT(quit())); Go4MainGUI->ensurePolished(); Go4MainGUI->show(); myapp.connect( &myapp, SIGNAL( lastWindowClosed() ), &myapp, SLOT( quit() ) ); QApplication::setDoubleClickInterval(400); //ms, for Qt>=3.3 avoid very fast defaults! QApplication::setStartDragTime(150); // ms for (int i = 0; i < files.size(); ++i) Go4MainGUI->Browser()->OpenFile(files.at(i).toLatin1().constData()); if (dabcnode.length()>0) Go4MainGUI->Browser()->ConnectDabc(dabcnode.toLatin1().constData()); if (hotstart.length()>0) Go4MainGUI->HotStart(hotstart.toLatin1().constData()); if (dologin>=0) { go4sett->setClientNode(loghost); go4sett->setClientPort(logport); go4sett->setClientDefaultPass(logpass==0); go4sett->setClientControllerMode(dologin); Go4MainGUI->ConnectServerSlot(false, logpass); } else if (prepare_for_client) { Go4MainGUI->PrepareForClientConnectionSlot(false); } int res = myapp.exec(); delete go4sett; return res; }