Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OutputPreview.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2016 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include <QWidget>
21 #include <QColor>
22 #include <QRect>
23 #include <QPoint>
24 #include <omni/Session.h>
27 
28 namespace omni {
29  namespace ui {
30  /// Widget to draw rendered output of a session
31  class OutputPreview :
32  public QWidget,
33  public mixin::SharedDataModel<Session>,
34  public mixin::TransformedRect<OutputPreview>{
35  Q_OBJECT
37 
38  public:
39  OutputPreview(QWidget * = nullptr);
41 
42  /// Return desktop rectangle
43  QRect desktopRect() const;
44 
45  public slots:
46  void triggerUpdate();
47 
48  signals:
49  void dataModelChanged();
50 
51  protected:
52  void resizeEvent(QResizeEvent *);
53  void paintEvent(QPaintEvent *);
54  void timerEvent(QTimerEvent *);
55 
56  private:
57  void drawBorder(QColor _color,
58  QRect const& _rect,
59  QPoint& _capPos,
60  QString const& _caption);
61 
62  void drawTuning(QPainter&,
63  proj::Tuning const *);
64  void drawScreen(QPainter&,
65  QScreen const *);
66  int verticalMultiplier() const;
67 
68  /// Return non transformed rectangle for tuning
69  QRect getRectForTuning(proj::Tuning const *);
70 
71  void dataToFrontend();
72  inline bool frontendToData() {
73  return false;
74  }
75 
76  int timerId_ = 0;
77  bool needsUpdate_ = true;
78  QImage image_;
79  };
80  }
81 }
void dataToFrontend()
Pure virtual method which determines how data model is represented in frontend.
Definition: OutputPreview.cpp:181
A session consists of a canvas, a mapping, a list of tunings and one or several inputs.
Definition: Session.h:41
#define OMNI_UI_SHARED_DATAMODEL(MODEL)
Definition: DataModel.h:216
QImage image_
Definition: OutputPreview.h:78
Widget to draw rendered output of a session.
Definition: OutputPreview.h:31
void drawScreen(QPainter &, QScreen const *)
Definition: OutputPreview.cpp:144
Mixin which calculates transformed screen rectangles Used in export output preview and screen setup ...
Definition: TransformedRect.h:33
int verticalMultiplier() const
Definition: OutputPreview.cpp:159
void timerEvent(QTimerEvent *)
Definition: OutputPreview.cpp:104
QRect desktopRect() const
Return desktop rectangle.
Definition: OutputPreview.cpp:39
bool frontendToData()
Return true if data has changed by front end.
Definition: OutputPreview.h:72
void resizeEvent(QResizeEvent *)
Definition: OutputPreview.cpp:60
int timerId_
Definition: OutputPreview.h:76
OutputPreview(QWidget *=nullptr)
Definition: OutputPreview.cpp:30
void drawTuning(QPainter &, proj::Tuning const *)
Definition: OutputPreview.cpp:110
void triggerUpdate()
Definition: OutputPreview.cpp:56
QRect getRectForTuning(proj::Tuning const *)
Return non transformed rectangle for tuning.
bool needsUpdate_
Definition: OutputPreview.h:77
~OutputPreview()
Definition: OutputPreview.cpp:37
void paintEvent(QPaintEvent *)
Definition: OutputPreview.cpp:64
Holds a specific data model with frontend update mechanism.
Definition: DataModel.h:87
void drawBorder(QColor _color, QRect const &_rect, QPoint &_capPos, QString const &_caption)
Widget for manipulating projector parameters Also holds a preview OpenGL widget. ...
Definition: Tuning.h:46