141: QMainWindow(parent),
159 #if defined BUILDVP1LIGHT
165 if (!checkShowAllCruiseAndEventControls) {
166 pushButton_eventseek->setVisible(
false);
167 groupBox_cruise->setVisible(
false);
177 QMenu* menu_file =
new QMenu(menubar);
178 menu_file->setObjectName(
"menu_file");
179 menu_file->setTitle(
"&File");
180 menubar->addAction(menu_file->menuAction());
186 #ifndef BUILDVP1LIGHT
187 pushButton_previousevent->setVisible(
false);
188 pushButton_eventselect->setVisible(
false);
190 pushButton_eventselect->setVisible(
true);
191 pushButton_eventselect->setText(
"Event: 0/0");
192 pushButton_eventselect->setEnabled(
false);
193 pushButton_previousevent->setEnabled(
false);
197 pushButton_quicksetup_trackingstudies->setEnabled(
false);
198 pushButton_quicksetup_trackingstudies->setToolTip(
"Not available in VP1Light");
199 pushButton_quicksetup_calostudies->setEnabled(
false);
200 pushButton_quicksetup_calostudies->setToolTip(
"Not available in VP1Light");
201 action_quicklaunch_Tracking_studies->setEnabled(
false);
202 action_quicklaunch_Tracking_studies->setToolTip(
"Not available in VP1Light");
203 action_quicklaunch_Calo_studies->setEnabled(
false);
204 action_quicklaunch_Calo_studies->setToolTip(
"Not available in VP1Light");
205 action_quicklaunch_Storegate_browser->setEnabled(
false);
206 action_quicklaunch_Storegate_browser->setToolTip(
"Not available in VP1Light");
207 action_quicklaunch_trackcalo_commis->setEnabled(
false);
208 action_quicklaunch_trackcalo_commis->setToolTip(
"Not available in VP1Light");
217 QStringList inputdirs;
221 if (availLocal&&!inputdirs.isEmpty()) {
224 if (currentdir.endsWith(
"/"))
227 QMenu * menu_inputdir =
new QMenu(menubar);
228 menu_inputdir->setObjectName(
"menu_inputdir");
229 menu_inputdir->setTitle(
"&Stream");
231 menubar->addAction(menu_inputdir->menuAction());
233 QActionGroup * inputdir_actiongroup =
new QActionGroup(menu_inputdir);
234 QAction*action_inputdir_current(0);
235 for (QString inputdir : inputdirs) {
236 if (inputdir.endsWith(
"/"))
238 QString
dirname = QDir(inputdir).dirName();
239 QAction * action_inputdir =
new QAction(
this);
240 action_inputdir->setObjectName(
"action_inputdir_"+
dirname);
241 action_inputdir->setData(inputdir);
242 action_inputdir->setStatusTip(
"Get input files from: "+inputdir);
243 action_inputdir->setCheckable(
true);
245 if (currentdir==inputdir)
246 action_inputdir_current = action_inputdir;
247 menu_inputdir->addAction(action_inputdir);
248 inputdir_actiongroup->addAction(action_inputdir);
252 if (action_inputdir_current) {
253 action_inputdir_current->blockSignals(
true);
254 action_inputdir_current->setChecked(
true);
255 action_inputdir_current->blockSignals(
false);
269 QTimer *timer =
new QTimer(
this);
284 for (
int i=0;i<stackedWidget_central->count();++i)
285 stackedWidget_central->widget(i)->layout()->setContentsMargins(0,0,0,0);
288 frame_instructions->setFrameShape(QFrame::StyledPanel);
291 #ifndef BUILDVP1LIGHT
292 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
294 connect(pushButton_quicksetup_3dcocktail,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
296 connect(pushButton_quicksetup_trackingstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
297 connect(pushButton_quicksetup_calostudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
298 connect(pushButton_quicksetup_geometrystudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
299 connect(pushButton_quicksetup_analysisstudies,SIGNAL(clicked()),
this,SLOT(
quickSetupTriggered()));
321 connect(pushButton_channelfullscreen,SIGNAL(clicked()),
m_tabmanager,SLOT(showCurrentChannelFullScreen()));
329 connect(action_quicklaunch_Tracking_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
330 connect(action_quicklaunch_Calo_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
331 connect(action_quicklaunch_Geometry_studies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
332 connect(action_quicklaunch_analysisstudies,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
333 connect(action_quicklaunch_Storegate_browser,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
334 connect(action_quicklaunch_3dcocktail,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
335 connect(action_quicklaunch_trackcalo_commis,SIGNAL(triggered(
bool)),
this,SLOT(
quickSetupTriggered()));
336 connect(action_exit_VP1,SIGNAL(triggered(
bool)),
this,SLOT(close()));
342 menuConfiguration->addSeparator();
352 QActionGroup * styleGroup =
new QActionGroup(
this);
353 QAction * laststyleact(0);
354 bool foundplastique=
false;
356 QString defaultstyle=s.value(
"style/defaultstyle",
"Fusion").toString();
357 for (QString style : QStyleFactory::keys() ) {
359 act->setStatusTip(
"Change application style to "+style);
361 act->setCheckable(
true);
362 styleGroup->addAction(act);
364 if (act->text()==defaultstyle) {
365 act->setChecked(
true);
366 QApplication::setStyle(QStyleFactory::create(act->text()));
370 if (!foundplastique) {
371 laststyleact->setChecked(
true);
372 QApplication::setStyle(QStyleFactory::create(laststyleact->text()));
377 savedgoal = s.value(
"font/pixelsize_diff", 0).toInt();
379 savedgoal = s.value(
"font/pointsize_relativepercent", 0).toInt();
382 QList<int> fontoptions;
384 fontoptions <<15<<10<<+5<<+3<<+2<<+1<<0<<-1<<-2<<-3<<-5<<-10<<-20<<-30;
386 fontoptions <<150<<100<<50<<30<<20<<10<<5<<0<<-5<<-10<<-20<<-30<<-50;
388 QActionGroup * fontGroup =
new QActionGroup(
this);
389 bool foundsavedgoal(
false);
390 QAction * normalfontact(0);
391 for (
int fontopt : fontoptions) {
394 QString text = (fontopt==0?
"normal": (fontopt>0?
"+":
"")+QString::number(fontopt)+(
m_defaultfont_pointsize < 0.0?
" pixels" :
"%"));
396 act->setStatusTip(
"Change overall font size of application to "+text);
397 act->setData(fontopt);
398 act->setCheckable(
true);
399 fontGroup->addAction(act);
403 if (savedgoal==fontopt) {
404 act->setChecked(
true);
409 if (!foundsavedgoal) {
410 normalfontact->setChecked(
true);
416 menuConfiguration->addSeparator();
424 menuConfiguration->addSeparator();
431 connect(pushButton_nextevent,SIGNAL(clicked()),
this,SLOT(
goToNextEvent()));
433 connect(pushButton_previousevent,SIGNAL(clicked()),
this,SLOT(goToPreviousEvent()));
434 connect(pushButton_eventselect,SIGNAL(clicked()),
this,SLOT(chooseEvent()));
454 QMenu* menu_help =
new QMenu(menubar);
455 menu_help->setObjectName(
"menu_help");
456 menu_help->setTitle(
"&Help");
457 menubar->addAction(menu_help->menuAction());
461 menu_help->addSeparator();
466 if (qgetenv(
"VP1_REMOTE_MODE") ==
"1") {
467 QString coinPolicy = QString::fromLocal8Bit(qgetenv(
"VP1_COIN_INDIRECT_RENDERING_MESSAGE"));
468 if (coinPolicy.isEmpty())
469 coinPolicy = tr(
"Coin default policy (not initialized by the vp1 launcher).");
470 auto *modeLabel =
new QLabel(tr(
"REMOTE MODE"),
this);
471 modeLabel->setStyleSheet(
"QLabel { background: #ffe08a; color: #202020; font-weight: bold; padding: 4px; }");
472 modeLabel->setToolTip(tr(
"Remote mode enabled. Continuous rotation after mouse release is off by default. "
473 "Restart with --no-remote if detection is incorrect."));
474 modeLabel->setToolTip(modeLabel->toolTip() + QStringLiteral(
"\nSnapshot compatibility: ")
476 + QStringLiteral(
"\nCoin OpenGL policy: ") + coinPolicy);
477 statusBar()->addPermanentWidget(modeLabel);
479 QTimer::singleShot(0,
this, [
this, coinPolicy]() {
480 auto *notice =
new QMessageBox(QMessageBox::Information, tr(
"VP1 remote mode"),
481 tr(
"VP1 has launched in remote mode.\n\nReason: %1.\n\n"
482 "Remote mode improves your experience when running VP1 remotely. "
483 "It helps protect screenshot creation and makes mouse interaction more responsive.")
484 .arg(QString::fromLocal8Bit(qgetenv(
"VP1_REMOTE_REASON"))),
485 QMessageBox::Ok,
this);
486 notice->setTextFormat(Qt::PlainText);
487 notice->setDetailedText(
488 tr(
"To improve responsiveness, Continue rotating after mouse release is OFF by default. "
489 "Your saved remote preference takes precedence. Normal mouse dragging still works.\n\n"
490 "You can change this setting in the 3D viewer's right-click menu.\n\n"
491 "Snapshot compatibility: %1\n\n"
492 "Coin OpenGL policy: %2\n\n"
493 "If detection is incorrect, restart VP1 with --no-remote.")
495 notice->setAttribute(Qt::WA_DeleteOnClose);
510 #ifndef BUILDVP1LIGHT
511 menubar->setEnabled(
false);
813 const QString& instareasubdir,
814 const QString& extradirenvvar,
815 bool currentdir )
const
818 qDebug() <<
"VP1MainWindow::availableFiles()";
819 qDebug() <<
"extension:" << extension <<
"pathvar:" <<
pathvar <<
"instareasubdir:" << instareasubdir <<
"extradirenvvar:" << extradirenvvar <<
"currentdir:" << currentdir;
823 QStringList vp1pluginpath =
824 extradirenvvar.isEmpty() ?
826 QString(::getenv(extradirenvvar.toStdString().c_str())) .
827#
if QTCORE_VERSION >= 0x050E00
828 split(
":",Qt::SkipEmptyParts);
830 split(
":",QString::SkipEmptyParts);
833 qDebug() <<
"extradirenvvar:" << extradirenvvar;
834 qDebug() <<
"vp1pluginpath:" << vp1pluginpath;
840 vp1pluginpath<<QCoreApplication::applicationDirPath()+
"/../lib";
848 vp1pluginpath<<QDir::currentPath();
854 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
856 QString path = env.value(
pathvar);
859 if (!path.isEmpty()) {
860#if QTCORE_VERSION >= 0x050E00
862 QStringList tmp = path.split(
":",Qt::SkipEmptyParts);
865 QStringList tmp = path.split(
":",QString::SkipEmptyParts);
867 for (
const QString& dir : tmp) {
868 vp1pluginpath << ( instareasubdir.isEmpty() ? dir : dir+QDir::separator()+instareasubdir );
873 int nDuplicatesRemoved = vp1pluginpath.removeDuplicates();
877 QStringList validPluginPaths;
878 validPluginPaths.reserve(vp1pluginpath.size());
879 for (
const QString& plugindir : vp1pluginpath) {
881 QFileInfo fi(plugindir);
883 if (fi.exists() && fi.isDir()) {
884 validPluginPaths << plugindir;
889 vp1pluginpath = validPluginPaths;
893 QMap<QString,QString> plugins2fullpath;
894 for (
const QString& plugindir : vp1pluginpath) {
895 QStringList plugins = QDir(plugindir).entryList((QStringList()<<(
"*"+extension)),QDir::CaseSensitive | QDir::Files | QDir::Readable,QDir::Name);
896 for (QString plugin : plugins) {
897 plugin = QFileInfo(plugin).fileName();
898 if (!plugins2fullpath.contains(plugin)) {
899 QString fullpath = plugindir+QDir::separator()+plugin;
900 plugins2fullpath[plugin]=fullpath;
904 return plugins2fullpath;
1746 QSettings settings(
"ATLAS",
"VP1Light");
1748 QString plugfile, channelname, tabname;
1750 if (sender()==pushButton_quicksetup_geometrystudies||sender()==action_quicklaunch_Geometry_studies) {
1754 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1757 if(!dbSelection.result())
1762 plugfile=
"libVP1GeometryPlugin.so";
1763 channelname=
"Geometry";
1764 tabname =
"Geometry";
1765 }
else if (sender()==pushButton_quicksetup_trackingstudies||sender()==action_quicklaunch_Tracking_studies) {
1766 plugfile=
"libVP1TrackPlugin.so";
1767 channelname=
"Tracking";
1768 tabname =
"Tracking";
1769 }
else if (sender()==pushButton_quicksetup_calostudies||sender()==action_quicklaunch_Calo_studies) {
1770 plugfile=
"libVP1CaloPlugin.so";
1771 channelname=
"Calo Cells";
1772 tabname =
"Calorimeter";
1773 }
else if (sender()==action_quicklaunch_Storegate_browser) {
1774 plugfile=
"libVP1BanksPlugin.so";
1775 channelname=
"Banks";
1776 tabname =
"StoreGate";
1777 }
else if (sender()==pushButton_quicksetup_3dcocktail||sender()==action_quicklaunch_3dcocktail) {
1778#ifndef BUILDVP1LIGHT
1779 plugfile=
"libVP13DCocktailPlugin.so";
1780 channelname=
"3DCocktail";
1781 tabname =
"3D Cocktail";
1784 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1786 aodSelection.exec();
1787 if(!aodSelection.result())
1790 if(settings.value(
"db/dbByEnv").toString().isEmpty()){
1793 if(!dbSelection.result())
1798 pushButton_eventselect->setEnabled(
true);
1799 plugfile=
"libVP1LightPlugin.so";
1800 channelname=
"VP1Light";
1801 tabname =
"Geometry/AOD";
1803 }
else if (sender()==action_quicklaunch_trackcalo_commis) {
1804 plugfile=
"libVP13DCocktailPlugin.so";
1805 channelname=
"TrackCalo";
1806 tabname =
"Track/Calo";
1807 }
else if (sender()==pushButton_quicksetup_analysisstudies||sender()==action_quicklaunch_analysisstudies) {
1811 if(settings.value(
"aod/aodByEnv").toString().isEmpty()){
1813 aodSelection.exec();
1814 if(!aodSelection.result())
1818 pushButton_eventselect->setEnabled(
true);
1821 plugfile=
"libVP1AODPlugin.so";
1823 tabname =
"Analysis";
1830 if (plugfile.endsWith(
".so"))
1831 plugfile = plugfile.left(plugfile.count()-3)+
".dylib";
1838 qDebug() <<
"plugins2fullpath: " << plugins2fullpath;
1841 if (!plugins2fullpath.contains(plugfile)) {
1842 QMessageBox::critical(0,
"Error - could not locate plugin file: "+plugfile,
1843 "could not locate plugin file: "
1844 +plugfile,QMessageBox::Ok,QMessageBox::Ok);
1847 QString plugfile_fullpath = plugins2fullpath[plugfile];
1853 if (!err.isEmpty()||!
m_channelmanager->currentPluginFiles().contains(plugfile_fullpath)) {
1854 QMessageBox::critical(0,
"Error - could not load plugin file: "+plugfile_fullpath,
1855 "Could not load plugin file: "
1856 +plugfile_fullpath+
"\n\nReason: "+err,QMessageBox::Ok,QMessageBox::Ok);
1863 if (!
m_channelmanager->channelsInPluginFile(plugfile_fullpath).contains(channelname)) {
1864 QMessageBox::critical(0,
"Error - did not find necessary channel: "+channelname,
1865 "Could not find channel: "+channelname+
" in loaded plugin "+plugfile_fullpath,
1866 QMessageBox::Ok,QMessageBox::Ok);
1870 bool save = updatesEnabled();
1871 setUpdatesEnabled(
false);
1875 QString newtabname =
m_tabmanager->suggestNewTabName(tabname);
1878 QMessageBox::critical(0,
"Error - could not create tab: "+newtabname,
1879 "Could not create tab: "+newtabname,
1880 QMessageBox::Ok,QMessageBox::Ok);
1881 setUpdatesEnabled(save);
1888 if (!
m_tabmanager->addChannelToTab( channelname, newtabname )) {
1889 QMessageBox::critical(0,
"Error - problems launching channel: "+channelname,
1890 "Problems launching channel: "+channelname,
1891 QMessageBox::Ok,QMessageBox::Ok);
1892 setUpdatesEnabled(save);
1900 setUpdatesEnabled(save);