-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubdisplayhandler.h
More file actions
executable file
·185 lines (173 loc) · 5.81 KB
/
subdisplayhandler.h
File metadata and controls
executable file
·185 lines (173 loc) · 5.81 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* Copyright 2016 Pascal COMBES <pascom@orange.fr>
*
* This file is part of ProSlideShower.
*
* ProSlideShower 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.
*
* ProSlideShower 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 ProSlideShower. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef SUBDISPLAYHANDLER_H
#define SUBDISPLAYHANDLER_H
#include <QObject>
#include <QVector>
class PresModel;
class ProjDisplay;
/*!
* \brief The SubDisplayHandler class manages multiple ProjDisplay.
*
* This class defines generic method for objects controlling multiple
* instances of ProjDisplay. It can be used a class member (as done in ProjController)
* or as the class parent (as done in ProjManager).
*
* It defines the master model used by the children ProjDisplay,
* as well as some functions to interact with it.
*
* It also handles the context menu actions for the ProjDisplay
* and manages it.
*/
class SubDisplayHandler : public QObject, public QVector<ProjDisplay *>
{
Q_OBJECT
public:
/*!
* \brief Constructor
*
* Initializes the class members.
* \param model The master model for the children ProjDisplay.
* \param parent The parent object.
*/
SubDisplayHandler(PresModel* model = NULL, QObject* parent = NULL);
/*!
* \brief Destructor
*
* Desallocates the children ProjDisplay.
*/
virtual ~SubDisplayHandler(void);
/*!
* \brief Set parent widget
*
* Sets the parent widget used as a parent for the dialogs.
* \param widget The widget to be used as parent.
* \sa parentWidget()
*/
inline void setParentWidget(QWidget* widget) {mParent = widget;}
/*!
* \brief Get parent widget
*
* Returns the widget used as parent by dialogs.
* \return The widget used as parent.
* \sa setParentWidget()
*/
inline QWidget* parentWidget(void) const {return mParent;}
/*!
* \brief Set the master model
*
* Sets the master model used by all children ProjDisplay.
* \note It may be \c NULL, to deactivate display.
* \param model The model to be used as master.
* \sa model()
*/
virtual void setModel(PresModel* model);
/*!
* \brief Get the master model
*
* Returns the model used by all children ProjDisplay.
* \return The model used as master.
* \sa setModel()
*/
inline PresModel* model() const {return mModel;}
public slots:
/*!
* \brief Load file
*
* This slot asks the user for the file to load.
* It then loads the file in the master model
* \internal
* \note Depending on the action which calls the slot,
* the user-provided file may be loaded
* in the master or the slave model.
* \endinternal
* \sa load(const QString&, int, int)
*/
void load(void);
/*!
* \brief Load master file.
*
* Loads a file in master model with the given number of
* horizontal and vertical virtual screens.
* \internal
* \note If the number of horizontal virtual screens is 0 or less,
* handleVirtualScreens() is used to ask the user for the number of
* horizontal virtual screens in the presentation.
* \endinternal
* \param file The path to the file to load in master model.
* \param h The number of horizontal virtual screens (positive).
* \param v The number of vertical virtual screens (strictly positive).
* \sa load()
*/
virtual void load(const QString& file, int h = 0, int v = 1);
/*!
* \brief Go to next page
*
* This function changes forward the current page in the slave models
* (models not equal to the master model) used by children ProjDisplay.
* \sa goToPrevPage()
*/
void goToNextPage();
/*!
* \brief Go to prev page
*
* This function changes backward the current page in the slave models
* (models not equal to the master model) used by children ProjDisplay.
* \sa goToNextPage()
*/
void goToPrevPage();
/*!
* \brief Update display actions
*
* Updates the actions shown in the context menu of the children ProjDisplay.
* \internal
* \sa updateDisplayActions(ProjDisplay*)
* \endinternal
*/
virtual void updateDisplayActions(void);
private slots:
/*!
* \brief Let the user choose the number of horizontal virtual screens
*
* This slot show a prompt dialog where the user can choose the number of
* horizontal virtual screens in the presentation.
* \note Depending on the action which calls the slot,
* it may act on the master or the slave model.
*/
void handleVirtualScreens(void);
/*!
* \brief Let the user choose the number of vertical virtual screens
*
* This slot show a prompt dialog where the user can choose the offset.
* \note Depending on the action which calls the slot,
* it may act on the master or the slave model.
*/
void handleOffset(void);
private:
/*!
* \brief Update display actions
*
* Updates display actions for the given ProjDisplay.
* \param display A children ProjDisplay.
* \sa updateDisplayActions()
*/
void updateDisplayActions(ProjDisplay* display);
PresModel* mModel; /*!< The master model used by default by all children. */
QWidget* mParent; /*!< The widget used as parent for dialogs. */
};
#endif // SUBDISPLAYHANDLER_H