• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

ViewManager.h

Go to the documentation of this file.
00001 /*
00002     Copyright 2006-2008 by Robert Knight <robertknight@gmail.com>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301  USA.
00018 */
00019 
00020 #ifndef VIEWMANAGER_H
00021 #define VIEWMANAGER_H
00022 
00023 // Qt
00024 #include <QtCore/QHash>
00025 #include <QtCore/QObject>
00026 #include <QtCore/QPointer>
00027 
00028 // Konsole
00029 #include "Profile.h"
00030 
00031 class QSignalMapper;
00032 class QMenu;
00033 class KActionCollection;
00034 
00035 namespace Konsole
00036 {
00037 
00038 class ColorScheme;
00039 class IncrementalSearchBar;
00040 class Session;
00041 class TerminalDisplay;
00042 class Profile;
00043 
00044 class SessionController;
00045 class ViewProperties;
00046 class ViewContainer;
00047 class ViewSplitter;
00048 
00068 class ViewManager : public QObject
00069 {
00070 Q_OBJECT
00071 
00072 public:
00078     ViewManager(QObject* parent , KActionCollection* collection);
00079     ~ViewManager();
00080 
00085     void createView(Session* session);
00086 
00092     void applyProfile(TerminalDisplay* view , const Profile::Ptr profile
00093                     , bool applyContainerSettings);
00094 
00099     QWidget* widget() const;
00100 
00104     QWidget* activeView() const;
00105 
00113     QList<ViewProperties*> viewProperties() const;
00114 
00120     enum NavigationMethod
00121     {
00126         TabbedNavigation,
00128         NoNavigation
00129     };
00130 
00138     void setNavigationMethod(NavigationMethod method);
00139 
00144     NavigationMethod navigationMethod() const;
00145 
00150     SessionController* activeViewController() const;
00151 
00155     IncrementalSearchBar* searchBar() const;
00156 
00160     void saveSessions(KConfigGroup& group);
00161     void restoreSessions(const KConfigGroup& group);
00162 
00163 signals:
00165     void empty();
00166 
00168     void viewDetached(Session* session);
00169 
00174     void activeViewChanged(SessionController* controller);
00175 
00181     void viewPropertiesChanged(const QList<ViewProperties*>& propertiesList);
00182 
00191     void splitViewToggle(bool multipleViews);
00192 
00197     void setMenuBarVisibleRequest(bool);
00198 
00200     void newViewRequest();
00202     void newViewRequest(Profile::Ptr);
00203 
00204 private slots:
00205     // called when the "Split View Left/Right" menu item is selected
00206     void splitLeftRight();
00207     void splitTopBottom();
00208     void closeActiveView();
00209     void closeOtherViews();
00210     void expandActiveView();
00211     void shrinkActiveView();
00212 
00213     // called when the "Detach View" menu item is selected
00214     void detachActiveView();
00215     void updateDetachViewState();
00216 
00217     // called when a session terminates - the view manager will delete any
00218     // views associated with the session
00219     void sessionFinished();
00220     // called when the container requests to close a particular view
00221     void viewCloseRequest(QWidget* widget);
00222 
00223     // controller detects when an associated view is given the focus
00224     // and emits a signal.  ViewManager listens for that signal
00225     // and then plugs the action into the UI
00226     //void viewFocused( SessionController* controller );
00227 
00228     // called when the active view in a ViewContainer changes, so
00229     // that we can plug the appropriate actions into the UI
00230     void viewActivated( QWidget* view );
00231 
00232     // called when "Next View" shortcut is activated
00233     void nextView();
00234 
00235     // called when "Previous View" shortcut is activated
00236     void previousView();
00237 
00238     // called when "Next View Container" shortcut is activated
00239     void nextContainer();
00240 
00241     // called when the views in a container owned by this view manager
00242     // changes
00243     void containerViewsChanged(QObject* container);
00244 
00245     // called when a profile changes
00246     void profileChanged(Profile::Ptr profile);
00247 
00248     void updateViewsForSession(Session* session);
00249 
00250     // moves active view to the left
00251     void moveActiveViewLeft();
00252     // moves active view to the right
00253     void moveActiveViewRight();
00254     // switches to the view at visual position 'index' 
00255     // in the current container
00256     void switchToView(int index);
00257 
00258     // called when a SessionController gains focus
00259     void controllerChanged(SessionController* controller);
00260 
00261     // called when a ViewContainer requests a view be 
00262     // moved 
00263     void containerMoveViewRequest(int index, int id, bool& success);
00264 
00265 private:
00266     void createView(Session* session, ViewContainer* container, int index);
00267     const ColorScheme* colorSchemeForProfile(const Profile::Ptr profile) const;
00268 
00269     void setupActions();
00270     void focusActiveView();
00271     void registerView(TerminalDisplay* view);
00272     void unregisterView(TerminalDisplay* view);
00273   
00274     // takes a view from a view container owned by a different manager and places it in 
00275     // newContainer owned by this manager
00276     void takeView(ViewManager* otherManager , ViewContainer* otherContainer, ViewContainer* newContainer, TerminalDisplay* view); 
00277     void splitView(Qt::Orientation orientation);
00278     
00279     // creates a new container which can hold terminal displays
00280     // 'profile' specifies the profile to use to get initial
00281     // settings (eg. navigation position) for the container
00282     ViewContainer* createContainer(const Profile::Ptr profile);
00283     // removes a container and emits appropriate signals
00284     void removeContainer(ViewContainer* container);
00285 
00286     // creates a new terminal display
00287     // the 'session' is used so that the terminal display's random seed
00288     // can be set to something which depends uniquely on that session
00289     TerminalDisplay* createTerminalDisplay(Session* session = 0);
00290     
00291     // creates a new controller for a session/display pair which provides the menu
00292     // actions associated with that view, and exposes basic information
00293     // about the session ( such as title and associated icon ) to the display.
00294     SessionController* createController(Session* session , TerminalDisplay* display);
00295 
00296     // create menu for 'new tab' button
00297     QMenu* createNewViewMenu();
00298 private:
00299     QPointer<ViewSplitter>          _viewSplitter;
00300     QPointer<SessionController>     _pluggedController;
00301     
00302     QHash<TerminalDisplay*,Session*> _sessionMap;
00303 
00304     KActionCollection*                  _actionCollection;
00305     QSignalMapper*                      _containerSignalMapper;
00306     NavigationMethod                _navigationMethod;
00307 
00308     QMenu* _newViewMenu;
00309 };
00310 
00311 }
00312 
00313 #endif
00314 
00315 /*
00316   Local Variables:
00317   mode: c++
00318   c-file-style: "stroustrup"
00319   indent-tabs-mode: nil
00320   tab-width: 4
00321   End:
00322 */

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal