• Skip to content
  • Skip to link menu
KDE 4.1 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 Session;
00040 class TerminalDisplay;
00041 class Profile;
00042 
00043 class SessionController;
00044 class ViewProperties;
00045 class ViewContainer;
00046 class ViewSplitter;
00047 
00067 class ViewManager : public QObject
00068 {
00069 Q_OBJECT
00070 
00071 public:
00077     ViewManager(QObject* parent , KActionCollection* collection);
00078     ~ViewManager();
00079 
00084     void createView(Session* session);
00085 
00091     void applyProfile(TerminalDisplay* view , const Profile::Ptr profile
00092                     , bool applyContainerSettings);
00093 
00098     QWidget* widget() const;
00099 
00103     QWidget* activeView() const;
00104 
00112     QList<ViewProperties*> viewProperties() const;
00113 
00119     enum NavigationMethod
00120     {
00125         TabbedNavigation,
00127         NoNavigation
00128     };
00129 
00137     void setNavigationMethod(NavigationMethod method);
00138 
00143     NavigationMethod navigationMethod() const;
00144 
00149     SessionController* activeViewController() const;
00150 
00151 signals:
00153     void empty();
00154 
00156     void viewDetached(Session* session);
00157 
00162     void activeViewChanged(SessionController* controller);
00163 
00169     void viewPropertiesChanged(const QList<ViewProperties*>& propertiesList);
00170 
00179     void splitViewToggle(bool multipleViews);
00180 
00185     void setMenuBarVisibleRequest(bool);
00186 
00188     void newViewRequest();
00190     void newViewRequest(Profile::Ptr);
00191 
00192 private slots:
00193     // called when the "Split View Left/Right" menu item is selected
00194     void splitLeftRight();
00195     void splitTopBottom();
00196     void closeActiveView();
00197     void closeOtherViews();
00198     void expandActiveView();
00199     void shrinkActiveView();
00200 
00201     // called when the "Detach View" menu item is selected
00202     void detachActiveView();
00203     void updateDetachViewState();
00204 
00205     // called when a session terminates - the view manager will delete any
00206     // views associated with the session
00207     void sessionFinished();
00208     // called when the container requests to close a particular view
00209     void viewCloseRequest(QWidget* widget);
00210 
00211     // controller detects when an associated view is given the focus
00212     // and emits a signal.  ViewManager listens for that signal
00213     // and then plugs the action into the UI
00214     //void viewFocused( SessionController* controller );
00215 
00216     // called when the active view in a ViewContainer changes, so
00217     // that we can plug the appropriate actions into the UI
00218     void viewActivated( QWidget* view );
00219 
00220     // called when "Next View" shortcut is activated
00221     void nextView();
00222 
00223     // called when "Previous View" shortcut is activated
00224     void previousView();
00225 
00226     // called when "Next View Container" shortcut is activated
00227     void nextContainer();
00228 
00229     // called when the views in a container owned by this view manager
00230     // changes
00231     void containerViewsChanged(QObject* container);
00232 
00233     // called when a profile changes
00234     void profileChanged(Profile::Ptr profile);
00235 
00236     void updateViewsForSession(Session* session);
00237 
00238     // moves active view to the left
00239     void moveActiveViewLeft();
00240     // moves active view to the right
00241     void moveActiveViewRight();
00242 
00243     // called when a SessionController gains focus
00244     void controllerChanged(SessionController* controller);
00245 
00246     // called when a ViewContainer requests a view be 
00247     // moved 
00248     void containerMoveViewRequest(int index, int id, bool& success);
00249 
00250 private:
00251     void createView(Session* session, ViewContainer* container, int index);
00252     const ColorScheme* colorSchemeForProfile(const Profile::Ptr profile) const;
00253 
00254     void setupActions();
00255     void focusActiveView();
00256     void registerView(TerminalDisplay* view);
00257     void unregisterView(TerminalDisplay* view);
00258   
00259     // takes a view from a view container owned by a different manager and places it in 
00260     // newContainer owned by this manager
00261     void takeView(ViewManager* otherManager , ViewContainer* otherContainer, ViewContainer* newContainer, TerminalDisplay* view); 
00262     void splitView(Qt::Orientation orientation);
00263     
00264     // creates a new container which can hold terminal displays
00265     // 'profile' specifies the profile to use to get initial
00266     // settings (eg. navigation position) for the container
00267     ViewContainer* createContainer(const Profile::Ptr profile);
00268     // removes a container and emits appropriate signals
00269     void removeContainer(ViewContainer* container);
00270 
00271     // creates a new terminal display
00272     // the 'session' is used so that the terminal display's random seed
00273     // can be set to something which depends uniquely on that session
00274     TerminalDisplay* createTerminalDisplay(Session* session = 0);
00275     
00276     // creates a new controller for a session/display pair which provides the menu
00277     // actions associated with that view, and exposes basic information
00278     // about the session ( such as title and associated icon ) to the display.
00279     SessionController* createController(Session* session , TerminalDisplay* display);
00280 
00281     // create menu for 'new tab' button
00282     QMenu* createNewViewMenu();
00283 private:
00284     QPointer<ViewSplitter>          _viewSplitter;
00285     QPointer<SessionController>     _pluggedController;
00286     
00287     QHash<TerminalDisplay*,Session*> _sessionMap;
00288 
00289     KActionCollection*                  _actionCollection;
00290     QSignalMapper*                      _containerSignalMapper;
00291     NavigationMethod                _navigationMethod;
00292 
00293     QMenu* _newViewMenu;
00294 };
00295 
00296 }
00297 
00298 #endif

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.4
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