16 #include <QtCore/QString> 17 #include <QtCore/QDateTime> 18 #include <QtCore/QTimer> 19 #include <QtCore/QProcess> 20 #include <QtCore/QHash> 21 #include <QtCore/QDir> 23 #include <QApplication> 25 #include <QDockWidget> 28 #include <QActionGroup> 30 #include <QStyleFactory> 32 #include <QMessageBox> 33 #include <QColorDialog> 34 #include <QFileDialog> 35 #include <QFontDialog> 36 #include <QInputDialog> 37 #include <QMdiSubWindow> 39 #include <QDesktopServices> 54 #include "TGo4LockGuard.h" 122 setWindowIcon(QIcon(
":/icons/go4logo2_big.png"));
158 TH1I* h1 =
new TH1I(
"histo1",
"histo title", 100, -10., 10.);
159 h1->FillRandom(
"gaus",10000);
160 h1->SetDirectory(
nullptr);
173 gStyle->SetPalette(1);
174 gStyle->SetCanvasColor(10);
175 gStyle->SetPadColor(10);
176 gStyle->SetFrameFillColor(10);
177 gStyle->SetStatColor(0);
183 fxMdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
184 fxMdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
188 menuBar()->setNativeMenuBar(kFALSE);
201 QDockWidget* BrowserDockWin =
new QDockWidget(
"Browser",
this);
202 BrowserDockWin->setObjectName(
"BrowserDock");
203 TGo4Browser* browser =
new TGo4Browser(BrowserDockWin,
"Browser");
204 browser->setWindowFlags(Qt::Widget);
206 browser->StartWorking();
207 BrowserDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
208 BrowserDockWin->setWidget(browser);
209 BrowserDockWin->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
210 addDockWidget(Qt::LeftDockWidgetArea, BrowserDockWin);
212 QAction* BrowserDockAction = BrowserDockWin->toggleViewAction();
213 BrowserDockAction->setShortcut(QKeySequence(
"F6"));
215 QDockWidget* LogDockWin =
new QDockWidget(
"Log window",
this);
216 LogDockWin->setObjectName(
"LogInfoDock");
217 TGo4LogInfo* loginfo =
new TGo4LogInfo(
this,
"LogInfo");
219 LogDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
220 LogDockWin->setWidget(loginfo);
221 LogDockWin->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
222 addDockWidget(Qt::BottomDockWidgetArea, LogDockWin);
224 QAction* LogDockWinAction=LogDockWin->toggleViewAction();
225 LogDockWinAction->setShortcut(QKeySequence(
"F7"));
227 QDockWidget* MBSDockWin =
new QDockWidget(
"MBS monitor",
this);
228 MBSDockWin->setObjectName(
"MbsViewerDock");
229 TGo4MBSViewer* mbs =
new TGo4MBSViewer(MBSDockWin,
"MBSViewer");
230 mbs->setWindowFlags(Qt::Widget);
232 MBSDockWin->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
233 MBSDockWin->setWidget(mbs);
234 MBSDockWin->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
235 addDockWidget(Qt::BottomDockWidgetArea, MBSDockWin);
237 QAction* MBSDockAction=MBSDockWin->toggleViewAction();
238 MBSDockAction->setShortcut(QKeySequence(
"F8"));
240 QToolBar* DividePanelBar = addToolBar(
"Canvas Tools");
241 DividePanelBar->setObjectName(
"DividePadDock");
242 TGo4DividePad* dividepanel =
new TGo4DividePad(
this,
"DividePad");
243 DividePanelBar->addWidget(dividepanel);
245 QToolBar* stylebar = addToolBar(
"Color Tools");
246 stylebar->setObjectName(
"Go4StyleDock");
247 fxStyle =
new TGo4Style(
this,
"Go4Style");
250 QToolBar* BrowserOptionsPanel = addToolBar(
"Browser Options");
251 BrowserOptionsPanel->setObjectName(
"BrowserOptionsDock");
252 TGo4BrowserOptions* bropt =
new TGo4BrowserOptions(
this,
"BrowserOptions");
254 BrowserOptionsPanel->addWidget(bropt);
255 bropt->StartWorking();
257 QToolBar* DrawOptionPanel = addToolBar(
"Draw Options");
258 DrawOptionPanel->setObjectName(
"DrawOptionsDock");
259 TGo4HisDrawOptions* drawopt =
new TGo4HisDrawOptions(
this,
"DrawOptions");
260 DrawOptionPanel->addWidget(drawopt);
261 DrawOptionPanel->adjustSize();
263 QToolBar* DrawOptionShortPanel = addToolBar(
"Hist Draw Options");
264 DrawOptionShortPanel->setObjectName(
"HisDrawOptionsDock");
265 TGo4HisDrawOptionsShort* drawopts =
new TGo4HisDrawOptionsShort(
this,
"HisDrawOptions");
266 DrawOptionShortPanel->addWidget(drawopts);
267 DrawOptionShortPanel->adjustSize();
269 QToolBar* ScaleOptionBar = addToolBar(
"Zoom Tools");
270 ScaleOptionBar->setObjectName(
"ScaleOptionsDock");
271 TGo4ScaleOptions* scopt =
new TGo4ScaleOptions(
this,
"ScaleOptions");
273 ScaleOptionBar->addWidget(scopt);
274 ScaleOptionBar->adjustSize();
276 QToolBar* commandlinebar = addToolBar(
"Go4 Command Line");
277 commandlinebar->setObjectName(
"CommandLineDock");
278 TGo4CommandLine* cli =
new TGo4CommandLine(
this,
"CommandLine");
280 commandlinebar->addWidget(cli);
282 QToolBar* tviewerdock = addToolBar(
"Tree viewer");
283 tviewerdock->setObjectName(
"TreeViewerDock");
284 TGo4TreeViewer* tviewer =
new TGo4TreeViewer(
this,
"TreeViewer");
286 tviewerdock->addWidget(tviewer);
306 menuBar()->addSeparator();
308 QMenu* helpMenu = menuBar()->addMenu(
"&Help");
312 helpMenu->addSeparator();
319 const char *libs = gSystem->Getenv(
"GO4USERLIBRARY");
322 #if QT_VERSION < QT_VERSION_CHECK(5,14,0) 323 QStringList LibList = QString(libs).split(
":", QString::SkipEmptyParts);
325 QStringList LibList = QString(libs).split(
":", Qt::SkipEmptyParts);
328 for (
auto it = LibList.begin(); it != LibList.end(); ++it)
329 gSystem->Load((*it).toLatin1().constData());
348 statusBar()->showMessage(
"Ready");
349 statusBar()->setSizeGripEnabled(
true);
352 if (!sfmt.isEmpty()) gStyle->SetStatFormat(sfmt.toLatin1().constData());
369 QMessageBox AboutDialog(QMessageBox::NoIcon, title, text, QMessageBox::Ok,
this);
370 AboutDialog.setIconPixmap(QPixmap(icon));
371 AboutDialog.setTextFormat(Qt::RichText);
377 QString GO4STR(
"Go4 ");
379 QString GO4STR1 = GO4STR;
380 GO4STR1.append(
"<br>");
381 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");
388 QMessageBox::aboutQt(
this,
"Qt");
393 QString mestring(
"This Go4 uses ROOT ");
394 mestring.append(gROOT->GetVersion());
395 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 QString mestring(
"This Go4 uses DABC ");
405 mestring.append(
"<undef>");
406 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");
412 QMenu* settMenu = menuBar()->addMenu(
"&Settings");
414 QMenu* sub = createPopupMenu();
415 sub->setTitle(
"Sh&ow/hide");
416 settMenu->addMenu(sub);
420 QMenu *styleMenu = settMenu->addMenu(
"St&yle");
422 QMenu* prefMenu = settMenu->addMenu(
"&Preferences");
444 QMenu* panelMenu = settMenu->addMenu(
"&Panel defaults");
487 QMenu* termMenu = settMenu->addMenu(
"&Terminal");
500 QActionGroup *ag =
new QActionGroup(
this);
501 ag->setExclusive(
true);
503 QStringList list = QStyleFactory::keys();
505 QHash<QString, int> stylesDict;
506 for (
auto styleStr : list) {
507 QString styleAccel = styleStr;
508 if ( stylesDict[styleAccel.left(1)] ) {
509 for (
int i = 0; i < styleAccel.length(); i++ ) {
510 if ( !stylesDict[styleAccel.mid( i, 1 )] ) {
511 stylesDict.insert(styleAccel.mid( i, 1 ), 1);
512 styleAccel = styleAccel.insert( i,
'&' );
517 stylesDict.insert(styleAccel.left(1), 1);
518 styleAccel =
"&"+styleAccel;
520 QAction *act =
new QAction(styleAccel,
this);
521 act->setCheckable(
true);
524 QObject::connect(act, &QAction::triggered, [&, styleStr]() {
SetStyleSlot(styleStr); });
527 styleMenu->addAction(act);
531 #define CtrlKey(key) ((int)Qt::CTRL | key) 536 QMenu* fileMenu = menuBar()->addMenu(
"&File");
538 fileMenu->addAction(QIcon(
":/icons/open.png" ),
"&Open...",
540 fileMenu->addAction(QIcon(
":/icons/network.png" ),
"Open &Remote...",
543 fileMenu->addAction(QIcon(
":/icons/dabc.png" ),
"Connect &DABC...",
545 fileMenu->addAction(QIcon(
":/icons/http.png" ),
"Connect &HTTP...",
547 fileMenu->addAction(QIcon(
":/icons/histserv.png" ),
"Open HIST &Server...",
549 fileMenu->addAction(QIcon(
":/icons/filesave.png" ),
"Save memor&y...",
551 fileMenu->addAction(QIcon(
":/icons/close.png" ),
"Close all files",
553 fileMenu->addAction(QIcon(
":/icons/exit.png" ),
"E&xit",
554 this, &TGo4MainWindow::close)->setShortcut(
CtrlKey(Qt::Key_X));
559 QToolBar *FileBar = addToolBar(
"File Toolbar" );
560 FileBar->setObjectName(
"FileToolBar");
562 FileBar->addAction( QIcon(
":/icons/open.png" ),
"Open a local file from disk",
565 FileBar->addAction( QIcon(
":/icons/network.png" ),
"Open a remote file from server",
569 FileBar->addAction( QIcon(
":/icons/dabc.png" ),
"Connect to DABC server",
572 FileBar->addAction( QIcon(
":/icons/http.png" ),
"Connect to HTTP server",
575 FileBar->addAction( QIcon(
":/icons/histserv.png" ),
"Connect to running histogram server",
578 FileBar->addAction( QIcon(
":/icons/filesave.png" ),
"Save the content of the browser to a root file",
581 FileBar->addAction( QIcon(
":/icons/close.png" ),
"Close all root files in file browser",
584 FileBar->addAction( QIcon(
":/icons/exit.png" ),
"Exit the Go4",
585 this, &TGo4MainWindow::close);
590 QMenu* toolMenu = menuBar()->addMenu(
"&Tools");
592 toolMenu->addAction(QIcon(
":/icons/chart.png" ),
"&View panel",
594 toolMenu->addAction(QIcon(
":/icons/fitpanel.png" ),
"&Fit panel...",
596 toolMenu->addAction(QIcon(
":/icons/hislist.png" ),
"&Histogram properties...",
598 toolMenu->addAction(QIcon(
":/icons/hiscre.png" ),
"Create New H&istogram...",
600 toolMenu->addAction(QIcon(
":/icons/condlist.png" ),
"C&ondition properties...",
602 toolMenu->addAction(QIcon(
":/icons/condcre.png" ),
"Create new &condition...",
604 toolMenu->addAction(QIcon(
":/icons/zoom.png" ),
"&Event printout...",
606 toolMenu->addAction(QIcon(
":/icons/dynlist.png" ),
"Create &dyn. list entry ...",
608 toolMenu->addAction(QIcon(
":/icons/dllicon.png" ),
"Load li&braries ...",
610 toolMenu->addAction(QIcon(
":/icons/user.png" ),
"&User GUI ...",
616 QToolBar *ToolBar = addToolBar(
"Go4 tools");
617 ToolBar->setObjectName(
"Go4ToolsBar");
619 ToolBar->addAction( QIcon(
":/icons/chart.png" ),
"Create a new view panel",
622 ToolBar->addAction( QIcon(
":/icons/fitpanel.png" ),
"Show/hide the Go4 Fit Panel",
625 ToolBar->addAction( QIcon(
":/icons/hislist.png" ),
"Show histogram properties window",
628 ToolBar->addAction( QIcon(
":/icons/hiscre.png" ),
"Create new ROOT Histogram",
631 ToolBar->addAction( QIcon(
":/icons/condlist.png" ),
"Show condition properties window",
634 ToolBar->addAction( QIcon(
":/icons/condcre.png" ),
"Create new condition in analysis",
637 ToolBar->addAction( QIcon(
":/icons/zoom.png" ),
"Event printout and examination window",
640 ToolBar->addAction( QIcon(
":/icons/dynlist.png" ),
"Create new Dynamic list entry",
643 ToolBar->addAction( QIcon(
":/icons/dllicon.png" ),
"Load Libraries",
646 ToolBar->addAction( QIcon(
":/icons/user.png" ),
"Start user panel",
652 QMenu* anMenu = menuBar()->addMenu(
"&Analysis");
655 anMenu->addAction(QIcon(
":/icons/launchanal.png"),
"Lau&nch analysis...", [
this]() {
LaunchClient(); });
658 anMenu->addAction(QIcon(
":/icons/connect.png"),
"&Connect to running server...", [
this]() {
ConnectServer(); });
661 faPrepareAnal = anMenu->addAction(QIcon(
":/icons/connect.png"),
"&Prepare for client connection...",
664 faDisconnectAnal = anMenu->addAction(QIcon(
":/icons/disconnect.png"),
"Disconnect from analysis",
668 faShutdownAnal = anMenu->addAction(QIcon(
":/icons/shutanal.png"),
"Shutdown analysis",
682 faAnalConfig = anMenu->addAction(QIcon(
":/icons/control.png"),
"Confi&guration...",
this,
686 faAnalTermin = anMenu->addAction(QIcon(
":/icons/analysiswin.png"),
"Analysis &Window",
this,
693 QToolBar *AnalBar = addToolBar(
"Analysis Toolbar");
694 AnalBar->setObjectName(
"AnalysisToolBar");
695 AnalBar->setToolTip(
"Analysis related tool buttons");
715 bool on = !
fxMdiArea->subWindowList().isEmpty();
719 windowsMenu->addAction(
"&Close all",
fxMdiArea, &TGo4MdiArea::closeAllSubWindows)->setEnabled(on);
726 auto loginfo = (TGo4LogInfo *)
FindGo4Widget(
"LogInfo",
false);
731 windowsMenu->addAction(
"Save L&ogwindow")->setEnabled(
false);
732 windowsMenu->addAction(
"Clear &Logwindow")->setEnabled(
false);
740 windowsMenu->addAction(
"Save &Analysis window")->setEnabled(
false);
741 windowsMenu->addAction(
"Clear Analysis &window")->setEnabled(
false);
746 QList<QMdiSubWindow *> windows =
fxMdiArea->subWindowList();
747 for (
int i = 0; i < windows.count(); i++) {
748 QAction *act =
new QAction(windows.at(i)->widget()->windowTitle(),
this);
749 act->setCheckable(
true);
750 act->setChecked(
fxMdiArea->activeSubWindow() == windows.at(i));
754 QObject::connect(act, &QAction::triggered, [
this, i]() {
WindowActivated(i); });
760 QList<QMdiSubWindow *> windows =
fxMdiArea->subWindowList();
761 for (
int i = 0; i < windows.count(); i++ )
762 windows.at(i)->widget()->showMinimized();
767 QList<QMdiSubWindow *> windows =
fxMdiArea->subWindowList();
771 for (
int i = 0; i < windows.count(); i++ ) {
772 windows.at(i)->move(x, y);
780 else showFullScreen();
786 QList<QMdiSubWindow *> windows =
fxMdiArea->subWindowList();
787 if ((
id >= 0) && (
id < windows.count())) {
788 windows.at(
id)->widget()->showNormal();
789 windows.at(
id)->widget()->setFocus();
793 typedef void *(*TStartUserGuiFunc)(QWidget *parent);
797 QString dirname, libname;
801 if (usergui && (strlen(usergui) > 0)) {
802 QFileInfo info(usergui);
805 dirname = info.path();
806 libname = info.fileName();
807 }
else if (info.isDir()) {
811 if ((dirname.length()>0) && (dirname[dirname.length()-1]!=
'/')) dirname+=
"/";
814 bool defaultnames = libname.isEmpty();
816 libname =
"libGo4UserGui";
820 libname = dirname + libname;
822 std::cout <<
"Try usergui: " << libname.toLatin1().constData() << std::endl;
826 if (gSystem->Load(libname.toLatin1().constData()) >= 0) {
828 startfunc = (
TStartUserGuiFunc) gSystem->DynFindSymbol(libname.toLatin1().constData(),
"StartUserPanel");
834 userpanel->setObjectName(
"UserPanel");
839 userpanel->ensurePolished();
843 StatusMessage(
"StartUserPanel() function did not create user widget");
847 std::cout <<
"Start user GUI from ";
848 if (dirname.length()>0)
849 std::cout << dirname.toLatin1().constData() << std::endl;
851 std::cout <<
"$LD_LIBRARY_PATH=" << gSystem->Getenv(
"LD_LIBRARY_PATH") << std::endl;
853 if (loaded) gSystem->Unload(libname.toLatin1().constData());
862 if (userpanel)
return;
865 if (gSystem->Getenv(
"GO4USERGUI"))
866 if (
startUserGUI(gSystem->Getenv(
"GO4USERGUI")))
return;
880 QMessageBox::critical(
this,
"Starting user GUI",
"No suitable libraries found");
892 name = QString(
"Panel") + QString::number(n);
893 }
while (edslot && edslot->
FindChild(name.toLatin1().constData()));
895 TGo4ViewPanel *panel =
new TGo4ViewPanel(
fxMdiArea, name.toLatin1().constData());
907 panel->ensurePolished();
908 panel->CompleteInitialization();
912 int DivX = 1, DivY = 1;
914 TGo4DividePad* divpad = findChild<TGo4DividePad*>(
"DividePad");
917 DivX = divpad->SpinBoxX->value();
918 DivY = divpad->SpinBoxY->value();
920 if (DivX * DivY < ndiv) {
921 DivX = (int) TMath::Sqrt(ndiv*1.);
923 while (DivX*DivY<ndiv) DivY++;
925 panel->Divide(DivX, DivY);
938 if (newx + sub->width() >
fxMdiArea->width()) newx = 0;
939 if (newy + sub->height() >
fxMdiArea->height()) newy = 0;
940 sub->move(newx, newy);
950 if(QMessageBox::question(
this,
"Go4 GUI",
"Really Exit Go4?",
951 QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) {
956 TGo4FitPanel* panel = (TGo4FitPanel*)
FindGo4Widget(
"FitPanel",
false);
957 if (panel) panel->close();
965 bool realshutdown =
false;
975 statusBar()->showMessage(
"Exit.... please wait");
976 QApplication::setOverrideCursor(Qt::WaitCursor);
980 statusBar()->showMessage(
"Closing GUI...");
1001 QMessageBox box(QMessageBox::Critical,
"Exit GUI",
"Analysis is not (yet) shutdown correctly");
1002 auto wait_btn = box.addButton(
"Wait 10 s more", QMessageBox::AcceptRole);
1003 auto kill_btn = box.addButton(
"Kill analysis", QMessageBox::DestructiveRole);
1004 auto exit_btn = box.addButton(
"Exit immediately", QMessageBox::DestructiveRole);
1005 auto cancel_btn = box.addButton(
"Cancel quit", QMessageBox::RejectRole);
1006 box.setDefaultButton(wait_btn);
1010 if (box.clickedButton() == wait_btn) {
1016 if ((box.clickedButton() == cancel_btn) || !box.clickedButton()) {
1017 std::cout <<
"Keep GUI running, press exit once again" << std::endl;
1021 if (box.clickedButton() == kill_btn) {
1022 std::cout <<
"Killing analysis" << std::endl;
1026 if (box.clickedButton() == exit_btn) {
1027 std::cout <<
"GUI closed with analysis still running - may lead to analysis task running forever" << std::endl;
1028 std::cout <<
"Please check running processes with \"ps\" and probably, kill analysis with \"killall go4analysis\" command" << std::endl;
1031 std::cout <<
"----- Exiting Go4 GUI now -----" << std::endl;
1037 QFileDialog fd(
this,
1038 "Select a ROOT file to open it in the Go4 Disk Browser",
1040 QString(
"Root files (*.root);;Root xml files (*.xml);;All files (*.*)"));
1042 fd.setFileMode( QFileDialog::ExistingFiles);
1044 if ( fd.exec() != QDialog::Accepted )
return;
1046 QStringList list = fd.selectedFiles();
1047 QStringList::Iterator it = list.begin();
1048 while( it != list.end() ) {
1049 QString fileName = *it;
1058 TGo4OpenRemoteDialog fd(
this);
1059 if (fd.exec() != QDialog::Accepted)
return;
1061 QString ftype = fd.GetFileType();
1062 QString host = fd.GetServer();
1065 if(ftype.contains(
"root:"))
1066 urlpath =
"root://" + host +
"/";
1068 if (ftype.contains(
"rfio:")) {
1070 urlpath=
"rfio:" + host +
":/";
1074 if (ftype.contains(
"http:")) {
1076 urlpath=
"http://" + host +
"/";
1081 QString fileName = fd.GetFileName();
1083 if(!fileName.isEmpty() && !fileName.contains(
".root"))
1084 fileName.append(
".root");
1086 fileName = urlpath + fileName;
1094 QString dabcnode = QInputDialog::getText(
1095 this,
"Establish connection with DABC",
"Provide dabc server name",
1096 QLineEdit::Normal, QString(), &ok);
1099 if (!
Browser()->ConnectDabc(dabcnode.toLatin1().constData()))
1100 QMessageBox::warning(
this,
"DABC server",
"Cannot connect to DABC server");
1116 httpaddr = QInputDialog::getText(
1117 this,
"Establish connection with HTTP",
"Provide http server name",
1118 QLineEdit::Normal, fulladdress, &ok);
1119 if (!ok)
return nullptr;
1120 QStringList nameportlist = httpaddr.split(
":");
1123 if(nameportlist.at(0).contains(
"http")) {
1128 if(nameportlist.size()<portindex+1 || nameportlist.at(portindex).isEmpty()){
1129 QMessageBox::warning(
this,
"HTTP server connection",
"Could not connect. Please specify port number!");
1132 QString host = nameportlist.at(nameindex);
1133 QStringList hostnamelist = nameportlist.at(nameindex).split(
"//");
1134 if(hostnamelist.size()>1) host = hostnamelist.at(1);
1145 if (!exec)
return nullptr;
1149 if (serv)
StatusMessage(QString(
"Connect with http server %1 %2").arg(httpaddr).arg(serv->
IsGo4Analysis() ?
" as GO4 analysis" :
""));
1156 TGo4LogInfo* loginfo = (TGo4LogInfo*)
FindGo4Widget(
"LogInfo",
false);
1157 if (loginfo) loginfo->WorkWithInfo(serv->
LoginfoSlot());
1167 TGo4HServerConnection dlg(
this,
"Connect to remote HServer",
true );
1174 if (dlg.exec() != QDialog::Accepted)
return;
1182 dlg.PortNumberSpin->value(),
1183 dlg.BaseName->text().toLatin1().constData(),
1184 dlg.UserPassEdt->text().toLatin1().constData(),
1185 dlg.FilterList->text().toLatin1().constData()))
1186 QMessageBox::warning(
this,
"HServer",
"Cannot connect to histogram server");
1191 QFileDialog fd(
this,
1193 "Select root file to fetch and export all browser objects" :
1194 "Select root file to export all local browser objects",
1197 fd.setFileMode( QFileDialog::AnyFile);
1198 fd.setAcceptMode(QFileDialog::AcceptSave);
1199 fd.selectFile(
"export.root");
1201 if (fd.exec() != QDialog::Accepted)
return;
1203 QStringList flst = fd.selectedFiles();
1204 if (flst.isEmpty())
return;
1206 QString fname = flst[0];
1208 if (fname.indexOf(
".root", 0, Qt::CaseInsensitive)<0) fname +=
".root";
1211 QMessageBox::warning(
this,
"Save data to file",
"Specified file can not be created");
1225 size = QInputDialog::getInt(
this,
1226 "Analysis terminal history size in bytes (minimum 10000 bytes)",
1227 "Input 0 if full analysis history should be preserved",
1228 size, 0, 100000000, 10000, &ok);
1230 if ((size > 0) && (size < 10000)) size = 10000;
1242 TGo4LogSettings dlg;
1243 if (dlg.exec() != QDialog::Accepted)
return;
1245 if(dlg.LogfileWrite->isChecked())
1246 TGo4Log::OpenLogfile(dlg.LogfileName->text().toLatin1().constData(),
"Logfile for Go4 GUI",
true);
1256 QApplication::setOverrideCursor( Qt::WaitCursor );
1260 bool result = QDesktopServices::openUrl(QUrl::fromLocalFile(surl));
1263 StatusMessage(msg ? QString(msg) : QString(
"Show ") + filename);
1267 QApplication::restoreOverrideCursor();
1272 HelpWindow(
"docs/Go4Introduction.pdf",
"Show Go4 Introduction manual...");
1277 HelpWindow(
"docs/Go4Reference.pdf",
"Show Go4 Reference manual...");
1282 HelpWindow(
"docs/Go4FitTutorial.pdf",
"Show Go4 Fit tutorial...");
1302 QFont font= QFontDialog::getFont(&ok, QApplication::font(),
this);
1307 QApplication::setFont(font);
1319 if (anw) anw->setFont(font);
1334 QString str = QInputDialog::getText(
this,
"Analysis terminal timestamp format",
1335 "Time format (empty resets to yyyy-MM-dd hh:mm:ss.zzz)",
1339 str =
"yyyy-MM-dd hh:mm:ss.zzz";
1353 QApplication::setStyle(style);
1358 QString output = QDateTime::currentDateTime().toString(Qt::ISODate);
1359 output.append(
": ");
1360 output.append(mess);
1361 statusBar()->showMessage(output, 0);
1374 QString capt =
"Go4 ";
1377 capt += gSystem->HostName();
1383 setWindowTitle(capt);
1386 if (!pr) flag = !ht ?
true:
false;
1403 flag = !ht ? true :
false;
1411 flag = !ht ? false :
true;
1421 bool iscontrolling =
false, issubmit =
false;
1438 if (!go4_serv && root_serv) {
1477 QColor c = QColorDialog::getColor();
1484 TGo4MarkerSettings mset;
1485 if (mset.exec() != QDialog::Accepted)
return;
1491 TGo4OptStatsSettings stset;
1545 w = QInputDialog::getInt(
this,
1546 "Default line width for object drawing",
1547 "Input 1 to preserve default value",
1560 w = QInputDialog::getInt(
this,
1561 "Default fill color for 1D objects (histogram and graph) drawing",
1562 "Input 0 for no fill",
1574 w = QInputDialog::getInt(
this,
1575 "Default fill style for 1D objects (histogram and graph) drawing",
1576 "Input 1001 for solid fill",
1577 w, 0, 4000, 1, &ok);
1586 QString str = QInputDialog::getText(
this,
1587 "Default draw options for TH1 class",
1588 "Input draw options",
1596 QString str = QInputDialog::getText(
this,
1597 "Default draw options for TH2 class",
1598 "Input draw options",
1606 QString str = QInputDialog::getText(
this,
1607 "Default draw options for TH3 class",
1608 "Input draw options",
1616 QString str = QInputDialog::getText(
this,
1617 "Default draw options for TGraph class",
1618 "Input draw options",
1629 if (s0.isEmpty()) s0 = gStyle->GetStatFormat();
1631 QString str = QInputDialog::getText(
this,
1632 "Printf argument for float values - gStyle->GetStatFormat()",
1633 "Input format string like 6.4g (empty - ROOT default)",
1634 QLineEdit::Normal, s0, &ok);
1638 gStyle->SetStatFormat();
1640 gStyle->SetStatFormat(str.toLatin1().constData());
1649 int min = 0, def = 0, max = 0;
1651 QString palvals = QString(
"%1:%2:%3").arg(min).arg(def).arg(max);
1652 QString str = QInputDialog::getText(
this,
1653 "Default Palette options",
1654 "Input - MinIndex:DefaultIndex:MaxIndex",
1655 QLineEdit::Normal, palvals, &ok);
1657 QStringList parts=str.split(
":");
1658 min=parts[0].toInt();
1659 def=parts[1].toInt();
1660 max=parts[2].toInt();
1664 fxStyle->SetPaletteRange(min,def,max);
1675 w = QInputDialog::getDouble(
this,
"HighDPI scaling",
"Please set scale factor. Restart GUI to apply!", w, 0, 50, 1,
1685 QMessageBox::warning(
this,
"Launch analysis",
"Please disconnect analysis first");
1690 TGo4StartClient dlg;
1691 if (dlg.exec()!=QDialog::Accepted)
return;
1699 TString launchcmd, killcmd;
1700 Bool_t res = kFALSE;
1711 if (
ConnectHttpServer(addr.toLatin1().constData(),
nullptr,
nullptr,
false,
true)) {
1713 std::cout<<
"!!! Connected to existing analysis webserver "<<addr.toLatin1().constData()<<
"!!! "<<std::endl;
1718 2, shellmode, termmode,
1721 workdir.toLatin1().constData(),
1731 if ((termmode==2) || (termmode==3)) {
1732 gSystem->Exec(launchcmd.Data());
1735 anw->
StartAnalysisShell(launchcmd.Data(), (shellmode == 0) ? workdir.toLatin1().constData() :
nullptr,
true);
1746 if (isserver == 0) {
1754 workdir.toLatin1().constData(),
1759 if (res && anw && (termmode==1)) {
1760 anw->
StartAnalysisShell(launchcmd.Data(), (shellmode == 0) ? workdir.toLatin1().constData() :
nullptr,
false);
1770 workdir.toLatin1().constData(),
1783 if ((isserver == 1) && interactive) {
1792 if (ana && interactive)
1793 QMessageBox::information(
this,
"Prepare for client connection",
1794 QString(
"Now you can start client from other shell (node) and connect to port ") + QString::number(ana->
ConnectorPort()));
1801 if (force_recreate || (anw->
HasOutput() && !needoutput)) {
1813 anw->ensurePolished();
1816 QToolBar* dock = addToolBar(
"Analysis control");
1817 dock->setObjectName(
"AnalysisControlBar");
1820 dock->addWidget(anw);
1833 if (!serv || (dynamic_cast<TGo4AnalysisProxy *>(serv) !=
nullptr) || (serv->DebugOutputSlot() ==
nullptr))
return;
1838 if (anw->HasLink())
return;
1844 if (anw) anw->WorkWithDebugOutput(serv->DebugOutputSlot());
1845 serv->ResetDebugOutputRequests();
1851 const char *analisysitem =
"Analysis";
1865 if (!anal)
return nullptr;
1869 TGo4LogInfo *loginfo = (TGo4LogInfo *)
FindGo4Widget(
"LogInfo",
false);
1884 if (anw->HasOutput() && !needoutput) {
1926 bool shouldexists =
false;
1930 shouldexists =
true;
1932 shouldexists =
true;
1936 if (shouldexists && !anw) {
1947 TGo4AnalysisStatusMonitor* status =
1948 dynamic_cast<TGo4AnalysisStatusMonitor*
> 1953 status =
new TGo4AnalysisStatusMonitor(statusBar(),
"AnalysisStatusMonitor");
1955 statusBar()->addWidget(status);
1960 }
else if (level == 0) {
1962 status->RemoveLink(
"Ratemeter",
true);
1963 statusBar()->removeWidget(status);
1983 delete conf->parentWidget();
1986 }
else if (level >= 2) {
1988 conf =
new TGo4AnalysisConfiguration(
fxMdiArea,
"AnalysisConfiguration");
1998 conf->WorkWithAnalysis(anal);
2014 QMessageBox::warning(
this,
"Connect client",
"Analysis task is already connected");
2019 QString pass = password;
2021 TGo4ConnectServer dlg;
2024 if (dlg.exec()!=QDialog::Accepted)
return;
2025 pass = dlg.getInput();
2038 def ? nullptr : pass.toLatin1().constData());
2039 StatusMessage(
"Connecting running analysis.... Please wait");
2050 fulladdress.append(
":");
2051 fulladdress.append(portstring);
2053 QString
msg(
"Connecting analysis http server at ");
2054 msg.append(fulladdress).append(QString(
", Please wait"));
2058 pass.toLatin1().constData(),
false,
false);
2119 QMessageBox msgBox(QMessageBox::Warning,
2120 "Disconnect from analysis",
2121 "Analysis runs inside go4 widget.\n" 2122 "If one only disconnects from the analysis,\n" 2123 "it remains invisible and difficult to stop.\n" 2124 "To shutdown it later, one need to reconnect with go4 gui again.\n" 2125 "It is recommended to shutdown analysis now");
2127 auto btnShutdown = msgBox.addButton(
"Shutdown", QMessageBox::DestructiveRole);
2128 auto btnDisconnect = msgBox.addButton(
"Disconnect", QMessageBox::ActionRole);
2129 auto btnCancel = msgBox.addButton(
"Cancel", QMessageBox::RejectRole);
2130 msgBox.setDefaultButton(btnShutdown);
2133 if (msgBox.clickedButton() == btnCancel)
2135 else if (msgBox.clickedButton() == btnShutdown)
2137 else if (msgBox.clickedButton() == btnDisconnect)
2140 QMessageBox msgBox(QMessageBox::Question,
"Disconnect analysis",
"Really disconnect from analysis task?");
2142 auto btnDisconnect = msgBox.addButton(
"Disconnect", QMessageBox::DestructiveRole);
2143 auto btnCancel = msgBox.addButton(
"Cancel", QMessageBox::RejectRole);
2144 msgBox.setDefaultButton(btnDisconnect);
2147 if (msgBox.clickedButton() == btnCancel)
2158 QMessageBox msgBox(QMessageBox::Question,
"Shutdown analysis",
"Really shutdown analysis task?");
2160 auto btnShutdown = msgBox.addButton(
"Shutdown", QMessageBox::DestructiveRole);
2161 auto btnCancel = msgBox.addButton(
"Cancel", QMessageBox::RejectRole);
2162 msgBox.setDefaultButton(btnShutdown);
2165 if (msgBox.clickedButton() == btnCancel)
2170 bool realshutdown =
false;
2187 if (!serv)
return false;
2193 StatusMessage(
"Press Ctrl+S or choose Analysis->Start from the Menu to start the analysis");
2218 if (cmd.Length() > 0) {
2220 StatusMessage(TString::Format(
"Submit %s command to the server", cmd.Data()).Data());
2235 if (cmd.Length()>0) {
2237 StatusMessage(TString::Format(
"Submit %s command to the server", cmd.Data()).Data());
2246 QMessageBox msgBox(QMessageBox::Question,
"Kill analysis process",
2247 QString(
"Kill analysis by shell command: ") +
fKillCommand +
" ?");
2249 auto btnKill = msgBox.addButton(
"Kill", QMessageBox::DestructiveRole);
2250 auto btnCancel = msgBox.addButton(
"Cancel", QMessageBox::RejectRole);
2251 msgBox.setDefaultButton(btnKill);
2254 if (msgBox.clickedButton() == btnCancel)
2271 QProcess* killprocess =
new QProcess;
2275 killprocess->start(progname, args);
2276 QTimer::singleShot(10000, killprocess, &QProcess::deleteLater);
2278 StatusMessage(
"Can not kill analysis. Do it by OS commands");
2287 if (!
fxOM)
return nullptr;
2292 if (!widgslot)
return nullptr;
2297 if (widg && activate) {
2298 if(!widg->isVisible()){
2310 TGo4FitPanel *fitpanel = (TGo4FitPanel*)
FindGo4Widget(
"FitPanel",
true);
2313 fitpanel =
new TGo4FitPanel(
fxMdiArea,
"FitPanel");
2317 fitpanel->ensurePolished();
2320 fitpanel->parentWidget()->showNormal();
2321 fitpanel->setFocus();
2328 TGo4HistogramInfo* hinfo = (TGo4HistogramInfo*)
FindGo4Widget(
"HistogramInfo",
true);
2330 hinfo =
new TGo4HistogramInfo(
fxMdiArea,
"HistogramInfo");
2334 hinfo->ensurePolished();
2335 hinfo->adjustSize();
2343 TGo4ConditionInfo* cinfo = (TGo4ConditionInfo*)
FindGo4Widget(
"ConditionInfo",
true);
2345 cinfo =
new TGo4ConditionInfo(
fxMdiArea,
"ConditionInfo");
2349 cinfo->ensurePolished();
2350 cinfo->adjustSize();
2358 TGo4LoadedLibraries llib(
this);
2366 TGo4Browser* br = (TGo4Browser*)
FindGo4Widget(
"Browser",
false);
2367 if (br) br->ShootUpdateTimer();
2372 TGo4ParaEdit* pedit = (TGo4ParaEdit*)
FindGo4Widget(
"ParaEdit",
true);
2377 if (!cl->IsLoaded()) {
2378 QMessageBox::warning(
nullptr,
"Parameter editor", QString(
"Cannot start parameter editor for incomplete class ") + cl->GetName());
2384 pedit =
new TGo4ParaEdit(
fxMdiArea,
"ParaEdit");
2387 pedit->ensurePolished();
2393 pedit->WorkWithParameter(itemname,
false);
2400 TGo4EditDynEntry* dedit = (TGo4EditDynEntry*)
FindGo4Widget(
"EditDynEntry",
true);
2403 dedit =
new TGo4EditDynEntry(
fxMdiArea,
"EditDynEntry");
2407 dedit->ensurePolished();
2416 TGo4ConditionEditor* wedit = (TGo4ConditionEditor*)
FindGo4Widget(
"ConditionEditor",
true);
2418 wedit =
new TGo4ConditionEditor(
fxMdiArea,
"ConditionEditor");
2422 wedit->ensurePolished();
2430 TGo4EventInfo* einfo = (TGo4EventInfo*)
FindGo4Widget(
"EventInfo",
true);
2433 einfo =
new TGo4EventInfo(
fxMdiArea,
"EventInfo");
2437 einfo->ensurePolished();
2446 return (TGo4AnalysisConfiguration *)
FindGo4Widget(
"AnalysisConfiguration",
false);
2452 QWidget *mdi = conf ? conf->parentWidget() :
nullptr;
2457 if (mdi->isVisible()) {
2460 if (conf->GetNumSteps() == 0) {
2469 if (mdi->isMinimized())
2485 QWidget *mdi = anw->parentWidget();
2487 if (mdi->isVisible()) {
2492 if (mdi->isMinimized()) mdi->showNormal();
2495 QToolBar* dock =
dynamic_cast<QToolBar*
> (anw->parentWidget());
2496 if (dock->isVisible())
2509 anw->parentWidget()->close();
2511 QToolBar* bar =
dynamic_cast<QToolBar*
> (anw->parentWidget());
2524 TGo4MBSViewer *mbs =
dynamic_cast<TGo4MBSViewer *
>(
FindGo4Widget(
"MBSViewer",
false));
2527 if (mbs->parentWidget()->isVisible()) {
2528 mbs->parentWidget()->hide();
2530 mbs->SetNode(nodename);
2531 mbs->parentWidget()->show();
2537 TGo4SetScaleValues* scl =
nullptr;
2539 QList<QMdiSubWindow *> windows =
fxMdiArea->subWindowList();
2540 for (
int i = 0; i < windows.count(); ++i) {
2541 scl =
dynamic_cast<TGo4SetScaleValues *
>(windows.at(i)->widget());
2546 scl =
new TGo4SetScaleValues(
fxMdiArea,
"ScaleValues", Qt::WindowStaysOnTopHint);
2549 scl->ensurePolished();
2552 scl->parentWidget()->close();
2560 TGo4CreateNewHistogram dlg(
this);
2564 dlg.SetLocalAvaliable(isremote != 1);
2566 if (dlg.exec() != QDialog::Accepted)
return;
2567 TH1 *h1 = dlg.MakeHistogram();
2572 if (dlg.GetSelectedCmd()==1) {
2575 if (newitem.Length()>0)
2578 newitem.Data(), h1->IsA());
2581 if ((dlg.GetSelectedCmd() == 2) && an) {
2594 QMessageBox::information(
this,
"Create new condition",
"Cannot create new condition before analysis setup");
2598 TGo4CreateNewCondition dlg(
this);
2600 if (dlg.exec() != QDialog::Accepted)
return;
2618 QMessageBox::information(
this,
"Create new dynamic entry",
"Cannot create new entry before analysis setup");
2622 TGo4CreateNewDynEntry dlg(
this);
2624 if (dlg.exec() != QDialog::Accepted)
return;
2640 if (!editor)
return;
2648 if (!br || !itemname || strlen(itemname) == 0)
return nullptr;
2652 if (!guislot)
return nullptr;
2654 std::cerr <<
" Problem with gui slots" << std::endl;
2660 pad = panel->GetCanvas();
2662 pad = panel->GetActivePad();
2667 panel->SetActivePad(pad);
2668 panel->ShootRepaintTimer();
2671 if (updatelevel < 0) {
2686 if (!br || !itemname)
return false;
2688 TString fileslotname;
2689 const char *filepath =
nullptr;
2694 QMessageBox msgBox(QMessageBox::Question,
"Writing object to file",
2695 QString(
"Overwrite ") + filepath +
" in file " + fileslotname.Data());
2696 auto btnOverwrite = msgBox.addButton(
"Overwrite", QMessageBox::ActionRole);
2697 msgBox.addButton(
"Save to other file", QMessageBox::ActionRole);
2698 auto btnCancel = msgBox.addButton(
"Cancel", QMessageBox::RejectRole);
2699 msgBox.setDefaultButton(btnOverwrite);
2701 if (msgBox.clickedButton() == btnCancel)
2703 if (msgBox.clickedButton() == btnOverwrite)
2708 QString root_fmt =
"ROOT (*.root)";
2709 QString xml_fmt =
"ROOT XML (*.xml)";
2711 QFileDialog fd(
this, QString(
"Save ") + itemname +
" in root file",
fLastFileDir);
2712 fd.setFileMode(QFileDialog::AnyFile);
2713 fd.setAcceptMode(QFileDialog::AcceptSave);
2714 fd.setNameFilters(QStringList() << root_fmt << xml_fmt);
2716 if (fd.exec() == QDialog::Accepted) {
2717 QStringList flst = fd.selectedFiles();
2718 if (!flst.isEmpty()) {
2719 QString filename = flst[0];
2720 if (fd.selectedNameFilter()==xml_fmt) {
2721 if (!filename.endsWith(
".xml")) filename.append(
".xml");
2723 if (!filename.endsWith(
".root")) filename.append(
".root");
2725 res = br->
SaveItemToFile(itemname, filename.toLatin1().constData(), subfolder);
2738 TCanvas *can = panel->GetCanvas();
2740 QFileDialog fd(
this, QString(
"Save ") + panel->objectName() +
" As",
fLastFileDir);
2741 fd.setFileMode( QFileDialog::AnyFile );
2742 fd.setAcceptMode(QFileDialog::AcceptSave);
2744 QString PS =
"Post Script (*.ps)";
2745 QString PS_Portrait =
"Post Script Portrait (*.ps)";
2746 QString PS_Landscape =
"Post Script Landscape (*.ps)";
2747 QString EPS =
"Encapsulated Post Script (*.eps)";
2748 QString EPS_Preview =
"Encapsulated Post Script preview (*.eps)";
2749 QString GIF =
"GIF format (*.gif)";
2750 QString PDF =
"PDF format (*.pdf)";
2751 QString SVG =
"SVG format (*.svg)";
2752 QString XPM =
"XPM format (*.xpm)";
2753 QString PNG =
"PNG format (*.png)";
2754 QString JPG =
"JPG format (*.jpg)";
2755 QString TIFF =
"TIFF format (*.tiff)";
2757 QString CXXM =
"C++ Macro (*.C)";
2758 QString JSONM =
"json file (*.json)";
2759 QString ROOTM =
"root file (*.root)";
2765 flt << PS_Landscape;
2781 fd.setNameFilters(flt);
2783 if (fd.exec() != QDialog::Accepted)
return;
2788 can = (TCanvas *) panel->GetCanvas()->Clone();
2789 can->SetName(
"PrintoutPad");
2791 QStringList flst = fd.selectedFiles();
2792 if (flst.isEmpty())
return;
2794 QString filename = flst[0];
2795 QString filter = fd.selectedNameFilter();
2799 const char *opt =
"ps";
2801 if (filter == EPS) {
2803 if (!filename.endsWith(
".eps"))
2804 filename.append(
".eps");
2805 }
else if (filter == EPS_Preview) {
2807 if (!filename.endsWith(
".eps"))
2808 filename.append(
".eps");
2809 }
else if (filter == PS) {
2811 if (!filename.endsWith(
".ps"))
2812 filename.append(
".ps");
2813 }
else if (filter == PS_Portrait) {
2815 if (!filename.endsWith(
".ps"))
2816 filename.append(
".ps");
2817 }
else if (filter == PS_Landscape) {
2819 if (!filename.endsWith(
".ps"))
2820 filename.append(
".ps");
2821 }
else if (filter == GIF) {
2823 if (!filename.endsWith(
".gif"))
2824 filename.append(
".gif");
2825 }
else if (filter == PDF) {
2827 if (!filename.endsWith(
".pdf"))
2828 filename.append(
".pdf");
2829 }
else if (filter == SVG) {
2831 if (!filename.endsWith(
".svg"))
2832 filename.append(
".svg");
2833 }
else if (filter == XPM) {
2835 if (!filename.endsWith(
".xpm"))
2836 filename.append(
".xpm");
2837 }
else if (filter == PNG) {
2839 if (!filename.endsWith(
".png"))
2840 filename.append(
".png");
2841 }
else if (filter == JPG) {
2843 if (!filename.endsWith(
".jpg"))
2844 filename.append(
".jpg");
2845 }
else if (filter == TIFF) {
2847 if (!filename.endsWith(
".tiff"))
2848 filename.append(
".tiff");
2849 }
else if (filter == CXXM) {
2851 if (!filename.endsWith(
".C"))
2852 filename.append(
".C");
2853 }
else if (filter == JSONM) {
2855 if (!filename.endsWith(
".json"))
2856 filename.append(
".json");
2857 }
else if (filter == ROOTM) {
2859 if (!filename.endsWith(
".root"))
2860 filename.append(
".root");
2864 panel->ResetPadFillColors(can,0);
2865 gROOT->SetBatch(kTRUE);
2868 can->Print(filename.toLatin1().constData(), opt);
2871 gROOT->SetBatch(kFALSE);
2888 if (!widget)
return nullptr;
2890 QString EditorName = widget->objectName();
2893 editorslotname +=
"/";
2894 editorslotname += EditorName;
2896 if (!edslot && force) {
2898 edslot =
fxOM->
GetSlot(editorslotname.toLatin1().constData());
2912 if (actpanel && actpanel->IsRepaintTimerActive())
2913 actpanel->checkRepaintSlot();
2919 for (
int n = 0; n < topslot->
NumChilds(); n++) {
2924 if (!wproxy)
continue;
2926 TGo4ViewPanel *panel =
2927 dynamic_cast<TGo4ViewPanel *
> (wproxy->
GetWidget());
2929 if (panel && (panel != actpanel))
2930 if (panel->IsRepaintTimerActive()) {
2931 panel->checkRepaintSlot();
2942 if (!editor)
return;
2947 if (!edslot)
return;
2949 switch (serviceid) {
2951 QDragMoveEvent *
event = (QDragMoveEvent *) par;
2952 if (!event || !event->mimeData()->hasText())
return;
2954 QString eventstr =
event->mimeData()->text();
2956 bool accept =
false;
2960 accept = editor->
IsAcceptDrag(eventstr.toLatin1().constData(), cl, kind);
2963 if (accept)
event->acceptProposedAction();
2968 QDropEvent *
event = (QDropEvent *) par;
2970 if (!event || !event->mimeData()->hasText())
return;
2972 QString eventstr =
event->mimeData()->text();
2973 event->acceptProposedAction();
2979 auto panel =
dynamic_cast<TGo4ViewPanel *
>(editor);
2980 auto fitpanel =
dynamic_cast<TGo4FitPanel *
>(editor);
2982 panel->DropOnPad((TPad *)str, eventstr.toLatin1().constData(), cl, kind);
2984 fitpanel->DropOnPanel(event, eventstr.toLatin1().constData(), cl, kind);
2986 editor->
DropItem(eventstr.toLatin1().constData(), cl, kind);
2992 TClass *cl = (TClass *) par;
2993 int id = str ? QString(str).toInt() : 0;
2995 if (cl->InheritsFrom(TH1::Class()))
2997 else if (cl->InheritsFrom(TGo4Condition::Class()) && (
id != 0))
2999 else if (cl->InheritsFrom(TGo4DynamicEntry::Class()) && (
id != 0))
3005 void ** res = (
void **) par;
3006 res[0] =
DisplayBrowserItem(str, (TGo4ViewPanel *) res[0], (TPad *) res[1], *((
bool *)res[2]), *((
int *) res[3]),
nullptr);
3011 TGo4ViewPanel **res = (TGo4ViewPanel **) par;
3014 for (
int n = 0; n < topslot->
NumChilds(); n++) {
3019 if (!wproxy)
continue;
3021 TGo4ViewPanel *panel =
3022 dynamic_cast<TGo4ViewPanel *
> (wproxy->
GetWidget());
3025 if (panel->FindPadWithItem(str)) {
3036 for (
int n = 0; n < topslot->
NumChilds(); n++) {
3040 if (!wproxy)
continue;
3042 auto panel =
dynamic_cast<TGo4ViewPanel *
> (wproxy->GetWidget());
3044 panel->UndrawItemOnPanel(str);
3058 TGo4TreeViewer* tviewer =
3059 dynamic_cast<TGo4TreeViewer*
> (
FindGo4Widget(
"TreeViewer",
false));
3061 tviewer->WorkWithLeaf(str);
3062 tviewer->parentWidget()->show();
3069 if (cl->InheritsFrom(TGo4Fitter::Class())) {
3071 TGo4ViewPanel *panel =
dynamic_cast<TGo4ViewPanel *
> (editor);
3072 fitpanel->WorkWithFitter(str, panel, !panel ?
nullptr : panel->GetActivePad());
3073 }
else if (cl->InheritsFrom(TGo4Parameter::Class())) {
3075 }
else if (cl->InheritsFrom(TH1::Class())) {
3077 hinfo->WorkWithHistogram(str);
3078 }
else if (cl->InheritsFrom(TGo4Condition::Class())) {
3080 wedit->WorkWithCondition(str);
3081 }
else if (cl->InheritsFrom(TGo4DynamicEntry::Class())) {
3083 dedit->WorkWithEntry(str);
3084 }
else if (cl->InheritsFrom(TGo4AnalysisStatus::Class())) {
3097 einfo->WorkWithEvent(str);
3101 if (cl->InheritsFrom(TH1::Class())) {
3103 hinfo->WorkWithHistogram(str);
3104 }
else if (cl->InheritsFrom(TGo4Condition::Class())) {
3106 cinfo->WorkWithCondition(str);
3116 if (obj->InheritsFrom(TGo4Fitter::Class())) {
3118 fitpanel->WorkWithFitterInSlot(slot);
3124 const char *subfolder = (
const char *) par;
3126 *((
char *) par) = res ? 1 : 0;
3131 TObject **obj = (TObject **) par;
3133 *obj = res ? (TObject *) 1 :
nullptr;
3143 TGo4ViewPanel **res = (TGo4ViewPanel **) par;
3149 bool* res = (
bool*) par;
3161 TObject **obj = (TObject **) par;
3163 QString **res = (QString **) par;
3165 if (itemname.Length() > 0)
3166 *res =
new QString(itemname.Data());
3179 QByteArray ba = editor->objectName().toLatin1();
3181 if (!str) str = ba.constData();
3184 str,
"link to browser item");
3192 QByteArray ba = editor->objectName().toLatin1();
3193 if (!str) str = ba.constData();
3205 if (!parent) parent = edslot;
3210 brslot->GetName(),
"link in specific subfolder");
3242 if (!edslot)
return;
3243 const char **res = (
const char **) par;
3249 void ** res = (
void **) par;
3258 if (!edslot)
return;
3262 TObject **res = (TObject **) par;
3272 if (!edslot)
return;
3274 if (link) link->
Delete();
3279 if (!str || (strcmp(str,
"complete") != 0))
3288 for (
int n = 0; n < slot->
NumChilds(); n++) {
3290 if (edslot == subslot)
3312 TGo4ViewPanel **res = (TGo4ViewPanel **) par;
3318 if (strcmp(str,
"CloseAnalysisWindow") == 0) {
3322 }
else if (strcmp(str,
"PrintAnalysisHistograms") == 0) {
3324 if (anw) anw->PrintHistograms();
3325 }
else if (strcmp(str,
"PrintAnalysisConditions") == 0) {
3327 if (anw) anw->PrintConditions();
3328 }
else if (strcmp(str,
"DisplayMbsMonitor") == 0) {
3330 }
else if (strcmp(str,
"SubmitAnalysisSettings") == 0) {
3332 }
else if (strcmp(str,
"CloseAnalysisSettings") == 0) {
3336 anal->RefreshNamesList();
3338 }
else if (strcmp(str,
"SubmitStartAnalysis") == 0) {
3340 }
else if (strcmp(str,
"StartAnalysis") == 0) {
3342 }
else if (strcmp(str,
"StopAnalysis") == 0) {
3344 }
else if (strcmp(str,
"TerminateAnalysis") == 0) {
3346 }
else if (strcmp(str,
"UpdateGuiLayout") == 0) {
3348 }
else if (strcmp(str,
"StartEventInfo") == 0) {
3350 }
else if(strcmp(str,
"ActivateConditionEditor") == 0) {
3351 TGo4ConditionEditor* w =
3352 (TGo4ConditionEditor*)
FindGo4Widget(
"ConditionEditor",
true);
3355 w->RefreshWidget(
true);
3357 }
else if (strcmp(str,
"SavePanelCanvas") == 0) {
3359 }
else if (strcmp(str,
"ToggleScaleValues") == 0) {
3361 }
else if (strcmp(str,
"GetFitterFromFitPanel") == 0) {
3362 TGo4FitPanel *panel = (TGo4FitPanel *)
FindGo4Widget(
"FitPanel",
false);
3365 *res = panel->GetFitter();
3366 }
else if (strcmp(str,
"CloneFitterFromFitPanel") == 0) {
3367 auto panel = (TGo4FitPanel *)
FindGo4Widget(
"FitPanel",
false);
3370 *res = panel->CloneFitter();
3402 TGo4ViewPanel *panel = (TGo4ViewPanel *) editor;
3403 TPad *pad = (TPad *) par;
3437 if (!QApplication::overrideCursor())
3438 QApplication::setOverrideCursor(Qt::WaitCursor);
3442 QApplication::restoreOverrideCursor();
3456 QFileDialog::getSaveFileName(
this,
3457 "Create GUI script dialog",
3459 QString(
"GUI hotstart script (*") + ext +
")");
3460 if (fileName.isEmpty())
return;
3462 int pos = fileName.indexOf(ext);
3464 if ((pos<0) || (pos!=fileName.length()-ext.length()))
3474 QToolBar* AnalysisMacroBar = addToolBar(
"Analysis Command Buttons");
3475 AnalysisMacroBar->setObjectName(
"AnalysisCommandToolBar");
3478 TGo4UserCommands* companel =
new TGo4UserCommands(
this,
"UserCommands");
3480 AnalysisMacroBar->addWidget(companel);
3481 AnalysisMacroBar->adjustSize();
3491 if (!name || !*name)
return nullptr;
3493 TGo4ViewPanel *panel =
dynamic_cast<TGo4ViewPanel *
> (
FindGo4Widget(name,
false));
3495 if (panel)
return panel;
3499 for (Int_t n = 0; n < slot->
NumChilds(); n++) {
3502 panel = !wproxy ? nullptr :
dynamic_cast<TGo4ViewPanel *
>(wproxy->
GetWidget());
3505 if (strcmp(panel->GetPanelName(), name) == 0)
void PaletteSettingsSlot()
TGo4ConditionEditor * StartConditionEditor()
void setDrawDateFlag(bool on=true)
QString GetSettLoaction()
void setScreenScaleFactor(double factor)
TGo4Proxy * GetProxy(const char *name)
QAction * faDisconnectAnal
TGo4ServerProxy * ConnectHttpServer(const char *addr=nullptr, const char *user=nullptr, const char *pass=nullptr, bool with_qt_process=false, bool get_analysis_config=false)
bool getSavePadWhiteBackground()
void OpenRemoteFileSlot()
TGo4Slot * GetChild(Int_t n) const
void OpenFile(const char *fname)
Bool_t IsAdministrator() const override
Bool_t ContinueExecution()
void HotStart(const char *fname)
QString getTGraphDrawOpt()
QString getClientAccountName()
void EstablishAnalysisWindowForHttp()
void PrepareForClientConnection(bool interactive=true)
void StartAnalysisShell(const char *cmd, const char *workdir=nullptr, bool aschildprocess=false)
void storeMainWindowState(QMainWindow *src)
void StatusMessage(const QString &mess)
QMdiSubWindow * AddGo4SubWindow(QWidget *widget, Qt::WindowFlags flags=Qt::Widget)
void ChangeTerminalFontSlot()
TGo4AnalysisProxy * AddAnalysisProxy(bool isserver, bool needoutput)
Bool_t IsController() const override
void setTH1DrawOpt(const QString &value)
void HelpWindow(const char *filename, const char *msg=nullptr)
void setHideTGo4EventElement(bool on=true)
TString SaveToMemory(const char *pathname, TObject *obj, Bool_t ownership, Bool_t overwrite=kFALSE)
TObject * GetBrowserObject(const char *name, Int_t update=0)
double getScreenScaleFactor()
void SetProxy(TGo4Proxy *cont)
void ConnectHServerSlot()
void CreateNewHist(int isremote=-1)
void CreateMemoryFolder(const char *foldername=nullptr)
TGo4Slot * UpdateObjectSlot()
void ToggleFullScreenSlot()
void setFetchDataWhenCopy(bool on=true)
void ConnectServer(bool interactive=true, const char *password="")
virtual void ClearLogInfo()
void EventStatusSlot(bool)
Int_t ItemKind(const char *name)
bool SaveBrowserItemToFile(const char *itemname, const char *subfolder)
void setPadEventStatus(bool on)
bool getFetchDataWhenCopy()
TGo4MainWindow(QApplication *)
void AddFile(const char *pathname, const char *filename)
static void ExtractProgArgs(QString &prog, QStringList &args)
QString getTermTimeFormat()
Bool_t IsItemRemote(const char *name)
void checkPanelRepaintSlot()
void ChangeDrawTimeFlagSlot(bool)
void setDrawFillColor(int col)
void ConnectGo4Widget(QGo4Widget *editor)
void setPaletteOpt(int min, int def, int max)
void ToggleAnalysisConfiguration()
TGo4Slot * FindChild(const char *name) const
void LaunchClient(bool interactive=true)
TGo4AnalysisConfiguration * EstablishAnalysisConfiguration(int level)
void MakeFolder(const char *pathname)
virtual Bool_t IsViewer() const
void setHServFilter(const QString &)
TGo4AnalysisProxy * FindAnalysis(const char *itemname=nullptr)
void ChangeHideEventElement(bool)
TGo4Proxy * GetProxy() const
static void OpenLogfile(const char *name=nullptr, const char *headercomment=nullptr, Bool_t appendmode=kFALSE)
virtual void CloseAnalysisSettings()
TClass * ItemClass(const char *name)
Bool_t IsConnected() const override
static const char * FileExtension()
virtual Bool_t CanSubmitObjects() const
QString getClientExec(int mode=-1)
TGo4AnalysisStatusMonitor * EstablishRatemeter(int level)
static void SetIgnoreLevel(Int_t level)
void SetAnalysisLaunched(Int_t on=1)
void UpdateDockAnalysisWindow()
bool SubmitAnalysisSettings()
void ToggleMbsMonitor(const char *nodename)
void CreateNewCondition(bool forothereditor=false)
virtual Bool_t RefreshNamesList()
static void OutputEnable(Bool_t on=kTRUE)
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=nullptr)
void ChangeTerminalTimeStampSlot(bool)
void closeEvent(QCloseEvent *ce) override
virtual void RequestAnalysisSettings()
TGo4Slot * BrowserSlot(const char *item=nullptr)
virtual Bool_t IsAdministrator() const
void setTH3DrawOpt(const QString &value)
void ShowAboudDialog(const QString &title, const QString &text, const QString &icon)
virtual Bool_t IsController() const
virtual void SaveLogInfo()
Bool_t ConnectHServer(const char *servername, Int_t portnumber, const char *basename, const char *userpass, const char *filter)
void CheckConnectingCounterSlot()
virtual Bool_t SubmitCommand(const char *name, Int_t waitres=-1, const char *arg1=nullptr, const char *arg2=nullptr, const char *arg3=nullptr)
void SetHistorySize(int sz)
void setSavePadWhiteBackground(bool on)
int getClientControllerMode()
virtual void StartAnalysis()
void setTermHistorySize(int sz)
static TGo4Script * ScriptInstance()
TGo4FitPanel * StartFitPanel()
TGo4Slot * DataSlot(const char *item)
TString GetFullName(TGo4Slot *toparent=nullptr)
TGo4ParaEdit * StartParaEdit(const char *itemname=nullptr)
Bool_t ConnectToServer(const char *remotehost, Int_t remoteport, Int_t ascontroller, const char *accesspass)
TGo4BrowserProxy * Browser()
TGo4Slot * RatemeterSlot()
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
void InputTerminalParametersSlot()
TObject * GetAssignedObject()
TGo4SetScaleValues * ToggleScaleValues()
void SetDefaultReceiver(TGo4ObjectManager *rcv, const char *path)
void SavePanelCanvas(TGo4ViewPanel *panel)
void SetAnalysisReady(Bool_t on=kTRUE)
Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj=nullptr)
void setFetchDataWhenDraw(bool on=true)
void setCloneFlag(bool on=true)
void setPadCrosshair(bool on)
void UpdateCaptionButtons()
Bool_t IsConnected() const override
void ResponseOnPanelEvent(int funcid, TGo4ViewPanel *panel, TPad *pad)
void windowsMenuAboutToShow()
static void DeleteInstance()
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
TGo4HistogramInfo * StartHistogramInfo()
static Int_t DelayMillisec()
void ChangeFetchWhenSaveSlot(bool)
bool getMbsMonitorMonitorActive()
void setHServPort(int port)
virtual Bool_t IsConnected() const
bool getTermShowTimestamp()
TGo4Slot * MakeObjSlot(const char *foldername, const char *name=nullptr, const char *title=nullptr)
void AddAnalysisMacrosBar()
void SuperimposeSlot(bool)
void setTermFont(const QFont &)
TGo4AnalysisWindow * EstablishAnalysisWindow(bool needoutput, bool withkillbnt=false, bool force_recreate=false)
virtual Bool_t UpdateAnalysisObject(const char *objectname, TObject *obj)
Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder=nullptr)
void setAppStyle(const QString &)
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
void setDrawLineWidth(int w=1)
void ChangeDrawDateFlagSlot(bool)
int getClientConnectMode()
TGo4EventInfo * StartEventInfo()
QAction * faSumbStartAnal
Bool_t IsAnalysisSettingsReady() const
void setDrawOnceFlag(bool on=true)
TGo4ViewPanel * GetActivePanel()
void WorkWithUpdateObjectCmd(TGo4Slot *slot)
void ClearAnalysisOutput()
bool getFetchDataWhenSave()
void SetMonitorBlockingFlag(Bool_t blocked=kFALSE)
void setFetchDataWhenSave(bool on=true)
static void ProduceScript(const char *filename, TGo4MainWindow *main)
void restoreMainWindowState(QMainWindow *tgt)
void ChangeFetchWhenCopySlot(bool)
void WindowActivated(int id)
virtual ~TGo4MainWindow()
void ChangeSaveWhiteBackgroundSlot(bool)
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()
void CreateGUIScriptSlot()
void ChangeFetchWhenDrawSlot(bool)
void setMoveSubwindowRubberBand(bool on=true)
QGo4Widget * FindGo4Widget(const char *name, bool activate)
static const char * GetLinkedName(TGo4Slot *slot)
const char * LastTypedPassword() const
Bool_t IsAnalysisServer() const override
void CloseFiles(const char *pathname)
TGo4EditDynEntry * StartEditDynEntry()
void setDrawTimeFlag(bool on=true)
Bool_t StartScriptExecution(const char *fname)
void SetStyleSlot(const QString &)
bool TerminateOnClose() const
const char * GetContainedObjectInfo() override
void *(* TStartUserGuiFunc)(QWidget *parent)
QSize lastPanelSize(const QString &kind="ViewPanel", int dfltwidth=450, int dfltheight=250)
virtual Bool_t IsAnalysisServer() const
void editorServiceSlot(QGo4Widget *editor, int serviceid, const char *str, void *par)
void setTH2DrawOpt(const QString &value)
void setHServName(const QString &)
void ChangeDrawItemFlagSlot(bool)
void GStyleStatFormatSlot()
void SubmitStartAnalysisSlot()
void CreateNewDynEntry(bool forothereditor=false)
void ChangeCloneFlagSlot(bool)
virtual void StopAnalysis()
bool getClientDefaultPass()
static TString subGO4SYS(const char *subdir)
Bool_t IsAdministrator() const override
void setClientNode(const QString &)
void ShutdownAnalysis(bool interactive=true)
void UpdateTimeStampFormat()
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()
TGo4ViewPanel * DisplayBrowserItem(const char *itemname, TGo4ViewPanel *panel, TPad *pad, bool activate, int updatelevel, const char *drawopt)
static const char * GetDabcVersion()
void DeleteChilds(const char *startedwith=nullptr)
void AppendOutputBuffer(const QString &value, int prio=0)
virtual Bool_t IsGo4Analysis() const
TGo4AnalysisConfiguration * FindAnalysisConfiguration()
virtual TString FindCommand(const char *name)
Int_t IsAnalysisLaunched() const
QString getGStyleStatFormat()
TGo4ViewPanel * MakeNewPanel(int div=0)
void CloseAnalysisWindow()
void TerminateAnalysis(bool interactive=true)
Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath)
static void AutoEnable(Bool_t on=kTRUE)
void Delete(Option_t *opt="") override
void DisconnectAnalysis(bool interactive=true)
TGo4AnalysisWindow * FindAnalysisWindow()
void setClientConnectMode(int)
bool getHideTGo4EventElement()
void setHServBase(const QString &)
void MarkerSettingsSlot()
bool RemoveAnalysisProxy(int waittime=30, bool servershutdown=false)
void setGStyleStatFormat(const QString &)
virtual void DisconnectAnalysis(Int_t waittime=30, Bool_t servershutdown=kFALSE)
TGo4ServerProxy * FindServer(const char *itemname=nullptr, Bool_t asanalysis=kTRUE)
TGo4ServerProxy * ConnectHttp(const char *servername, const char *account=nullptr, const char *pass=nullptr) override
void ToggleAnalysisWindow()
void CascadeMdiPosition(QWidget *sub)
void setTermTimeFormat(const QString &form)
static Bool_t IsAutoEnabled()
void ChangeDrawOnceSlot(bool)
void ChangeTerminalTimeStampFormatSlot()
void setAppFont(const QFont &)
void setPadSuperimpose(bool on)
void ToggleMonitoring(Int_t period)
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=nullptr)
void TerminateAnalysisProcess()
TGo4Slot * AddLink(TGo4Slot *source, const char *pathname, const char *linkname, const char *linktitle)
TGo4ConditionInfo * StartConditionInfo()
void SaveAnalysisOutput()
TGo4Slot * GetWidgetTopSlot(QGo4Widget *widget, bool force)
Bool_t IsWaitSomething() const
void setTGraphDrawOpt(const QString &value)
void ChangeWindowRubberBandSlot(bool)
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=nullptr)
void WaitForNewObject(bool isobjectforeditor)
Bool_t SaveBrowserToFile(const char *filename, Bool_t prefetch=kFALSE, const char *selectedpath=nullptr, const char *description=nullptr)
static void LogfileEnable(Bool_t on=kTRUE)