window.h 6.16 KB
Newer Older
1 2 3 4 5
#ifndef _WINDOW_H_
#define _WINDOW_H_

#include "ui_window.h"

6
#include "types.h"
7 8
#include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h"
9

Pierre Kraemer's avatar
Pierre Kraemer committed
10 11 12
class QVBoxLayout;
class QSplitter;

Pierre Kraemer's avatar
Pierre Kraemer committed
13 14 15 16 17 18
namespace CGoGN
{

namespace SCHNApps
{

Pierre Kraemer's avatar
Pierre Kraemer committed
19 20 21 22
class CamerasDialog;
class PluginsDialog;
class MapsDialog;

Pierre Kraemer's avatar
Pierre Kraemer committed
23
struct Texture;
24 25 26 27 28 29

class Window : public QMainWindow, Ui::Window
{
	Q_OBJECT

public:
30
	Window(const QString& appPath, PythonQtObjectPtr& pythonContext, PythonQtScriptingConsole& pythonConsole);
31 32
	~Window();

Pierre Kraemer's avatar
Pierre Kraemer committed
33
public slots:
34
	const QString& getAppPath() { return m_appPath; }
Pierre Kraemer's avatar
Pierre Kraemer committed
35 36 37
	CamerasDialog* getCamerasDialog() { return m_camerasDialog; }
	PluginsDialog* getPluginsDialog() { return m_pluginsDialog; }
	MapsDialog* getMapsDialog() { return m_mapsDialog; }
38

Pierre Kraemer's avatar
Pierre Kraemer committed
39 40 41
	/*********************************************************
	 * MANAGE DOCK
	 *********************************************************/
42

43
	QTabWidget* getDockTabWidget() const { return m_dockTabWidget; }
44

Pierre Kraemer's avatar
Pierre Kraemer committed
45
public:
46
	void addTabInDock(QWidget* tabWidget, const QString& tabText, bool enable);
Pierre Kraemer's avatar
Pierre Kraemer committed
47 48
	void removeTabInDock(QWidget* tabWidget);

49
public slots:
50 51 52
	void enablePluginTabWidgets(Plugin* plugin);
	void disablePluginTabWidgets(Plugin* plugin);

Pierre Kraemer's avatar
Pierre Kraemer committed
53 54 55
	/*********************************************************
	 * MANAGE MENU ACTIONS
	 *********************************************************/
56

57
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
58 59 60 61 62 63 64 65 66 67
	bool addMenuAction(const QString& menuPath, QAction* action);
	void removeMenuAction(QAction* action);

	/*********************************************************
	 * MANAGE TOOLBAR ACTIONS
	 *********************************************************/

	bool addToolbarAction(QAction* action);
	void removeToolbarAction(QAction* action);

68 69 70 71 72 73 74
	/*********************************************************
	 * MANAGE CAMERAS
	 *********************************************************/

	Camera* addCamera(const QString& name);
	Camera* addCamera();
	void removeCamera(const QString& name);
75 76

public slots:
77
	Camera* getCamera(const QString& name) const;
78 79

public:
80 81
	QList<Camera*> getCamerasList() const { return h_cameras.values(); }
	const CameraHash& getCamerasHash() const { return h_cameras; }
82 83 84 85 86 87 88 89

	/*********************************************************
	 * MANAGE VIEWS
	 *********************************************************/

	View* addView(const QString& name);
	View* addView();
	void removeView(const QString& name);
90 91

public slots:
92
	View* getView(const QString& name) const;
93 94

public:
95 96 97 98 99 100
	QList<View*> getViewsList() const { return h_views.values(); }
	const ViewHash& getViewsHash() const { return h_views; }

	View* getCurrentView() const { return m_currentView; }
	void setCurrentView(View* view);

Pierre Kraemer's avatar
Pierre Kraemer committed
101
	void splitView(const QString& name, Qt::Orientation orientation);
102

Pierre Kraemer's avatar
Pierre Kraemer committed
103 104 105
	/*********************************************************
	 * MANAGE PLUGINS
	 *********************************************************/
106

107
public slots:
108 109
	void registerPluginsDirectory(const QString& path);

110
	Plugin* loadPlugin(const QString& pluginFilePath);
Pierre Kraemer's avatar
Pierre Kraemer committed
111
	void unloadPlugin(const QString& pluginName);
112

113 114 115
	Plugin* getPlugin(const QString& name) const;
	QList<Plugin*> getPluginsList() const { return h_plugins.values(); }
	const PluginHash& getPluginsHash() const { return h_plugins; }
116

117 118
	const QMap<QString, QString>& getAvailablePlugins() const { return m_availablePlugins; }

119 120 121
	/*********************************************************
	 * MANAGE MAPS
	 *********************************************************/
Pierre Kraemer's avatar
Pierre Kraemer committed
122

Pierre Kraemer's avatar
Pierre Kraemer committed
123
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
124
	MapHandlerGen* addMap(const QString& name, unsigned int dim);
125
	void removeMap(const QString& name);
Pierre Kraemer's avatar
Pierre Kraemer committed
126 127

public slots:
128
	MapHandlerGen* getMap(const QString& name) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
129 130

public:
131 132
	QList<MapHandlerGen*> getMapsList() const { return h_maps.values(); }
	const MapHash& getMapsHash() const { return h_maps; }
Pierre Kraemer's avatar
Pierre Kraemer committed
133

134 135 136 137 138
	/*********************************************************
	 * MANAGE LINKS
	 *********************************************************/

public slots:
139
	void linkViewAndCamera(View* v, Camera* c);
140
	void linkViewAndCamera(const QString& viewName, const QString& cameraName);
141 142

