ATLAS Offline Software
Loading...
Searching...
No Matches
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
26class 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
32class IVP1System;
33
34class IVP1ChannelWidget : public QWidget, public VP1String {
35
36 Q_OBJECT
37
38public:
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
53protected:
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
73protected:
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
81public:
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
87signals:
88 //Emitting the following signal makes a message show up in the text window of the application
89 void message(QString);
90
97
98public:
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
107private:
108 unsigned cloneID() const;
109 QWidget * controllerWidget();
110signals:
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!!!
113private:
115 bool hasRefreshingSystem();
116private:
119 class Imp;
121
122 void setCloneID(unsigned id);
123 const std::set<IVP1System *>& systems();
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);
135public:
136 virtual void dockResized();//Called by the dockwidget to inform about resize events.
137};
138
139#define VP1CHANNELNAMEINPLUGIN(cls,nme) nme
140
141
142Q_DECLARE_INTERFACE(IVP1ChannelWidget,"IVP1ChannelWidget/1.0")
143
144#endif
const double width
friend class VP1Prioritiser
virtual Type type() const =0
friend class VP1ChannelManager
friend class VP1ExecutionScheduler
void registerSystem(IVP1System *)
virtual void goingToNextEvent()
void getRunEvtNumber(int &runnumber, unsigned long long &eventnumber)
virtual void lastOfActiveSystemsRefreshed()
virtual bool isAccumulator() const
virtual void dockResized()
void setRunEvtNumber(int runnumber, unsigned long long eventnumber)
void setEvtTimestamp(unsigned timestamp)
void registerController(QWidget *)
virtual void systemRefreshed(IVP1System *)
virtual void restoreFromState(QByteArray)
void message(QString)
virtual void init()=0
unsigned cloneID() const
virtual QPixmap getSnapshot(bool transp=false, int width=0, bool batch=false)
void turnOff(IVP1System *, const bool &immediateErase=true)
void systemRefreshInfoChanged(QString sysrefreshing, int nsysOn, int nsysOnRefreshed)
void setCloneID(unsigned id)
virtual bool setAntiAliasing(bool aa)
IVP1ChannelWidget & operator=(const IVP1ChannelWidget &)
void setState(const State &)
void uniqueNameChanged(const QString &)
const QString & information() const
friend class VP1MainWindow
IVP1ChannelWidget(const IVP1ChannelWidget &)
void getEvtTimestamp(unsigned &timestamp)
const QString unique_name() const
const QString & name() const
const std::set< IVP1System * > & systems()
virtual bool isAntiAliasing()
IVP1ChannelWidget(const QString &name, const QString &information, const QString &contact_info)
virtual void systemErased(IVP1System *)
void setCanRegister(const bool &controller, const bool &system)
const QString & contact_info() const
virtual QByteArray saveState()
void turnOn(IVP1System *)
friend class VP1TabManager
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static std::vector< uint32_t > runnumber
Definition iLumiCalc.h:37