GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4MainWindow.cpp
Go to the documentation of this file.
1 // $Id: TGo4MainWindow.cpp 1991 2017-02-24 11:58:12Z adamczew $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4MainWindow.h"
15 
16 #include "qaction.h"
17 #include "qimage.h"
18 #include "qpixmap.h"
19 #include "qclipboard.h"
20 #include "qstylefactory.h"
21 #include "qfileinfo.h"
22 
23 #include <QtCore/QString>
24 #include <QtCore/QDateTime>
25 #include <QtCore/QTimer>
26 #include <QtCore/QProcess>
27 #include <QtCore/QHash>
28 #include <QtCore/QSignalMapper>
29 #include <QtCore/QDir>
30 
31 #include <QApplication>
32 #include <QMenuBar>
33 #include <QDockWidget>
34 #include <QToolBar>
35 #include <QComboBox>
36 #include <QAction>
37 #include <QStatusBar>
38 #include <QStyle>
39 #include <QColor>
40 #include <QToolTip>
41 #include <QToolButton>
42 #include <QMessageBox>
43 #include <QColorDialog>
44 #include <QFileDialog>
45 #include <QFontDialog>
46 #include <QInputDialog>
47 #include <QMdiSubWindow>
48 #include <QMimeData>
49 #include <QDesktopServices>
50 #include <QUrl>
51 
52 
54 #include "Riostream.h"
55 #include "TSystem.h"
56 #include "TROOT.h"
57 #include "TMath.h"
58 #include "TStyle.h"
59 #include "TH1.h"
60 #include "TH2.h"
61 #include "TTree.h"
62 #include "TColor.h"
63 #include "TCanvas.h"
64 #include "TList.h"
65 
67 #include "QRootApplication.h"
68 #include "TGo4Version.h"
69 #include "TGo4Log.h"
70 #include "TGo4LockGuard.h"
71 #include "TGo4Parameter.h"
72 #include "TGo4Condition.h"
73 #include "TGo4Marker.h"
74 #include "TGo4MdiArea.h"
75 #include "TGo4Fitter.h"
76 #include "TGo4FitPanel.h"
77 #include "TGo4DynamicEntry.h"
78 #include "TGo4AnalysisStatus.h"
79 
80 #include "TGo4ObjectManager.h"
81 #include "TGo4ObjectProxy.h"
82 #include "TGo4BrowserProxy.h"
83 #include "TGo4DabcProxy.h"
84 #include "TGo4AnalysisProxy.h"
85 #include "TGo4WidgetProxy.h"
86 
87 
88 
90 #include "QGo4Widget.h"
91 #include "TGo4QSettings.h"
92 #include "TGo4TreeViewer.h"
93 #include "TGo4Browser.h"
94 #include "TGo4BrowserOptions.h"
95 #include "TGo4Style.h"
96 #include "TGo4ViewPanel.h"
98 #include "TGo4AnalysisWindow.h"
99 #include "TGo4StartClient.h"
100 #include "TGo4HisDrawOptions.h"
101 #include "TGo4HisDrawOptionsShort.h"
102 #include "TGo4ScaleOptions.h"
103 #include "TGo4DividePad.h"
104 #include "TGo4CreateNewHistogram.h"
105 #include "TGo4CreateNewCondition.h"
106 #include "TGo4CreateNewDynEntry.h"
107 #include "TGo4ConditionInfo.h"
108 #include "TGo4HistogramInfo.h"
109 #include "TGo4EventInfo.h"
110 #include "TGo4LoadedLibraries.h"
111 #include "TGo4EditDynEntry.h"
112 #include "TGo4ParaEdit.h"
114 #include "TGo4ConditionEditor.h"
115 #include "TGo4LogSettings.h"
116 #include "TGo4LogInfo.h"
117 #include "TGo4OpenRemoteDialog.h"
118 #include "TGo4ConnectServer.h"
119 #include "TGo4MBSViewer.h"
120 #include "TGo4SetScaleValues.h"
121 #include "TGo4CommandLine.h"
122 #include "TGo4MarkerSettings.h"
123 #include "TGo4OptStatsSettings.h"
124 #include "TGo4HttpProxy.h"
125 
126 #include "TGo4UserCommands.h"
127 
128 
129 #ifdef __GO4DIM__
130 #include "TGo4DabcMonitor.h"
131 #endif
132 
133 
134 #include "TGo4Script.h"
135 
136 #include "TGo4HServerConnection.h"
137 
138 using namespace Qt;
139 
140 TGo4MainWindow::TGo4MainWindow(QApplication* app) :
141  QMainWindow(),
142  fApp(app)
143 {
144  // setDockWindowsMovable(true);
145  // statusBar();
146  resize( 1152, 864 );
147 
148  setWindowIcon(QIcon(":/icons/go4logo2_big.png"));
149  // setRightJustification( true );
150  // setUsesTextLabel(true);
151  // setOpaqueMoving(false);
152 
153 
154 
155  fxOM = new TGo4ObjectManager("GUI_OM","Gui object manager");
156  fOMDataPath = "data";
157  fOMBrowserPath = "gui";
158  fOMEditorsPath = "editors";
159 
160  fNewWidgetX = 0;
161  fNewWidgetY = 0;
162 
163  fKillCommand = "";
164  fLastPassword = "";
165  fLastFileDir = QDir::currentPath();
166 
167  fCloseCounter = 0;
168  fConnectingCounter = 0;
169  fConnectingHttp = "";
170 
171  fbGetAnalysisConfig=true;
172 
173  fbPanelTimerActive = false;
174  winMapper = 0;
175 
176  fbFullScreen = false;
177 
178 
179  // create mount point for all data sources
180  fxOM->MakeFolder(fOMDataPath.toLatin1().constData());
181 
182  // create entry for browser
183  TGo4BrowserProxy* br = new TGo4BrowserProxy(fOMDataPath.toLatin1().constData(), fOMEditorsPath.toLatin1().constData(), kFALSE);
184  fxOM->AddProxy("", br, fOMBrowserPath.toLatin1().constData(), "Place for gui slots");
185  br->CreateMemoryFolder();
186 
187  TH1I* h1 = new TH1I("histo1","histo title", 100, -10., 10.);
188  h1->FillRandom("gaus",10000);
189  h1->SetDirectory(0);
190  br->SaveToMemory("", h1, kTRUE);
191 
192 /* TH2I* h2 = new TH2I("histo2","histo 2 title", 100, -10., 10., 100, -10., 10.);
193  h2->FillRandom("gaus",100000);
194  h2->SetDrawOption("hist");
195  h2->SetDirectory(0);
196  br->SaveToMemory("", h2, kTRUE);
197 */
198  // br->OpenFile("asf.root");
199 
200  new TGo4Script(this);
201 
202  gStyle->SetPalette(1);
203  gStyle->SetCanvasColor(10); // no effect, can be set in settings
204  gStyle->SetPadColor(10); // no effect
205  gStyle->SetFrameFillColor(10); // works if not 0
206  gStyle->SetStatColor(0); // works
207 
208  //gStyle->SetOptStat(11111111);
209  gStyle->SetOptStat(go4sett->getOptStat());
210 
211  fxMdiArea = new TGo4MdiArea(this);
212  fxMdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
213  fxMdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
214  setCentralWidget(fxMdiArea);
215  fxMdiArea->setFocus();
216 
217  AddFileMenu();
218  AddFileToolBar();
219 
220  AddToolsMenu();
221  AddToolsBar();
222 
223  AddAnalysisMenu();
224  AddAnalysisBar();
225 
227 
228  QDockWidget* BrowserDockWin = new QDockWidget("Browser", this);
229  BrowserDockWin->setObjectName("BrowserDock");
230  TGo4Browser* browser = new TGo4Browser(BrowserDockWin,"Browser");
231  browser->setWindowFlags(Qt::Widget);
232  ConnectGo4Widget(browser);
233  browser->StartWorking();
234  BrowserDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
235  BrowserDockWin->setWidget(browser);
236  BrowserDockWin->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
237  addDockWidget(Qt::LeftDockWidgetArea, BrowserDockWin);
238 
239  QAction* BrowserDockAction=BrowserDockWin->toggleViewAction();
240  BrowserDockAction->setShortcut(QKeySequence("F6"));
241 
242 
243 #if (QT_VERSION >= 0x040700) && (QT_VERSION <= 0x040909)
244  browser->setMinimumWidth(230);
245 #endif
246 
247  QDockWidget* LogDockWin = new QDockWidget("Log window", this);
248  LogDockWin->setObjectName("LogInfoDock");
249  TGo4LogInfo* loginfo = new TGo4LogInfo(this, "LogInfo");
250  ConnectGo4Widget(loginfo);
251  LogDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
252  LogDockWin->setWidget(loginfo);
253  LogDockWin->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
254  addDockWidget(Qt::BottomDockWidgetArea, LogDockWin);
255 
256  QAction* LogDockWinAction=LogDockWin->toggleViewAction();
257  LogDockWinAction->setShortcut(QKeySequence("F7"));
258 
259  QDockWidget* MBSDockWin = new QDockWidget("MBS monitor", this);
260  MBSDockWin->setObjectName("MbsViewerDock");
261  TGo4MBSViewer* mbs = new TGo4MBSViewer(MBSDockWin, "MBSViewer");
262  mbs->setWindowFlags(Qt::Widget);
263  ConnectGo4Widget(mbs);
264  MBSDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
265  MBSDockWin->setWidget(mbs);
266  MBSDockWin->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
267  addDockWidget(Qt::BottomDockWidgetArea, MBSDockWin);
268 
269  QAction* MBSDockAction=MBSDockWin->toggleViewAction();
270  MBSDockAction->setShortcut(QKeySequence("F8"));
271 
272 
273 #ifdef __GO4DIM__
274  QDockWidget* DABCDockWin = new QDockWidget("DABC monitor", this);
275  DABCDockWin->setObjectName("DABCMonitorDock");
276  TGo4DabcMonitor* dabc = new TGo4DabcMonitor(DABCDockWin, "DabcMonitor");
277  dabc->setWindowFlags(Qt::Widget);
278  ConnectGo4Widget(dabc);
279  DABCDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
280  DABCDockWin->setWidget(dabc);
281  DABCDockWin->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
282  addDockWidget(Qt::BottomDockWidgetArea, DABCDockWin);
283  QAction* DABCDockWinAction=DABCDockWin->toggleViewAction();
284  DABCDockWinAction->setShortcut(QKeySequence("F9"));
285 
286 
287 #endif
288 
289  QToolBar* DividePanelBar = addToolBar("Canvas Tools");
290  DividePanelBar->setObjectName("DividePadDock");
291  TGo4DividePad* dividepanel = new TGo4DividePad(this, "DividePad");
292  DividePanelBar->addWidget(dividepanel);
293 
294  QToolBar* stylebar = addToolBar("Color Tools");
295  stylebar->setObjectName("Go4StyleDock");
296  fxStyle = new TGo4Style(this, "Go4Style");
297  stylebar->addWidget(fxStyle);
298 
299  QToolBar* BrowserOptionsPanel = addToolBar("Browser Options");
300  BrowserOptionsPanel->setObjectName("BrowserOptionsDock");
301  TGo4BrowserOptions* bropt = new TGo4BrowserOptions(this, "BrowserOptions");
302  ConnectGo4Widget(bropt);
303  BrowserOptionsPanel->addWidget(bropt);
304  bropt->StartWorking();
305 
306  QToolBar* DrawOptionPanel = addToolBar("Draw Options");
307  DrawOptionPanel->setObjectName("DrawOptionsDock");
308  TGo4HisDrawOptions* drawopt = new TGo4HisDrawOptions(this, "DrawOptions");
309  DrawOptionPanel->addWidget(drawopt);
310  DrawOptionPanel->adjustSize();
311 
312  QToolBar* DrawOptionShortPanel = addToolBar("Hist Draw Options");
313  DrawOptionShortPanel->setObjectName("HisDrawOptionsDock");
314  TGo4HisDrawOptionsShort* drawopts = new TGo4HisDrawOptionsShort(this, "HisDrawOptions");
315  DrawOptionShortPanel->addWidget(drawopts);
316  DrawOptionShortPanel->adjustSize();
317 
318  QToolBar* ScaleOptionBar = addToolBar("Zoom Tools");
319  ScaleOptionBar->setObjectName("ScaleOptionsDock");
320  TGo4ScaleOptions* scopt = new TGo4ScaleOptions(this, "ScaleOptions");
321  ConnectGo4Widget(scopt);
322  ScaleOptionBar->addWidget(scopt);
323  ScaleOptionBar->adjustSize();
324 
325  QToolBar* commandlinebar = addToolBar("Go4 Command Line");
326  commandlinebar->setObjectName("CommandLineDock");
327  TGo4CommandLine* cli = new TGo4CommandLine(this, "CommandLine");
328  ConnectGo4Widget(cli);
329  commandlinebar->addWidget(cli);
330 
331  QToolBar* tviewerdock = addToolBar("Tree viewer");
332  tviewerdock->setObjectName("TreeViewerDock");
333  TGo4TreeViewer* tviewer = new TGo4TreeViewer(this, "TreeViewer");
334  ConnectGo4Widget(tviewer);
335  tviewerdock->addWidget(tviewer);
336 
337  AddAnalysisMacrosBar(); // new 2016
338 
339 
340  // test: can we implement shortcuts to enable specific dock windows JAM?
341 // QMenu* dockMenu = menuBar()->addMenu("&Docks");
342 // dockMenu->addAction(BrowserDockAction);
343 // dockMenu->addAction(LogDockWinAction);
344 // dockMenu->addAction(MBSDockAction);
345 // do not need this, since shortcuts also work in default dock menu :)
346 
347  // make it here while only here exists all toolbars and dock widgets
348  AddSettingMenu();
349 
350  windowsMenu = menuBar()->addMenu("&Windows");
351  connect(windowsMenu, SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
352  // need to create menu item with F11
354 
355  menuBar()->addSeparator();
356 
357  QMenu* helpMenu = menuBar()->addMenu("&Help");
358  helpMenu->addAction("&Introduction (user manual)", this, SLOT(IntroHelpSlot()), Key_F1);
359  helpMenu->addAction("&Reference manual", this, SLOT(RefHelpSlot()));
360  helpMenu->addAction("&Fit Tutorial", this, SLOT(FitHelpSlot()));
361  helpMenu->addSeparator();
362  helpMenu->addAction("About &Qt", this, SLOT(aboutQt()), Key_F2 );
363  helpMenu->addAction("About R&OOT", this, SLOT(aboutROOT()), Key_F3);
365  helpMenu->addAction("About &DABC", this, SLOT(aboutDABC()));
366  helpMenu->addAction("About &Go4", this, SLOT(about()), Key_F4);
367 
368  const char* libs = gSystem->Getenv("GO4USERLIBRARY");
369 
370  if (libs!=0) {
371  QStringList LibList = QString(libs).split(":",QString::SkipEmptyParts);
372 
373  for (QStringList::Iterator it=LibList.begin(); it!=LibList.end(); ++it)
374  gSystem->Load((*it).toLatin1().constData());
375  }
376 
378 
379  QApplication::setStyle(go4sett->getAppStyle());
380 
381  faSuperimpose->setChecked(go4sett->getPadSuperimpose());
382  faCrosshair->setChecked(go4sett->getPadCrosshair());
383  faEventstatus->setChecked(go4sett->getPadEventStatus());
384 
386  go4sett->getAppFont();
387 
388  // start mbs monitoring only after browser etc. is fully there:
389  if(go4sett->getMbsMonitorMonitorActive()) mbs->TimerStart();
390 
391  std::cout <<"Using Qt settings at "<< go4sett->GetSettLoaction().toLatin1().constData() << std::endl;
392 
393  statusBar()->showMessage("Ready");
394  statusBar()->setSizeGripEnabled(true);
395 
396  QString sfmt = go4sett->getGStyleStatFormat();
397  if (!sfmt.isEmpty()) gStyle->SetStatFormat(sfmt.toLatin1().constData());
398 }
399 
401 {
403 
404  delete fxOM;
405 }
406 
408 {
409  return fLastPassword.toLatin1().constData();
410 }
411 
412 
414 {
415  QString GO4STR("Go4 ");
416  GO4STR.append ( __GO4RELEASE__);
417  QString GO4STR1 = GO4STR;
418  GO4STR1.append("<br>");
419  GO4STR1.append("The Go4 (GSI Object Oriented On-line Off-line system) is based on ROOT<br> with the specific requirements of the low and medium energy nuclear and atomic<br> physics experiments implemented as extensions.<br> See <a href='http://go4.gsi.de'>http://go4.gsi.de</a> for more information") ;
420 
421  QMessageBox AboutGo4(GO4STR, GO4STR1, QMessageBox::NoIcon,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton ,this);
422  AboutGo4.setIconPixmap(QPixmap( ":/icons/go4logo2_big.png"));
423  AboutGo4.setTextFormat(Qt::RichText);
424  AboutGo4.exec();
425 }
426 
428 {
429  QMessageBox::aboutQt(this, "Qt");
430 }
431 
433 {
434  QString mestring("This Go4 uses ROOT ");
435  mestring.append(gROOT->GetVersion());
436  mestring.append("<br> ROOT is an object-oriented framework <br>for large scale scientific <br>data analysis and data mining.<br> It has been developed at CERN<br> See <a href='http://root.cern.ch'>http://root.cern.ch</a> for more information");
437  QMessageBox AboutRoot("ROOT", mestring,
438  QMessageBox::NoIcon,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton ,this);
439  AboutRoot.setIconPixmap(QPixmap( ":/icons/root.png"));
440  AboutRoot.setTextFormat(Qt::RichText);
441  AboutRoot.exec();
442 }
443 
445 {
446  QString mestring("This Go4 uses DABC ");
448  mestring.append(TGo4DabcProxy::GetDabcVersion());
449  else
450  mestring.append("<undef>");
451  mestring.append("<br>DABC (Data Acquisition Backbone Core) is <br> framework to build multi-threaded multi-node DAQ applications.<br> It is developed in GSI.<br> See <a href='http://dabc.gsi.de'>http://dabc.gsi.de</a> for more information");
452  QMessageBox AboutDabc("DABC", mestring,
453  QMessageBox::NoIcon,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton ,this);
454  AboutDabc.setIconPixmap(QPixmap( ":/icons/dabc.png"));
455  AboutDabc.setTextFormat(Qt::RichText);
456  AboutDabc.exec();
457 }
458 
459 
460 
462 {
463  QMenu* settMenu = menuBar()->addMenu("&Settings");
464 
465  QMenu* sub = createPopupMenu();
466  sub->setTitle("Sh&ow/hide");
467  settMenu->addMenu(sub);
468 
469  settMenu->addAction("&Font...", this, SLOT(ChangeFontSlot()));
470 
471  QMenu *style = settMenu->addMenu("St&yle");
472 
473  QMenu* prefMenu = settMenu->addMenu("&Preferences");
474 
475  faFetchWhenDraw = AddChkAction(prefMenu, "Fetch when drawing",
477 
478  faFetchWhenCopy = AddChkAction(prefMenu, "Fetch when copying",
480 
481  faFetchWhenSave = AddChkAction(prefMenu, "Fetch when saving",
483 
484  faHideEventElement = AddChkAction(prefMenu, "Hide TGo4EventElement",
486 
487  faDrawOnce = AddChkAction(prefMenu, "Draw item once",
488  go4sett->getDrawOnceFlag(), this, SLOT(ChangeDrawOnceSlot()));
489 
490  faWindowRubberBand = AddChkAction(prefMenu, "Rubberband when moving windows",
492 
493 #if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
494  prefMenu->addAction("GUI HighDPI Scale factor...", this, SLOT(ScaleFactorSlot()));
495 #endif
496 
497  QMenu* panelMenu = settMenu->addMenu("&Panel defaults");
498 
499  panelMenu->addAction("&Canvas color...", this, SLOT(CanvasColorSlot()));
500 
501  faSaveWhite=AddChkAction(panelMenu, "White canvas for saved images",
503 
504  panelMenu->addAction("Marker labels...", this, SLOT(MarkerSettingsSlot()));
505  panelMenu->addAction("Statistics box...", this, SLOT(OptStatsSlot()));
506 
507  faSuperimpose = AddChkAction(panelMenu, "&Superimpose mode",
508  go4sett->getPadSuperimpose(), this, SLOT(SuperimposeSlot()));
509 
510  faCrosshair = AddChkAction(panelMenu, "Cross(&X)hair mode",
511  go4sett->getPadCrosshair(), this, SLOT(CrosshairSlot()));
512 
513  faEventstatus = AddChkAction(panelMenu, "Show Event Status",
514  go4sett->getPadEventStatus(), this, SLOT(EventStatusSlot()));
515 
516  faClone = AddChkAction(panelMenu, "Objects cloning",
517  go4sett->getCloneFlag(), this, SLOT(ChangeCloneFlagSlot()));
518 
519  faDrawTime = AddChkAction(panelMenu, "Draw time",
521  faDrawTime->setEnabled(go4sett->getCloneFlag());
522 
523  faDrawDate = AddChkAction(panelMenu, "Draw date",
525  faDrawDate->setEnabled(go4sett->getCloneFlag());
526 
527  faDrawItem = AddChkAction(panelMenu, "Draw item name",
529  panelMenu->addAction(faDrawItem);
530  faDrawItem->setEnabled(go4sett->getCloneFlag());
531 
532  panelMenu->addAction("Draw line &width ...", this, SLOT(DrawLineWidthSlot()));
533  panelMenu->addAction("Draw fill color ...", this, SLOT(DrawFillColorSlot()));
534  panelMenu->addAction("Draw fill style ...", this, SLOT(DrawFillStyleSlot()));
535  panelMenu->addAction("TH1 draw opt ...", this, SLOT(TH1DrawOptSlot()));
536  panelMenu->addAction("TH2 draw opt ...", this, SLOT(TH2DrawOptSlot()));
537  panelMenu->addAction("TH3 draw opt ...", this, SLOT(TH3DrawOptSlot()));
538  panelMenu->addAction("TGraph draw opt ...", this, SLOT(TGraphDrawOptSlot()));
539  panelMenu->addAction("Printf format ...", this, SLOT(GStyleStatFormatSlot()));
540  panelMenu->addAction("Palette settings ...", this, SLOT(PaletteSettingsSlot()));
541 
542 
543 
544 
545  settMenu->addAction("&Log actions...", this, SLOT(LogSettingsSlot()));
546  QMenu* termMenu = settMenu->addMenu("&Terminal");
547  faTermTimeStamp = AddChkAction(termMenu, "Print timestamps",
549  termMenu->addAction("&Timestamp Format...", this, SLOT(ChangeTerminalTimeStampFormatSlot()));
550  termMenu->addAction("&History...", this, SLOT(InputTerminalParametersSlot()));
551  termMenu->addAction("&Font...", this, SLOT(ChangeTerminalFontSlot()));
552 
553 
554  settMenu->addAction("Generate &hotstart", this, SLOT(CreateGUIScriptSlot()));
555  settMenu->addAction("&Break hotstart execution", this, SLOT(StopGUIScriptSlot()));
556 
557 
558  settMenu->addAction("&Save settings", this, SLOT(SaveSettingsSlot()));
559 
560  QActionGroup *ag = new QActionGroup(this);
561  ag->setExclusive( true );
562  QSignalMapper *styleMapper = new QSignalMapper( this );
563  connect(styleMapper, SIGNAL(mapped(const QString&)), this, SLOT(SetStyleSlot(const QString&)));
564 
565  QStringList list = QStyleFactory::keys();
566  list.sort();
567  QHash<QString, int> stylesDict;
568  for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
569  QString styleStr = *it;
570  QString styleAccel = styleStr;
571  if ( stylesDict[styleAccel.left(1)] ) {
572  for ( uint i = 0; i < styleAccel.length(); i++ ) {
573  if ( !stylesDict[styleAccel.mid( i, 1 )] ) {
574  stylesDict.insert(styleAccel.mid( i, 1 ), 1);
575  styleAccel = styleAccel.insert( i, '&' );
576  break;
577  }
578  }
579  } else {
580  stylesDict.insert(styleAccel.left(1), 1);
581  styleAccel = "&"+styleAccel;
582  }
583  QAction *act = new QAction(styleAccel, this);
584  act->setCheckable(true);
585  if (go4sett->getAppStyle() == styleStr)
586  act->setChecked(true);
587 
588  connect( act, SIGNAL(triggered()), styleMapper, SLOT(map()) );
589  styleMapper->setMapping(act, styleStr);
590 
591  ag->addAction(act);
592  style->addAction(act);
593  }
594 }
595 
597 {
598  QMenu* fileMenu = menuBar()->addMenu("&File");
599 
600  fileMenu->addAction(QIcon( ":/icons/open.png" ), "&Open...",
601  this, SLOT(OpenFileSlot()), CTRL+Key_O );
602  fileMenu->addAction(QIcon( ":/icons/network.png" ), "Open &Remote...",
603  this, SLOT(OpenRemoteFileSlot()), CTRL+Key_R );
605  fileMenu->addAction(QIcon( ":/icons/dabc.png" ), "Connect &DABC...",
606  this, SLOT(ConnectDabcSlot()) );
607  fileMenu->addAction(QIcon( ":/icons/http.png" ), "Connect &HTTP...",
608  this, SLOT(ConnectHttpSlot()) );
609  fileMenu->addAction(QIcon( ":/icons/histserv.png" ), "Open HIST &Server...",
610  this, SLOT(ConnectHServerSlot()) );
611  fileMenu->addAction(QIcon( ":/icons/filesave.png" ), "Save memor&y...",
612  this, SLOT(SaveFileSlot()), CTRL+Key_Y );
613  fileMenu->addAction(QIcon( ":/icons/close.png" ),"Close all files",
614  this, SLOT(CloseAllFilesSlot()), CTRL+Key_Q);
615  fileMenu->addAction(QIcon( ":/icons/exit.png" ), "E&xit",
616  this, SLOT(close()), CTRL+Key_X );
617 }
618 
620 {
621  QToolBar *FileBar = addToolBar( "File Toolbar" );
622  FileBar->setObjectName("FileToolBar");
623 
624  FileBar->addAction( QIcon( ":/icons/open.png" ), "Open a local file from disk",
625  this, SLOT(OpenFileSlot()));
626 
627  FileBar->addAction( QIcon( ":/icons/network.png" ), "Open a remote file from server",
628  this, SLOT(OpenRemoteFileSlot()));
629 
631  FileBar->addAction( QIcon( ":/icons/dabc.png" ), "Connect to DABC server",
632  this, SLOT(ConnectDabcSlot()));
633 
634  FileBar->addAction( QIcon( ":/icons/http.png" ), "Connect to HTTP server",
635  this, SLOT(ConnectHttpSlot()));
636 
637  FileBar->addAction( QIcon( ":/icons/histserv.png" ), "Connect to running histogram server",
638  this, SLOT(ConnectHServerSlot()));
639 
640  FileBar->addAction( QIcon( ":/icons/filesave.png" ), "Save the content of the browser to a root file",
641  this, SLOT(SaveFileSlot()));
642 
643  FileBar->addAction( QIcon( ":/icons/close.png" ), "Close all root files in file browser",
644  this, SLOT(CloseAllFilesSlot() ));
645 
646  FileBar->addAction( QIcon( ":/icons/exit.png" ), "Exit the Go4",
647  this, SLOT(close()));
648 }
649 
651 {
652  QMenu* toolMenu = menuBar()->addMenu("&Tools");
653 
654  toolMenu->addAction(QIcon(":/icons/chart.png" ), "&View panel",
655  this, SLOT(MakeNewPanel()), CTRL+Key_V );
656  toolMenu->addAction(QIcon(":/icons/fitpanel.png" ), "&Fit panel...",
657  this, SLOT(StartFitPanel()), CTRL+Key_F );
658  toolMenu->addAction(QIcon(":/icons/hislist.png" ),"&Histogram properties...",
659  this, SLOT(StartHistogramInfo()));
660  toolMenu->addAction(QIcon(":/icons/hiscre.png" ), "Create New H&istogram...",
661  this, SLOT(CreateNewHistSlot()), CTRL+Key_I );
662  toolMenu->addAction(QIcon(":/icons/condlist.png" ),"C&ondition properties...",
663  this, SLOT(StartConditionInfo()));
664  toolMenu->addAction(QIcon(":/icons/condcre.png" ),"Create new &condition...",
665  this, SLOT(CreateNewConditionSlot()));
666  toolMenu->addAction(QIcon(":/icons/zoom.png" ),"&Event printout...",
667  this, SLOT(StartEventInfo()));
668  toolMenu->addAction(QIcon(":/icons/dynlist.png" ),"Create &dyn. list entry ...",
669  this, SLOT(CreateNewDynEntrySlot()), CTRL+Key_D);
670  toolMenu->addAction(QIcon(":/icons/dllicon.png" ), "Load li&braries ...",
671  this, SLOT(LoadLibrarySlot()), CTRL+Key_B);
672  toolMenu->addAction(QIcon(":/icons/user.png" ), "&User GUI ...",
673  this, SLOT(UserPanelSlot()), CTRL+Key_U);
674 }
675 
677 {
678  QToolBar *ToolBar = addToolBar("Go4 tools");
679  ToolBar->setObjectName("Go4ToolsBar");
680 
681  ToolBar->addAction( QIcon( ":/icons/chart.png" ), "Create a new view panel",
682  this, SLOT(MakeNewPanel()));
683 
684  ToolBar->addAction( QIcon( ":/icons/fitpanel.png" ), "Show/hide the Go4 Fit Panel",
685  this, SLOT(StartFitPanel()));
686 
687  ToolBar->addAction( QIcon( ":/icons/hislist.png" ), "Show histogram properties window",
688  this, SLOT(StartHistogramInfo()));
689 
690  ToolBar->addAction( QIcon( ":/icons/hiscre.png" ), "Create new ROOT Histogram",
691  this, SLOT(CreateNewHistSlot()));
692 
693  ToolBar->addAction( QIcon( ":/icons/condlist.png" ), "Show condition properties window",
694  this, SLOT(StartConditionInfo()));
695 
696  ToolBar->addAction( QIcon( ":/icons/condcre.png" ), "Create new condition in analysis",
697  this, SLOT(CreateNewConditionSlot()));
698 
699  ToolBar->addAction( QIcon( ":/icons/zoom.png" ), "Event printout and examination window",
700  this, SLOT(StartEventInfo()));
701 
702  ToolBar->addAction( QIcon( ":/icons/dynlist.png" ), "Create new Dynamic list entry",
703  this, SLOT(CreateNewDynEntrySlot()));
704 
705  ToolBar->addAction( QIcon( ":/icons/dllicon.png" ), "Load Libraries",
706  this, SLOT(LoadLibrarySlot() ));
707 
708  ToolBar->addAction( QIcon( ":/icons/user.png" ), "Start user panel",
709  this, SLOT(UserPanelSlot()));
710 }
711 
713 {
714  QMenu* anMenu = menuBar()->addMenu("&Analysis");
715 
716  faLaunchAnal =
717  anMenu->addAction(QIcon(":/icons/launchanal.png" ), "Lau&nch analysis...",
718  this, SLOT(LaunchClientSlot()), CTRL+Key_N);
719  faConnectAnal =
720  anMenu->addAction(QIcon(":/icons/connect.png"), "&Connect to running server...",
721  this, SLOT(ConnectServerSlot()), CTRL+Key_C);
722 
723  faPrepareAnal =
724  anMenu->addAction(QIcon(":/icons/connect.png" ), "&Prepare for client connection...",
725  this, SLOT(PrepareForClientConnectionSlot()));
726 
728  anMenu->addAction(QIcon(":/icons/disconnect.png"), "Disconnect from analysis",
729  this, SLOT(DisconnectAnalysisSlot()), CTRL+Key_M);
730 
732  anMenu->addAction(QIcon(":/icons/shutanal.png"), "Shutdown analysis",
733  this, SLOT(ShutdownAnalysisSlot()), CTRL+Key_M);
734 
736  anMenu->addAction(QIcon(":/icons/restart.png"), "Submit+S&tart",
737  this, SLOT(SubmitStartAnalysisSlot()), CTRL+Key_T);
738 
739  faStartAnal =
740  anMenu->addAction(QIcon(":/icons/start.png"), "&Start",
741  this, SLOT(StartAnalysisSlot()), CTRL+Key_S);
742 
743  faStopAnal =
744  anMenu->addAction(QIcon(":/icons/Stop.png"), "Stop (&Halt)",
745  this, SLOT(StopAnalysisSlot()), CTRL+Key_H);
746 
747  faAnalConfig =
748  anMenu->addAction(QIcon(":/icons/control.png"), "Confi&guration...",
749  this, SLOT(ToggleAnalysisConfiguration()), CTRL+Key_G);
750 
751  faAnalTermin =
752  anMenu->addAction(QIcon(":/icons/analysiswin.png"), "Analysis &Window",
753  this, SLOT(ToggleAnalysisWindow()), CTRL+Key_W);
754 }
755 
757 {
758  QToolBar *AnalBar = addToolBar("Analysis Toolbar");
759  AnalBar->setObjectName("AnalysisToolBar");
760  AnalBar->setToolTip("Analysis related tool buttons");
761 
762  AnalBar->addAction(faLaunchAnal);
763  AnalBar->addAction(faConnectAnal);
764  AnalBar->addAction(faDisconnectAnal);
765  AnalBar->addAction(faShutdownAnal);
766 
767  AnalBar->addAction(faSumbStartAnal);
768 
769  AnalBar->addAction(faStartAnal);
770 
771  AnalBar->addAction(faStopAnal);
772  AnalBar->addAction(faAnalConfig);
773  AnalBar->addAction(faAnalTermin);
774 }
775 
777 {
778  windowsMenu->clear();
779 
780  bool on = ! fxMdiArea->subWindowList().isEmpty();
781 
782  //windowsMenu->addAction("Ca&scade", this, SLOT(CascadeSubWindows()))->setEnabled(on);
783  windowsMenu->addAction("Ca&scade", fxMdiArea, SLOT(cascadeSubWindows()))->setEnabled(on);
784  windowsMenu->addAction("&Tile", fxMdiArea, SLOT(tileSubWindows()))->setEnabled(on);
785  windowsMenu->addAction("&Close all", fxMdiArea, SLOT(closeAllSubWindows()))->setEnabled(on);
786  windowsMenu->addAction("&Minimize all", this, SLOT(MinAllWindows()))->setEnabled(on);
787 
788  windowsMenu->addAction((fbFullScreen ? "&Normal window" : "&Full screen"), this, SLOT(ToggleFullScreenSlot()), Key_F11);
789 
790  windowsMenu->addSeparator();
791 
792  QGo4Widget* loginfo = FindGo4Widget("LogInfo", false);
793  if (loginfo!=0) {
794  windowsMenu->addAction("Save L&ogwindow", loginfo, SLOT(SaveLogInfo()));
795  windowsMenu->addAction("Clear &Logwindow", loginfo, SLOT(ClearLogInfo()));
796  } else {
797  windowsMenu->addAction("Save L&ogwindow")->setEnabled(false);
798  windowsMenu->addAction("Clear &Logwindow")->setEnabled(false);
799  }
800 
801  QGo4Widget* anw = FindGo4Widget("AnalysisWindow", false);
802  if (anw!=0) {
803  windowsMenu->addAction("Save &Analysis window", anw, SLOT(SaveAnalysisOutput()));
804  windowsMenu->addAction("Clear Analysis &window", anw, SLOT(ClearAnalysisOutput()));
805  } else {
806  windowsMenu->addAction("Save &Analysis window")->setEnabled(false);
807  windowsMenu->addAction("Clear Analysis &window")->setEnabled(false);
808  }
809 
810  windowsMenu->addSeparator();
811 
812  delete winMapper;
813  winMapper = new QSignalMapper(this);
814  connect(winMapper, SIGNAL(mapped(int)), this, SLOT(windowsMenuActivated(int)));
815 
816  QList<QMdiSubWindow *> windows = fxMdiArea->subWindowList();
817  for (int i=0; i< windows.count(); i++ ) {
818  QAction* act = new QAction(windows.at(i)->widget()->windowTitle(), winMapper);
819  act->setCheckable(true);
820  act->setChecked(fxMdiArea->activeSubWindow() == windows.at(i));
821 
822  windowsMenu->addAction(act);
823 
824  connect(act, SIGNAL(triggered()), winMapper, SLOT(map()) );
825  winMapper->setMapping(act, i);
826  }
827 }
828 
830 {
831  QList<QMdiSubWindow *> windows = fxMdiArea->subWindowList();
832  for ( int i = 0; i < windows.count(); i++ )
833  windows.at(i)->widget()->showMinimized();
834 }
835 
837 {
838  QList<QMdiSubWindow *> windows = fxMdiArea->subWindowList();
839 
840  int x(15),y(15);
841 
842  for ( int i = 0; i < windows.count(); i++ ) {
843  windows.at(i)->move(x, y);
844  x+=25; y+=25;
845  }
846 }
847 
848 
850 {
851  if (fbFullScreen) showNormal();
852  else showFullScreen();
854 }
855 
856 
858 {
859  QList<QMdiSubWindow *> windows = fxMdiArea->subWindowList();
860  if ((id>=0) && (id<windows.count())) {
861  windows.at(id)->widget()->showNormal();
862  windows.at(id)->widget()->setFocus();
863  }
864 }
865 
866 typedef void* (*TStartUserGuiFunc)(QWidget* parent);
867 
868 bool TGo4MainWindow::startUserGUI(const char* usergui)
869 {
870  QString dirname, libname;
871 
872  bool result = false;
873 
874  if ((usergui!=0) && (strlen(usergui)>0)) {
875  QFileInfo info(usergui);
876  if (info.exists())
877  if (info.isFile()) {
878  dirname = info.path();
879  libname = info.fileName();
880 
881  } else
882  if (info.isDir()) {
883  dirname = usergui;
884  }
885  if ((dirname.length()>0) && (dirname[dirname.length()-1]!='/')) dirname+="/";
886  }
887 
888  bool defaultnames = libname.length()==0;
889  if (defaultnames)
890  libname = "libGo4UserGui";
891 
892  TStartUserGuiFunc startfunc = 0;
893 
894  libname = dirname + libname;
895 
896  std::cout << "Try usergui: " << libname.toLatin1().constData() << std::endl;
897 
898  bool loaded = false;
899 
900  if (gSystem->Load(libname.toLatin1().constData())>=0) {
901  loaded = true;
902  startfunc = (TStartUserGuiFunc) gSystem->DynFindSymbol(libname.toLatin1().constData(), "StartUserPanel");
903  }
904 
905  if (startfunc!=0) {
906  QGo4Widget* userpanel = (QGo4Widget*) startfunc(fxMdiArea);
907  if (userpanel!=0) {
908  userpanel->setObjectName("UserPanel");
909 
910  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(userpanel);
911  CascadeMdiPosition(sub);
912  ConnectGo4Widget(userpanel);
913  userpanel->ensurePolished();
914  sub->show();
915  result = true;
916  } else
917  StatusMessage("StartUserPanel() function did not create user widget");
918  }
919 
920  if (result) {
921  std::cout << "Start user GUI from ";
922  if (dirname.length()>0)
923  std::cout << dirname.toLatin1().constData() << std::endl;
924  else
925  std::cout << "$LD_LIBRARY_PATH=" << gSystem->Getenv("LD_LIBRARY_PATH") << std::endl;
926  } else {
927  if (loaded) gSystem->Unload(libname.toLatin1().constData());
928  }
929 
930  return result;
931 }
932 
934 {
935  QGo4Widget* userpanel = FindGo4Widget("UserPanel", true);
936  if (userpanel!=0) return;
937 
938  // check GO4USERGUI variable
939  if (gSystem->Getenv("GO4USERGUI")!=0)
940  if (startUserGUI(gSystem->Getenv("GO4USERGUI"))) return;
941 
942  // check from standard LD_LIBRARY_PATHS
943  if (startUserGUI(0)) return;
944 
945  if (startUserGUI(TGo4Log::subGO4SYS("qt4/Go4UserGUI").Data())) return;
946 
947  QMessageBox::critical(this,"Starting user GUI", "No suitable libraries found");
948 }
949 
950 
951 TGo4ViewPanel* TGo4MainWindow::MakeNewPanel(int ndiv)
952 {
953  QString name;
954 
955  TGo4Slot* edslot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
956 
957  int n = 0;
958  do {
959  n++;
960  name = QString("Panel") + QString::number(n);
961  } while ((edslot!=0) && (edslot->FindChild(name.toLatin1().constData())!=0));
962 
963  TGo4ViewPanel* panel = new TGo4ViewPanel(fxMdiArea, name.toLatin1().constData());
964  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(panel); // warning: Qt may exchange the winId here!
965  // panel->GetQCanvas()->performResize(); // may register new winId for TCanvas here
966 
967 
968  sub->resize(go4sett->lastPanelSize("ViewPanel"));
969 
970  CascadeMdiPosition(sub);
971 
972  ConnectGo4Widget(panel);
973  panel->update();
974  panel->show();
975  panel->ensurePolished();
976  panel->CompleteInitialization();
977 
978  if(ndiv>1) {
979 
980  int DivX(1), DivY(1);
981 
982  TGo4DividePad* divpad = findChild<TGo4DividePad*>("DividePad");
983 
984  if (divpad!=0) {
985  DivX = divpad->SpinBoxX->value();
986  DivY = divpad->SpinBoxY->value();
987  }
988  if (DivX * DivY < ndiv) {
989  DivX = (int) TMath::Sqrt(ndiv*1.);
990  DivY = DivX;
991  while (DivX*DivY<ndiv) DivY++;
992  }
993  panel->Divide(DivX, DivY);
994  }
995 
996  return panel;
997 }
998 
1000 {
1001  //if ((sub->x() + sub->width() < fxMdiArea->viewport()->width()) &&
1002  //(sub->y() + sub->height() < fxMdiArea->viewport()->height())) return;
1003 
1004  int newx = fNewWidgetX;
1005  int newy = fNewWidgetY;
1006  if (newx + sub->width() > fxMdiArea->width()) newx = 0;
1007  if (newy + sub->height() > fxMdiArea->height()) newy = 0;
1008  sub->move(newx, newy);
1009  fNewWidgetX = sub->x() + 30;
1010  fNewWidgetY = sub->y() + 30;
1011 }
1012 
1013 
1014 void TGo4MainWindow::closeEvent( QCloseEvent* ce)
1015 {
1016  if (fCloseCounter!=0) return;
1017 
1018 // new for Qt4:
1019  if(QMessageBox::question( this, "Go4 GUI", "Really Exit Go4?",
1020  QMessageBox::Yes | QMessageBox::No ,
1021  QMessageBox::Yes) != QMessageBox::Yes ) {
1022  //std::cout <<"QMessageBox does not return yes! "<< std::endl;
1023  ce->ignore();
1024  return;
1025  }
1026 
1027  //fxMdiArea->closeAllSubWindows();
1028 
1029  Browser()->ToggleMonitoring(0);
1030  fxMdiArea->closeAllSubWindows();
1032 
1033  bool realshutdown = false;
1034 
1035  // TODO: terminate HTTP server running in Qt window
1037  if (an && an->TerminateOnClose()) realshutdown = true;
1038 
1040  int waitsecs = 180;
1041  if(!RemoveAnalysisProxy(waitsecs, realshutdown)) {
1042  //std::cout <<"closeEvent - RemoveAnalysisProxy returned false, using close counter" << std::endl;
1043  fCloseCounter = (waitsecs+10) *10; // was 100 gui waits about 10 second to close analysis
1044  statusBar()->showMessage("Exit.... please wait");
1045  QApplication::setOverrideCursor(Qt::WaitCursor);
1046  QTimer::singleShot(100, this, SLOT(ForseCloseSlot()));
1047  //std::cout <<"TGo4MainWindow::closeEvent after QTimer, ignore close event" << std::endl;
1048  ce->ignore();
1049  } else {
1050  statusBar()->showMessage("Closing GUI...");
1051  // JAM: due to problems with Qt5, we just use delayed exit here
1052  // note that calling directly gSystem->Exit gives crash in ROOT object/pad cleanup...
1053  // probably because fxMdiArea->closeAllSubWindows() will have effect only after this event handler returns
1054  QTimer::singleShot(100, this, SLOT(ForseCloseSlot()));
1055  ce->ignore();
1056  }
1057 }
1058 
1060 {
1061  // if (!RemoveAnalysisProxy(30) && (fCloseCounter>0)) {
1062 
1063  if (Browser()->FindServer()!=0) {
1064 
1065  if (fCloseCounter>0) {
1066  fCloseCounter--;
1067  QTimer::singleShot(100, this, SLOT(ForseCloseSlot()));
1068  return;
1069  }
1070 
1071  QMessageBox box(QMessageBox::Critical, "Exit GUI", "Analysis is not (yet) shutdown correctly");
1072  QPushButton *wait_btn = box.addButton("Wait 10 s more", QMessageBox::AcceptRole);
1073  QAbstractButton *kill_btn = box.addButton("Kill analysis", QMessageBox::DestructiveRole);
1074  QAbstractButton *exit_btn = box.addButton("Exit immediately", QMessageBox::DestructiveRole);
1075  QAbstractButton *cancel_btn = box.addButton("Cancel quit", QMessageBox::RejectRole);
1076  box.setDefaultButton(wait_btn);
1077 
1078  box.exec();
1079 
1080  if (box.clickedButton() == wait_btn) {
1081  fCloseCounter = 100;
1082  QTimer::singleShot(100, this, SLOT(ForseCloseSlot()));
1083  return;
1084  }
1085 
1086  if ((box.clickedButton() == cancel_btn) || (box.clickedButton() == 0)) {
1087  std::cout << "Keep GUI running, press exit once again" << std::endl;
1088  return;
1089  }
1090 
1091  if (box.clickedButton() == kill_btn) {
1092  std::cout << "Killing analysis" << std::endl;
1093  TerminateAnalysis(false);
1094  }
1095 
1096  if (box.clickedButton() == exit_btn) {
1097  std::cout << "GUI closed with analysis still running - may lead to analysis task running forever" << std::endl;
1098  std::cout << "Please check running processes with \"ps\" and probably, kill analysis with \"killall go4analysis\" command" << std::endl;
1099  }
1100  }
1101  std::cout << "----- Exiting Go4 GUI now -----" << std::endl;
1102  gSystem->Exit( 0 );
1103 }
1104 
1106 {
1107  QFileDialog fd( this,
1108  "Select a ROOT file to open it in the Go4 Disk Browser",
1109  fLastFileDir,
1110  QString("Root files (*.root);;Root xml files (*.xml);;All files (*.*)"));
1111 
1112  fd.setFileMode( QFileDialog::ExistingFiles);
1113 
1114  if ( fd.exec() != QDialog::Accepted ) return;
1115 
1116  QStringList list = fd.selectedFiles();
1117  QStringList::Iterator it = list.begin();
1118  while( it != list.end() ) {
1119  QString fileName = *it;
1120  fLastFileDir = QFileInfo(fileName).absolutePath();
1121  Browser()->OpenFile(fileName.toLatin1().constData());
1122  ++it;
1123  }
1124 }
1125 
1127 {
1128  TGo4OpenRemoteDialog fd( this);
1129  if (fd.exec() != QDialog::Accepted) return;
1130 
1131  QString ftype = fd.GetFileType();
1132  QString host = fd.GetServer();
1133 
1134  QString urlpath;
1135  if(ftype.contains("root:"))
1136  urlpath = "root://" + host + "/";
1137  else
1138  if (ftype.contains("rfio:")) {
1139  if(!host.isEmpty())
1140  urlpath="rfio:" + host + ":/";
1141  else
1142  urlpath="rfio:/";
1143  } else
1144  if (ftype.contains("http:")) {
1145  if(!host.isEmpty())
1146  urlpath="http://" + host + "/";
1147  else
1148  urlpath="http://";
1149  }
1150 
1151  QString fileName = fd.GetFileName();
1152 
1153  if(!fileName.isEmpty() && !fileName.contains(".root"))
1154  fileName.append(".root");
1155 
1156  fileName = urlpath + fileName;
1157 
1158  fxOM->AddFile(fOMDataPath.toLatin1().constData(), fileName.toLatin1().constData());
1159 }
1160 
1162 {
1163  bool ok = false;
1164  QString dabcnode = QInputDialog::getText(
1165  this, "Establish connection with DABC", "Provide dabc server name",
1166  QLineEdit::Normal, QString::null, &ok);
1167  if (!ok) return;
1168 
1169  if (!Browser()->ConnectDabc(dabcnode.toLatin1().constData()))
1170  QMessageBox::warning(0, "DABC server", "Cannot connect to DABC server");
1171 }
1172 
1173 TGo4ServerProxy* TGo4MainWindow::ConnectHttpSlot(const char* addr, const char* user, const char* pass, bool with_qt_process, bool get_analysis_config)
1174 {
1175  QString httpaddr;
1176 
1177  if (addr==0) {
1178  bool ok = false;
1179  QString portstring;
1180  QString fulladdress = go4sett->getClientNode().append(QString(":")).append(portstring.setNum(go4sett->getClientPort()));
1181  httpaddr = QInputDialog::getText(
1182  this, "Establish connection with HTTP", "Provide http server name",
1183  QLineEdit::Normal, fulladdress, &ok);
1184  if (!ok) return 0;
1185  QStringList nameportlist = httpaddr.split(":");
1186  int nameindex=0;
1187  int portindex=1;
1188  if(nameportlist.at(0).contains("http")) {
1189  nameindex=1;
1190  portindex=2;
1191  }
1192  // first check here if we have valid port number:
1193  if(nameportlist.size()<portindex+1 || nameportlist.at(portindex).isEmpty()){
1194  QMessageBox::warning(0, "HTTP server connection", "Could not connect. Please specify port number!");
1195  return 0;
1196  }
1197  QString host = nameportlist.at(nameindex);
1198  QStringList hostnamelist = nameportlist.at(nameindex).split("//");
1199  if(hostnamelist.size()>1) host = hostnamelist.at(1); // get rid of optional leading // of full http adress
1200  go4sett->setClientNode(host);
1201  go4sett->setClientPort(nameportlist.at(portindex).toInt());
1203 
1204  } else {
1205  httpaddr = addr;
1206  }
1207 
1209 
1210  if (!exec) return 0;
1211 
1212  TGo4ServerProxy* serv = exec->ConnectHttp(httpaddr.toLatin1().constData(), user, pass);
1213 
1214  if (serv) StatusMessage(QString("Connect with http server %1 %2").arg(httpaddr).arg(serv->IsGo4Analysis() ? " as GO4 analysis" : ""));
1215 
1216  if (serv && serv->IsGo4Analysis()) {
1217  EstablishRatemeter(2);
1218  if (!serv->IsViewer()) {
1219  EstablishAnalysisConfiguration(get_analysis_config ? 3 : 2);
1220  }
1221 
1222 
1223  TGo4LogInfo* loginfo = (TGo4LogInfo*) FindGo4Widget("LogInfo", false);
1224  if (loginfo!=0) loginfo->WorkWithInfo(serv->LoginfoSlot());
1225 
1226  if (!with_qt_process) EstablishAnalysisWindowForHttp();
1227  }
1228 
1229  return serv;
1230 }
1231 
1232 
1234 {
1235  TGo4HServerConnection dlg( this, "Connect to remote HServer", true );
1236 
1237  dlg.ServerName->setText(go4sett->getHServName());
1238  dlg.BaseName->setText(go4sett->getHServBase());
1239  dlg.FilterList->setText(go4sett->getHServFilter());
1240  dlg.PortNumberSpin->setValue(go4sett->getHServPort());
1241 
1242  if (dlg.exec() != QDialog::Accepted) return;
1243 
1244  go4sett->setHServName(dlg.ServerName->text());
1245  go4sett->setHServBase(dlg.BaseName->text());
1246  go4sett->setHServFilter(dlg.FilterList->text());
1247  go4sett->setHServPort(dlg.PortNumberSpin->value());
1248 
1249  if (!Browser()->ConnectHServer(dlg.ServerName->text().toLatin1().constData(),
1250  dlg.PortNumberSpin->value(),
1251  dlg.BaseName->text().toLatin1().constData(),
1252  dlg.UserPassEdt->text().toLatin1().constData(),
1253  dlg.FilterList->text().toLatin1().constData()))
1254  QMessageBox::warning(0, "HServer", "Cannot connect to histogram server");
1255 }
1256 
1258 {
1259  QFileDialog fd(this,
1261  "Select root file to fetch and export all browser objects" :
1262  "Select root file to export all local browser objects",
1263  fLastFileDir, "ROOT (*.root)");
1264 
1265  fd.setFileMode( QFileDialog::AnyFile);
1266  fd.setAcceptMode(QFileDialog::AcceptSave);
1267  fd.selectFile("export.root");
1268 
1269  if (fd.exec() != QDialog::Accepted) return;
1270 
1271  QStringList flst = fd.selectedFiles();
1272  if (flst.isEmpty()) return;
1273 
1274  QString fname = flst[0];
1275  fLastFileDir = fd.directory().path();
1276  if (fname.indexOf(".root", 0, Qt::CaseInsensitive)<0) fname+=".root";
1277 
1278  if (!Browser()->SaveBrowserToFile(fname.toLatin1().constData(), go4sett->getFetchDataWhenSave()))
1279  QMessageBox::warning(this, "Save data to file", "Specified file can not be created");
1280 }
1281 
1283 {
1284  fxOM->CloseFiles(fOMDataPath.toLatin1().constData());
1285 }
1286 
1288 {
1289  int size = go4sett->getTermHistorySize();
1290 
1291  bool ok;
1292 
1293 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
1294  size = QInputDialog::getInt(this,
1295  "Analysis terminal history size in bytes (minimum 10000 bytes)",
1296  "Input 0 if full analysis history should be preserved",
1297  size, 0, 100000000, 10000, &ok);
1298 #else
1299  size = QInputDialog::getInteger(this,
1300  "Analysis terminal history size in bytes (minimum 10000 bytes)",
1301  "Input 0 if full analysis history should be preserved",
1302  size, 0, 100000000, 10000, &ok);
1303 #endif
1304 
1305 
1306  if ((size>0) && (size<10000)) size = 10000;
1307 
1308  if (ok) {
1309  go4sett->setTermHistorySize(size);
1311  if (anw!=0)
1312  anw->SetHistorySize(size);
1313  }
1314 }
1315 
1317 {
1318  TGo4LogSettings dlg;
1319  if (dlg.exec() != QDialog::Accepted) return;
1320 
1321  if(dlg.LogfileWrite->isChecked())
1322  TGo4Log::OpenLogfile(dlg.LogfileName->text().toLatin1().constData(), "Logfile for Go4 GUI", true);
1323 
1324  TGo4Log::LogfileEnable(dlg.LogfileWrite->isChecked());
1325  TGo4Log::OutputEnable(dlg.LogfilePrint->isChecked());
1326  TGo4Log::SetIgnoreLevel(dlg.IgnoreCombo->currentIndex());
1327  TGo4Log::AutoEnable(dlg.ModeCombo->currentIndex());
1328 }
1329 
1330 void TGo4MainWindow::HelpWindow(const char* filename, const char* msg)
1331 {
1332  QApplication::setOverrideCursor( Qt::WaitCursor );
1333 
1334  QString surl = TGo4Log::subGO4SYS(filename).Data();
1335 
1336  bool result = QDesktopServices::openUrl(QUrl::fromLocalFile(surl));
1337 
1338  if(result)
1339  StatusMessage(msg ? QString(msg) : QString("Show ") + filename);
1340  else
1341  StatusMessage(QString("Fail to display ") + filename);
1342 
1343  QApplication::restoreOverrideCursor();
1344 }
1345 
1347 {
1348  HelpWindow("docs/Go4Introduction.pdf", "Show Go4 Introduction manual...");
1349 }
1350 
1352 {
1353  HelpWindow("docs/Go4Reference.pdf", "Show Go4 Reference manual...");
1354 }
1355 
1357 {
1358  HelpWindow("docs/Go4FitTutorial.pdf", "Show Go4 Fit tutorial...");
1359 }
1360 
1362 {
1364  go4sett->setAppFont(QApplication::font());
1365 
1366  go4sett->setAppStyle(QApplication::style()->objectName());
1367 
1369 
1370  go4sett->Store();
1371 
1372  std::cout <<"Save Qt settings to "<< go4sett->GetSettLoaction().toLatin1().constData() << std::endl;
1373 }
1374 
1376 {
1377  bool ok = false;
1378  QFont font= QFontDialog::getFont(&ok, QApplication::font(), this);
1379  if (!ok) return;
1380 
1381  go4sett->setAppFont(font);
1382 
1383  QApplication::setFont(font);
1384 }
1385 
1387 {
1388 
1389  bool ok = false;
1390  QFont font= QFontDialog::getFont(&ok, go4sett->getTermFont(), this);
1391  if (!ok) return;
1392 
1393  go4sett->setTermFont(font);
1394 
1396  if (anw) anw->setFont(font);
1397 }
1398 
1399 
1401 {
1404  if (anw!=0)
1405  anw->UpdateTimeStampFormat();
1406 }
1407 
1409 {
1410 
1411  bool ok = false;
1412  QString str = QInputDialog::getText(this, "Analysis terminal timestamp format",
1413  "Time format (empty resets to yyyy-MM-dd hh:mm:ss.zzz)",
1414  QLineEdit::Normal, go4sett->getTermTimeFormat(), &ok);
1415  if (ok)
1416  {
1417  if (str.isEmpty())
1418  str = "yyyy-MM-dd hh:mm:ss.zzz";
1419  go4sett->setTermTimeFormat(str);
1421  if (anw!=0)
1422  anw->UpdateTimeStampFormat();
1423  }
1424 }
1425 
1426 
1427 
1428 void TGo4MainWindow::SetStyleSlot(const QString &style)
1429 {
1430 /*
1431  QString infostring="Style "+style+" was selected.\n";
1432  infostring += "One can try to apply it immediately, but Qt crashed very often at that place :(\n";
1433  infostring += "One can save that style in settings and it will be applied next time Go4 is started";
1434 
1435  int res = QMessageBox::question( this, "Go4 GUI", infostring,
1436  QMessageBox::Apply | QMessageBox::Save | QMessageBox::Cancel ,
1437  QMessageBox::Save);
1438 
1439  if (res == QMessageBox::Cancel) return;
1440 */
1441  // save settings anyway
1442  go4sett->setAppStyle(style);
1443  go4sett->Store();
1444 
1445 // if (res == QMessageBox::Apply)
1446  QApplication::setStyle(style);
1447 }
1448 
1449 void TGo4MainWindow::StatusMessage(const QString& mess)
1450 {
1451  QString output = QDateTime::currentDateTime().toString(Qt::ISODate);
1452  output.append(": ");
1453  output.append(mess);
1454  statusBar()->showMessage(output, 0); // JAM2016: do not clear message after 3s. ratemeter will clear message on each update.
1456  TGo4Log::Message(1,output.toLatin1().constData());
1457 
1458  //UpdateCaptionButtons();
1459  // <- JAM2016: do not refresh ratemeter display immediately,
1460  // but give message a chance to appear a while!
1461 }
1462 
1464 {
1465  // JAM note this function is called by update timer from TGo4Browser each second
1466  TGo4ServerProxy* root_serv = Browser()->FindServer(0, kFALSE);
1467  TGo4ServerProxy* go4_serv = Browser()->FindServer();
1468  TGo4AnalysisProxy* pr = dynamic_cast<TGo4AnalysisProxy*>(go4_serv);
1469  TGo4HttpProxy* ht = dynamic_cast<TGo4HttpProxy*>(go4_serv);
1470 
1471  QString capt = "Go4 ";
1472  capt += __GO4RELEASE__;
1473  capt += " @";
1474  capt += gSystem->HostName();
1475  if ((go4_serv!=0) && go4_serv->IsConnected() ) {
1476  capt += " <";
1477  capt += go4_serv->GetContainedObjectInfo();
1478  capt += ">";
1479  }
1480  setWindowTitle(capt);
1481 
1482  bool flag = false;
1483  if (pr==0) flag = (ht==0 ? true: false) ;
1484  faLaunchAnal->setEnabled(flag);
1485  // JAM here check again ratemeter connection, if http server was disconnected by browser popup close item:
1486  EstablishRatemeter(flag? 0: 1);
1487  // need to check if the controller role has switched to another HTTP server here:
1488  static TGo4HttpProxy* oldhttp=0;
1489  if (ht) {
1490  // check for server names may not be unique if connected twice by chance, better use proxy pointers!
1491  if(ht!= oldhttp)
1492  {
1493  //printf("UpdateCaptionButtons sees new http server (0x%x), old (0x%x) \n", ht, oldhttp);
1494  oldhttp=ht;
1495  EstablishRatemeter(0);
1496  EstablishRatemeter(2);
1497  }
1498  }
1499 
1500  if (pr==0) flag = (ht==0 ? true: false) ;
1501  else flag = (fConnectingCounter<=0) && pr->IsAnalysisServer() && !pr->IsConnected();
1502  faConnectAnal->setEnabled(flag);
1503 
1504  faPrepareAnal->setEnabled(flag);
1505 
1506  if (pr==0) flag = (ht==0 ? false: true);
1507  else flag = pr->IsAnalysisServer() &&
1508  (pr->IsConnected() || (fConnectingCounter<=0));
1509  faDisconnectAnal->setEnabled(flag);
1510 
1511  flag = false;
1512  if (go4_serv)
1513  flag = !go4_serv->IsAnalysisServer() || (go4_serv->IsConnected() && go4_serv->IsAdministrator());
1514  faShutdownAnal->setEnabled(flag);
1515 
1516  bool iscontrolling(false), issubmit(false);
1517  if (go4_serv) {
1518  iscontrolling = go4_serv->IsConnected() && (go4_serv->IsAdministrator() || go4_serv->IsController());
1519  if (iscontrolling) issubmit = go4_serv->CanSubmitObjects();
1520  }
1521 
1522  faSumbStartAnal->setEnabled(issubmit);
1523 
1524  faStartAnal->setEnabled(iscontrolling);
1525 
1526  faStopAnal->setEnabled(iscontrolling);
1527 
1528  faAnalConfig->setEnabled(iscontrolling);
1529 
1530  faAnalTermin->setEnabled(FindAnalysisWindow()!=0);
1531 
1532  if ((go4_serv==0) && (root_serv!=0)) {
1533  faStartAnal->setEnabled(root_serv->FindCommand("Start").Length()>0);
1534  faStopAnal->setEnabled(root_serv->FindCommand("Stop").Length()>0);
1535  }
1536 }
1537 
1539 {
1541 }
1542 
1544 {
1546 }
1547 
1549 {
1551 }
1552 
1554 {
1556  UpdateBrowser();
1557 }
1558 
1560 {
1561  go4sett->setDrawOnceFlag(faDrawOnce->isChecked());
1562 
1563 }
1564 
1566 {
1568 }
1569 
1570 
1572 {
1573  QColor c = QColorDialog::getColor();
1574  if (c.isValid())
1575  go4sett->setCanvasColor(c.red(), c.green(), c.blue());
1576 }
1577 
1579 {
1580  TGo4MarkerSettings mset;
1581  if (mset.exec() != QDialog::Accepted) return;
1582  // all work is done inside dialog.
1583 }
1584 
1586 {
1587  TGo4OptStatsSettings stset;
1588  if (stset.exec() != QDialog::Accepted) return;
1589  // all work is done inside dialog.
1590 }
1591 
1593 {
1594  go4sett->setPadSuperimpose(faSuperimpose->isChecked());
1595 }
1596 
1597 
1599 {
1600  go4sett->setPadCrosshair(faCrosshair->isChecked());
1601 }
1602 
1604 {
1605  go4sett->setPadEventStatus(faEventstatus->isChecked());
1606 }
1607 
1609 {
1610  bool s = faClone->isChecked();
1611  faDrawTime->setEnabled(s);
1612  faDrawDate->setEnabled(s);
1613  faDrawItem->setEnabled(s);
1614  go4sett->setCloneFlag(s);
1615 }
1616 
1618 {
1619  go4sett->setDrawTimeFlag(faDrawTime->isChecked());
1620 }
1621 
1623 {
1624  go4sett->setDrawItemFlag(faDrawItem->isChecked());
1625 }
1626 
1628 {
1629  go4sett->setDrawDateFlag(faDrawDate->isChecked());
1630 }
1631 
1632 
1634 {
1636 }
1637 
1638 
1640 {
1641  int w = go4sett->getDrawLineWidth();
1642 
1643  bool ok = false;
1644 
1645 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
1646  w = QInputDialog::getInt(this,
1647  "Default line width for object drawing",
1648  "Input 1 to preserve default value",
1649  w, 1, 10, 1, &ok);
1650 #else
1651  w = QInputDialog::getInteger(this,
1652  "Default line width for object drawing",
1653  "Input 1 to preserve default value",
1654  w, 1, 10, 1, &ok);
1655 #endif
1656 
1657  if (ok) go4sett->setDrawLineWidth(w);
1658 }
1659 
1660 
1662 {
1663  int w = go4sett->getDrawFillColor();
1664 
1665  bool ok = false;
1666 
1667 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
1668  w = QInputDialog::getInt(this,
1669  "Default fill color for 1D objects (histogram and graph) drawing",
1670  "Input 0 for no fill",
1671  w, 0, 50, 1, &ok);
1672 #else
1673  w = QInputDialog::getInteger(this,
1674  "Default fill color for 1D objects (histogram and graph) drawing",
1675  "Input 0 for no fill",
1676  w, 0, 50, 1, &ok);
1677 #endif
1678 
1679  if (ok) go4sett->setDrawFillColor(w);
1680 }
1681 
1683 {
1684  int w = go4sett->getDrawFillStyle();
1685 
1686  bool ok = false;
1687 
1688 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
1689  w = QInputDialog::getInt(this,
1690  "Default fill style for 1D objects (histogram and graph) drawing",
1691  "Input 1001 for solid fill",
1692  w, 0, 4000, 1, &ok);
1693 #else
1694  w = QInputDialog::getInteger(this,
1695  "Default fill style for 1D objects (histogram and graph) drawing",
1696  "Input 1001 for solid fill",
1697  w, 0, 4000, 1, &ok);
1698 #endif
1699 
1700  if (ok) go4sett->setDrawFillStyle(w);
1701 }
1702 
1703 
1705 {
1706  bool ok = false;
1707  QString str = QInputDialog::getText(this,
1708  "Default draw options for TH1 class",
1709  "Input draw options",
1710  QLineEdit::Normal, go4sett->getTH1DrawOpt(), &ok);
1711  if (ok) go4sett->setTH1DrawOpt(str);
1712 }
1713 
1715 {
1716  bool ok = false;
1717  QString str = QInputDialog::getText(this,
1718  "Default draw options for TH2 class",
1719  "Input draw options",
1720  QLineEdit::Normal, go4sett->getTH2DrawOpt(), &ok);
1721  if (ok) go4sett->setTH2DrawOpt(str);
1722 }
1723 
1725 {
1726  bool ok = false;
1727  QString str = QInputDialog::getText(this,
1728  "Default draw options for TH3 class",
1729  "Input draw options",
1730  QLineEdit::Normal, go4sett->getTH3DrawOpt(), &ok);
1731  if (ok) go4sett->setTH3DrawOpt(str);
1732 }
1733 
1735 {
1736  bool ok = false;
1737  QString str = QInputDialog::getText(this,
1738  "Default draw options for TGraph class",
1739  "Input draw options",
1740  QLineEdit::Normal, go4sett->getTGraphDrawOpt(), &ok);
1741  if (ok)
1742  go4sett->setTGraphDrawOpt(str);
1743 }
1744 
1745 
1747 {
1748  bool ok = false;
1749  QString s0 = go4sett->getGStyleStatFormat();
1750  if (s0.isEmpty()) s0 = gStyle->GetStatFormat();
1751 
1752  QString str = QInputDialog::getText(this,
1753  "Printf argument for float values - gStyle->GetStatFormat()",
1754  "Input format string like 6.4g (empty - ROOT default)",
1755  QLineEdit::Normal, s0, &ok);
1756  if (ok) {
1758  if (str.isEmpty())
1759  gStyle->SetStatFormat();
1760  else
1761  gStyle->SetStatFormat(str.toLatin1().constData());
1762  }
1763 }
1764 
1765 
1767 {
1768  // JAM: later we might put some elaborate input dialog here. for the moment keep on with parsing a string-
1769  bool ok = false;
1770  int min=0, def=0, max =0;
1771  QString palvals;
1772  go4sett->getPaletteOpt(min,def,max);
1773  palvals.sprintf("%d:%d:%d",min,def,max);
1774  QString str = QInputDialog::getText(this,
1775  "Default Palette options",
1776  "Input - MinIndex:DefaultIndex:MaxIndex",
1777  QLineEdit::Normal, palvals, &ok);
1778  if (ok) {
1779  QStringList parts=str.split(":");
1780  min=parts[0].toInt();
1781  def=parts[1].toInt();
1782  max=parts[2].toInt();
1783 // std::cout <<"PaletteSettingsSlot has "<<min<<":"<<def<<":"<<max <<std::endl;
1784  go4sett->setPaletteOpt(min,def,max);
1785  // activate settings immediately, do not need to restart go4
1786  fxStyle->SetPaletteRange(min,def,max);
1787  }
1788 }
1789 
1790 
1792 {
1793 #if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
1794  double w = go4sett->getScreenScaleFactor();
1795 
1796  bool ok = false;
1797 
1798  w = QInputDialog::getDouble(this,
1799  "HighDPI scaling",
1800  "Please set scale factor. Restart GUI to apply!",
1801  w, 0, 50, 1, &ok);
1802  if (ok) go4sett->setScreenScaleFactor(w);
1803 #endif
1804 }
1805 
1806 
1807 
1808 void TGo4MainWindow::LaunchClientSlot(bool interactive)
1809 {
1810  TGo4AnalysisProxy* anal = Browser()->FindAnalysis();
1811  if (anal!=0) {
1812  QMessageBox::warning(this, "Launch analysis", "Please disconnect analysis first");
1813  return;
1814  }
1815 
1816  if (interactive) {
1817  TGo4StartClient dlg;
1818  if (dlg.exec()!=QDialog::Accepted) return;
1819  dlg.getResults();
1820  }
1821 
1822  int shellmode = go4sett->getClientShellMode();
1823  int termmode = go4sett->getClientTermMode();
1824  int isserver = go4sett->getClientIsServer();
1825 
1826  TString launchcmd, killcmd;
1827  Bool_t res = kFALSE;
1828 
1829  QString workdir = go4sett->getClientDir();
1830 
1831  if (isserver==2) {
1832  // first handle http connection
1833 
1834  QString addr = QString("%1:%2").arg(go4sett->getClientNode()).arg(go4sett->getClientPort());
1835 
1836  // first verify that http server already running with such address
1837  // need to request analysis status anyway
1838  if (ConnectHttpSlot(addr.toLatin1().constData(),0,0,false, true )!=0) {
1839  StatusMessage("Connected to exisiting analysis webserver!"); // JAM tell user that this is no analysis restart!
1840  std::cout<< "!!! Connected to exisiting analysis webserver "<<addr.toLatin1().constData()<< "!!! "<<std::endl; // status message is shadowed by ratemeters....
1841  return;
1842  }
1843 
1844  res = TGo4ServerProxy::GetLaunchString(launchcmd, killcmd,
1845  2, shellmode, termmode,
1846  go4sett->getClientName().toLatin1().constData(),
1847  go4sett->getClientNode().toLatin1().constData(),
1848  workdir.toLatin1().constData(),
1849  go4sett->getClientExec().toLatin1().constData(),
1852  go4sett->getClientArgs().toLatin1().constData());
1853 
1854  if (!res) return;
1855 
1856  fKillCommand = killcmd.Data();
1857 
1858  if ((termmode==2) || (termmode==3)) {
1859  gSystem->Exec(launchcmd.Data());
1860  } else {
1861  TGo4AnalysisWindow* anw = EstablishAnalysisWindow(true, true, true);
1862  anw->StartAnalysisShell(launchcmd.Data(), (shellmode==0) ? workdir.toLatin1().constData() : 0, true);
1863  }
1864 
1865  fConnectingCounter = 100; // try next 10 seconds connect with the server
1866  fConnectingHttp = addr;
1867  fbGetAnalysisConfig=true; // pass to timer that we want to have analysis config window when ready JAM
1868  QTimer::singleShot(100, this, SLOT(CheckConnectingCounterSlot()));
1869 
1870  return;
1871  }
1872 
1873  if (isserver==0) {
1874  TGo4AnalysisProxy* anal = AddAnalysisProxy(false, (termmode==1));
1875  if (anal!=0)
1876  res = anal->LaunchAsClient(launchcmd, killcmd,
1877  shellmode,
1878  termmode,
1879  go4sett->getClientName().toLatin1().constData(),
1880  go4sett->getClientNode().toLatin1().constData(),
1881  workdir.toLatin1().constData(),
1882  go4sett->getClientExec().toLatin1().constData(),
1884  go4sett->getClientArgs().toLatin1().constData());
1886  if (res && (anw!=0) && (termmode==1)) {
1887  anw->StartAnalysisShell(launchcmd.Data(), (shellmode==0) ? workdir.toLatin1().constData() : 0, false);
1888  }
1889  if (res && (anal!=0)) anal->SetAnalysisLaunched(termmode==1 ? 2 : 1);
1890  } else {
1891  res = TGo4AnalysisProxy::LaunchAsServer(launchcmd, killcmd,
1892  shellmode,
1893  termmode,
1894  go4sett->getClientName().toLatin1().constData(),
1895  go4sett->getClientNode().toLatin1().constData(),
1897  workdir.toLatin1().constData(),
1898  go4sett->getClientExec().toLatin1().constData(),
1900  go4sett->getClientArgs().toLatin1().constData());
1901  }
1902 
1903  if (res)
1904  fKillCommand = killcmd.Data();
1905  else
1906  fKillCommand = "";
1907 
1908  StatusMessage("Starting Analysis.... Please wait");
1909 
1910  if ((isserver==1) && interactive) {
1911  fbGetAnalysisConfig=true; // pass to timer that we want to have analysis config window when ready JAM
1912  ConnectServerSlot(true, "");
1913  }
1914 }
1915 
1917 {
1918  TGo4AnalysisProxy* ana = AddAnalysisProxy(false, false);
1919  if ((ana!=0) && interactive)
1920  QMessageBox::information(this,"Prepare for client connection",
1921  "Now you can start client from other shell (node) and connect to port " +
1922  QString::number(ana->ConnectorPort()), "Ok");
1923 }
1924 
1925 TGo4AnalysisWindow* TGo4MainWindow::EstablishAnalysisWindow(bool needoutput, bool withkillbnt, bool force_recreate)
1926 {
1928  if (anw!=0)
1929  if (force_recreate || (anw->HasOutput() && !needoutput)) {
1930  delete anw;
1931  anw = 0;
1932  }
1933 
1934  if (anw==0)
1935  if (needoutput) {
1936  anw = new TGo4AnalysisWindow(fxMdiArea, "AnalysisWindow", true);
1937  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(anw);
1938  sub->resize(go4sett->lastPanelSize("AnalysisWindow", 700, 500));
1939  CascadeMdiPosition(sub);
1940  ConnectGo4Widget(anw);
1941  anw->ensurePolished();
1942  sub->show();
1943  } else {
1944  QToolBar* dock = addToolBar("Analysis control");
1945  dock->setObjectName("AnalysisControlBar");
1946  anw = new TGo4AnalysisWindow(this, "AnalysisWindow", false, withkillbnt || fKillCommand.length()>0);
1947  ConnectGo4Widget(anw);
1948  dock->addWidget(anw);
1949  }
1950 
1951  return anw;
1952 }
1953 
1955 {
1956  // used together with http server connection
1957  // analysis window only created when not exists and http proxy is available
1958 
1959  TGo4ServerProxy* serv = Browser()->FindServer();
1960  if ((serv==0) || (dynamic_cast<TGo4AnalysisProxy*>(serv)!=0) || (serv->DebugOutputSlot()==0)) return;
1961 
1963 
1964  if (anw) {
1965  if (anw->HasLink()) return;
1966  delete anw;
1967  anw = 0;
1968  }
1969 
1970  anw = EstablishAnalysisWindow(true, false);
1971  if (anw) anw->WorkWithDebugOutput(serv->DebugOutputSlot());
1972  serv->ResetDebugOutputRequests();
1973 }
1974 
1975 
1976 TGo4AnalysisProxy* TGo4MainWindow::AddAnalysisProxy(bool isserver, bool needoutput)
1977 {
1978  const char* analisysitem = "Analysis";
1979 
1980  TGo4Slot* analslot = Browser()->DataSlot(analisysitem);
1981 
1982  if (analslot==0) {
1983  TGo4AnalysisProxy* anal = new TGo4AnalysisProxy(isserver);
1984  fxOM->AddProxy(fOMDataPath.toLatin1().constData(), anal, analisysitem, "Analysis proxy");
1985  analslot = Browser()->DataSlot(analisysitem);
1986  anal->SetDefaultReceiver(fxOM, TString("gui/") + analisysitem + "/");
1987  }
1988 
1989  TGo4AnalysisProxy* anal = (analslot==0) ? 0 :
1990  dynamic_cast<TGo4AnalysisProxy*> (analslot->GetProxy());
1991 
1992  if (anal==0) return 0;
1993 
1994  anal->SetAnalysisReady(kFALSE);
1995 
1996  TGo4LogInfo* loginfo = (TGo4LogInfo*) FindGo4Widget("LogInfo", false);
1997  if (loginfo!=0)
1998  loginfo->WorkWithInfo(anal->LoginfoSlot());
1999 
2000  if (anal->IsAnalysisServer())
2001  EstablishRatemeter(anal->IsConnected() ? 2 : 0);
2002  else
2003  EstablishRatemeter(1);
2004 
2006 
2008 
2010  if (anw!=0)
2011  if (anw->HasOutput() && !needoutput) {
2012  delete anw;
2013  anw = 0;
2014  }
2015 
2016  if(anw==0)
2017  if (needoutput) {
2018  anw = EstablishAnalysisWindow(true);
2019  if (anw) anw->WorkWithUpdateObjectCmd(anal->UpdateObjectSlot());
2020  } else {
2022  }
2023 
2024  return anal;
2025 }
2026 
2027 bool TGo4MainWindow::RemoveAnalysisProxy(int waittime, bool servershutdown)
2028 {
2029  // Browser()->ToggleMonitoring(0);
2031  EstablishRatemeter(0);
2032 
2033  // TGo4AnalysisProxy* anal = Browser()->FindAnalysis();
2034  TGo4ServerProxy* srv = Browser()->FindServer();
2035  if (srv!=0) {
2036  srv->DisconnectAnalysis(waittime, servershutdown);
2037  }
2038  // TGo4Slot* slot = Browser()->FindServerSlot(kTRUE, 1);
2039  // it is allowed to delete slot directly
2040  //if (slot) delete slot;
2041 
2042  return Browser()->FindServer()==0;
2043 }
2044 
2046 {
2048  TGo4AnalysisProxy* anal = Browser()->FindAnalysis();
2049 
2050  if ((anw!=0) && anw->HasOutput()) return;
2051 
2052  bool shouldexists = false;
2053  if (anal!=0)
2054  if (anal->IsAnalysisServer()) {
2055  if (anal->IsConnected() && (anal->IsController() || anal->IsAdministrator()))
2056  shouldexists = true;
2057  } else {
2058  shouldexists = true;
2059  }
2060 
2061  if (shouldexists && (anw==0)) {
2062  anw = EstablishAnalysisWindow(false, !anal->IsAnalysisServer());
2063  if (anw) anw->WorkWithUpdateObjectCmd(anal->UpdateObjectSlot());
2064  }
2065 }
2066 
2067 TGo4AnalysisStatusMonitor* TGo4MainWindow::EstablishRatemeter(int level)
2068 // level = 0 - delete
2069 // level = 1 - as is
2070 // level = 2 - create
2071 {
2072  //std::cout<<"EstablishRatemeter with level "<<level << std::endl;
2073 
2074 
2075 
2076  TGo4AnalysisStatusMonitor* status =
2077  dynamic_cast<TGo4AnalysisStatusMonitor*>
2078  (FindGo4Widget("AnalysisStatusMonitor", false));
2079 
2080  if (level==2) {
2081  if (status==0) {
2082  status = new TGo4AnalysisStatusMonitor(statusBar(), "AnalysisStatusMonitor");
2083  ConnectGo4Widget(status);
2084  statusBar()->addWidget(status);
2085  TGo4ServerProxy* serv = Browser()->FindServer();
2086  if (serv!=0)
2087  status->WorkWithRatemeter(serv->RatemeterSlot());
2088  }
2089  } else
2090  if (level==0) {
2091  if (status!=0) {
2092  status->RemoveLink("Ratemeter",true); // JAM: need to remove the update link before deleting!
2093  statusBar()->removeWidget(status);
2094  delete status;
2095  }
2096  status = 0;
2097  }
2098 
2099  if (status!=0)
2100  status->show();
2101 
2102  return status;
2103 }
2104 
2105 TGo4AnalysisConfiguration* TGo4MainWindow::EstablishAnalysisConfiguration(int level)
2106 {
2107  // level: 0 - delete, 1 - keep as is, 2 - create, 3 - create + request status
2108 
2109  TGo4AnalysisConfiguration* conf = FindAnalysisConfiguration();
2110 
2111  if (level==0) {
2112  if (conf!=0) {
2113  delete conf->parentWidget();
2114  conf = 0;
2115  }
2116  } else
2117  if (level>=2) {
2118  if (conf==0) {
2119  conf = new TGo4AnalysisConfiguration(fxMdiArea, "AnalysisConfiguration");
2120  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(conf);
2121  CascadeMdiPosition(sub);
2122  ConnectGo4Widget(conf);
2123  // ! do not show configuration window before analysis settings requested
2124  // conf->ensurePolished();
2125  // sub->show();
2126  }
2127  TGo4ServerProxy* anal = Browser()->FindServer();
2128  if (anal!=0) {
2129  conf->WorkWithAnalysis(anal);
2130  if (level>2) anal->RequestAnalysisSettings();
2131  }
2132  }
2133 
2134  return conf;
2135 }
2136 
2137 
2138 void TGo4MainWindow::ConnectServerSlot(bool interactive, const char* password)
2139 {
2140  if (fConnectingCounter>0) return;
2141  TGo4AnalysisProxy* anal = Browser()->FindAnalysis();
2142  if (anal!=0) {
2143  if (anal->IsConnected() || !anal->IsAnalysisServer()) {
2144  if (interactive)
2145  QMessageBox::warning(this, "Connect client", "Analysis task is already connected");
2146  return;
2147  }
2148  }
2149 
2150  QString pass = password;
2151  if (interactive) {
2152  TGo4ConnectServer dlg;
2153  if (fLastPassword.length()>0)
2154  dlg.setPassword(fLastPassword.toLatin1().constData());
2155  if (dlg.exec()!=QDialog::Accepted) return;
2156  pass = dlg.getInput();
2157  }
2158  // here check if we want web server or regular connection:
2159 
2160  if(go4sett->getClientConnectMode()==0)
2161  {
2162  if (anal==0) anal = AddAnalysisProxy(true, false);
2163  bool def = go4sett->getClientDefaultPass();
2164  if (!def) fLastPassword = pass;
2165 
2166  if (anal!=0)
2167  anal->ConnectToServer(go4sett->getClientNode().toLatin1().constData(),
2170  def ? 0 : pass.toLatin1().constData());
2171  StatusMessage("Connecting running analysis.... Please wait");
2172 
2173  // wait about 4 sec that analysis is connected
2174  fConnectingCounter = 41;
2177  }
2178  else
2179  {
2180  QString portstring;
2181  QString fulladdress = go4sett->getClientNode().append(QString(":")).append(portstring.setNum(go4sett->getClientPort()));
2182  //std::cout << " try to connect to server: "<<fulladdress.toLatin1().constData() << std::endl;
2183  QString msg("Connecting analysis http server at ");
2184  msg.append(fulladdress).append(QString(", Please wait"));
2185  StatusMessage(msg);
2186  ConnectHttpSlot(fulladdress.toLatin1().constData(),
2187  go4sett->getClientAccountName().toLatin1().constData(),
2188  pass.toLatin1().constData(), false, false);
2190  }
2191 }
2192 
2194 {
2195  if (fConnectingHttp.length() > 0) {
2196  TGo4ServerProxy *serv =
2197  ConnectHttpSlot(fConnectingHttp.toLatin1().constData(), 0, 0, go4sett->getClientTermMode()==1,fbGetAnalysisConfig);
2198  if (serv != 0) {
2199  serv->SetAnalysisLaunched(go4sett->getClientTermMode()==1 ? 2 : 1);
2200  fConnectingHttp = "";
2201  fConnectingCounter = 0;
2202  fbGetAnalysisConfig=false;
2203  return;
2204  }
2205  if (--fConnectingCounter<=0) {
2206  StatusMessage(fConnectingHttp + " refused connection. Try again");
2207  fConnectingHttp = "";
2208  fConnectingCounter = 0;
2209  fbGetAnalysisConfig=false;
2210  return;
2211  }
2212  } else {
2213  TGo4AnalysisProxy* anal = Browser()->FindAnalysis();
2214  if ((anal==0) || anal->IsConnected() || (--fConnectingCounter<=0)) {
2215  if (fConnectingCounter<=0)
2216  StatusMessage("Analysis refused connection. Try again");
2217  fConnectingCounter = 0;
2218  EstablishRatemeter((anal!=0) && anal->IsConnected() ? 2 : 0);
2219  int level=0;
2220  if((anal!=0) && anal->IsConnected() && (anal->IsController() || anal->IsAdministrator()))
2221  {
2223  {
2224  level=3;
2225  fbGetAnalysisConfig=false;
2226  }
2227  else
2228  {
2229  level=2;
2230  }
2231  }
2235  if ((anal!=0) && !anal->IsConnected()) RemoveAnalysisProxy(1);
2236  return;
2237  }
2238  }
2239  QTimer::singleShot(100, this, SLOT(CheckConnectingCounterSlot()));
2240 }
2241 
2243 {
2244  TGo4ServerProxy* serv = Browser()->FindServer();
2245  if (serv==0) return;
2246 
2247  bool shutdown = serv->IsAnalysisLaunched() > 1;
2248 
2249  if (interactive) {
2250 
2251  if (shutdown) {
2252 
2253  QMessageBox msgBox(
2254  QMessageBox::Warning,
2255  "Disconnect from analysis",
2256  "Analysis runs inside go4 widget.\n"
2257  "If one only disconnects from the analysis,\n"
2258  "it remains invisible and difficult to stop.\n"
2259  "To shutdown it later, one need to reconnect with go4 gui again.\""
2260  "It is recommended to shutdown analysis now",
2261  QMessageBox::Ok | QMessageBox::Close | QMessageBox::Abort);
2262 
2263  msgBox.setButtonText(QMessageBox::Ok, "Shutdown");
2264  msgBox.setButtonText(QMessageBox::Close, "Disconnect");
2265  msgBox.setButtonText(QMessageBox::Abort, "Cancel");
2266 
2267  switch (msgBox.exec()) {
2268  case QMessageBox::Ok: shutdown = true; break;
2269  case QMessageBox::Close: shutdown = false; break;
2270  default: return;
2271  }
2272  } else {
2273  if (QMessageBox::warning(this, "Disconnect analysis",
2274  QString("Really disconnect from analysis task?"),
2275  QString("Disconnect"),
2276  QString("Cancel"),
2277  QString::null, 0)!=0) return;
2278  }
2279  }
2280  RemoveAnalysisProxy(30, shutdown);
2281  StatusMessage("Disconnect analysis");
2282 }
2283 
2285 {
2286  if (interactive) {
2287  int res = QMessageBox::warning(this, "Shutdown analysis",
2288  QString("Really shutdown analysis task?"),
2289  QString("Shutdown"),
2290  QString("Cancel"),
2291  QString::null, 0);
2292  if (res!=0) return;
2293  }
2294  TGo4ServerProxy* srv = Browser()->FindServer();
2295  if (srv==0) return;
2296  bool realshutdown = false;
2297  TGo4AnalysisProxy* anal = dynamic_cast<TGo4AnalysisProxy*> (srv);
2298  TGo4HttpProxy* http = dynamic_cast<TGo4HttpProxy*>(srv);
2299  if (anal)
2300  realshutdown = anal->IsAnalysisServer() &&
2301  anal->IsConnected() &&
2302  anal->IsAdministrator();
2303  else if (http)
2304  realshutdown = http->IsConnected() && http->IsAdministrator();
2305 
2306  RemoveAnalysisProxy(30, realshutdown);
2307  StatusMessage("Shutdown analysis");
2308 }
2309 
2311 {
2312  TGo4ServerProxy* serv = Browser()->FindServer();
2313  if (serv==0) return false;
2314 
2315  if (serv->IsConnected() && serv->CanSubmitObjects() &&
2316  (serv->IsAdministrator() || serv->IsController())) {
2317  serv->SubmitAnalysisSettings();
2318  serv->RefreshNamesList();
2319  StatusMessage("Press Ctrl+S or choose Analysis->Start from the Menu to start the analysis");
2320  return true;
2321  }
2322 
2323  return false;
2324 }
2325 
2327 {
2328  if (SubmitAnalysisSettings())
2330 }
2331 
2333 {
2334  TGo4ServerProxy* go4_serv = Browser()->FindServer();
2335  if (go4_serv!=0) {
2336  go4_serv->StartAnalysis();
2337  go4_serv->RefreshNamesList();
2338  go4_serv->DelayedRefreshNamesList(4);
2339  EstablishRatemeter(2);
2340  } else {
2341  TGo4ServerProxy* root_serv = Browser()->FindServer(0, kFALSE);
2342  if (root_serv) {
2343  TString cmd = root_serv->FindCommand("Start");
2344  if (cmd.Length()>0) {
2345  root_serv->SubmitCommand(cmd);
2346  StatusMessage(TString::Format("Submit %s command to the server", cmd.Data()).Data());
2347  }
2348  }
2349  }
2350 }
2351 
2353 {
2354  TGo4ServerProxy* go4_serv = Browser()->FindServer();
2355  if (go4_serv) {
2356  go4_serv->StopAnalysis();
2357  } else {
2358  TGo4ServerProxy* root_serv = Browser()->FindServer(0, kFALSE);
2359  if (root_serv) {
2360  TString cmd = root_serv->FindCommand("Stop");
2361  if (cmd.Length()>0) {
2362  root_serv->SubmitCommand(cmd);
2363  StatusMessage(TString::Format("Submit %s command to the server", cmd.Data()).Data());
2364  }
2365  }
2366  }
2367 }
2368 
2370 {
2371  if (interactive) {
2372  int res = QMessageBox::warning(this, "Kill analysis process",
2373  QString("Kill analysis by shell command: ") +fKillCommand + " ?",
2374  QString("Kill"),
2375  QString("Cancel"),
2376  QString::null, 0);
2377  if (res!=0) return;
2378  }
2379 
2381  if (anw!=0) anw->TerminateAnalysisProcess();
2382 
2383  // proxy will be deleted after 7 second
2384  //RemoveAnalysisProxy(7);
2385 
2386  anw = FindAnalysisWindow();
2387  if (anw!=0)
2388  anw->AppendOutputBuffer(QString("\nKilling analysis client: \n ")+fKillCommand, 2);
2389  else
2390  StatusMessage(QString("Killing analysis client with: ")+fKillCommand);
2391 
2392  if (fKillCommand.length()>0) {
2393  QProcess* killprocess = new QProcess;
2394  killprocess->start(fKillCommand);
2395  QTimer::singleShot(10000, killprocess, SLOT(deleteLater()));
2396  } else
2397  StatusMessage("Can not kill analysis. Do it by OS commands");
2398 
2400 
2401  EstablishRatemeter(0);
2402 }
2403 
2404 QGo4Widget* TGo4MainWindow::FindGo4Widget(const char* name, bool activate)
2405 {
2406  if (fxOM==0) return 0;
2407 
2408  TGo4Slot* slot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
2409 
2410  TGo4Slot* widgslot = slot==0 ? 0 : slot->FindChild(name);
2411  if (widgslot==0) return 0;
2412 
2413  TGo4WidgetProxy* wproxy = (TGo4WidgetProxy*) widgslot->GetProxy();
2414 
2415  QGo4Widget* widg = wproxy->GetWidget();
2416  if ((widg!=0) && activate) {
2417  if(!widg->isVisible()){
2418  widg->raise();
2419  widg->show();
2420  widg->setFocus();
2421  }
2422  }
2423 
2424  return widg;
2425 }
2426 
2427 
2429 {
2430  TGo4FitPanel* fitpanel = (TGo4FitPanel*) FindGo4Widget("FitPanel", true);
2431 
2432  if (fitpanel==0) {
2433  fitpanel = new TGo4FitPanel(fxMdiArea,"FitPanel");
2434  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(fitpanel);
2435  CascadeMdiPosition(sub);
2436  ConnectGo4Widget(fitpanel);
2437  fitpanel->ensurePolished();
2438  sub->show();
2439  } else {
2440  fitpanel->parentWidget()->showNormal();
2441  fitpanel->setFocus();
2442  }
2443  return fitpanel;
2444 }
2445 
2447 {
2448  TGo4HistogramInfo* hinfo = (TGo4HistogramInfo*) FindGo4Widget("HistogramInfo", true);
2449  if (hinfo==0) {
2450  hinfo = new TGo4HistogramInfo(fxMdiArea, "HistogramInfo");
2451  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(hinfo);
2452  CascadeMdiPosition(sub);
2453  ConnectGo4Widget(hinfo);
2454  hinfo->ensurePolished();
2455  hinfo->adjustSize();
2456  sub->show();
2457  }
2458  return hinfo;
2459 }
2460 
2462 {
2463  TGo4ConditionInfo* cinfo = (TGo4ConditionInfo*) FindGo4Widget("ConditionInfo", true);
2464  if (cinfo==0) {
2465  cinfo = new TGo4ConditionInfo(fxMdiArea, "ConditionInfo");
2466  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(cinfo);
2467  CascadeMdiPosition(sub);
2468  ConnectGo4Widget(cinfo);
2469  cinfo->ensurePolished();
2470  cinfo->adjustSize();
2471  sub->show();
2472  }
2473  return cinfo;
2474 }
2475 
2477 {
2478  TGo4LoadedLibraries llib(this);
2479  llib.exec();
2480 
2481  UpdateBrowser();
2482 }
2483 
2485 {
2486  TGo4Browser* br = (TGo4Browser*) FindGo4Widget("Browser", false);
2487  if (br!=0) br->ShootUpdateTimer();
2488 }
2489 
2490 
2491 TGo4ParaEdit* TGo4MainWindow::StartParaEdit(const char* itemname)
2492 {
2493  TGo4ParaEdit* pedit = (TGo4ParaEdit*) FindGo4Widget("ParaEdit", true);
2494 
2495  if (itemname!=0) {
2496  TClass* cl = Browser()->ItemClass(itemname);
2497  if (cl!=0)
2498  if (!cl->IsLoaded()) {
2499  QMessageBox::warning(0, "Parameter editor", QString("Cannot start parameter editor for incomplete class ") + cl->GetName());
2500  return pedit;
2501  }
2502  }
2503 
2504  if (pedit==0) {
2505  pedit = new TGo4ParaEdit(fxMdiArea, "ParaEdit");
2506  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(pedit);
2507  ConnectGo4Widget(pedit);
2508  pedit->ensurePolished();
2509  sub->show();
2510  CascadeMdiPosition(sub);
2511  }
2512 
2513  if (itemname!=0)
2514  pedit->WorkWithParameter(itemname, false);
2515 
2516  return pedit;
2517 }
2518 
2520 {
2521  TGo4EditDynEntry* dedit = (TGo4EditDynEntry*) FindGo4Widget("EditDynEntry", true);
2522 
2523  if (dedit==0) {
2524  dedit = new TGo4EditDynEntry(fxMdiArea, "EditDynEntry");
2525  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(dedit);
2526  CascadeMdiPosition(sub);
2527  ConnectGo4Widget(dedit);
2528  dedit->ensurePolished();
2529  sub->show();
2530  }
2531 
2532  return dedit;
2533 }
2534 
2536 {
2537  TGo4ConditionEditor* wedit = (TGo4ConditionEditor*) FindGo4Widget("ConditionEditor", true);
2538  if (wedit==0) {
2539  wedit = new TGo4ConditionEditor(fxMdiArea, "ConditionEditor");
2540  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(wedit);
2541  CascadeMdiPosition(sub);
2542  ConnectGo4Widget(wedit);
2543  wedit->ensurePolished();
2544  sub->show();
2545  }
2546  return wedit;
2547 }
2548 
2550 {
2551  TGo4EventInfo* einfo = (TGo4EventInfo*) FindGo4Widget("EventInfo", true);
2552 
2553  if (einfo==0) {
2554  einfo = new TGo4EventInfo(fxMdiArea, "EventInfo");
2555  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(einfo);
2556  CascadeMdiPosition(sub);
2557  ConnectGo4Widget(einfo);
2558  einfo->ensurePolished();
2559  sub->show();
2560  }
2561 
2562  return einfo;
2563 }
2564 
2565 TGo4AnalysisConfiguration* TGo4MainWindow::FindAnalysisConfiguration()
2566 {
2567  return (TGo4AnalysisConfiguration*) FindGo4Widget("AnalysisConfiguration", false);
2568 }
2569 
2571 {
2572  TGo4AnalysisConfiguration* conf = FindAnalysisConfiguration();
2573  QWidget* mdi = conf ? conf->parentWidget() : 0;
2574 
2575  if (mdi == 0)
2576  return;
2577 
2578  if (mdi->isVisible())
2579  {
2580  mdi->hide();
2581  }
2582  else
2583  {
2584 
2585  if (conf->GetNumSteps() == 0)
2586  {
2587  // this can happen when gui connected to server without requesting the setup. Do it when user wants to see config:
2588  TGo4ServerProxy* anal = Browser()->FindServer();
2589  if (anal != 0)
2590  anal->RequestAnalysisSettings();
2591  }
2592  mdi->raise();
2593  mdi->show();
2594  if (mdi->isMinimized())
2595  mdi->showNormal();
2596  }
2597 }
2598 
2600 {
2601  return (TGo4AnalysisWindow*) FindGo4Widget("AnalysisWindow", false);
2602 }
2603 
2605 {
2607  if (anw==0) return;
2608 
2609  if (anw->HasOutput()) {
2610  QWidget* mdi = anw->parentWidget();
2611 
2612  if (mdi->isVisible()) {
2613  mdi->hide();
2614  } else {
2615  mdi->raise();
2616  mdi->show();
2617  if (mdi->isMinimized()) mdi->showNormal();
2618  }
2619  } else {
2620  QToolBar* dock = dynamic_cast<QToolBar*> (anw->parentWidget());
2621  if (dock->isVisible())
2622  dock->hide();
2623  else
2624  dock->show();
2625  }
2626 }
2627 
2629 {
2631 
2632  if (anw)
2633  if (anw->HasOutput()) {
2634  anw->parentWidget()->close();
2635  } else {
2636  QToolBar* bar = dynamic_cast<QToolBar*> (anw->parentWidget());
2637  removeToolBar(bar);
2638  delete bar;
2639  }
2640 
2641  // try to reestablish window for other server
2642  QTimer::singleShot(250, this, SLOT(EstablishAnalysisWindowForHttp()));
2643 }
2644 
2645 
2646 void TGo4MainWindow::ToggleMbsMonitor(const char* nodename)
2647 {
2648  TGo4MBSViewer* mbs =
2649  dynamic_cast<TGo4MBSViewer*> (FindGo4Widget("MBSViewer", false));
2650  if (mbs==0) return;
2651  if (mbs->parentWidget()->isVisible()) {
2652  mbs->parentWidget()->hide();
2653  } else {
2654  mbs->SetNode(nodename);
2655  mbs->parentWidget()->show();
2656  }
2657 }
2658 
2659 
2661 {
2662  TGo4SetScaleValues* scl = 0;
2663 
2664  QList<QMdiSubWindow *> windows = fxMdiArea->subWindowList();
2665  for (int i=0; i < windows.count(); ++i ) {
2666  scl = dynamic_cast<TGo4SetScaleValues*> (windows.at(i)->widget());
2667  if (scl!=0) break;
2668  }
2669 
2670  if (scl==0) {
2671  scl = new TGo4SetScaleValues(fxMdiArea, "ScaleValues", Qt::WindowStaysOnTopHint);
2672  QMdiSubWindow* sub = fxMdiArea->AddGo4SubWindow(scl);
2673  CascadeMdiPosition(sub);
2674  scl->ensurePolished();
2675  sub->show();
2676  } else {
2677  scl->parentWidget()->close();
2678  scl = 0;
2679  }
2680  return scl;
2681 }
2682 
2684 {
2685  TGo4CreateNewHistogram dlg(this);
2686  TGo4ServerProxy* an = Browser()->FindServer();
2687 
2688  dlg.SetAnalysisAvaliable((isremote!=0) && (an!=0) && an->IsAnalysisSettingsReady());
2689  dlg.SetLocalAvaliable(isremote!=1);
2690 
2691  if (dlg.exec() != QDialog::Accepted) return;
2692  TH1* h1 = dlg.MakeHistogram();
2693  if (h1==0) return;
2694 
2696 
2697  if (dlg.GetSelectedCmd()==1) {
2698  TString newitem = Browser()->SaveToMemory("", h1, kTRUE);
2699 
2700  if (newitem.Length()>0)
2701  editorServiceSlot(anw,
2703  newitem.Data(), h1->IsA());
2704  h1 = 0;
2705  } else
2706  if ((dlg.GetSelectedCmd()==2) && (an!=0)) {
2707  h1->SetBit(TGo4Status::kGo4CanDelete);
2708  an->UpdateAnalysisObject("", h1);
2709  if (anw!=0) anw->WaitForNewObject(isremote==1);
2710  else an->RefreshNamesList();
2711  }
2712  if (h1!=0) delete h1;
2713 }
2714 
2716 {
2717  TGo4ServerProxy* an = Browser()->FindServer();
2718  if ((an==0) || !an->IsAnalysisSettingsReady()) {
2719  QMessageBox::information(this,"Create new condition","Cannot create new condition before analysis setup");
2720  return;
2721  }
2722 
2723  TGo4CreateNewCondition dlg(this);
2724 
2725  if (dlg.exec() != QDialog::Accepted) return;
2726 
2727  TGo4Condition* cond = dlg.MakeCondition();
2728  if (cond==0) return;
2729 
2730  cond->SetBit(TGo4Status::kGo4CanDelete);
2731  an->UpdateAnalysisObject("", cond);
2732  delete cond;
2733 
2735  if(anw!=0) anw->WaitForNewObject(forothereditor);
2736  else an->RefreshNamesList();
2737 }
2738 
2739 void TGo4MainWindow::CreateNewDynEntrySlot(bool forothereditor)
2740 {
2741  TGo4ServerProxy* an = Browser()->FindServer();
2742  if ((an==0) || !an->IsAnalysisSettingsReady()) {
2743  QMessageBox::information(this,"Create new dynamic entry","Cannot create new entry before analysis setup");
2744  return;
2745  }
2746 
2747  TGo4CreateNewDynEntry dlg(this);
2748 
2749  if (dlg.exec() != QDialog::Accepted) return;
2750 
2751  TGo4DynamicEntry* entry = dlg.MakeEntry();
2752  if (entry==0) return;
2753 
2754  entry->SetBit(TGo4Status::kGo4CanDelete);
2755  an->UpdateAnalysisObject("", entry);
2756  delete entry;
2757 
2759  if (anw!=0) anw->WaitForNewObject(forothereditor);
2760  else an->RefreshNamesList();
2761 }
2762 
2764 {
2765  if (editor==0) return;
2766  connect(editor, SIGNAL(widgetService(QGo4Widget*, int, const char*, void*)),
2767  this, SLOT(editorServiceSlot(QGo4Widget*, int, const char*, void*)));
2768  GetWidgetTopSlot(editor, true);
2769 }
2770 
2771 TGo4ViewPanel* TGo4MainWindow::DisplayBrowserItem(const char* itemname, TGo4ViewPanel* panel, TPad* pad, bool activate, int updatelevel, const char* drawopt)
2772 {
2773  TGo4BrowserProxy* br = Browser();
2774  if ((br==0) || (itemname==0) || strlen(itemname)==0 ) return 0;
2775 
2776  TGo4Slot* guislot = br->BrowserSlot(itemname);
2777 
2778  if (guislot==0) return 0;
2779  if (guislot->GetProxy()==0) {
2780  std::cerr << " Problem with gui slots" << std::endl;
2781  return 0;
2782  }
2783 
2784  if (panel==0) {
2785  panel = MakeNewPanel();
2786  pad = panel->GetCanvas();
2787  } else
2788  if (pad==0) pad = panel->GetActivePad();
2789 
2790  if (panel->AddDrawObject(pad, TGo4ViewPanel::kind_Link, itemname, 0, false, drawopt)==0) return 0;
2791 
2792  if (activate) {
2793  panel->SetActivePad(pad);
2794  panel->ShootRepaintTimer();
2795  }
2796 
2797  if (updatelevel<0)
2799  updatelevel = 2;
2800  else
2801  updatelevel = 1;
2802 
2803  br->GetBrowserObject(itemname, updatelevel);
2804 
2805  return panel;
2806 }
2807 
2808 bool TGo4MainWindow::SaveBrowserItemToFile(const char* itemname, const char* subfolder)
2809 {
2810  TGo4BrowserProxy* br = Browser();
2811  if ((br==0) || (itemname==0)) return 0;
2812 
2813  TString fileslotname;
2814  const char* filepath = 0;
2815 
2816  bool res = false;
2817 
2818  if (br->DefineFileObject(itemname, fileslotname, &filepath)) {
2819  int answer = QMessageBox::question(this, "Writing object to file",
2820  QString("Overwrite ") + filepath + " in file " + fileslotname.Data(),
2821  "Overwrite", "Save to other file", "Cancel");
2822  if (answer==2) return false;
2823  if (answer==0)
2824  res = br->UpdateObjectInFile(itemname, fileslotname.Data(), filepath);
2825  }
2826 
2827  if (!res) {
2828  QString root_fmt = "ROOT (*.root)";
2829  QString xml_fmt = "ROOT XML (*.xml)";
2830 
2831  QFileDialog fd(this, QString("Save ") + itemname + " in root file", fLastFileDir);
2832  fd.setFileMode(QFileDialog::AnyFile);
2833  fd.setAcceptMode(QFileDialog::AcceptSave);
2834  fd.setNameFilters(QStringList() << root_fmt << xml_fmt);
2835 
2836  if (fd.exec() == QDialog::Accepted) {
2837  QStringList flst = fd.selectedFiles();
2838  if (!flst.isEmpty()) {
2839  QString filename = flst[0];
2840  if (fd.selectedNameFilter()==xml_fmt) {
2841  if (!filename.endsWith(".xml")) filename.append(".xml");
2842  } else {
2843  if (!filename.endsWith(".root")) filename.append(".root");
2844  }
2845  res = br->SaveItemToFile(itemname, filename.toLatin1().constData(), subfolder);
2846  fLastFileDir = fd.directory().path();
2847  }
2848  }
2849  }
2850 
2851  return res;
2852 }
2853 
2854 void TGo4MainWindow::SavePanelCanvas(TGo4ViewPanel* panel)
2855 {
2856  if (panel==0) return;
2857 
2858  TCanvas* can= panel->GetCanvas();
2859  TCanvas* cansav;
2860 
2861 
2862  QFileDialog fd( this, QString("Save ") + panel->objectName() + " As", fLastFileDir);
2863  fd.setFileMode( QFileDialog::AnyFile );
2864  fd.setAcceptMode(QFileDialog::AcceptSave);
2865 
2866  QString PS = "Post Script (*.ps)";
2867  QString PS_Portrait = "Post Script Portrait (*.ps)";
2868  QString PS_Landscape = "Post Script Landscape (*.ps)";
2869  QString EPS = "Encapsulated Post Script (*.eps)";
2870  QString EPS_Preview = "Encapsulated Post Script preview (*.eps)";
2871  QString GIF = "GIF format (*.gif)";
2872  QString PDF = "PDF format (*.pdf)";
2873  QString SVG = "SVG format (*.svg)";
2874  QString XPM = "XPM format (*.xpm)";
2875  QString PNG = "PNG format (*.png)";
2876  QString JPG = "JPG format (*.jpg)";
2877  QString TIFF = "TIFF format (*.tiff)";
2878 
2879  QString CXXM = "C++ Macro (*.C)";
2880  QString ROOTM = "root file (*.root)";
2881 
2882  QStringList flt;
2883 
2884  flt << PS;
2885  flt << PS_Portrait;
2886  flt << PS_Landscape;
2887  flt << EPS;
2888  flt << EPS_Preview;
2889  flt << PDF;
2890  flt << SVG;
2891  flt << GIF;
2892 
2893  #if ROOT_VERSION_CODE >= ROOT_VERSION(4,4,2)
2894  flt << XPM;
2895  flt << PNG;
2896  flt << JPG;
2897  flt << TIFF;
2898  #endif
2899 
2900  flt << CXXM;
2901  flt << ROOTM;
2902 
2903  fd.setNameFilters(flt);
2904 
2905  if (fd.exec() != QDialog::Accepted) return;
2906 
2907 
2908  bool blankbg=go4sett->getSavePadWhiteBackground();
2909  if(blankbg)
2910  {
2911  can = (TCanvas*) panel->GetCanvas()->Clone();
2912  can->SetName("PrintoutPad");
2913  //std::cout << "SavePanelCanvas has cloned panel canvas! "<< can->GetName()<< std::endl;
2914  }
2915  QStringList flst = fd.selectedFiles();
2916  if (flst.isEmpty()) return;
2917 
2918  QString filename = flst[0];
2919  QString filter = fd.selectedNameFilter();
2920 
2921  fLastFileDir = fd.directory().path();
2922 
2923  const char* opt = "ps";
2924 
2925  if(filter==EPS) {
2926  opt = "eps";
2927  if (!filename.endsWith(".eps")) filename.append(".eps");
2928  } else
2929  if(filter==EPS_Preview) {
2930  opt = "Preview";
2931  if (!filename.endsWith(".eps")) filename.append(".eps");
2932  } else
2933  if(filter==PS) {
2934  opt = "ps";
2935  if (!filename.endsWith(".ps")) filename.append(".ps");
2936  } else
2937  if(filter==PS_Portrait) {
2938  opt = "Portrait";
2939  if (!filename.endsWith(".ps")) filename.append(".ps");
2940  } else
2941  if(filter==PS_Landscape) {
2942  opt = "Landscape";
2943  if (!filename.endsWith(".ps")) filename.append(".ps");
2944  } else
2945  if(filter==GIF) {
2946  opt = "gif";
2947  if (!filename.endsWith(".gif")) filename.append(".gif");
2948  } else
2949  if(filter==PDF) {
2950  opt = "pdf";
2951  if (!filename.endsWith(".pdf")) filename.append(".pdf");
2952  } else
2953  if(filter==SVG) {
2954  opt = "svg";
2955  if (!filename.endsWith(".svg")) filename.append(".svg");
2956  } else
2957  if(filter==XPM) {
2958  opt = "xpm";
2959  if (!filename.endsWith(".xpm")) filename.append(".xpm");
2960  } else
2961  if(filter==PNG) {
2962  opt = "png";
2963  if (!filename.endsWith(".png")) filename.append(".png");
2964  } else
2965  if(filter==JPG) {
2966  opt = "jpg";
2967  if (!filename.endsWith(".jpg")) filename.append(".jpg");
2968  } else
2969  if(filter==TIFF) {
2970  opt = "tiff";
2971  if (!filename.endsWith(".tiff")) filename.append(".tiff");
2972  } else
2973  if(filter==CXXM) {
2974  opt = "cxx";
2975  if (!filename.endsWith(".C")) filename.append(".C");
2976  } else
2977  if (filter==ROOTM) {
2978  opt = "root";
2979  if (!filename.endsWith(".root")) filename.append(".root");
2980  }
2981 
2982  if(blankbg)
2983  {
2984  panel->ResetPadFillColors(can,0);
2985  // std::cout <<"Reset pad fill colors for blank bg option with canvas "<<can->GetName() <<std::endl;
2986  gROOT->SetBatch(kTRUE); // force ROOT to make memory print of canvas instead of using actual window display for image formats.
2987  }
2988  can->Print(filename.toLatin1().constData(), opt);
2989 
2990  // std::cout<< "printed canvas "<<can->GetName() << std::endl;
2991  if(blankbg)
2992  {
2993  gROOT->SetBatch(kFALSE);
2994  delete can;
2995  }
2996 }
2997 
2999 {
3000  return fxOM;
3001 }
3002 
3004 {
3005  return (TGo4BrowserProxy*) fxOM->GetProxy(fOMBrowserPath.toLatin1().constData());
3006 }
3007 
3009 {
3010  if (widget==0) return 0;
3011 
3012  QString EditorName = widget->objectName();
3013 
3014  QString editorslotname = fOMEditorsPath;
3015  editorslotname += "/";
3016  editorslotname += EditorName;
3017  TGo4Slot* edslot = fxOM->GetSlot(editorslotname.toLatin1().constData());
3018  if ((edslot==0) && force) {
3019  fxOM->AddProxy(fOMEditorsPath.toLatin1().constData(), new TGo4WidgetProxy(widget), EditorName.toLatin1().constData(), "Links for Go4 widget");
3020  edslot = fxOM->GetSlot(editorslotname.toLatin1().constData());
3021  }
3022  return edslot;
3023 }
3024 
3026 {
3027  // block monitoring when start panel updates
3028  Browser()->SetMonitorBlockingFlag(kTRUE);
3029 
3030  fbPanelTimerActive = false;
3031 
3032  // first check if active viewpnael need update its content
3033  TGo4ViewPanel* actpanel = fxMdiArea->GetActivePanel();
3034  if ((actpanel!=0) && actpanel->IsRepaintTimerActive())
3035  actpanel->checkRepaintSlot();
3036 
3037  if (fbPanelTimerActive) return;
3038 
3039  // now check if any other panel shold be repainted
3040  TGo4Slot* topslot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
3041  for (int n=0;n<topslot->NumChilds();n++) {
3042  TGo4Slot* subslot = topslot->GetChild(n);
3043 
3044  TGo4WidgetProxy* wproxy =
3045  dynamic_cast<TGo4WidgetProxy*> (subslot->GetProxy());
3046  if (wproxy==0) continue;
3047 
3048  TGo4ViewPanel* panel =
3049  dynamic_cast<TGo4ViewPanel*> (wproxy->GetWidget());
3050 
3051  if ((panel!=0) && (panel!=actpanel))
3052  if (panel->IsRepaintTimerActive()) {
3053  panel->checkRepaintSlot();
3054  if (fbPanelTimerActive) return;
3055  }
3056  }
3057 
3058  // enable monitoring only when all drawing are finished
3059  Browser()->SetMonitorBlockingFlag(kFALSE);
3060 }
3061 
3062 //int temp_counter = 0;
3063 
3064 void TGo4MainWindow::editorServiceSlot(QGo4Widget* editor, int serviceid, const char* str, void* par)
3065 {
3066  if (editor==0) return;
3067 
3068  TGo4LockGuard lock;
3069 
3070  TGo4Slot* edslot = GetWidgetTopSlot(editor, false);
3071  if (edslot==0) return;
3072 
3073  switch (serviceid) {
3075  QDragEnterEvent* event = (QDragEnterEvent*) par;
3076  if ((event==0) || !event->mimeData()->hasText()) return;
3077 
3078  QString eventstr = event->mimeData()->text();
3079 
3080  bool accept = false;
3081  if (event->source()==FindGo4Widget("Browser",false)) {
3082  int kind = Browser()->ItemKind(eventstr.toLatin1().constData());
3083  TClass* cl = Browser()->ItemClass(eventstr.toLatin1().constData());
3084  accept = editor->IsAcceptDrag(eventstr.toLatin1().constData(), cl, kind);
3085  }
3086 
3087  if (accept) event->acceptProposedAction();
3088  break;
3089  }
3090 
3092  QDropEvent* event = (QDropEvent*) par;
3093 
3094  if ((event==0) || !event->mimeData()->hasText()) return;
3095 
3096  QString eventstr = event->mimeData()->text();
3097  event->acceptProposedAction();
3098 
3099  if (event->source()==FindGo4Widget("Browser",false)) {
3100  int kind = Browser()->ItemKind(eventstr.toLatin1().constData());
3101  TClass* cl = Browser()->ItemClass(eventstr.toLatin1().constData());
3102 
3103  TGo4ViewPanel* panel = dynamic_cast<TGo4ViewPanel*> (editor);
3104  TGo4FitPanel* fitpanel = dynamic_cast<TGo4FitPanel*> (editor);
3105  if (panel!=0)
3106  panel->DropOnPad((TPad*)str, eventstr.toLatin1().constData(), cl, kind);
3107  else
3108  if (fitpanel!=0)
3109  fitpanel->DropOnPanel(event, eventstr.toLatin1().constData(), cl, kind);
3110  else
3111  editor->DropItem(eventstr.toLatin1().constData(), cl, kind);
3112  }
3113  break;
3114  }
3115 
3117  TClass* cl = (TClass*) par;
3118  int id = str!=0 ? QString(str).toInt() : 0;
3119  if (cl!=0)
3120  if (cl->InheritsFrom(TH1::Class()))
3121  CreateNewHistSlot(id);
3122  else
3123  if (cl->InheritsFrom(TGo4Condition::Class()) && (id!=0))
3124  CreateNewConditionSlot(id==1);
3125  else
3126  if (cl->InheritsFrom(TGo4DynamicEntry::Class()) && (id!=0))
3127  CreateNewDynEntrySlot(id==1);
3128  break;
3129  }
3131  void** res = (void**) par;
3132  res[0] = DisplayBrowserItem(str, (TGo4ViewPanel*) res[0], (TPad*) res[1], *((bool*)res[2]), *((int*) res[3]), 0);
3133  break;
3134  }
3135 
3137  TGo4ViewPanel** res = (TGo4ViewPanel**) par;
3138  *res = 0;
3139  TGo4Slot* topslot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
3140  for (int n=0;n<topslot->NumChilds();n++) {
3141  TGo4Slot* subslot = topslot->GetChild(n);
3142 
3143  TGo4WidgetProxy* wproxy =
3144  dynamic_cast<TGo4WidgetProxy*> (subslot->GetProxy());
3145  if (wproxy==0) continue;
3146 
3147  TGo4ViewPanel* panel =
3148  dynamic_cast<TGo4ViewPanel*> (wproxy->GetWidget());
3149 
3150  if (panel!=0)
3151  if (panel->FindPadWithItem(str)!=0) {
3152  *res = panel;
3153  break;
3154  }
3155  }
3156  break;
3157  }
3158 
3160  TGo4Slot* topslot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
3161 
3162  for (int n=0;n<topslot->NumChilds();n++) {
3163  TGo4Slot* subslot = topslot->GetChild(n);
3164 
3165  TGo4WidgetProxy* wproxy =
3166  dynamic_cast<TGo4WidgetProxy*> (subslot->GetProxy());
3167  if (wproxy==0) continue;
3168 
3169  TGo4ViewPanel* panel =
3170  dynamic_cast<TGo4ViewPanel*> (wproxy->GetWidget());
3171 
3172  if (panel!=0)
3173  panel->UndrawItemOnPanel(str);
3174  }
3175 
3176  break;
3177  }
3178 
3180  TClass* cl = Browser()->ItemClass(str);
3181  Int_t kind = Browser()->ItemKind(str);
3182 
3183  if (kind==TGo4Access::kndGo4Param) {
3184  TGo4ParaEdit* paredit = StartParaEdit(str);
3185  break;
3186  } else
3187  if (kind==TGo4Access::kndTreeLeaf) {
3188  TGo4TreeViewer* tviewer =
3189  dynamic_cast<TGo4TreeViewer*> (FindGo4Widget("TreeViewer", false));
3190  if (tviewer!=0) {
3191  tviewer->WorkWithLeaf(str);
3192  tviewer->parentWidget()->show();
3193  }
3194  break;
3195  }
3196 
3197  if (cl==0) return;
3198 
3199  if (cl->InheritsFrom(TGo4Fitter::Class())) {
3200  TGo4FitPanel* fitpanel = StartFitPanel();
3201  TGo4ViewPanel* panel = dynamic_cast<TGo4ViewPanel*> (editor);
3202  fitpanel->WorkWithFitter(str, panel, panel==0 ? 0 : panel->GetActivePad());
3203  } else
3204  if (cl->InheritsFrom(TGo4Parameter::Class())) {
3205  TGo4ParaEdit* paredit = StartParaEdit(str);
3206  } else
3207  if (cl->InheritsFrom(TH1::Class())) {
3208  TGo4HistogramInfo* hinfo = StartHistogramInfo();
3209  hinfo->WorkWithHistogram(str);
3210  } else
3211  if (cl->InheritsFrom(TGo4Condition::Class())) {
3212  TGo4ConditionEditor* wedit = StartConditionEditor();
3213  wedit->WorkWithCondition(str);
3214  } else
3215  if (cl->InheritsFrom(TGo4DynamicEntry::Class())) {
3216  TGo4EditDynEntry* dedit = StartEditDynEntry();
3217  dedit->WorkWithEntry(str);
3218  } else
3219  if (cl->InheritsFrom(TGo4AnalysisStatus::Class())) {
3220  // use central editor, later can control many analysis at once
3222  }
3223 
3224  break;
3225  }
3226 
3228  TClass* cl = Browser()->ItemClass(str);
3229  int kind = Browser()->ItemKind(str);
3230  if (kind==TGo4Access::kndEventElement) {
3231  TGo4EventInfo* einfo = StartEventInfo();
3232  einfo->WorkWithEvent(str);
3233  break;
3234  }
3235  if (cl==0) return;
3236  if (cl->InheritsFrom(TH1::Class())) {
3237  TGo4HistogramInfo* hinfo = StartHistogramInfo();
3238  hinfo->WorkWithHistogram(str);
3239  } else
3240  if (cl->InheritsFrom(TGo4Condition::Class())) {
3241  TGo4ConditionInfo* cinfo = StartConditionInfo();
3242  cinfo->WorkWithCondition(str);
3243  }
3244  break;
3245  }
3246 
3248  TGo4Slot* slot = (TGo4Slot*) par;
3249  if (slot==0) break;
3250  TObject* obj = slot->GetAssignedObject();
3251  if (obj==0) break;
3252  if (obj->InheritsFrom(TGo4Fitter::Class())) {
3253  TGo4FitPanel* fitpanel = StartFitPanel();
3254  fitpanel->WorkWithFitterInSlot(slot);
3255  }
3256  break;
3257  }
3258 
3260  const char* subfolder = (const char*) par;
3261  bool* replace = (bool*) par;
3262  bool res = SaveBrowserItemToFile(str, subfolder);
3263  * ((char*) par) = res ? 1 : 0;
3264  break;
3265  }
3266 
3268  TObject** obj = (TObject**) par;
3269  Bool_t res = Browser()->UpdateAnalysisItem(str, *obj);
3270  if (res) *obj = (TObject*) 1; else *obj = 0;
3271  break;
3272  }
3273 
3275  StatusMessage(str);
3276  break;
3277  }
3278 
3280  TGo4ViewPanel** res = (TGo4ViewPanel**) par;
3281  *res = MakeNewPanel(QString(str).toInt());
3282  break;
3283  }
3284 
3286  bool* res = (bool*) par;
3287  *res = Browser()->IsItemRemote(str);
3288  break;
3289  }
3290 
3292  TGo4BrowserProxy** res = (TGo4BrowserProxy**) par;
3293  *res= Browser();
3294  break;
3295  }
3296 
3298  TObject** obj = (TObject**) par;
3299  TString itemname = Browser()->SaveToMemory(str, *obj, true);
3300  QString** res = (QString**) par;
3301  *res = 0;
3302  if (itemname.Length()>0)
3303  *res = new QString(itemname.Data());
3304  break;
3305  }
3306 
3308  TGo4ServerProxy** res = (TGo4ServerProxy**) par;
3309  *res = Browser()->FindServer(str);
3310  break;
3311  }
3312 
3314  TGo4Slot* brslot = Browser()->BrowserSlot((const char*)par);
3315 
3316  QByteArray ba = editor->objectName().toLatin1();
3317 
3318  if (str==0) str = ba.constData();
3319 
3320  TGo4Slot* link = fxOM->AddLink(brslot, edslot->GetFullName(),
3321  str, "link to browser item");
3322  if (link!=0)
3323  editor->SetLinkedName(link, (const char*)par);
3324 
3325  break;
3326  }
3327 
3329  //std::cout << " QGo4Widget::service_AddDirectLink " << std::endl;
3330  QByteArray ba = editor->objectName().toLatin1();
3331  if (str==0) str = ba.constData();
3332  TGo4Slot* slot = (TGo4Slot*) par;
3333  if (slot!=0) {
3334  //std::cout << "add link for " << str << " in edslot = " << edslot->GetFullName() << std::endl;
3335  fxOM->AddLink(slot, edslot->GetFullName(),
3336  str, "direct link to OM slot");
3337  //edslot->Print("*");
3338  }
3339  break;
3340  }
3341 
3343  //std::cout << " QGo4Widget::service_AddLinkInSlot " << std::endl;
3344 
3345  TGo4Slot** res = (TGo4Slot**) par;
3346 
3347  TGo4Slot* parent = *res;
3348  *res = 0;
3349  if (parent==0) parent = edslot;
3350  TGo4Slot* brslot = Browser()->BrowserSlot(str);
3351 
3352  if (brslot!=0) {
3353  *res = fxOM->AddLink(brslot, parent->GetFullName(),
3354  brslot->GetName(), "link in specific subfolder");
3355  if (*res!=0)
3356  editor->SetLinkedName(*res, str);
3357  }
3358  break;
3359  }
3360 
3362  TGo4Slot** res = (TGo4Slot**) par;
3363  *res = edslot;
3364  break;
3365  }
3366 
3368  TGo4Slot* objslot = edslot->FindChild(str);
3369 
3370  if (objslot==0)
3371  objslot = fxOM->MakeObjSlot(edslot->GetFullName(), str, "Place for editor object");
3372  if (objslot!=0)
3373  objslot->SetProxy(new TGo4ObjectProxy);
3374 
3375  TGo4Slot** res = (TGo4Slot**) par;
3376  *res = objslot;
3377  break;
3378  }
3379 
3382  break;
3383  }
3384 
3386  if (edslot==0) return;
3387  const char** res = (const char**) par;
3388  *res = TGo4BrowserProxy::GetLinkedName(edslot->FindChild(str));
3389  break;
3390  }
3391 
3393  void** res = (void**) par;
3394  TGo4Slot* link = (TGo4Slot*) *res;
3395  *res = (void*) TGo4BrowserProxy::GetLinkedName(link);
3396  break;
3397  }
3398 
3402  if (edslot==0) return;
3403  TGo4Slot* link = edslot->FindChild(str);
3404  if (link==0) return;
3405  const char* itemname = TGo4BrowserProxy::GetLinkedName(link);
3406  TObject** res = (TObject**) par;
3407  int updatelevel = serviceid - QGo4Widget::service_GetLinked0;
3408  if (itemname!=0)
3409  *res = Browser()->GetBrowserObject(itemname, updatelevel);
3410  else
3411  *res = link->GetAssignedObject();
3412  break;
3413  }
3414 
3416  if (edslot==0) return;
3417  TGo4Slot* link = edslot->FindChild(str);
3418  if (link!=0) link->Delete();
3419  break;
3420  }
3421 
3423  if ((str==0) || (strcmp(str,"complete")!=0))
3424  edslot->DeleteChilds(str);
3425  else
3426  edslot->Delete();
3427  break;
3428  }
3429 
3431  TGo4Slot* slot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
3432  for (int n=0;n<slot->NumChilds();n++) {
3433  TGo4Slot* subslot = slot->GetChild(n);
3434  if (edslot==subslot) continue;
3435 
3436  TGo4WidgetProxy* wproxy =
3437  dynamic_cast<TGo4WidgetProxy*>
3438  (subslot->GetProxy());
3439 
3440  if (wproxy!=0)
3441  wproxy->GetWidget()->ObjectCreatedByWidget(str, (TClass*) par);
3442  }
3443  break;
3444  }
3445 
3447  if (edslot==0) break;
3448 
3449  TGo4WidgetProxy* proxy =
3450  dynamic_cast<TGo4WidgetProxy*> (edslot->GetProxy());
3451  if (proxy!=0)
3452  proxy->ConnectPad((TPad*) par);
3453  break;
3454  }
3455 
3457  TGo4ViewPanel** res = (TGo4ViewPanel**) par;
3458  *res = fxMdiArea->GetActivePanel();
3459  break;
3460  }
3461 
3463  if (strcmp(str,"CloseAnalysisWindow")==0) {
3464  // we should postpone window closing, while it is called from inside window itself
3465  // and it is create problem in sequence,
3466  QTimer::singleShot(100, this, SLOT(CloseAnalysisWindow()));
3467  } else
3468 
3469  if (strcmp(str,"PrintAnalysisHistograms")==0) {
3471  if (anw!=0) anw->PrintHistograms();
3472  } else
3473 
3474  if (strcmp(str,"PrintAnalysisConditions")==0) {
3476  if (anw!=0) anw->PrintConditions();
3477  } else
3478 
3479  if (strcmp(str,"DisplayMbsMonitor")==0) {
3480  ToggleMbsMonitor((const char*) par);
3481  } else
3482 
3483  if (strcmp(str,"SubmitAnalysisSettings")==0) {
3485  } else
3486 
3487  if (strcmp(str,"CloseAnalysisSettings")==0) {
3488  TGo4ServerProxy* anal = Browser()->FindServer();
3489  if (anal!=0) {
3490  anal->CloseAnalysisSettings();
3491  anal->RefreshNamesList();
3492  }
3493  } else
3494 
3495  if (strcmp(str,"SubmitStartAnalysis")==0) {
3497  } else
3498 
3499  if (strcmp(str,"StartAnalysis")==0) {
3501  } else
3502 
3503  if (strcmp(str,"StopAnalysis")==0) {
3504  StopAnalysisSlot();
3505  } else
3506 
3507  if (strcmp(str,"TerminateAnalysis")==0) {
3508  TerminateAnalysis(true);
3509  } else
3510 
3511  if (strcmp(str,"UpdateGuiLayout")==0) {
3513  } else
3514 
3515  if (strcmp(str, "StartEventInfo")==0) {
3516  StartEventInfo();
3517  } else
3518 
3519  if (strcmp(str, "ActivateConditionEditor")==0) {
3520  TGo4ConditionEditor* w =
3521  (TGo4ConditionEditor*) FindGo4Widget("ConditionEditor", true);
3522  if (w!=0) {
3523  w->setFocus();
3524  w->RefreshWidget(true);
3525  }
3526  } else
3527 
3528  if (strcmp(str, "SavePanelCanvas")==0) {
3529  SavePanelCanvas(dynamic_cast<TGo4ViewPanel*>(editor));
3530  } else
3531 
3532  if (strcmp(str, "ToggleScaleValues")==0) {
3534  } else
3535 
3536  if (strcmp(str, "GetFitterFromFitPanel")==0) {
3537  TGo4FitPanel* panel = (TGo4FitPanel*) FindGo4Widget("FitPanel", false);
3538  TGo4Fitter** res = (TGo4Fitter**) par;
3539  if ((panel!=0) && (res!=0))
3540  *res = panel->GetFitter();
3541  } else
3542 
3543  if (strcmp(str, "CloneFitterFromFitPanel")==0) {
3544  TGo4FitPanel* panel = (TGo4FitPanel*) FindGo4Widget("FitPanel", false);
3545  TGo4Fitter** res = (TGo4Fitter**) par;
3546  if ((panel!=0) && (res!=0))
3547  *res = panel->CloneFitter();
3548  }
3549 
3550  break;
3551  }
3552 
3554  TGo4ViewPanel* panel = (TGo4ViewPanel*) editor;
3555  if (!fbPanelTimerActive) {
3556  fbPanelTimerActive = true;
3557  QTimer::singleShot(0, this, SLOT(checkPanelRepaintSlot()));
3558  }
3559 
3560  break;
3561  }
3562 
3564  HelpWindow(str, (const char*) par);
3565  break;
3566  }
3567 
3569  HotStart(str);
3570  break;
3571  }
3572 
3579  TGo4ViewPanel* panel = (TGo4ViewPanel*) editor;
3580  TPad* pad = (TPad*) par;
3581  fxMdiArea->ResponseOnPanelEvent(serviceid, panel, pad);
3582  break;
3583  }
3584 
3585  }
3586 }
3587 
3588 // ******************** hot start functions *********************
3589 
3590 void TGo4MainWindow::HotStart(const char* fname)
3591 {
3592  if (fname==0) return;
3593 
3595  if(exec==0) return;
3596 
3597  if (!exec->StartScriptExecution(fname)) return;
3598 
3599  QTimer::singleShot(TGo4AbstractInterface::DelayMillisec(), this, SLOT(ProcessHotStart()));
3600 }
3601 
3603 {
3605  if (exec==0) return;
3606 
3607  Bool_t res = kTRUE;
3608  do {
3609  res = exec->ContinueExecution();
3610  } while(res && !exec->IsWaitSomething());
3611 
3612  if (res) {
3613  QTimer::singleShot(TGo4AbstractInterface::DelayMillisec(), this, SLOT(ProcessHotStart()));
3614  if (QApplication::overrideCursor()==0)
3615  QApplication::setOverrideCursor(Qt::WaitCursor);
3616  } else {
3617  exec->FinishExecution();
3618  StatusMessage("Script execution done");
3619  QApplication::restoreOverrideCursor();
3620  }
3621 }
3622 
3624 {
3626  if (exec!=0) exec->FinishExecution();
3627 }
3628 
3630 {
3631  QString ext = TGo4AbstractInterface::FileExtension();
3632  QString fileName =
3633  QFileDialog::getSaveFileName(this,
3634  "Create GUI script dialog",
3635  fLastFileDir,
3636  QString("GUI hotstart script (*") + ext + ")");
3637  if (fileName.length()==0) return;
3638 
3639  int pos = fileName.indexOf(ext);
3640 
3641  if ((pos<0) || (pos!=fileName.length()-ext.length()))
3642  fileName+=ext;
3643 
3644  StatusMessage(QString("Generate script ")+fileName);
3645 
3646  TGo4Script::ProduceScript(fileName.toLatin1().constData(), this);
3647 }
3648 
3649 
3650 
3652 {
3653  QToolBar* AnalysisMacroBar = addToolBar("Analysis Command Buttons");
3654  AnalysisMacroBar->setObjectName("AnalysisCommandToolBar");
3655 
3656  // new: everything is in dedicated class
3657  TGo4UserCommands* companel = new TGo4UserCommands(this, "UserCommands");
3658  ConnectGo4Widget(companel);
3659  AnalysisMacroBar->addWidget(companel);
3660  AnalysisMacroBar->adjustSize();
3661 }
3662 
3663 
3664 
3666 {
3667  if (fApp!=0) fApp->processEvents(QEventLoop::AllEvents, TGo4AbstractInterface::DelayMillisec());
3668 }
3669 
3670 TGo4ViewPanel* TGo4MainWindow::FindViewPanel(const char* name)
3671 {
3672  if ((name==0) || (*name==0)) return 0;
3673 
3674  TGo4ViewPanel* panel = dynamic_cast<TGo4ViewPanel*> (FindGo4Widget(name, false));
3675 
3676  if (panel!=0) return panel;
3677 
3678  TGo4Slot* slot = fxOM->GetSlot(fOMEditorsPath.toLatin1().constData());
3679 
3680  for (Int_t n=0;n<slot->NumChilds();n++) {
3681  TGo4Slot* widgslot = slot->GetChild(n);
3682  TGo4WidgetProxy* wproxy = widgslot==0 ? 0 : dynamic_cast<TGo4WidgetProxy*> (widgslot->GetProxy());
3683  panel = wproxy==0 ? 0 : dynamic_cast<TGo4ViewPanel*> (wproxy->GetWidget());
3684 
3685  if (panel!=0)
3686  if (strcmp(panel->GetPanelName(), name)==0) return panel;
3687  }
3688 
3689  return 0;
3690 }
Bool_t IsAnalysisSettingsReady() const
QAction * faWindowRubberBand
TGo4ConditionEditor * StartConditionEditor()
void setDrawDateFlag(bool on=true)
QString getClientDir()
QString GetSettLoaction()
virtual Bool_t IsViewer()
void setScreenScaleFactor(double factor)
TGo4Proxy * GetProxy(const char *name)
QAction * faDisconnectAnal
bool getSavePadWhiteBackground()
void OpenFile(const char *fname)
void CreateNewHistSlot(int isremote=-1)
QString getAppStyle()
QAction * faEventstatus
Bool_t ContinueExecution()
Definition: TGo4Script.cxx:101
void HotStart(const char *fname)
QString getTGraphDrawOpt()
int getClientShellMode()
virtual Bool_t IsConnected()
QString getClientAccountName()
QAction * faSuperimpose
void EstablishAnalysisWindowForHttp()
void storeMainWindowState(QMainWindow *src)
void StatusMessage(const QString &mess)
QAction * faCrosshair
void ChangeTerminalFontSlot()
TGo4AnalysisProxy * AddAnalysisProxy(bool isserver, bool needoutput)
void setTH1DrawOpt(const QString &value)
void setHideTGo4EventElement(bool on=true)
void ChangeDrawDateFlagSlot()
TString SaveToMemory(const char *pathname, TObject *obj, Bool_t ownership, Bool_t overwrite=kFALSE)
bool getDrawOnceFlag()
TObject * GetBrowserObject(const char *name, Int_t update=0)
double getScreenScaleFactor()
virtual Bool_t IsAdministrator()
void SetProxy(TGo4Proxy *cont)
Definition: TGo4Slot.cxx:313
TGo4Slot * LoginfoSlot()
TGo4Slot * UpdateObjectSlot()
QAction * faDrawOnce
void ToggleFullScreenSlot()
void LaunchClientSlot(bool interactive=true)
void setFetchDataWhenCopy(bool on=true)
Int_t ItemKind(const char *name)
bool SaveBrowserItemToFile(const char *itemname, const char *subfolder)
QAction * faSaveWhite
QString getClientName()
void setPadEventStatus(bool on)
bool getFetchDataWhenCopy()
TGo4MainWindow(QApplication *)
void AddFile(const char *pathname, const char *filename)
void ChangeFetchWhenDrawSlot()
QAction * faShutdownAnal
QAction * faConnectAnal
QString getTermTimeFormat()
Bool_t IsItemRemote(const char *name)
TGo4Proxy * GetProxy() const
Definition: TGo4Slot.h:93
QString fConnectingHttp
void checkPanelRepaintSlot()
QAction * faPrepareAnal
void setDrawFillColor(int col)
void ConnectGo4Widget(QGo4Widget *editor)
Bool_t LaunchAsClient(TString &launchcmd, TString &killcmd, Int_t shellkind, Int_t konsole, const char *name, const char *remotehost, const char *remotedir, const char *remoteexe, Int_t exe_kind=0, const char *exeargs=0)
void HelpWindow(const char *filename, const char *msg=0)
void setPaletteOpt(int min, int def, int max)
void ToggleAnalysisConfiguration()
QAction * faClone
bool getDrawItemFlag()
TGo4AnalysisConfiguration * EstablishAnalysisConfiguration(int level)
void MakeFolder(const char *pathname)
QAction * faTermTimeStamp
QString fOMBrowserPath
QAction * faFetchWhenSave
void SetLinkedName(TGo4Slot *slot, const char *itemname)
Definition: QGo4Widget.cpp:152
virtual Bool_t IsGo4Analysis() const
void CreateNewConditionSlot(bool forothereditor=false)
void setHServFilter(const QString &)
void ChangeHideEventElement()
virtual TGo4ServerProxy * ConnectHttp(const char *servername, const char *account=0, const char *pass=0)
Definition: TGo4Script.cxx:815
TGo4ParaEdit * StartParaEdit(const char *itemname=0)
QAction * faHideEventElement
virtual void CloseAnalysisSettings()
TClass * ItemClass(const char *name)
static const char * FileExtension()
void DeleteChilds(const char *startedwith=0)
Definition: TGo4Slot.cxx:221
QString getClientExec(int mode=-1)
TGo4AnalysisStatusMonitor * EstablishRatemeter(int level)
QAction * faFetchWhenDraw
static void SetIgnoreLevel(Int_t level)
Definition: TGo4Log.cxx:322
void SetAnalysisLaunched(Int_t on=1)
void UpdateDockAnalysisWindow()
bool SubmitAnalysisSettings()
void ToggleMbsMonitor(const char *nodename)
virtual Bool_t IsConnected()
void setBasicSettings()
virtual Bool_t RefreshNamesList()
static void OutputEnable(Bool_t on=kTRUE)
Definition: TGo4Log.cxx:358
void StartAnalysisShell(const char *cmd, const char *workdir=0, bool aschildprocess=false)
virtual Bool_t IsAdministrator()
void ConnectServerSlot(bool interactive=true, const char *password="")
void ChangeFetchWhenCopySlot()
virtual void RequestAnalysisSettings()
bool getPadCrosshair()
virtual Bool_t IsController()
static void OpenLogfile(const char *name=0, const char *headercomment=0, Bool_t appendmode=kFALSE)
Definition: TGo4Log.cxx:391
void setTH3DrawOpt(const QString &value)
TGo4ServerProxy * FindServer(const char *itemname=0, Bool_t asanalysis=kTRUE)
Bool_t ConnectHServer(const char *servername, Int_t portnumber, const char *basename, const char *userpass, const char *filter)
virtual Bool_t IsAnalysisServer() const
void CheckConnectingCounterSlot()
QAction * faAnalConfig
void ShutdownAnalysisSlot(bool interactive=true)
QAction * faStartAnal
QString getTH2DrawOpt()
void setSavePadWhiteBackground(bool on)
int getClientControllerMode()
virtual void StartAnalysis()
Bool_t SaveBrowserToFile(const char *filename, Bool_t prefetch=kFALSE, const char *selectedpath=0, const char *description=0)
void setTermHistorySize(int sz)
static TGo4Script * ScriptInstance()
Definition: TGo4Script.cxx:51
virtual bool IsAcceptDrag(const char *itemname, TClass *cl, int kind)
Definition: QGo4Widget.cpp:88
void FinishExecution()
Definition: TGo4Script.cxx:131
TGo4FitPanel * StartFitPanel()
TGo4Slot * DataSlot(const char *item)
QString getHServName()
QString fLastFileDir
void ChangeTerminalTimeStampSlot()
Bool_t ConnectToServer(const char *remotehost, Int_t remoteport, Int_t ascontroller, const char *accesspass)
TGo4BrowserProxy * Browser()
QAction * faAnalTermin
virtual Bool_t IsAdministrator()
TGo4Slot * RatemeterSlot()
QAction * faDrawItem
bool getPadSuperimpose()
bool getDrawTimeFlag()
void InputTerminalParametersSlot()
TObject * GetAssignedObject()
Definition: TGo4Slot.cxx:373
TGo4SetScaleValues * ToggleScaleValues()
void SetDefaultReceiver(TGo4ObjectManager *rcv, const char *path)
QString fOMEditorsPath
QString getHServFilter()
void SavePanelCanvas(TGo4ViewPanel *panel)
void WorkWithDebugOutput(TGo4Slot *slot)
void SetAnalysisReady(Bool_t on=kTRUE)
void setFetchDataWhenDraw(bool on=true)
void setCloneFlag(bool on=true)
void setClientPort(int)
#define __GO4RELEASE__
Definition: TGo4Version.h:25
void setPadCrosshair(bool on)
TGo4Slot * DebugOutputSlot()
virtual Bool_t IsConnected()
void ObjectCreatedByWidget(const char *itemname, TClass *cl)
Definition: QGo4Widget.cpp:42
TGo4Slot * FindChild(const char *name)
Definition: TGo4Slot.cxx:262
void ConnectPad(TPad *pad)
void ResponseOnPanelEvent(int funcid, TGo4ViewPanel *panel, TPad *pad)
Definition: TGo4MdiArea.cpp:90
void windowsMenuAboutToShow()
virtual void ResetDebugOutputRequests()
virtual const char * GetContainedObjectInfo()
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
TGo4HistogramInfo * StartHistogramInfo()
void CreateMemoryFolder(const char *foldername=0)
Int_t IsAnalysisLaunched() const
void getBasicSettings()
void ChangeSaveWhiteBackgroundSlot()
bool getMbsMonitorMonitorActive()
void setHServPort(int port)
TGo4Slot * MakeObjSlot(const char *foldername, const char *name=0, const char *title=0)
virtual Bool_t IsAnalysisServer() const
bool getTermShowTimestamp()
QString fLastPassword
QString getClientArgs()
bool TerminateOnClose() const
void setTermFont(const QFont &)
QAction * faDrawDate
QAction * faLaunchAnal
TGo4AnalysisWindow * EstablishAnalysisWindow(bool needoutput, bool withkillbnt=false, bool force_recreate=false)
virtual Bool_t IsController()
virtual Bool_t UpdateAnalysisObject(const char *objectname, TObject *obj)
QAction * AddChkAction(QMenu *menu, const QString &text, bool checked, QObject *recv, const char *member)
Definition: QGo4Widget.cpp:407
void setAppStyle(const QString &)
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
Definition: TGo4Slot.cxx:471
void setDrawLineWidth(int w=1)
QAction * faFetchWhenCopy
int getClientConnectMode()
TGo4EventInfo * StartEventInfo()
void windowsMenuActivated(int id)
QAction * faSumbStartAnal
static Bool_t GetLaunchString(TString &launchcmd, TString &killcmd, Int_t serverkind, Int_t shellkind, Int_t konsole, const char *name, const char *remotehost, const char *remotedir, const char *remoteexe, Int_t guiport, Int_t exe_kind=0, const char *exeargs=0)
void setDrawOnceFlag(bool on=true)
TGo4QSettings * go4sett
TGo4ViewPanel * GetActivePanel()
Definition: TGo4MdiArea.cpp:64
void WorkWithUpdateObjectCmd(TGo4Slot *slot)
TGo4MdiArea * fxMdiArea
bool getFetchDataWhenSave()
void SetMonitorBlockingFlag(Bool_t blocked=kFALSE)
static const char * Message(Int_t prio, const char *text,...)
Definition: TGo4Log.cxx:209
void *(* TStartUserGuiFunc)(QWidget *parent)
void setFetchDataWhenSave(bool on=true)
bool getPadEventStatus()
virtual Bool_t CanSubmitObjects()
static void ProduceScript(const char *filename, TGo4MainWindow *main)
Definition: TGo4Script.cxx:842
void restoreMainWindowState(QMainWindow *tgt)
TGo4Slot * BrowserSlot(const char *item)
QSignalMapper * winMapper
virtual ~TGo4MainWindow()
QString getTH1DrawOpt()
TGo4ViewPanel * FindViewPanel(const char *name)
bool startUserGUI(const char *)
void AddProxy(const char *pathname, TGo4Proxy *cont, const char *name, const char *title="title")
bool getFetchDataWhenDraw()
virtual void SubmitAnalysisSettings()
QAction * faStopAnal
void CreateNewDynEntrySlot(bool forothereditor=false)
TGo4AnalysisProxy * FindAnalysis(const char *itemname=0)
void setMoveSubwindowRubberBand(bool on=true)
QGo4Widget * FindGo4Widget(const char *name, bool activate)
static const char * GetLinkedName(TGo4Slot *slot)
TGo4ObjectManager * OM()
void CloseFiles(const char *pathname)
TGo4EditDynEntry * StartEditDynEntry()
void setDrawTimeFlag(bool on=true)
Bool_t StartScriptExecution(const char *fname)
Definition: TGo4Script.cxx:74
bool getDrawDateFlag()
void SetStyleSlot(const QString &)
QSize lastPanelSize(const QString &kind="ViewPanel", int dfltwidth=450, int dfltheight=250)
void editorServiceSlot(QGo4Widget *editor, int serviceid, const char *str, void *par)
void setTH2DrawOpt(const QString &value)
QString fKillCommand
void DisconnectAnalysisSlot(bool interactive=true)
QGo4Widget * GetWidget() const
void setHServName(const QString &)
virtual void Delete(Option_t *opt="")
Definition: TGo4Slot.cxx:190
void SubmitStartAnalysisSlot()
virtual void StopAnalysis()
bool getClientDefaultPass()
static TString subGO4SYS(const char *subdir)
Definition: TGo4Log.cxx:192
Bool_t IsWaitSomething()
Definition: TGo4Script.cxx:139
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)
QApplication * fApp
Int_t NumChilds() const
Definition: TGo4Slot.h:76
virtual void closeEvent(QCloseEvent *ce)
TString GetFullName(TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:290
QString getTH3DrawOpt()
virtual Bool_t DelayedRefreshNamesList(Int_t delay_sec)
void getPaletteOpt(int &min, int &def, int &max)
static void SetLinkedName(TGo4Slot *slot, const char *itemname)
void setTermShowTimestamp(bool on)
void setDrawFillStyle(int style)
void setDrawItemFlag(bool on=true)
void setCanvasColor(int red, int green, int blue)
bool getMoveSubwindowRubberBand()
void ChangeFetchWhenSaveSlot()
void ChangeDrawTimeFlagSlot()
TGo4ViewPanel * DisplayBrowserItem(const char *itemname, TGo4ViewPanel *panel, TPad *pad, bool activate, int updatelevel, const char *drawopt)
static const char * GetDabcVersion()
void AppendOutputBuffer(const QString &value, int prio=0)
TGo4AnalysisConfiguration * FindAnalysisConfiguration()
virtual TString FindCommand(const char *name)
void ChangeDrawItemFlagSlot()
QString getGStyleStatFormat()
TGo4ViewPanel * MakeNewPanel(int div=0)
void TerminateAnalysis(bool interactive=true)
const char * LastTypedPassword() const
Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath)
virtual Bool_t SubmitCommand(const char *name, Int_t waitres=-1, const char *arg1=0, const char *arg2=0, const char *arg3=0)
static void AutoEnable(Bool_t on=kTRUE)
Definition: TGo4Log.cxx:380
TGo4AnalysisWindow * FindAnalysisWindow()
void setClientConnectMode(int)
virtual void DropItem(const char *itemname, TClass *cl, int kind)
Definition: QGo4Widget.cpp:93
QMdiSubWindow * AddGo4SubWindow(QWidget *widget, Qt::WindowFlags flags=0)
Definition: TGo4MdiArea.cpp:69
TGo4Slot * GetChild(Int_t n) const
Definition: TGo4Slot.h:77
bool getHideTGo4EventElement()
void setHServBase(const QString &)
bool RemoveAnalysisProxy(int waittime=30, bool servershutdown=false)
void setGStyleStatFormat(const QString &)
Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj=0)
QAction * faDrawTime
virtual void DisconnectAnalysis(Int_t waittime=30, Bool_t servershutdown=kFALSE)
QString getHServBase()
TGo4Style * fxStyle
void CascadeMdiPosition(QWidget *sub)
void setTermTimeFormat(const QString &form)
static Bool_t IsAutoEnabled()
Definition: TGo4Log.cxx:386
QString getClientNode()
void ChangeTerminalTimeStampFormatSlot()
void setAppFont(const QFont &)
TGo4ObjectManager * fxOM
void setPadSuperimpose(bool on)
void ChangeWindowRubberBandSlot()
void ToggleMonitoring(Int_t period)
void PrepareForClientConnectionSlot(bool interactive=true)
TGo4Slot * AddLink(TGo4Slot *source, const char *pathname, const char *linkname, const char *linktitle)
TGo4ConditionInfo * StartConditionInfo()
Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder=0)
TGo4Slot * GetWidgetTopSlot(QGo4Widget *widget, bool force)
void setTGraphDrawOpt(const QString &value)
int getTermHistorySize()
string msg
Definition: go4init.py:11
void WaitForNewObject(bool isobjectforeditor)
static void LogfileEnable(Bool_t on=kTRUE)
Definition: TGo4Log.cxx:369
static Bool_t LaunchAsServer(TString &launchcmd, TString &killcmd, Int_t shellkind, Int_t konsole, const char *name, const char *remotehost, Int_t remoteport, const char *remotedir, const char *remoteexe, Int_t exe_kind=0, const char *exeargs=0)