// $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 "TSystem.h" #include "RVersion.h" #include "Riostream.h" #include "tqapplication.h" #include "qrootapplication.h" #include "TGo4Log.h" #include "TGo4Version.h" #include "TGo4MainWindow.h" #include "TGo4QSettings.h" #include "TGo4BrowserProxy.h" #include "TGo4AbstractInterface.h" int main(int argc, char **argv) { if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) { std::cerr << "Go4 was build with version " << __GO4BUILDVERSION__ << std::endl; std::cerr << "Loaded go4 libraries has version " << TGo4Version::Instance()->GetBuildVersion() << std::endl; 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 traceon = false; bool prepare_for_client = false; QString hotstart = ""; 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 = atoi(argv[++narg]); if ((narg+1AccessPathName(QDir::currentDirPath(),kWritePermission)) { TGo4QSettings::SetToCurrentDir(false); accountsettings=true; } else { TGo4QSettings::SetToCurrentDir(true); } } else if(settingsenv.contains("ACCOUNT")) { TGo4QSettings::SetToCurrentDir(false); accountsettings=true; } else { TGo4QSettings::SetUserPath(settingsenv); } /// check here if current settings exist. If not, copy from home QString homesettings = QDir::homeDirPath()+ "/.qt/go4rc"; QString usersettings = TGo4QSettings::GetUserPath()+TGo4QSettings::GetSettingsName()+"rc"; QString hometools = QDir::homeDirPath()+ "/.qt/go4toolsrc"; QString usertools = TGo4QSettings::GetUserPath()+"/go4toolsrc"; if(!accountsettings && gSystem->AccessPathName(usersettings)) // file not there { // first create subfolder .qt if not there, otherwise copy fails! QString qsubdir=TGo4QSettings::GetUserPath(); if(gSystem->AccessPathName(qsubdir)) { std::cout <<"Creating settings subdirectory "<mkdir(qsubdir,true)!=0) std::cout <<"Could not create "<CopyFile(homesettings,usersettings,kTRUE)==0) std::cout <<"Copied account settings "<CopyFile(hometools,usertools,kTRUE)==0) std::cout <<"Copied account settings "<polish(); 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 ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) Go4MainGUI->Browser()->OpenFile((*it).latin1()); if (hotstart.length()>0) Go4MainGUI->HotStart(hotstart.latin1()); 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; }