Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScreenSetup.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "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 #ifndef OMNI_PROJ_SCREENSETUP_H_
21 #define OMNI_PROJ_SCREENSETUP_H_
22 
23 #include <set>
24 #include <vector>
25 #include <QScreen>
26 
27 namespace omni {
28  class Session;
29 
30  namespace proj {
31  class Tuning;
32 
33  /// Singleton class which manages the current screen setup
34  class ScreenSetup {
35  public:
36  ScreenSetup(Session const *_session);
37 
38  /**@brief Returns the screen geometry for a screen
39  @detail If screen is null, the geometry for the virtual screen is returned
40  **/
41  QRect screenGeometry(QScreen const* = nullptr) const;
42 
43  /// Returns screen size that supports triple heads
44  static std::vector<QSize>const& screenResolutions();
45 
46  /// Return standard screen, where omnidome has to be placed
47  static QScreen const * standardScreen();
48 
49  /// Return const pointer to session
50  Session const * session() const;
51 
52  /**@brief Returns the number of subscreens for a single screen
53  @detail If screen is nullptr, number of subscreen for virtual screen
54  is returned.
55  **/
56  int subScreenCount(QScreen const * = nullptr) const;
57 
58  /** @brief Static method for getting subscreen count for screen
59  @detail Screen must not be nullptr!
60  **/
61  static int subScreenCountForScreen(QScreen const *);
62 
63  /**@brief Returns the number of subscreens for a single screen
64  @detail If screen is nullptr, number of subscreen for virtual screen
65  is returned.
66  **/
67  int subScreenWidth(QScreen const * = nullptr) const;
68 
69  /** @brief Static method for getting subscreen width for screen
70  @detail Screen must not be nullptr!
71  **/
72  static int subScreenWidthForScreen(QScreen const *);
73 
74  /// Returns the rectangle of a subscreen with a certain index
75  QRect subScreenRect(int _index, QScreen const* = nullptr) const;
76 
77  /** @brief Static method for getting subscreen count for screen
78  @detail Screen must not be nullptr!
79  **/
80  static QRect subScreenRectForScreen(int _index, QScreen const *);
81 
82  /// Return aspect ratio of subscreen
83  qreal subScreenAspectRatio(QScreen const* = nullptr) const;
84 
85 
86  static QRect desktopRect(
87  bool _excludeStandardScreen = true);
88 
89  /// Virtual desktop rect contains all non-assigned tunings
90  QRect virtualScreenRect() const;
91 
92  /// Returns combined desktop and virtual desktop rect
93  QRect combinedDesktopRect() const;
94 
95  /// Returns true if no tuning is assigned to a screen
96  bool noTuningsAssigned() const;
97 
98  bool noTuningsAssigned(QScreen const *)
99  const;
100 
101  std::set<QScreen const*> usedScreens() const;
102 
103  /// Return vector, optionally excluded standard screen
104  static std::vector<QScreen const *>screens(
105  bool _excludeStandardScreen = true);
106 
107  std::set<proj::Tuning const *> tunings(bool _excludeNonAssigned) const;
108 
109  /// Return pointer to screen for rectangle, nullptr if no screen with
110  // rectangle exists
111  static QScreen const * screenFromRect(QRect const&);
112 
113  /// Bounding rect that unifies all tunings
114  QRect tuningRect() const;
115 
116  bool operator==(const ScreenSetup&) const;
117 
118  private:
120  };
121  }
122 
123  using proj::ScreenSetup;
124 }
125 
126 #endif /* OMNI_PROJ_SCREENSETUP_H_ */
static QScreen const * screenFromRect(QRect const &)
Return pointer to screen for rectangle, nullptr if no screen with.
Definition: ScreenSetup.cpp:243
ScreenSetup(Session const *_session)
Definition: ScreenSetup.cpp:29
bool noTuningsAssigned() const
Returns true if no tuning is assigned to a screen.
Definition: ScreenSetup.cpp:75
QRect combinedDesktopRect() const
Returns combined desktop and virtual desktop rect.
Definition: ScreenSetup.cpp:98
A session consists of a canvas, a mapping, a list of tunings and one or several inputs.
Definition: Session.h:41
static std::vector< QSize > const & screenResolutions()
Returns screen size that supports triple heads.
Definition: ScreenSetup.cpp:33
Singleton class which manages the current screen setup.
Definition: ScreenSetup.h:34
static std::vector< QScreen const * > screens(bool _excludeStandardScreen=true)
Return vector, optionally excluded standard screen.
Definition: ScreenSetup.cpp:189
QRect virtualScreenRect() const
Virtual desktop rect contains all non-assigned tunings.
Definition: ScreenSetup.cpp:61
QRect tuningRect() const
Bounding rect that unifies all tunings.
Definition: ScreenSetup.cpp:219
std::set< proj::Tuning const * > tunings(bool _excludeNonAssigned) const
Definition: ScreenSetup.cpp:230
Session const * session() const
Return const pointer to session.
Definition: ScreenSetup.cpp:57
static int subScreenCountForScreen(QScreen const *)
Static method for getting subscreen count for screen Screen must not be nullptr! ...
Definition: ScreenSetup.cpp:136
static int subScreenWidthForScreen(QScreen const *)
Static method for getting subscreen width for screen Screen must not be nullptr! ...
Definition: ScreenSetup.cpp:158
static QScreen const * standardScreen()
Return standard screen, where omnidome has to be placed.
Definition: ScreenSetup.cpp:52
int subScreenCount(QScreen const *=nullptr) const
Returns the number of subscreens for a single screen If screen is nullptr, number of subscreen for v...
Definition: ScreenSetup.cpp:120
Session const * session_
Definition: ScreenSetup.h:119
bool operator==(const ScreenSetup &) const
Definition: ScreenSetup.cpp:253
std::set< QScreen const * > usedScreens() const
Definition: ScreenSetup.cpp:207
QRect subScreenRect(int _index, QScreen const *=nullptr) const
Returns the rectangle of a subscreen with a certain index.
Definition: ScreenSetup.cpp:163
QRect screenGeometry(QScreen const *=nullptr) const
Returns the screen geometry for a screen If screen is null, the geometry for the virtual screen is r...
Definition: ScreenSetup.cpp:110
qreal subScreenAspectRatio(QScreen const *=nullptr) const
Return aspect ratio of subscreen.
Definition: ScreenSetup.cpp:176
static QRect subScreenRectForScreen(int _index, QScreen const *)
Static method for getting subscreen count for screen Screen must not be nullptr! ...
Definition: ScreenSetup.cpp:171
int subScreenWidth(QScreen const *=nullptr) const
Returns the number of subscreens for a single screen If screen is nullptr, number of subscreen for v...
Definition: ScreenSetup.cpp:153
static QRect desktopRect(bool _excludeStandardScreen=true)
Definition: ScreenSetup.cpp:180