Warning, file /graphics/tikzkit/src/app/MainWindow.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the TikZKit project 0002 * 0003 * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 2 or the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program; If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 #ifndef TIKZKIT_MAIN_WINDOW_H 0019 #define TIKZKIT_MAIN_WINDOW_H 0020 0021 #include <QMainWindow> 0022 #include <memory> 0023 #include <QPointer> 0024 0025 #include <tikz/core/Pos.h> 0026 0027 class QLabel; 0028 class QComboBox; 0029 class QTextEdit; 0030 class QTreeView; 0031 class QListWidget; 0032 0033 class ViewManager; 0034 0035 namespace tex { 0036 class PdfGenerator; 0037 } 0038 0039 namespace tikz { 0040 namespace ui { 0041 class MainWindow; 0042 class Document; 0043 class View; 0044 class PropertyBrowser; 0045 class TikzToolBox; 0046 } 0047 } 0048 0049 class MainWindow : public QMainWindow 0050 { 0051 Q_OBJECT 0052 0053 public: 0054 /** 0055 * Default constructor. 0056 */ 0057 MainWindow(); 0058 0059 /** 0060 * Virtual destructor. 0061 */ 0062 virtual ~MainWindow(); 0063 0064 public Q_SLOTS: 0065 void slotDocumentNew(); 0066 void slotDocumentOpen(); 0067 void slotDocumentSave(); 0068 void slotCloseActiveView(); 0069 void closeDocument(tikz::ui::Document * doc); 0070 void slotPreferredUnitChanged(int index); 0071 0072 void previewPdf(); 0073 void previewPdf(const QString & pdfFile); 0074 0075 protected: 0076 void setupUi(); 0077 void setupActions(); 0078 void setupStatusBar(); 0079 0080 protected Q_SLOTS: 0081 void mergeView(tikz::ui::View * view); 0082 void unmergeView(tikz::ui::View * view); 0083 void updateMousePosition(const tikz::Pos & pos); 0084 void logMessage(tikz::LogType logType, const QString & text); 0085 0086 public Q_SLOTS: 0087 /** 0088 * This slot is called by the ViewManager whenever the current view changes. 0089 */ 0090 void slotViewChanged(tikz::ui::View * view); 0091 0092 /** 0093 * Call this slot whenever the window title needs to be changed. 0094 */ 0095 void updateWindowTitle(); 0096 0097 /** 0098 * Call this slot whenever document changed. 0099 */ 0100 void updateTikzCode(); 0101 0102 /** 0103 * Call this slot whenever the document actions change. 0104 */ 0105 void updateActions(); 0106 0107 public: 0108 /** 0109 * Accessor to the MainWindow wrapper interface 0110 */ 0111 tikz::ui::MainWindow * wrapper() const; 0112 0113 // 0114 // tikz::ui::MainWindow interface 0115 // 0116 public Q_SLOTS: 0117 /** 0118 * Get a list of all views for this main window. 0119 * @return all views 0120 */ 0121 QVector<tikz::ui::View *> views() const; 0122 0123 /** 0124 * Access the active view. 0125 * \return active view 0126 */ 0127 tikz::ui::View *activeView(); 0128 0129 /** 0130 * Activate the view with the corresponding \p document. 0131 * If none exist for this document, create one 0132 * \param document the document 0133 * \return activated view of this document 0134 */ 0135 tikz::ui::View *activateView(tikz::ui::Document *document); 0136 0137 /** 0138 * Open the document \p url. 0139 * \param url the document's url 0140 * \return a pointer to the created view for the new document, if a document 0141 * with this url is already existing, its view will be activated 0142 */ 0143 tikz::ui::View *openUrl(const QUrl &url); 0144 0145 /** 0146 * Close selected view 0147 * \param view the view 0148 */ 0149 void closeView(tikz::ui::View *view); 0150 0151 // 0152 // Signals related to view handling 0153 // 0154 Q_SIGNALS: 0155 /** 0156 * This signal is emitted whenever the active view changes. 0157 * @param view new active view 0158 */ 0159 void viewChanged(tikz::ui::View *view); 0160 0161 /** 0162 * This signal is emitted whenever a new view is created 0163 * @param view view that was created 0164 */ 0165 void viewCreated(tikz::ui::View *view); 0166 0167 private: 0168 QMenu * m_fileMenu = nullptr; 0169 QMenu * m_viewMenu = nullptr; 0170 QToolBar * m_toolBar = nullptr; 0171 QAction * m_fileNew = nullptr; 0172 QAction * m_fileOpen = nullptr; 0173 QAction * m_fileSave = nullptr; 0174 QAction * m_fileClose = nullptr; 0175 QAction * m_fileQuit = nullptr; 0176 QAction * m_filePreview = nullptr; 0177 0178 QAction * m_aZoomIn = nullptr; 0179 QAction * m_aResetZoom = nullptr; 0180 QAction * m_aZoomOut = nullptr; 0181 0182 QAction * m_editUndo = nullptr; 0183 QAction * m_editRedo = nullptr; 0184 0185 ViewManager * m_viewManager = nullptr; 0186 QPointer<tikz::ui::View> m_activeView; 0187 0188 tikz::ui::MainWindow * m_wrapper = nullptr; 0189 0190 QTextEdit * m_textEdit = nullptr; 0191 0192 tikz::ui::PropertyBrowser * m_browser = nullptr; 0193 QTreeView * m_historyView = nullptr; 0194 QListWidget * m_logWidget = nullptr; 0195 0196 tikz::ui::TikzToolBox * m_toolBox = nullptr; 0197 0198 tex::PdfGenerator * m_pdfGenerator = nullptr; 0199 0200 // status bar 0201 QLabel * m_positionLabel = nullptr; 0202 QComboBox * m_unitComboBox = nullptr; 0203 QComboBox * m_zoomComboBox = nullptr; 0204 }; 0205 0206 #endif // TIKZKIT_MAIN_WINDOW_H 0207 0208 // kate: indent-width 4; replace-tabs on;