itom  4.1.0
AppManagement.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet 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 #ifndef APPMANAGEMENT_H
24 #define APPMANAGEMENT_H
25 
26 //#include <qstring.h>
27 #include <qobject.h>
28 #include <qmutex.h>
29 
30 class QTextCodec;
31 
32 namespace ito
33 {
34 
35 /* content */
36 
38 // without causing many circular includes.
40 {
41  public:
42  static QString getSettingsFile();
43 
44  inline static QObject* getScriptEditorOrganizer() { QMutexLocker locker(&m_mutex); return m_sew; }
45  inline static QObject* getPythonEngine() { QMutexLocker locker(&m_mutex); return m_pe; }
46  inline static QObject* getPythonStatePublisher() { QMutexLocker locker(&m_mutex); return m_psp; }
48  inline static QObject* getPaletteOrganizer() { QMutexLocker locker(&m_mutex); return m_plo; }
49  inline static QObject* getDesignerWidgetOrganizer() { QMutexLocker locker(&m_mutex); return m_dwo; }
51  inline static QObject* getMainApplication() { QMutexLocker locker (&m_mutex); return m_app; }
52  inline static QObject* getAddInManager() { QMutexLocker locker(&m_mutex); return m_addInManager; }
53  inline static QObject* getMainWindow() { QMutexLocker locker (&m_mutex); return m_mainWin; }
54  inline static QObject* getUiOrganizer() { QMutexLocker locker (&m_mutex); return m_uiOrganizer; }
55  inline static QObject* getProcessOrganizer() { QMutexLocker locker (&m_mutex); return m_processOrganizer; }
56  inline static QObject* getUserOrganizer() { QMutexLocker locker (&m_mutex); return m_userOrganizer; }
57  inline static QObject* getCoutStream() { QMutexLocker locker (&m_mutex); return m_coutStream; }
58  inline static QObject* getCerrStream() { QMutexLocker locker (&m_mutex); return m_cerrStream; }
59 
60  static QTextCodec* getScriptTextCodec();
61  static void setScriptTextCodec(QTextCodec *codec);
62 
63 
64  static void setScriptEditorOrganizer(QObject* scriptEditorOrganizer)
65  {
66  QMutexLocker locker(&m_mutex);
67  m_sew = scriptEditorOrganizer;
68  }
69 
70  static void setAddInManager(QObject* addInManager)
71  {
72  QMutexLocker locker(&m_mutex);
73  m_addInManager = addInManager;
74  }
75 
76  static void setPythonEngine(QObject* pythonEngine)
77  {
78  QMutexLocker locker(&m_mutex);
79  m_pe = pythonEngine;
80  }
81 
82  static void setPythonStatePublisher(QObject* pythonStatePublisher)
83  {
84  QMutexLocker locker(&m_mutex);
85  m_psp = pythonStatePublisher;
86  }
87 
88  static void setPaletteOrganizer(QObject* paletteOrganizer)
89  {
90  QMutexLocker locker(&m_mutex);
91  m_plo = paletteOrganizer;
92  }
93 
94  static void setDesignerWidgetOrganizer(QObject* designerWidgetOrganizer)
95  {
96  QMutexLocker locker(&m_mutex);
97  m_dwo = designerWidgetOrganizer;
98  }
99 
100  static void setMainApplication(QObject* mainApplication)
101  {
102  QMutexLocker locker(&m_mutex);
103  m_app = mainApplication;
104  }
105 
106  static void setMainWindow(QObject* mainWindow)
107  {
108  QMutexLocker locker(&m_mutex);
109  m_mainWin = mainWindow;
110  }
111 
112  static void setUiOrganizer(QObject* uiOrganizer)
113  {
114  QMutexLocker locker(&m_mutex);
115  m_uiOrganizer = uiOrganizer;
116  }
117 
118  static void setProcessOrganizer(QObject* processOrganizer)
119  {
120  QMutexLocker locker(&m_mutex);
121  m_processOrganizer = processOrganizer;
122  }
123 
124  static void setUserOrganizer(QObject* userOrganizer)
125  {
126  QMutexLocker locker(&m_mutex);
127  m_userOrganizer = userOrganizer;
128  }
129 
130  static void setStdCoutCerrStreamRedirections(QObject* coutStream, QObject* cerrStream)
131  {
132  QMutexLocker locker(&m_mutex);
133  m_coutStream = coutStream;
134  m_cerrStream = cerrStream;
135  }
136 
137  struct Timeouts
138  {
139  int pluginInitClose;
140  int pluginGeneral;
141  int pluginFileSaveLoad;
142  };
143 
144  static Timeouts timeouts;
145 
146  private:
147  static QObject* m_sew;
148  static QObject* m_pe;
149  static QObject* m_psp;
150  static QObject* m_dwo;
151  static QObject* m_plo;
152  static QObject* m_app;
153  static QObject* m_mainWin;
154  static QObject* m_addInManager;
155  static QObject* m_uiOrganizer;
156  static QObject* m_processOrganizer;
157  static QObject *m_userOrganizer;
158  static QObject* m_coutStream;
159  static QObject* m_cerrStream;
160  static QTextCodec *m_scriptTextCodec;
161  static QMutex m_mutex;
163 };
164 
165 } //end namespace ito
166 
167 #endif // APPMANAGEMENT_H
static QObject * m_uiOrganizer
Definition: AppManagement.h:155
static QObject * m_userOrganizer
Definition: AppManagement.h:157
static void setAddInManager(QObject *addInManager)
Definition: AppManagement.h:70
Definition: AppManagement.h:137
static void setPythonEngine(QObject *pythonEngine)
Definition: AppManagement.h:76
static QTextCodec * m_scriptTextCodec
Definition: AppManagement.h:160
static QObject * m_sew
Definition: AppManagement.h:147
< AppManagement (in order to provide access to basic organizers, managers and other main components t...
Definition: AppManagement.h:39
static QObject * m_pe
Definition: AppManagement.h:148
static QObject * getProcessOrganizer()
Definition: AppManagement.h:55
static QObject * m_dwo
Definition: AppManagement.h:150
static void setPaletteOrganizer(QObject *paletteOrganizer)
Definition: AppManagement.h:88
static QObject * m_app
Definition: AppManagement.h:152
Definition: apiFunctionsGraph.cpp:39
static QMutex m_mutex
Definition: AppManagement.h:161
static QObject * getPaletteOrganizer()
Definition: AppManagement.h:48
static void setPythonStatePublisher(QObject *pythonStatePublisher)
Definition: AppManagement.h:82
static QObject * getPythonStatePublisher()
Definition: AppManagement.h:46
static QObject * getPythonEngine()
Definition: AppManagement.h:45
static void setDesignerWidgetOrganizer(QObject *designerWidgetOrganizer)
Definition: AppManagement.h:94
static QObject * getScriptEditorOrganizer()
Definition: AppManagement.h:44
static QObject * m_plo
Definition: AppManagement.h:151
static void setScriptEditorOrganizer(QObject *scriptEditorOrganizer)
Definition: AppManagement.h:64
static QObject * m_processOrganizer
Definition: AppManagement.h:156
static QObject * getDesignerWidgetOrganizer()
Definition: AppManagement.h:49
static QObject * m_psp
Definition: AppManagement.h:149
static QObject * m_coutStream
Definition: AppManagement.h:158
static QObject * m_cerrStream
Definition: AppManagement.h:159
static QObject * getUiOrganizer()
Definition: AppManagement.h:54