File indexing completed on 2024-04-28 03:40:28
0001 // SPDX-FileCopyrightText: 2001-2003 Sarang Lakare <sarang@users.sourceforge.net> 0002 // SPDX-FileCopyrightText: 2003-2004 Olaf Schmidt <ojschmidt@kde.org> 0003 // SPDX-FileCopyrightText: 2008 Matthew Woehlke <mw_triad@users.sourceforge.net> 0004 // SPDX-FileCopyrightText: 2010 Sebastian Sauer <sebsauer@kdab.com> 0005 // SPDX-License-Identifier: GPL-2.0-or-later 0006 0007 #ifndef KMAG_H 0008 #define KMAG_H 0009 0010 #include "kmagzoomview.h" 0011 #include "focustrackconfig.h" 0012 0013 // include files for Qt 0014 #include <QPrinter> 0015 0016 // include files for KF5 0017 #include <KSharedConfig> 0018 #include <KXmlGuiWindow> 0019 0020 class KToggleAction; 0021 class KSelectAction; 0022 0023 /** 0024 * The base class for Kmag application windows. It sets up the main 0025 * window and reads the config file as well as providing a menubar, toolbar 0026 * and statusbar. An instance of KmagView creates your center view, which is connected 0027 * to the window's Doc object. 0028 * KmagApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports 0029 * full session management as well as using KActions. 0030 * @see KXmlGuiWindow 0031 * @see KApplication 0032 * @see KConfig 0033 * 0034 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team. 0035 * @version KDevelop version 1.2 code generation 0036 */ 0037 class KmagApp : public KXmlGuiWindow 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 /** 0043 * Constructor of KmagApp, calls all init functions to create the application. 0044 */ 0045 explicit KmagApp(QWidget* parent=nullptr); 0046 0047 /// Default destructor 0048 ~KmagApp() override; 0049 0050 0051 0052 protected: 0053 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration 0054 * file 0055 */ 0056 void saveOptions(); 0057 /** read general Options again and initialize all variables like the recent file list 0058 */ 0059 void readOptions(); 0060 /** initializes the KActions of the application */ 0061 void initActions(); 0062 0063 /** creates the centerwidget of the KTMainWindow instance and sets it as the view 0064 */ 0065 void initView(); 0066 0067 /// Initialize all connections 0068 void initConnections(); 0069 0070 bool queryClose() override; 0071 0072 /// Catch context menu events 0073 void contextMenuEvent ( QContextMenuEvent * e ) override; 0074 0075 public Q_SLOTS: 0076 /** open a new application window by creating a new instance of KmagApp */ 0077 void slotFileNewWindow(); 0078 0079 /** print the actual file */ 0080 void slotFilePrint(); 0081 0082 void slotFileQuit(); 0083 0084 /** put the marked text/object into the clipboard 0085 */ 0086 void copyToClipBoard(); 0087 0088 /// Toggle the refreshing of the window 0089 void slotToggleRefresh(); 0090 0091 void slotModeChanged(); 0092 void slotModeWholeScreen(); 0093 void slotModeSelWin(); 0094 0095 /// Zooms in 0096 void zoomIn(); 0097 0098 /// Zooms out 0099 void zoomOut(); 0100 0101 /// Save the zoomed image 0102 void saveZoomPixmap(); 0103 0104 /// Sets the zoom index to index 0105 void setZoomIndex(int index); 0106 0107 /// Sets the rotation index to index 0108 void setRotationIndex(int index); 0109 0110 /// Sets the fps index to index 0111 void setFPSIndex(int index); 0112 0113 /// Sets the color index to index 0114 void setColorIndex(int index); 0115 0116 /// Shows/hides the mouse cursor 0117 void showMouseCursor(bool show); 0118 0119 void slotShowMenu(); 0120 0121 void slotToggleHideCursor(); 0122 void slotStaysOnTop(); 0123 0124 /// Opens shortcut key configuration dialog 0125 void slotConfKeys(); 0126 0127 /// Called when toolbar config is updated 0128 void slotNewToolbarConfig(); 0129 0130 /// Called when "configure toolbar" is clicked 0131 void slotEditToolbars(); 0132 0133 void slotChangeZoomBoxIndex(int index); 0134 void slotChangeRotationBoxIndex(int index); 0135 void slotChangeFPSIndex(int index); 0136 void slotChangeColorIndex(int index); 0137 0138 0139 Q_SIGNALS: 0140 /// This signal is raised whenever the index into the zoom array is changed 0141 void updateZoomIndex(int); 0142 0143 /// This signal is raised whenever the zoom value changes 0144 void updateZoomValue(float); 0145 0146 /// This signal is raised whenever the index into the rotation array is changed 0147 void updateRotationIndex(int); 0148 0149 /// This signal is raised whenever the rotation value changes 0150 void updateRotationValue(int); 0151 0152 /// This signal is raised whenever the index into the fps array is changed 0153 void updateFPSIndex(int); 0154 0155 /// This signal is raised whenever the fps value changes 0156 void updateFPSValue(float); 0157 0158 /// This signal is raised whenever the index into the color array is changed 0159 void updateColorIndex(int); 0160 0161 /// This signal is raised whenever the color value changes 0162 void updateColorValue(int); 0163 0164 private: 0165 /// the configuration object of the application 0166 KSharedConfigPtr config; 0167 0168 // KAction pointers to enable/disable actions 0169 QAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf; 0170 QAction *m_pPrint; 0171 QAction *m_pZoomIn; 0172 QAction *m_pZoomOut; 0173 QAction *m_pQuit; 0174 QAction *refreshSwitch; 0175 KToggleAction *m_pShowMenu; 0176 KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox, *m_pColorBox; 0177 0178 /// Current index into the zoomArray 0179 unsigned int m_zoomIndex; 0180 0181 /// Current index into the rotationArray 0182 unsigned int m_rotationIndex; 0183 0184 /// Current index into the fpsArray 0185 unsigned int m_fpsIndex; 0186 0187 /// Current index into the colorArray 0188 unsigned int m_colorIndex; 0189 0190 QStringList zoomArrayString; 0191 QList<float> zoomArray; 0192 0193 QStringList rotationArrayString; 0194 QList<int> rotationArray; 0195 0196 QStringList fpsArrayString; 0197 QList<float> fpsArray; 0198 0199 QStringList colorArrayString; 0200 QList<int> colorArray; 0201 0202 KMagZoomView* m_zoomView; 0203 KToggleAction *m_hideCursor, *m_staysOnTop; 0204 KToggleAction *m_modeFollowMouse, *m_modeFollowFocus, *m_modeWholeScreen, *m_modeSelWin; 0205 0206 /// Stores the non-zero cursor type to be used 0207 unsigned int m_mouseCursorType; 0208 0209 unsigned int m_defaultMouseCursorType; 0210 0211 #ifndef QT_NO_PRINTER 0212 // Keep QPrinter so settings persist 0213 QPrinter *m_printer = nullptr; 0214 #endif // QT_NO_PRINTER 0215 0216 }; 0217 0218 0219 #endif // KMAG_H