Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
b308066d
Commit
b308066d
authored
Dec 04, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: encore un petit souci d'affichage GL1 / GL2..
parent
95db7eb4
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
231 additions
and
162 deletions
+231
-162
CMakeLists.txt
CMakeLists.txt
+1
-0
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+1
-0
SCHNApps/Debug/CMakeLists.txt
SCHNApps/Debug/CMakeLists.txt
+5
-2
SCHNApps/Plugins/firstPlugin/include/firstPlugin.h
SCHNApps/Plugins/firstPlugin/include/firstPlugin.h
+5
-28
SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp
SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp
+23
-53
SCHNApps/Release/CMakeLists.txt
SCHNApps/Release/CMakeLists.txt
+5
-4
SCHNApps/include/camera.h
SCHNApps/include/camera.h
+5
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+11
-2
SCHNApps/include/plugin.h
SCHNApps/include/plugin.h
+11
-4
SCHNApps/include/system.h
SCHNApps/include/system.h
+5
-5
SCHNApps/include/types.h
SCHNApps/include/types.h
+3
-0
SCHNApps/include/view.h
SCHNApps/include/view.h
+7
-4
SCHNApps/include/viewButtonArea.h
SCHNApps/include/viewButtonArea.h
+7
-8
SCHNApps/include/window.h
SCHNApps/include/window.h
+10
-12
SCHNApps/src/camera.cpp
SCHNApps/src/camera.cpp
+7
-0
SCHNApps/src/mapHandler.cpp
SCHNApps/src/mapHandler.cpp
+10
-2
SCHNApps/src/plugin.cpp
SCHNApps/src/plugin.cpp
+8
-1
SCHNApps/src/pluginDialog.cpp
SCHNApps/src/pluginDialog.cpp
+19
-4
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+20
-12
SCHNApps/src/viewButtonArea.cpp
SCHNApps/src/viewButtonArea.cpp
+21
-17
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+47
-4
No files found.
CMakeLists.txt
View file @
b308066d
...
...
@@ -146,6 +146,7 @@ IF(WIN32)
# set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
ELSE
(
WIN32
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -fPIC"
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -fPIC"
)
add_subdirectory
(
Release
)
add_subdirectory
(
Debug
)
add_subdirectory
(
${
CGoGN_ROOT_DIR
}
/Apps Apps
)
...
...
SCHNApps/CMakeLists.txt
View file @
b308066d
...
...
@@ -8,6 +8,7 @@ SET( QT_USE_QTDESIGNER TRUE )
SET
(
QT_USE_QTGUI TRUE
)
SET
(
QT_USE_QTPLUGIN TRUE
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -fPIC"
)
#========CGoGN========#
SET
(
CGoGN_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
/.. CACHE STRING
"CGoGN root dir"
)
...
...
SCHNApps/Debug/CMakeLists.txt
View file @
b308066d
...
...
@@ -39,9 +39,12 @@ file(
)
SET
(
SCHNApps_H_OBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/camera.h
${
SCHNApps_ROOT_DIR
}
/include/mapHandler.h
${
SCHNApps_ROOT_DIR
}
/include/plugin.h
${
SCHNApps_ROOT_DIR
}
/include/splitArea.h
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/viewButtonArea.h
${
SCHNApps_ROOT_DIR
}
/include/viewSelector.h
${
SCHNApps_ROOT_DIR
}
/include/cameraDialog.h
...
...
SCHNApps/Plugins/firstPlugin/include/firstPlugin.h
View file @
b308066d
...
...
@@ -6,7 +6,8 @@
/**---CGoGN includes **/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Algo/Render/GL2/topoRender.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
/**---CGoGN includes **/
/**---Definitions specific to CGoGN ---*/
...
...
@@ -50,7 +51,6 @@ public:
FirstPlugin
()
{
setProvidesRendering
(
true
);
glewInit
();
}
~
FirstPlugin
()
...
...
@@ -87,34 +87,11 @@ public:
virtual
void
viewRemoved
(
View
*
view
)
{}
protected:
/** Attributes that are specific to this plugin **/
MAP
myMap
;
// attribute for vertices positions
VertexAttribute
<
VEC3
>
position
;
// render (for the topo)
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo
;
// just for more compact writing
inline
Dart
PHI1
(
Dart
d
)
{
return
myMap
.
phi1
(
d
);
}
inline
Dart
PHI_1
(
Dart
d
)
{
return
myMap
.
phi_1
(
d
);
}
inline
Dart
PHI2
(
Dart
d
)
{
return
myMap
.
phi2
(
d
);
}
template
<
int
X
>
Dart
PHI
(
Dart
d
)
{
return
myMap
.
phi
<
X
>
(
d
);
}
/** Attributes that are specific to this plugin **/
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
ShaderFlat
*
m_flatShader
;
};
#endif // _FIRSTPLUGIN_H_
SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp
View file @
b308066d
#include "firstPlugin.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Import/import.h"
bool
FirstPlugin
::
enable
()
{
// creation of 2 new faces: 1 triangle and 1 square
Dart
d1
=
myMap
.
newFace
(
3
);
Dart
d2
=
myMap
.
newFace
(
4
);
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_positionVBO
=
new
Utils
::
VBO
()
;
m_flatShader
=
new
Utils
::
ShaderFlat
()
;
m_flatShader
->
setAttributePosition
(
m_positionVBO
)
;
m_flatShader
->
setAmbiant
(
Geom
::
Vec4f
(
0.2
f
,
0.2
f
,
0.2
f
,
0.1
f
))
;
m_flatShader
->
setDiffuse
(
Geom
::
Vec4f
(
0.8
f
,
0.9
f
,
0.7
f
,
1.0
f
))
;
m_flatShader
->
setExplode
(
1.0
f
)
;
CGoGN
::
Utils
::
GLSLShader
::
registerShader
(
NULL
,
m_flatShader
)
;
// sew these faces along one of their edge
myMap
.
sewFaces
(
d1
,
d2
);
std
::
vector
<
std
::
string
>
attrNames
;
CGoGN
::
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
"/home/kraemer/Media/Data/surface/lowRes/duck_163.ply"
,
attrNames
);
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
CGoGN
::
Algo
::
Render
::
GL2
::
POINTS
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
CGoGN
::
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
CGoGN
::
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
// affect position by moving in the map
position
[
d1
]
=
VEC3
(
0
,
0
,
0
);
position
[
PHI1
(
d1
)]
=
VEC3
(
2
,
0
,
0
);
position
[
PHI_1
(
d1
)]
=
VEC3
(
1
,
2
,
0
);
position
[
PHI
<
11
>
(
d2
)]
=
VEC3
(
0
,
-
2
,
0
);
position
[
PHI_1
(
d2
)]
=
VEC3
(
2
,
-
2
,
0
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
nb
);
m_positionVBO
->
updateData
(
position
)
;
return
true
;
}
void
FirstPlugin
::
disable
()
{
if
(
m_render_topo
)
{
delete
m_render_topo
;
}
}
void
FirstPlugin
::
redraw
(
View
*
view
)
{
m_render_topo
->
drawTopo
();
// const float nbSteps = 200.0;
// glBegin(GL_QUAD_STRIP);
// for (float i = 0; i < nbSteps; ++i)
// {
// float ratio = i/nbSteps;
// float angle = 21.0*ratio;
// float c = cos(angle);
// float s = sin(angle);
// float r1 = 1.0 - 0.8f*ratio;
// float r2 = 0.8f - 0.8f*ratio;
// float alt = ratio - 0.5f;
// const float nor = 0.5f;
// const float up = sqrt(1.0-nor*nor);
// glColor3f(1.0-ratio, 0.2f , ratio);
// glNormal3f(nor*c, up, nor*s);
// glVertex3f(r1*c, alt, r1*s);
// glVertex3f(r2*c, alt+0.05f, r2*s);
// }
// glEnd();
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
)
;
glEnable
(
GL_LIGHTING
)
;
m_render
->
draw
(
m_flatShader
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
}
void
FirstPlugin
::
viewAdded
(
View
*
view
)
{
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
PFP
::
VEC3
&
min
=
bb
.
min
();
PFP
::
VEC3
&
max
=
bb
.
max
();
qglviewer
::
Vec
minV
(
min
[
0
],
min
[
1
],
min
[
2
]);
qglviewer
::
Vec
maxV
(
max
[
0
],
max
[
1
],
max
[
2
]);
view
->
setSceneBoundingBox
(
minV
,
maxV
);
CGoGN
::
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
qglviewer
::
Vec
min
(
bb
.
min
()[
0
],
bb
.
min
()[
1
],
bb
.
min
()[
2
]);
qglviewer
::
Vec
max
(
bb
.
max
()[
0
],
bb
.
max
()[
1
],
bb
.
max
()[
2
]);
view
->
setSceneBoundingBox
(
min
,
max
);
}
/**
...
...
SCHNApps/Release/CMakeLists.txt
View file @
b308066d
...
...
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8)
SET
(
CMAKE_BUILD_TYPE Release
)
ADD_DEFINITIONS
(
-fPIC
)
IF
(
WIN32
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/Release
)
ELSE
(
WIN32
)
...
...
@@ -41,9 +39,12 @@ file(
)
SET
(
SCHNApps_H_OBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/camera.h
${
SCHNApps_ROOT_DIR
}
/include/mapHandler.h
${
SCHNApps_ROOT_DIR
}
/include/plugin.h
${
SCHNApps_ROOT_DIR
}
/include/splitArea.h
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/viewButtonArea.h
${
SCHNApps_ROOT_DIR
}
/include/viewSelector.h
${
SCHNApps_ROOT_DIR
}
/include/cameraDialog.h
...
...
SCHNApps/include/camera.h
View file @
b308066d
...
...
@@ -8,6 +8,8 @@ class Window;
class
Camera
:
public
qglviewer
::
Camera
{
Q_OBJECT
public:
static
unsigned
int
cameraCount
;
...
...
@@ -79,6 +81,9 @@ protected:
double
m_drawPathScale
;
int
m_snapCount
;
public
slots
:
void
cb_viewRemoved
(
View
*
view
);
};
#endif
SCHNApps/include/mapHandler.h
View file @
b308066d
...
...
@@ -15,15 +15,20 @@ namespace CGoGN
}
}
class
MapHandler
class
MapHandler
:
public
QObject
{
Q_OBJECT
public:
MapHandler
(
const
QString
&
name
,
CGoGN
::
GenericMap
*
map
);
MapHandler
(
const
QString
&
name
,
Window
*
window
,
CGoGN
::
GenericMap
*
map
);
~
MapHandler
();
const
QString
&
getName
()
{
return
m_name
;
}
void
setName
(
const
QString
&
name
)
{
m_name
=
name
;
}
Window
*
getWindow
()
{
return
m_window
;
}
void
setWindow
(
Window
*
w
)
{
m_window
=
w
;
}
CGoGN
::
GenericMap
*
getMap
()
{
return
m_map
;
}
CGoGN
::
Utils
::
VBO
*
addVBO
(
const
QString
&
name
);
...
...
@@ -45,11 +50,15 @@ public:
protected:
QString
m_name
;
Window
*
m_window
;
CGoGN
::
GenericMap
*
m_map
;
QList
<
View
*>
l_views
;
VBOHash
h_vbo
;
public
slots
:
void
cb_viewRemoved
(
View
*
view
);
};
#endif
SCHNApps/include/plugin.h
View file @
b308066d
...
...
@@ -15,10 +15,9 @@
class
Plugin
:
public
QObject
{
public:
enum
{
UNLIMITED_NUMBER_OF_MAPS
=
-
1
};
enum
{
UNLIMITED_NUMBER_OF_SCENES
=
-
1
};
Q_OBJECT
public:
Plugin
();
virtual
~
Plugin
();
...
...
@@ -35,7 +34,12 @@ public:
void
setWindow
(
Window
*
w
)
{
m_window
=
w
;
}
bool
getProvidesRendering
()
{
return
b_providesRendering
;
}
void
setProvidesRendering
(
bool
b
)
{
b_providesRendering
=
b
;
}
void
setProvidesRendering
(
bool
b
)
{
b_providesRendering
=
b
;
if
(
b_providesRendering
)
glewInit
();
}
virtual
void
redraw
(
View
*
view
)
=
0
;
...
...
@@ -92,6 +96,9 @@ protected:
QList
<
QAction
*>
l_menuActions
;
QList
<
QAction
*>
l_toolbarActions
;
public
slots
:
void
cb_viewRemoved
(
View
*
view
);
// QList<Plugin*> l_dependencies;
// QList<Plugin*> l_dependantPlugins;
...
...
SCHNApps/include/system.h
View file @
b308066d
...
...
@@ -143,11 +143,11 @@ public:
// static bool savePluginsInfo(Window *window, PluginHash *pluginHash, QStringList paths);
//};
typedef
enum
{
GLVIEWER_IN_DOCK
,
SIMPLE_GLVIEWER
}
QGLV_CREATE_SETTINGS
;
//
typedef enum
//
{
//
GLVIEWER_IN_DOCK,
//
SIMPLE_GLVIEWER
//
} QGLV_CREATE_SETTINGS;
extern
QString
app_path
;
...
...
SCHNApps/include/types.h
View file @
b308066d
...
...
@@ -8,6 +8,7 @@ class Window;
class
Plugin
;
class
View
;
class
Camera
;
class
Texture
;
class
MapHandler
;
...
...
@@ -28,6 +29,8 @@ typedef QHash<QString, MapHandler*> MapHash;
typedef
QHash
<
QString
,
CGoGN
::
Utils
::
VBO
*>
VBOHash
;
typedef
QHash
<
QString
,
CGoGN
::
Utils
::
GLSLShader
*>
ShaderHash
;
typedef
QHash
<
QString
,
Texture
*>
TextureHash
;
namespace
Qt
{
extern
int
UserRoleType
;
...
...
SCHNApps/include/view.h
View file @
b308066d
...
...
@@ -105,15 +105,18 @@ protected:
QString
m_textInfo
;
qglviewer
::
Vec
bbmin
;
qglviewer
::
Vec
bbmax
;
CameraViewDialog
*
m_cameraViewDialog
;
PluginsViewDialog
*
m_pluginsViewDialog
;
MapsViewDialog
*
m_mapsViewDialog
;
public
slots
:
void
cb_cameraView
(
int
x
,
int
y
);
void
cb_pluginsView
(
int
x
,
int
y
);
void
cb_mapsView
(
int
x
,
int
y
);
void
cb_closeView
(
int
x
,
int
y
);
void
cb_cameraView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
cb_pluginsView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
cb_mapsView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
cb_closeView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
//signals:
// void currentCameraChanged(Camera* camera);
...
...
SCHNApps/include/viewButtonArea.h
View file @
b308066d
...
...
@@ -10,6 +10,7 @@
#include <iostream>
class
View
;
class
Texture
;
class
ViewButton
:
public
QObject
{
...
...
@@ -19,20 +20,18 @@ public:
ViewButton
(
const
QString
&
image
,
View
*
view
);
~
ViewButton
();
QSize
getSize
()
{
return
m_GLimg
.
size
();
}
QSize
getSize
()
;
void
click
(
int
x
,
int
y
);
void
click
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
drawAt
(
int
x
,
int
y
);
protected:
QString
m_img
;
View
*
m_view
;
QSize
m_size
;
QImage
m_GLimg
;
int
m_texID
;
Texture
*
m_tex
;
signals:
void
clicked
(
int
x
,
int
y
);
void
clicked
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
};
class
ViewButtonArea
:
public
QObject
...
...
@@ -49,7 +48,7 @@ public:
void
removeButton
(
ViewButton
*
button
);
bool
isClicked
(
int
x
,
int
y
);
void
clickButton
(
int
x
,
int
y
);
void
clickButton
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
const
QRect
&
getForm
()
{
return
m_form
;
}
...
...
SCHNApps/include/window.h
View file @
b308066d
...
...
@@ -9,6 +9,7 @@
class
SplitArea
;
class
PluginDialog
;
class
CameraDialog
;
class
Texture
;
class
Window
:
public
QMainWindow
,
Ui
::
Window
{
...
...
@@ -238,17 +239,12 @@ public:
QList
<
MapHandler
*>
getMapsList
()
{
return
h_maps
.
values
();
}
const
MapHash
&
getMapsHash
()
{
return
h_maps
;
}
// template<typename T>
// T* getReferencedMap(QString map_name){
// MapHash::iterator it;
// if((it=h_map.find(map_name))!=h_map.end()){
// return ((T*)(*it));
// }
// else{
// System::Error::code= System::Error::MAP_UNREFERENCED_f(map_name);
// return NULL;
// }
// }
/*********************************************************
* MANAGE TEXTURES
*********************************************************/
Texture
*
getTexture
(
const
QString
&
image
);
void
releaseTexture
(
const
QString
&
image
);
protected:
bool
m_initialization
;
...
...
@@ -266,6 +262,8 @@ protected:
CameraHash
h_cameras
;
MapHash
h_maps
;
TextureHash
h_textures
;
PluginDialog
*
m_pluginDialog
;
CameraDialog
*
m_cameraDialog
;
...
...
@@ -330,7 +328,7 @@ signals:
void
viewAdded
(
View
*
view
);
void
viewRemoved
(
View
*
view
);
void
mapAdded
(
MapHandler
*
camera
);
void
mapAdded
(
MapHandler
*
map
);
void
mapRemoved
(
MapHandler
*
map
);
void
pluginAdded
(
Plugin
*
plugin
);
...
...
SCHNApps/src/camera.cpp
View file @
b308066d
...
...
@@ -15,6 +15,8 @@ Camera::Camera(const QString& name, Window* window) :
{
++
cameraCount
;
this
->
setZClippingCoefficient
(
100
);
// connect(m_window, SIGNAL(viewRemoved(View*)), this, SLOT(cb_viewRemoved(View*)));
}
Camera
::~
Camera
()
...
...
@@ -63,3 +65,8 @@ void Camera::saveSnapshot(QString snapPathName)
view
->
saveSnapshot
(
snapPathName
+
view
->
getName
()
+
'_'
+
QString
::
number
(
m_snapCount
)
+
".jpg"
,
true
);
++
m_snapCount
;
}
void
Camera
::
cb_viewRemoved
(
View
*
view
)
{
unlinkView
(
view
);
}
SCHNApps/src/mapHandler.cpp
View file @
b308066d
...
...
@@ -4,10 +4,13 @@
#include "Topology/generic/genericmap.h"
#include "Utils/vbo.h"
MapHandler
::
MapHandler
(
const
QString
&
name
,
CGoGN
::
GenericMap
*
map
)
:
MapHandler
::
MapHandler
(
const
QString
&
name
,
Window
*
window
,
CGoGN
::
GenericMap
*
map
)
:
m_name
(
name
),
m_window
(
window
),
m_map
(
map
)
{}
{
// connect(m_window, SIGNAL(viewRemoved(View*)), this, SLOT(cb_viewRemoved(View*)));
}
MapHandler
::~
MapHandler
()
{
...
...
@@ -98,3 +101,8 @@ void MapHandler::unlinkView(View* view)
view
->
updateGL
();
}
}
void
MapHandler
::
cb_viewRemoved
(
View
*
view
)
{
unlinkView
(
view
);
}
SCHNApps/src/plugin.cpp
View file @
b308066d
...
...
@@ -3,7 +3,9 @@
Plugin
::
Plugin
()
:
m_window
(
NULL
),
b_providesRendering
(
false
)
{}
{
// connect(m_window, SIGNAL(viewRemoved(View*)), this, SLOT(cb_viewRemoved(View*)));
}
Plugin
::~
Plugin
()
{
...
...
@@ -114,3 +116,8 @@ void Plugin::removeToolbarAction(QAction* action)
if
(
l_toolbarActions
.
removeOne
(
action
))
m_window
->
removeToolbarAction
(
action
);
}
void
Plugin
::
cb_viewRemoved
(
View
*
view
)
{
unlinkView
(
view
);
}
SCHNApps/src/pluginDialog.cpp
View file @
b308066d
...
...
@@ -15,6 +15,7 @@
#include "system.h"
#include "window.h"
#include "plugin.h"
PluginDialog
::
PluginDialog
(
Window
*
window
)
:
m_window
(
window
),
...
...
@@ -155,7 +156,7 @@ void PluginDialog::cb_addPlugins()
QStringList
files
=
QFileDialog
::
getOpenFileNames
(
this
,
"Select one or more plugins"
,
System
::
app_path
,
System
::
app_path
+
QString
(
"/../Plugins/"
)
,
"Plugins (lib*.so lib*.dylib)"
);
...
...
@@ -189,7 +190,7 @@ void PluginDialog::cb_addPluginsDirectory()
QString
dir
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Select a directory"
),
System
::
app_path
,
System
::
app_path
+
QString
(
"/../Plugins/"
)
,
QFileDialog
::
ShowDirsOnly
|
QFileDialog
::
DontResolveSymlinks
);
...
...
@@ -345,11 +346,25 @@ void PluginDialog::cb_togglePlugin(QTreeWidgetItem *item, int column)
init
=
true
;
item
->
setCheckState
(
0
,
Qt
::
Unchecked
);
init
=
false
;
return
;
}
}
else
if
(
item
->
checkState
(
0
)
==
Qt
::
Unchecked
)
m_window
->
unloadPlugin
(
pluginName
);
{
Plugin
*
p
=
m_window
->
getPlugin
(
pluginName
);
if
(
!
p
->
getLinkedViews
().
empty
())
{
QMessageBox
::
warning
(
this
,
tr
(
"Warning"
),
"Plugin is currently used"
);
init
=
true
;
item
->
setCheckState
(
0
,
Qt
::
Checked
);
init
=
false
;
return
;
}
else
{
m_window
->
unloadPlugin
(
pluginName
);
}
}
}
}
...
...
SCHNApps/src/view.cpp
View file @
b308066d
...
...
@@ -43,10 +43,16 @@ View::~View()
this
->
setCamera
(
c
);
foreach
(
Plugin
*
plugin
,
l_plugins
)
{
plugin
->
unlinkView
(
this
);
unlinkPlugin
(
plugin
);
}
foreach
(
MapHandler
*
map
,
l_maps
)
{
map
->
unlinkView
(
this
);
unlinkMap
(
map
);
}
delete
m_buttonArea
;
}
...
...
@@ -58,19 +64,19 @@ void View::init()
m_cameraButton
=
new
ViewButton
(
":icons/icons/camera_32.png"
,
this
);
m_buttonArea
->
addButton
(
m_cameraButton
);
connect
(
m_cameraButton
,
SIGNAL
(
clicked
(
int
,
int
)),
this
,
SLOT
(
cb_cameraView
(
int
,
int
)));
connect
(
m_cameraButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
cb_cameraView
(
int
,
int
,
int
,
int
)));
m_pluginsButton
=
new
ViewButton
(
":icons/icons/plugins_32.png"
,
this
);
m_buttonArea
->
addButton
(
m_pluginsButton
);
connect
(
m_pluginsButton
,
SIGNAL
(
clicked
(
int
,
int
)),
this
,
SLOT
(
cb_pluginsView
(
int
,
int
)));
connect
(
m_pluginsButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
cb_pluginsView
(
int
,
int
,
int
,
int
)));
m_mapsButton
=
new
ViewButton
(
":icons/icons/maps_32.png"
,
this
);
m_buttonArea
->
addButton
(
m_mapsButton
);
connect
(
m_mapsButton
,
SIGNAL
(
clicked
(
int
,
int
)),
this
,
SLOT
(
cb_mapsView
(
int
,
int
)));
connect
(
m_mapsButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
cb_mapsView
(
int
,
int
,
int
,
int
)));
m_closeButton
=
new
ViewButton
(
":icons/icons/close_32.png"
,
this
);
m_buttonArea
->
addButton
(
m_closeButton
);
connect
(
m_closeButton
,
SIGNAL
(
clicked
(
int
,
int
)),
this
,
SLOT
(
<