-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenmanager.hpp
113 lines (108 loc) · 3.15 KB
/
screenmanager.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright (C) 2020 Arkadiusz Bubała <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCREENMANAGER_HPP
#define SCREENMANAGER_HPP
#include <QObject>
#include "pimpl.hpp"
class Randomizer;
class ScreenManagerPrivate;
class QGraphicsItem;
class QGraphicsView;
/**
* @brief Screen Manager.
*
* This class is responsible for managing screens and everything
* that is displayed on these screens.
*
*/
class ScreenManager : public QObject
{
Q_OBJECT
public:
/**
* @brief The constructor.
*
* @param randomizer Pointer to the Randomizer instance.
* @param parent Pointer to QObject parent class.
*/
explicit ScreenManager(QObject* parent = nullptr);
/**
* @brief The destructor.
*
*/
~ScreenManager();
/**
* @brief Close all views.
*
*/
void close();
/**
* @brief Add QGraphicsItem to screen.
*
* @param item QGraphicsItem to add.
*/
void addItem(QGraphicsItem* item);
/**
* @brief Show all views.
*
* Shows all views in full screen mode. For multiple monitors each view is
* placed on its screen.
*/
void show();
private:
ScreenManager(const ScreenManager&) = delete;
ScreenManager& operator=(const ScreenManager&) = delete;
/**
* @brief Create views.
*
* Create view for each screen.
* For multiple monitor configuration it resizes the scene for the maximum
* resolution. Each view is paired with its screen, this mapping is stored
* in m_screenToViewMap.
*
*/
void createViews();
/**
* @brief Get scene boundaries that new element will fit to screen.
*
* @param sceneRect Scene rectangle.
* @param itemRect Item rectangle.
* @return QRectF Scene boundaries.
*/
QRectF getSceneBoundariesForItem(const QRectF& sceneRect,
const QRectF& itemRect) const;
/**
* @brief Get random position on @p sceneRect.
*
* @param sceneRect Scene rectangle.
* @return QPointF Random position coordinates.
*/
QPointF getRandomPosition(const QRectF& sceneRect) const;
/**
* @brief Get random view.
*
* @return QGraphicsView Random view.
*/
QGraphicsView* getRandomView() const;
/**
* @brief Insert short help string on top of @p view.
* @param view View to insert the help.
*/
void insertShortHelp(const QGraphicsView& view);
PImpl<ScreenManagerPrivate> pImpl; /**< Pointer to the implementation. */
};
#endif // SCREENMANAGER_HPP