Changeset View
Changeset View
Standalone View
Standalone View
src/ViewManager.h
Show All 21 Lines | |||||
22 | 22 | | |||
23 | // Qt | 23 | // Qt | ||
24 | #include <QHash> | 24 | #include <QHash> | ||
25 | #include <QObject> | 25 | #include <QObject> | ||
26 | #include <QPointer> | 26 | #include <QPointer> | ||
27 | 27 | | |||
28 | // Konsole | 28 | // Konsole | ||
29 | #include "Profile.h" | 29 | #include "Profile.h" | ||
30 | #include "ViewContainer.h" | | |||
31 | 30 | | |||
32 | class KActionCollection; | 31 | class KActionCollection; | ||
33 | class KConfigGroup; | 32 | class KConfigGroup; | ||
34 | 33 | | |||
35 | namespace Konsole { | 34 | namespace Konsole { | ||
36 | class ColorScheme; | 35 | class ColorScheme; | ||
37 | class IncrementalSearchBar; | | |||
38 | class Session; | 36 | class Session; | ||
39 | class TerminalDisplay; | 37 | class TerminalDisplay; | ||
40 | 38 | class TabbedViewContainer; | |||
41 | class SessionController; | 39 | class SessionController; | ||
42 | class ViewProperties; | 40 | class ViewProperties; | ||
43 | class ViewSplitter; | 41 | class ViewSplitter; | ||
44 | 42 | | |||
45 | /** | 43 | /** | ||
46 | * Manages the terminal display widgets in a Konsole window or part. | 44 | * Manages the terminal display widgets in a Konsole window or part. | ||
47 | * | 45 | * | ||
48 | * When a view manager is created, it constructs a splitter widget ( accessed via | 46 | * When a view manager is created, it constructs a splitter widget ( accessed via | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 67 | public: | |||
149 | 147 | | |||
150 | /** | 148 | /** | ||
151 | * Returns the controller for the active view. activeViewChanged() is | 149 | * Returns the controller for the active view. activeViewChanged() is | ||
152 | * emitted when this changes. | 150 | * emitted when this changes. | ||
153 | */ | 151 | */ | ||
154 | SessionController *activeViewController() const; | 152 | SessionController *activeViewController() const; | ||
155 | 153 | | |||
156 | /** | 154 | /** | ||
157 | * Returns the search bar. | | |||
158 | */ | | |||
159 | IncrementalSearchBar *searchBar() const; | | |||
sandsmark: isn't this a semi-public header? in that case this breaks api and abi. it's a private library… | |||||
Yes, it breaks API and ABI. I request some help here as the idea of a searchBar() method *here* in the viewManager was when we had only *one* searchBar() that was reparented whenever we requested it. but now the TerminalDisplay has it's searchBar() internally and we don't share the instances. (this fixed around quite a few bugs actually), so in my perspective, this is inside the konsole private library and it actually should be removed as there's no searchBar() being managed by the viewManager anymore. tcanabrava: Yes, it breaks API and ABI. I request some help here as the idea of a searchBar() method *here*… | |||||
160 | | ||||
161 | /** | | |||
162 | * Session management | 155 | * Session management | ||
163 | */ | 156 | */ | ||
164 | void saveSessions(KConfigGroup &group); | 157 | void saveSessions(KConfigGroup &group); | ||
165 | void restoreSessions(const KConfigGroup &group); | 158 | void restoreSessions(const KConfigGroup &group); | ||
166 | 159 | | |||
167 | void setNavigationVisibility(int visibility); | | |||
168 | void setNavigationPosition(int position); | | |||
169 | void setNavigationBehavior(int behavior); | | |||
170 | void setNavigationTabWidthExpanding(bool expand); | | |||
171 | void setNavigationStyleSheet(const QString &styleSheet); | | |||
172 | void setShowQuickButtons(bool show); | | |||
173 | | ||||
174 | int managerId() const; | 160 | int managerId() const; | ||
175 | 161 | | |||
176 | /** Returns a list of sessions in this ViewManager */ | 162 | /** Returns a list of sessions in this ViewManager */ | ||
177 | QList<Session *> sessions() | 163 | QList<Session *> sessions() | ||
178 | { | 164 | { | ||
179 | return _sessionMap.values(); | 165 | return _sessionMap.values(); | ||
180 | } | 166 | } | ||
181 | 167 | | |||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 223 | public Q_SLOTS: | |||
290 | Q_SCRIPTABLE void moveSessionLeft(); | 276 | Q_SCRIPTABLE void moveSessionLeft(); | ||
291 | 277 | | |||
292 | /** DBus slot that Switches the current session (as returned by | 278 | /** DBus slot that Switches the current session (as returned by | ||
293 | * currentSession()) with the right (or next) one in the navigation | 279 | * currentSession()) with the right (or next) one in the navigation | ||
294 | * tab. | 280 | * tab. | ||
295 | */ | 281 | */ | ||
296 | Q_SCRIPTABLE void moveSessionRight(); | 282 | Q_SCRIPTABLE void moveSessionRight(); | ||
297 | 283 | | |||
298 | /** DBus slot that sets ALL tabs' width to match their text */ | | |||
299 | Q_SCRIPTABLE void setTabWidthToText(bool); | | |||
sandsmark: this breaks the dbus API (and the setting, as noted elsewhere). | |||||
300 | | ||||
301 | private Q_SLOTS: | 284 | private Q_SLOTS: | ||
302 | // called when the "Split View Left/Right" menu item is selected | 285 | // called when the "Split View Left/Right" menu item is selected | ||
303 | void splitLeftRight(); | 286 | void splitLeftRight(); | ||
304 | void splitTopBottom(); | 287 | void splitTopBottom(); | ||
305 | void closeActiveContainer(); | 288 | void closeActiveContainer(); | ||
306 | void closeOtherContainers(); | 289 | void closeOtherContainers(); | ||
307 | void expandActiveContainer(); | 290 | void expandActiveContainer(); | ||
308 | void shrinkActiveContainer(); | 291 | void shrinkActiveContainer(); | ||
Show All 26 Lines | |||||
335 | // called when "Switch to last tab" shortcut is activated | 318 | // called when "Switch to last tab" shortcut is activated | ||
336 | void lastView(); | 319 | void lastView(); | ||
337 | 320 | | |||
338 | // called when "Next View Container" shortcut is activated | 321 | // called when "Next View Container" shortcut is activated | ||
339 | void nextContainer(); | 322 | void nextContainer(); | ||
340 | 323 | | |||
341 | // called when the views in a container owned by this view manager | 324 | // called when the views in a container owned by this view manager | ||
342 | // changes | 325 | // changes | ||
343 | void containerViewsChanged(ViewContainer *container); | 326 | void containerViewsChanged(TabbedViewContainer *container); | ||
344 | 327 | | |||
345 | // called when a profile changes | 328 | // called when a profile changes | ||
346 | void profileChanged(Profile::Ptr profile); | 329 | void profileChanged(Profile::Ptr profile); | ||
347 | 330 | | |||
348 | void updateViewsForSession(Session *session); | 331 | void updateViewsForSession(Session *session); | ||
349 | 332 | | |||
350 | // moves active view to the left | 333 | // moves active view to the left | ||
351 | void moveActiveViewLeft(); | 334 | void moveActiveViewLeft(); | ||
352 | // moves active view to the right | 335 | // moves active view to the right | ||
353 | void moveActiveViewRight(); | 336 | void moveActiveViewRight(); | ||
354 | // switches to the view at visual position 'index' | 337 | // switches to the view at visual position 'index' | ||
355 | // in the current container | 338 | // in the current container | ||
356 | void switchToView(int index); | 339 | void switchToView(int index); | ||
357 | 340 | | |||
358 | // called when a SessionController gains focus | 341 | // called when a SessionController gains focus | ||
359 | void controllerChanged(SessionController *controller); | 342 | void controllerChanged(SessionController *controller); | ||
360 | 343 | | |||
361 | // called when a ViewContainer requests a view be | 344 | // called when a ViewContainer requests a view be | ||
362 | // moved | 345 | // moved | ||
363 | void containerMoveViewRequest(int index, int id, bool &success, | 346 | void containerMoveViewRequest(int index, int id, bool &success, | ||
364 | TabbedViewContainer *sourceTabbedContainer); | 347 | TabbedViewContainer *sourceTabbedContainer); | ||
365 | 348 | | |||
366 | void detachView(ViewContainer *container, QWidget *view); | 349 | void detachView(TabbedViewContainer *container, QWidget *view); | ||
367 | | ||||
368 | void closeTabFromContainer(ViewContainer *container, QWidget *tab); | | |||
369 | 350 | | |||
370 | private: | 351 | private: | ||
371 | Q_DISABLE_COPY(ViewManager) | 352 | Q_DISABLE_COPY(ViewManager) | ||
372 | 353 | | |||
373 | void createView(Session *session, ViewContainer *container, int index); | 354 | void createView(Session *session, TabbedViewContainer *container, int index); | ||
374 | static const ColorScheme *colorSchemeForProfile(const Profile::Ptr profile); | 355 | static const ColorScheme *colorSchemeForProfile(const Profile::Ptr profile); | ||
375 | 356 | | |||
376 | void setupActions(); | 357 | void setupActions(); | ||
377 | 358 | | |||
378 | // takes a view from a view container owned by a different manager and places it in | 359 | // takes a view from a view container owned by a different manager and places it in | ||
379 | // newContainer owned by this manager | 360 | // newContainer owned by this manager | ||
380 | void takeView(ViewManager *otherManager, ViewContainer *otherContainer, | 361 | void takeView(ViewManager *otherManager, TabbedViewContainer *otherContainer, | ||
381 | ViewContainer *newContainer, TerminalDisplay *view); | 362 | TabbedViewContainer *newContainer, TerminalDisplay *view); | ||
382 | void splitView(Qt::Orientation orientation); | 363 | void splitView(Qt::Orientation orientation); | ||
383 | 364 | | |||
384 | // creates a new container which can hold terminal displays | 365 | // creates a new container which can hold terminal displays | ||
385 | ViewContainer *createContainer(); | 366 | TabbedViewContainer *createContainer(); | ||
386 | // removes a container and emits appropriate signals | 367 | // removes a container and emits appropriate signals | ||
387 | void removeContainer(ViewContainer *container); | 368 | void removeContainer(TabbedViewContainer *container); | ||
388 | 369 | | |||
389 | // creates a new terminal display | 370 | // creates a new terminal display | ||
390 | // the 'session' is used so that the terminal display's random seed | 371 | // the 'session' is used so that the terminal display's random seed | ||
391 | // can be set to something which depends uniquely on that session | 372 | // can be set to something which depends uniquely on that session | ||
392 | TerminalDisplay *createTerminalDisplay(Session *session = nullptr); | 373 | TerminalDisplay *createTerminalDisplay(Session *session = nullptr); | ||
393 | 374 | | |||
394 | // creates a new controller for a session/display pair which provides the menu | 375 | // creates a new controller for a session/display pair which provides the menu | ||
395 | // actions associated with that view, and exposes basic information | 376 | // actions associated with that view, and exposes basic information | ||
396 | // about the session ( such as title and associated icon ) to the display. | 377 | // about the session ( such as title and associated icon ) to the display. | ||
397 | SessionController *createController(Session *session, TerminalDisplay *view); | 378 | SessionController *createController(Session *session, TerminalDisplay *view); | ||
398 | 379 | | |||
399 | // Sets the possible features for a container. | | |||
400 | void setContainerFeatures(ViewContainer* container); | | |||
401 | | ||||
402 | private: | 380 | private: | ||
403 | QPointer<ViewSplitter> _viewSplitter; | 381 | QPointer<ViewSplitter> _viewSplitter; | ||
404 | QPointer<SessionController> _pluggedController; | 382 | QPointer<SessionController> _pluggedController; | ||
405 | 383 | | |||
406 | QHash<TerminalDisplay *, Session *> _sessionMap; | 384 | QHash<TerminalDisplay *, Session *> _sessionMap; | ||
407 | 385 | | |||
408 | KActionCollection *_actionCollection; | 386 | KActionCollection *_actionCollection; | ||
409 | 387 | | |||
410 | NavigationMethod _navigationMethod; | 388 | NavigationMethod _navigationMethod; | ||
411 | | ||||
412 | ViewContainer::NavigationVisibility _navigationVisibility; | | |||
413 | ViewContainer::NavigationPosition _navigationPosition; | | |||
414 | bool _showQuickButtons; | | |||
415 | bool _navigationTabWidthExpanding; | | |||
416 | NewTabBehavior _newTabBehavior; | | |||
417 | QString _navigationStyleSheet; | 389 | QString _navigationStyleSheet; | ||
it seems like you removed all use of this, so can probably just remove this as well? sandsmark: it seems like you removed all use of this, so can probably just remove this as well? | |||||
418 | | ||||
419 | int _managerId; | 390 | int _managerId; | ||
420 | static int lastManagerId; | 391 | static int lastManagerId; | ||
421 | }; | 392 | }; | ||
422 | } | 393 | } | ||
423 | 394 | | |||
424 | #endif | 395 | #endif |
isn't this a semi-public header? in that case this breaks api and abi. it's a private library, but I'm not sure how much e. g. yakuake uses.