ATLAS Offline Software
Loading...
Searching...
No Matches
VP1MainWindow.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6// //
7// Implementation of class VP1MainWindow //
8// //
9// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10// //
11// Initial version: April 2007 //
12//
13// Updates:
14// - Riccardo.Maria.Bianchi@cern.ch
15// //
17
19
29
30#ifdef BUILDVP1LIGHT
35#endif
36
38
40#include "VP1Base/IVP1System.h"
41#include "VP1Base/VP1Msg.h"
42#include "VP1Base/VP1Settings.h"
43#include "VP1Base/VP1QtUtils.h"
44
45
46#include <QMessageBox>
47#include <QInputDialog>
48#include <QLabel>
49#include <QCloseEvent>
50#include <QFileDialog>
51#include <QDir>
52#include <QTimer>
53#include <QSettings>
54#include <QComboBox>
55#include <QPainter>
56#include <QPrinter>
57#include <QPrintDialog>
58#include <QProgressBar>
59#include <QStyleFactory>
60#include <QDateTime>
61#include <QMutex>
62#include <QDesktopServices>
63#include <QUrl>
64#include <QProcess>
65#include <QGraphicsView>
66#include <QGraphicsScene>
67#include <QtGui>
68#include <QScrollBar>
69
70
71
72/* FIXME: LCG does not ship QWebEngine with Qt5 at the moment,
73 * but later you want to put it back again!
74 */
75/*
76#include <QtGlobal>
77#if QT_VERSION > QT_VERSION_CHECK(5, 5, 0)
78 #include <QWebEngineView> // Qt 5.6
79#else
80 #include <QtWebKit>
81#endif
82*/
83
84#include <cassert>
85#include <iostream>
86
87
88//_________________________________________________________________________________
90: QMainWindow(parent),
91 m_runnumber(-1),
92 m_eventnumber(-1),
93 m_betweenevents(true),
94 m_mustquit(false),
95 m_dummyemptycontroller(new QWidget(0)),
96 m_scheduler(sched),
97 m_availEvents(ae),
98 m_settingsfile(QDir::homePath()+QDir::separator()+".atlasvp1"),
101 m_mutex(new QMutex()),
102 m_edEditor(0)
103{
104 setupUi(this); // this sets up the GUI
105
107 //
108 #if defined BUILDVP1LIGHT
109 bool checkShowAllCruiseAndEventControls = VP1QtUtils::expertSettingIsSet("expert","ExpertSettings/VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS");
110 #else
111 bool checkShowAllCruiseAndEventControls = VP1QtUtils::environmentVariableIsOn("VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS");
112 #endif
113
114 if (!checkShowAllCruiseAndEventControls) {
115 pushButton_eventseek->setVisible(false);
116 groupBox_cruise->setVisible(false);
117 }
118
119 if (m_availEvents) {
120 connect(m_availEvents,SIGNAL(message(const QString&)),this,SLOT(helperAddToMessageBox(const QString&)));
121 connect(m_availEvents,SIGNAL(freshEventsChanged()),this,SLOT(updateEventControls()));
122 }
123
124 // File menu
125 if(!m_availEvents) {
126 QMenu* menu_file = new QMenu(menubar);
127 menu_file->setObjectName("menu_file");
128 menu_file->setTitle("&File");
129 menubar->addAction(menu_file->menuAction());
130 m_action_addEventFile = menu_file->addAction("&Add event file ...");
131
132 connect(m_action_addEventFile,SIGNAL(triggered(bool)),this,SLOT(addEventFile()));
133 }
134
135 #ifndef BUILDVP1LIGHT
136 pushButton_previousevent->setVisible(false);
137 pushButton_eventselect->setVisible(false);
138 #else
139 pushButton_eventselect->setVisible(true);
140 pushButton_eventselect->setText("Event: 0/0");
141 pushButton_eventselect->setEnabled(false);
142 pushButton_previousevent->setEnabled(false);
143 //Disable all controls that are not available in VP1Light
144 // pushButton_quicksetup_3dcocktail->setEnabled(false);
145 // pushButton_quicksetup_3dcocktail->setToolTip("Not available in VP1Light");
146 pushButton_quicksetup_trackingstudies->setEnabled(false);
147 pushButton_quicksetup_trackingstudies->setToolTip("Not available in VP1Light");
148 pushButton_quicksetup_calostudies->setEnabled(false);
149 pushButton_quicksetup_calostudies->setToolTip("Not available in VP1Light");
150 action_quicklaunch_Tracking_studies->setEnabled(false);
151 action_quicklaunch_Tracking_studies->setToolTip("Not available in VP1Light");
152 action_quicklaunch_Calo_studies->setEnabled(false);
153 action_quicklaunch_Calo_studies->setToolTip("Not available in VP1Light");
154 action_quicklaunch_Storegate_browser->setEnabled(false);
155 action_quicklaunch_Storegate_browser->setToolTip("Not available in VP1Light");
156 action_quicklaunch_trackcalo_commis->setEnabled(false);
157 action_quicklaunch_trackcalo_commis->setToolTip("Not available in VP1Light");
158 m_action_addEventFile->setEnabled(false);
159 #endif
160
162 //Do we need a menu for multiple input directories?
163
164 VP1AvailEvtsLocalDir* availLocal = dynamic_cast<VP1AvailEvtsLocalDir*>(m_availEvents);
165
166 QStringList inputdirs;
167 if (availLocal)
168 inputdirs = availLocal->availableSourceDirectories();
169
170 if (availLocal&&!inputdirs.isEmpty()) {
171
172 QString currentdir = availLocal->currentSourceDir();
173 if (currentdir.endsWith("/"))
174 currentdir.chop(1);
175 m_currentStream = QDir(currentdir).dirName();
176 QMenu * menu_inputdir = new QMenu(menubar);
177 menu_inputdir->setObjectName("menu_inputdir");
178 menu_inputdir->setTitle("&Stream");
179
180 menubar->addAction(menu_inputdir->menuAction());
181
182 QActionGroup * inputdir_actiongroup = new QActionGroup(menu_inputdir);
183 QAction*action_inputdir_current(0);
184 for (QString inputdir : inputdirs) {
185 if (inputdir.endsWith("/"))
186 inputdir.chop(1);
187 QString dirname = QDir(inputdir).dirName();
188 QAction * action_inputdir = new QAction(this);
189 action_inputdir->setObjectName("action_inputdir_"+dirname);
190 action_inputdir->setData(inputdir);
191 action_inputdir->setStatusTip("Get input files from: "+inputdir);
192 action_inputdir->setCheckable(true);
193
194 if (currentdir==inputdir)
195 action_inputdir_current = action_inputdir;
196 menu_inputdir->addAction(action_inputdir);
197 inputdir_actiongroup->addAction(action_inputdir);
198 m_inputdiractions << action_inputdir;
199 connect(action_inputdir,SIGNAL(triggered(bool)),this,SLOT(inputDirectoryActionTriggered()));
200 }
201 if (action_inputdir_current) {
202 action_inputdir_current->blockSignals(true);
203 action_inputdir_current->setChecked(true);
204 action_inputdir_current->blockSignals(false);
205 }
206
207 // Populate inputdirstatuses
208 for(QAction* action : m_inputdiractions)
209 m_inputdirstatuses[action] = VP1DirStatusData(action->data().toString(),
210 QString(),
211 true,
212 false);
213
215 m_streamMenuUpdater->start();
216
217 //Fixme: start timer which every minute checks the status of these directories
218 QTimer *timer = new QTimer(this);
219 connect(timer, SIGNAL(timeout()), this, SLOT(updateInputDirectoriesStatus()));
220 timer->start(5000);//update this menu rather often (this is only for P1 anyway)
221 }
222
223 //.......
224
226 m_tabmanager = new VP1TabManager(this,tabWidget_central,m_channelmanager);
227 stackedWidget_customcontrols->addWidget(m_dummyemptycontroller);
228
229 //Final touches to instructions page:
230
231 // Remove any margins added by the layouts in the stacked
232 // widget. This really ought to be the default for stacked widgets!
233 for (int i=0;i<stackedWidget_central->count();++i)
234 stackedWidget_central->widget(i)->layout()->setContentsMargins(0,0,0,0);
235
236 frame_instructions->setStyleSheet("QFrame#frame_instructions { "+VP1DockWidget::highlightStyle()+" } ");
237 frame_instructions->setFrameShape(QFrame::StyledPanel);
238 // textBrowser_intro1->setStyleSheet("QTextBrowser#textBrowser_intro1 { background-color: rgba(0, 0, 0, 0%) } ");
239 // textBrowser_intro2->setStyleSheet("QTextBrowser#textBrowser_intro2 { background-color: rgba(0, 0, 0, 0%) } ");
240 #ifndef BUILDVP1LIGHT
241 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
242 #else
243 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
244 #endif
245 connect(pushButton_quicksetup_trackingstudies,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
246 connect(pushButton_quicksetup_calostudies,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
247 connect(pushButton_quicksetup_geometrystudies,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
248 connect(pushButton_quicksetup_analysisstudies,SIGNAL(clicked()),this,SLOT(quickSetupTriggered()));
249
250 //Default application font:
251 m_defaultfont = QApplication::font();
255 else
257
258 //Tabs:
259 connect(m_tabmanager,SIGNAL(tabListChanged(QStringList)),this,SLOT(tabListChanged(QStringList)));
260 connect(tabWidget_central,SIGNAL(currentChanged(int)),this,SLOT(updateCentralStackWidget()));
262
263 //Channels:
264
265 connect(pushButton_saveAllChannels,SIGNAL(clicked()),this,SLOT(saveAllCurrentChannels()));
266 connect(pushButton_makeEventDisplay,SIGNAL(clicked()),this,SLOT(makeAllChannelsEventDisplay()));
267
268 connect(pushButton_3D,SIGNAL(clicked()),this,SLOT(launch3DstereoEditor()));
269
270 connect(pushButton_channelfullscreen,SIGNAL(clicked()),m_tabmanager,SLOT(showCurrentChannelFullScreen()));
271 connect(pushButton_channelinformation,SIGNAL(clicked()),this,SLOT(request_channelInformation()));
272 connect(pushButton_printchannel,SIGNAL(clicked()),this,SLOT(request_printChannel()));
273 connect(pushButton_savesnapshotchannel,SIGNAL(clicked()),this,SLOT(request_saveChannelSnapshot()));
275
276 //Menu:
277 //Quick start:
278 connect(action_quicklaunch_Tracking_studies,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
279 connect(action_quicklaunch_Calo_studies,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
280 connect(action_quicklaunch_Geometry_studies,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
281 connect(action_quicklaunch_analysisstudies,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
282 connect(action_quicklaunch_Storegate_browser,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
283 connect(action_quicklaunch_3dcocktail,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
284 connect(action_quicklaunch_trackcalo_commis,SIGNAL(triggered(bool)),this,SLOT(quickSetupTriggered()));
285 connect(action_exit_VP1,SIGNAL(triggered(bool)),this,SLOT(close()));
286
287 //Configuration
288 m_menu_loadConfFile = menuConfiguration->addMenu ( "&Load tab configuration from file" );
289 m_menu_loadConfFile->setStatusTip("Select .vp1 config file to load");
290 connect(m_menu_loadConfFile,SIGNAL(aboutToShow()),this,SLOT(showMenu_loadConfFile()));
291 menuConfiguration->addSeparator();
292 //plugins:
293 m_menu_loadPlugin = menuConfiguration->addMenu ( "&Load plugin" );
294 m_menu_loadPlugin->setStatusTip("Select plugin to load");
295 // m_action_infoAboutLoadedPlugins = menuPlugins->addAction ( "&Info about loaded plugins" );
296 // m_action_infoAboutLoadedPlugins->setStatusTip("Get information about the presently loaded plugins");
297 // m_action_infoAboutLoadedPlugins->setEnabled(false);
298 connect(m_menu_loadPlugin,SIGNAL(aboutToShow()),this,SLOT(showMenu_loadPlugin()));
299 //Style
300 m_menu_changeStyle = menu_Style->addMenu ( "&Style" );
301 QActionGroup * styleGroup = new QActionGroup(this);
302 QAction * laststyleact(0);
303 bool foundplastique=false;
304 QSettings s(m_settingsfile,QSettings::IniFormat);
305 QString defaultstyle=s.value("style/defaultstyle", "Fusion").toString();
306 for (QString style : QStyleFactory::keys() ) {
307 QAction * act = m_menu_changeStyle->addAction(style);
308 act->setStatusTip("Change application style to "+style);
309 connect(act,SIGNAL(triggered(bool)),this,SLOT(changeStyleActionTriggered()));
310 act->setCheckable(true);
311 styleGroup->addAction(act);
312 laststyleact=act;
313 if (act->text()==defaultstyle) {
314 act->setChecked(true);
315 QApplication::setStyle(QStyleFactory::create(act->text()));
316 foundplastique=true;
317 }
318 }
319 if (!foundplastique) {
320 laststyleact->setChecked(true);
321 QApplication::setStyle(QStyleFactory::create(laststyleact->text()));
322 }
323 //Fonts:
324 int savedgoal = 0;
326 savedgoal = s.value("font/pixelsize_diff", 0).toInt();
327 else
328 savedgoal = s.value("font/pointsize_relativepercent", 0).toInt();
329
330 m_menu_changeFontSize = menu_Style->addMenu ( "&Font size" );
331 QList<int> fontoptions;
333 fontoptions <<15<<10<<+5<<+3<<+2<<+1<<0<<-1<<-2<<-3<<-5<<-10<<-20<<-30;
334 else
335 fontoptions <<150<<100<<50<<30<<20<<10<<5<<0<<-5<<-10<<-20<<-30<<-50;
336
337 QActionGroup * fontGroup = new QActionGroup(this);
338 bool foundsavedgoal(false);
339 QAction * normalfontact(0);
340 for (int fontopt : fontoptions) {
342 continue;
343 QString text = (fontopt==0?"normal": (fontopt>0?"+":"")+QString::number(fontopt)+(m_defaultfont_pointsize < 0.0? " pixels" : "%"));
344 QAction * act = m_menu_changeFontSize->addAction(text);
345 act->setStatusTip("Change overall font size of application to "+text);
346 act->setData(fontopt);
347 act->setCheckable(true);
348 fontGroup->addAction(act);
349 connect(act,SIGNAL(triggered(bool)),this,SLOT(changeFontSizeActionTriggered()));
350 if (fontopt==0)
351 normalfontact=act;
352 if (savedgoal==fontopt) {
353 act->setChecked(true);
354 changeFontSize(fontopt);
355 foundsavedgoal=true;
356 }
357 }
358 if (!foundsavedgoal) {
359 normalfontact->setChecked(true);
360 }
361
362 //
363 m_actionSave_current_tabs = menuConfiguration->addAction ( "&Save current tab configuration to file" );
364 m_actionSave_current_tabs->setStatusTip("Save current tab/channel layout to .vp1 config file");
365 menuConfiguration->addSeparator();
366 m_actionAdd_empty_tab = menuConfiguration->addAction ( "&Add empty tab" );
367 m_actionAdd_empty_tab->setStatusTip("Add empty tab to the current tab list");
368 connect(m_actionAdd_empty_tab,SIGNAL(triggered(bool)),this,SLOT(request_addEmptyTab()));
369 connect(m_actionSave_current_tabs,SIGNAL(triggered(bool)),this,SLOT(request_saveasConfig()));
370
371 //ExpertSettings
372 #ifdef BUILDVP1LIGHT
373 menuConfiguration->addSeparator();
374 m_actionEnableExpertSettings = menuConfiguration->addAction ( "&Settings" );
375 m_actionEnableExpertSettings->setStatusTip("Open additional settings");
376 connect(m_actionEnableExpertSettings, &QAction::triggered, this, &VP1MainWindow::request_expertSettings);
377 #endif
378
379 //Event navigation:
380 connect(pushButton_nextevent,SIGNAL(clicked()),this,SLOT(goToNextEvent()));
381 #ifdef BUILDVP1LIGHT
382 connect(pushButton_previousevent,SIGNAL(clicked()),this,SLOT(goToPreviousEvent()));
383 connect(pushButton_eventselect,SIGNAL(clicked()),this,SLOT(chooseEvent()));
384 #endif
385
386 //Listen for external requests:
388 listenOnTcp();
389 // updateTcpIcon();
390 connect(&m_tcpserver,SIGNAL(listenStateChanged(bool)),this,SLOT(updateTcpIcon()));
393 m_blockallmessages=false;
395
396 //Cruise:
397 connect(pushButton_cruise,SIGNAL(clicked()),this,SLOT(request_cruisemodechange()));
398 connect(radioButton_cruise_event,SIGNAL(clicked()),this,SLOT(request_cruisemodechange()));
399 connect(radioButton_cruise_tab,SIGNAL(clicked()),this,SLOT(request_cruisemodechange()));
400 connect(radioButton_cruise_both,SIGNAL(clicked()),this,SLOT(request_cruisemodechange()));
401
402 // Help menu
403 QMenu* menu_help = new QMenu(menubar);
404 menu_help->setObjectName("menu_help");
405 menu_help->setTitle("&Help");
406 menubar->addAction(menu_help->menuAction());
407 m_action_openVP1Site = menu_help->addAction("VP1 &Web Site");
408 m_action_openUsersGuide = menu_help->addAction("VP1 &User's Guide");
409 m_action_openUsersSupport = menu_help->addAction("VP1 User's &Support (in the system browser)");
410 menu_help->addSeparator();
411 m_action_openAbout = menu_help->addAction("&About VP1");
412
413 QTimer::singleShot(0, this, SLOT(postInitUpdates()));
416
417 connect(m_action_openUsersGuide,SIGNAL(triggered(bool)),this,SLOT(help_openUserGuide()));
418 connect(m_action_openVP1Site,SIGNAL(triggered(bool)),this,SLOT(help_openVP1WebSite()));
419 connect(m_action_openUsersSupport,SIGNAL(triggered(bool)),this,SLOT(help_openUserSupport()));
420 connect(m_action_openAbout,SIGNAL(triggered(bool)),this,SLOT(help_openAbout()));
421
422 // FIXME: enabling menubar again. It's part of a quickfix, described here: https://its.cern.ch/jira/browse/ATLASVPONE-120
423 #ifndef BUILDVP1LIGHT
424 menubar->setEnabled(false);
425 #endif
426}
427
428//_________________________________________________________________________________
430{
431 VP1Msg::messageDebug("VP1MainWindow::launch3DstereoEditor()");
432 m_tabmanager->launchStereoEditorCurrentTab();
433
434}
435
436//_________________________________________________________________________________
438 /*
439 * Open the online help from a web url location
440 * with the default system web browser
441 */
442 VP1Msg::messageDebug("VP1MainWindow::help_openUserGuide()");
443 // we use here the default system browser
444 QDesktopServices::openUrl(QUrl("http://atlas-vp1.web.cern.ch/atlas-vp1/doc/"));
445 return;
446}
447
448//_________________________________________________________________________________
450 /*
451 * Open the online page with links to the JIRA issue collectors
452 * with the default system web browser
453 */
454 VP1Msg::messageDebug("VP1MainWindow::help_openUserSupport()");
455 // we use here the default system browser
456 QDesktopServices::openUrl(QUrl("http://atlas-vp1.web.cern.ch/atlas-vp1/vp1_users_support/"));
457 return;
458}
459
460//_________________________________________________________________________________
462 /*
463 * Open the online help from a web url location
464 * with the default system web browser
465 */
466 VP1Msg::messageDebug("VP1MainWindow::help_openVP1WebSite()");
467 // we use here the default system browser
468 QDesktopServices::openUrl(QUrl("http://atlas-vp1.web.cern.ch/atlas-vp1/"));
469 return;
470}
471
472
473//_________________________________________________________________________________
475 /*
476 * open the online help
477 */
478 VP1Msg::messageDebug("VP1MainWindow::help_openAbout()");
479 // we use here the default system browser
480 QDesktopServices::openUrl(QUrl("https://atlas-vp1.web.cern.ch/atlas-vp1/doc_new/about_vp1/CREDITS.html"));
481 return;
482}
483
484
485//_________________________________________________________________________________
487
488 //Make sure that the splitters give maximum space for the tab area.
489
490 int sum1 = splitter_tabwidget_messagebox->sizes().at(0) + splitter_tabwidget_messagebox->sizes().at(1);
491 QList<int> sizes1; sizes1 << sum1 << 0;
492 splitter_tabwidget_messagebox->setSizes ( sizes1 );
493 int bottom = 1;
494 while (splitter_tabwidget_messagebox->sizes().at(1)==0&&bottom<50000) {
495 QList<int> sizes2; sizes2 << sum1-bottom << bottom;
496 splitter_tabwidget_messagebox->setSizes ( sizes2 );
497 ++bottom;
498 }
499
500 int sum2 = splitter_leftright->sizes().at(0) + splitter_leftright->sizes().at(1);
501 int left = 300;
502 QList<int> sizes3; sizes3 << left << sum2-left;
503 splitter_leftright->setSizes ( sizes3 );
504 while (splitter_leftright->sizes().at(0)==0&&left<50000) {
505 QList<int> sizes4; sizes4 << left << sum2-left;
506 splitter_leftright->setSizes ( sizes4 );
507 ++left;
508 }
509
510 int prefwidths = std::max<int>(left,widget_controlsContainer->sizeHint().width());
511 prefwidths = std::max<int>(prefwidths,groupBox_channelcontrols->sizeHint().width());
512 prefwidths = std::max<int>(prefwidths,groupBox_cruise->sizeHint().width());
513 prefwidths = std::max<int>(prefwidths,groupBox_event->sizeHint().width());
514 prefwidths = std::max<int>(prefwidths,stackedWidget_customcontrols->sizeHint().width());
515 widget_controlsContainer->setMaximumWidth(50+prefwidths);
516 // int h1(textBrowser_intro1->viewport()->sizeHint().height());
517 // textBrowser_intro1->setMaximumHeight(h1+2);
518 if (m_availEvents)
519 m_availEvents->init();
521}
522
523//_________________________________________________________________________________
525 progressbar = new QProgressBar();
526 progressbar->setMinimum(0);
527 progressbar->reset();
528 progressbar->setOrientation(Qt::Horizontal);
529 statusBar()->addPermanentWidget(progressbar);
530 m_statusbarlabel = new QLabel();
531 //Turn off ugly box around items in statusbar:
532 statusBar()->setStyleSheet("QStatusBar::item { border-width: 0 }");
533 statusBar()->addPermanentWidget(m_statusbarlabel);
534 progressbar->hide();
535}
536
537//_________________________________________________________________________________
539{
540 if (m_edEditor) {
541 VP1Msg::messageDebug("deleting the editor");
542 delete m_edEditor;
543 }
544 VP1Msg::messageDebug("deleting the tab manager");
545 delete m_tabmanager;
546 VP1Msg::messageDebug("deleting the channel manager");
547 delete m_channelmanager;
548 VP1Msg::messageDebug("deleting the events");
549 delete m_availEvents;
550
552 VP1Msg::messageDebug("deleting the streamupdater");
553 m_streamMenuUpdater->quit();
554 m_streamMenuUpdater->deleteLater();
555 }
556
557 VP1Msg::messageDebug("deleting the mutex");
558 delete m_mutex;
559
560 VP1Msg::messageDebug("deleting the view");
561}
562
563//_________________________________________________________________________________
565 return m_mustquit;
566}
567
568
569//_________________________________________________________________________________
571{
572 bool l = m_tcpserver.isListening();
573 m_statusbarlabel->setPixmap(QIcon(l?":/vp1/icons/icons/network_64x64.png":":/vp1/icons/icons/network_disconnect_64x64.png")
574 .pixmap(progressbar->height(),progressbar->height(),QIcon::Normal,QIcon::On));
575 m_statusbarlabel->setToolTip(l?"Listening on port "+QString::number(m_tcpserver.port())+" for incoming messsages"
576 :"VP1 is presently NOT listening for incoming messages");
577
578}
579
580//_________________________________________________________________________________
581void VP1MainWindow::loadPluginFile(const QString& filename)
582{
583 VP1Msg::messageDebug("loadPluginFile()");
584
585 QString err = m_channelmanager->loadPluginFile(filename);
586 if (!err.isEmpty()) {
587 QMessageBox::critical(0, "Error - could not load plugin file: "+filename,
588 "Could not load plugin file: "
589 +filename+"\n\nReason: "+err,QMessageBox::Ok,QMessageBox::Ok);
590 VP1Msg::message("Could not load plugin file: "+filename+"\n\nReason: "+err);
591 }
592 //Fixme: Error message here is hardcoded to be the same as in loadPluginFile method!!
593}
594
595//_________________________________________________________________________________
597 bool ok;
598 QString newtabname = QInputDialog::getText( 0, "New Tab Name","New tab name:",
599 QLineEdit::Normal, m_tabmanager->suggestNewTabName("My Tab"), &ok );
600 if (!ok||newtabname.isEmpty())
601 return;
602 m_tabmanager->addNewTab(newtabname);
603}
604
605//_________________________________________________________________________________
606void VP1MainWindow::tabListChanged(const QStringList& l) {
608 if (l.count()) {
609 m_actionSave_current_tabs->setEnabled(true);
610 groupBox_cruise->setEnabled(true);
611 } else {
612 m_actionSave_current_tabs->setEnabled(false);
613 groupBox_cruise->setEnabled(false);
614 }
615 if (l.count()>1) {
616 radioButton_cruise_tab->setEnabled(true);
617 radioButton_cruise_both->setEnabled(true);
618 } else {
619 if (radioButton_cruise_tab->isChecked()||radioButton_cruise_both->isChecked())
620 radioButton_cruise_event->setChecked(true);
621 radioButton_cruise_tab->setEnabled(false);
622 radioButton_cruise_both->setEnabled(false);
623 }
624}
625
626//_________________________________________________________________________________
627void VP1MainWindow::addChannelIconsToComboBox(QComboBox* cb, const bool& isbasenames) {
628 int n= cb->count();
629 for (int i = 0; i<n; ++i) {
630 QString icontext = m_channelmanager->getIconLocation(cb->itemText(i), isbasenames);
631 if (!icontext.isEmpty())
632 cb->setItemIcon ( i, QIcon(icontext) );
633 }
634}
635
636//_________________________________________________________________________________
638{
639 VP1Msg::messageDebug("VP1MainWindow::selectedChannelChanged()");
640
641 //Controls box:
642 if (cw) {
643 groupBox_channelcontrols->setTitle("Controls: "+cw->unique_name());
644 groupBox_channelcontrols->setEnabled(true);
645 QWidget* controller = m_channelmanager->getController(cw);
646 if (!controller) {
647 stackedWidget_customcontrols->setCurrentWidget(m_dummyemptycontroller);
648 } else {
649 if (stackedWidget_customcontrols->indexOf(controller)==-1)
650 stackedWidget_customcontrols->addWidget(controller);
651 stackedWidget_customcontrols->setCurrentWidget(controller);
652 }
653 } else {
654 groupBox_channelcontrols->setTitle("Controls: no channel selected");
655 groupBox_channelcontrols->setEnabled(false);
656 stackedWidget_customcontrols->setCurrentWidget(m_dummyemptycontroller);
657 }
658
659 // FIXME: enabling menubar again. It's part of a quickfix, described here: https://its.cern.ch/jira/browse/ATLASVPONE-120
660 menubar->setEnabled(true);
661
662 // FIXME: enabling menubar again. It's part of a quickfix, described here: https://its.cern.ch/jira/browse/ATLASVPONE-120
663 menubar->setEnabled(true);
664}
665
666//_________________________________________________________________________________
668
669 QString filename = QFileDialog::getSaveFileName(this, "Select configuration file to save",
671 "VP1 Configuration files (*.vp1)",0,QFileDialog::DontResolveSymlinks);
672 if(filename.isEmpty())
673 return;
674
675 if (!filename.endsWith(".vp1"))
676 filename += ".vp1";
677
678 m_tabmanager->saveConfigurationToFile(filename,false/*Since the filedialog already asks*/);
679 m_currentconfigfile=filename;
680}
681
682//_________________________________________________________________________________
684{
685 if (m_currentconfigfile.isEmpty()) {
687 return;
688 }
689 m_tabmanager->saveConfigurationToFile(m_currentconfigfile,false);
690}
691
692//_________________________________________________________________________________
694{
695 QString filename = QFileDialog::getOpenFileName(this, "Select configuration file to load",
697 "VP1 configuration files (*.vp1)",0,QFileDialog::DontResolveSymlinks);
698 if(filename.isEmpty())
699 return;
700 m_tabmanager->loadConfigurationFromFile(filename,availablePluginFiles());
701 m_currentconfigfile=filename;
702}
703
704//_________________________________________________________________________________
706{
707#ifdef __APPLE__
708 QString sharedlibsuffix = "dylib";
709#else
710 QString sharedlibsuffix = "so";
711#endif
712 qDebug() << "VP1MainWindow::request_loadPlugin()"<<m_currentloadpluginpath;
713
714 QString filename = QFileDialog::getOpenFileName(this, "Select plugin file to load",
716 "VP1 plugin files (*VP1*."+sharedlibsuffix+")",0,QFileDialog::DontResolveSymlinks);
717 if(filename.isEmpty())
718 return;
719 m_currentloadpluginpath = QFileInfo(filename).dir().absolutePath();
720 loadPluginFile(filename);
721}
722
723//_________________________________________________________________________________
724QMap<QString,QString> VP1MainWindow::availableFiles(const QString& extension,
725 const QString& pathvar,//LD_LIBRARY_PATH or DATAPATH
726 const QString& instareasubdir,
727 const QString& extradirenvvar,
728 bool currentdir ) const
729{
730
731 qDebug() << "VP1MainWindow::availableFiles()";
732 qDebug() << "extension:" << extension << "pathvar:" << pathvar << "instareasubdir:" << instareasubdir << "extradirenvvar:" << extradirenvvar << "currentdir:" << currentdir;
733
734
735 //Add directories from extradirenvvar (e.g. $VP1PLUGINPATH)
736 QStringList vp1pluginpath =
737 extradirenvvar.isEmpty() ?
738 QStringList() :
739 QString(::getenv(extradirenvvar.toStdString().c_str())) .
740#if QTCORE_VERSION >= 0x050E00
741 split(":",Qt::SkipEmptyParts);
742#else
743 split(":",QString::SkipEmptyParts);
744#endif
745 if(VP1Msg::debug()){
746 qDebug() << "extradirenvvar:" << extradirenvvar;
747 qDebug() << "vp1pluginpath:" << vp1pluginpath;
748 }
749
750 #ifdef BUILDVP1LIGHT
751 //Add dir from Expert Settings
752 if(VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1PLUGINPATH")==""){
753 vp1pluginpath<<QCoreApplication::applicationDirPath()+"/../lib";
754 } else{
755 vp1pluginpath<<VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1PLUGINPATH");
756 }
757 #endif
758
759 //Currentdir:
760 if (currentdir) {
761 vp1pluginpath<<QDir::currentPath();
762 if (QDir::currentPath()!=VP1Settings::defaultFileSelectDirectory())
764 }
765
766 //Add directories from pathvar (looking in subdir instareasubdir):
767 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
768 VP1Msg::messageDebug("This is the 'pathvar' variable: " + pathvar);
769 QString path = env.value(pathvar);
770 VP1Msg::messageDebug("Add directories from 'pathvar' variable: " + path);
771
772 if (!path.isEmpty()) {
773#if QTCORE_VERSION >= 0x050E00
774 VP1Msg::messageDebug("We're using Qt5...");
775 QStringList tmp = path.split(":",Qt::SkipEmptyParts);//This 'tmp' is for SLC3 compilation.
776#else
777 VP1Msg::messageDebug("We're using Qt older than 5...");
778 QStringList tmp = path.split(":",QString::SkipEmptyParts);//This 'tmp' is for SLC3 compilation.
779#endif
780 for (const QString& dir : tmp) {
781 vp1pluginpath << ( instareasubdir.isEmpty() ? dir : dir+QDir::separator()+instareasubdir );
782 }
783 }
784
785 // Remove duplicates
786 int nDuplicatesRemoved = vp1pluginpath.removeDuplicates();
787 VP1Msg::messageDebug("Removed '" + QString::number(nDuplicatesRemoved) + "' duplicate paths.");
788
789 // Remove all nonexisting directories:
790 QStringList validPluginPaths;
791 validPluginPaths.reserve(vp1pluginpath.size());
792 for (const QString& plugindir : vp1pluginpath) {
793 VP1Msg::messageDebug("plugindir: '" + plugindir + "'");
794 QFileInfo fi(plugindir);
795
796 if (fi.exists() && fi.isDir()) {
797 validPluginPaths << plugindir;
798 } else {
799 VP1Msg::messageDebug("Removed non-valid path: '" + plugindir + "'");
800 }
801 }
802 vp1pluginpath = validPluginPaths;
803
804
805 //Find all files with required extension in the directories (in case of duplicates - the ones appearing first are used):
806 QMap<QString,QString> plugins2fullpath;
807 for (const QString& plugindir : vp1pluginpath) {
808 QStringList plugins = QDir(plugindir).entryList((QStringList()<<("*"+extension)),QDir::CaseSensitive | QDir::Files | QDir::Readable,QDir::Name);
809 for (QString plugin : plugins) {
810 plugin = QFileInfo(plugin).fileName();
811 if (!plugins2fullpath.contains(plugin)) {
812 QString fullpath = plugindir+QDir::separator()+plugin;
813 plugins2fullpath[plugin]=fullpath;
814 }
815 }
816 }
817 return plugins2fullpath;
818}
819
820//_________________________________________________________________________________
821QMap<QString,QString> VP1MainWindow::availablePluginFiles() const
822{
823VP1Msg::messageDebug("VP1MainWindow::availablePluginFiles()");
824
825#ifdef __APPLE__
826 QString sharedlibsuffix = "dylib";
827#else
828 QString sharedlibsuffix = "so";
829#endif
830
831 return availableFiles( "."+sharedlibsuffix, "LD_LIBRARY_PATH", "vp1plugins", "VP1PLUGINPATH" );
832
833}
834
835//_________________________________________________________________________________
837 if (!m_plugindialog)
838 return;
839
840 int res = m_plugindialog->result();
841 QString filename = m_plugindialog->unloadfile();
842 disconnect(m_plugindialog,SIGNAL(finished(int)),this,SLOT(pluginDialogClosed()));
843 m_plugindialog->deleteLater();
844 m_plugindialog = 0;
845
846 if (res!=QDialog::Accepted||filename.isEmpty())
847 return;
848
849 QStringList bns = m_channelmanager->channelsInPluginFile(filename);
850
851 for (const QString& bn : bns) {
852 while(m_channelmanager->basename2UniqueNames(bn).count()>0)
853 m_tabmanager->removeChannel(m_channelmanager->basename2UniqueNames(bn).value(0));
854 }
855
856 m_currentunloadpluginfiles << filename;
857 QTimer::singleShot(0, this, SLOT(unloadPlugin_continue()));
858
859}
860
861//_________________________________________________________________________________
863{
864 for (const QString& filename : m_currentunloadpluginfiles) {
865 bool success = m_channelmanager->unloadPluginFile(filename);
866 if (!success)
867 QMessageBox::critical(0, "Error - problems unloading plugin file: "+filename,
868 "Problems encountered while attempting to unload plugin file: "+filename,QMessageBox::Ok,QMessageBox::Ok);
869 }
871}
872
873//_________________________________________________________________________________
875{
876 return ! (m_betweenevents || (m_availEvents&&m_availEvents->freshEvents().isEmpty()));
877}
878
879
880//_________________________________________________________________________________
882 m_betweenevents=true;
883 if (m_availEvents) {
884 QList<VP1EventFile> evts = m_availEvents->freshEvents();
885 if (evts.empty()) {
886 addToMessageBox("ERROR: Going to next event, but one is not available!");
887 m_scheduler->setNextRequestedEventFile("");
888 } else {
889 m_scheduler->setNextRequestedEventFile(evts.front().fileName());
890 }
891 }
893}
894
895//_________________________________________________________________________________
897 #if defined BUILDVP1LIGHT
898 std::cout << "goToNextEvent: \n"
899 << "m_scheduler->getEvtNr()+2: " << m_scheduler->getEvtNr()+2
900 << "\nm_scheduler->getTotEvtNr(): " << m_scheduler->getTotEvtNr() << std::endl;
901 if ( m_scheduler->getEvtNr()+2 < m_scheduler->getTotEvtNr() ) {
902 std::cout << "First case" << std::endl;
903 m_scheduler->setEvtNr(m_scheduler->getEvtNr()+1);
904 nextEvent();
905 qApp->quit();
906 }
907 else if( m_scheduler->getEvtNr()+2 == m_scheduler->getTotEvtNr() ) {
908 std::cout << "Second case" << std::endl;
909 m_scheduler->setEvtNr(m_scheduler->getEvtNr()+1);
910 nextEvent();
911 qApp->quit();
912 }
913 #else
914 nextEvent();
915 qApp->quit();
916 #endif
917}
918
919#if defined BUILDVP1LIGHT
920//_________________________________________________________________________________
921void VP1MainWindow::goToPreviousEvent() {
922 if ( m_scheduler->getEvtNr()-1 > 0 ) {
923 m_scheduler->setEvtNr(m_scheduler->getEvtNr()-1);
924 nextEvent();
925 qApp->quit();
926 }
927 else if( m_scheduler->getEvtNr()-1 == 0 ) {
928 m_scheduler->setEvtNr(m_scheduler->getEvtNr()-1);
929 nextEvent();
930 qApp->quit();
931 }
932}
933#endif
934
935//_________________________________________________________________________________
936void VP1MainWindow::closeEvent(QCloseEvent * event)
937{
938 VP1Msg::messageDebug("VP1MainWindow::closeEvent()");
939
940 bool checkEnableAskOnClose;
941 #if defined BUILDVP1LIGHT
942 checkEnableAskOnClose = VP1QtUtils::expertSettingIsSet("general","ExpertSettings/VP1_ENABLE_ASK_ON_CLOSE");
943 #else
944 checkEnableAskOnClose = VP1QtUtils::environmentVariableIsOn("VP1_ENABLE_ASK_ON_CLOSE");
945 #endif
946
947 if (checkEnableAskOnClose) {
948 int ret = QMessageBox::warning(this,
949 "Close VP1?",
950 "You are about to close VP1 and end the job.\nProceed?",
951 QMessageBox::Ok| QMessageBox::Cancel,
952 QMessageBox::Cancel );
953 if (ret!=QMessageBox::Ok) {
954 event->ignore();
955 return;
956 }
957 m_userRequestedExit = true;
958 }
959
960 hide();
961
962 VP1Msg::messageDebug("calling tabmanager->setSelectedDockWidget(0)...");
963 m_tabmanager->setSelectedDockWidget(0);
964 VP1Msg::messageDebug("tabmanager->setSelectedDockWidget(0) called.");
965
966 m_mustquit=true; // this will inform VP1Alg that we want to quit VP1 (then we'll quit the Athena algorithm)
967 VP1Msg::messageDebug("calling qApp->quit()...");
968 qApp->quit();
969}
970
971//_________________________________________________________________________________
972void VP1MainWindow::setRunEvtNumber(const int& r, const unsigned long long& e, const unsigned& triggerType, const unsigned& time, const bool& printmessage ) {
973
974 m_scheduler->setNextRequestedEventFile("");
975 const bool sameasold(m_runnumber==r&&m_eventnumber==e);
976
979 m_timestamp=time;
980
981 m_betweenevents = false;
982 if (m_availEvents)
983 m_availEvents->setCurrentEvent(r,e);
984
985 for(IVP1ChannelWidget* channel : m_tabmanager->allChannels()) {
986 channel->setRunEvtNumber(r,e);
987 channel->setEvtTimestamp(time);
988 }
989
990 if(printmessage) {
991 qulonglong evNumber = m_eventnumber;
992 QString evtstr = "run# "+QString::number(m_runnumber)+", event# "+QString::number(evNumber)+(sameasold?" (reused)":"");
993 QString trighex = triggerType > 0 ? "0x"+QString::number(triggerType, 16).toUpper().rightJustified(sizeof(triggerType),'0') : "";
994 QString expandedevtstr = evtstr
995 + QString(trighex.isEmpty()?QString(""):", triggerType: "+trighex)
996 + QString(time>0 ? ", time: "+QDateTime::fromTime_t(time).toString(Qt::ISODate).replace('T',' ') : "")
997 + QString(m_currentStream.isEmpty()?"":", "+m_currentStream);
998
999 #ifdef BUILDVP1LIGHT
1000 setWindowTitle("VP1Light ["+expandedevtstr+"]");
1001 #else
1002 setWindowTitle("VP1 (Virtual Point 1) ["+expandedevtstr+"]");
1003 #endif // BUILDVP1LIGHT
1004
1005 groupBox_event->setTitle("Event [loaded]");
1006 label_run_event->setText("["+evtstr+"]");
1007
1008 addToMessageBox("New event: "+expandedevtstr,"color:#ff0000");
1009
1010 }
1012}
1013
1014//_________________________________________________________________________________
1015void VP1MainWindow::addToMessageBox( const QString& m, const QString& extrastyleopts,
1016 const QString& title, const QString& titleextrastyleopts )
1017{
1018
1019 if (title.isEmpty())
1020 std::cout<<VP1Msg::prefix_msg()<<": "<<m.toStdString()<<std::endl;
1021 else
1022 std::cout<<VP1Msg::prefix_msg()<<": "<<title.toStdString() << ": " <<m.toStdString()<<std::endl;
1023
1024
1025 QString titlepart = ( title.isEmpty() ? "" : ( titleextrastyleopts.isEmpty() ? title
1026 : "<span style=\"font-style:italic;"+titleextrastyleopts+";\">["+title+"]</span> "));
1027
1028 textBrowser_channelmessages->append(titlepart
1029 + ( extrastyleopts.isEmpty() ? m
1030 : "<span style=\"font-style:italic;"+extrastyleopts+";\">"+m+"</span>"));
1031 textBrowser_channelmessages->verticalScrollBar()->setSliderPosition(textBrowser_channelmessages->verticalScrollBar()->maximum());
1032}
1033
1034//_________________________________________________________________________________
1036{
1037 IVP1System*sys = static_cast<IVP1System*>(sender());
1038 if (!sys) {
1039 addToMessageBox("VP1MainWindow::systemAddToMessageBox Error: Only prints system messages!");
1040 return;
1041 }
1042 if (!sys->channel()) {
1043 addToMessageBox("VP1MainWindow::systemAddToMessageBox Error: System does not know its channel!");
1044 return;
1045 }
1046 addToMessageBox( m, "color:#000000",sys->channel()->unique_name()+"/"+sys->name(),"color:#0000ff" );
1047}
1048
1049//_________________________________________________________________________________
1051{
1052 IVP1ChannelWidget*cw = static_cast<IVP1ChannelWidget*>(sender());
1053 if (!cw) {
1054 addToMessageBox("VP1MainWindow::channelAddToMessageBox Error: Only prints channelwidget messages!");
1055 return;
1056 }
1057 addToMessageBox(m,"color:#000000", cw->unique_name(),"color:#0000ff");
1058}
1059
1060//_________________________________________________________________________________
1062{
1063 addToMessageBox(m);
1064}
1065
1066//_________________________________________________________________________________
1068 if(!m_tabmanager->selectedChannelWidget())
1069 return;
1070
1071 QString out = "Information about channel: "+m_tabmanager->selectedChannelWidget()->name() + "\n\n";
1072 out += "Contact: "+m_tabmanager->selectedChannelWidget()->contact_info()+"\n";
1073 out += "Information: "+m_tabmanager->selectedChannelWidget()->information()+"\n";
1074 out += "Systems:\n\n";
1075 std::set<IVP1System *>::iterator itsys, itsysE = m_tabmanager->selectedChannelWidget()->systems().end();
1076 for (itsys = m_tabmanager->selectedChannelWidget()->systems().begin();itsys!=itsysE;++itsys) {
1077 out += " ==> System "+(*itsys)->name()+"\n";
1078 out += " Contact: "+(*itsys)->contact_info()+"\n";
1079 out += " Information: "+(*itsys)->information()+"\n";
1080 out += "\n";
1081 }
1082
1083 QMessageBox::information(0, "Information about channel: "+m_tabmanager->selectedChannelWidget()->name(),Qt::convertFromPlainText(out),QMessageBox::Ok,QMessageBox::Ok);
1084}
1085
1086//_________________________________________________________________________________
1088{
1089 VP1Msg::messageVerbose("VP1MainWindow::makeAllChannelsEventDisplay()");
1090
1091 QList<QPixmap> list;
1092 QStringList listNames;
1093 QList<unsigned long long> listRunEventNumberTimestamp;
1094
1095 getAllChannelsIntoSnapshots(list, listNames);
1096
1097 listRunEventNumberTimestamp << m_runnumber;
1098 listRunEventNumberTimestamp << m_eventnumber;
1099 listRunEventNumberTimestamp << m_timestamp;
1100
1101 // create a new editor window
1102 m_edEditor = new VP1EventDisplayEditor(this, listRunEventNumberTimestamp);
1103
1104 m_edEditor->addPixmapList(list, listNames);
1105
1106 // pass the lists of all tabs and their names to the editor
1107 m_edEditor->setTabsList( listNames);
1108
1109 m_edEditor->show();
1110
1111}
1112
1113
1114
1115
1116//_________________________________________________________________________________
1117void VP1MainWindow::getAllChannelsIntoSnapshots(QList<QPixmap>& list, QStringList& listNames)
1118{
1119 VP1Msg::messageDebug("VP1MainWindow::getAllChannelsIntoSnapshots()");
1120
1121// int nTabs = m_tabmanager->nTabs();
1122 QList<IVP1ChannelWidget*> allTabs = m_tabmanager->allChannels();
1123
1124 if (allTabs.isEmpty()) {
1125 VP1Msg::message("WARNING - No tabs to save.");
1126 return;
1127 }
1128
1129 int nT = 0;
1130
1131 // loop over all tabs/channels
1132 for(IVP1ChannelWidget* widg : allTabs) {
1133
1134 // increase tab number
1135 ++nT;
1136
1137 // get channel name (e.g. Geometry, 3DCocktail)
1138 QString channelname = m_tabmanager->channelToTab(widg);
1139 channelname.replace(' ','_');
1140 VP1Msg::messageDebug("tab: " + channelname);
1141
1142 // DEBUG MSGS
1143 // get channel info, only for debug
1144 //QString info = widg->information();
1145 //VP1Msg::messageDebug("channel info: " + info);
1146
1147
1148 QPixmap snap = getSingleChannelCustomSnapshot(widg);
1149
1150 list << snap;
1151 listNames << channelname;
1152
1153 }
1154
1155 VP1Msg::messageVerbose(QString::number(nT)+" tabs/channels saved in the QList.");
1156
1157}
1158
1159//_________________________________________________________________________________
1161{
1162 VP1Msg::messageDebug("VP1MainWindow::getSingleChannelCustomSnapshot()");
1163
1164 std::cout << "tab: " << tab << std::endl;
1165
1166 // save the anti-aliasing status, set by the user
1167 bool antialias_original = tab->isAntiAliasing();
1168
1169 // for the final event display images we want the anti-aliasing turned ON,
1170 tab->setAntiAliasing(true);
1171
1172 // get the snapshot
1173 QPixmap snap;
1174 if (width)
1175 snap = tab->getSnapshot(true, width); // 'true' means 'transparent background'
1176 else
1177 snap = tab->getSnapshot(true); // 'true' means 'transparent background'
1178
1179 if (snap.isNull()) {
1180 VP1Msg::message("ERROR! - No snapshot produced!");
1181 return QPixmap();
1182 }
1183
1184 // go back to the original anti-aliasing status, set by the user for the tab
1185 tab->setAntiAliasing(antialias_original);
1186
1187 return snap;
1188}
1189//_________________________________________________________________________________
1190QPixmap VP1MainWindow::getSingleChannelCustomSnapshot(const QString& tabName, int width)
1191{
1192 QList<IVP1ChannelWidget*> allTabs = m_tabmanager->allChannels();
1193
1194 if (allTabs.isEmpty()) {
1195 VP1Msg::message("WARNING - No tabs to get snapshots from.");
1196 }
1197
1198 // loop over all tabs/channels
1199 for(IVP1ChannelWidget* widg : allTabs) {
1200
1201 // get channel name (e.g. Geometry, 3DCocktail)
1202 QString channelname = m_tabmanager->channelToTab(widg);
1203 channelname.replace(' ','_');
1204
1205 if (channelname == tabName) {
1206 VP1Msg::messageDebug("found tab: " + channelname);
1207
1208 if (width)
1210 else
1211 return getSingleChannelCustomSnapshot(widg);
1212
1213 }
1214 }
1215 return QPixmap();
1216}
1217
1218//_________________________________________________________________________________
1220{
1221 VP1Msg::messageDebug("VP1MainWindow::saveAllCurrentChannels()");
1222
1223 int nTabs = m_tabmanager->nTabs();
1224
1225 VP1Msg::messageDebug("# of tabs: " + QString::number(nTabs));
1226
1227 QList<IVP1ChannelWidget*> allTabs = m_tabmanager->allChannels();
1228
1229 if (allTabs.isEmpty()) {
1230 VP1Msg::message("WARNING - No tabs to save.");
1231 return;
1232 }
1233
1234
1235// QString guess;
1236// QString chnlname = m_tabmanager->selectedChannelWidget()->name().toLower();
1237// chnlname.replace(' ','_');
1238
1239 QString base=m_currentsaveimagepath+QDir::separator()+"vp1"
1240 + "_run"+QString::number(m_runnumber)+"_evt"+QString::number(m_eventnumber)
1241 + QString(m_timestamp>0 ? "_"+QDateTime::fromTime_t(m_timestamp).toString(Qt::ISODate).replace(':','-') : "");
1242
1243
1244 // check for existing files
1245 int i(2);
1246 while (QFile::exists(base+".png")) {
1247 base = base+"_"+QString::number(i++);
1248 }
1249
1250 // let the user choose the base filename
1251 QString filename = QFileDialog::getSaveFileName(0, "Select target image file", base,
1252 "Image (*.png *.bmp)",
1253 0,QFileDialog::DontResolveSymlinks);
1254 if(filename.isEmpty()) {
1255 VP1Msg::message("WARNING - No filename selected.");
1256 return;
1257 }
1258
1259 m_currentsaveimagepath = QFileInfo(filename).dir().absolutePath ();
1260
1261
1262 QStringList tab_save_files;
1263
1264 int nT = 0;
1265 for(IVP1ChannelWidget* widg : allTabs) {
1266
1267 // increase tab number
1268 ++nT;
1269
1270 // get channel name (e.g. Geometry, 3DCocktail)
1271 QString channelname = widg->name().toLower();
1272 channelname.replace(' ','_');
1273 VP1Msg::messageDebug("tab: " + channelname);
1274
1275// // get channel info, only for debug
1276// QString info = widg->information();
1277// VP1Msg::messageDebug("channel info: " + info);
1278
1279 QPixmap snap = widg->getSnapshot();
1280 if (snap.isNull()) {
1281 VP1Msg::message("ERROR! - No snapshot produced!");
1282 return;
1283 }
1284
1285 QString tabfilename = filename + "_" + QString::number(nT) + "_" + channelname + ".png";
1286
1287 if (!(tabfilename.endsWith(".png",Qt::CaseInsensitive)||tabfilename.endsWith(".bmp",Qt::CaseInsensitive)))
1288 tabfilename += ".png";
1289
1290
1291 snap.save(tabfilename);
1292
1293 tab_save_files << tabfilename;
1294 }
1295
1296 VP1Msg::message("Tabs saved as: " + tab_save_files.join(" - "));
1297
1298
1299 QMessageBox::information(this, tr("Snapshots saved."),
1300 "All tabs have been saved as snapshots in the following files:\n\n"+tab_save_files.join("\n"),
1301 QMessageBox::Ok,
1302 QMessageBox::Ok);
1303
1304
1305// // TODO: test to create a multilayered PSD or TIFF file
1306// // but doesn't work with the ImageMagick version shipped with SLC5...
1307// // So I give it up now...
1308// QProcess *proc = new QProcess();
1309// QString program = "convert";
1310// QStringList arguments;
1311// arguments = tab_save_files;
1312// arguments << " " + m_currentsaveimagepath + QDir::separator() + "out.psd";
1313// VP1Msg::messageDebug("running: " + program + " " + arguments.join(" "));
1314//
1315// // start the process
1316// proc->start(program, arguments );
1317//
1318// if (!proc->waitForStarted())
1319// return;
1320//
1321// if (!proc->waitForFinished())
1322// return;
1323
1324}
1325
1326//_________________________________________________________________________________
1327/*
1328 * save a snaphot of the currently selected tab.
1329 *
1330 * nsnap is an optional parameter: it's an extra label being added
1331 * to the output filename.
1332 */
1334{
1335
1336 VP1Msg::messageDebug("VP1MainWindow::request_saveChannelSnapshot()");
1337
1338 if(!m_tabmanager->selectedChannelWidget()) {
1339 return QString();
1340 }
1341
1342 QString guess;
1343 QString chnlname = m_tabmanager->selectedChannelWidget()->name().toLower();
1344 chnlname.replace(' ','_');
1345
1346 QString base=m_currentsaveimagepath+QDir::separator()+"vp1_"+chnlname
1347 +"_run"+QString::number(m_runnumber)+"_evt"+QString::number(m_eventnumber)
1348 + QString(m_timestamp>0 ? "_"+QDateTime::fromTime_t(m_timestamp).toString(Qt::ISODate).replace(':','-') : "");
1349
1350
1351 // check for existing files
1352 guess=base;
1353 int i(2);
1354 while (QFile::exists(guess+".png")) {
1355 guess=base+"_"+QString::number(i++);
1356 }
1357 guess+=".png";
1358
1359
1360 // adding the extra label xLabel, if provided
1361 if (!xLabel.isEmpty()) {
1362 guess += "_" + xLabel;
1363 }
1364
1365
1366 QString filename = QFileDialog::getSaveFileName(0, "Select target image file", guess,
1367 "Image (*.png *.bmp)",
1368 0,QFileDialog::DontResolveSymlinks);
1369 if(filename.isEmpty())
1370 return QString();
1371
1372 m_currentsaveimagepath = QFileInfo(filename).dir().absolutePath ();
1373
1374 if (!(filename.endsWith(".png",Qt::CaseInsensitive)||filename.endsWith(".bmp",Qt::CaseInsensitive)))
1375 filename += ".png";
1376
1377 VP1Msg::messageVerbose("calling snapshot");
1378 QPixmap pm = m_tabmanager->selectedChannelWidget()->getSnapshot();
1379
1380 if (pm.isNull())
1381 return QString();
1382
1383 pm.save(filename);
1384 return filename;
1385}
1386
1387//_________________________________________________________________________________
1389 if(!m_tabmanager->selectedChannelWidget())
1390 return;
1391
1392 //The following will paint the widget onto a paper and bring up the print dialog:
1393 QPrinter printer;
1394 QPrintDialog dialog(&printer, this);
1395 if (dialog.exec() == QDialog::Accepted) {
1396 QPixmap pm = m_tabmanager->selectedChannelWidget()->getSnapshot();
1397 if (pm.isNull())
1398 return;
1399 QPainter painter;
1400 painter.begin(&printer);
1401 painter.drawPixmap(0,0,pm);
1402 painter.end();
1403 }
1404}
1405
1406
1407//_________________________________________________________________________________
1409 m_tabmanager->loadConfigurationFromFile(file,availablePluginFiles());
1410}
1411
1412//_________________________________________________________________________________
1414{
1415 VP1Msg::messageDebug("VP1MainWindow::replaceConfigurationFile() : " + file);
1416 m_tabmanager->removeAllTabs();
1417 m_tabmanager->loadConfigurationFromFile(file,availablePluginFiles());
1418}
1419
1420//_________________________________________________________________________________
1422{
1423 QString err;
1424 if (!m_tcpserver.listen(err)) {
1425 qDebug("%s", err.toStdString().c_str());
1426 }
1427}
1428
1429
1430//_________________________________________________________________________________
1432{
1434 if (!m_requestqueue.empty())
1435 QTimer::singleShot(0, this, SLOT(processEnqueuedRequests()));
1436}
1437
1438
1439//_________________________________________________________________________________
1445
1446//_________________________________________________________________________________
1448{
1450 return;
1451 if (m_messages_blockedsenders.contains(request.sender()))
1452 return;
1453 if (m_messages_blockedexactmessages.contains(request))
1454 return;
1456 //Fixme: store TIME of incoming request (to show the user).
1457 if (m_requestqueue.count()<999) {
1458 m_requestqueue.enqueue(request);
1459 m_currentincomingdialog->updatependinginfo();
1460 }
1461 return;
1462 }
1467 connect(md,SIGNAL(finished(int)),this,SLOT(finishedIncomingDialog()));
1468 m_tabmanager->dropOutOfFullScreen();
1469 md->show();
1470}
1471
1472//_________________________________________________________________________________
1474{
1475 if (pushButton_cruise->isChecked()) {
1476 if (radioButton_cruise_event->isChecked()) {
1478 groupBox_cruise->setTitle("Cruise Mode [event]");
1479 } else if (radioButton_cruise_tab->isChecked()) {
1481 groupBox_cruise->setTitle("Cruise Mode [tab]");
1482 } else if (radioButton_cruise_both->isChecked()) {
1484 groupBox_cruise->setTitle("Cruise Mode [event && tab]");
1485 } else { assert(0); }
1486 } else {
1488 groupBox_cruise->setTitle("Cruise Mode [off]");
1489 }
1490}
1491
1492//_________________________________________________________________________________
1494{
1495 m_menu_loadPlugin->clear();
1496
1497 QMap<QString,QString> plugins2fullpath = availablePluginFiles();
1498
1499 if (plugins2fullpath.empty()) {
1500 m_menu_loadPlugin->addAction("No plugins found")->setEnabled(false);
1501 return;
1502 }
1503
1504 QStringList pluglist(plugins2fullpath.keys());
1505 pluglist.sort();
1506
1507 QStringList currentpluginfiles = m_channelmanager->currentPluginFiles();
1508 for(const QString& plug : pluglist) {
1509 QAction * act = m_menu_loadPlugin->addAction(plug);
1510 assert(plugins2fullpath.contains(plug));
1511 QString fullpath = plugins2fullpath[plug];
1512 if (currentpluginfiles.contains(fullpath)) {
1513 act->setEnabled(false);
1514 } else {
1515 act->setData(fullpath);
1516 act->setStatusTip(fullpath);
1517 connect(act,SIGNAL(triggered(bool)),this,SLOT(showMenu_loadPluginItemSelected()));
1518 }
1519 }
1520
1521 m_menu_loadPlugin->addSeparator();
1522 QAction * act_browse = m_menu_loadPlugin->addAction("&Browse...");
1523 act_browse->setStatusTip("Browse filesystem for VP1 plugin files");
1524 connect(act_browse,SIGNAL(triggered(bool)),this,SLOT(request_loadPlugin()));
1525
1526}
1527
1528//_________________________________________________________________________________
1530{
1531 QAction * act = static_cast<QAction*>(sender());
1532 assert(act);
1533 if (!act)
1534 return;
1535 loadPluginFile(act->data().toString());
1536}
1537
1538
1539//_________________________________________________________________________________
1541{
1542 m_menu_loadConfFile->clear();
1543
1544 QMap<QString,QString> conffile2fullpath = availableFiles( ".vp1", "DATAPATH", "", "VP1CONFIGFILEPATH", true );
1545
1546 #ifndef BUILDVP1LIGHT
1547 if (conffile2fullpath.empty()) {
1548 m_menu_loadConfFile->addAction("No .vp1 config files found")->setEnabled(false);
1549 return;
1550 }
1551
1552 QStringList filelist(conffile2fullpath.keys());
1553 filelist.sort();
1554
1555 for(const QString& file : filelist) {
1556 QAction * act = m_menu_loadConfFile->addAction(file);
1557 assert(conffile2fullpath.contains(file));
1558 QString fullpath = conffile2fullpath[file];
1559 act->setData(fullpath);
1560 act->setStatusTip(fullpath);
1561 connect(act,SIGNAL(triggered(bool)),this,SLOT(showMenu_loadConfFileItemSelected()));
1562 }
1563 #endif
1564
1565 m_menu_loadConfFile->addSeparator();
1566 QAction * act_browse = m_menu_loadConfFile->addAction("&Browse...");
1567 act_browse->setStatusTip("Browse filesystem for .vp1 config file");
1568 connect(act_browse,SIGNAL(triggered(bool)),this,SLOT(request_loadConfig()));
1569
1570}
1571
1572
1573//_________________________________________________________________________________
1575{
1576 QAction * act = static_cast<QAction*>(sender());
1577 assert(act);
1578 if (!act)
1579 return;
1580 loadConfigurationFromFile(act->data().toString());
1581}
1582
1583//_________________________________________________________________________________
1585{
1586 QAction * act = static_cast<QAction*>(sender());
1587 assert(act);
1588 if (!act)
1589 return;
1590 assert(QStyleFactory::keys().contains(act->text()));
1591 if (!QStyleFactory::keys().contains(act->text()))
1592 return;
1593 QApplication::setStyle(QStyleFactory::create(act->text()));
1594 QSettings s(m_settingsfile,QSettings::IniFormat);
1595 s.setValue("style/defaultstyle",act->text());
1596
1597}
1598
1599//_________________________________________________________________________________
1601{
1602 QAction * act = static_cast<QAction*>(sender());
1603 assert(act);
1604 if (!act)
1605 return;
1606 bool ok;
1607 int goal = act->data().toInt(&ok);
1608 assert(ok);
1609 if (!ok)
1610 return;
1611 changeFontSize(goal);
1612}
1613
1614//_________________________________________________________________________________
1616{
1617 QFont newfont = m_defaultfont;
1618 QSettings s(m_settingsfile,QSettings::IniFormat);
1619 if (m_defaultfont_pointsize<0.0) {
1620 //pixels
1621 assert(m_defaultfont_pixelsize+goal>0);
1622 if (m_defaultfont_pixelsize+goal<=0)
1623 return;
1624 if (m_defaultfont_pixelsize+goal>200)
1625 return;
1626 newfont.setPixelSize(m_defaultfont_pixelsize+goal);
1627 s.setValue("font/pixelsize_diff",goal);
1628 } else {
1629 //pointsize
1630 double fact = (goal+100.0)/100.0;
1631 if (fact<0.01||fact>50)
1632 return;
1633 double newpointsize=m_defaultfont_pointsize*fact;
1634 if (newpointsize<0)
1635 return;
1636 newfont.setPointSizeF(newpointsize);
1637 s.setValue("font/pointsize_relativepercent",goal);
1638 }
1639 QApplication::setFont(newfont);
1640}
1641
1642
1643//_________________________________________________________________________________
1645{
1646 QWidget * targetpage = tabWidget_central->count() ? page_tabwidget : page_instructions;
1647 if (stackedWidget_central->currentWidget() != targetpage)
1648 stackedWidget_central->setCurrentWidget(targetpage);
1649}
1650
1651//_________________________________________________________________________________
1653{
1654 VP1Msg::messageVerbose("VP1MainWindow::quickSetupTriggered()");
1655
1656 QSettings settings("ATLAS", "VP1Light");
1657
1658 QString plugfile, channelname, tabname;
1659
1660 if (sender()==pushButton_quicksetup_geometrystudies||sender()==action_quicklaunch_Geometry_studies) {
1661
1662 //Open geometry database selection dialog for VP1Light
1663#ifdef BUILDVP1LIGHT
1664 if(settings.value("db/dbByEnv").toString().isEmpty()){
1665 VP1GeoDBSelection dbSelection;
1666 dbSelection.exec();
1667 if(!dbSelection.result())
1668 return;
1669 }
1670#endif // BUILDVP1LIGHT
1671
1672 plugfile="libVP1GeometryPlugin.so";
1673 channelname="Geometry";
1674 tabname = "Geometry";
1675 } else if (sender()==pushButton_quicksetup_trackingstudies||sender()==action_quicklaunch_Tracking_studies) {
1676 plugfile="libVP1TrackPlugin.so";
1677 channelname="Tracking";
1678 tabname = "Tracking";
1679 } else if (sender()==pushButton_quicksetup_calostudies||sender()==action_quicklaunch_Calo_studies) {
1680 plugfile="libVP1CaloPlugin.so";
1681 channelname="Calo Cells";
1682 tabname = "Calorimeter";
1683 } else if (sender()==action_quicklaunch_Storegate_browser) {
1684 plugfile="libVP1BanksPlugin.so";
1685 channelname="Banks";
1686 tabname = "StoreGate";
1687 } else if (sender()==pushButton_quicksetup_3dcocktail||sender()==action_quicklaunch_3dcocktail) {
1688#ifndef BUILDVP1LIGHT
1689 plugfile="libVP13DCocktailPlugin.so";
1690 channelname="3DCocktail";
1691 tabname = "3D Cocktail";
1692#else
1693 //Open Geometry DB and AOD file selection dialog for VP1Light
1694 if(settings.value("aod/aodByEnv").toString().isEmpty()){
1695 VP1AODSelection aodSelection;
1696 aodSelection.exec();
1697 if(!aodSelection.result())
1698 return;
1699 }
1700 if(settings.value("db/dbByEnv").toString().isEmpty()){
1701 VP1GeoDBSelection dbSelection;
1702 dbSelection.exec();
1703 if(!dbSelection.result())
1704 return;
1705 }
1706 m_scheduler->loadEvent();
1707
1708 pushButton_eventselect->setEnabled(true);
1709 plugfile="libVP1LightPlugin.so";
1710 channelname="VP1Light";
1711 tabname = "Geometry/AOD";
1712#endif // BUILDVP1LIGHT
1713 } else if (sender()==action_quicklaunch_trackcalo_commis) {
1714 plugfile="libVP13DCocktailPlugin.so";
1715 channelname="TrackCalo";
1716 tabname = "Track/Calo";
1717 } else if (sender()==pushButton_quicksetup_analysisstudies||sender()==action_quicklaunch_analysisstudies) {
1718
1719 //Open AOD file selection dialog for VP1Light
1720#ifdef BUILDVP1LIGHT
1721 if(settings.value("aod/aodByEnv").toString().isEmpty()){
1722 VP1AODSelection aodSelection;
1723 aodSelection.exec();
1724 if(!aodSelection.result())
1725 return;
1726 }
1727 m_scheduler->loadEvent();
1728 pushButton_eventselect->setEnabled(true);
1729#endif // BUILDVP1LIGHT
1730
1731 plugfile="libVP1AODPlugin.so";
1732 channelname="AOD";
1733 tabname = "Analysis";
1734 } else {
1735 addToMessageBox("quickSetupTriggered() Error: Unknown sender");
1736 return;
1737 }
1738
1739#ifdef __APPLE__
1740 if (plugfile.endsWith(".so"))
1741 plugfile = plugfile.left(plugfile.count()-3)+".dylib";
1742#endif
1743
1744
1745 //Check that the plugin is available:
1746 QMap<QString,QString> plugins2fullpath = availablePluginFiles();
1747 if(VP1Msg::debug()){
1748 qDebug() << "plugins2fullpath: " << plugins2fullpath;
1749 }
1750
1751 if (!plugins2fullpath.contains(plugfile)) {
1752 QMessageBox::critical(0, "Error - could not locate plugin file: "+plugfile,
1753 "could not locate plugin file: "
1754 +plugfile,QMessageBox::Ok,QMessageBox::Ok);
1755 return;
1756 }
1757 QString plugfile_fullpath = plugins2fullpath[plugfile];
1758
1759
1760 //Load plugin
1761 if (!m_channelmanager->currentPluginFiles().contains(plugfile_fullpath)) {
1762 QString err = m_channelmanager->loadPluginFile(plugfile_fullpath);
1763 if (!err.isEmpty()||!m_channelmanager->currentPluginFiles().contains(plugfile_fullpath)) {
1764 QMessageBox::critical(0, "Error - could not load plugin file: "+plugfile_fullpath,//Fixme: Error message here is hardcoded to be the same as in loadPluginFile method!!
1765 "Could not load plugin file: "
1766 +plugfile_fullpath+"\n\nReason: "+err,QMessageBox::Ok,QMessageBox::Ok);
1767 return;
1768 }
1769 }
1770
1771
1772 //Check that plugin contains necessary channel:
1773 if (!m_channelmanager->channelsInPluginFile(plugfile_fullpath).contains(channelname)) {
1774 QMessageBox::critical(0, "Error - did not find necessary channel: "+channelname,
1775 "Could not find channel: "+channelname+" in loaded plugin "+plugfile_fullpath,
1776 QMessageBox::Ok,QMessageBox::Ok);
1777 return;
1778 }
1779
1780 bool save = updatesEnabled();
1781 setUpdatesEnabled(false);
1782
1783
1784 //Add tab:
1785 QString newtabname = m_tabmanager->suggestNewTabName(tabname);
1786 m_tabmanager->addNewTab(newtabname);
1787 if (!m_tabmanager->hasTab(newtabname)) {
1788 QMessageBox::critical(0, "Error - could not create tab: "+newtabname,
1789 "Could not create tab: "+newtabname,
1790 QMessageBox::Ok,QMessageBox::Ok);
1791 setUpdatesEnabled(save);
1792 return;
1793 }
1794
1795
1796 //Finally, add channel:
1797
1798 if (!m_tabmanager->addChannelToTab( channelname, newtabname )) {
1799 QMessageBox::critical(0, "Error - problems launching channel: "+channelname,
1800 "Problems launching channel: "+channelname,
1801 QMessageBox::Ok,QMessageBox::Ok);
1802 setUpdatesEnabled(save);
1803 return;
1804 }
1805
1806
1807 m_tabmanager->showTab(newtabname);
1808
1809
1810 setUpdatesEnabled(save);
1811}
1812
1813//_________________________________________________________________________________
1815{
1816 pushButton_nextevent->setEnabled(okToProceedToNextEvent());
1817 #if defined BUILDVP1LIGHT
1818 pushButton_previousevent->setEnabled(okToProceedToNextEvent());
1819 #endif
1820}
1821
1822//_________________________________________________________________________________
1824{
1825 if(!m_mutex->tryLock()) return;
1826
1827 QFont f;
1828 QFont fb;
1829 fb.setBold(true);
1830
1831 for (QAction * act : m_inputdiractions) {
1832 VP1DirStatusData& dirstatus = m_inputdirstatuses[act];
1833 QString inputdir(act->data().toString());
1834 QString dirname = QDir(inputdir).dirName();
1835 act->setEnabled(dirstatus.enabled);
1836 act->setFont(dirstatus.bold?fb:f);
1837 act->setText(dirname+" ["+dirstatus.dirStatus+"]");
1838 }
1839
1840 m_mutex->unlock();
1841}
1842
1843//_________________________________________________________________________________
1845{
1846 QAction * act = dynamic_cast<QAction*>(sender());
1847 if (!act)
1848 return;
1849 VP1AvailEvtsLocalDir* availLocal = dynamic_cast<VP1AvailEvtsLocalDir*>(m_availEvents);
1850 if (!availLocal)
1851 return;
1852 QString inputdir(act->data().toString());
1853 QFileInfo fi(inputdir);
1854 if (fi.exists()&&fi.isDir()) {
1855 availLocal->setSourceDir(inputdir);
1856 std::cout<<VP1Msg::prefix_msg()<<": "
1857 <<"VP1Message: inputdirectory changed to "
1858 <<availLocal->currentSourceDir().toStdString()<<std::endl;
1859 m_currentStream = QDir(availLocal->currentSourceDir()).dirName();
1860 }
1861
1862
1863}
1864
1865//________________________________________________________________________________
1867{
1868 QStringList returnval(m_userRequestedFiles);
1869 m_userRequestedFiles.clear();
1870 return returnval;
1871}
1872
1873//_________________________________________________________________________________
1875{
1876 QString newEventFile = QFileDialog::getOpenFileName(NULL
1877 ,tr("Open Event File")
1879 ,tr("All files (*.*)"));
1880 if(newEventFile.isEmpty()) return;
1881 if(VP1FileUtilities::fileExistsAndReadable(newEventFile.toStdString())) {
1882 m_userRequestedFiles.append(newEventFile);
1883 addToMessageBox(newEventFile + " will be appended to the list of input files");
1884 }
1885 else
1886 QMessageBox::critical(0, newEventFile + " either does not exist or is not readable",
1887 newEventFile + " either does not exist or is not readable",
1888 QMessageBox::Ok,QMessageBox::Ok);
1889}
1890
1891//_________________________________________________________________________________
1892#ifdef BUILDVP1LIGHT
1893void VP1MainWindow::request_expertSettings(){
1895 es.exec();
1896}
1897
1898void VP1MainWindow::chooseEvent(){
1899 //Open event selection dialog for VP1Light
1900 VP1SelectEvent selectEvent(m_scheduler->getTotEvtNr(), m_scheduler->getEvtNr());
1901 selectEvent.exec();
1902 int newEvtNr = selectEvent.result()-1;
1903
1904 if( (newEvtNr >= 0) && (newEvtNr <= m_scheduler->getTotEvtNr()-1) ){
1905 m_scheduler->setEvtNr(newEvtNr);
1906 nextEvent();
1907 qApp->quit();
1908 }
1909}
1910#endif // BUILDVP1LIGHT
std::pair< std::vector< unsigned int >, bool > res
const char * pathvar
const double width
virtual QPixmap getSnapshot(bool transp=false, int width=0, bool batch=false)
virtual bool setAntiAliasing(bool aa)
const QString unique_name() const
virtual bool isAntiAliasing()
const QString & currentSourceDir() const
void setSourceDir(const QString &)
const QStringList & availableSourceDirectories() const
static QString highlightStyle()
const QString & sender() const
static bool fileExistsAndReadable(const std::string &)
void finishedIncomingDialog()
void request_loadPlugin()
void helperAddToMessageBox(const QString &)
void setRunEvtNumber(const int &runnumber, const unsigned long long &eventnumber, const unsigned &triggerType=0, const unsigned &time=0, const bool &printmessage=true)
void changeFontSize(int)
QQueue< VP1ExternalRequest > m_requestqueue
void updateCentralStackWidget()
void help_openUserSupport()
int m_defaultfont_pixelsize
QMenu * m_menu_changeFontSize
VP1EventDisplayEditor * m_edEditor
VP1AvailEvents * m_availEvents
void systemAddToMessageBox(const QString &)
void receivedExternalRequest(VP1ExternalRequest)
QLabel * m_statusbarlabel
void saveAllCurrentChannels()
QString m_currentconfigfile
double m_defaultfont_pointsize
void showMenu_loadConfFileItemSelected()
QString request_saveChannelSnapshot(QString xLabel="")
VP1ChannelManager * m_channelmanager
VP1TabManager * m_tabmanager
QString m_currentsaveimagepath
QString m_currentloadpluginpath
QMap< QString, QString > availablePluginFiles() const
VP1MainWindow(VP1ExecutionScheduler *, VP1AvailEvents *availEvents, QWidget *parent=0)
VP1IncomingMessageDialog * m_currentincomingdialog
QStringList userRequestedFiles()
void request_saveasConfig()
void addChannelIconsToComboBox(QComboBox *cb, const bool &isbasenames)
QAction * m_action_openUsersSupport
QMenu * m_menu_loadPlugin
void request_cruisemodechange()
QWidget * m_dummyemptycontroller
const QString m_settingsfile
QAction * m_actionSave_current_tabs
QList< VP1ExternalRequest > m_messages_blockedexactmessages
void addToMessageBox(const QString &, const QString &extrastyleopts="", const QString &title="", const QString &titleextrastyleopts="")
void replaceConfigurationFile(const QString &file)
QProgressBar * progressbar
QAction * m_action_openUsersGuide
void processEnqueuedRequests()
bool mustQuit() const
QStringList m_userRequestedFiles
void changeStyleActionTriggered()
QMenu * m_menu_loadConfFile
void unloadPlugin_continue()
QString m_currentStream
unsigned long long m_eventnumber
void help_openUserGuide()
QMap< QString, QString > availableFiles(const QString &extension, const QString &pathvar, const QString &instareasubdir, const QString &extradirenvvar, bool currentdir=false) const
bool okToProceedToNextEvent() const
unsigned m_timestamp
QAction * m_action_openVP1Site
void request_loadConfig()
QAction * m_actionAdd_empty_tab
void getAllChannelsIntoSnapshots(QList< QPixmap > &list, QStringList &listNames)
void inputDirectoryActionTriggered()
void loadConfigurationFromFile(const QString &file)
VP1PluginDialog * m_plugindialog
void closeEvent(QCloseEvent *event)
void channelAddToMessageBox(const QString &)
VP1DirStatuses m_inputdirstatuses
void request_printChannel()
VP1TcpServer m_tcpserver
QList< QAction * > m_inputdiractions
QAction * m_actionEnableExpertSettings
QStringList m_currentunloadpluginfiles
void loadPluginFile(const QString &filename)
VP1StreamMenuUpdater * m_streamMenuUpdater
void request_channelInformation()
VP1ExecutionScheduler * m_scheduler
void pluginDialogClosed()
void makeAllChannelsEventDisplay()
QAction * m_action_addEventFile
void changeFontSizeActionTriggered()
void selectedChannelChanged(IVP1ChannelWidget *)
void request_addEmptyTab()
void tabListChanged(const QStringList &)
QAction * m_action_openAbout
void launch3DstereoEditor()
void updateInputDirectoriesStatus()
void request_saveConfig()
void showMenu_loadConfFile()
void help_openVP1WebSite()
QList< QString > m_messages_blockedsenders
void showMenu_loadPluginItemSelected()
QMenu * m_menu_changeStyle
QPixmap getSingleChannelCustomSnapshot(IVP1ChannelWidget *tab, int width=0)
static bool debug()
Definition VP1Msg.h:32
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
static const char * prefix_msg()
Definition VP1Msg.h:56
static bool environmentVariableIsOn(const QString &name)
static bool expertSettingIsSet(const QString &type, const QString &name)
static QString expertSettingValue(const QString &type, const QString &name)
static QString defaultFileSelectDirectory()
int r
Definition globals.cxx:22
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116
std::string base
Definition hcg.cxx:83
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179
TFile * file
std::string dirname(std::string name)
Definition utils.cxx:200