itom 1.3.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 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     ConsoleWidget *m_console;
00079 
00080     QVBoxLayout *m_contentLayout;
00081     
00082     BreakPointDockWidget  *m_breakPointDock;
00083     LastCommandDockWidget *m_lastCommandDock;
00084     HelpDockWidget        *m_helpDock;
00085     WorkspaceDockWidget   *m_globalWorkspaceDock;
00086     WorkspaceDockWidget   *m_localWorkspaceDock;
00087     CallStackDockWidget   *m_callStackDock;
00088     FileSystemDockWidget  *m_fileSystemDock;
00089 
00090     AIManagerWidget* m_pAIManagerWidget;
00091 
00092     QSignalMapper *m_lastFilesMapper;       
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     QAction *m_lastFileAct;
00108 
00109     QMap<QString, QAction*> m_actions;
00110 
00111     QMenu *m_pMenuHelp;
00112     QMenu *m_pMenuFile;
00113     QMenu *m_plastFilesMenu;
00114     QMenu *m_pMenuPython;
00115     QMenu *m_pMenuReloadModule;
00116     QMenu *m_pMenuView;
00117 
00118     HelpSystem *m_pHelpSystem;
00119 
00120     QLabel *m_statusLblCurrentDir; //label for showing current directory
00121 
00122     QRect m_geometryNormalState;
00123 
00124     bool m_pythonBusy;                  
00125     bool m_pythonDebugMode;             
00126     bool m_pythonInWaitingMode;         
00127     bool m_isFullscreen;
00128 
00129     QMap<QString, QPointer<WidgetInfoBox> > m_infoBoxWidgets;
00130 
00131 signals:
00132     void mainWindowCloseRequest();  
00133     void pythonDebugCommand(tPythonDbgCmd cmd); 
00134     void pythonSetAutoReloadSettings(bool enabled, bool checkFile, bool checkCmd, bool checkFct);
00135 
00136 public slots:
00137     void addAbstractDock(AbstractDockWidget* dockWidget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
00138     void removeAbstractDock(AbstractDockWidget* dockWidget);
00139 
00140     virtual void pythonStateChanged(tPythonTransitions pyTransition);
00141 
00142     void setStatusText(QString message, int timeout);
00143 
00144     void pythonAddToolbarButton(QString toolbarName, QString buttonName, QString buttonIconFilename, QString pythonCode);
00145     void pythonRemoveToolbarButton(QString toolbarName, QString buttonName);
00146 
00147     void pythonAddMenuElement(int typeID, QString key, QString name, QString code, QString buttonIconFilename);
00148     void pythonRemoveMenuElement(QString key);
00149     void pythonRunSelection(QString selectionText);
00150 
00151     void setCursor(const Qt::CursorShape cursor);
00152     void resetCursor();
00153 
00154     void currentDirectoryChanged();
00155 
00156     void showInfoMessageLine( QString text, QString winKey = "" );
00157 
00158 private slots:
00159     void mnuAboutQitom();
00160     void mnuExitApplication();
00161 
00162     void mnuNewScript();
00163     void mnuOpenFile();
00164     void mnuShowAssistant();
00165     void mnuShowScriptReference();
00166     void mnuShowDesigner();
00167     void mnuShowProperties();
00168     void mnuShowUserManagement();
00169     void mnuToggleExecPyCodeByDebugger(bool checked);
00170 
00171     void mnuScriptStop();
00172     void mnuScriptContinue();
00173     void mnuScriptStep();
00174     void mnuScriptStepOver();
00175     void mnuScriptStepOut();
00176     void mnuPyReloadModules();
00177     void mnuShowLoadedPlugins();
00178 
00179     void mnuPyAutoReloadTriggered(bool checked);
00180 
00181     void helpAssistantError ( QProcess::ProcessError error );
00182     void designerError ( QProcess::ProcessError error );
00183 
00184     void userDefinedActionTriggered(const QString &pythonCode);
00185 
00186     void pythonAutoReloadChanged(bool enabled, bool checkFile, bool checkCmd, bool checkFct);
00187 
00188     void menuLastFilesAboutToShow();
00189     void lastFileOpen(const QString &path);
00190 
00191     //void mnuRestore()
00192     //{
00193     //    QSettings settings;
00194     //    restoreGeometry(settings.value("geometry").toByteArray());
00195     //    restoreState(settings.value("windowState").toByteArray());
00196     //}
00197 
00198 };
00199 
00200 } //end namespace ito
00201 
00202 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends