diff --git a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h index a41d5e5cddd3e41ee88a8013dd2e3b0c87efe2e2..3d35b90630de97e5e81f9379c566c4f4dcca6826 100644 --- a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h +++ b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h @@ -363,7 +363,7 @@ class WriteGeoModel : public GeoNodeAction { bool m_inspect{0}; /// Stores the loglevel, the verbosity of the output messages - unsigned m_loglevel; + unsigned m_loglevel{0}; }; } /* namespace GeoModelIO */ diff --git a/GeoModelTools/GMCAT/src/publishMetaData.cpp b/GeoModelTools/GMCAT/src/publishMetaData.cpp index f06210c29c5d6a0ea99b8e3cb61a149e66ea8e04..cd29a8c6eaf97e7b12e7998a4ea66d0c267c7e92 100644 --- a/GeoModelTools/GMCAT/src/publishMetaData.cpp +++ b/GeoModelTools/GMCAT/src/publishMetaData.cpp @@ -153,7 +153,6 @@ void publishMetaData( GMDBManager & db, &metadata.dateString, &metadata.gmdataAssociatedTag}) { s->erase(std::remove(s->begin(), s->end(), '\n'), s->end()); - std::cout << s << std::endl; } @@ -190,7 +189,6 @@ void publishMetaData( GMDBManager & db, &xtraMetadata.repo, &xtraMetadata.branch }) { s->erase(std::remove(s->begin(), s->end(), '\n'), s->end()); - std::cout << s << std::endl; } diff --git a/GeoModelVisualization/GeoModelExplorer/src/main.cxx b/GeoModelVisualization/GeoModelExplorer/src/main.cxx index d8de337f3ba5c405e3e5ee9b0c6ca443a750c94c..8c34096029d6d4251c3a6df6acdba8bb7e52b1b7 100644 --- a/GeoModelVisualization/GeoModelExplorer/src/main.cxx +++ b/GeoModelVisualization/GeoModelExplorer/src/main.cxx @@ -7,7 +7,6 @@ // Update: Nov 2019 // // Qt includes -#include <QSettings> #include <QString> #include <QDir> #include <QDebug> @@ -29,19 +28,15 @@ int main(int argc, char** argv) { - // We don't know for sure which one of these causes the trouble..We add them all till we understand why this - // is happening and correct the problem where it occurs. - - - setenv("LC_ADDRESS","en_US.UTF-8",1); - setenv("LC_NAME","en_US.UTF-8",1); - setenv("LC_MONETARY","en_US.UTF-8",1); - setenv("LC_PAPER","en_US.UTF-8",1); - setenv("LC_IDENTIFICATION","en_US.UTF-8",1); - setenv("LC_TELEPHONE","en_US.UTF-8",1); - setenv("LC_MEASUREMENT","en_US.UTF-8",1); - setenv("LC_TIME","en_US.UTF-8",1); - setenv("LC_NUMERIC","en_US.UTF-8",1); + setenv("LC_ADDRESS","en_US.UTF-8",1); + setenv("LC_NAME","en_US.UTF-8",1); + setenv("LC_MONETARY","en_US.UTF-8",1); + setenv("LC_PAPER","en_US.UTF-8",1); + setenv("LC_IDENTIFICATION","en_US.UTF-8",1); + setenv("LC_TELEPHONE","en_US.UTF-8",1); + setenv("LC_MEASUREMENT","en_US.UTF-8",1); + setenv("LC_TIME","en_US.UTF-8",1); + setenv("LC_NUMERIC","en_US.UTF-8",1); @@ -58,7 +53,7 @@ int main(int argc, char** argv) std::string gxpluginpath= GXPLUGINDIR; pManip("GXPLUGINPATH",gxpluginpath.c_str()); - std::cout << "Plugins resolved in path: " << getenv("GXPLUGINPATH") << std::endl; + QStringList arguments; for (int i = 0; i<=argc; i++){ arguments << argv[i]; @@ -100,24 +95,16 @@ int main(int argc, char** argv) } - //If help option is set, display help and exit VP1Light + //If help option is set, display help and exit gmex if(helpIsSet){ qInfo() << "Usage"; qInfo() << " "; - qInfo() << " vp1light [options] [dbfile1] [dbfile2]... [sharedlib1] [sharedlib2] [sharedlib3]... [clash1.json] [clash2.json]..."; + qInfo() << " gmex [options] [dbfile1] [dbfile2]... [sharedlib1] [sharedlib2] [sharedlib3]... [clash1.json] [clash2.json]..."; qInfo() << "Options:"; qInfo() << " -h, --help = Show help."; return 0; } - // Save settings - QSettings settings("ATLAS", "VP1Light"); // TODO: update labels! - // Disable expert settings by default - if(settings.value("ExpertSettings/notFirstStart").toString().isEmpty()){ - settings.setValue("ExpertSettings/notFirstStart","1"); - settings.setValue("ExpertSettings/enableExpertSettings",""); - } - GXExecutionScheduler *scheduler=GXExecutionScheduler::init(); while (scheduler->interact()) GXExecutionScheduler::cleanup(scheduler); diff --git a/GeoModelVisualization/VP1Base/VP1Base/VP1ExaminerViewer.h b/GeoModelVisualization/VP1Base/VP1Base/VP1ExaminerViewer.h index fcd7dc9ecf1a8f3060ace169d20f2547d46dcf6a..89ec8ac52672ed30cc311673699afdb905ebc8bb 100644 --- a/GeoModelVisualization/VP1Base/VP1Base/VP1ExaminerViewer.h +++ b/GeoModelVisualization/VP1Base/VP1Base/VP1ExaminerViewer.h @@ -120,7 +120,6 @@ protected: - private: class Imp; diff --git a/GeoModelVisualization/VP1Base/src/VP1ExaminerViewer.cxx b/GeoModelVisualization/VP1Base/src/VP1ExaminerViewer.cxx index f5fee1fbdaf804545816d5888e0144aeee01cfd9..ed7847e276297cde379a6930d1f980f305800235 100644 --- a/GeoModelVisualization/VP1Base/src/VP1ExaminerViewer.cxx +++ b/GeoModelVisualization/VP1Base/src/VP1ExaminerViewer.cxx @@ -52,7 +52,7 @@ #include <QFileDialog> #include <QInputDialog> #include <QPushButton> -#include <QActionGroup> +#include <QActionGroup> //#include <QGLFormat> #include <map> @@ -1386,12 +1386,12 @@ void VP1ExaminerViewer::removeDecorationMenuOption() } + //____________________________________________________________________ SbBool VP1ExaminerViewer::processSoEvent(const SoEvent * const evt ) { // VP1Msg::messageDebug("VP1ExaminerViewer::processSoEvent()"); // std::cout << "event type: " << evt->getClassTypeId().getName() << " - " << evt->getTypeId().getName() << std::endl; - if (evt->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) { //We want to add a few shortcuts: // "A": View all @@ -1515,9 +1515,9 @@ void VP1ExaminerViewer::setSeekMode(SbBool enable) //____________________________________________________________________ void VP1ExaminerViewer::setViewing(SbBool enable) { - VP1Msg::messageVerbose("VP1ExaminerViewer::setViewing()"); - m_d->grabFocus(); - SoQtExaminerViewer::setViewing(enable); + VP1Msg::messageVerbose("VP1ExaminerViewer::setViewing()"); + // m_d->grabFocus(); JFB TURNED THIS OFF, otherwise Alt key is screwy. + SoQtExaminerViewer::setViewing(enable); } //____________________________________________________________________ @@ -1759,7 +1759,6 @@ void VP1ExaminerViewer::setAntiAlias(bool b) { m_d->isantialias=b; b ? setAntialiasing(true,4) : setAntialiasing(false,1); - std::cout << "antiAliasing set." << std::endl; } //____________________________________________________________________ diff --git a/GeoModelVisualization/VP1Base/src/VP1QtUtils.cxx b/GeoModelVisualization/VP1Base/src/VP1QtUtils.cxx index 501a835596f3acd3bbb7917a1b762fe8cccbd98f..fb0a80770fc6d1f0d56556fe4baf6a31299beefc 100644 --- a/GeoModelVisualization/VP1Base/src/VP1QtUtils.cxx +++ b/GeoModelVisualization/VP1Base/src/VP1QtUtils.cxx @@ -28,7 +28,7 @@ bool VP1QtUtils::expertSettingIsSet(const QString& type, const QString& name) { bool set; if(type=="general"){ - QSettings generalSettings("ATLAS", "VP1Light"); + QSettings generalSettings("ATLAS", "gmex"); set = !generalSettings.value(name).toString().isEmpty(); } else { QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat); @@ -44,7 +44,7 @@ QString VP1QtUtils::expertSettingValue(const QString& type, const QString& name) { QString env; if(type=="general"){ - QSettings generalSettings("ATLAS", "VP1Light"); + QSettings generalSettings("ATLAS", "gmex"); env = generalSettings.value(name).toString(); } else { QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat); @@ -61,7 +61,7 @@ bool VP1QtUtils::expertSettingIsOn(const QString& type, const QString& name) { QString env; if(type=="general"){ - QSettings generalSettings("ATLAS", "VP1Light"); + QSettings generalSettings("ATLAS", "gmex"); env = generalSettings.value(name).toString(); } else { QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat); @@ -94,7 +94,7 @@ void VP1QtUtils::setExpertSetting(const QString& type, const QString& name, cons VP1Msg::messageVerbose("VP1QtUtils::setEnvironmentVariable: Setting variable '"+name+"' to value '"+content+"'."); if(type=="general"){ - QSettings generalSettings("ATLAS", "VP1Light"); + QSettings generalSettings("ATLAS", "gmex"); generalSettings.setValue(name, content); } else { QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat); diff --git a/GeoModelVisualization/VP1GeometrySystems/VP1GeometrySystems/VP1GeometrySystem.h b/GeoModelVisualization/VP1GeometrySystems/VP1GeometrySystems/VP1GeometrySystem.h index e33dda7102b53f93f496c4e0e7c259023a26db82..139ac0f36f770adc46807d4ab7c1bc65f4002f68 100644 --- a/GeoModelVisualization/VP1GeometrySystems/VP1GeometrySystems/VP1GeometrySystem.h +++ b/GeoModelVisualization/VP1GeometrySystems/VP1GeometrySystems/VP1GeometrySystem.h @@ -77,7 +77,6 @@ protected slots: void volumeStateChangeRequested(VolumeHandle*,VP1GeoFlags::VOLSTATE); void volumeResetRequested(VolumeHandle*); - void actionOnAllNonStandardVolumes(bool);//true: zap, false: expand. void actionOnAllVolumes(bool zap, bool standardVolumes = true);//true: zap, false: expand; true: standardVolumes void filterVolumes(QString targetname, bool bymatname, int maxDepth, bool stopAtFirst, bool visitChildren, bool reset); diff --git a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx index c09b8affd937f7e40b50b175eb6e773cb5cf3c30..6b4b49449017df47475b96e9c820b8da52031d3a 100644 --- a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx +++ b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx @@ -88,7 +88,6 @@ // Qt includes #include <QStack> #include <QString> -#include <QSettings> #include <QDebug> #include <QRegExp> #include <QByteArray> @@ -306,7 +305,6 @@ QWidget * VP1GeometrySystem::buildController() connect (m_d->controller,SIGNAL(volumeResetRequested(VolumeHandle*)), this,SLOT(volumeResetRequested(VolumeHandle*))); - connect(m_d->controller,SIGNAL(actionOnAllNonStandardVolumes(bool)),this,SLOT(actionOnAllNonStandardVolumes(bool))); connect(m_d->controller,SIGNAL(autoExpandByVolumeOrMaterialName(bool,QString)),this,SLOT(autoExpandByVolumeOrMaterialName(bool,QString))); connect(m_d->controller,SIGNAL(signalFilterVolumes(QString, bool, int, bool, bool, bool)),this,SLOT(filterVolumes(QString, bool, int, bool, bool, bool))); @@ -1814,13 +1812,6 @@ void VP1GeometrySystem::Imp::changeStateOfVisibleNonStandardVolumesRecursively(V changeStateOfVisibleNonStandardVolumesRecursively(*it, target); } -// Not used at the moment, but useful -//_____________________________________________________________________________________ -void VP1GeometrySystem::actionOnAllNonStandardVolumes(bool zap) -{ - actionOnAllVolumes(zap, false); -} - // Not used at the moment, but useful //_____________________________________________________________________________________ void VP1GeometrySystem::actionOnAllVolumes(bool zap, bool standardVolumes /* default: true*/) diff --git a/GeoModelVisualization/VP1Gui/VP1Gui/GXExecutionScheduler.h b/GeoModelVisualization/VP1Gui/VP1Gui/GXExecutionScheduler.h index 50e789ba8d04d56f3f1b30e637e9d536483aac74..4285fb7ccd3e54918db75cdc9d31a3835066965b 100644 --- a/GeoModelVisualization/VP1Gui/VP1Gui/GXExecutionScheduler.h +++ b/GeoModelVisualization/VP1Gui/VP1Gui/GXExecutionScheduler.h @@ -60,11 +60,6 @@ public: bool hasAllActiveSystemsRefreshed(IVP1ChannelWidget*) const; - QStringList userRequestedFiles(); - - QString saveSnaphsotToFile(IVP1System* s, bool batch = false); - - signals: void refreshingStatusChanged(bool); @@ -79,7 +74,6 @@ private: private slots: void processSystemForRefresh(); - void updateProgressBarDuringRefresh(); void channelCreated(IVP1ChannelWidget*); void channelUncreated(IVP1ChannelWidget*); void startRefreshQueueIfAppropriate(); diff --git a/GeoModelVisualization/VP1Gui/VP1Gui/GXMainWindow.h b/GeoModelVisualization/VP1Gui/VP1Gui/GXMainWindow.h index 29879847f8b4a49b15100608bac0f479119af5be..48edff3b4d11abb932bcfa559c388f62354a87bc 100644 --- a/GeoModelVisualization/VP1Gui/VP1Gui/GXMainWindow.h +++ b/GeoModelVisualization/VP1Gui/VP1Gui/GXMainWindow.h @@ -56,9 +56,6 @@ public: public slots: void loadPluginFile(QString filename); - #ifdef BUILDVP1LIGHT - void request_expertSettings(); - #endif void request_addEmptyTab(); void request_channelInformation(); void request_printChannel(); @@ -154,7 +151,6 @@ protected: QMenu * m_menu_changeStyle; QMenu * m_menu_changeFontSize; QAction * m_actionAdd_empty_tab; - QAction * m_actionEnableExpertSettings; QAction * m_actionSave_current_tabs; QAction* m_action_openUsersGuide; QAction* m_action_openUsersSupport; diff --git a/GeoModelVisualization/VP1Gui/VP1Gui/VP1ExpertSettings.h b/GeoModelVisualization/VP1Gui/VP1Gui/VP1ExpertSettings.h deleted file mode 100644 index af550ca00727346dc781fe70777de118581b3f55..0000000000000000000000000000000000000000 --- a/GeoModelVisualization/VP1Gui/VP1Gui/VP1ExpertSettings.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////////////////////////// -// // -// Header file for class VP1ExpertSettings // -// // -// Description: Additional VP1 settings // -// // -// Author: Sebastian Andreas Merkt (sebastian.andreas.merkt@cern.ch) // -// Initial version: August 2017 // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef VP1EXPERTSETTINGS_H -#define VP1EXPERTSETTINGS_H - -#include <QDialog> -#include <QComboBox> -#include <QPushButton> -#include <QDialogButtonBox> -#include <QCheckBox> - -class VP1ExpertSettings : public QDialog -{ - Q_OBJECT -public: - explicit VP1ExpertSettings(QWidget *parent = 0); - -public slots: - void setPluginPath(const QString &path); - void setFileSelectDir(const QString &path); - void setScreenshotDir(const QString &path); - void setAuthLog(const QString &path); - -private: - QString m_pluginPath; - QString m_fileSelectDir; - QString m_screenshotDir; - QString m_authLog; - QDialogButtonBox* m_buttonBox; - QTabWidget* m_tabWidget; - QPushButton* m_okButton; - - bool checkBoxState(); - void closeEvent(QCloseEvent *event); - void keyPressEvent(QKeyEvent *event); - void setExpertSetting(const QString &type, const QString &name); -}; - - - - - - -class GeneralTab : public QWidget -{ - Q_OBJECT - -public: - explicit GeneralTab(QWidget *parent = 0); - -private slots: - #if defined BUILDVP1LIGHT - void setExpertSetting(const QString &type, const QString &name); - #else - void setExpertSetting(const QString &name); - #endif - void on_browseButton1_clicked(); - void slotScreenshotDirChanged(const QString &path); - -signals: - void signalScreenshotDirChanged(const QString &path); - -private: - QCheckBox* m_checkboxVerbose; - QCheckBox* m_checkboxDebug; - QCheckBox* m_checkboxDisallowMultipleChannels; - QCheckBox* m_checkboxDisplayMouseClicks; - QCheckBox* m_checkboxEnableAskOnClose; - QCheckBox* m_checkboxGuidesSphereInsteadOfCoordaxes; - QCheckBox* m_checkboxAntiAliasing; - QPushButton* m_browseButton1; - QLineEdit* m_lineEdit1; -}; - - - - - - -class AdvancedTab : public QWidget -{ - Q_OBJECT - -public: - explicit AdvancedTab(QWidget *parent = 0); - -private slots: - void on_browseButton1_clicked(); - void on_browseButton2_clicked(); - void on_browseButton3_clicked(); - void slotPluginPathChanged(const QString &path); - void slotFileSelectDirChanged(const QString &path); - void slotAuthLogChanged(const QString &path); - #if defined BUILDVP1LIGHT - void setExpertSetting(const QString &type, const QString &name); - #else - void setExpertSetting(const QString &name); - #endif - -signals: - void signalPluginPathChanged(const QString &path); - void signalFileSelectDirChanged(const QString &path); - void signalAuthLogChanged(const QString &path); - -private: - QPushButton* m_browseButton1; - QPushButton* m_browseButton2; - QPushButton* m_browseButton3; - QCheckBox* m_checkboxEnableInformOnEndOfJob; - QCheckBox* m_checkboxHardExitAtEnd; - QCheckBox* m_checkboxDevelShowAllCruiseAndEventControls; - QLineEdit* m_lineEdit1; - QLineEdit* m_lineEdit2; - QLineEdit* m_lineEdit3; -}; - - -#endif // VP1EXPERTSETTINGS_H diff --git a/GeoModelVisualization/VP1Gui/src/GXExecutionScheduler.cxx b/GeoModelVisualization/VP1Gui/src/GXExecutionScheduler.cxx index 20d3664d4ac8566331678035f37a88a43b8bcf35..6408e3bc18d4f9c7a71fc5e10f93fc8afd30af2f 100644 --- a/GeoModelVisualization/VP1Gui/src/GXExecutionScheduler.cxx +++ b/GeoModelVisualization/VP1Gui/src/GXExecutionScheduler.cxx @@ -15,23 +15,6 @@ // // ///////////////////////////////////////////////////////////// -//TODO: -// -// * Save sys2time data in .vp1 file -// * Disable custom controllers between events! -// we need to be able to ask the scheduler if a given tab is ready. -// * "Soon to be visible" priority -// * General performance optimisation (inline internal methods + -// cache iterators). -// * Take care of accumulators. - -/* this to fix the 'ptrdiff_t' does not name a type error with Qt: - * refs: - * - http://qt-project.org/forums/viewthread/16992 - * - http://stackoverflow.com/questions/6727193/g-4-6-complains-about-iterator-difference-type-g-4-4-and-visual-studio-don - */ -// #include <stddef.h> - #include "VP1Gui/GXExecutionScheduler.h" #include "VP1Gui/VP1Prioritiser.h" @@ -51,7 +34,6 @@ #include <QApplication> #include <QProgressBar> -//#include <QDesktopWidget> #include <QMouseEvent> #include <QWheelEvent> #include <QCursor> @@ -77,46 +59,14 @@ std::vector<std::string> qstringlistToVecString(QStringList list) { - std::vector<std::string> vec; - foreach(QString str, list) { - vec.push_back(str.toStdString()); - } - return vec; + std::vector<std::string> vec; + foreach(QString str, list) { + vec.push_back(str.toStdString()); + } + return vec; } -#ifdef BUILDVP1LIGHT - //Qt - #include <QSettings> - - // XAOD - #include "xAODRootAccess/Init.h" - #include "xAODRootAccess/TEvent.h" - #include "xAODRootAccess/TStore.h" - #include "xAODRootAccess/tools/Message.h" - #include "xAODRootAccess/TAuxStore.h" - #include "xAODCore/AuxContainerBase.h" - #include "xAODCore/tools/ReadStats.h" - #include "xAODCore/tools/IOStats.h" - - // // For testing - #include "xAODEventInfo/EventInfo.h" - #include <QDebug> - #include "xAODRootAccessInterfaces/TActiveEvent.h" - #include "xAODRootAccessInterfaces/TVirtualEvent.h" - #include <TTree.h> - #include <regex> - #include <QString> - - // ROOT include(s): - #include <TTree.h> - #include <TFile.h> - #include <TError.h> - - template <typename... Args> inline void unused(Args&&...) {} // to declare unused variables (see executeNewEvent() ). -#endif // BUILDVP1LIGHT - - //___________________________________________________________________ class GXExecutionScheduler::Imp { @@ -128,21 +78,12 @@ public: VP1Prioritiser * prioritiser; GXMainWindow* mainwindow; - long int eventsProcessed; - QTimer * refreshtimer; QTimer * splashScreenTimer; IVP1System* currentsystemrefreshing; bool allSystemsRefreshed; - bool goingtonextevent; - //Statusbar: - QProgressBar * pb; - double calctimethisevent; - double currentrefreshsystemestimate; - void updateProgressBar(); - QTimer * pbtimer; //When receiving erase requests for a system that is currently refreshing, we use this: bool eraseJustAfterRefresh; @@ -153,9 +94,7 @@ public: static void warnIfWidgetsAlive(); - QString nextRequestedEvent; - bool skipEvent; }; // NOTE: Before arriving here, events are intercepted by the SoCooperativeSelection class, @@ -163,724 +102,483 @@ public: //___________________________________________________________________ class GXExecutionScheduler::Imp::GlobalEventFilter : public QObject { public: - GlobalEventFilter():m_lastPopup(QTime::currentTime()), - m_lastPopupWasQMenu(false){} - - bool eventFilter ( QObject * watched, QEvent * event ) { - // std::cout << "GXExecutionScheduler::Imp::GlobalEventFilter::eventFilter()\n"; - - if (event->type()==QEvent::MouseButtonPress - ||event->type()==QEvent::MouseButtonDblClick - ||event->type()==QEvent::Wheel - ||event->type()==QEvent::KeyPress) - { - QTime t = QTime::currentTime(); - int timediff(abs(t.msecsTo(m_lastPopup))); - int timecut(m_lastPopupWasQMenu?300:100); - if (timediff>timecut) { - m_lastPopup = t; - QString txt; - - // Grab events - QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(event); - QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(event); - QWheelEvent* wheelEvent = dynamic_cast<QWheelEvent*>(event); - - // Intercept mouse events - if (mouseEvent) { - qDebug() << "VP1Gui::GlobalEventFilter: mouse event intercepted."; - /* - * get 'modifiers' - * macOS: - * - shift: QFlags<Qt::KeyboardModifier>(ShiftModifier) - * - option/alt: QFlags<Qt::KeyboardModifier>(AltModifier) - * - control: QFlags<Qt::KeyboardModifier>(MetaModifier) - * - command: QFlags<Qt::KeyboardModifier>(ControlModifier) - */ - qDebug() << "modifiers:" << mouseEvent->modifiers(); - /* - * get the mouse position - */ - qDebug() << "pos():" << mouseEvent->pos() << ", x():" << mouseEvent->x() << ", y():" << mouseEvent->y() << ", globalPos():" << mouseEvent->globalPos(); - - txt = event->type()==QEvent::MouseButtonDblClick?"Dbl-click" - :(mouseEvent->button()&Qt::LeftButton?"Left-click" - :(mouseEvent->button()&Qt::RightButton?"Right-click":"Middle-click")); - } - // Intercept Wheel events - else if (wheelEvent) { - qDebug() << "VP1Gui::GlobalEventFilter: wheel event intercepted."; - // QWheelEvent * wheelEvent = dynamic_cast<QWheelEvent*>(event); - // if (wheelEvent) - txt = "Wheel event"; - } - - if (keyEvent) { - qDebug() << "VP1Gui::GlobalEventFilter: keyboard event intercepted."; - /* - * get the key pressed by the user - */ - qDebug() << "key pressed (code):" << keyEvent->key() << "key pressed (text):" << keyEvent->text(); - if (keyEvent->text() != "") txt = txt + "+" + keyEvent->text(); - else txt = txt + "+" + (char) keyEvent->key(); - } - - // std::cout<<"Popup (dt="<<timediff<<") "<<txt.toStdString()<<". watched = "<<watched - // <<" (on="<<watched->objectName().toStdString()<<")" - // <<" (cn="<<watched->metaObject()->className()<<")" - // <<std::endl; - - QLabel * label = new QLabel(txt,0,Qt::Tool|Qt::FramelessWindowHint - |Qt::X11BypassWindowManagerHint|Qt::WindowStaysOnTopHint); - label->setStyleSheet("background-color: yellow;color: black;" - "font: bold 140%;border: 2px solid black"); - //"border-radius: 3px;" - label->setFrameStyle(QFrame::StyledPanel); - label->setAttribute(Qt::WA_ShowWithoutActivating); - label->setFocusPolicy(Qt::NoFocus); - QPoint p(QCursor::pos().x()-label->sizeHint().width()/2,QCursor::pos().y()-label->sizeHint().height()); - label->move(p); - QTimer::singleShot(0,label,SLOT(show())); - QTimer::singleShot(500, label, SLOT(deleteLater())); - m_lastPopupWasQMenu = (dynamic_cast<QMenu*>(watched)!=0); - } - } - return false;//old - // new, from Qt documentation. - // FIXME: However, it is not possible to switch the "Show click events" option in VP1Light - // when that is ON, because the click on the checkbox is not passed on properly. - return QObject::eventFilter(watched, event);// return false; + GlobalEventFilter():m_lastPopup(QTime::currentTime()), + m_lastPopupWasQMenu(false){} + + bool eventFilter ( QObject * watched, QEvent * event ) { + + if (event->type()==QEvent::MouseButtonPress + ||event->type()==QEvent::MouseButtonDblClick + ||event->type()==QEvent::Wheel + ||event->type()==QEvent::KeyPress) + { + QTime t = QTime::currentTime(); + int timediff(abs(t.msecsTo(m_lastPopup))); + int timecut(m_lastPopupWasQMenu?300:100); + if (timediff>timecut) { + m_lastPopup = t; + QString txt; + + // Grab events + QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(event); + QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(event); + QWheelEvent* wheelEvent = dynamic_cast<QWheelEvent*>(event); + + // Intercept mouse events + if (mouseEvent) { + qDebug() << "VP1Gui::GlobalEventFilter: mouse event intercepted."; + /* + * get 'modifiers' + * macOS: + * - shift: QFlags<Qt::KeyboardModifier>(ShiftModifier) + * - option/alt: QFlags<Qt::KeyboardModifier>(AltModifier) + * - control: QFlags<Qt::KeyboardModifier>(MetaModifier) + * - command: QFlags<Qt::KeyboardModifier>(ControlModifier) + */ + qDebug() << "modifiers:" << mouseEvent->modifiers(); + /* + * get the mouse position + */ + qDebug() << "pos():" << mouseEvent->pos() << ", x():" << mouseEvent->x() << ", y():" << mouseEvent->y() << ", globalPos():" << mouseEvent->globalPos(); + + txt = event->type()==QEvent::MouseButtonDblClick?"Dbl-click" + :(mouseEvent->button()&Qt::LeftButton?"Left-click" + :(mouseEvent->button()&Qt::RightButton?"Right-click":"Middle-click")); + } + // Intercept Wheel events + else if (wheelEvent) { + qDebug() << "VP1Gui::GlobalEventFilter: wheel event intercepted."; + // QWheelEvent * wheelEvent = dynamic_cast<QWheelEvent*>(event); + // if (wheelEvent) + txt = "Wheel event"; + } + + if (keyEvent) { + qDebug() << "VP1Gui::GlobalEventFilter: keyboard event intercepted."; + /* + * get the key pressed by the user + */ + qDebug() << "key pressed (code):" << keyEvent->key() << "key pressed (text):" << keyEvent->text(); + if (keyEvent->text() != "") txt = txt + "+" + keyEvent->text(); + else txt = txt + "+" + (char) keyEvent->key(); + } + + // std::cout<<"Popup (dt="<<timediff<<") "<<txt.toStdString()<<". watched = "<<watched + // <<" (on="<<watched->objectName().toStdString()<<")" + // <<" (cn="<<watched->metaObject()->className()<<")" + // <<std::endl; + + QLabel * label = new QLabel(txt,0,Qt::Tool|Qt::FramelessWindowHint + |Qt::X11BypassWindowManagerHint|Qt::WindowStaysOnTopHint); + label->setStyleSheet("background-color: yellow;color: black;" + "font: bold 140%;border: 2px solid black"); + //"border-radius: 3px;" + label->setFrameStyle(QFrame::StyledPanel); + label->setAttribute(Qt::WA_ShowWithoutActivating); + label->setFocusPolicy(Qt::NoFocus); + QPoint p(QCursor::pos().x()-label->sizeHint().width()/2,QCursor::pos().y()-label->sizeHint().height()); + label->move(p); + QTimer::singleShot(0,label,SLOT(show())); + QTimer::singleShot(500, label, SLOT(deleteLater())); + m_lastPopupWasQMenu = (dynamic_cast<QMenu*>(watched)!=0); } + } + return false;//old + // new, from Qt documentation. + // FIXME: However, it is not possible to switch the "Show click events" option in VP1Light + // when that is ON, because the click on the checkbox is not passed on properly. + return QObject::eventFilter(watched, event);// return false; + } private: - QTime m_lastPopup; - bool m_lastPopupWasQMenu; + QTime m_lastPopup; + bool m_lastPopupWasQMenu; }; //___________________________________________________________________ GXExecutionScheduler::GXExecutionScheduler( QObject * parent) -: QObject(parent), m_d(new Imp) + : QObject(parent), m_d(new Imp) { - m_d->eventsProcessed = 0; - m_d->scheduler = this; - m_d->prioritiser = new VP1Prioritiser(this); - m_d->mainwindow = new GXMainWindow(this); + m_d->scheduler = this; + m_d->prioritiser = new VP1Prioritiser(this); + m_d->mainwindow = new GXMainWindow(this); - m_d->allSystemsRefreshed = false; - m_d->goingtonextevent=true; - m_d->currentsystemrefreshing=0; - m_d->eraseJustAfterRefresh=false; - m_d->postponedUncreateAndDeleteCW=0; - m_d->refreshtimer = new QTimer(this); - m_d->splashScreenTimer = new QTimer(this); - m_d->splashScreenTimer->setSingleShot(true); - m_d->splashScreenTimer->setInterval(1000); + m_d->allSystemsRefreshed = false; + m_d->currentsystemrefreshing=0; + m_d->eraseJustAfterRefresh=false; + m_d->postponedUncreateAndDeleteCW=0; + m_d->refreshtimer = new QTimer(this); + m_d->splashScreenTimer = new QTimer(this); + m_d->splashScreenTimer->setSingleShot(true); + m_d->splashScreenTimer->setInterval(1000); - connect(m_d->refreshtimer, SIGNAL(timeout()), this, SLOT(processSystemForRefresh())); - - connect(m_d->splashScreenTimer, SIGNAL(timeout()), m_d->mainwindow, SLOT(quickSetupTriggered())); - //Connect signals to ensure that prioritiser knows about present channels and their visibility: - connect(m_d->mainwindow->channelManager(),SIGNAL(newChannelCreated(IVP1ChannelWidget*)),m_d->prioritiser, SLOT(channelCreated(IVP1ChannelWidget*))); - connect(m_d->mainwindow->channelManager(),SIGNAL(channelUncreated(IVP1ChannelWidget*)),m_d->prioritiser, SLOT(channelUncreated(IVP1ChannelWidget*))); - connect(m_d->mainwindow->channelManager(),SIGNAL(newChannelCreated(IVP1ChannelWidget*)),this, SLOT(channelCreated(IVP1ChannelWidget*))); - connect(m_d->mainwindow->channelManager(),SIGNAL(channelUncreated(IVP1ChannelWidget*)),this, SLOT(channelUncreated(IVP1ChannelWidget*))); + connect(m_d->refreshtimer, SIGNAL(timeout()), this, SLOT(processSystemForRefresh())); - connect(m_d->mainwindow->tabManager(),SIGNAL(visibleChannelsChanged(const QSet<IVP1ChannelWidget*>&,const QSet<IVP1ChannelWidget*>&,const double&)), - m_d->prioritiser,SLOT(visibleChannelsChanged(const QSet<IVP1ChannelWidget*>&,const QSet<IVP1ChannelWidget*>&,const double&))); + connect(m_d->splashScreenTimer, SIGNAL(timeout()), m_d->mainwindow, SLOT(quickSetupTriggered())); + //Connect signals to ensure that prioritiser knows about present channels and their visibility: + connect(m_d->mainwindow->channelManager(),SIGNAL(newChannelCreated(IVP1ChannelWidget*)),m_d->prioritiser, SLOT(channelCreated(IVP1ChannelWidget*))); + connect(m_d->mainwindow->channelManager(),SIGNAL(channelUncreated(IVP1ChannelWidget*)),m_d->prioritiser, SLOT(channelUncreated(IVP1ChannelWidget*))); + connect(m_d->mainwindow->channelManager(),SIGNAL(newChannelCreated(IVP1ChannelWidget*)),this, SLOT(channelCreated(IVP1ChannelWidget*))); + connect(m_d->mainwindow->channelManager(),SIGNAL(channelUncreated(IVP1ChannelWidget*)),this, SLOT(channelUncreated(IVP1ChannelWidget*))); + connect(m_d->mainwindow->tabManager(),SIGNAL(visibleChannelsChanged(const QSet<IVP1ChannelWidget*>&,const QSet<IVP1ChannelWidget*>&,const double&)), + m_d->prioritiser,SLOT(visibleChannelsChanged(const QSet<IVP1ChannelWidget*>&,const QSet<IVP1ChannelWidget*>&,const double&))); - // Init and show the main window of VP1 - SoQt::init( m_d->mainwindow );// SoQt::init( "VP1" ); + // Init and show the main window of VP1 + SoQt::init( m_d->mainwindow ); - m_d->mainwindow->show(); + m_d->mainwindow->show(); - m_d->pb = m_d->mainwindow->progressbar; - m_d->pbtimer = new QTimer(this); - connect(m_d->pbtimer, SIGNAL(timeout()), this, SLOT(updateProgressBarDuringRefresh())); - m_d->calctimethisevent=0; - m_d->currentrefreshsystemestimate=0; + bool checkDisplayMouseClicks = VP1QtUtils::expertSettingIsOn("general","ExpertSettings/GMEX_DISPLAY_MOUSE_CLICKS") || + VP1QtUtils::environmentVariableIsOn("GMEX_DISPLAY_MOUSE_CLICKS"); + if (checkDisplayMouseClicks) { + m_d->globalEventFilter = new Imp::GlobalEventFilter; + qApp->installEventFilter(m_d->globalEventFilter); + } else { + m_d->globalEventFilter = 0; + } - // TODO: VP1Light should work both with env vars and the "settings" file. Env vars discovered at the start of the application, should be converted to settings. - #if defined BUILDVP1LIGHT - bool checkDisplayMouseClicks = VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_DISPLAY_MOUSE_CLICKS"); - #else - bool checkDisplayMouseClicks = VP1QtUtils::environmentVariableIsOn("VP1_DISPLAY_MOUSE_CLICKS"); - #endif - if (checkDisplayMouseClicks) { - m_d->globalEventFilter = new Imp::GlobalEventFilter; - qApp->installEventFilter(m_d->globalEventFilter); - } else { - m_d->globalEventFilter = 0; - } - - - m_d->skipEvent = false; } //___________________________________________________________________ GXExecutionScheduler::~GXExecutionScheduler() { - m_d->refreshtimer->stop(); - delete m_d->mainwindow; - delete m_d->prioritiser; - delete m_d->globalEventFilter; - delete m_d; + m_d->refreshtimer->stop(); + delete m_d->mainwindow; + delete m_d->prioritiser; + delete m_d->globalEventFilter; + delete m_d; } //___________________________________________________________________ GXExecutionScheduler* GXExecutionScheduler::init() { - QCoreApplication::setOrganizationName("ATLAS"); - #if defined BUILDVP1LIGHT - QCoreApplication::setApplicationName("VP1Light"); - #else - QCoreApplication::setApplicationName("VP1"); - #endif - QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); - - - - // here we check if the main (and unique!) Qt application has been initialized already. If not we initialize it. - if (qApp) { - VP1Msg::message("GXExecutionScheduler::init ERROR: QApplication already initialized. Expect problems!!!"); - } else { - //NB: Static to avoid scope-problems: - static int argc=1; - static char execpath[] = "/some/fake/executable/vp1"; - static char *argv[2]; - // VP1Msg::messageDebug("setting argv[0]..."); - argv[0] = execpath; - // VP1Msg::messageDebug("setting argv[1]..."); - argv[1] = NULL; - // instead of using the default Qt QApplication class, - // we now use our custom inherited class where we - // reimplemented the notify() method, in order to catch - // C++ exceptions, especially while running it inside Athena. - //new QApplication(argc, argv); - new VP1QtApplication(argc, argv); - } - - GXExecutionScheduler*scheduler = new GXExecutionScheduler(0); - return scheduler; + QCoreApplication::setOrganizationName("ATLAS"); + QCoreApplication::setApplicationName("gmex"); + QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); + + + + // here we check if the main (and unique!) Qt application has been initialized already. If not we initialize it. + if (qApp) { + VP1Msg::message("GXExecutionScheduler::init ERROR: QApplication already initialized. Expect problems!!!"); + } else { + //NB: Static to avoid scope-problems: + static int argc=1; + static char execpath[] = "/some/fake/executable/vp1"; + static char *argv[2]; + // VP1Msg::messageDebug("setting argv[0]..."); + argv[0] = execpath; + // VP1Msg::messageDebug("setting argv[1]..."); + argv[1] = NULL; + // instead of using the default Qt QApplication class, + // we now use our custom inherited class where we + // reimplemented the notify() method, in order to catch + // C++ exceptions, especially while running it inside Athena. + //new QApplication(argc, argv); + new VP1QtApplication(argc, argv); + } + + GXExecutionScheduler*scheduler = new GXExecutionScheduler(0); + return scheduler; } //___________________________________________________________________ void GXExecutionScheduler::cleanup(GXExecutionScheduler*scheduler) { - #if defined BUILDVP1LIGHT - bool checkEnableInformOnEndOfJob = VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/VP1_ENABLE_INFORM_ON_END_OF_JOB"); - #else - bool checkEnableInformOnEndOfJob = VP1QtUtils::environmentVariableIsOn("VP1_ENABLE_INFORM_ON_END_OF_JOB"); - #endif - - if (checkEnableInformOnEndOfJob && ( !scheduler||!(scheduler->m_d->mainwindow->userRequestedExit()) ) ) - QMessageBox::information(0, "End of job reached",Qt::convertFromPlainText("Job about to end.\n\nThis is most" - " likely since there are no more available events to process."),QMessageBox::Ok,QMessageBox::Ok); - - if (scheduler) { - delete scheduler; -// qApp->processEvents(QEventLoop::DeferredDeletion); // Qt 4 - qApp->processEvents(); // Qt 5 - qApp->deleteLater(); // Qt 5 - - Imp::warnIfWidgetsAlive(); - VP1HelperClassBase::warnUndeletedInstances(); - - delete qApp; - SoQt::done(); - } - - - - const QString quickExitEnv("VP1_HARD_EXIT_AT_END"); - - #if defined BUILDVP1LIGHT - bool checkHardExitAtEnd = VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/"+quickExitEnv); - #else - bool checkHardExitAtEnd = VP1QtUtils::environmentVariableIsOn(quickExitEnv); - #endif - - if (checkHardExitAtEnd) { - VP1Msg::message("Hard job exit (unset "+quickExitEnv+" to disable this behaviour)."); - exit(0); - } - -} - -//___________________________________________________________________ -void GXExecutionScheduler::Imp::updateProgressBar() -{ - double remaining = prioritiser->estimateRemainingCalcTime(); - if (remaining>0.0) { - pb->setMaximum(static_cast<int>((calctimethisevent+remaining)*10.0)); - pb->setValue(static_cast<int>((calctimethisevent)*10.0)); - pb->show(); - if (!pbtimer->isActive()) - pbtimer->start(40);//25 "frames"/second. If it is good enough for TV, it is good enough for us. - } else { - calctimethisevent=0.0; - pb->hide(); - pb->reset(); - pbtimer->stop(); - } -} -//___________________________________________________________________ -void GXExecutionScheduler::updateProgressBarDuringRefresh() -{ - if (m_d->currentrefreshsystemestimate<1.0) - return; - double timing=(m_d->prioritiser->elapsedTiming_Refresh())*0.95;//The *0.95 is to give a smoother overall impression. - if (timing>m_d->currentrefreshsystemestimate) - return; - m_d->pb->setValue(static_cast<int>((m_d->calctimethisevent+timing)*10.0)); + if (scheduler) { + delete scheduler; + qApp->processEvents(); // Qt 5 + qApp->deleteLater(); // Qt 5 + + Imp::warnIfWidgetsAlive(); + VP1HelperClassBase::warnUndeletedInstances(); + + delete qApp; + SoQt::done(); + } } - //___________________________________________________________________ bool GXExecutionScheduler::interact() { - VP1Msg::messageDebug("GXExecutionScheduler::executeNewEvent()"); + VP1Msg::messageDebug("GXExecutionScheduler::executeNewEvent()"); - m_d->nextRequestedEvent=""; + assert(!m_d->refreshtimer->isActive());//fixme: -> if. - m_d->goingtonextevent = false; - m_d->calctimethisevent=0; - m_d->currentrefreshsystemestimate=0; - m_d->updateProgressBar(); - assert(!m_d->refreshtimer->isActive());//fixme: -> if. + VP1Msg::messageDebug("calling refreshtimer->start()..."); + m_d->refreshtimer->start(); + m_d->splashScreenTimer->start(); - VP1Msg::messageDebug("calling refreshtimer->start()..."); - m_d->refreshtimer->start(); - m_d->splashScreenTimer->start(); + //Flush event queue before reenabling controllers, etc.: + qApp->processEvents(); + VP1Msg::messageDebug("qApp->processEvents() called."); + //Enable various user input: + m_d->mainwindow->groupBox_channelcontrols->setEnabled(true); - //Flush event queue before reenabling controllers, etc.: - qApp->processEvents(); - VP1Msg::messageDebug("qApp->processEvents() called."); - //Enable various user input: - m_d->mainwindow->groupBox_channelcontrols->setEnabled(true); + qApp->exec(); + VP1Msg::messageDebug("Disabling user inputs..."); + //Disable various user input: + m_d->mainwindow->groupBox_channelcontrols->setEnabled(false); - { - VP1Msg::messageDebug("skipEvent: " + QString::number(m_d->skipEvent)); - if(m_d->skipEvent) { - VP1Msg::messageDebug("skipEvent"); - m_d->skipEvent=false; - // m_d->mainwindow->nextEvent(); - } - else { - VP1Msg::messageDebug("calling qApp->exec()..."); - qApp->exec();//NOTE!!! We then exit the exec() when someone pushes the "next event" button. - } - } - VP1Msg::messageDebug("Disabling user inputs..."); - //Disable various user input: - m_d->mainwindow->groupBox_channelcontrols->setEnabled(false); + if (m_d->refreshtimer->isActive()) { + m_d->refreshtimer->stop(); + } - m_d->goingtonextevent = true; + VP1Msg::messageDebug("Erasing systems..."); + assert(!m_d->currentsystemrefreshing); + foreach(IVP1System*s,m_d->prioritiser->getSystemsToEraseByPriority()) { + qApp->processEvents(QEventLoop::ExcludeUserInputEvents|QEventLoop::ExcludeSocketNotifiers); + eraseSystem(s); + } - if (m_d->refreshtimer->isActive()) { - m_d->refreshtimer->stop(); - } - m_d->pb->hide(); - m_d->pb->reset(); - m_d->pbtimer->stop(); - //Fixme: Refresh all accumulators that still needs refresh (or just have the button disabled until now) - - //Fixme: wait here until end of any active refreshing... - - VP1Msg::messageDebug("Erasing systems..."); - assert(!m_d->currentsystemrefreshing); - foreach(IVP1System*s,m_d->prioritiser->getSystemsToEraseByPriority()) { - qApp->processEvents(QEventLoop::ExcludeUserInputEvents|QEventLoop::ExcludeSocketNotifiers); - eraseSystem(s); - } - ++m_d->eventsProcessed; // we don't use Athena's tools for this, so we can use this in VP1Light as well. - VP1Msg::messageDebug("event processed. " + QString::number(m_d->eventsProcessed) + " events processed so far."); + qApp->processEvents(QEventLoop::ExcludeUserInputEvents|QEventLoop::ExcludeSocketNotifiers); - //Let channels know we are going to the next event now: - foreach(IVP1ChannelWidget*cw, m_d->mainwindow->tabManager()->allChannels()) { - cw->goingToNextEvent(); - } - qApp->processEvents(QEventLoop::ExcludeUserInputEvents|QEventLoop::ExcludeSocketNotifiers); - - - VP1Msg::messageDebug("mainwindow->mustQuit ? " + QString::number(m_d->mainwindow->mustQuit()) ); - return !m_d->mainwindow->mustQuit(); + VP1Msg::messageDebug("mainwindow->mustQuit ? " + QString::number(m_d->mainwindow->mustQuit()) ); + return !m_d->mainwindow->mustQuit(); } //___________________________________________________________________ void GXExecutionScheduler::eraseSystem(IVP1System*s) { - VP1Msg::messageDebug("GXExecutionScheduler::eraseSystem()"); + VP1Msg::messageDebug("GXExecutionScheduler::eraseSystem()"); - assert(s->state()==IVP1System::REFRESHED); - assert(!s->isRefreshing()); + assert(s->state()==IVP1System::REFRESHED); + assert(!s->isRefreshing()); - QString base = QString(s->name())+" from channel "+s->channel()->unique_name(); - m_d->mainwindow->statusBar()->showMessage( "Erasing system ["+base+"]" ); - VP1Msg::messageDebug("ERASING - " + base); + QString base = QString(s->name())+" from channel "+s->channel()->unique_name(); + m_d->mainwindow->statusBar()->showMessage( "Erasing system ["+base+"]" ); + VP1Msg::messageDebug("ERASING - " + base); - s->disallowUpdateGUI(); - s->erase();//fixme: time? - s->setState(IVP1System::ERASED); - m_d->mainwindow->statusBar()->showMessage( "Post-erase update to channel ["+base+"]" ); - s->channel()->systemErased(s);//fixme: time? - m_d->mainwindow->statusBar()->clearMessage(); + s->disallowUpdateGUI(); + s->erase();//fixme: time? + s->setState(IVP1System::ERASED); + m_d->mainwindow->statusBar()->showMessage( "Post-erase update to channel ["+base+"]" ); + s->channel()->systemErased(s);//fixme: time? + m_d->mainwindow->statusBar()->clearMessage(); } //___________________________________________________________________ void GXExecutionScheduler::systemNeedErase() { - IVP1System*s = static_cast<IVP1System*>(sender()); - assert(s); - if (m_d->currentsystemrefreshing!=s) { - eraseSystem(s); - } else { - assert(s->isRefreshing()); - m_d->eraseJustAfterRefresh=true; - } + IVP1System*s = static_cast<IVP1System*>(sender()); + assert(s); + if (m_d->currentsystemrefreshing!=s) { + eraseSystem(s); + } else { + assert(s->isRefreshing()); + m_d->eraseJustAfterRefresh=true; + } } //___________________________________________________________________ void GXExecutionScheduler::processSystemForRefresh() { - assert(!m_d->goingtonextevent); - if (m_d->currentsystemrefreshing) - return; - - IVP1System * s = m_d->prioritiser->nextErasedActiveSystemByPriority(); - if (s) { - refreshSystem(s); - } else { - assert(m_d->refreshtimer->isActive());//fixme: -> if. ??? - //if (refreshtimer->isActive()) - m_d->refreshtimer->stop(); - m_d->pb->hide(); - m_d->pb->reset(); - m_d->pbtimer->stop(); - } + if (m_d->currentsystemrefreshing) + return; + + IVP1System * s = m_d->prioritiser->nextErasedActiveSystemByPriority(); + if (s) { + refreshSystem(s); + } else { + assert(m_d->refreshtimer->isActive());//fixme: -> if. ??? + //if (refreshtimer->isActive()) + m_d->refreshtimer->stop(); + } } //___________________________________________________________________ void GXExecutionScheduler::channelCreated(IVP1ChannelWidget* cw) { - std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); - for (it=cw->systems().begin();it!=itE;++it) { - qInfo() << "System name:" << (*it)->name(); - connect(*it,SIGNAL(inactiveSystemTurnedActive()),this,SLOT(startRefreshQueueIfAppropriate())); - connect(*it,SIGNAL(needErase()),this,SLOT(systemNeedErase())); - #ifdef BUILDVP1LIGHT - connect(*it,SIGNAL(signalLoadEvent(IVP1System*)),this,SLOT(passEvent(IVP1System*))); - #endif // BUILDVP1LIGHT - } - startRefreshQueueIfAppropriate(); + std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); + for (it=cw->systems().begin();it!=itE;++it) { + qInfo() << "System name:" << (*it)->name(); + connect(*it,SIGNAL(inactiveSystemTurnedActive()),this,SLOT(startRefreshQueueIfAppropriate())); + connect(*it,SIGNAL(needErase()),this,SLOT(systemNeedErase())); +#ifdef BUILDVP1LIGHT + connect(*it,SIGNAL(signalLoadEvent(IVP1System*)),this,SLOT(passEvent(IVP1System*))); +#endif // BUILDVP1LIGHT + } + startRefreshQueueIfAppropriate(); } //___________________________________________________________________ void GXExecutionScheduler::channelUncreated(IVP1ChannelWidget* cw) { - std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); - for (it=cw->systems().begin();it!=itE;++it) - disconnect(*it,SIGNAL(inactiveSystemTurnedActive()),this,SLOT(startRefreshQueueIfAppropriate())); + std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); + for (it=cw->systems().begin();it!=itE;++it) + disconnect(*it,SIGNAL(inactiveSystemTurnedActive()),this,SLOT(startRefreshQueueIfAppropriate())); } //___________________________________________________________________ void GXExecutionScheduler::startRefreshQueueIfAppropriate() { - if (!m_d->goingtonextevent&&!m_d->refreshtimer->isActive()) - m_d->refreshtimer->start(); + if (!m_d->refreshtimer->isActive()) m_d->refreshtimer->start(); } //___________________________________________________________________ bool GXExecutionScheduler::isRefreshing() const { - return m_d->currentsystemrefreshing; + return m_d->currentsystemrefreshing; } //___________________________________________________________________ void GXExecutionScheduler::refreshSystem(IVP1System*s) { - QString sysname = s->name(); - VP1Msg::messageDebug("GXExecutionScheduler::refreshSystem() - system: " + sysname); - - m_d->updateProgressBar(); - - assert(s->state()==IVP1System::ERASED); - assert(s->activeState()==IVP1System::ON); - assert(!m_d->currentsystemrefreshing); - - m_d->currentrefreshsystemestimate = m_d->prioritiser->beginTiming_Refresh(s); - m_d->currentsystemrefreshing = s; - - QString base = QString(s->name())+" from channel "+s->channel()->unique_name(); - m_d->mainwindow->statusBar()->showMessage( "Refreshing system ["+base+"]" ); - - s->allowUpdateGUI(); - s->setRefreshing(true); - refreshingStatusChanged(true); - s->channel()->emitRefreshInfoChanged(); - s->refresh(VP1AthenaPtrs::eventStore()); - s->setState(IVP1System::REFRESHED); - s->setRefreshing(false); - s->disallowUpdateGUI(); - - m_d->mainwindow->statusBar()->showMessage( "Post-refresh update to channel ["+base+"]" ); - s->channel()->systemRefreshed(s);//fixme: time independently? + QString sysname = s->name(); + VP1Msg::messageDebug("GXExecutionScheduler::refreshSystem() - system: " + sysname); - m_d->mainwindow->statusBar()->clearMessage(); - m_d->currentsystemrefreshing = 0; - m_d->calctimethisevent += m_d->prioritiser->endTiming_Refresh(); - m_d->currentrefreshsystemestimate=0; - m_d->updateProgressBar(); + assert(s->state()==IVP1System::ERASED); + assert(s->activeState()==IVP1System::ON); + assert(!m_d->currentsystemrefreshing); - refreshingStatusChanged(false); - s->channel()->emitRefreshInfoChanged(); + m_d->currentsystemrefreshing = s; - VP1Msg::messageDebug("checking if all systems have refreshed..."); - if (hasAllActiveSystemsRefreshed(s->channel())) { + QString base = QString(s->name())+" from channel "+s->channel()->unique_name(); + m_d->mainwindow->statusBar()->showMessage( "Refreshing system ["+base+"]" ); - VP1Msg::messageDebug("All systems refreshed! - last system refreshed! - system: " + sysname); - s->channel()->lastOfActiveSystemsRefreshed(); + s->allowUpdateGUI(); + s->setRefreshing(true); + refreshingStatusChanged(true); + s->channel()->emitRefreshInfoChanged(); + s->refresh(VP1AthenaPtrs::eventStore()); + s->setState(IVP1System::REFRESHED); + s->setRefreshing(false); + s->disallowUpdateGUI(); - m_d->allSystemsRefreshed = true; // check if that is fine for multiple channels window: i.e. VP1 instances with a couple of 3DCkocktail windows, for example. + m_d->mainwindow->statusBar()->showMessage( "Post-refresh update to channel ["+base+"]" ); + s->channel()->systemRefreshed(s);//fixme: time independently? - } // end of hasAllActiveSystemsRefreshed() - - - if (m_d->eraseJustAfterRefresh) { - //Someone asked to erase the system while it was refreshing! - m_d->eraseJustAfterRefresh=false; - //Check that it still needs to (maybe it was flicked back to ON by the impatient user) - if (s->activeState()==IVP1System::OFF) - eraseSystem(s); - } - if (m_d->postponedUncreateAndDeleteCW) { - actualUncreateAndDelete(m_d->postponedUncreateAndDeleteCW); - m_d->postponedUncreateAndDeleteCW=0; - } - - VP1Msg::messageDebug("end of refreshing the system: " + sysname); - -} - -//___________________________________________________________________ -QString GXExecutionScheduler::saveSnaphsotToFile(IVP1System* s, bool batch) -{ - QString chnlname = s->name().toLower(); - VP1Msg::messageDebug("GXExecutionScheduler::saveSnaphsotToFile() - taking the snapshot of the channel " + chnlname ); - - QString currentsaveimagepath = VP1Settings::defaultFileSelectDirectory() + QDir::separator(); - - - if (batch) { - - VP1Msg::messageDebug("Note: 'batch-mode'"); - - - // A FOLDER CONTAINER - QString folderName = ""; - - // check if use specified an output folder for the batch job - QString batchOutFolder = VP1QtUtils::environmentVariableValue("VP1_BATCHMODE_OUT_FOLDER"); // ::getenv("VP1_BATCHMODE"); - if ( ! (batchOutFolder == "") ) { - VP1Msg::messageDebug("Setting 'batch' output folder from user's settings"); - folderName = batchOutFolder; - } - else - folderName = "atlas_vp1_batch_images"; - - // check if the folder already exists, if not make a new folder - QDir dir(folderName); - if (!dir.exists()) { - dir.mkpath("."); - } - - QString folder; - if (folderName.startsWith("/")) - folder = folderName + QDir::separator(); - else - folder = currentsaveimagepath + folderName + QDir::separator(); - - VP1Msg::messageDebug("folder set: " + folder); - - - // EVENT INFO AND TIMESTAMP - - //QString evtimestamp = QString::number(m_d->mainwindow->getEventTimestamp()); - - //time_t t_evttimestamp = m_d->mainwindow->getEventTimestamp(); - //tm * human_evtimestamp = localtime(&t_evttimestamp); - - //std::ostringstream h_evtimestamp_ostri; - //h_evtimestamp_ostri << 1900 + human_evtimestamp->tm_year - // << "-" << 1 + human_evtimestamp->tm_mon // tm_mon is in the range [0, 11], so 1 must be added to get real months - // << "-" << human_evtimestamp->tm_mday - // << "T" << human_evtimestamp->tm_hour << "-" << human_evtimestamp->tm_min << "-" << human_evtimestamp->tm_sec << "CEST"; - - //std::string h_evtimestamp_str = h_evtimestamp_ostri.str(); - //QString h_evtimestamp = QString::fromStdString(h_evtimestamp_str); - - // IMAGE TIMESTAMP - - time_t t_timestamp = time(0); // get time now; - tm *ltm = localtime(&t_timestamp); - - // print various components of tm structure. - VP1Msg::messageDebug( "Year: "+ QString::number(1900 + ltm->tm_year) - + " - " + "Month: " + QString::number(1 + ltm->tm_mon) + " - " // tm_mon is in the range [0, 11], so 1 must be added to get real months - + "Day: " + QString::number(ltm->tm_mday) - + " - " "Time: " + QString::number(ltm->tm_hour) + ":" + QString::number(ltm->tm_min) + ":" + QString::number(ltm->tm_sec) + "CEST"); - - std::ostringstream ostri_unix; - ostri_unix << t_timestamp; + m_d->mainwindow->statusBar()->clearMessage(); + m_d->currentsystemrefreshing = 0; + + refreshingStatusChanged(false); + s->channel()->emitRefreshInfoChanged(); - std::ostringstream ostri; - ostri << 1900 + ltm->tm_year - << "-" << 1 + ltm->tm_mon // tm_mon is in the range [0, 11], so 1 must be added to get real months - << "-" << ltm->tm_mday - << "T" << ltm->tm_hour << "-" << ltm->tm_min << "-" << ltm->tm_sec << "CEST"; + VP1Msg::messageDebug("checking if all systems have refreshed..."); + if (hasAllActiveSystemsRefreshed(s->channel())) { - std::string unixTimestamp = ostri_unix.str(); - std::string humanTimestamp = ostri.str(); - QString q_unixTimestamp = QString::fromStdString(unixTimestamp); - QString q_humanTimestamp = QString::fromStdString(humanTimestamp); - VP1Msg::messageDebug("Unix timestamp: " + q_unixTimestamp ); - VP1Msg::messageDebug("'human readable' timestamp: " + q_humanTimestamp ); + VP1Msg::messageDebug("All systems refreshed! - last system refreshed! - system: " + sysname); + s->channel()->lastOfActiveSystemsRefreshed(); - /* channel's name is the name of the last channel updated by the executer, - * i.e. the name changes according to the order the channels are refreshed. - * Thus, we don't use the channel's name in the filename, - * because it could be misleading. - */ - //QString filename = currentsaveimagepath + "vp1_" + chnlname + "_snapshot_" + q_humanTimestamp + ".png"; - QString filename = folder + "gmex_batch_snapshotimgtime_H" + q_humanTimestamp + "_U" + q_unixTimestamp + ".png"; + m_d->allSystemsRefreshed = true; // check if that is fine for multiple channels window: i.e. VP1 instances with a couple of 3DCkocktail windows, for example. - // taking the actual snapshot - QPixmap pm = s->channel()->getSnapshot(); - if (pm.isNull()) { - VP1Msg::messageDebug("QPixmap is null! returning..."); - return QString(); - } + } // end of hasAllActiveSystemsRefreshed() - // saving to file - pm.save(filename); - // save last-saved image filename to working dir - QString latestImageFileName = currentsaveimagepath + QString("latest_vp1image"); - QFile latestImage(latestImageFileName); - if(latestImage.exists() && !latestImage.remove()) - throw std::runtime_error("Unable to overwrite the existing latest image file"); - if(!latestImage.open(QIODevice::WriteOnly | QIODevice::Text)) - throw std::runtime_error("Unable to create new latest image file"); - latestImage.write(filename.toStdString().c_str()); - latestImage.close(); - - - return filename; - } + if (m_d->eraseJustAfterRefresh) { + //Someone asked to erase the system while it was refreshing! + m_d->eraseJustAfterRefresh=false; + //Check that it still needs to (maybe it was flicked back to ON by the impatient user) + if (s->activeState()==IVP1System::OFF) + eraseSystem(s); + } + if (m_d->postponedUncreateAndDeleteCW) { + actualUncreateAndDelete(m_d->postponedUncreateAndDeleteCW); + m_d->postponedUncreateAndDeleteCW=0; + } - // default exit - return QString();//filename; + VP1Msg::messageDebug("end of refreshing the system: " + sysname); } - //___________________________________________________________________ void GXExecutionScheduler::bringFromConstructedToReady(IVP1ChannelWidget*cw) { - assert(cw->state()==IVP1ChannelWidget::CONSTRUCTED); - - connect(cw,SIGNAL(message(const QString&)),m_d->mainwindow,SLOT(channelAddToMessageBox(const QString&))); - - std::set<IVP1System *>::iterator itsys, itsysE = cw->systems().end(); - for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { - assert((*itsys)->state()==IVP1System::CONSTRUCTED); - connect((*itsys),SIGNAL(sysmessage(const QString&)),m_d->mainwindow,SLOT(systemAddToMessageBox(const QString&))); - } - itsysE = cw->systems().end(); - for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { - (*itsys)->setCanRegisterController(true); - (*itsys)->create(VP1AthenaPtrs::detectorStore()); - (*itsys)->setCanRegisterController(false); - (*itsys)->setState(IVP1System::ERASED); - } - assert(cw->state()==IVP1ChannelWidget::CONSTRUCTED); - cw->setCanRegister(true,false);//Ok to register controllers during create. - cw->create(); - cw->setCanRegister(false,false); - cw->setState(IVP1ChannelWidget::READY); - - assert(cw->state()==IVP1ChannelWidget::READY); - //Fixme: statusbar!!!!! + assert(cw->state()==IVP1ChannelWidget::CONSTRUCTED); + + connect(cw,SIGNAL(message(const QString&)),m_d->mainwindow,SLOT(channelAddToMessageBox(const QString&))); + + std::set<IVP1System *>::iterator itsys, itsysE = cw->systems().end(); + for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { + assert((*itsys)->state()==IVP1System::CONSTRUCTED); + connect((*itsys),SIGNAL(sysmessage(const QString&)),m_d->mainwindow,SLOT(systemAddToMessageBox(const QString&))); + } + itsysE = cw->systems().end(); + for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { + (*itsys)->setCanRegisterController(true); + (*itsys)->create(VP1AthenaPtrs::detectorStore()); + (*itsys)->setCanRegisterController(false); + (*itsys)->setState(IVP1System::ERASED); + } + assert(cw->state()==IVP1ChannelWidget::CONSTRUCTED); + cw->setCanRegister(true,false);//Ok to register controllers during create. + cw->create(); + cw->setCanRegister(false,false); + cw->setState(IVP1ChannelWidget::READY); + + assert(cw->state()==IVP1ChannelWidget::READY); + //Fixme: statusbar!!!!! } //___________________________________________________________________ void GXExecutionScheduler::uncreateAndDelete(IVP1ChannelWidget*cw) { - assert(cw->state()==IVP1ChannelWidget::READY); - if (m_d->currentsystemrefreshing&&cw->systems().find(m_d->currentsystemrefreshing)!=cw->systems().end()) { - assert(!m_d->postponedUncreateAndDeleteCW); - m_d->postponedUncreateAndDeleteCW=cw; - } else { - actualUncreateAndDelete(cw); - } + assert(cw->state()==IVP1ChannelWidget::READY); + if (m_d->currentsystemrefreshing&&cw->systems().find(m_d->currentsystemrefreshing)!=cw->systems().end()) { + assert(!m_d->postponedUncreateAndDeleteCW); + m_d->postponedUncreateAndDeleteCW=cw; + } else { + actualUncreateAndDelete(cw); + } } //___________________________________________________________________ void GXExecutionScheduler::actualUncreateAndDelete(IVP1ChannelWidget*cw) { - assert(cw->state()==IVP1ChannelWidget::READY); - cw->setUpdatesEnabled(false);//Just because... - - //From this point on, we are not interested in signals from the channel (and its systems) that could disturb us: - std::set<IVP1System *>::iterator itsys, itsysE = cw->systems().end(); - for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { - (*itsys)->blockSignals(true); - disconnect(*itsys,0,0,0); - } - cw->blockSignals(true); - disconnect(cw,0,0,0); - - //Make sure that all systems gets in the ERASED state. Throw assert if any is presently refreshing (BAD PROGRAMMER!!) - for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { - assert(m_d->currentsystemrefreshing!=(*itsys)); - if ((*itsys)->state()==IVP1System::REFRESHED) - eraseSystem(*itsys); - } - - //Uncreate systems: - for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { - assert((*itsys)->state()==IVP1System::ERASED); - (*itsys)->uncreate(); - (*itsys)->setState(IVP1System::UNCREATED); - } - - //Uncreate channel: - assert(cw->state()==IVP1ChannelWidget::READY); - cw->uncreate();//Fixme: Return codes!! - cw->setState(IVP1ChannelWidget::UNCREATED); - - assert(cw->state()==IVP1ChannelWidget::UNCREATED); - - cw->deleteControllers();//Also deletes system controllers. - - //Delete: - cw->deleteLater(); + assert(cw->state()==IVP1ChannelWidget::READY); + cw->setUpdatesEnabled(false);//Just because... + + //From this point on, we are not interested in signals from the channel (and its systems) that could disturb us: + std::set<IVP1System *>::iterator itsys, itsysE = cw->systems().end(); + for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { + (*itsys)->blockSignals(true); + disconnect(*itsys,0,0,0); + } + cw->blockSignals(true); + disconnect(cw,0,0,0); + + //Make sure that all systems gets in the ERASED state. Throw assert if any is presently refreshing (BAD PROGRAMMER!!) + for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { + assert(m_d->currentsystemrefreshing!=(*itsys)); + if ((*itsys)->state()==IVP1System::REFRESHED) + eraseSystem(*itsys); + } + + //Uncreate systems: + for (itsys = cw->systems().begin();itsys!=itsysE;++itsys) { + assert((*itsys)->state()==IVP1System::ERASED); + (*itsys)->uncreate(); + (*itsys)->setState(IVP1System::UNCREATED); + } + + //Uncreate channel: + assert(cw->state()==IVP1ChannelWidget::READY); + cw->uncreate();//Fixme: Return codes!! + cw->setState(IVP1ChannelWidget::UNCREATED); + + assert(cw->state()==IVP1ChannelWidget::UNCREATED); + + cw->deleteControllers();//Also deletes system controllers. + + //Delete: + cw->deleteLater(); } @@ -888,81 +586,76 @@ void GXExecutionScheduler::actualUncreateAndDelete(IVP1ChannelWidget*cw) void GXExecutionScheduler::Imp::warnIfWidgetsAlive() { QSet<QWidget*> w_ignore, wl(QApplication::allWidgets().begin(), QApplication::allWidgets().end());// = QApplication::allWidgets().toSet(); - //w_ignore<<qApp->desktop(); - foreach (QObject*o,qApp->children()) { - if (o->isWidgetType()) - w_ignore << static_cast<QWidget*>(o); - } - foreach (QWidget * w, wl) { - if (w->objectName().startsWith("internal clipboard")) - w_ignore << w; - if (w->objectName()=="empty_widget") - w_ignore << w; - } - wl.subtract(w_ignore); - if (!wl.empty()) { - std::cout<<std::endl; - std::cout<<"VP1 WARNING: "<<wl.count()<< " widget"<<(wl.count()>1?"s":"")<<" left at end of job:"<<std::endl; - int i(0); - foreach(QWidget*w,wl) { - std::cout<<++i<<") Address="<<w<<", ObjectName="<<w->objectName().toStdString()<<", ClassName="<<w->metaObject()->className()<<std::endl; - } - std::cout<<std::endl; - } + //w_ignore<<qApp->desktop(); + foreach (QObject*o,qApp->children()) { + if (o->isWidgetType()) + w_ignore << static_cast<QWidget*>(o); + } + foreach (QWidget * w, wl) { + if (w->objectName().startsWith("internal clipboard")) + w_ignore << w; + if (w->objectName()=="empty_widget") + w_ignore << w; + } + wl.subtract(w_ignore); + if (!wl.empty()) { + std::cout<<std::endl; + std::cout<<"VP1 WARNING: "<<wl.count()<< " widget"<<(wl.count()>1?"s":"")<<" left at end of job:"<<std::endl; + int i(0); + foreach(QWidget*w,wl) { + std::cout<<++i<<") Address="<<w<<", ObjectName="<<w->objectName().toStdString()<<", ClassName="<<w->metaObject()->className()<<std::endl; + } + std::cout<<std::endl; + } } //___________________________________________________________________ bool GXExecutionScheduler::hasAllActiveSystemsRefreshed( IVP1ChannelWidget* cw ) const { - VP1Msg::messageDebug("GXExecutionScheduler::hasAllActiveSystemsRefreshed() - channelWidget: " + cw->name()); - - std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); - int i=0; - for (it=cw->systems().begin();it!=itE;++it) { - - /* - * enum State { CONSTRUCTED=0, REFRESHED, ERASED, UNCREATED }; - * enum ActiveState { ON=0, OFF };//Whether it is part of the erase/refresh cycle. - */ - if (VP1Msg::verbose()) { - QString name = QString((*it)->name()); - QString active = QString::number((*it)->activeState()); - QString state = QString::number((*it)->state()); - std::cout << i << " - name: " << name.toStdString() << " - active: " << active.toStdString() << " - refreshed: " << state.toStdString() << std::endl; - } - if ((*it)->activeState()==IVP1System::ON&&(*it)->state()!=IVP1System::REFRESHED) - return false; - - i++; - } - - return true; + VP1Msg::messageDebug("GXExecutionScheduler::hasAllActiveSystemsRefreshed() - channelWidget: " + cw->name()); + + std::set<IVP1System*>::const_iterator it, itE = cw->systems().end(); + int i=0; + for (it=cw->systems().begin();it!=itE;++it) { + + /* + * enum State { CONSTRUCTED=0, REFRESHED, ERASED, UNCREATED }; + * enum ActiveState { ON=0, OFF };//Whether it is part of the erase/refresh cycle. + */ + if (VP1Msg::verbose()) { + QString name = QString((*it)->name()); + QString active = QString::number((*it)->activeState()); + QString state = QString::number((*it)->state()); + std::cout << i << " - name: " << name.toStdString() << " - active: " << active.toStdString() << " - refreshed: " << state.toStdString() << std::endl; + } + if ((*it)->activeState()==IVP1System::ON&&(*it)->state()!=IVP1System::REFRESHED) + return false; + + i++; + } + + return true; } //___________________________________________________________________ bool GXExecutionScheduler::Imp::allVisibleRefreshed() const { - foreach(IVP1ChannelWidget*cw,mainwindow->tabManager()->visibleChannels()) - if (!scheduler->hasAllActiveSystemsRefreshed(cw)) - return false; - return true; + foreach(IVP1ChannelWidget*cw,mainwindow->tabManager()->visibleChannels()) + if (!scheduler->hasAllActiveSystemsRefreshed(cw)) + return false; + return true; } //___________________________________________________________________ bool GXExecutionScheduler::Imp::allSoonVisibleRefreshed() const { - foreach(IVP1ChannelWidget*cw,mainwindow->tabManager()->soonVisibleChannels()) - if (!scheduler->hasAllActiveSystemsRefreshed(cw)) - return false; - return true; + foreach(IVP1ChannelWidget*cw,mainwindow->tabManager()->soonVisibleChannels()) + if (!scheduler->hasAllActiveSystemsRefreshed(cw)) + return false; + return true; } -//___________________________________________________________________ -QStringList GXExecutionScheduler::userRequestedFiles() -{ - return m_d->mainwindow->userRequestedFiles(); -} diff --git a/GeoModelVisualization/VP1Gui/src/GXMainWindow.cxx b/GeoModelVisualization/VP1Gui/src/GXMainWindow.cxx index 78ac78f3479f87ee18f9b4cefc04d2cc87bb33d7..3ba30ae6cbbcdeff57e972c437eb376c49df13d7 100644 --- a/GeoModelVisualization/VP1Gui/src/GXMainWindow.cxx +++ b/GeoModelVisualization/VP1Gui/src/GXMainWindow.cxx @@ -219,13 +219,6 @@ GXMainWindow::GXMainWindow(GXExecutionScheduler*sched,QWidget * parent) connect(m_actionAdd_empty_tab,SIGNAL(triggered(bool)),this,SLOT(request_addEmptyTab())); connect(m_actionSave_current_tabs,SIGNAL(triggered(bool)),this,SLOT(request_saveasConfig())); - //ExpertSettings - #ifdef BUILDVP1LIGHT - menuConfiguration->addSeparator(); - m_actionEnableExpertSettings = menuConfiguration->addAction ( "&Settings" ); - m_actionEnableExpertSettings->setStatusTip("Open additional settings"); - connect(m_actionEnableExpertSettings, &QAction::triggered, this, &GXMainWindow::request_expertSettings); - #endif // Help menu QMenu* menu_help = new QMenu(menubar); @@ -526,15 +519,6 @@ QMap<QString,QString> GXMainWindow::availableFiles(const QString& extension, qDebug() << "vp1pluginpath A :" << vp1pluginpath; } - #ifdef BUILDVP1LIGHT - //Add dir from Expert Settings - if(VP1QtUtils::expertSettingValue("expert","ExpertSettings/GXPLUGINPATH")==""){ - vp1pluginpath<<QCoreApplication::applicationDirPath()+"/../lib"; - } else{ - vp1pluginpath<<VP1QtUtils::expertSettingValue("expert","ExpertSettings/GXPLUGINPATH"); - } - #endif - //Currentdir: if (currentdir) { vp1pluginpath<<QDir::currentPath(); @@ -646,26 +630,6 @@ void GXMainWindow::closeEvent(QCloseEvent * event) { VP1Msg::messageDebug("GXMainWindow::closeEvent()"); - bool checkEnableAskOnClose; - #if defined BUILDVP1LIGHT - checkEnableAskOnClose = VP1QtUtils::expertSettingIsSet("general","ExpertSettings/VP1_ENABLE_ASK_ON_CLOSE"); - #else - checkEnableAskOnClose = VP1QtUtils::environmentVariableIsOn("VP1_ENABLE_ASK_ON_CLOSE"); - #endif - - if (checkEnableAskOnClose) { - int ret = QMessageBox::warning(this, - "Close VP1?", - "You are about to close VP1 and end the job.\nProceed?", - QMessageBox::Ok| QMessageBox::Cancel, - QMessageBox::Cancel ); - if (ret!=QMessageBox::Ok) { - event->ignore(); - return; - } - m_userRequestedExit = true; - } - hide(); VP1Msg::messageDebug("calling tabmanager->setSelectedDockWidget(0)..."); @@ -1247,7 +1211,7 @@ void GXMainWindow::quickSetupTriggered() { VP1Msg::messageVerbose("GXMainWindow::quickSetupTriggered()"); - QSettings settings("ATLAS", "VP1Light"); + QSettings settings("ATLAS", "gmex"); QString plugfile, channelname, tabname; @@ -1359,11 +1323,3 @@ QStringList GXMainWindow::userRequestedFiles() return returnval; } -//_________________________________________________________________________________ -#ifdef BUILDVP1LIGHT -void GXMainWindow::request_expertSettings(){ - VP1ExpertSettings es; - es.exec(); -} - -#endif // BUILDVP1LIGHT diff --git a/GeoModelVisualization/VP1Gui/src/VP1ExpertSettings.cxx b/GeoModelVisualization/VP1Gui/src/VP1ExpertSettings.cxx deleted file mode 100644 index 214d842b0f64c41a11c36cd4d463f59ef792694c..0000000000000000000000000000000000000000 --- a/GeoModelVisualization/VP1Gui/src/VP1ExpertSettings.cxx +++ /dev/null @@ -1,551 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////////////////////////// -// // -// Source file for class VP1ExpertSettings // -// // -// Description: Additional VP1 settings // -// // -// Author: Sebastian Andreas Merkt (sebastian.andreas.merkt@cern.ch) // -// Initial version: August 2017 // -// // -////////////////////////////////////////////////////////////////////////// - -#include "VP1Gui/VP1ExpertSettings.h" -#include "VP1Base/VP1QtUtils.h" -#include "VP1Base/VP1Msg.h" - -#include <QPushButton> -#include <QGridLayout> -#include <QLabel> -#include <QComboBox> -#include <QCheckBox> -#include <QDir> -#include <QKeyEvent> - -#include <QtWidgets> - - -template <typename... Args> inline void unused(Args&&...) {} // to declare variables as 'unused' - - - -VP1ExpertSettings::VP1ExpertSettings(QWidget *parent) : QDialog(parent) -{ - - m_tabWidget = new QTabWidget; - GeneralTab *generalTab = new GeneralTab(); - AdvancedTab *advancedTab = new AdvancedTab(); - m_tabWidget->addTab(generalTab, tr("Settings")); - connect(generalTab, &GeneralTab::signalScreenshotDirChanged, this, &VP1ExpertSettings::setScreenshotDir); - - #if defined BUILDVP1LIGHT - QString pluginPath=VP1QtUtils::expertSettingValue("expert","ExpertSettings/GXPLUGINPATH"); - QString fileSelectDir=VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1_FILESELECTDIR"); - QString screenshotDir=VP1QtUtils::expertSettingValue("general","ExpertSettings/VP1_SCREENSHOTS_DIR"); - QString authLog=VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1_AUTH_ENABLELOG"); - - if(VP1QtUtils::expertSettingIsOn("general", "ExpertSettings/enableExpertSettings")){ - m_tabWidget->addTab(advancedTab, tr("Advanced")); - connect(advancedTab, &AdvancedTab::signalPluginPathChanged, this, &VP1ExpertSettings::setPluginPath); - connect(advancedTab, &AdvancedTab::signalFileSelectDirChanged, this, &VP1ExpertSettings::setFileSelectDir); - connect(advancedTab, &AdvancedTab::signalAuthLogChanged, this, &VP1ExpertSettings::setAuthLog); - } - #else - QString pluginPath=VP1QtUtils::environmentVariableValue("GXPLUGINPATH"); - QString fileSelectDir=VP1QtUtils::environmentVariableValue("VP1_FILESELECTDIR"); - QString screenshotDir=VP1QtUtils::environmentVariableValue("VP1_SCREENSHOTS_DIR"); - QString authLog=VP1QtUtils::environmentVariableValue("VP1_AUTH_ENABLELOG"); - - // Always enable Advanced settings for VP1 - m_tabWidget->addTab(advancedTab, tr("Advanced")); - connect(advancedTab, &AdvancedTab::signalPluginPathChanged, this, &VP1ExpertSettings::setPluginPath); - connect(advancedTab, &AdvancedTab::signalFileSelectDirChanged, this, &VP1ExpertSettings::setFileSelectDir); - connect(advancedTab, &AdvancedTab::signalAuthLogChanged, this, &VP1ExpertSettings::setAuthLog); - #endif - - m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); - - connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::close); - // connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(m_tabWidget); - mainLayout->addWidget(m_buttonBox); - setLayout(mainLayout); - - this->setWindowTitle(tr("VP1 Settings")); - - -} - -void VP1ExpertSettings::closeEvent(QCloseEvent *event) -{ - //Update settings - #if defined BUILDVP1LIGHT - VP1Msg::enableMsg("general", "ExpertSettings/VP1_VERBOSE_OUTPUT"); - VP1Msg::enableMsg("general", "ExpertSettings/VP1_DEBUG_OUTPUT"); - #else - VP1Msg::enableMsg("VP1_VERBOSE_OUTPUT"); - VP1Msg::enableMsg("VP1_DEBUG_OUTPUT"); - #endif - - // if(QDir(pluginPath).exists()||pluginPath==""){ - #if defined BUILDVP1LIGHT - VP1QtUtils::setExpertSetting("expert","ExpertSettings/GXPLUGINPATH", m_pluginPath); - VP1QtUtils::setExpertSetting("expert","ExpertSettings/VP1_FILESELECTDIR", m_fileSelectDir); - VP1QtUtils::setExpertSetting("expert","ExpertSettings/VP1_AUTH_ENABLELOG", m_authLog); - VP1QtUtils::setExpertSetting("general","ExpertSettings/VP1_SCREENSHOTS_DIR", m_screenshotDir); - #else - VP1QtUtils::setEnvironmentVariable("GXPLUGINPATH", m_pluginPath); - VP1QtUtils::setEnvironmentVariable("VP1_FILESELECTDIR", m_fileSelectDir); - VP1QtUtils::setEnvironmentVariable("VP1_AUTH_ENABLELOG", m_authLog); - VP1QtUtils::setEnvironmentVariable("VP1_SCREENSHOTS_DIR", m_screenshotDir); - #endif - - #if defined BUILDVP1LIGHT - QMessageBox msgBox; - QCheckBox *cb = new QCheckBox("Don't ask again."); - msgBox.setWindowTitle("Settings"); - msgBox.setText("Some settings may require a restart of VP1."); - msgBox.setIcon(QMessageBox::Icon::Information); - msgBox.setCheckBox(cb); - - if(VP1QtUtils::expertSettingIsOn("general","Configuration/enableCloseSettingsReminder")){ - cb->setChecked(true); - } - connect(cb, &QCheckBox::toggled, [this](){VP1ExpertSettings::setExpertSetting("general","Configuration/enableCloseSettingsReminder");}); - - if(cb->checkState()==Qt::Unchecked){ - msgBox.exec(); - } - - event->accept(); - #else - unused(event); - #endif - - -} - -void VP1ExpertSettings::keyPressEvent(QKeyEvent *event){ - if(event->key() == Qt::Key_Escape) - VP1ExpertSettings::close(); -} - -void VP1ExpertSettings::setPluginPath(const QString &path){ - m_pluginPath = path; -} - -void VP1ExpertSettings::setFileSelectDir(const QString &path){ - m_fileSelectDir = path; -} - -void VP1ExpertSettings::setScreenshotDir(const QString &path){ - m_screenshotDir = path; -} - -void VP1ExpertSettings::setAuthLog(const QString &path){ - m_authLog = path; -} - -void VP1ExpertSettings::setExpertSetting(const QString &type, const QString &name){ - if(!VP1QtUtils::expertSettingIsOn(type, name)){ - VP1QtUtils::setExpertSetting(type, name, "1"); - } else { - VP1QtUtils::setExpertSetting(type, name, ""); - } -} - -GeneralTab::GeneralTab(QWidget *parent) - : QWidget(parent) -{ - - QGroupBox *generalGroup = new QGroupBox(tr("General settings")); - - m_checkboxVerbose = new QCheckBox("&Verbose output", this); - m_checkboxVerbose->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Enable A LOT more verbose output to stdout from VP1. It is very useful if you run with this before sending us logfiles for bug reports.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_VERBOSE_OUTPUT")){ - m_checkboxVerbose->setChecked(true); - } - connect(m_checkboxVerbose, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_VERBOSE_OUTPUT");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_VERBOSE_OUTPUT")){ - m_checkboxVerbose->setChecked(true); - } - connect(m_checkboxVerbose, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_VERBOSE_OUTPUT");}); - #endif - - m_checkboxDebug = new QCheckBox("&Debug output", this); - m_checkboxDebug->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Enable A LOT more debug output to stdout from VP1. It is very useful if you run with this before sending us logfiles for bug reports.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_DEBUG_OUTPUT")){ - m_checkboxDebug->setChecked(true); - } - connect(m_checkboxDebug, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_DEBUG_OUTPUT");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_DEBUG_OUTPUT")){ - m_checkboxDebug->setChecked(true); - } - connect(m_checkboxDebug, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_DEBUG_OUTPUT");}); - #endif - - m_checkboxDisallowMultipleChannels = new QCheckBox("D&isallow multiple channels", this); - m_checkboxDisallowMultipleChannels->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">This variable exists to help users whose graphics drivers are broken in such a way as to make VP1 crash when showing multiple 3D widgets. Setting this variable will thus ensure that the user can only ever open one channel, and it will remove the little 3D preview window normally shown when editing a material.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_DISALLOW_MULTIPLE_CHANNELS")){ - m_checkboxDisallowMultipleChannels->setChecked(true); - } - connect(m_checkboxDisallowMultipleChannels, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_DISALLOW_MULTIPLE_CHANNELS");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_DISALLOW_MULTIPLE_CHANNELS")){ - m_checkboxDisallowMultipleChannels->setChecked(true); - } - connect(m_checkboxDisallowMultipleChannels, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_DISALLOW_MULTIPLE_CHANNELS");}); - #endif - - m_checkboxDisplayMouseClicks = new QCheckBox("Dis&play mouse clicks", this); - m_checkboxDisplayMouseClicks->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Makes a small popup window appear whenever the user clicks a mouse-button in VP1. Basically this feature exists since it is used when producing the movies (screencasts) on this webpage.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_DISPLAY_MOUSE_CLICKS")){ - m_checkboxDisplayMouseClicks->setChecked(true); - } - connect(m_checkboxDisplayMouseClicks, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_DISPLAY_MOUSE_CLICKS");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_DISPLAY_MOUSE_CLICKS")){ - m_checkboxDisplayMouseClicks->setChecked(true); - } - connect(m_checkboxDisplayMouseClicks, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_DISPLAY_MOUSE_CLICKS");}); - #endif - - m_checkboxEnableAskOnClose = new QCheckBox("&Ask on close", this); - m_checkboxEnableAskOnClose->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">By default, closing the VP1 window immediately results in the job being finished. Setting this variable will instead make VP1 ask the user if it should really close.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_ENABLE_ASK_ON_CLOSE")){ - m_checkboxEnableAskOnClose->setChecked(true); - } - connect(m_checkboxEnableAskOnClose, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_ENABLE_ASK_ON_CLOSE");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_ENABLE_ASK_ON_CLOSE")){ - m_checkboxEnableAskOnClose->setChecked(true); - } - connect(m_checkboxEnableAskOnClose, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_ENABLE_ASK_ON_CLOSE");}); - #endif - - - m_checkboxGuidesSphereInsteadOfCoordaxes = new QCheckBox("G&uides sphere instead of coordinate axes", this); - m_checkboxGuidesSphereInsteadOfCoordaxes->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Replaces the coordinate axes with a red sphere.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_GUIDES_SPHERE_INSTEAD_OF_COORDAXES")){ - m_checkboxGuidesSphereInsteadOfCoordaxes->setChecked(true); - } - connect(m_checkboxGuidesSphereInsteadOfCoordaxes, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_GUIDES_SPHERE_INSTEAD_OF_COORDAXES");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_GUIDES_SPHERE_INSTEAD_OF_COORDAXES")){ - m_checkboxGuidesSphereInsteadOfCoordaxes->setChecked(true); - } - connect(m_checkboxGuidesSphereInsteadOfCoordaxes, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_GUIDES_SPHERE_INSTEAD_OF_COORDAXES");}); - #endif - - - m_checkboxAntiAliasing = new QCheckBox("Advanced Anti-Aliasing", this); - m_checkboxAntiAliasing->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Switches on advanced Anti-Aliasing. WARNING: May cause issues with certain graphics drivers.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("general","ExpertSettings/VP1_ADVANCED_ANTIALIASING")){ - m_checkboxAntiAliasing->setChecked(true); - } - connect(m_checkboxAntiAliasing, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("general","ExpertSettings/VP1_ADVANCED_ANTIALIASING");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_ADVANCED_ANTIALIASING")){ - m_checkboxAntiAliasing->setChecked(true); - } - connect(m_checkboxAntiAliasing, &QCheckBox::toggled, [this](){GeneralTab::setExpertSetting("VP1_ADVANCED_ANTIALIASING");}); - #endif - - - - QGroupBox *directoryGroup = new QGroupBox(tr("Directory settings")); - - m_browseButton1 = new QPushButton(tr("&Browse..."), this); - connect(m_browseButton1, &QAbstractButton::clicked, this, &GeneralTab::on_browseButton1_clicked); - #if defined BUILDVP1LIGHT - m_lineEdit1 = new QLineEdit(VP1QtUtils::expertSettingValue("general","ExpertSettings/VP1_SCREENSHOTS_DIR"), this); - #else - m_lineEdit1 = new QLineEdit(VP1QtUtils::environmentVariableValue("VP1_SCREENSHOTS_DIR"), this); - #endif - m_lineEdit1->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Turns on the automatic generation of screen-shots for all channels at every event. The value must be a valid writable directory, where all generated screenshot files will be stored.</div>" - " </html>", 0 - )); - connect(m_lineEdit1, &QLineEdit::textChanged, this, &GeneralTab::slotScreenshotDirChanged); - - - QVBoxLayout *generalLayout = new QVBoxLayout; - generalLayout->addWidget(m_checkboxVerbose); - generalLayout->addWidget(m_checkboxDebug); - generalLayout->addWidget(m_checkboxDisallowMultipleChannels); - generalLayout->addWidget(m_checkboxDisplayMouseClicks); - generalLayout->addWidget(m_checkboxEnableAskOnClose); - generalLayout->addWidget(m_checkboxGuidesSphereInsteadOfCoordaxes); - generalLayout->addWidget(m_checkboxAntiAliasing); - generalGroup->setLayout(generalLayout); - - QGridLayout *gridLayout = new QGridLayout(this); - gridLayout->addWidget(new QLabel(tr("Screenshots directory:")), 0, 0); - gridLayout->addWidget(m_lineEdit1,1,0); - gridLayout->addWidget(m_browseButton1,1,1); - directoryGroup->setLayout(gridLayout); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(generalGroup); - mainLayout->addWidget(directoryGroup); - mainLayout->addStretch(1); - setLayout(mainLayout); - -} - -#if defined BUILDVP1LIGHT -void GeneralTab::setExpertSetting(const QString &type, const QString &name){ - if(!VP1QtUtils::expertSettingIsOn(type, name)){ - VP1QtUtils::setExpertSetting(type, name, "1"); - } else { - VP1QtUtils::setExpertSetting(type, name, ""); - } -} -#else -void GeneralTab::setExpertSetting(const QString &name){ - if(!VP1QtUtils::environmentVariableIsOn(name)){ - VP1QtUtils::setEnvironmentVariable(name, "1"); - } else { - VP1QtUtils::unsetEnvironmentVariable(name); - } -} -#endif - -void GeneralTab::on_browseButton1_clicked(){ - QString fileName = QFileDialog::getExistingDirectory(this, - tr("Select screenshot directory"), QDir::currentPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - - m_lineEdit1->setText(fileName); -} - -void GeneralTab::slotScreenshotDirChanged(const QString &path){ - emit signalScreenshotDirChanged(path); -} - - -AdvancedTab::AdvancedTab(QWidget *parent) - : QWidget(parent) -{ - QGroupBox *checkBoxGroup = new QGroupBox(tr("Advanced settings")); - - m_checkboxEnableInformOnEndOfJob = new QCheckBox("&Enable inform on end of job", this); - m_checkboxEnableInformOnEndOfJob->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">By default, VP1 simply exits at the end of the ATHENA job, which might be confusing to some. When this variable is set, VP1 will show an dialog, letting the user know that the end of the job has been reached.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/VP1_ENABLE_INFORM_ON_END_OF_JOB")){ - m_checkboxEnableInformOnEndOfJob->setChecked(true); - } - connect(m_checkboxEnableInformOnEndOfJob, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("expert","ExpertSettings/VP1_ENABLE_INFORM_ON_END_OF_JOB");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_ENABLE_INFORM_ON_END_OF_JOB")){ - m_checkboxEnableInformOnEndOfJob->setChecked(true); - } - connect(m_checkboxEnableInformOnEndOfJob, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("VP1_ENABLE_INFORM_ON_END_OF_JOB");}); - #endif - - m_checkboxHardExitAtEnd = new QCheckBox("&Hard exit at end", this); - m_checkboxHardExitAtEnd->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">By default, the VP1 algorithm simply tells ATHENA to end the job when VP1 is being closed. This means that ATHENA will shut down with its usual procedure, calling finalise on algorithms, generating summaries, etc. If this variable is set, then VP1 will make the process end immediately and abrubtly instead - saving the user some time.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/VP1_HARD_EXIT_AT_END")){ - m_checkboxHardExitAtEnd->setChecked(true); - } - connect(m_checkboxHardExitAtEnd, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("expert","ExpertSettings/VP1_HARD_EXIT_AT_END");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_HARD_EXIT_AT_END")){ - m_checkboxHardExitAtEnd->setChecked(true); - } - connect(m_checkboxHardExitAtEnd, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("VP1_HARD_EXIT_AT_END");}); - #endif - - m_checkboxDevelShowAllCruiseAndEventControls = new QCheckBox("&Show all cruise and event controls", this); - m_checkboxDevelShowAllCruiseAndEventControls->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Use to enable a few controls related to VP1 cruise-mode, which have presently been disabled.</div>" - " </html>", 0 - )); - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS")){ - m_checkboxDevelShowAllCruiseAndEventControls->setChecked(true); - } - connect(m_checkboxDevelShowAllCruiseAndEventControls, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("expert","ExpertSettings/VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS");}); - #else - if(VP1QtUtils::environmentVariableIsOn("VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS")){ - m_checkboxDevelShowAllCruiseAndEventControls->setChecked(true); - } - connect(m_checkboxDevelShowAllCruiseAndEventControls, &QCheckBox::toggled, [this](){AdvancedTab::setExpertSetting("VP1_DEVEL_SHOW_ALL_CRUISE_AND_EVENT_CONTROLS");}); - #endif - - - QGroupBox *directoryGroup = new QGroupBox(tr("Directory settings")); - - m_browseButton1 = new QPushButton(tr("&Browse..."), this); - connect(m_browseButton1, &QAbstractButton::clicked, this, &AdvancedTab::on_browseButton1_clicked); - m_lineEdit1 = new QLineEdit("", this); - - #if defined BUILDVP1LIGHT - if(VP1QtUtils::expertSettingValue("expert","ExpertSettings/GXPLUGINPATH")==""){ - #ifdef MACBUNDLE - m_lineEdit1->setText(QCoreApplication::applicationDirPath()+"/../Frameworks"); - #else - m_lineEdit1->setText(QCoreApplication::applicationDirPath()+"/../lib"); - #endif - } else { - m_lineEdit1->setText(VP1QtUtils::expertSettingValue("expert","ExpertSettings/GXPLUGINPATH")); - } - #else - if(VP1QtUtils::environmentVariableValue("GXPLUGINPATH")==""){ - m_lineEdit1->setText(QCoreApplication::applicationDirPath()+"/../lib"); - } else { - m_lineEdit1->setText(VP1QtUtils::environmentVariableValue("GXPLUGINPATH")); - } - #endif - m_lineEdit1->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Select the directory that contains the plugin libraries.</div>" - " </html>", 0 - )); - connect(m_lineEdit1, &QLineEdit::textChanged, this, &AdvancedTab::slotPluginPathChanged); - - m_browseButton2 = new QPushButton(tr("B&rowse..."), this); - connect(m_browseButton2, &QAbstractButton::clicked, this, &AdvancedTab::on_browseButton2_clicked); - #if defined BUILDVP1LIGHT - m_lineEdit2 = new QLineEdit(VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1_FILESELECTDIR"), this); - #else - m_lineEdit2 = new QLineEdit(VP1QtUtils::environmentVariableValue("VP1_FILESELECTDIR"), this); - #endif - m_lineEdit2->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">By default, the various VP1 file selectors starts in the job run-directory. Setting this variable to a directory ensures that that directory is used by default instead.</div>" - " </html>", 0 - )); - connect(m_lineEdit2, &QLineEdit::textChanged, this, &AdvancedTab::slotFileSelectDirChanged); - - m_browseButton3 = new QPushButton(tr("Br&owse..."), this); - connect(m_browseButton3, &QAbstractButton::clicked, this, &AdvancedTab::on_browseButton3_clicked); - #if defined BUILDVP1LIGHT - m_lineEdit3 = new QLineEdit(VP1QtUtils::expertSettingValue("expert","ExpertSettings/VP1_AUTH_ENABLELOG"), this); - #else - m_lineEdit3 = new QLineEdit(VP1QtUtils::environmentVariableValue("VP1_AUTH_ENABLELOG"), this); - #endif - m_lineEdit3->setToolTip( QApplication::translate(__FUNCTION__, " <html>\n" - " <div style=\"width: 300px;\">Enables creation of an authentication log file for VP1 live.</div>" - " </html>", 0 - )); - connect(m_lineEdit3, &QLineEdit::textChanged, this, &AdvancedTab::slotAuthLogChanged); - - - QVBoxLayout *checkBoxLayout = new QVBoxLayout; - checkBoxLayout->addWidget(m_checkboxEnableInformOnEndOfJob); - checkBoxLayout->addWidget(m_checkboxHardExitAtEnd); - checkBoxLayout->addWidget(m_checkboxDevelShowAllCruiseAndEventControls); - checkBoxGroup->setLayout(checkBoxLayout); - - QGridLayout *gridLayout = new QGridLayout(this); - gridLayout->addWidget(new QLabel(tr("Plugin path:")), 0, 0); - gridLayout->addWidget(m_lineEdit1,1,0); - gridLayout->addWidget(m_browseButton1,1,1); - gridLayout->addWidget(new QLabel(tr("File selection directory:")), 2, 0); - gridLayout->addWidget(m_lineEdit2,3,0); - gridLayout->addWidget(m_browseButton2,3,1); - gridLayout->addWidget(new QLabel(tr("Authentication log directory:")), 4, 0); - gridLayout->addWidget(m_lineEdit3,5,0); - gridLayout->addWidget(m_browseButton3,5,1); - directoryGroup->setLayout(gridLayout); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(checkBoxGroup); - mainLayout->addWidget(directoryGroup); - mainLayout->addStretch(1); - setLayout(mainLayout); -} - -void AdvancedTab::on_browseButton1_clicked() -{ - QString fileName = QFileDialog::getExistingDirectory(this, - tr("Select Plugin Path"), QDir::currentPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - - m_lineEdit1->setText(fileName); -} - -void AdvancedTab::on_browseButton2_clicked() -{ - QString fileName = QFileDialog::getExistingDirectory(this, - tr("Select file directory"), QDir::currentPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - - m_lineEdit2->setText(fileName); -} - -void AdvancedTab::on_browseButton3_clicked() -{ - QString fileName = QFileDialog::getExistingDirectory(this, - tr("Select authentication directory"), QDir::currentPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - - m_lineEdit3->setText(fileName); -} - -void AdvancedTab::slotPluginPathChanged(const QString &path){ - emit signalPluginPathChanged(path); -} - -void AdvancedTab::slotFileSelectDirChanged(const QString &path){ - emit signalFileSelectDirChanged(path); -} - -void AdvancedTab::slotAuthLogChanged(const QString &path){ - emit signalAuthLogChanged(path); -} - -#if defined BUILDVP1LIGHT -void AdvancedTab::setExpertSetting(const QString &type, const QString &name){ - if(!VP1QtUtils::expertSettingIsOn(type, name)) { - VP1QtUtils::setExpertSetting(type, name, "1"); - } else { - VP1QtUtils::setExpertSetting(type, name, ""); - } -} -#else -void AdvancedTab::setExpertSetting(const QString &name){ - if(!VP1QtUtils::environmentVariableIsOn(name)) { - VP1QtUtils::setEnvironmentVariable(name, "1"); - } else { - VP1QtUtils::unsetEnvironmentVariable(name); - } -} -#endif diff --git a/GeoModelVisualization/VP1Gui/src/VP1GeoDBSelection.cxx b/GeoModelVisualization/VP1Gui/src/VP1GeoDBSelection.cxx index bd4d7713a3de349b92e2a5509b20903718d6821a..239fc51f55a8735ba4f54aafccd06aff30c2d058 100644 --- a/GeoModelVisualization/VP1Gui/src/VP1GeoDBSelection.cxx +++ b/GeoModelVisualization/VP1Gui/src/VP1GeoDBSelection.cxx @@ -47,7 +47,7 @@ VP1GeoDBSelection::VP1GeoDBSelection(QWidget *parent) : QDialog(parent) connect(m_cancelButton, &QPushButton::clicked, this, &VP1GeoDBSelection::reject); //Open QSettings to store path do database - QSettings settings("ATLAS", "VP1Light"); + QSettings settings("ATLAS", "gmex"); QString text; //If no db file has been provided via command line argument, the "db/path" value is "" @@ -113,7 +113,7 @@ void VP1GeoDBSelection::on_browseButton_clicked() void VP1GeoDBSelection::loadDatabase(){ //Save DB path to settings - QSettings settings("ATLAS", "VP1Light"); + QSettings settings("ATLAS", "gmex"); settings.setValue("db/path", m_directoryComboBox->itemText(m_directoryComboBox->currentIndex())); //If the selected DB does not exists, go back