ATLAS Offline Software
IVP1ChannelWidget.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Header file for class IVP1ChannelWidget //
8 // //
9 // Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10 // //
11 // Initial version: April 2007 //
12 // update: rbianchi@cern.ch - October 2013 //
13 // //
15 
16 #ifndef IVP1CHANNELWIDGET_H
17 #define IVP1CHANNELWIDGET_H
18 
19 #include "VP1Base/VP1String.h"
20 #include "VP1Base/VP1Msg.h"
21 
22 #include <QWidget>
23 
24 #include <set>
25 
26 class QPixmap;
27 
28 //NB: When implementing subclasses, remember that the VP1 might
29 //instantiate several versions of each channel (so stay away from
30 //static/global variables for instance).
31 
32 class IVP1System;
33 
34 class IVP1ChannelWidget : public QWidget, public VP1String {
35 
36  Q_OBJECT
37 
38 public:
39  IVP1ChannelWidget(const QString & name, const QString & information, const QString & contact_info);
40  virtual void init() = 0;//This is where addSystem calls should be made. No code should be in constructors
41 
42  virtual ~IVP1ChannelWidget();
43  //The name should be kept shorter than 20 characters.
44 
45  //Type of widget:
47  virtual Type type() const = 0;//Fixme: as parameter to constructor!
48 
49  virtual bool isAccumulator() const;
50 
51  void setRunEvtNumber(int runnumber, unsigned long long eventnumber);
52 
53 protected:
54  virtual void create();//Fixme: Abstract!
55  virtual void systemRefreshed(IVP1System*);
56  virtual void systemErased(IVP1System*);
57  virtual void goingToNextEvent(){}
58  virtual void uncreate();
59 
60  virtual void lastOfActiveSystemsRefreshed();//For triggering some behaviour when all data for event is loaded
61 
62 
63  //Fixme:Optional (de)persistification of settings?
64 
65  void turnOn(IVP1System*);
66  void turnOff(IVP1System*,const bool& immediateErase=true);
67 
68  void getRunEvtNumber(int& runnumber, unsigned long long& eventnumber);
69 
70  void setEvtTimestamp(unsigned timestamp);
71  void getEvtTimestamp(unsigned& timestamp);
72 
73 protected:
74  //If the channel needs a custom control widget to allow the user to
75  //control how it presents itself, call the follwing method in create() (and at most once):
76  void registerController(QWidget*);
77 
78  //Call once for each system in constructor of derived classes:
80 
81 public:
82  //Override the following if the channel needs to be able to save info in the .vp1 files (states of systems are saved separately):
83  virtual QByteArray saveState();
84  virtual void restoreFromState(QByteArray);//If channel loaded from .vp1 files, this will be called
85  //after create() and before any refreshes.
86 
87 signals:
88  //Emitting the following signal makes a message show up in the text window of the application
89  void message(QString);
90 
97 
98 public:
99  const QString& name() const;
100  const QString unique_name() const;
101  const QString& information() const;
102  const QString& contact_info() const;
103  virtual QPixmap getSnapshot(bool transp = false, int width = 0, bool batch = false);
104  virtual bool setAntiAliasing(bool aa) {VP1Msg::messageVerbose("You should not call this function directly, but one of its implementations in derived classes..."); return aa; };
105  virtual bool isAntiAliasing() {VP1Msg::messageVerbose("You should not call this function directly, but one of its implementations in derived classes..."); return false; };
106 
107 private:
108  unsigned cloneID() const;
109  QWidget * controllerWidget();
110 signals:
111  void uniqueNameChanged(const QString&);//Do NOT call this method in derived classes!!!
112  void systemRefreshInfoChanged(QString sysrefreshing, int nsysOn, int nsysOnRefreshed);//Do NOT call this method in derived classes!!!
113 private:
114  void emitRefreshInfoChanged();
115  bool hasRefreshingSystem();
116 private:
119  class Imp;
120  Imp * m_d;
121 
122  void setCloneID(unsigned id);
123  const std::set<IVP1System *>& systems();
124  friend class VP1ExecutionScheduler;
125  friend class VP1Prioritiser;
126  friend class VP1ChannelManager;
127  friend class VP1TabManager;
128  friend class VP1MainWindow;
129  friend class IVP1System;
131  void deleteControllers();
132  State state() const;
133  void setState(const State&);
134  void setCanRegister(const bool&controller,const bool&system);
135 public:
136  virtual void dockResized();//Called by the dockwidget to inform about resize events.
137 };
138 
139 #define VP1CHANNELNAMEINPLUGIN(cls,nme) nme
140 
141 
142 Q_DECLARE_INTERFACE(IVP1ChannelWidget,"IVP1ChannelWidget/1.0")
143 
144 #endif
IVP1ChannelWidget::registerSystem
void registerSystem(IVP1System *)
Definition: IVP1ChannelWidget.cxx:221
IVP1ChannelWidget::lastOfActiveSystemsRefreshed
virtual void lastOfActiveSystemsRefreshed()
Definition: IVP1ChannelWidget.cxx:334
IVP1ChannelWidget::setRunEvtNumber
void setRunEvtNumber(int runnumber, unsigned long long eventnumber)
Definition: IVP1ChannelWidget.cxx:89
VP1String
Definition: VP1String.h:43
VP1String.h
VP1Msg.h
IVP1ChannelWidget::contact_info
const QString & contact_info() const
Definition: IVP1ChannelWidget.cxx:191
IVP1ChannelWidget::TWODIMENSIONAL
@ TWODIMENSIONAL
Definition: IVP1ChannelWidget.h:46
IVP1ChannelWidget::State
State
Definition: IVP1ChannelWidget.h:130
IVP1ChannelWidget::dockResized
virtual void dockResized()
Definition: IVP1ChannelWidget.cxx:315
IVP1ChannelWidget::registerController
void registerController(QWidget *)
Definition: IVP1ChannelWidget.cxx:210
IVP1ChannelWidget::deleteControllers
void deleteControllers()
Definition: IVP1ChannelWidget.cxx:161
IVP1ChannelWidget::type
virtual Type type() const =0
IVP1ChannelWidget::NUMBERS
@ NUMBERS
Definition: IVP1ChannelWidget.h:46
IVP1ChannelWidget::emitRefreshInfoChanged
void emitRefreshInfoChanged()
Definition: IVP1ChannelWidget.cxx:268
IVP1ChannelWidget::HISTOGRAM
@ HISTOGRAM
Definition: IVP1ChannelWidget.h:46
IVP1ChannelWidget::create
virtual void create()
Definition: IVP1ChannelWidget.cxx:124
Preparation.batch
batch
Definition: Preparation.py:49
IVP1ChannelWidget::systemErased
virtual void systemErased(IVP1System *)
Definition: IVP1ChannelWidget.cxx:142
IVP1ChannelWidget::unique_name
const QString unique_name() const
Definition: IVP1ChannelWidget.cxx:175
IVP1ChannelWidget::turnOff
void turnOff(IVP1System *, const bool &immediateErase=true)
Definition: IVP1ChannelWidget.cxx:246
IVP1ChannelWidget::systemRefreshInfoChanged
void systemRefreshInfoChanged(QString sysrefreshing, int nsysOn, int nsysOnRefreshed)
VP1ChannelManager
Definition: VP1ChannelManager.h:27
IVP1ChannelWidget::getEvtTimestamp
void getEvtTimestamp(unsigned &timestamp)
Definition: IVP1ChannelWidget.cxx:262
IVP1ChannelWidget::isAccumulator
virtual bool isAccumulator() const
Definition: IVP1ChannelWidget.cxx:83
IVP1ChannelWidget::operator=
IVP1ChannelWidget & operator=(const IVP1ChannelWidget &)
IVP1System
Definition: IVP1System.h:36
IVP1ChannelWidget::UNKNOWN
@ UNKNOWN
Definition: IVP1ChannelWidget.h:46
IVP1ChannelWidget::uncreate
virtual void uncreate()
Definition: IVP1ChannelWidget.cxx:155
IVP1ChannelWidget::init
virtual void init()=0
IVP1ChannelWidget::~IVP1ChannelWidget
virtual ~IVP1ChannelWidget()
Definition: IVP1ChannelWidget.cxx:60
VP1Prioritiser
Definition: VP1Prioritiser.h:22
IVP1ChannelWidget::CONSTRUCTED
@ CONSTRUCTED
Definition: IVP1ChannelWidget.h:130
IVP1ChannelWidget::isAntiAliasing
virtual bool isAntiAliasing()
Definition: IVP1ChannelWidget.h:105
IVP1ChannelWidget::UNCREATED
@ UNCREATED
Definition: IVP1ChannelWidget.h:130
IVP1ChannelWidget::hasRefreshingSystem
bool hasRefreshingSystem()
Definition: IVP1ChannelWidget.cxx:289
IVP1ChannelWidget::systems
const std::set< IVP1System * > & systems()
Definition: IVP1ChannelWidget.cxx:231
IVP1ChannelWidget::getSnapshot
virtual QPixmap getSnapshot(bool transp=false, int width=0, bool batch=false)
Definition: IVP1ChannelWidget.cxx:306
IVP1ChannelWidget::message
void message(QString)
xAODType
Definition: ObjectType.h:13
IVP1ChannelWidget::uniqueNameChanged
void uniqueNameChanged(const QString &)
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
IVP1ChannelWidget::setState
void setState(const State &)
Definition: IVP1ChannelWidget.cxx:108
DeMoScan.runnumber
runnumber
Definition: DeMoScan.py:266
IVP1ChannelWidget
Definition: IVP1ChannelWidget.h:34
IVP1ChannelWidget::goingToNextEvent
virtual void goingToNextEvent()
Definition: IVP1ChannelWidget.h:57
VP1ExecutionScheduler
Definition: VP1ExecutionScheduler.h:42
IVP1ChannelWidget::IVP1ChannelWidget
IVP1ChannelWidget(const IVP1ChannelWidget &)
IVP1ChannelWidget::state
State state() const
Definition: IVP1ChannelWidget.cxx:102
IVP1ChannelWidget::restoreFromState
virtual void restoreFromState(QByteArray)
Definition: IVP1ChannelWidget.cxx:326
IVP1ChannelWidget::saveState
virtual QByteArray saveState()
Definition: IVP1ChannelWidget.cxx:320
IVP1ChannelWidget::IVP1ChannelWidget
IVP1ChannelWidget(const QString &name, const QString &information, const QString &contact_info)
Definition: IVP1ChannelWidget.cxx:46
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
IVP1ChannelWidget::setCloneID
void setCloneID(unsigned id)
Definition: IVP1ChannelWidget.cxx:203
IVP1ChannelWidget::cloneID
unsigned cloneID() const
Definition: IVP1ChannelWidget.cxx:197
IVP1ChannelWidget::getRunEvtNumber
void getRunEvtNumber(int &runnumber, unsigned long long &eventnumber)
Definition: IVP1ChannelWidget.cxx:255
IVP1ChannelWidget::setEvtTimestamp
void setEvtTimestamp(unsigned timestamp)
Definition: IVP1ChannelWidget.cxx:96
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
IVP1ChannelWidget::systemRefreshed
virtual void systemRefreshed(IVP1System *)
Definition: IVP1ChannelWidget.cxx:130
IVP1ChannelWidget::setCanRegister
void setCanRegister(const bool &controller, const bool &system)
Definition: IVP1ChannelWidget.cxx:299
IVP1ChannelWidget::READY
@ READY
Definition: IVP1ChannelWidget.h:130
IVP1ChannelWidget::Imp
Definition: IVP1ChannelWidget.cxx:21
VP1TabManager
Definition: VP1TabManager.h:30
IVP1ChannelWidget::name
const QString & name() const
Definition: IVP1ChannelWidget.cxx:180
IVP1ChannelWidget::controllerWidget
QWidget * controllerWidget()
Definition: IVP1ChannelWidget.cxx:77
IVP1ChannelWidget::m_d
Imp * m_d
Definition: IVP1ChannelWidget.h:119
IVP1ChannelWidget::THREEDIMENSIONAL
@ THREEDIMENSIONAL
Definition: IVP1ChannelWidget.h:46
VP1MainWindow
Definition: VP1MainWindow.h:82
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
IVP1ChannelWidget::turnOn
void turnOn(IVP1System *)
Definition: IVP1ChannelWidget.cxx:237
IVP1ChannelWidget::information
const QString & information() const
Definition: IVP1ChannelWidget.cxx:185
IVP1ChannelWidget::setAntiAliasing
virtual bool setAntiAliasing(bool aa)
Definition: IVP1ChannelWidget.h:104