	void linkViewAndMap(View* v, MapHandlerGen* m);
143
	void linkViewAndMap(const QString& viewName, const QString& mapName);
144
	void unlinkViewAndMap(View* v, MapHandlerGen* m);
145
	void unlinkViewAndMap(const QString& viewName, const QString& mapName);
146

147
	void linkViewAndPlugin(View* v, Plugin* p);
148
	void linkViewAndPlugin(const QString& viewName, const QString& pluginName);
149
	void unlinkViewAndPlugin(View* v, Plugin* p);
150
	void unlinkViewAndPlugin(const QString& viewName, const QString& pluginName);
151

152 153 154 155
	/*********************************************************
	 * MANAGE TEXTURES
	 *********************************************************/

156
public:
157 158
	Texture* getTexture(const QString& image);
	void releaseTexture(const QString& image);
159 160

protected:
161
	QString m_appPath;
Pierre Kraemer's avatar
Pierre Kraemer committed
162
	PythonQtObjectPtr& m_pythonContext;
163
	PythonQtScriptingConsole& m_pythonConsole;
164

Pierre Kraemer's avatar
Pierre Kraemer committed
165 166 167
	QVBoxLayout* m_centralLayout;
	QSplitter* m_rootSplitter;
	bool b_rootSplitterInitialized;
168

169
	View* m_firstView;
170
	View* m_currentView;
171

Pierre Kraemer's avatar
Pierre Kraemer committed
172 173
	QDockWidget* m_dock;
	QTabWidget* m_dockTabWidget;
174

175 176
	QDockWidget* m_pythonDock;

177 178
	QMap<QString, QString> m_availablePlugins;

Pierre Kraemer's avatar
Pierre Kraemer committed
179
	PluginHash h_plugins;
180
	ViewHash h_views;
Pierre Kraemer's avatar
Pierre Kraemer committed
181
	CameraHash h_cameras;
182
	MapHash h_maps;
183

184 185
	TextureHash h_textures;

Pierre Kraemer's avatar
Pierre Kraemer committed
186 187 188
	CamerasDialog* m_camerasDialog;
	PluginsDialog* m_pluginsDialog;
	MapsDialog* m_mapsDialog;
189 190

public slots:
191 192
	void cb_aboutSCHNApps();
	void cb_aboutCGoGN();
193 194
	
	void cb_showHideDock();
195
	void cb_showHidePythonDock();
196
	void cb_loadPythonScript();
197

Pierre Kraemer's avatar
Pierre Kraemer committed
198 199 200
	void cb_showCamerasDialog();
	void cb_showPluginsDialog();
	void cb_showMapsDialog();
201

202 203 204 205 206 207
signals:
	void cameraAdded(Camera* camera);
	void cameraRemoved(Camera* camera);

	void viewAdded(View* view);
	void viewRemoved(View* view);
208
	void currentViewChanged(View* view);
209

210 211
	void mapAdded(MapHandlerGen* map);
	void mapRemoved(MapHandlerGen* map);
212

213 214
	void pluginLoaded(Plugin* plugin);
	void pluginUnloaded(Plugin* plugin);
215 216 217 218 219 220 221 222 223

	void viewAndCameraLinked(View* view, Camera* camera);
	void viewAndCameraUnlinked(View* view, Camera* camera);

	void viewAndMapLinked(View* view, MapHandlerGen* map);
	void viewAndMapUnlinked(View* view, MapHandlerGen* map);

	void viewAndPluginLinked(View* view, Plugin* plugin);
	void viewAndPluginUnlinked(View* view, Plugin* plugin);
224 225
};

Pierre Kraemer's avatar
Pierre Kraemer committed
226 227 228 229
} // namespace SCHNApps

} // namespace CGoGN

230
#endif