1 | /*************************************************************************** |
2 | kmag.h - description |
3 | ------------------- |
4 | begin : Mon Feb 12 23:45:41 EST 2001 |
5 | copyright : (C) 2001 by Sarang Lakare |
6 | email : sarang@users.sourceforge.net |
7 | copyright : (C) 2003-2004 by Olaf Schmidt |
8 | email : ojschmidt@kde.org |
9 | copyright : (C) 2008 by Matthew Woehlke |
10 | email : mw_triad@users.sourceforge.net |
11 | copyright (C) 2010 Sebastian Sauer |
12 | email sebsauer@kdab.com |
13 | ***************************************************************************/ |
14 | |
15 | /*************************************************************************** |
16 | * * |
17 | * This program is free software; you can redistribute it and/or modify * |
18 | * it under the terms of the GNU General Public License as published by * |
19 | * the Free Software Foundation; either version 2 of the License, or * |
20 | * (at your option) any later version. * |
21 | * * |
22 | ***************************************************************************/ |
23 | |
24 | #ifndef KMAG_H |
25 | #define KMAG_H |
26 | |
27 | #include "kmagzoomview.h" |
28 | #include "focustrackconfig.h" |
29 | |
30 | // include files for Qt |
31 | #include <QtGui/QContextMenuEvent> |
32 | #include <QtGui/QPrinter> |
33 | |
34 | // include files for KDE |
35 | #include <kxmlguiwindow.h> |
36 | #include <kaction.h> |
37 | #include <knuminput.h> |
38 | #include <kconfig.h> |
39 | |
40 | /** |
41 | * The base class for Kmag application windows. It sets up the main |
42 | * window and reads the config file as well as providing a menubar, toolbar |
43 | * and statusbar. An instance of KmagView creates your center view, which is connected |
44 | * to the window's Doc object. |
45 | * KmagApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports |
46 | * full session management as well as using KActions. |
47 | * @see KXmlGuiWindow |
48 | * @see KApplication |
49 | * @see KConfig |
50 | * |
51 | * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team. |
52 | * @version KDevelop version 1.2 code generation |
53 | */ |
54 | class KmagApp : public KXmlGuiWindow |
55 | { |
56 | Q_OBJECT |
57 | |
58 | public: |
59 | /** |
60 | * Construtor of KmagApp, calls all init functions to create the application. |
61 | */ |
62 | explicit KmagApp(QWidget* parent=0, const char* name=0); |
63 | |
64 | /// Default destructor |
65 | ~KmagApp(); |
66 | |
67 | |
68 | |
69 | protected: |
70 | /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration |
71 | * file |
72 | */ |
73 | void saveOptions(); |
74 | /** read general Options again and initialize all variables like the recent file list |
75 | */ |
76 | void readOptions(); |
77 | /** initializes the KActions of the application */ |
78 | void initActions(); |
79 | |
80 | /** creates the centerwidget of the KTMainWindow instance and sets it as the view |
81 | */ |
82 | void initView(); |
83 | |
84 | /// Initialize all connections |
85 | void initConnections(); |
86 | |
87 | virtual bool queryClose(); |
88 | |
89 | /// Catch context menu events |
90 | void ( QContextMenuEvent * e ); |
91 | |
92 | public slots: |
93 | /** open a new application window by creating a new instance of KmagApp */ |
94 | void slotFileNewWindow(); |
95 | |
96 | /** print the actual file */ |
97 | void slotFilePrint(); |
98 | |
99 | void slotFileQuit(); |
100 | |
101 | /** put the marked text/object into the clipboard |
102 | */ |
103 | void copyToClipBoard(); |
104 | |
105 | /// Toggle the refreshing of the window |
106 | void slotToggleRefresh(); |
107 | |
108 | void slotModeChanged(); |
109 | void slotModeWholeScreen(); |
110 | void slotModeSelWin(); |
111 | |
112 | /// Zooms in |
113 | void zoomIn(); |
114 | |
115 | /// Zooms out |
116 | void zoomOut(); |
117 | |
118 | /// Save the zoomed image |
119 | void saveZoomPixmap(); |
120 | |
121 | /// Sets the zoom index to index |
122 | void setZoomIndex(int index); |
123 | |
124 | /// Sets the rotation index to index |
125 | void setRotationIndex(int index); |
126 | |
127 | /// Sets the fps index to index |
128 | void setFPSIndex(int index); |
129 | |
130 | /// Sets the color index to index |
131 | void setColorIndex(int index); |
132 | |
133 | /// Shows/hides the mouse cursor |
134 | void showMouseCursor(bool show); |
135 | |
136 | void (); |
137 | |
138 | void slotToggleHideCursor(); |
139 | void slotStaysOnTop(); |
140 | |
141 | /// Opens shortcut key configuration dialog |
142 | void slotConfKeys(); |
143 | |
144 | /// Called when toolbar config is updated |
145 | void slotNewToolbarConfig(); |
146 | |
147 | /// Called when "configure toolbar" is clicked |
148 | void slotEditToolbars(); |
149 | |
150 | void slotChangeZoomBoxIndex(int index); |
151 | void slotChangeRotationBoxIndex(int index); |
152 | void slotChangeFPSIndex(int index); |
153 | void slotChangeColorIndex(int index); |
154 | |
155 | |
156 | signals: |
157 | /// This signal is raised whenever the index into the zoom array is changed |
158 | void updateZoomIndex(int); |
159 | |
160 | /// This signal is raised whenever the zoom value changes |
161 | void updateZoomValue(float); |
162 | |
163 | /// This signal is raised whenever the index into the rotation array is changed |
164 | void updateRotationIndex(int); |
165 | |
166 | /// This signal is raised whenever the rotation value changes |
167 | void updateRotationValue(int); |
168 | |
169 | /// This signal is raised whenever the index into the fps array is changed |
170 | void updateFPSIndex(int); |
171 | |
172 | /// This signal is raised whenever the fps value changes |
173 | void updateFPSValue(float); |
174 | |
175 | /// This signal is raised whenever the index into the color array is changed |
176 | void updateColorIndex(int); |
177 | |
178 | /// This signal is raised whenever the color value changes |
179 | void updateColorValue(int); |
180 | |
181 | private: |
182 | /// the configuration object of the application |
183 | KSharedConfigPtr config; |
184 | |
185 | // KAction pointers to enable/disable actions |
186 | KAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf; |
187 | QAction *m_pPrint; |
188 | QAction *m_pZoomIn; |
189 | QAction *m_pZoomOut; |
190 | QAction *m_pQuit; |
191 | KAction *refreshSwitch; |
192 | KToggleAction *; |
193 | KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox, *m_pColorBox; |
194 | |
195 | /// zoom slider |
196 | KIntNumInput *m_zoomSlider; |
197 | |
198 | /// Current index into the zoomArray |
199 | unsigned int m_zoomIndex; |
200 | |
201 | /// Current index into the rotationArray |
202 | unsigned int m_rotationIndex; |
203 | |
204 | /// Current index into the fpsArray |
205 | unsigned int m_fpsIndex; |
206 | |
207 | /// Current index into the colorArray |
208 | unsigned int m_colorIndex; |
209 | |
210 | QStringList zoomArrayString; |
211 | QVector<float> zoomArray; |
212 | |
213 | QStringList rotationArrayString; |
214 | QVector<int> rotationArray; |
215 | |
216 | QStringList fpsArrayString; |
217 | QVector<float> fpsArray; |
218 | |
219 | QStringList colorArrayString; |
220 | QVector<int> colorArray; |
221 | |
222 | KMagZoomView* m_zoomView; |
223 | KToggleAction *m_hideCursor, *m_staysOnTop; |
224 | KToggleAction *m_modeFollowMouse, *m_modeFollowFocus, *m_modeWholeScreen, *m_modeSelWin; |
225 | |
226 | /// Stores the non-zero cursor type to be used |
227 | unsigned int m_mouseCursorType; |
228 | |
229 | unsigned int m_defaultMouseCursorType; |
230 | |
231 | #ifndef QT_NO_PRINTER |
232 | // Keep QPrinter so settings persist |
233 | QPrinter *m_printer; |
234 | #endif // QT_NO_PRINTER |
235 | |
236 | }; |
237 | |
238 | |
239 | #endif // KMAG_H |
240 | |