system.h 3.29 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
#ifndef _SYSTEM_H_
#define _SYSTEM_H_

#include <QWidget>
#include <QSplashScreen>

#include <unistd.h>
#include <stdarg.h>
#include <iostream>

#include "types.h"

#include "ui_questionSessionDialog.h"
#include "ui_infoDialog.h"

class Window;
class SplitArea;

namespace System{

	namespace Dialog{
		class QuestionSessionDialog : public QDialog, public Ui::QSDialog{
			Q_OBJECT
		public:
			QuestionSessionDialog(QWidget* parent=0) : QDialog(parent){ this->setupUi(this);}
		};


		class InfoDialog : public QDialog, public Ui::InfoDialog{
			Q_OBJECT
		public:
			InfoDialog(QWidget* parent=0) : QDialog(parent){ this->setupUi(this);}

			bool setContent(QUrl urlHTMLFile);
		};
	}

	class Error{
	public:
		virtual ~Error() =0;

		typedef enum{SUCCESS, NO_SCENE, SCENE_UNREFERENCED, SCENE_EXISTS, NO_DOCK, NO_PLUGIN_PATH_FILE,
					ERROR_OPEN_PLUGIN_FILE ,BAD_PLUGIN_PATH_FILE, BAD_PLUGIN_PATH_IN_FILE, NO_PLUGIN_IN_DIR,
					PLUGIN_EXISTS, ERROR_PLUGIN_LOAD, BAD_LINK_PLUGIN_WINDOW, UNSATSIFIED_PLUGIN_DEPENDENCIE,
					BAD_ACTION_MENU_PATH, MAP_UNREFERENCED, MAP_EXISTS, SHADER_EXISTS, SHADER_NOT_FOUND,
					VBO_EXISTS, VBO_NOT_FOUND, TOPO3RENDER_EXISTS, TOPO3RENDER_NOT_FOUND, OPEN_FILE_ERROR,
					BAD_XML_FILE} ERROR_CODE;


		static QString parameter;

		static ERROR_CODE code;

		static ERROR_CODE BAD_PLUGIN_PATH_IN_FILE_f(QString file);
		static ERROR_CODE NO_PLUGIN_IN_DIR_f(QString dir);
		static ERROR_CODE PLUGIN_EXISTS_f(QString plugin);
		static ERROR_CODE ERROR_PLUGIN_LOAD_f(QString plugin);
		static ERROR_CODE BAD_LINK_PLUGIN_WINDOW_f(QString plugin);
		static ERROR_CODE UNSATSIFIED_PLUGIN_DEPENDENCIE_f(QString dependencie, QString from=QString());
		static ERROR_CODE BAD_ACTION_MENU_PATH_f(QString actionPath);
		static ERROR_CODE MAP_UNREFERENCED_f(QString map_name);
		static ERROR_CODE MAP_EXISTS_f(QString map_name);
		static ERROR_CODE SHADER_EXISTS_f(QString shader_name, QString glv_name=QString());
		static ERROR_CODE SHADER_NOT_FOUND_f(QString shader_name, QString glv_name=QString());
		static ERROR_CODE VBO_EXISTS_f(QString vbo_name, QString glv_name=QString());
		static ERROR_CODE VBO_NOT_FOUND_f(QString vbo_name, QString glv_name=QString());
		static ERROR_CODE TOPO3RENDER_EXISTS_f(QString name, QString glv_name=QString());
		static ERROR_CODE TOPO3RENDER_NOT_FOUND_f(QString name, QString glv_name=QString());
		static ERROR_CODE OPEN_FILE_ERROR_f(QString filepath);
		static ERROR_CODE BAD_XML_FILE_f(QString filepath);

		static void showError(QWidget* parent=0);
	};

	class Events{
	public:
		virtual ~Events() =0;

		static bool movieDialogOpened;
	};

	class Info{
	public:
		virtual ~Info() =0;

		static void showPluginInfo(QString pluginAbsolutePath, QWidget* parent=0);
		static void showPluginInfo(QString locationPath, QString pluginName, QWidget* parent=0);
	};

	class StateHandler{
	public:
		virtual ~StateHandler() =0;

		static bool saveState(Window* window, PluginHash* pluginHash, SceneHash* sceneHash, SplitArea* splitArea);
		static bool loadState(Window* window, PluginHash* pluginHash, SceneHash* sceneHash, SplitArea* splitArea);
		static void unsaveState();
		static bool savePluginsInfo(Window* window, PluginHash* pluginHash, QStringList paths);
	};

	typedef enum{GLVIEWER_IN_DOCK, SIMPLE_GLVIEWER} QGLV_CREATE_SETTINGS;

	extern QString app_path;

	extern QSplashScreen* splash;
}

#endif