itom 1.0.14
|
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 SCRIPTEDITORORGANIZER_H 00024 #define SCRIPTEDITORORGANIZER_H 00025 00026 #include "../widgets/scriptDockWidget.h" 00027 #include "../common/sharedStructuresQt.h" 00028 00029 class ScriptEditorOrganizer : public QObject 00030 { 00031 Q_OBJECT 00032 public: 00033 ScriptEditorOrganizer( bool dockAvailable); 00034 ~ScriptEditorOrganizer(); 00035 00036 RetVal saveAllScripts(bool askFirst = true, bool ignoreNewScripts = false); 00037 RetVal closeAllScripts(bool saveFirst); 00038 00039 protected: 00040 ScriptDockWidget* createEmptyScriptDock(bool docked); 00041 00042 private: 00043 ScriptDockWidget* getFirstDockedElement(); 00044 ScriptDockWidget* getFirstUndockedElement(); 00045 ScriptDockWidget* getActiveDockWidget(); 00046 00047 QList<ScriptDockWidget*> scriptDockElements; 00048 bool m_dockAvailable; 00049 00050 QMutex m_scriptStackMutex; 00051 00052 signals: 00053 void addScriptDockWidgetToMainWindow(AbstractDockWidget *dockWidget, Qt::DockWidgetArea area); 00054 void removeScriptDockWidgetFromMainWindow(AbstractDockWidget *dockWidget); 00055 00056 void pythonRunFile(QString filename); 00057 void pythonDebugFile(QString filename); 00058 00059 00060 public slots: 00061 void removeScriptDockWidget(ScriptDockWidget* widget); 00062 00063 void dockScriptTab(ScriptDockWidget* widget, int index, bool closeDockIfEmpty = false); 00064 void undockScriptTab(ScriptDockWidget* widget, int index, bool undockToNewScriptWindow = false, bool closeDockIfEmpty = false); 00065 00066 void openNewScriptWindow(bool docked, ItomSharedSemaphore* semaphore = NULL); 00067 RetVal newScript(ItomSharedSemaphore* semaphore = NULL); 00068 RetVal openScript(QString filename, ItomSharedSemaphore* semaphore = NULL, int visibleLineNr = -1); 00069 00070 ScriptDockWidget* openScriptRequested(QString filename, ScriptDockWidget* widget); 00071 00072 void pythonRunFileRequested(QString filename); 00073 void pythonDebugFileRequested(QString filename); 00074 00075 void pythonDebugPositionChanged(QString filename, int lineNo); 00076 00077 private slots: 00078 00079 void widgetFocusChanged(QWidget* old, QWidget* now); 00080 00081 }; 00082 00083 #endif