109: QMainWindow(parent),
127 #if defined BUILDVP1LIGHT
133 if (!checkShowAllCruiseAndEventControls) {
134 pushButton_eventseek->setVisible(
false);
135 groupBox_cruise->setVisible(
false);
145 QMenu* menu_file =
new QMenu(menubar);
146 menu_file->setObjectName(
"menu_file");
147 menu_file->setTitle(
"&File");
148 menubar->addAction(menu_file->menuAction());
154 #ifndef BUILDVP1LIGHT
155 pushButton_previousevent->setVisible(
false);
156 pushButton_eventselect->setVisible(
false);
158 pushButton_eventselect->setVisible(
true);
159 pushButton_eventselect->setText(
"Event: 0/0");
160 pushButton_eventselect->setEnabled(
false);
161 pushButton_previousevent->setEnabled(
false);
165 pushButton_quicksetup_trackingstudies->setEnabled(
false);
166 pushButton_quicksetup_trackingstudies->setToolTip(
"Not available in VP1Light");
167 pushButton_quicksetup_calostudies->setEnabled(
false);
168 pushButton_quicksetup_calostudies->setToolTip(
"Not available in VP1Light");
169 action_quicklaunch_Tracking_studies->setEnabled(
false);
170 action_quicklaunch_Tracking_studies->setToolTip(
"Not available in VP1Light");
171 action_quicklaunch_Calo_studies->setEnabled(
false);
172 action_quicklaunch_Calo_studies->setToolTip(
"Not available in VP1Light");
173 action_quicklaunch_Storegate_browser->setEnabled(
false);
174 action_quicklaunch_Storegate_browser->setToolTip(
"Not available in VP1Light");
175 action_quicklaunch_trackcalo_commis->setEnabled(
false);
176 action_quicklaunch_trackcalo_commis->setToolTip(
"Not available in VP1Light");
185 QStringList inputdirs;
189 if (availLocal&&!inputdirs.isEmpty()) {
192 if (currentdir.endsWith(
"/"))
195 QMenu * menu_inputdir =
new QMenu(menubar);
196 menu_inputdir->setObjectName(
"menu_inputdir");
197 menu_inputdir->setTitle(
"&Stream");
199 menubar->addAction(menu_inputdir->menuAction());
201 QActionGroup * inputdir_actiongroup =
new QActionGroup(menu_inputdir);
202 QAction*action_inputdir_current(0);
203 for (QString inputdir : inputdirs) {
204 if (inputdir.endsWith(
"/"))
206 QString
dirname = QDir(inputdir).dirName();
207 QAction * action_inputdir =
new QAction(
this);
208 action_inputdir->setObjectName(
"action_inputdir_"+
dirname);
209 action_inputdir->setData(inputdir);
210 action_inputdir->setStatusTip(
"Get input files from: "+inputdir);
211 action_inputdir->setCheckable(
true);
213 if (currentdir==inputdir)
214 action_inputdir_current = action_inputdir;
215 menu_inputdir->addAction(action_inputdir);
216 inputdir_actiongroup->addAction(action_inputdir);
220 if (action_inputdir_current) {
221 action_inputdir_current->blockSignals(
true);
222 action_inputdir_current->setChecked(
true);
223 action_inputdir_current->blockSignals(
false);
237 QTimer *timer =
new QTimer(
this);
252 for (
int i=0;i<stackedWidget_central->count();++i)
253 stackedWidget_central->widget(i)->layout()->setContentsMargins(0,0,0,0);
256 frame_instructions->setFrameShape(QFrame::StyledPanel);
259 #ifndef BUILDVP1LIGHT
260 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
262 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
264 connect(pushButton_quicksetup_trackingstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
265 connect(pushButton_quicksetup_calostudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
266 connect(pushButton_quicksetup_geometrystudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
267 connect(pushButton_quicksetup_analysisstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
289 connect(pushButton_channelfullscreen,SIGNAL(clicked()),
m_tabmanager,SLOT(showCurrentChannelFullScreen()));
297 connect(action_quicklaunch_Tracking_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
298 connect(action_quicklaunch_Calo_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
299 connect(action_quicklaunch_Geometry_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
300 connect(action_quicklaunch_analysisstudies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
301 connect(action_quicklaunch_Storegate_browser,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
302 connect(action_quicklaunch_3dcocktail,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
303 connect(action_quicklaunch_trackcalo_commis,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
304 connect(action_exit_VP1,SIGNAL(triggered(
bool)),
this,SLOT(close()));
310 menuConfiguration->addSeparator();
320 QActionGroup * styleGroup =
new QActionGroup(
this);
321 QAction * laststyleact(0);
322 bool foundplastique=
false;
324 QString defaultstyle=s.value(
"style/defaultstyle",
"Fusion").toString();
325 for (QString style : QStyleFactory::keys() ) {
327 act->setStatusTip(
"Change application style to "+style);
329 act->setCheckable(
true);
330 styleGroup->addAction(act);
332 if (act->text()==defaultstyle) {
333 act->setChecked(
true);
334 QApplication::setStyle(QStyleFactory::create(act->text()));
338 if (!foundplastique) {
339 laststyleact->setChecked(
true);
340 QApplication::setStyle(QStyleFactory::create(laststyleact->text()));
345 savedgoal = s.value(
"font/pixelsize_diff", 0).toInt();
347 savedgoal = s.value(
"font/pointsize_relativepercent", 0).toInt();
350 QList<int> fontoptions;
352 fontoptions <<15<<10<<+5<<+3<<+2<<+1<<0<<-1<<-2<<-3<<-5<<-10<<-20<<-30;
354 fontoptions <<150<<100<<50<<30<<20<<10<<5<<0<<-5<<-10<<-20<<-30<<-50;
356 QActionGroup * fontGroup =
new QActionGroup(
this);
357 bool foundsavedgoal(
false);
358 QAction * normalfontact(0);
359 for (
int fontopt : fontoptions) {
362 QString text = (fontopt==0?
"normal": (fontopt>0?
"+":
"")+QString::number(fontopt)+(
m_defaultfont_pointsize < 0.0?
" pixels" :
"%"));
364 act->setStatusTip(
"Change overall font size of application to "+text);
365 act->setData(fontopt);
366 act->setCheckable(
true);
367 fontGroup->addAction(act);
371 if (savedgoal==fontopt) {
372 act->setChecked(
true);
377 if (!foundsavedgoal) {
378 normalfontact->setChecked(
true);
384 menuConfiguration->addSeparator();
392 menuConfiguration->addSeparator();
399 connect(pushButton_nextevent,SIGNAL(clicked()),
this,SLOT(
goToNextEvent()));
401 connect(pushButton_previousevent,SIGNAL(clicked()),
this,SLOT(goToPreviousEvent()));
402 connect(pushButton_eventselect,SIGNAL(clicked()),
this,SLOT(chooseEvent()));
422 QMenu* menu_help =
new QMenu(menubar);
423 menu_help->setObjectName(
"menu_help");
424 menu_help->setTitle(
"&Help");
425 menubar->addAction(menu_help->menuAction());
429 menu_help->addSeparator();
442 #ifndef BUILDVP1LIGHT
443 menubar->setEnabled(
false);
509 int sum1 = splitter_tabwidget_messagebox->sizes().at(0) + splitter_tabwidget_messagebox->sizes().at(1);
510 QList<int> sizes1; sizes1 << sum1 << 0;
511 splitter_tabwidget_messagebox->setSizes ( sizes1 );
513 while (splitter_tabwidget_messagebox->sizes().at(1)==0&&bottom<50000) {
514 QList<int> sizes2; sizes2 << sum1-bottom << bottom;
515 splitter_tabwidget_messagebox->setSizes ( sizes2 );
519 int sum2 = splitter_leftright->sizes().at(0) + splitter_leftright->sizes().at(1);
521 QList<int> sizes3; sizes3 << left << sum2-left;
522 splitter_leftright->setSizes ( sizes3 );
523 while (splitter_leftright->sizes().at(0)==0&&left<50000) {
524 QList<int> sizes4; sizes4 << left << sum2-left;
525 splitter_leftright->setSizes ( sizes4 );
529 int prefwidths = std::max<int>(left,widget_controlsContainer->sizeHint().width());
530 prefwidths = std::max<int>(prefwidths,groupBox_channelcontrols->sizeHint().width());
531 prefwidths = std::max<int>(prefwidths,groupBox_cruise->sizeHint().width());
532 prefwidths = std::max<int>(prefwidths,groupBox_event->sizeHint().width());
533 prefwidths = std::max<int>(prefwidths,stackedWidget_customcontrols->sizeHint().width());
534 widget_controlsContainer->setMaximumWidth(50+prefwidths);
745 const QString& instareasubdir,
746 const QString& extradirenvvar,
747 bool currentdir )
const
750 qDebug() <<
"VP1MainWindow::availableFiles()";
751 qDebug() <<
"extension:" << extension <<
"pathvar:" <<
pathvar <<
"instareasubdir:" << instareasubdir <<
"extradirenvvar:" << extradirenvvar <<
"currentdir:" << currentdir;
755 QStringList vp1pluginpath =
756 extradirenvvar.isEmpty() ?
758 QString(::getenv(extradirenvvar.toStdString().c_str())) .
759#
if QTCORE_VERSION >= 0x050E00
760 split(
":",Qt::SkipEmptyParts);
762 split(
":",QString::SkipEmptyParts);
765 qDebug() <<
"extradirenvvar:" << extradirenvvar;
766 qDebug() <<
"vp1pluginpath:" << vp1pluginpath;
772 vp1pluginpath<<QCoreApplication::applicationDirPath()+
"/../lib";
780 vp1pluginpath<<QDir::currentPath();
786 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
788 QString path = env.value(
pathvar);
791 if (!path.isEmpty()) {
792#if QTCORE_VERSION >= 0x050E00
794 QStringList tmp = path.split(
":",Qt::SkipEmptyParts);
797 QStringList tmp = path.split(
":",QString::SkipEmptyParts);
799 for (
const QString& dir : tmp) {
800 vp1pluginpath << ( instareasubdir.isEmpty() ? dir : dir+QDir::separator()+instareasubdir );
805 int nDuplicatesRemoved = vp1pluginpath.removeDuplicates();
809 QStringList validPluginPaths;
810 validPluginPaths.reserve(vp1pluginpath.size());
811 for (
const QString& plugindir : vp1pluginpath) {
813 QFileInfo fi(plugindir);
815 if (fi.exists() && fi.isDir()) {
816 validPluginPaths << plugindir;
821 vp1pluginpath = validPluginPaths;
825 QMap<QString,QString> plugins2fullpath;
826 for (
const QString& plugindir : vp1pluginpath) {
827 QStringList plugins = QDir(plugindir).entryList((QStringList()<<(
"*"+extension)),QDir::CaseSensitive | QDir::Files | QDir::Readable,QDir::Name);
828 for (QString plugin : plugins) {
829 plugin = QFileInfo(plugin).fileName();
830 if (!plugins2fullpath.contains(plugin)) {
831 QString fullpath = plugindir+QDir::separator()+plugin;
832 plugins2fullpath[plugin]=fullpath;
836 return plugins2fullpath;
1683 QSettings settings(
"ATLAS",
"VP1Light");
1685 QString plugfile, channelname, tabname;
1687 if (sender()==pushButton_quicksetup_geometrystudies||sender()==action_quicklaunch_Geometry_studies) {
1691 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1694 if(!dbSelection.result())
1699 plugfile=
"libVP1GeometryPlugin.so";
1700 channelname=
"Geometry";
1701 tabname =
"Geometry";
1702 }
else if (sender()==pushButton_quicksetup_trackingstudies||sender()==action_quicklaunch_Tracking_studies) {
1703 plugfile=
"libVP1TrackPlugin.so";
1704 channelname=
"Tracking";
1705 tabname =
"Tracking";
1706 }
else if (sender()==pushButton_quicksetup_calostudies||sender()==action_quicklaunch_Calo_studies) {
1707 plugfile=
"libVP1CaloPlugin.so";
1708 channelname=
"Calo Cells";
1709 tabname =
"Calorimeter";
1710 }
else if (sender()==action_quicklaunch_Storegate_browser) {
1711 plugfile=
"libVP1BanksPlugin.so";
1712 channelname=
"Banks";
1713 tabname =
"StoreGate";
1714 }
else if (sender()==pushButton_quicksetup_3dcocktail||sender()==action_quicklaunch_3dcocktail) {
1715#ifndef BUILDVP1LIGHT
1716 plugfile=
"libVP13DCocktailPlugin.so";
1717 channelname=
"3DCocktail";
1718 tabname =
"3D Cocktail";
1721 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1723 aodSelection.exec();
1724 if(!aodSelection.result())
1727 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1730 if(!dbSelection.result())
1735 pushButton_eventselect->setEnabled(
true);
1736 plugfile=
"libVP1LightPlugin.so";
1737 channelname=
"VP1Light";
1738 tabname =
"Geometry/AOD";
1740 }
else if (sender()==action_quicklaunch_trackcalo_commis) {
1741 plugfile=
"libVP13DCocktailPlugin.so";
1742 channelname=
"TrackCalo";
1743 tabname =
"Track/Calo";
1744 }
else if (sender()==pushButton_quicksetup_analysisstudies||sender()==action_quicklaunch_analysisstudies) {
1748 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1750 aodSelection.exec();
1751 if(!aodSelection.result())
1755 pushButton_eventselect->setEnabled(
true);
1758 plugfile=
"libVP1AODPlugin.so";
1760 tabname =
"Analysis";
1767 if (plugfile.endsWith(
".so"))
1768 plugfile = plugfile.left(plugfile.count()-3)+
".dylib";
1775 qDebug() <<
"plugins2fullpath: " << plugins2fullpath;
1778 if (!plugins2fullpath.contains(plugfile)) {
1779 QMessageBox::critical(0,
"Error - could not locate plugin file: "+plugfile,
1780 "could not locate plugin file: "
1781 +plugfile,QMessageBox::Ok,QMessageBox::Ok);
1784 QString plugfile_fullpath = plugins2fullpath[plugfile];
1790 if (!err.isEmpty()||!
m_channelmanager->currentPluginFiles().contains(plugfile_fullpath)) {
1791 QMessageBox::critical(0,
"Error - could not load plugin file: "+plugfile_fullpath,
1792 "Could not load plugin file: "
1793 +plugfile_fullpath+
"\n\nReason: "+err,QMessageBox::Ok,QMessageBox::Ok);
1800 if (!
m_channelmanager->channelsInPluginFile(plugfile_fullpath).contains(channelname)) {
1801 QMessageBox::critical(0,
"Error - did not find necessary channel: "+channelname,
1802 "Could not find channel: "+channelname+
" in loaded plugin "+plugfile_fullpath,
1803 QMessageBox::Ok,QMessageBox::Ok);
1807 bool save = updatesEnabled();
1808 setUpdatesEnabled(
false);
1812 QString newtabname =
m_tabmanager->suggestNewTabName(tabname);
1815 QMessageBox::critical(0,
"Error - could not create tab: "+newtabname,
1816 "Could not create tab: "+newtabname,
1817 QMessageBox::Ok,QMessageBox::Ok);
1818 setUpdatesEnabled(save);
1825 if (!
m_tabmanager->addChannelToTab( channelname, newtabname )) {
1826 QMessageBox::critical(0,
"Error - problems launching channel: "+channelname,
1827 "Problems launching channel: "+channelname,
1828 QMessageBox::Ok,QMessageBox::Ok);
1829 setUpdatesEnabled(save);
1837 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