itom
Loading...
Searching...
No Matches
mainWindow.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2023, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22
23#pragma once
24
25#include "workspaceDockWidget.h"
26#include "callStackDockWidget.h"
27#include "scriptDockWidget.h"
28#include "consoleWidget.h"
29#include "AIManagerWidget.h"
30#include "fileSystemDockWidget.h"
31#include "breakPointDockWidget.h"
32#include "bookmarkDockWidget.h"
33#include "helpDockWidget.h"
34#include "lastCommandDockWidget.h"
35//#include "pythonMessageDockWidget.h"
36#include "userManagement.h"
37
38#include <qtableview.h>
39#include <qprocess.h>
40#include <qsplitter.h>
41
42#include "../organizer/helpSystem.h"
43
44#include <qsharedpointer.h>
45
46
47namespace ito {
48
49class WidgetInfoBox; //forward declaration
50
51#ifdef ITOM_USEHELPVIEWER
52class HelpViewer; //forward declaration
53#endif
54
55class MainWindow : public QMainWindow
56{
57 Q_OBJECT
58
59public:
60 MainWindow();
62
63 ito::RetVal addCentralWidget(QWidget *widget);
64
66
67protected:
68 void closeEvent(QCloseEvent *event);
69 void resizeEvent(QResizeEvent * event);
70 void moveEvent (QMoveEvent * event);
71
72 inline bool pythonBusy() const { return m_pythonBusy; }
73 inline bool pythonDebugMode() const { return m_pythonDebugMode; }
74 inline bool pythonInWaitingMode() const { return m_pythonInWaitingMode; }
76private:
77 void createActions();
78 void createMenus();
79 void createToolBars();
80 void createStatusBar();
81 void updateMenus();
83
84 void getMenuHandlesRecursively(const QMenu *parent, QSharedPointer<QVector<size_t> > menuHandles);
85 QAction* searchActionRecursively(const size_t menuHandle, const QMenu *parent);
86
87 ConsoleWidget *m_console;
88
89 QVBoxLayout *m_contentLayout;
90 QSplitter *m_contentSplitter;
91
92 BreakPointDockWidget *m_breakPointDock;
93 BookmarkDockWidget *m_bookmarkDock;
94 LastCommandDockWidget *m_lastCommandDock;
95 HelpDockWidget *m_helpDock;
96 WorkspaceDockWidget *m_globalWorkspaceDock;
97 WorkspaceDockWidget *m_localWorkspaceDock;
98 CallStackDockWidget *m_callStackDock;
99 FileSystemDockWidget *m_fileSystemDock;
100
101 AIManagerWidget* m_pAIManagerWidget;
102
103 QMap<QString, QToolBar*> m_userDefinedToolBars;
104 QMap<QString, QMenu* > m_userDefinedRootMenus;
105 unsigned int m_userDefinedActionCounter;
106
107 QAction *m_appFileNew;
108 QAction *m_appFileOpen;
109 QAction *m_aboutQt;
110 QAction *m_aboutQitom;
111 QAction* m_copyLog;
112
113 QMap<QString, QAction*> m_actions;
114
115 QMenu *m_pMenuFigure;
116 QMenu *m_pShowOpenFigure;
117 QMenu *m_pMenuHelp;
118 QMenu *m_pMenuFile;
119 QMenu *m_plastFilesMenu;
120 QMenu *m_pMenuPython;
121 QMenu *m_pMenuReloadModule;
122 QMenu *m_pMenuView;
123
125
128
131
133 QLabel *m_pStatusLblScriptInfo;
134
135#ifdef ITOM_USEHELPVIEWER
136 QPointer<HelpViewer> m_helpViewer;
137#endif
138
139 QRect m_geometryNormalState;
140
144 bool m_isFullscreen;
145
146 QMap<QString, QPointer<WidgetInfoBox> > m_infoBoxWidgets;
147
148signals:
149 void mainWindowCloseRequest(bool considerPythonBusy);
150 void pythonDebugCommand(tPythonDbgCmd cmd);
151 void pythonSetAutoReloadSettings(bool enabled, bool checkFile, bool checkCmd, bool checkFct);
152
153public slots:
154 void addAbstractDock(AbstractDockWidget* dockWidget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
155 void removeAbstractDock(AbstractDockWidget* dockWidget);
156
157 void pythonStateChanged(tPythonTransitions pyTransition);
158
159 void setStatusText(QString message, int timeout);
160
161 ito::RetVal addToolbarButton(const QString &toolbarName, const QString &buttonName, const QString &buttonIconFilename, const QString &pythonCode, QSharedPointer<size_t> buttonHandle, ItomSharedSemaphore *waitCond = NULL);
162 ito::RetVal removeToolbarButton(const QString &toolbarName, const QString &buttonName, QSharedPointer<QVector<size_t> > buttonHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = nullptr);
163 ito::RetVal removeToolbarButton(const size_t buttonHandle, bool showMessage = true, ItomSharedSemaphore *waitCond = nullptr);
164
165 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);
166 ito::RetVal removeMenuElement(const QString &key, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL);
167 ito::RetVal removeMenuElement(const size_t menuHandle, QSharedPointer<QVector<size_t> > removedMenuHandles, bool showMessage = true, ItomSharedSemaphore *waitCond = NULL);
168
169 ito::RetVal dumpToolbarsAndButtons(QSharedPointer<QString> pythonCodeString, ItomSharedSemaphore *waitCond = NULL);
170
171 void pythonRunSelection(QString selectionText);
172
173 void setCursor(const Qt::CursorShape cursor);
174 void resetCursor();
175
176 void currentDirectoryChanged();
177
178 void showInfoMessageLine( QString text, QString winKey = "" );
179
180 void showAssistant(const QString& collectionFile = "", const QString& showUrl = "");
181
182 void setCentralWidgetsSizes(const QVector<int> &sizes);
183
184private slots:
185 void mnuAboutQitom();
186 void mnuCopyLog();
187 void mnuExitApplication();
188
189 void mnuNewScript();
190 void mnuOpenFile();
191 void mnuShowAssistant();
192 void mnuShowScriptReference();
193 void mnuShowDesigner();
194 void mnuShowProperties();
195 void mnuShowUserManagement();
196 void mnuToggleExecPyCodeByDebugger(bool checked);
197 void mnuCloseAllPlots();
198 void mnuShowAllPlots();
199 void mnuMinimizeAllPlots();
200
201 void mnuScriptStop();
202 void mnuScriptContinue();
203 void mnuScriptStep();
204 void mnuScriptStepOver();
205 void mnuScriptStepOut();
206 void mnuPyReloadModules();
207 void mnuShowLoadedPlugins();
208 void mnuPyPipManager();
209 void mnuPyTimerManager();
210
211 void mnuPyAutoReloadTriggered(bool checked);
212
213 void helpAssistantError ( QProcess::ProcessError error );
214 void designerError ( QProcess::ProcessError error );
215
216 void userDefinedActionTriggered(const QString &pythonCode);
217
218 void pythonAutoReloadChanged(bool enabled, bool checkFile, bool checkCmd, bool checkFct);
219
220 void menuLastFilesAboutToShow();
221 void lastFileOpen(const QString &path);
222 void openScript(const QString &filename);
223
224 void mnuViewAboutToShow();
225 void mnuFigureAboutToShow();
226 void raiseFigureByHandle(int handle);
227
228 void scriptStatusBarInformationChanged(
229 const QPointer<ScriptDockWidget> sourceDockWidget,
230 const QString& encoding,
231 int line,
232 int column);
233
234};
235
236} //end namespace ito
semaphore which can be used for asynchronous thread communication. By using this class it is possible...
Definition sharedStructuresQt.h:58
Definition AIManagerWidget.h:41
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition abstractDockWidget.h:55
Provides the bookmark toolbox which is mainly a view of the BookmarkModel.
Definition bookmarkDockWidget.h:44
Definition breakPointDockWidget.h:39
docking
Definition callStackDockWidget.h:38
Definition consoleWidget.h:57
Definition fileSystemDockWidget.h:53
Definition helpDockWidget.h:40
Definition helpSystem.h:37
Definition lastCommandDockWidget.h:55
Definition mainWindow.h:56
bool m_pythonDebugMode
Definition mainWindow.h:142
void mnuScriptStepOut()
slot invoked to execute a python debugging step out
Definition mainWindow.cpp:2767
void createStatusBar()
initializes status bar
Definition mainWindow.cpp:1417
bool pythonBusy() const
Definition mainWindow.h:72
void mnuScriptContinue()
slot invoked to continue debugging process if actually waiting at breakpoint
Definition mainWindow.cpp:2746
QLabel * m_pStatusLblCurrentDir
label for showing the busy status of python (hidden, if python is currently not working) in the statu...
Definition mainWindow.h:127
void addAbstractDock(AbstractDockWidget *dockWidget, Qt::DockWidgetArea area=Qt::TopDockWidgetArea)
Definition mainWindow.cpp:712
void scriptEditorOrganizerAvailable()
slot called by startupApplication if script editor organizer is loaded.
Definition mainWindow.cpp:689
void createToolBars()
creates toolbar
Definition mainWindow.cpp:1048
void mnuScriptStepOver()
slot invoked to execute a python debugging step over
Definition mainWindow.cpp:2760
~MainWindow()
destructor
Definition mainWindow.cpp:536
MainWindow()
constructor
Definition mainWindow.cpp:101
bool m_pythonBusy
Definition mainWindow.h:141
void mnuOpenFile()
slot invoked by action to open any known file format
Definition mainWindow.cpp:1574
void mainWindowCloseRequest(bool considerPythonBusy)
void pythonStateChanged(tPythonTransitions pyTransition)
Definition mainWindow.cpp:1450
void mnuNewScript()
slot invoked by action to open a new python script
Definition mainWindow.cpp:1557
void updatePythonActions()
updates actions which deal with python commands
Definition mainWindow.cpp:1529
void pythonDebugCommand(tPythonDbgCmd cmd)
bool pythonDebugMode() const
Definition mainWindow.h:73
void removeAbstractDock(AbstractDockWidget *dockWidget)
Definition mainWindow.cpp:793
bool pythonInWaitingMode() const
Definition mainWindow.h:74
HelpSystem * m_pHelpSystem
label for showing current directory in status bar
Definition mainWindow.h:124
QLabel * m_pStatusLblPythonBusy
label for showing basic information about the script, that has currently the focus,...
Definition mainWindow.h:130
bool m_pythonInWaitingMode
Definition mainWindow.h:143
void closeEvent(QCloseEvent *event)
close event invoked if main window should be closed (and therefore the whole application too)
Definition mainWindow.cpp:861
void mnuScriptStep()
slot invoked to execute a python debugging step
Definition mainWindow.cpp:2753
void createActions()
creates actions for menu and toolbar
Definition mainWindow.cpp:888
Class for managing status values (like errors or warning)
Definition retVal.h:54
docking widget for contents of type workspace widget
Definition workspaceDockWidget.h:39
Definition apiFunctionsGraph.cpp:40