itom 1.4.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität 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 class MainWindow : public QMainWindow 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 MainWindow(); 00057 ~MainWindow(); 00058 00059 00060 00061 protected: 00062 void closeEvent(QCloseEvent *event); 00063 void resizeEvent(QResizeEvent * event); 00064 void moveEvent (QMoveEvent * event); 00065 00066 inline bool pythonBusy() const { return m_pythonBusy; } 00067 inline bool pythonDebugMode() const { return m_pythonDebugMode; } 00068 inline bool pythonInWaitingMode() const { return m_pythonInWaitingMode; } 00070 private: 00071 void createActions(); 00072 void createMenus(); 00073 void createToolBars(); 00074 void createStatusBar(); 00075 void updateMenus(); 00076 void updatePythonActions(); 00077 00078 void getMenuHandlesRecursively(const QMenu *parent, QSharedPointer<QVector<size_t> > menuHandles); 00079 QAction* searchActionRecursively(const size_t menuHandle, const QMenu *parent); 00080 00081 ConsoleWidget *m_console; 00082 00083 QVBoxLayout *m_contentLayout; 00084 00085 BreakPointDockWidget *m_breakPointDock; 00086 LastCommandDockWidget *m_lastCommandDock; 00087 HelpDockWidget *m_helpDock; 00088 WorkspaceDockWidget *m_globalWorkspaceDock; 00089 WorkspaceDockWidget *m_localWorkspaceDock; 00090 CallStackDockWidget *m_callStackDock; 00091 FileSystemDockWidget *m_fileSystemDock; 00092 00093 AIManagerWidget* m_pAIManagerWidget; 00094 00095 QSignalMapper *m_lastFilesMapper; 00097 QToolBar* m_aboutToolBar; 00098 QToolBar* m_appToolBar; 00099 QToolBar* m_toolToolBar; 00100 QToolBar* m_pythonToolBar; 00101 00102 QMap<QString, QToolBar*> m_userDefinedToolBars; 00103 QMap<QString, QMenu* > m_userDefinedRootMenus; 00104 QSignalMapper *m_userDefinedSignalMapper; 00105 unsigned int m_userDefinedActionCounter; 00106 00107 QAction *m_appFileNew; 00108 QAction *m_appFileOpen; 00109 QAction *m_aboutQt; 00110 QAction *m_aboutQitom; 00111 QAction *m_lastFileAct; 00112 00113 QMap<QString, QAction*> m_actions; 00114 00115 QMenu *m_pMenuHelp; 00116 QMenu *m_pMenuFile; 00117 QMenu *m_plastFilesMenu; 00118 QMenu *m_pMenuPython; 00119 QMenu *m_pMenuReloadModule; 00120 QMenu *m_pMenuView; 00121 00122 HelpSystem *m_pHelpSystem; 00123 00124 QLabel *m_statusLblCurrentDir; //label for showing current directory 00125 00126 QRect m_geometryNormalState; 00127 00128 bool m_pythonBusy; 00129 bool m_pythonDebugMode; 00130 bool m_pythonInWaitingMode; 00131 bool m_isFullscreen; 00132 00133 QMap<QString, QPointer<WidgetInfoBox> > m_infoBoxWidgets; 00134 00135 signals: 00136 void mainWindowCloseRequest(); 00137 void pythonDebugCommand(tPythonDbgCmd cmd); 00138 void pythonSetAutoReloadSettings(bool enabled, bool checkFile, bool checkCmd, bool checkFct); 00139 00140 public slots: 00141 void addAbstractDock(AbstractDockWidget* dockWidget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea); 00142 void removeAbstractDock(AbstractDockWidget* dockWidget); 00143 00144 virtual void pythonStateChanged(tPythonTransitions pyTransition); 00145 00146 void setStatusText(QString message, int timeout); 00147 00148 ito::RetVal addToolbarButton(const QString &toolbarName, const QString &buttonName, const QString &buttonIconFilename, const QString &pythonCode, QSharedPointer<size_t> buttonHandle, ItomSharedSemaphore *waitCond = NULL); 00149 ito::RetVal removeToolbarButton(const QString &toolbarName, const QString &buttonName, QSharedPointer<size_t> buttonHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00150 ito::RetVal removeToolbarButton(const size_t buttonHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00151 00152 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); 00153 ito::RetVal removeMenuElement(const QString &key, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00154 ito::RetVal removeMenuElement(const size_t menuHandle, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL); 00155 void pythonRunSelection(QString selectionText); 00156 00157 void setCursor(const Qt::CursorShape cursor); 00158 void resetCursor(); 00159 00160 void currentDirectoryChanged(); 00161 00162 void showInfoMessageLine( QString text, QString winKey = "" ); 00163 00164 private slots: 00165 void mnuAboutQitom(); 00166 void mnuExitApplication(); 00167 00168 void mnuNewScript(); 00169 void mnuOpenFile(); 00170 void mnuShowAssistant(); 00171 void mnuShowScriptReference(); 00172 void mnuShowDesigner(); 00173 void mnuShowProperties(); 00174 void mnuShowUserManagement(); 00175 void mnuToggleExecPyCodeByDebugger(bool checked); 00176 00177 void mnuScriptStop(); 00178 void mnuScriptContinue(); 00179 void mnuScriptStep(); 00180 void mnuScriptStepOver(); 00181 void mnuScriptStepOut(); 00182 void mnuPyReloadModules(); 00183 void mnuShowLoadedPlugins(); 00184 00185 void mnuPyAutoReloadTriggered(bool checked); 00186 00187 void helpAssistantError ( QProcess::ProcessError error ); 00188 void designerError ( QProcess::ProcessError error ); 00189 00190 void userDefinedActionTriggered(const QString &pythonCode); 00191 00192 void pythonAutoReloadChanged(bool enabled, bool checkFile, bool checkCmd, bool checkFct); 00193 00194 void menuLastFilesAboutToShow(); 00195 void lastFileOpen(const QString &path); 00196 00197 //void mnuRestore() 00198 //{ 00199 // QSettings settings; 00200 // restoreGeometry(settings.value("geometry").toByteArray()); 00201 // restoreState(settings.value("windowState").toByteArray()); 00202 //} 00203 00204 }; 00205 00206 } //end namespace ito 00207 00208 #endif