140: QMainWindow(parent),
158 #if defined BUILDVP1LIGHT
164 if (!checkShowAllCruiseAndEventControls) {
165 pushButton_eventseek->setVisible(
false);
166 groupBox_cruise->setVisible(
false);
176 QMenu* menu_file =
new QMenu(menubar);
177 menu_file->setObjectName(
"menu_file");
178 menu_file->setTitle(
"&File");
179 menubar->addAction(menu_file->menuAction());
185 #ifndef BUILDVP1LIGHT
186 pushButton_previousevent->setVisible(
false);
187 pushButton_eventselect->setVisible(
false);
189 pushButton_eventselect->setVisible(
true);
190 pushButton_eventselect->setText(
"Event: 0/0");
191 pushButton_eventselect->setEnabled(
false);
192 pushButton_previousevent->setEnabled(
false);
196 pushButton_quicksetup_trackingstudies->setEnabled(
false);
197 pushButton_quicksetup_trackingstudies->setToolTip(
"Not available in VP1Light");
198 pushButton_quicksetup_calostudies->setEnabled(
false);
199 pushButton_quicksetup_calostudies->setToolTip(
"Not available in VP1Light");
200 action_quicklaunch_Tracking_studies->setEnabled(
false);
201 action_quicklaunch_Tracking_studies->setToolTip(
"Not available in VP1Light");
202 action_quicklaunch_Calo_studies->setEnabled(
false);
203 action_quicklaunch_Calo_studies->setToolTip(
"Not available in VP1Light");
204 action_quicklaunch_Storegate_browser->setEnabled(
false);
205 action_quicklaunch_Storegate_browser->setToolTip(
"Not available in VP1Light");
206 action_quicklaunch_trackcalo_commis->setEnabled(
false);
207 action_quicklaunch_trackcalo_commis->setToolTip(
"Not available in VP1Light");
216 QStringList inputdirs;
220 if (availLocal&&!inputdirs.isEmpty()) {
223 if (currentdir.endsWith(
"/"))
226 QMenu * menu_inputdir =
new QMenu(menubar);
227 menu_inputdir->setObjectName(
"menu_inputdir");
228 menu_inputdir->setTitle(
"&Stream");
230 menubar->addAction(menu_inputdir->menuAction());
232 QActionGroup * inputdir_actiongroup =
new QActionGroup(menu_inputdir);
233 QAction*action_inputdir_current(0);
234 for (QString inputdir : inputdirs) {
235 if (inputdir.endsWith(
"/"))
237 QString
dirname = QDir(inputdir).dirName();
238 QAction * action_inputdir =
new QAction(
this);
239 action_inputdir->setObjectName(
"action_inputdir_"+
dirname);
240 action_inputdir->setData(inputdir);
241 action_inputdir->setStatusTip(
"Get input files from: "+inputdir);
242 action_inputdir->setCheckable(
true);
244 if (currentdir==inputdir)
245 action_inputdir_current = action_inputdir;
246 menu_inputdir->addAction(action_inputdir);
247 inputdir_actiongroup->addAction(action_inputdir);
251 if (action_inputdir_current) {
252 action_inputdir_current->blockSignals(
true);
253 action_inputdir_current->setChecked(
true);
254 action_inputdir_current->blockSignals(
false);
268 QTimer *timer =
new QTimer(
this);
283 for (
int i=0;i<stackedWidget_central->count();++i)
284 stackedWidget_central->widget(i)->layout()->setContentsMargins(0,0,0,0);
287 frame_instructions->setFrameShape(QFrame::StyledPanel);
290 #ifndef BUILDVP1LIGHT
291 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
293 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
295 connect(pushButton_quicksetup_trackingstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
296 connect(pushButton_quicksetup_calostudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
297 connect(pushButton_quicksetup_geometrystudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
298 connect(pushButton_quicksetup_analysisstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
320 connect(pushButton_channelfullscreen,SIGNAL(clicked()),
m_tabmanager,SLOT(showCurrentChannelFullScreen()));
328 connect(action_quicklaunch_Tracking_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
329 connect(action_quicklaunch_Calo_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
330 connect(action_quicklaunch_Geometry_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
331 connect(action_quicklaunch_analysisstudies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
332 connect(action_quicklaunch_Storegate_browser,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
333 connect(action_quicklaunch_3dcocktail,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
334 connect(action_quicklaunch_trackcalo_commis,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
335 connect(action_exit_VP1,SIGNAL(triggered(
bool)),
this,SLOT(close()));
341 menuConfiguration->addSeparator();
351 QActionGroup * styleGroup =
new QActionGroup(
this);
352 QAction * laststyleact(0);
353 bool foundplastique=
false;
355 QString defaultstyle=s.value(
"style/defaultstyle",
"Fusion").toString();
356 for (QString style : QStyleFactory::keys() ) {
358 act->setStatusTip(
"Change application style to "+style);
360 act->setCheckable(
true);
361 styleGroup->addAction(act);
363 if (act->text()==defaultstyle) {
364 act->setChecked(
true);
365 QApplication::setStyle(QStyleFactory::create(act->text()));
369 if (!foundplastique) {
370 laststyleact->setChecked(
true);
371 QApplication::setStyle(QStyleFactory::create(laststyleact->text()));
376 savedgoal = s.value(
"font/pixelsize_diff", 0).toInt();
378 savedgoal = s.value(
"font/pointsize_relativepercent", 0).toInt();
381 QList<int> fontoptions;
383 fontoptions <<15<<10<<+5<<+3<<+2<<+1<<0<<-1<<-2<<-3<<-5<<-10<<-20<<-30;
385 fontoptions <<150<<100<<50<<30<<20<<10<<5<<0<<-5<<-10<<-20<<-30<<-50;
387 QActionGroup * fontGroup =
new QActionGroup(
this);
388 bool foundsavedgoal(
false);
389 QAction * normalfontact(0);
390 for (
int fontopt : fontoptions) {
393 QString text = (fontopt==0?
"normal": (fontopt>0?
"+":
"")+QString::number(fontopt)+(
m_defaultfont_pointsize < 0.0?
" pixels" :
"%"));
395 act->setStatusTip(
"Change overall font size of application to "+text);
396 act->setData(fontopt);
397 act->setCheckable(
true);
398 fontGroup->addAction(act);
402 if (savedgoal==fontopt) {
403 act->setChecked(
true);
408 if (!foundsavedgoal) {
409 normalfontact->setChecked(
true);
415 menuConfiguration->addSeparator();
423 menuConfiguration->addSeparator();
430 connect(pushButton_nextevent,SIGNAL(clicked()),
this,SLOT(
goToNextEvent()));
432 connect(pushButton_previousevent,SIGNAL(clicked()),
this,SLOT(goToPreviousEvent()));
433 connect(pushButton_eventselect,SIGNAL(clicked()),
this,SLOT(chooseEvent()));
453 QMenu* menu_help =
new QMenu(menubar);
454 menu_help->setObjectName(
"menu_help");
455 menu_help->setTitle(
"&Help");
456 menubar->addAction(menu_help->menuAction());
460 menu_help->addSeparator();
473 #ifndef BUILDVP1LIGHT
474 menubar->setEnabled(
false);
540 int sum1 = splitter_tabwidget_messagebox->sizes().at(0) + splitter_tabwidget_messagebox->sizes().at(1);
541 QList<int> sizes1; sizes1 << sum1 << 0;
542 splitter_tabwidget_messagebox->setSizes ( sizes1 );
544 while (splitter_tabwidget_messagebox->sizes().at(1)==0&&bottom<50000) {
545 QList<int> sizes2; sizes2 << sum1-bottom << bottom;
546 splitter_tabwidget_messagebox->setSizes ( sizes2 );
550 int sum2 = splitter_leftright->sizes().at(0) + splitter_leftright->sizes().at(1);
552 QList<int> sizes3; sizes3 << left << sum2-left;
553 splitter_leftright->setSizes ( sizes3 );
554 while (splitter_leftright->sizes().at(0)==0&&left<50000) {
555 QList<int> sizes4; sizes4 << left << sum2-left;
556 splitter_leftright->setSizes ( sizes4 );
560 int prefwidths = std::max<int>(left,widget_controlsContainer->sizeHint().width());
561 prefwidths = std::max<int>(prefwidths,groupBox_channelcontrols->sizeHint().width());
562 prefwidths = std::max<int>(prefwidths,groupBox_cruise->sizeHint().width());
563 prefwidths = std::max<int>(prefwidths,groupBox_event->sizeHint().width());
564 prefwidths = std::max<int>(prefwidths,stackedWidget_customcontrols->sizeHint().width());
565 widget_controlsContainer->setMaximumWidth(50+prefwidths);
776 const QString& instareasubdir,
777 const QString& extradirenvvar,
778 bool currentdir )
const
781 qDebug() <<
"VP1MainWindow::availableFiles()";
782 qDebug() <<
"extension:" << extension <<
"pathvar:" <<
pathvar <<
"instareasubdir:" << instareasubdir <<
"extradirenvvar:" << extradirenvvar <<
"currentdir:" << currentdir;
786 QStringList vp1pluginpath =
787 extradirenvvar.isEmpty() ?
789 QString(::getenv(extradirenvvar.toStdString().c_str())) .
790#
if QTCORE_VERSION >= 0x050E00
791 split(
":",Qt::SkipEmptyParts);
793 split(
":",QString::SkipEmptyParts);
796 qDebug() <<
"extradirenvvar:" << extradirenvvar;
797 qDebug() <<
"vp1pluginpath:" << vp1pluginpath;
803 vp1pluginpath<<QCoreApplication::applicationDirPath()+
"/../lib";
811 vp1pluginpath<<QDir::currentPath();
817 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
819 QString path = env.value(
pathvar);
822 if (!path.isEmpty()) {
823#if QTCORE_VERSION >= 0x050E00
825 QStringList tmp = path.split(
":",Qt::SkipEmptyParts);
828 QStringList tmp = path.split(
":",QString::SkipEmptyParts);
830 for (
const QString& dir : tmp) {
831 vp1pluginpath << ( instareasubdir.isEmpty() ? dir : dir+QDir::separator()+instareasubdir );
836 int nDuplicatesRemoved = vp1pluginpath.removeDuplicates();
840 QStringList validPluginPaths;
841 validPluginPaths.reserve(vp1pluginpath.size());
842 for (
const QString& plugindir : vp1pluginpath) {
844 QFileInfo fi(plugindir);
846 if (fi.exists() && fi.isDir()) {
847 validPluginPaths << plugindir;
852 vp1pluginpath = validPluginPaths;
856 QMap<QString,QString> plugins2fullpath;
857 for (
const QString& plugindir : vp1pluginpath) {
858 QStringList plugins = QDir(plugindir).entryList((QStringList()<<(
"*"+extension)),QDir::CaseSensitive | QDir::Files | QDir::Readable,QDir::Name);
859 for (QString plugin : plugins) {
860 plugin = QFileInfo(plugin).fileName();
861 if (!plugins2fullpath.contains(plugin)) {
862 QString fullpath = plugindir+QDir::separator()+plugin;
863 plugins2fullpath[plugin]=fullpath;
867 return plugins2fullpath;
1709 QSettings settings(
"ATLAS",
"VP1Light");
1711 QString plugfile, channelname, tabname;
1713 if (sender()==pushButton_quicksetup_geometrystudies||sender()==action_quicklaunch_Geometry_studies) {
1717 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1720 if(!dbSelection.result())
1725 plugfile=
"libVP1GeometryPlugin.so";
1726 channelname=
"Geometry";
1727 tabname =
"Geometry";
1728 }
else if (sender()==pushButton_quicksetup_trackingstudies||sender()==action_quicklaunch_Tracking_studies) {
1729 plugfile=
"libVP1TrackPlugin.so";
1730 channelname=
"Tracking";
1731 tabname =
"Tracking";
1732 }
else if (sender()==pushButton_quicksetup_calostudies||sender()==action_quicklaunch_Calo_studies) {
1733 plugfile=
"libVP1CaloPlugin.so";
1734 channelname=
"Calo Cells";
1735 tabname =
"Calorimeter";
1736 }
else if (sender()==action_quicklaunch_Storegate_browser) {
1737 plugfile=
"libVP1BanksPlugin.so";
1738 channelname=
"Banks";
1739 tabname =
"StoreGate";
1740 }
else if (sender()==pushButton_quicksetup_3dcocktail||sender()==action_quicklaunch_3dcocktail) {
1741#ifndef BUILDVP1LIGHT
1742 plugfile=
"libVP13DCocktailPlugin.so";
1743 channelname=
"3DCocktail";
1744 tabname =
"3D Cocktail";
1747 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1749 aodSelection.exec();
1750 if(!aodSelection.result())
1753 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1756 if(!dbSelection.result())
1761 pushButton_eventselect->setEnabled(
true);
1762 plugfile=
"libVP1LightPlugin.so";
1763 channelname=
"VP1Light";
1764 tabname =
"Geometry/AOD";
1766 }
else if (sender()==action_quicklaunch_trackcalo_commis) {
1767 plugfile=
"libVP13DCocktailPlugin.so";
1768 channelname=
"TrackCalo";
1769 tabname =
"Track/Calo";
1770 }
else if (sender()==pushButton_quicksetup_analysisstudies||sender()==action_quicklaunch_analysisstudies) {
1774 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1776 aodSelection.exec();
1777 if(!aodSelection.result())
1781 pushButton_eventselect->setEnabled(
true);
1784 plugfile=
"libVP1AODPlugin.so";
1786 tabname =
"Analysis";
1793 if (plugfile.endsWith(
".so"))
1794 plugfile = plugfile.left(plugfile.count()-3)+
".dylib";
1801 qDebug() <<
"plugins2fullpath: " << plugins2fullpath;
1804 if (!plugins2fullpath.contains(plugfile)) {
1805 QMessageBox::critical(0,
"Error - could not locate plugin file: "+plugfile,
1806 "could not locate plugin file: "
1807 +plugfile,QMessageBox::Ok,QMessageBox::Ok);
1810 QString plugfile_fullpath = plugins2fullpath[plugfile];
1816 if (!err.isEmpty()||!
m_channelmanager->currentPluginFiles().contains(plugfile_fullpath)) {
1817 QMessageBox::critical(0,
"Error - could not load plugin file: "+plugfile_fullpath,
1818 "Could not load plugin file: "
1819 +plugfile_fullpath+
"\n\nReason: "+err,QMessageBox::Ok,QMessageBox::Ok);
1826 if (!
m_channelmanager->channelsInPluginFile(plugfile_fullpath).contains(channelname)) {
1827 QMessageBox::critical(0,
"Error - did not find necessary channel: "+channelname,
1828 "Could not find channel: "+channelname+
" in loaded plugin "+plugfile_fullpath,
1829 QMessageBox::Ok,QMessageBox::Ok);
1833 bool save = updatesEnabled();
1834 setUpdatesEnabled(
false);
1838 QString newtabname =
m_tabmanager->suggestNewTabName(tabname);
1841 QMessageBox::critical(0,
"Error - could not create tab: "+newtabname,
1842 "Could not create tab: "+newtabname,
1843 QMessageBox::Ok,QMessageBox::Ok);
1844 setUpdatesEnabled(save);
1851 if (!
m_tabmanager->addChannelToTab( channelname, newtabname )) {
1852 QMessageBox::critical(0,
"Error - problems launching channel: "+channelname,
1853 "Problems launching channel: "+channelname,
1854 QMessageBox::Ok,QMessageBox::Ok);
1855 setUpdatesEnabled(save);
1863 setUpdatesEnabled(save);
void setRunEvtNumber(const int &runnumber, const unsigned long long &eventnumber, const unsigned &triggerType=0, const unsigned &time=0, const bool &printmessage=true)
QMap< QString, QString > availableFiles(const QString &extension, const QString &pathvar, const QString &instareasubdir, const QString &extradirenvvar, bool currentdir=false) const