add more spacing
[personal-kdebase.git] / apps / konsole / src / Application.h
blob2e3ce856df3199c72a84f85951ec9a795d4160e7
1 /*
2 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
20 #ifndef APPLICATION_H
21 #define APPLICATION_H
23 // KDE
24 #include <KUniqueApplication>
26 // Konsole
27 #include "Profile.h"
29 class KCmdLineArgs;
31 namespace Konsole
33 class ProfileList;
34 class ViewManager;
35 class MainWindow;
36 class Session;
38 /**
39 * The Konsole Application.
41 * The application consists of one or more main windows and a set of factories to create
42 * new sessions and views.
44 * To create a new main window with a default terminal session, call the newInstance() method.
45 * Empty main windows can be created using newMainWindow().
47 * The factory used to create new terminal sessions can be retrieved using the sessionManager() accessor.
49 class Application : public KUniqueApplication
51 Q_OBJECT
53 public:
54 /** Constructs a new Konsole application. */
55 #ifdef Q_WS_X11
56 Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap);
57 #endif
59 /** Constructs a new Konsole application. */
60 Application();
62 virtual ~Application();
64 /** Creates a new main window and opens a default terminal session */
65 virtual int newInstance();
67 /**
68 * Creates a new, empty main window and connects to its newSessionRequest()
69 * and newWindowRequest() signals to trigger creation of new sessions or
70 * windows when then they are emitted.
72 MainWindow* newMainWindow();
74 /** Returns the Application instance */
75 static Application* self();
77 private slots:
78 Session* createSession(Profile::Ptr profile, const QString& directory , ViewManager* view);
79 void createWindow(Profile::Ptr profile , const QString& directory);
80 void detachView(Session* session);
82 void toggleBackgroundInstance();
84 private:
85 void init();
86 void listAvailableProfiles();
87 void startBackgroundMode(MainWindow* window);
88 bool processHelpArgs(KCmdLineArgs* args);
89 MainWindow* processWindowArgs(KCmdLineArgs* args);
90 void processProfileSelectArgs(KCmdLineArgs* args,MainWindow* window);
91 void processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window);
93 KCmdLineArgs* _arguments;
94 ProfileList* _sessionList;
96 MainWindow* _backgroundInstance;
100 #endif //APPLICATION_H