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