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