Changeset View
Changeset View
Standalone View
Standalone View
src/ViewContainer.h
Show All 21 Lines | |||||
22 | #ifndef VIEWCONTAINER_H | 22 | #ifndef VIEWCONTAINER_H | ||
23 | #define VIEWCONTAINER_H | 23 | #define VIEWCONTAINER_H | ||
24 | 24 | | |||
25 | // Qt | 25 | // Qt | ||
26 | #include <QObject> | 26 | #include <QObject> | ||
27 | #include <QPointer> | 27 | #include <QPointer> | ||
28 | #include <QHash> | 28 | #include <QHash> | ||
29 | #include <QList> | 29 | #include <QList> | ||
30 | #include <QTabWidget> | ||||
30 | 31 | | |||
31 | // Konsole | 32 | // Konsole | ||
32 | #include "Profile.h" | 33 | #include "Profile.h" | ||
33 | 34 | | |||
34 | class QStackedWidget; | | |||
35 | class QWidget; | | |||
36 | class QHBoxLayout; | | |||
37 | class QVBoxLayout; | | |||
38 | | ||||
39 | // TabbedViewContainer | | |||
40 | // Qt | 35 | // Qt | ||
41 | class QPoint; | 36 | class QPoint; | ||
42 | class QToolButton; | 37 | class QToolButton; | ||
43 | class QMenu; | 38 | class QMenu; | ||
44 | class QDropEvent; | 39 | class QDropEvent; | ||
45 | 40 | | |||
46 | // KDE | | |||
47 | class QMenu; | | |||
48 | | ||||
49 | namespace Konsole { | 41 | namespace Konsole { | ||
50 | class IncrementalSearchBar; | 42 | class IncrementalSearchBar; | ||
51 | class ViewProperties; | 43 | class ViewProperties; | ||
44 | class ViewManager; | ||||
52 | class TabbedViewContainer; | 45 | class TabbedViewContainer; | ||
46 | | ||||
53 | /** | 47 | /** | ||
54 | * An interface for container widgets which can hold one or more views. | 48 | * An interface for container widgets which can hold one or more views. | ||
55 | * | 49 | * | ||
56 | * The container widget typically displays a list of the views which | 50 | * The container widget typically displays a list of the views which | ||
57 | * it has and provides a means of switching between them. | 51 | * it has and provides a means of switching between them. | ||
58 | * | 52 | * | ||
59 | * Subclasses should reimplement the addViewWidget() and removeViewWidget() functions | 53 | * Subclasses should reimplement the addViewWidget() and removeViewWidget() functions | ||
60 | * to actually add or remove view widgets from the container widget, as well | 54 | * to actually add or remove view widgets from the container widget, as well | ||
61 | * as updating any navigation aids. | 55 | * as updating any navigation aids. | ||
62 | */ | 56 | */ | ||
63 | class ViewContainer : public QObject | 57 | class TabbedViewContainer : public QTabWidget | ||
64 | { | 58 | { | ||
65 | Q_OBJECT | 59 | Q_OBJECT | ||
66 | 60 | | |||
67 | public: | 61 | public: | ||
68 | /** | 62 | /** | ||
69 | * This enum describes the options for positioning the | | |||
70 | * container's navigation widget. | | |||
71 | */ | | |||
72 | enum NavigationPosition { | | |||
73 | /** Position the navigation widget above the views. */ | | |||
74 | NavigationPositionTop, | | |||
75 | /** Position the navigation widget below the views. */ | | |||
76 | NavigationPositionBottom, | | |||
77 | /** Position the navigation widget to the left of the views. */ | | |||
78 | NavigationPositionLeft, | | |||
79 | /** Position the navigation widget to the right of the views. */ | | |||
80 | NavigationPositionRight | | |||
81 | }; | | |||
82 | | ||||
83 | /** | | |||
84 | * Constructs a new view container with the specified parent. | 63 | * Constructs a new view container with the specified parent. | ||
85 | * | 64 | * | ||
86 | * @param position The initial position of the navigation widget | 65 | * @param position The initial position of the navigation widget | ||
87 | * @param parent The parent object of the container | 66 | * @param parent The parent object of the container | ||
88 | */ | 67 | */ | ||
89 | ViewContainer(NavigationPosition position, QObject *parent); | 68 | TabbedViewContainer(ViewManager *connectedViewManager, QWidget *parent); | ||
90 | 69 | | |||
91 | /** | 70 | /** | ||
92 | * Called when the ViewContainer is destroyed. When reimplementing this in | 71 | * Called when the ViewContainer is destroyed. When reimplementing this in | ||
93 | * subclasses, use object->deleteLater() to delete any widgets or other objects | 72 | * subclasses, use object->deleteLater() to delete any widgets or other objects | ||
94 | * instead of 'delete object'. | 73 | * instead of 'delete object'. | ||
95 | */ | 74 | */ | ||
96 | ~ViewContainer() Q_DECL_OVERRIDE; | 75 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | ||
97 | | ||||
98 | /** Returns the widget which contains the view widgets */ | | |||
99 | virtual QWidget *containerWidget() const = 0; | | |||
100 | | ||||
101 | /** | | |||
102 | * This enum describes the options for showing or hiding the | | |||
103 | * container's navigation widget. | | |||
104 | */ | | |||
105 | enum NavigationVisibility { | | |||
106 | /** Always show the navigation widget. */ | | |||
107 | AlwaysShowNavigation, | | |||
108 | /** Show the navigation widget only when the container has more than one view. */ | | |||
109 | ShowNavigationAsNeeded, | | |||
110 | /** Always hide the navigation widget. */ | | |||
111 | AlwaysHideNavigation | | |||
112 | }; | | |||
113 | /* | | |||
114 | * Sets the visibility of the view container's navigation widget. | | |||
115 | * | | |||
116 | * The ViewContainer sub-class is responsible for ensuring that this | | |||
117 | * setting is respected as views are added or removed from the | | |||
118 | * container. | | |||
119 | * | | |||
120 | * ViewContainer sub-classes should reimplement the | | |||
121 | * navigationVisibilityChanged() method to respond to changes | | |||
122 | * of this property. | | |||
123 | */ | | |||
124 | void setNavigationVisibility(NavigationVisibility mode); | | |||
125 | /** | | |||
126 | * Returns the current mode for controlling the visibility of the | | |||
127 | * the view container's navigation widget. | | |||
128 | */ | | |||
129 | NavigationVisibility navigationVisibility() const; | | |||
130 | | ||||
131 | /** | | |||
132 | * Sets the position of the navigation widget with | | |||
133 | * respect to the main content area. | | |||
134 | * | | |||
135 | * Depending on the ViewContainer subclass, not all | | |||
136 | * positions from the NavigationPosition enum may be | | |||
137 | * supported. A list of supported positions can be | | |||
138 | * obtained by calling supportedNavigationPositions() | | |||
139 | * | | |||
140 | * ViewContainer sub-classes should re-implement the | | |||
141 | * navigationPositionChanged() method to respond | | |||
142 | * to changes of this property. | | |||
143 | */ | | |||
144 | void setNavigationPosition(NavigationPosition position); | | |||
145 | | ||||
146 | /** | | |||
147 | * Returns the position of the navigation widget with | | |||
148 | * respect to the main content area. | | |||
149 | */ | | |||
150 | NavigationPosition navigationPosition() const; | | |||
151 | | ||||
152 | /** | | |||
153 | * Set whether tab width are expanding | | |||
154 | */ | | |||
155 | void setNavigationTabWidthExpanding(bool expand); | | |||
156 | | ||||
157 | /** | | |||
158 | * Returns the list of supported navigation positions. | | |||
159 | * The supported positions will depend upon the type of the | | |||
160 | * navigation widget used by the ViewContainer subclass. | | |||
161 | * | | |||
162 | * The base implementation returns one item, NavigationPositionTop | | |||
163 | */ | | |||
164 | virtual QList<NavigationPosition> supportedNavigationPositions() const; | | |||
165 | | ||||
166 | /** Sets the navigation text mode | | |||
167 | * If mode is true, use the width of the title; otherwise use the | | |||
168 | * default width calculations. | | |||
169 | */ | | |||
170 | void setNavigationTextMode(bool mode); | | |||
171 | | ||||
172 | /** Sets the stylesheet for visual appearance | | |||
173 | * | | |||
174 | * The default implementation does nothing. | | |||
175 | */ | | |||
176 | virtual void setStyleSheet(const QString &styleSheet) | | |||
177 | { | | |||
178 | Q_UNUSED(styleSheet); | | |||
179 | } | | |||
180 | 76 | | |||
181 | /** Adds a new view to the container widget */ | 77 | /** Adds a new view to the container widget */ | ||
182 | void addView(QWidget *view, ViewProperties *navigationItem, int index = -1); | 78 | void addView(QWidget *view, ViewProperties *navigationItem, int index = -1); | ||
183 | 79 | | |||
184 | /** Removes a view from the container */ | 80 | /** Removes a view from the container */ | ||
185 | void removeView(QWidget *view); | 81 | void removeView(QWidget *view); | ||
186 | 82 | | |||
187 | /** Returns the ViewProperties instance associated with a particular view in the container */ | 83 | /** Returns the ViewProperties instance associated with a particular view in the container */ | ||
188 | ViewProperties *viewProperties(QWidget *view) const; | 84 | ViewProperties *viewProperties(QWidget *view) const; | ||
85 | void setTabActivity(int index, bool activity); | ||||
189 | 86 | | |||
190 | /** Returns a list of the contained views */ | 87 | void updateTitle(ViewProperties *item); | ||
191 | const QList<QWidget *> views() const; | 88 | void updateIcon(ViewProperties *item); | ||
192 | 89 | void updateActivity(ViewProperties *item); | |||
sandsmark: document these | |||||
193 | /** | | |||
194 | * Returns the view which currently has the focus or 0 if none | | |||
195 | * of the child views have the focus. | | |||
196 | */ | | |||
197 | virtual QWidget *activeView() const = 0; | | |||
198 | | ||||
199 | /** | | |||
200 | * Changes the focus to the specified view and updates | | |||
201 | * navigation aids to reflect the change. | | |||
202 | */ | | |||
203 | virtual void setActiveView(QWidget *widget) = 0; | | |||
204 | | ||||
205 | /** | | |||
206 | * @return the search widget for this view | | |||
207 | */ | | |||
208 | IncrementalSearchBar *searchBar(); | | |||
209 | 90 | | |||
210 | /** Changes the active view to the next view */ | 91 | /** Changes the active view to the next view */ | ||
211 | void activateNextView(); | 92 | void activateNextView(); | ||
212 | 93 | | |||
213 | /** Changes the active view to the previous view */ | 94 | /** Changes the active view to the previous view */ | ||
214 | void activatePreviousView(); | 95 | void activatePreviousView(); | ||
215 | 96 | | |||
216 | /** Changes the active view to the last view */ | 97 | /** Changes the active view to the last view */ | ||
217 | void activateLastView(); | 98 | void activateLastView(); | ||
218 | 99 | | |||
100 | void setCssFromFile(const QUrl& url); | ||||
219 | /** | 101 | /** | ||
220 | * This enum describes the directions | 102 | * This enum describes the directions | ||
221 | * in which views can be re-arranged within the container | 103 | * in which views can be re-arranged within the container | ||
222 | * using the moveActiveView() method. | 104 | * using the moveActiveView() method. | ||
223 | */ | 105 | */ | ||
224 | enum MoveDirection { | 106 | enum MoveDirection { | ||
225 | /** Moves the view to the left. */ | 107 | /** Moves the view to the left. */ | ||
226 | MoveViewLeft, | 108 | MoveViewLeft, | ||
227 | /** Moves the view to the right. */ | 109 | /** Moves the view to the right. */ | ||
228 | MoveViewRight | 110 | MoveViewRight | ||
229 | }; | 111 | }; | ||
230 | 112 | | |||
231 | /** | 113 | /** | ||
232 | * Moves the active view within the container and | 114 | * Moves the active view within the container and | ||
233 | * updates the order in which the views are shown | 115 | * updates the order in which the views are shown | ||
234 | * in the container's navigation widget. | 116 | * in the container's navigation widget. | ||
235 | * | 117 | * | ||
236 | * The default implementation does nothing. | 118 | * The default implementation does nothing. | ||
237 | */ | 119 | */ | ||
238 | void moveActiveView(MoveDirection direction); | 120 | void moveActiveView(MoveDirection direction); | ||
239 | 121 | | |||
240 | /** Enum describing extra UI features which can be | | |||
241 | * provided by the container. */ | | |||
242 | enum Feature { | | |||
243 | /** Provides a button which can be clicked to create new views quickly. | | |||
244 | * When the button is clicked, a newViewRequest() signal is emitted. */ | | |||
245 | QuickNewView = 1, | | |||
246 | /** Provides a button which can be clicked to close views quickly. */ | | |||
247 | QuickCloseView = 2 | | |||
248 | }; | | |||
249 | Q_DECLARE_FLAGS(Features, Feature) | | |||
250 | /** | | |||
251 | * Sets which additional features are enabled in this container. | | |||
252 | * The default implementation does thing. Sub-classes should re-implement this | | |||
253 | * to hide or show the relevant parts of their UI | | |||
254 | */ | | |||
255 | virtual void setFeatures(Features features); | | |||
256 | /** Returns a bitwise-OR of enabled extra UI features. See setFeatures() */ | | |||
257 | Features features() const; | | |||
258 | /** Returns a bitwise-OR of supported extra UI features. The default | | |||
259 | * implementation returns 0 (no extra features) */ | | |||
260 | virtual Features supportedFeatures() const | | |||
261 | { | | |||
262 | return nullptr; | | |||
263 | } | | |||
264 | | ||||
265 | /** Sets the menu to be shown when the new view button is clicked. | 122 | /** Sets the menu to be shown when the new view button is clicked. | ||
266 | * Only valid if the QuickNewView feature is enabled. | 123 | * Only valid if the QuickNewView feature is enabled. | ||
267 | * The default implementation does nothing. */ | 124 | * The default implementation does nothing. */ | ||
268 | virtual void setNewViewMenu(QMenu *menu) | 125 | // TODO: Reenable this later. | ||
269 | { | 126 | // void setNewViewMenu(QMenu *menu); | ||
sandsmark: this breaks selecting the profile when opening a new tab. | |||||
270 | Q_UNUSED(menu); | 127 | void renameTab(int index); | ||
271 | } | 128 | ViewManager *connectedViewManager(); | ||
129 | void currentTabChanged(int index); | ||||
130 | void closeCurrentTab(); | ||||
131 | void wheelScrolled(int delta); | ||||
272 | 132 | | |||
273 | Q_SIGNALS: | 133 | void tabDoubleClicked(int index); | ||
274 | /** Emitted when the container is deleted */ | 134 | void openTabContextMenu(const QPoint &point); | ||
sandsmark: document these as well | |||||
275 | void destroyed(ViewContainer *container); | | |||
fwiw, I think this is what caused the warning to appear, in ViewSplitter::registerContainer(). be careful with fixing it, though, as the comment in registerContainer() warns about weird crashes. sandsmark: fwiw, I think this is what caused the warning to appear, in ViewSplitter::registerContainer(). | |||||
276 | 135 | | |||
136 | Q_SIGNALS: | ||||
277 | /** Emitted when the container has no more children */ | 137 | /** Emitted when the container has no more children */ | ||
278 | void empty(ViewContainer *container); | 138 | void empty(TabbedViewContainer *container); | ||
279 | 139 | | |||
280 | /** Emitted when the user requests to open a new view */ | 140 | /** Emitted when the user requests to open a new view */ | ||
281 | void newViewRequest(); | 141 | void newViewRequest(); | ||
282 | 142 | | |||
283 | /** Requests creation of a new view, with the selected profile. */ | 143 | /** Requests creation of a new view, with the selected profile. */ | ||
284 | void newViewRequest(Profile::Ptr); | 144 | void newViewRequest(Profile::Ptr); | ||
285 | 145 | | |||
286 | /** | 146 | /** | ||
sandsmark: document this | |||||
287 | * Emitted when the user requests to move a view from another container | 147 | * Emitted when the user requests to move a view from another container | ||
288 | * into this container. If 'success' is set to true by a connected slot | 148 | * into this container. If 'success' is set to true by a connected slot | ||
289 | * then the original view will be removed. | 149 | * then the original view will be removed. | ||
290 | * | 150 | * | ||
291 | * @param index Index at which to insert the new view in the container or -1 | 151 | * @param index Index at which to insert the new view in the container or -1 | ||
292 | * to append it. This index should be passed to addView() when the new view | 152 | * to append it. This index should be passed to addView() when the new view | ||
293 | * has been created. | 153 | * has been created. | ||
294 | * @param id The identifier of the view. | 154 | * @param id The identifier of the view. | ||
295 | * @param success The slot handling this signal should set this to true if the | 155 | * @param success The slot handling this signal should set this to true if the | ||
296 | * new view was successfully created. | 156 | * new view was successfully created. | ||
297 | * @param sourceContainer Initial move event Tabbed view container. | 157 | * @param sourceContainer Initial move event Tabbed view container. | ||
298 | */ | 158 | */ | ||
299 | void moveViewRequest(int index, int id, bool &success, TabbedViewContainer *sourceContainer); | 159 | void moveViewRequest(int index, int id, bool &success, TabbedViewContainer *sourceContainer); | ||
300 | 160 | | |||
301 | /** Emitted when the active view changes */ | 161 | /** Emitted when the active view changes */ | ||
302 | void activeViewChanged(QWidget *view); | 162 | void activeViewChanged(QWidget *view); | ||
303 | 163 | | |||
304 | /** Emitted when a view is added to the container. */ | 164 | /** Emitted when a view is added to the container. */ | ||
305 | void viewAdded(QWidget *view, ViewProperties *properties); | 165 | void viewAdded(QWidget *view, ViewProperties *properties); | ||
306 | 166 | | |||
307 | /** Emitted when a view is removed from the container. */ | 167 | /** Emitted when a view is removed from the container. */ | ||
308 | void viewRemoved(QWidget *view); | 168 | void viewRemoved(QWidget *view); | ||
309 | 169 | | |||
310 | protected: | 170 | protected: | ||
311 | /** | | |||
312 | * Performs the task of adding the view widget | | |||
313 | * to the container widget. | | |||
314 | */ | | |||
315 | virtual void addViewWidget(QWidget *view, int index) = 0; | | |||
316 | /** | | |||
317 | * Performs the task of removing the view widget | | |||
318 | * from the container widget. | | |||
319 | */ | | |||
320 | virtual void removeViewWidget(QWidget *view) = 0; | | |||
321 | | ||||
322 | /** | | |||
323 | * Called when the navigation display mode changes. | | |||
324 | * See setNavigationVisibility | | |||
325 | */ | | |||
326 | virtual void navigationVisibilityChanged(NavigationVisibility) | | |||
327 | { | | |||
328 | } | | |||
329 | | ||||
330 | /** | | |||
331 | * Called when the navigation tab width expanding option changes. | | |||
332 | * See setNavigationTabWidthExpanding | | |||
333 | */ | | |||
334 | virtual void navigationTabWidthExpandingChanged(bool) | | |||
335 | { | | |||
336 | } | | |||
337 | | ||||
338 | /** | | |||
339 | * Called when the navigation position changes to re-layout | | |||
340 | * the container and place the navigation widget in the | | |||
341 | * specified position. | | |||
342 | */ | | |||
343 | virtual void navigationPositionChanged(NavigationPosition) | | |||
344 | { | | |||
345 | } | | |||
346 | | ||||
347 | virtual void navigationTextModeChanged(bool) | | |||
348 | { | | |||
349 | } | | |||
350 | | ||||
351 | /** Returns the widgets which are associated with a particular navigation item */ | 171 | /** Returns the widgets which are associated with a particular navigation item */ | ||
352 | QList<QWidget *> widgetsForItem(ViewProperties *item) const; | 172 | QList<QWidget *> widgetsForItem(ViewProperties *item) const; | ||
353 | 173 | | |||
354 | /** | 174 | /** | ||
355 | * Rearranges the order of widgets in the container. | 175 | * Rearranges the order of widgets in the container. | ||
356 | * | 176 | * | ||
357 | * @param fromIndex Current index of the widget to move | 177 | * @param fromIndex Current index of the widget to move | ||
358 | * @param toIndex New index for the widget | 178 | * @param toIndex New index for the widget | ||
359 | */ | 179 | */ | ||
360 | virtual void moveViewWidget(int fromIndex, int toIndex); | 180 | void moveViewWidget(int fromIndex, int toIndex); | ||
181 | | ||||
182 | // close tabs and unregister | ||||
183 | void closeTerminalTab(int index); | ||||
361 | 184 | | |||
362 | private Q_SLOTS: | 185 | private Q_SLOTS: | ||
363 | void viewDestroyed(QObject *view); | 186 | void viewDestroyed(QObject *view); | ||
364 | void searchBarDestroyed(); | 187 | void konsoleConfigChanged(); | ||
365 | 188 | | |||
366 | private: | 189 | private: | ||
367 | Q_DISABLE_COPY(ViewContainer) | | |||
368 | | ||||
369 | void forgetView(QWidget *view); | 190 | void forgetView(QWidget *view); | ||
370 | 191 | | |||
371 | NavigationVisibility _navigationVisibility; | | |||
372 | NavigationPosition _navigationPosition; | | |||
373 | QList<QWidget *> _views; | | |||
374 | QHash<QWidget *, ViewProperties *> _navigation; | 192 | QHash<QWidget *, ViewProperties *> _navigation; | ||
375 | Features _features; | | |||
376 | IncrementalSearchBar *_searchBar; | | |||
377 | }; | | |||
378 | Q_DECLARE_OPERATORS_FOR_FLAGS(ViewContainer::Features) | | |||
379 | | ||||
380 | class ViewContainerTabBar; | | |||
381 | class ViewManager; | | |||
382 | | ||||
383 | /** | | |||
384 | * An alternative tabbed view container which uses a QTabBar and QStackedWidget | | |||
385 | * combination for navigation instead of QTabWidget | | |||
386 | */ | | |||
387 | class TabbedViewContainer : public ViewContainer | | |||
388 | { | | |||
389 | Q_OBJECT | | |||
390 | | ||||
391 | public: | | |||
392 | /** | | |||
393 | * Constructs a new tabbed view container. Supported positions | | |||
394 | * are NavigationPositionTop and NavigationPositionBottom. | | |||
395 | */ | | |||
396 | TabbedViewContainer(NavigationPosition position, ViewManager *connectedViewManager, | | |||
397 | QObject *parent); | | |||
398 | ~TabbedViewContainer() Q_DECL_OVERRIDE; | | |||
399 | | ||||
400 | QWidget *containerWidget() const Q_DECL_OVERRIDE; | | |||
401 | QWidget *activeView() const Q_DECL_OVERRIDE; | | |||
402 | void setActiveView(QWidget *view) Q_DECL_OVERRIDE; | | |||
403 | QList<NavigationPosition> supportedNavigationPositions() const Q_DECL_OVERRIDE; | | |||
404 | void setFeatures(Features features) Q_DECL_OVERRIDE; | | |||
405 | Features supportedFeatures() const Q_DECL_OVERRIDE; | | |||
406 | void setNewViewMenu(QMenu *menu) Q_DECL_OVERRIDE; | | |||
407 | void setStyleSheet(const QString &styleSheet) Q_DECL_OVERRIDE; | | |||
408 | void setTabBarVisible(bool visible); | | |||
409 | | ||||
410 | // return associated view manager | | |||
411 | ViewManager *connectedViewManager(); | | |||
412 | | ||||
413 | protected: | | |||
414 | void addViewWidget(QWidget *view, int index) Q_DECL_OVERRIDE; | | |||
415 | void removeViewWidget(QWidget *view) Q_DECL_OVERRIDE; | | |||
416 | void navigationVisibilityChanged(NavigationVisibility mode) Q_DECL_OVERRIDE; | | |||
417 | void navigationPositionChanged(NavigationPosition position) Q_DECL_OVERRIDE; | | |||
418 | void navigationTabWidthExpandingChanged(bool expand) Q_DECL_OVERRIDE; | | |||
419 | void navigationTextModeChanged(bool useTextWidth) Q_DECL_OVERRIDE; | | |||
420 | void moveViewWidget(int fromIndex, int toIndex) Q_DECL_OVERRIDE; | | |||
421 | | ||||
422 | private Q_SLOTS: | | |||
423 | void updateTitle(ViewProperties *item); | | |||
424 | void updateIcon(ViewProperties *item); | | |||
425 | void updateActivity(ViewProperties *item); | | |||
426 | void currentTabChanged(int index); | | |||
427 | void closeCurrentTab(); | | |||
428 | void wheelScrolled(int delta); | | |||
429 | | ||||
430 | void tabDoubleClicked(int index); | | |||
431 | void openTabContextMenu(const QPoint &point); | | |||
432 | void tabContextMenuCloseTab(); | | |||
433 | void tabContextMenuRenameTab(); | | |||
434 | void tabContextMenuDetachTab(); | | |||
435 | void startTabDrag(int index); | | |||
436 | void querySourceIndex(const QDropEvent *event, int &sourceIndex); | | |||
437 | void onMoveViewRequest(int index, const QDropEvent *event, bool &success, | | |||
438 | TabbedViewContainer *sourceTabbedContainer); | | |||
439 | | ||||
440 | Q_SIGNALS: | | |||
441 | void detachTab(ViewContainer *self, QWidget *activeView); | | |||
442 | void closeTab(ViewContainer *self, QWidget *activeView); | | |||
443 | | ||||
444 | private: | | |||
445 | Q_DISABLE_COPY(TabbedViewContainer) | | |||
446 | | ||||
447 | void dynamicTabBarVisibility(); | | |||
448 | void setTabActivity(int index, bool activity); | | |||
449 | void renameTab(int index); | | |||
450 | void updateVisibilityOfQuickButtons(); | | |||
451 | void widgetRemoved(int index); | | |||
452 | | ||||
453 | ViewContainerTabBar *_tabBar; | | |||
454 | QPointer<QStackedWidget> _stackWidget; | | |||
455 | QPointer<QWidget> _containerWidget; | | |||
456 | ViewManager *_connectedViewManager; | 193 | ViewManager *_connectedViewManager; | ||
457 | QVBoxLayout *_layout; | | |||
458 | QHBoxLayout *_tabBarLayout; | | |||
459 | QToolButton *_newTabButton; | | |||
460 | QToolButton *_closeTabButton; | | |||
461 | int _contextMenuTabIndex; | | |||
462 | QMenu *_contextPopupMenu; | 194 | QMenu *_contextPopupMenu; | ||
195 | QToolButton *_newTabButton; | ||||
463 | }; | 196 | }; | ||
464 | 197 | | |||
198 | | ||||
465 | } | 199 | } | ||
466 | #endif //VIEWCONTAINER_H | 200 | #endif //VIEWCONTAINER_H |
document these