itom  3.0.0
AppManagement.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, 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; }
47  inline static QObject* getPaletteOrganizer() { QMutexLocker locker(&m_mutex); return m_plo; }
48  inline static QObject* getDesignerWidgetOrganizer() { QMutexLocker locker(&m_mutex); return m_dwo; }
50  inline static QObject* getMainApplication() { QMutexLocker locker (&m_mutex); return m_app; }
51  inline static QObject* getAddInManager() { QMutexLocker locker(&m_mutex); return m_addInManager; }
52  inline static QObject* getMainWindow() { QMutexLocker locker (&m_mutex); return m_mainWin; }
53  inline static QObject* getUiOrganizer() { QMutexLocker locker (&m_mutex); return m_uiOrganizer; }
54  inline static QObject* getProcessOrganizer() { QMutexLocker locker (&m_mutex); return m_processOrganizer; }
55  inline static QObject* getUserOrganizer() { QMutexLocker locker (&m_mutex); return m_userOrganizer; }
56 
57  static QTextCodec* getScriptTextCodec();
58  static void setScriptTextCodec(QTextCodec *codec);
59 
60 
61  static void setScriptEditorOrganizer(QObject* scriptEditorOrganizer)
62  {
63  QMutexLocker locker(&m_mutex);
64  m_sew = scriptEditorOrganizer;
65  }
66 
67  static void setAddInManager(QObject* addInManager)
68  {
69  QMutexLocker locker(&m_mutex);
70  m_addInManager = addInManager;
71  }
72 
73  static void setPythonEngine(QObject* pythonEngine)
74  {
75  QMutexLocker locker(&m_mutex);
76  m_pe = pythonEngine;
77  }
78 
79  static void setPaletteOrganizer(QObject* paletteOrganizer)
80  {
81  QMutexLocker locker(&m_mutex);
82  m_plo = paletteOrganizer;
83  }
84 
85  static void setDesignerWidgetOrganizer(QObject* designerWidgetOrganizer)
86  {
87  QMutexLocker locker(&m_mutex);
88  m_dwo = designerWidgetOrganizer;
89  }
90 
91  static void setMainApplication(QObject* mainApplication)
92  {
93  QMutexLocker locker(&m_mutex);
94  m_app = mainApplication;
95  }
96 
97  static void setMainWindow(QObject* mainWindow)
98  {
99  QMutexLocker locker(&m_mutex);
100  m_mainWin = mainWindow;
101  }
102 
103  static void setUiOrganizer(QObject* uiOrganizer)
104  {
105  QMutexLocker locker(&m_mutex);
106  m_uiOrganizer = uiOrganizer;
107  }
108 
109  static void setProcessOrganizer(QObject* processOrganizer)
110  {
111  QMutexLocker locker(&m_mutex);
112  m_processOrganizer = processOrganizer;
113  }
114 
115  static void setUserOrganizer(QObject* userOrganizer)
116  {
117  QMutexLocker locker(&m_mutex);
118  m_userOrganizer = userOrganizer;
119  }
120 
121  struct Timeouts
122  {
123  int pluginInitClose;
124  int pluginGeneral;
125  int pluginFileSaveLoad;
126  };
127 
128  static Timeouts timeouts;
129 
130  private:
131  static QObject* m_sew;
132  static QObject* m_pe;
133  static QObject* m_dwo;
134  static QObject* m_plo;
135  static QObject* m_app;
136  static QObject* m_mainWin;
137  static QObject* m_addInManager;
138  static QObject* m_uiOrganizer;
139  static QObject* m_processOrganizer;
140  static QObject *m_userOrganizer;
141  static QTextCodec *m_scriptTextCodec;
142  static QMutex m_mutex;
144 };
145 
146 } //end namespace ito
147 
148 #endif // APPMANAGEMENT_H
static QObject * m_uiOrganizer
Definition: AppManagement.h:138
static QObject * m_userOrganizer
Definition: AppManagement.h:140
static void setAddInManager(QObject *addInManager)
Definition: AppManagement.h:67
Definition: AppManagement.h:121
static void setPythonEngine(QObject *pythonEngine)
Definition: AppManagement.h:73
static QTextCodec * m_scriptTextCodec
Definition: AppManagement.h:141
static QObject * m_sew
Definition: AppManagement.h:131
< 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:132
static QObject * getProcessOrganizer()
Definition: AppManagement.h:54
static QObject * m_dwo
Definition: AppManagement.h:133
static void setPaletteOrganizer(QObject *paletteOrganizer)
Definition: AppManagement.h:79
static QObject * m_app
Definition: AppManagement.h:135
Definition: apiFunctionsGraph.cpp:39
static QMutex m_mutex
Definition: AppManagement.h:142
static QObject * getPaletteOrganizer()
Definition: AppManagement.h:47
static QObject * getPythonEngine()
Definition: AppManagement.h:45
static void setDesignerWidgetOrganizer(QObject *designerWidgetOrganizer)
Definition: AppManagement.h:85
static QObject * getScriptEditorOrganizer()
Definition: AppManagement.h:44
static QObject * m_plo
Definition: AppManagement.h:134
static void setScriptEditorOrganizer(QObject *scriptEditorOrganizer)
Definition: AppManagement.h:61
static QObject * m_processOrganizer
Definition: AppManagement.h:139
static QObject * getDesignerWidgetOrganizer()
Definition: AppManagement.h:48
static QObject * getUiOrganizer()
Definition: AppManagement.h:53