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