itom 1.1.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 //#include "../memoryCheck/setDebugNew.h" 00046 //#include "../memoryCheck/reportingHook.h" 00047 00048 class WidgetInfoBox; //forward declaration 00049 00050 namespace ito { 00051 00052 class MainWindow : public QMainWindow 00053 { 00054 Q_OBJECT 00055 00056 public: 00057 MainWindow(); 00058 ~MainWindow(); 00059 00060 00061 00062 protected: 00063 void closeEvent(QCloseEvent *event); 00064 void resizeEvent(QResizeEvent * event); 00065 void moveEvent (QMoveEvent * event); 00066 00067 inline bool pythonBusy() const { return m_pythonBusy; } 00068 inline bool pythonDebugMode() const { return m_pythonDebugMode; } 00069 inline bool pythonInWaitingMode() const { return m_pythonInWaitingMode; } 00071 private: 00072 void createActions(); 00073 void createMenus(); 00074 void createToolBars(); 00075 void createStatusBar(); 00076 void updateMenus(); 00077 void updatePythonActions(); 00078 00079 ConsoleWidget *m_console; 00080 00081 QVBoxLayout *m_contentLayout; 00082 00083 BreakPointDockWidget *m_breakPointDock; 00084 LastCommandDockWidget *m_lastCommandDock; 00085 HelpDockWidget *m_helpDock; 00086 WorkspaceDockWidget *m_globalWorkspaceDock; 00087 WorkspaceDockWidget *m_localWorkspaceDock; 00088 CallStackDockWidget *m_callStackDock; 00089 FileSystemDockWidget *m_fileSystemDock; 00090 00091 AIManagerWidget* m_pAIManagerWidget; 00092 00093 QToolBar* m_aboutToolBar; 00094 QToolBar* m_appToolBar; 00095 QToolBar* m_toolToolBar; 00096 QToolBar* m_pythonToolBar; 00097 00098 QMap<QString, QToolBar*> m_userDefinedToolBars; 00099 QMap<QString, QMenu* > m_userDefinedRootMenus; 00100 QSignalMapper *m_userDefinedSignalMapper; 00101 00102 QAction *m_appFileNew; 00103 QAction *m_appFileOpen; 00104 QAction *m_aboutQt; 00105 QAction *m_aboutQitom; 00106 00107 QMap<QString, QAction*> m_actions; 00108 00109 QMenu *m_pMenuHelp; 00110 QMenu *m_pMenuFile; 00111 QMenu *m_pMenuPython; 00112 QMenu *m_pMenuView; 00113 00114 HelpSystem *m_pHelpSystem; 00115 00116 QLabel *m_statusLblCurrentDir; //label for showing current directory 00117 00118 QRect m_geometryNormalState; 00119 00120 bool m_pythonBusy; 00121 bool m_pythonDebugMode; 00122 bool m_pythonInWaitingMode; 00123 bool m_isFullscreen; 00124 00125 QMap<QString, QWeakPointer<WidgetInfoBox> > m_infoBoxWidgets; 00126 00127 signals: 00128 void mainWindowCloseRequest(); 00129 void pythonDebugCommand(tPythonDbgCmd cmd); 00131 public slots: 00132 void addAbstractDock(AbstractDockWidget* dockWidget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea); 00133 void removeAbstractDock(AbstractDockWidget* dockWidget); 00134 00135 virtual void pythonStateChanged(tPythonTransitions pyTransition); 00136 00137 void setStatusText(QString message, int timeout); 00138 00139 void pythonAddToolbarButton(QString toolbarName, QString buttonName, QString buttonIconFilename, QString pythonCode); 00140 void pythonRemoveToolbarButton(QString toolbarName, QString buttonName); 00141 00142 void pythonAddMenuElement(int typeID, QString key, QString name, QString code, QString buttonIconFilename); 00143 void pythonRemoveMenuElement(QString key); 00144 void pythonRunSelection(QString selectionText); 00145 00146 void setCursor(const Qt::CursorShape cursor); 00147 void resetCursor(); 00148 00149 void currentDirectoryChanged(); 00150 00151 void showInfoMessageLine( QString text, QString winKey = "" ); 00152 00153 private slots: 00154 void mnuAboutQitom(); 00155 void mnuExitApplication(); 00156 00157 void mnuNewScript(); 00158 void mnuOpenFile(); 00159 void mnuShowAssistant(); 00160 void mnuShowScriptReference(); 00161 void mnuShowDesigner(); 00162 void mnuShowProperties(); 00163 void mnuShowUserManagement(); 00164 void mnuToogleExecPyCodeByDebugger(bool checked); 00165 00166 void mnuScriptStop(); 00167 void mnuScriptContinue(); 00168 void mnuScriptStep(); 00169 void mnuScriptStepOver(); 00170 void mnuScriptStepOut(); 00171 void mnuPyReloadModules(); 00172 void mnuShowLoadedPlugins(); 00173 00174 /*void mnuTest() 00175 { 00176 ScriptWindow *s = new ScriptWindow(this); 00177 s->show(); 00178 }*/ 00179 00180 void helpAssistantError ( QProcess::ProcessError error ); 00181 void designerError ( QProcess::ProcessError error ); 00182 00183 void userDefinedActionTriggered(const QString &pythonCode); 00184 00185 //void mnuRestore() 00186 //{ 00187 // QSettings settings; 00188 // restoreGeometry(settings.value("geometry").toByteArray()); 00189 // restoreState(settings.value("windowState").toByteArray()); 00190 //} 00191 00192 }; 00193 00194 } //end namespace ito 00195 00196 #endif