itom 2.2.1
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2016, Institut fuer Technische Optik (ITO), 00005 Universitaet Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef MAINWINDOW_H 00024 #define MAINWINDOW_H 00025 00026 #include "workspaceDockWidget.h" 00027 #include "callStackDockWidget.h" 00028 #include "consoleWidget.h" 00029 #include "AIManagerWidget.h" 00030 #include "fileSystemDockWidget.h" 00031 #include "breakPointDockWidget.h" 00032 #include "helpDockWidget.h" 00033 #include "lastCommandDockWidget.h" 00034 #include "userManagement.h" 00035 00036 #include <qtableview.h> 00037 #include <qprocess.h> 00038 00039 #include <qsignalmapper.h> 00040 00041 #include "../organizer/helpSystem.h" 00042 00043 #include <qsharedpointer.h> 00044 00045 class QSignalMapper; //forward declaration 00046 00047 namespace ito { 00048 00049 class WidgetInfoBox; //forward declaration 00050 00051 #ifdef ITOM_USEHELPVIEWER 00052 class HelpViewer; //forward declaration 00053 #endif 00054 00055 class MainWindow : public QMainWindow 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 MainWindow(); 00061 ~MainWindow(); 00062 00063 00064 00065 protected: 00066 void closeEvent(QCloseEvent *event); 00067 void resizeEvent(QResizeEvent * event); 00068 void moveEvent (QMoveEvent * event); 00069 00070 inline bool pythonBusy() const { return m_pythonBusy; } 00071 inline bool pythonDebugMode() const { return m_pythonDebugMode; } 00072 inline bool pythonInWaitingMode() const { return m_pythonInWaitingMode; } 00074 private: 00075 void createActions(); 00076 void createMenus(); 00077 void createToolBars(); 00078 void createStatusBar(); 00079 void updateMenus(); 00080 void updatePythonActions(); 00081 00082 void getMenuHandlesRecursively(const QMenu *parent, QSharedPointer<QVector<size_t> > menuHandles); 00083 QAction* searchActionRecursively(const size_t menuHandle, const QMenu *parent); 00084 00085 ConsoleWidget *m_console; 00086 00087 QVBoxLayout *m_contentLayout; 00088 00089 BreakPointDockWidget *m_breakPointDock; 00090 LastCommandDockWidget *m_lastCommandDock; 00091 HelpDockWidget *m_helpDock; 00092 WorkspaceDockWidget *m_globalWorkspaceDock; 00093 WorkspaceDockWidget *m_localWorkspaceDock; 00094 CallStackDockWidget *m_callStackDock; 00095 FileSystemDockWidget *m_fileSystemDock; 00096 00097 AIManagerWidget* m_pAIManagerWidget; 00098 00099 QSignalMapper *m_lastFilesMapper; 00100 QSignalMapper *m_openScriptsMapper; 00102 QToolBar* m_aboutToolBar; 00103 QToolBar* m_appToolBar; 00104 QToolBar* m_toolToolBar; 00105 QToolBar* m_pythonToolBar; 00106 00107 QMap<QString, QToolBar*> m_userDefinedToolBars; 00108 QMap<QString, QMenu* > m_userDefinedRootMenus; 00109 QSignalMapper *m_userDefinedSignalMapper; 00110 unsigned int m_userDefinedActionCounter; 00111 00112 QAction *m_appFileNew; 00113 QAction *m_appFileOpen; 00114 QAction *m_aboutQt; 00115 QAction *m_aboutQitom; 00116 00117 QMap<QString, QAction*> m_actions; 00118 00119 QMenu *m_pMenuHelp; 00120 QMenu *m_pMenuFile; 00121 QMenu *m_plastFilesMenu; 00122 QMenu *m_pMenuPython; 00123 QMenu *m_pMenuReloadModule; 00124 QMenu *m_pMenuView; 00125 00126 HelpSystem *m_pHelpSystem; 00127 00128 QLabel *m_statusLblCurrentDir; //label for showing current directory 00129 00130 #ifdef ITOM_USEHELPVIEWER 00131 QPointer<HelpViewer> m_helpViewer; 00132 #endif 00133 00134 QRect m_geometryNormalState; 00135 00136 bool m_pythonBusy; 00137 bool m_pythonDebugMode; 00138 bool m_pythonInWaitingMode; 00139 bool m_isFullscreen; 00140 00141 QMap<QString, QPointer<WidgetInfoBox> > m_infoBoxWidgets; 00142 00143 signals: 00144 void mainWindowCloseRequest(); 00145 void pythonDebugCommand(tPythonDbgCmd cmd); 00146 void pythonSetAutoReloadSettings(bool enabled, bool checkFile, bool checkCmd, bool checkFct); 00147 00148 public slots: 00149 void addAbstractDock(AbstractDockWidget* dockWidget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea); 00150 void removeAbstractDock(AbstractDockWidget* dockWidget); 00151 00152 void pythonStateChanged(tPythonTransitions pyTransition); 00153 00154 void setStatusText(QString message, int timeout); 00155 00156 ito::RetVal addToolbarButton(const QString &toolbarName, const QString &buttonName, const QString &buttonIconFilename, const QString &pythonCode, QSharedPointer<size_t> buttonHandle, ItomSharedSemaphore *waitCond = NULL); 00157 ito::RetVal removeToolbarButton(const QString &toolbarName, const QString &buttonName, QSharedPointer<size_t> buttonHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00158 ito::RetVal removeToolbarButton(const size_t buttonHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00159 00160 ito::RetVal addMenuElement(int typeID, const QString &key, const QString &name, const QString &code, const QString &buttonIconFilename, QSharedPointer<size_t> menuHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00161 ito::RetVal removeMenuElement(const QString &key, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00162 ito::RetVal removeMenuElement(const size_t menuHandle, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00163 void pythonRunSelection(QString selectionText); 00164 00165 void setCursor(const Qt::CursorShape cursor); 00166 void resetCursor(); 00167 00168 void currentDirectoryChanged(); 00169 00170 void showInfoMessageLine( QString text, QString winKey = "" ); 00171 00172 void showAssistant(const QString &collectionFile = ""); 00173 00174 private slots: 00175 void mnuAboutQitom(); 00176 void mnuExitApplication(); 00177 00178 void mnuNewScript(); 00179 void mnuOpenFile(); 00180 void mnuShowAssistant(); 00181 void mnuShowScriptReference(); 00182 void mnuShowDesigner(); 00183 void mnuShowProperties(); 00184 void mnuShowUserManagement(); 00185 void mnuToggleExecPyCodeByDebugger(bool checked); 00186 00187 void mnuScriptStop(); 00188 void mnuScriptContinue(); 00189 void mnuScriptStep(); 00190 void mnuScriptStepOver(); 00191 void mnuScriptStepOut(); 00192 void mnuPyReloadModules(); 00193 void mnuShowLoadedPlugins(); 00194 void mnuPyPipManager(); 00195 void mnuPyTimerManager(); 00196 00197 void mnuPyAutoReloadTriggered(bool checked); 00198 00199 void helpAssistantError ( QProcess::ProcessError error ); 00200 void designerError ( QProcess::ProcessError error ); 00201 00202 void userDefinedActionTriggered(const QString &pythonCode); 00203 00204 void pythonAutoReloadChanged(bool enabled, bool checkFile, bool checkCmd, bool checkFct); 00205 00206 void menuLastFilesAboutToShow(); 00207 void lastFileOpen(const QString &path); 00208 void openScript(const QString &filename); 00209 00210 void mnuViewAboutToShow(); 00211 00212 }; 00213 00214 } //end namespace ito 00215 00216 #endif