itom 1.4.0
|
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 APPMANAGEMENT_H 00024 #define APPMANAGEMENT_H 00025 00026 //#include <qstring.h> 00027 #include <qobject.h> 00028 #include <qmutex.h> 00029 00030 class QTextCode; 00031 00032 namespace ito 00033 { 00034 00035 /* content */ 00036 00038 // without causing many circular includes. 00039 class AppManagement 00040 { 00041 public: 00042 static QString getSettingsFile(); 00043 00044 inline static QObject* getScriptEditorOrganizer() { QMutexLocker locker(&m_mutex); return m_sew; } 00045 inline static QObject* getPythonEngine() { QMutexLocker locker(&m_mutex); return m_pe; } 00047 inline static QObject* getPaletteOrganizer() { QMutexLocker locker(&m_mutex); return m_plo; } 00048 inline static QObject* getDesignerWidgetOrganizer() { QMutexLocker locker(&m_mutex); return m_dwo; } 00050 inline static QObject* getMainApplication() { QMutexLocker locker (&m_mutex); return m_app; } 00051 static QObject* getAddInManager(); 00052 inline static QObject* getMainWindow() { QMutexLocker locker (&m_mutex); return m_mainWin; } 00053 inline static QObject* getUiOrganizer() { QMutexLocker locker (&m_mutex); return m_uiOrganizer; } 00054 inline static QObject* getProcessOrganizer() { QMutexLocker locker (&m_mutex); return m_processOrganizer; } 00055 inline static QObject* getUserOrganizer() { QMutexLocker locker (&m_mutex); return m_userOrganizer; } 00056 00057 static QTextCodec* getScriptTextCodec(); 00058 static void setScriptTextCodec(QTextCodec *codec); 00059 00060 00061 static void setScriptEditorOrganizer(QObject* scriptEditorOrganizer) 00062 { 00063 QMutexLocker locker(&m_mutex); 00064 m_sew = scriptEditorOrganizer; 00065 } 00066 00067 static void setPythonEngine(QObject* pythonEngine) 00068 { 00069 QMutexLocker locker(&m_mutex); 00070 m_pe = pythonEngine; 00071 } 00072 00073 static void setPaletteOrganizer(QObject* paletteOrganizer) 00074 { 00075 QMutexLocker locker(&m_mutex); 00076 m_plo = paletteOrganizer; 00077 } 00078 00079 static void setDesignerWidgetOrganizer(QObject* designerWidgetOrganizer) 00080 { 00081 QMutexLocker locker(&m_mutex); 00082 m_dwo = designerWidgetOrganizer; 00083 } 00084 00085 static void setMainApplication(QObject* mainApplication) 00086 { 00087 QMutexLocker locker(&m_mutex); 00088 m_app = mainApplication; 00089 } 00090 00091 static void setMainWindow(QObject* mainWindow) 00092 { 00093 QMutexLocker locker(&m_mutex); 00094 m_mainWin = mainWindow; 00095 } 00096 00097 static void setUiOrganizer(QObject* uiOrganizer) 00098 { 00099 QMutexLocker locker(&m_mutex); 00100 m_uiOrganizer = uiOrganizer; 00101 } 00102 00103 static void setProcessOrganizer(QObject* processOrganizer) 00104 { 00105 QMutexLocker locker(&m_mutex); 00106 m_processOrganizer = processOrganizer; 00107 } 00108 00109 static void setUserOrganizer(QObject* userOrganizer) 00110 { 00111 QMutexLocker locker(&m_mutex); 00112 m_userOrganizer = userOrganizer; 00113 } 00114 00115 struct Timeouts 00116 { 00117 int pluginInitClose; 00118 int pluginGeneral; 00119 }; 00120 00121 static Timeouts timeouts; 00122 00123 private: 00124 static QObject* m_sew; 00125 static QObject* m_pe; 00126 static QObject* m_dwo; 00127 static QObject* m_plo; 00128 static QObject* m_app; 00129 static QObject* m_mainWin; 00130 static QObject* m_uiOrganizer; 00131 static QObject* m_processOrganizer; 00132 static QObject *m_userOrganizer; 00133 static QTextCodec *m_scriptTextCodec; 00134 static QMutex m_mutex; 00136 }; 00137 00138 } //end namespace ito 00139 00140 #endif // APPMANAGEMENT_H