Commit 742fcf8d authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps : première version presque fonctionnelle..

parent 78546092
...@@ -29,20 +29,23 @@ file( ...@@ -29,20 +29,23 @@ file(
${SCHNApps_ROOT_DIR}/src/splitArea.cpp ${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${SCHNApps_ROOT_DIR}/src/system.cpp ${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp ${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp ${SCHNApps_ROOT_DIR}/src/window.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/cameraViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginDialog.cpp
) )
SET(SCHNApps_H_OBJECT_FILES SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/window.h ${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/scene.h ${SCHNApps_ROOT_DIR}/include/scene.h
${SCHNApps_ROOT_DIR}/include/view.h ${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/system.h
${SCHNApps_ROOT_DIR}/include/splitArea.h ${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/viewSelector.h
${SCHNApps_ROOT_DIR}/include/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/pluginDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h # ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
...@@ -54,7 +57,9 @@ SET(SCHNApps_H_OBJECT_FILES ...@@ -54,7 +57,9 @@ SET(SCHNApps_H_OBJECT_FILES
file( file(
GLOB GLOB
SCHNApps_FORM_FILES SCHNApps_FORM_FILES
${SCHNApps_ROOT_DIR}/forms/*.ui ${SCHNApps_ROOT_DIR}/forms/window.ui
${SCHNApps_ROOT_DIR}/forms/cameraViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginDialog.ui
) )
QT4_WRAP_UI( UI_H_FILES QT4_WRAP_UI( UI_H_FILES
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
* conditions. * conditions.
* If this methods return 'false', the plugin load will be aborted. * If this methods return 'false', the plugin load will be aborted.
*/ */
bool activate(); bool enable();
/** /**
* The plugin's disabling method * The plugin's disabling method
......
...@@ -26,7 +26,7 @@ void FirstPlugin::cb_redraw(Scene *scene) ...@@ -26,7 +26,7 @@ void FirstPlugin::cb_redraw(Scene *scene)
m_render_topo->drawTopo(); m_render_topo->drawTopo();
} }
bool FirstPlugin::activate() bool FirstPlugin::enable()
{ {
// creation of 2 new faces: 1 triangle and 1 square // creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3); Dart d1 = myMap.newFace(3);
......
...@@ -31,20 +31,23 @@ file( ...@@ -31,20 +31,23 @@ file(
${SCHNApps_ROOT_DIR}/src/splitArea.cpp ${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${SCHNApps_ROOT_DIR}/src/system.cpp ${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp ${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp ${SCHNApps_ROOT_DIR}/src/window.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/cameraViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginDialog.cpp
) )
SET(SCHNApps_H_OBJECT_FILES SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/window.h ${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/scene.h ${SCHNApps_ROOT_DIR}/include/scene.h
${SCHNApps_ROOT_DIR}/include/view.h ${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/system.h
${SCHNApps_ROOT_DIR}/include/splitArea.h ${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/viewSelector.h
${SCHNApps_ROOT_DIR}/include/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/pluginDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h # ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h # ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
...@@ -56,7 +59,9 @@ SET(SCHNApps_H_OBJECT_FILES ...@@ -56,7 +59,9 @@ SET(SCHNApps_H_OBJECT_FILES
file( file(
GLOB GLOB
SCHNApps_FORM_FILES SCHNApps_FORM_FILES
${SCHNApps_ROOT_DIR}/forms/*.ui ${SCHNApps_ROOT_DIR}/forms/window.ui
${SCHNApps_ROOT_DIR}/forms/cameraViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginDialog.ui
) )
QT4_WRAP_UI( UI_H_FILES QT4_WRAP_UI( UI_H_FILES
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CVDialog</class>
<widget class="QDialog" name="CVDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>352</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Chosissez une caméra courante:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Liste des caméras de la vue.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Double-cliquez sur item pour changer le nom des caméras.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="add_Button">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ajouter une nouvelle caméra.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="remove_Button">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Supprimer un caméra.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="settings_Button">
<property name="text">
<string>O</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OK_Button">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>OK_Button</sender>
<signal>clicked()</signal>
<receiver>CVDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>230</x>
<y>328</y>
</hint>
<hint type="destinationlabel">
<x>128</x>
<y>175</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Dialog</class> <class>PluginDialog</class>
<widget class="QDialog" name="Dialog"> <widget class="QDialog" name="PluginDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>PluginDialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<connection> <connection>
<sender>OKButton</sender> <sender>OKButton</sender>
<signal>pressed()</signal> <signal>pressed()</signal>
<receiver>Dialog</receiver> <receiver>PluginDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
...@@ -145,9 +145,9 @@ ...@@ -145,9 +145,9 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>Dialog</sender> <sender>PluginDialog</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>Dialog</receiver> <receiver>PluginDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionManagePlugins"/> <addaction name="actionManagePlugins"/>
<addaction name="actionManageView"/> <addaction name="actionManageViews"/>
<addaction name="actionManageCameras"/> <addaction name="actionManageCameras"/>
<addaction name="actionManageMaps"/> <addaction name="actionManageMaps"/>
</widget> </widget>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<string>Manage plugins</string> <string>Manage plugins</string>
</property> </property>
</action> </action>
<action name="actionManageView"> <action name="actionManageViews">
<property name="icon"> <property name="icon">
<iconset resource="../resources/resources.qrc"> <iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/add_view.png</normaloff>:/icons/icons/add_view.png</iconset> <normaloff>:/icons/icons/add_view.png</normaloff>:/icons/icons/add_view.png</iconset>
......
#ifndef _CAMERA_H_ #ifndef _CAMERA_H_
#define _CAMERA_H_ #define _CAMERA_H_
#include "types.h" #include "view.h"
#include "QGLViewer/camera.h" #include "QGLViewer/camera.h"
class Window; class Window;
class View;
class Camera : public qglviewer::Camera class Camera : public qglviewer::Camera
{ {
public: public:
static unsigned int cameraCount;
Camera(const QString& name, Window* window); Camera(const QString& name, Window* window);
Camera(const QString& name, Window* window, const qglviewer::Camera& c);
~Camera(); ~Camera();
void setName(QString name) { m_name = name; } const QString& getName() { return m_name; }
QString getName() { return m_name; } void setName(const QString& name) { m_name = name; }
Window* getWindow() { return m_window; } Window* getWindow() { return m_window; }
void setWindow(Window* w) { m_window = w; } void setWindow(Window* w) { m_window = w; }
bool isUsed() { return l_views.size() > 0; }
bool isShared() { return l_views.size() > 1; } bool isShared() { return l_views.size() > 1; }
void draw(); void draw();
...@@ -56,8 +57,6 @@ public: ...@@ -56,8 +57,6 @@ public:
// void viewShowButton(bool b); // void viewShowButton(bool b);
protected: protected:
static unsigned int cameraCount;
QString m_name; QString m_name;
Window* m_window; Window* m_window;
......
#ifndef _CAMERAVIEWDIALOG_H_ #ifndef _CAMERAVIEWDIALOG_H_
#define _CAMERAVIEWDIALOG_H_ #define _CAMERAVIEWDIALOG_H_
#include "ui_cameraViewDialog.h" #include "ui_cameraViewDialog.h"
class View; class Window;
class Camera;
class CameraViewDialog : public QDialog, Ui::CVDialog{ class CameraViewDialog : public QDialog, Ui::CameraViewDialog
{
Q_OBJECT Q_OBJECT
public: public:
CameraViewDialog(View* view, QWidget* parent=0); CameraViewDialog(Window* window);
~CameraViewDialog(); ~CameraViewDialog();
protected: private:
View* view; void updateCameraList();
void updateViewList();
protected slots: Window* m_window;
void addCamera();
void removeCamera();
void changeCurrentCamera(QListWidgetItem * current, QListWidgetItem * previous);
void cameraNameChange(QListWidgetItem * item);
void settingsCamera();
private: public slots:
bool autoText; void cb_addCamera();
void cb_removeCamera();
void cb_selectedViewChanged(QListWidgetItem* current, QListWidgetItem* previous);
void cb_selectedCameraChanged(QListWidgetItem* current, QListWidgetItem* previous);
}; };
#endif #endif
#ifndef _CONTEXT_H_ #ifndef _CONTEXT_H_
#define _CONTEXT_H_ #define _CONTEXT_H_
#include "types.h"
#include <QGLContext> #include <QGLContext>
class Context : public QGLContext class Context : public QGLContext
{ {
public: public:
Context(const QGLFormat& format, QWidget* w); Context(const QGLFormat& format);
void setDevice(QWidget* w); void setDevice(QWidget* w);
}; };
......
...@@ -3,28 +3,18 @@ ...@@ -3,28 +3,18 @@
#include "ui_pluginDialog.h" #include "ui_pluginDialog.h"
#include <QDir>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNode>
#include <QTextStream>
#include "types.h" #include "types.h"
class Plugin; class PluginDialog : public QDialog, public Ui::PluginDialog
class Window;
class PluginDialog : public QDialog, public Ui::Dialog
{ {
Q_OBJECT Q_OBJECT
public: public:
PluginDialog(Window* parent = 0, PluginHash* activePlugins = NULL); PluginDialog(Window* window);
~PluginDialog(); ~PluginDialog();
protected: protected:
Window* parentWindow; Window* m_window;
PluginHash* activePlugins;
bool restoreState(); bool restoreState();
...@@ -49,7 +39,7 @@ protected slots: ...@@ -49,7 +39,7 @@ protected slots:
void cb_acceptDialog(); void cb_acceptDialog();
void showPluginInfo(); // void showPluginInfo();
}; };
#endif #endif
#ifndef _SCENE_H_ #ifndef _SCENE_H_
#define _SCENE_H_ #define _SCENE_H_
#include <QList>
#include <QString>
#include <QHash>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include "types.h" #include "types.h"
class Window; class QKeyEvent;
class Plugin; class QMouseEvent;
class View; class QWheelEvent;
class Camera;
//class Context;
class ViewButton;
class Scene : public QObject class Scene : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static unsigned int sceneCount;
Scene(const QString& name, Window* window); Scene(const QString& name, Window* window);
~Scene(); ~Scene();
...@@ -32,8 +23,8 @@ public: ...@@ -32,8 +23,8 @@ public:
Window* getWindow() { return m_window; } Window* getWindow() { return m_window; }
void setWindow(Window* w) { m_window = w; } void setWindow(Window* w) { m_window = w; }
QGLContext* getContext() { return m_context; } Context* getContext() { return m_context; }
void setContext(QGLContext* c) { m_context = c; } void setContext(Context* c) { m_context = c; }
void initGL(); void initGL();
void updateGL(); void updateGL();
...@@ -76,11 +67,9 @@ public: ...@@ -76,11 +67,9 @@ public:
void firstViewFitSphere(float x, float y, float z, float radius); void firstViewFitSphere(float x, float y, float z, float radius);
protected: protected:
static unsigned int sceneCount;
QString m_name; QString m_name;
Window* m_window; Window* m_window;
QGLContext* m_context; Context* m_context;
QList<View*> l_views; QList<View*> l_views;
QList<Plugin*> l_plugins; QList<Plugin*> l_plugins;
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "types.h"