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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
ceb4a9f3
Commit
ceb4a9f3
authored
Jan 28, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~kraemer/CGoGN
Conflicts: SCHNApps/src/main.cpp
parents
58e2022f
54603ff0
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
247 additions
and
58 deletions
+247
-58
SCHNApps/Debug/CMakeLists.txt
SCHNApps/Debug/CMakeLists.txt
+1
-0
SCHNApps/Plugins/importSurface/importSurface.cpp
SCHNApps/Plugins/importSurface/importSurface.cpp
+2
-1
SCHNApps/Plugins/importSurface/importSurface.h
SCHNApps/Plugins/importSurface/importSurface.h
+1
-1
SCHNApps/Plugins/importVolume/importVolume.cpp
SCHNApps/Plugins/importVolume/importVolume.cpp
+2
-1
SCHNApps/Plugins/importVolume/importVolume.h
SCHNApps/Plugins/importVolume/importVolume.h
+1
-1
SCHNApps/Release/CMakeLists.txt
SCHNApps/Release/CMakeLists.txt
+1
-0
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+10
-0
SCHNApps/include/dialogs/cameraViewDialog.h
SCHNApps/include/dialogs/cameraViewDialog.h
+3
-0
SCHNApps/include/dialogs/mapsViewDialog.h
SCHNApps/include/dialogs/mapsViewDialog.h
+3
-0
SCHNApps/include/dialogs/pluginsViewDialog.h
SCHNApps/include/dialogs/pluginsViewDialog.h
+3
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+4
-0
SCHNApps/include/plugin.h
SCHNApps/include/plugin.h
+7
-5
SCHNApps/include/view.h
SCHNApps/include/view.h
+4
-0
SCHNApps/include/window.h
SCHNApps/include/window.h
+5
-0
SCHNApps/src/dialogs/cameraViewDialog.cpp
SCHNApps/src/dialogs/cameraViewDialog.cpp
+45
-8
SCHNApps/src/dialogs/mapsViewDialog.cpp
SCHNApps/src/dialogs/mapsViewDialog.cpp
+46
-9
SCHNApps/src/dialogs/pluginsViewDialog.cpp
SCHNApps/src/dialogs/pluginsViewDialog.cpp
+46
-9
SCHNApps/src/main.cpp
SCHNApps/src/main.cpp
+6
-5
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+57
-18
No files found.
SCHNApps/Debug/CMakeLists.txt
View file @
ceb4a9f3
...
...
@@ -38,6 +38,7 @@ SET(SCHNApps_H_OBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/mapHandler.h
${
SCHNApps_ROOT_DIR
}
/include/plugin.h
${
SCHNApps_ROOT_DIR
}
/include/viewButtonArea.h
${
SCHNApps_ROOT_DIR
}
/include/dialogs/camerasDialog.h
${
SCHNApps_ROOT_DIR
}
/include/dialogs/pluginsDialog.h
...
...
SCHNApps/Plugins/importSurface/importSurface.cpp
View file @
ceb4a9f3
...
...
@@ -15,7 +15,7 @@ bool ImportSurfacePlugin::enable()
return
true
;
}
void
ImportSurfacePlugin
::
importFromFile
(
const
QString
&
fileName
)
MapHandlerGen
*
ImportSurfacePlugin
::
importFromFile
(
const
QString
&
fileName
)
{
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
...
...
@@ -43,6 +43,7 @@ void ImportSurfacePlugin::importFromFile(const QString& fileName)
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
return
mhg
;
}
}
...
...
SCHNApps/Plugins/importSurface/importSurface.h
View file @
ceb4a9f3
...
...
@@ -35,7 +35,7 @@ public:
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
public
slots
:
void
importFromFile
(
const
QString
&
fileName
);
MapHandlerGen
*
importFromFile
(
const
QString
&
fileName
);
void
importFromFileDialog
();
private:
...
...
SCHNApps/Plugins/importVolume/importVolume.cpp
View file @
ceb4a9f3
...
...
@@ -15,7 +15,7 @@ bool ImportVolumePlugin::enable()
return
true
;
}
void
ImportVolumePlugin
::
importFromFile
(
const
QString
&
fileName
)
MapHandlerGen
*
ImportVolumePlugin
::
importFromFile
(
const
QString
&
fileName
)
{
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
...
...
@@ -43,6 +43,7 @@ void ImportVolumePlugin::importFromFile(const QString& fileName)
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
return
mhg
;
}
}
...
...
SCHNApps/Plugins/importVolume/importVolume.h
View file @
ceb4a9f3
...
...
@@ -35,7 +35,7 @@ public:
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
public
slots
:
void
importFromFile
(
const
QString
&
fileName
);
MapHandlerGen
*
importFromFile
(
const
QString
&
fileName
);
void
importFromFileDialog
();
private:
...
...
SCHNApps/Release/CMakeLists.txt
View file @
ceb4a9f3
...
...
@@ -37,6 +37,7 @@ file(
SET
(
SCHNApps_H_OBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/view.h
${
SCHNApps_ROOT_DIR
}
/include/mapHandler.h
${
SCHNApps_ROOT_DIR
}
/include/plugin.h
${
SCHNApps_ROOT_DIR
}
/include/window.h
${
SCHNApps_ROOT_DIR
}
/include/viewButtonArea.h
${
SCHNApps_ROOT_DIR
}
/include/dialogs/camerasDialog.h
...
...
SCHNApps/bin/init.py
0 → 100644
View file @
ceb4a9f3
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurfacePlugin"
);
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialPropertiesPlugin"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"RenderPlugin"
);
hand
=
importPlugin
.
importFromFile
(
"/home/kraemer/Media/Data/surface/midRes/handman_12k.off"
);
v
=
schnapps
.
getView
(
"view_0"
);
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderPlugin
.
getName
());
schnapps
.
linkViewAndMap
(
v
.
getName
(),
hand
.
getName
());
SCHNApps/include/dialogs/cameraViewDialog.h
View file @
ceb4a9f3
...
...
@@ -24,11 +24,14 @@ public:
private:
Window
*
m_window
;
View
*
m_view
;
bool
b_refreshingUI
;
void
selectCurrentCamera
();
public
slots
:
void
selectedCameraChanged
();
void
selectCamera
(
View
*
view
,
Camera
*
camera
);
void
deselectCamera
(
View
*
view
,
Camera
*
camera
);
void
addCameraToList
(
Camera
*
c
);
void
removeCameraFromList
(
Camera
*
c
);
};
...
...
SCHNApps/include/dialogs/mapsViewDialog.h
View file @
ceb4a9f3
...
...
@@ -24,9 +24,12 @@ public:
private:
Window
*
m_window
;
View
*
m_view
;
bool
b_refreshingUI
;
public
slots
:
void
selectedMapsChanged
();
void
selectMap
(
View
*
view
,
MapHandlerGen
*
map
);
void
deselectMap
(
View
*
view
,
MapHandlerGen
*
map
);
void
addMapToList
(
MapHandlerGen
*
m
);
void
removeMapFromList
(
MapHandlerGen
*
m
);
};
...
...
SCHNApps/include/dialogs/pluginsViewDialog.h
View file @
ceb4a9f3
...
...
@@ -24,9 +24,12 @@ public:
private:
Window
*
m_window
;
View
*
m_view
;
bool
b_refreshingUI
;
public
slots
:
void
selectedPluginsChanged
();
void
selectPlugin
(
View
*
view
,
Plugin
*
plugin
);
void
deselectPlugin
(
View
*
view
,
Plugin
*
plugin
);
void
addPluginToList
(
Plugin
*
p
);
void
removePluginFromList
(
Plugin
*
p
);
};
...
...
SCHNApps/include/mapHandler.h
View file @
ceb4a9f3
...
...
@@ -29,6 +29,9 @@ public:
virtual
~
MapHandlerGen
();
const
QString
&
getName
()
const
{
return
m_name
;
}
public
slots
:
QString
getName
()
{
return
m_name
;
}
void
setName
(
const
QString
&
name
)
{
m_name
=
name
;
}
Window
*
getWindow
()
const
{
return
m_window
;
}
...
...
@@ -42,6 +45,7 @@ public:
bool
isUsed
()
const
{
return
!
l_views
.
empty
();
}
public:
void
draw
(
Utils
::
GLSLShader
*
shader
,
int
primitive
)
{
m_render
->
draw
(
shader
,
primitive
);
}
/*********************************************************
...
...
SCHNApps/include/plugin.h
View file @
ceb4a9f3
...
...
@@ -16,11 +16,16 @@ class Window;
class
Plugin
:
public
QObject
{
Q_OBJECT
public:
Plugin
();
virtual
~
Plugin
();
const
QString
&
getName
()
{
return
m_name
;
}
const
QString
&
getName
()
const
{
return
m_name
;
}
public
slots
:
QString
getName
()
{
return
m_name
;
}
void
setName
(
const
QString
&
name
)
{
m_name
=
name
;
}
const
QString
&
getFilePath
()
{
return
m_filePath
;
}
...
...
@@ -34,6 +39,7 @@ public:
bool
getProvidesRendering
()
{
return
b_providesRendering
;
}
void
setProvidesRendering
(
bool
b
)
{
b_providesRendering
=
b
;
}
public:
virtual
bool
enable
()
=
0
;
virtual
void
disable
()
=
0
;
...
...
@@ -46,10 +52,6 @@ public:
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
=
0
;
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
=
0
;
// virtual void viewLinked(View* view) = 0;
// virtual void viewUnlinked(View* view) = 0;
// virtual void currentViewChanged(View* view) = 0;
/*********************************************************
* MANAGE LINKED VIEWS
*********************************************************/
...
...
SCHNApps/include/view.h
View file @
ceb4a9f3
...
...
@@ -32,6 +32,9 @@ public:
~
View
();
const
QString
&
getName
()
const
{
return
m_name
;
}
public
slots
:
QString
getName
()
{
return
m_name
;
}
void
setName
(
const
QString
&
name
)
{
m_name
=
name
;
}
Window
*
getWindow
()
const
{
return
m_window
;
}
...
...
@@ -39,6 +42,7 @@ public:
bool
isCurrentView
()
const
{
return
m_window
->
getCurrentView
()
==
this
;
}
public:
virtual
void
init
();
virtual
void
preDraw
();
virtual
void
draw
();
...
...
SCHNApps/include/window.h
View file @
ceb4a9f3
...
...
@@ -231,12 +231,17 @@ public:
public
slots
:
void
linkViewAndCamera
(
View
*
v
,
Camera
*
c
);
void
linkViewAndCamera
(
const
QString
&
viewName
,
const
QString
&
cameraName
);
void
linkViewAndMap
(
View
*
v
,
MapHandlerGen
*
m
);
void
linkViewAndMap
(
const
QString
&
viewName
,
const
QString
&
mapName
);
void
unlinkViewAndMap
(
View
*
v
,
MapHandlerGen
*
m
);
void
unlinkViewAndMap
(
const
QString
&
viewName
,
const
QString
&
mapName
);
void
linkViewAndPlugin
(
View
*
v
,
Plugin
*
p
);
void
linkViewAndPlugin
(
const
QString
&
viewName
,
const
QString
&
pluginName
);
void
unlinkViewAndPlugin
(
View
*
v
,
Plugin
*
p
);
void
unlinkViewAndPlugin
(
const
QString
&
viewName
,
const
QString
&
pluginName
);
/*********************************************************
* MANAGE TEXTURES
...
...
SCHNApps/src/dialogs/cameraViewDialog.cpp
View file @
ceb4a9f3
...
...
@@ -16,7 +16,8 @@ namespace SCHNApps
CameraViewDialog
::
CameraViewDialog
(
Window
*
window
,
View
*
view
)
:
QDialog
(
view
),
m_window
(
window
),
m_view
(
view
)
m_view
(
view
),
b_refreshingUI
(
false
)
{
this
->
setupUi
(
this
);
this
->
setWindowTitle
(
m_view
->
getName
()
+
QString
(
" : camera"
));
...
...
@@ -26,6 +27,9 @@ CameraViewDialog::CameraViewDialog(Window* window, View* view) :
connect
(
m_window
,
SIGNAL
(
cameraAdded
(
Camera
*
)),
this
,
SLOT
(
addCameraToList
(
Camera
*
)));
connect
(
m_window
,
SIGNAL
(
cameraRemoved
(
Camera
*
)),
this
,
SLOT
(
removeCameraFromList
(
Camera
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndCameraLinked
(
View
*
,
Camera
*
)),
this
,
SLOT
(
selectCamera
(
View
*
,
Camera
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndCameraUnlinked
(
View
*
,
Camera
*
)),
this
,
SLOT
(
deselectCamera
(
View
*
,
Camera
*
)));
QList
<
Camera
*>
cameras
=
m_window
->
getCamerasList
();
foreach
(
Camera
*
c
,
cameras
)
cameraList
->
addItem
(
c
->
getName
());
...
...
@@ -50,14 +54,47 @@ void CameraViewDialog::selectCurrentCamera()
void
CameraViewDialog
::
selectedCameraChanged
()
{
QList
<
QListWidgetItem
*>
currentItems
=
cameraList
->
selectedItems
();
if
(
currentItems
.
empty
())
selectCurrentCamera
();
else
if
(
b_refreshingUI
)
{
QList
<
QListWidgetItem
*>
currentItems
=
cameraList
->
selectedItems
();
if
(
currentItems
.
empty
())
selectCurrentCamera
();
else
{
const
QString
&
cname
=
currentItems
[
0
]
->
text
();
Camera
*
c
=
m_window
->
getCamera
(
cname
);
m_window
->
linkViewAndCamera
(
m_view
,
c
);
}
}
}
void
CameraViewDialog
::
selectCamera
(
View
*
view
,
Camera
*
camera
)
{
if
(
view
==
m_view
)
{
const
QString
&
cname
=
currentItems
[
0
]
->
text
();
Camera
*
c
=
m_window
->
getCamera
(
cname
);
m_window
->
linkViewAndCamera
(
m_view
,
c
);
QList
<
QListWidgetItem
*>
items
=
cameraList
->
findItems
(
camera
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
true
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
}
void
CameraViewDialog
::
deselectCamera
(
View
*
view
,
Camera
*
camera
)
{
if
(
view
==
m_view
)
{
QList
<
QListWidgetItem
*>
items
=
cameraList
->
findItems
(
camera
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
false
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
}
...
...
SCHNApps/src/dialogs/mapsViewDialog.cpp
View file @
ceb4a9f3
...
...
@@ -17,7 +17,8 @@ namespace SCHNApps
MapsViewDialog
::
MapsViewDialog
(
Window
*
window
,
View
*
view
)
:
QDialog
(
view
),
m_window
(
window
),
m_view
(
view
)
m_view
(
view
),
b_refreshingUI
(
false
)
{
this
->
setupUi
(
this
);
this
->
setWindowTitle
(
m_view
->
getName
()
+
QString
(
" : maps"
));
...
...
@@ -27,6 +28,9 @@ MapsViewDialog::MapsViewDialog(Window* window, View* view) :
connect
(
m_window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
addMapToList
(
MapHandlerGen
*
)));
connect
(
m_window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
removeMapFromList
(
MapHandlerGen
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndMapLinked
(
View
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectMap
(
View
*
,
MapHandlerGen
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndMapUnlinked
(
View
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
deselectMap
(
View
*
,
MapHandlerGen
*
)));
QList
<
MapHandlerGen
*>
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
m
,
maps
)
mapList
->
addItem
(
m
->
getName
());
...
...
@@ -37,18 +41,51 @@ MapsViewDialog::~MapsViewDialog()
void
MapsViewDialog
::
selectedMapsChanged
()
{
for
(
int
i
=
0
;
i
<
mapList
->
count
();
++
i
)
if
(
!
b_refreshingUI
)
{
QString
mapName
=
mapList
->
item
(
i
)
->
text
();
MapHandlerGen
*
map
=
m_window
->
getMap
(
mapName
);
for
(
int
i
=
0
;
i
<
mapList
->
count
();
++
i
)
{
QString
mapName
=
mapList
->
item
(
i
)
->
text
();
MapHandlerGen
*
map
=
m_window
->
getMap
(
mapName
);
if
(
mapList
->
item
(
i
)
->
isSelected
()
&&
!
m_view
->
isLinkedToMap
(
map
))
m_window
->
linkViewAndMap
(
m_view
,
map
);
if
(
mapList
->
item
(
i
)
->
isSelected
()
&&
!
m_view
->
isLinkedToMap
(
map
))
m_window
->
linkViewAndMap
(
m_view
,
map
);
else
if
(
!
mapList
->
item
(
i
)
->
isSelected
()
&&
m_view
->
isLinkedToMap
(
map
))
m_window
->
unlinkViewAndMap
(
m_view
,
map
);
}
m_view
->
updateGL
();
}
}
void
MapsViewDialog
::
selectMap
(
View
*
view
,
MapHandlerGen
*
plugin
)
{
if
(
view
==
m_view
)
{
QList
<
QListWidgetItem
*>
items
=
mapList
->
findItems
(
plugin
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
true
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
}
else
if
(
!
mapList
->
item
(
i
)
->
isSelected
()
&&
m_view
->
isLinkedToMap
(
map
))
m_window
->
unlinkViewAndMap
(
m_view
,
map
);
void
MapsViewDialog
::
deselectMap
(
View
*
view
,
MapHandlerGen
*
plugin
)
{
if
(
view
==
m_view
)
{
QList
<
QListWidgetItem
*>
items
=
mapList
->
findItems
(
plugin
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
false
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
m_view
->
updateGL
();
}
void
MapsViewDialog
::
addMapToList
(
MapHandlerGen
*
m
)
...
...
SCHNApps/src/dialogs/pluginsViewDialog.cpp
View file @
ceb4a9f3
...
...
@@ -16,7 +16,8 @@ namespace SCHNApps
PluginsViewDialog
::
PluginsViewDialog
(
Window
*
window
,
View
*
view
)
:
QDialog
(
view
),
m_window
(
window
),
m_view
(
view
)
m_view
(
view
),
b_refreshingUI
(
false
)
{
this
->
setupUi
(
this
);
this
->
setWindowTitle
(
m_view
->
getName
()
+
QString
(
" : plugins"
));
...
...
@@ -26,6 +27,9 @@ PluginsViewDialog::PluginsViewDialog(Window* window, View* view) :
connect
(
m_window
,
SIGNAL
(
pluginLoaded
(
Plugin
*
)),
this
,
SLOT
(
addPluginToList
(
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
pluginUnloaded
(
Plugin
*
)),
this
,
SLOT
(
removePluginFromList
(
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndPluginLinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
selectPlugin
(
View
*
,
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndPluginUnlinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
deselectPlugin
(
View
*
,
Plugin
*
)));
QList
<
Plugin
*>
plugins
=
m_window
->
getPluginsList
();
foreach
(
Plugin
*
p
,
plugins
)
{
...
...
@@ -39,17 +43,50 @@ PluginsViewDialog::~PluginsViewDialog()
void
PluginsViewDialog
::
selectedPluginsChanged
()
{
for
(
int
i
=
0
;
i
<
pluginList
->
count
();
++
i
)
if
(
!
b_refreshingUI
)
{
for
(
int
i
=
0
;
i
<
pluginList
->
count
();
++
i
)
{
QString
pluginName
=
pluginList
->
item
(
i
)
->
text
();
Plugin
*
plugin
=
m_window
->
getPlugin
(
pluginName
);
if
(
pluginList
->
item
(
i
)
->
isSelected
()
&&
!
m_view
->
isLinkedToPlugin
(
plugin
))
m_window
->
linkViewAndPlugin
(
m_view
,
plugin
);
else
if
(
!
pluginList
->
item
(
i
)
->
isSelected
()
&&
m_view
->
isLinkedToPlugin
(
plugin
))
m_window
->
unlinkViewAndPlugin
(
m_view
,
plugin
);
}
m_view
->
updateGL
();
}
}
void
PluginsViewDialog
::
selectPlugin
(
View
*
view
,
Plugin
*
plugin
)
{
if
(
view
==
m_view
)
{
QString
pluginName
=
pluginList
->
item
(
i
)
->
text
();
Plugin
*
plugin
=
m_window
->
getPlugin
(
pluginName
);
if
(
pluginList
->
item
(
i
)
->
isSelected
()
&&
!
m_view
->
isLinkedToPlugin
(
plugin
))
m_window
->
linkViewAndPlugin
(
m_view
,
plugin
);
QList
<
QListWidgetItem
*>
items
=
pluginList
->
findItems
(
plugin
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
true
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
}
else
if
(
!
pluginList
->
item
(
i
)
->
isSelected
()
&&
m_view
->
isLinkedToPlugin
(
plugin
))
m_window
->
unlinkViewAndPlugin
(
m_view
,
plugin
);
void
PluginsViewDialog
::
deselectPlugin
(
View
*
view
,
Plugin
*
plugin
)
{
if
(
view
==
m_view
)
{
QList
<
QListWidgetItem
*>
items
=
pluginList
->
findItems
(
plugin
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
{
b_refreshingUI
=
true
;
items
[
0
]
->
setSelected
(
false
);
m_view
->
updateGL
();
b_refreshingUI
=
false
;
}
}
m_view
->
updateGL
();
}
void
PluginsViewDialog
::
addPluginToList
(
Plugin
*
p
)
...
...
SCHNApps/src/main.cpp
View file @
ceb4a9f3
#include <QSplashScreen>
#include "window.h"
#include <QFileInfo>
#include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h"
...
...
@@ -19,10 +18,10 @@ int main(int argc, char* argv[])
PythonQt
::
init
();
QStringList
classNames
;
classNames
.
append
(
"Plugin"
);
classNames
.
append
(
"View"
);
classNames
.
append
(
"MapHandlerGen"
);
classNames
.
append
(
"Camera"
);
classNames
.
append
(
"Plugin"
);
classNames
.
append
(
"MapHandlerGen"
);
PythonQt
::
self
()
->
registerQObjectClassNames
(
classNames
);
// get a smart pointer to the __main__ module of the Python interpreter
...
...
@@ -33,7 +32,9 @@ int main(int argc, char* argv[])
schnapps
.
show
();
pythonContext
.
addObject
(
"schnapps"
,
&
schnapps
);
pythonContext
.
evalFile
(
app
.
applicationDirPath
()
+
QString
(
"/init.py"
));
QFileInfo
fi
(
app
.
applicationDirPath
()
+
QString
(
"/init.py"
));
if
(
fi
.
exists
())
pythonContext
.
evalFile
(
fi
.
filePath
());
splash
->
finish
(
&
schnapps
);
delete
splash
;
...
...
SCHNApps/src/window.cpp
View file @
ceb4a9f3
...
...
@@ -476,8 +476,6 @@ Plugin* Window::loadPlugin(const QString& pluginName)
statusbar
->
showMessage
(
pluginName
+
QString
(
" successfully loaded."
),
2000
);
emit
(
pluginLoaded
(
plugin
));
m_pythonContext
.
addObject
(
pluginName
,
plugin
);
// method success
return
plugin
;
}
...
...
@@ -583,20 +581,24 @@ MapHandlerGen* Window::getMap(const QString& name) const
* MANAGE LINKS
*********************************************************/
void
Window
::
linkViewAnd
Plugin
(
View
*
v
,
Plugin
*
p
)
void
Window
::
linkViewAnd
Camera
(
View
*
v
,
Camera
*
c
)
{
v
->
linkPlugin
(
p
);
p
->
linkView
(
v
);
Camera
*
current
=
v
->
getCurrentCamera
();
current
->
unlinkView
(
v
);
emit
(
viewAndCameraUnlinked
(
v
,
current
));
emit
(
viewAndPluginLinked
(
v
,
p
));
v
->
setCurrentCamera
(
c
);
c
->
linkView
(
v
);
emit
(
viewAndCameraLinked
(
v
,
c
));
}
void
Window
::
unlinkViewAndPlugin
(
View
*
v
,
Plugin
*
p
)
void
Window
::
linkViewAndCamera
(
const
QString
&
viewName
,
const
QString
&
cameraName
)
{
v
->
unlinkPlugin
(
p
);
p
->
unlinkView
(
v
);
emit
(
viewAndPluginUnlinked
(
v
,
p
)
);
View
*
view
=
getView
(
viewName
);
Camera
*
camera
=
getCamera
(
cameraName
);
if
(
view
&&
camera
)
linkViewAndCamera
(
view
,
camera
);
}
void
Window
::
linkViewAndMap
(
View
*
v
,
MapHandlerGen
*
m
)
...
...
@@ -607,6 +609,14 @@ void Window::linkViewAndMap(View* v, MapHandlerGen* m)
emit
(
viewAndMapLinked
(
v
,
m
));
}
void
Window
::
linkViewAndMap
(
const
QString
&
viewName
,
const
QString
&
mapName
)
{
View
*
view
=
getView
(
viewName
);
MapHandlerGen
*
map
=
getMap
(
mapName
);
if
(
view
&&
map
)
linkViewAndMap
(
view
,
map
);
}
void
Window
::
unlinkViewAndMap
(
View
*
v
,
MapHandlerGen
*
m
)
{
v
->
unlinkMap
(
m
);
...
...
@@ -615,15 +625,44 @@ void Window::unlinkViewAndMap(View* v, MapHandlerGen* m)
emit
(
viewAndMapUnlinked
(
v
,
m
));
}
void
Window
::
linkViewAndCamera
(
View
*
v
,
Camera
*
c
)
void
Window
::
unlinkViewAndMap
(
const
QString
&
viewName
,
const
QString
&
mapName
)
{
Camera
*
current
=
v
->
getCurrentCamera
(
);
current
->
unlinkView
(
v
);
emit
(
viewAndCameraUnlinked
(
v
,
current
));
v
->
setCurrentCamera
(
c
);
c
->
linkView
(
v
);
View
*
view
=
getView
(
viewName
);
MapHandlerGen
*
map
=
getMap
(
mapName
);
if
(
view
&&
map
)
unlinkViewAndMap
(
view
,
map
);
}
emit
(
viewAndCameraLinked
(
v
,
c
));
void
Window
::
linkViewAndPlugin
(
View
*
v
,
Plugin
*
p
)
{
v
->
linkPlugin
(
p
);
p
->
linkView
(
v
);
emit
(
viewAndPluginLinked
(
v
,
p
));
}
void
Window
::
linkViewAndPlugin
(
const
QString
&
viewName
,
const
QString
&
pluginName
)
{
View
*
view
=
getView
(
viewName
);
Plugin
*
plugin
=
getPlugin
(
pluginName
);
if
(
view
&&
plugin
)
linkViewAndPlugin
(
view
,
plugin
);
}
void
Window
::
unlinkViewAndPlugin
(
View
*
v
,
Plugin
*
p
)
{
v
->
unlinkPlugin
(
p
);
p
->
unlinkView
(
v
);
emit
(
viewAndPluginUnlinked
(
v
,
p
));
}
void
Window
::
unlinkViewAndPlugin
(
const
QString
&
viewName
,
const
QString
&
pluginName
)
{
View
*
view
=
getView
(
viewName
);
Plugin
*
plugin
=
getPlugin
(
pluginName
);
if
(
view
&&
plugin
)
unlinkViewAndPlugin
(
view
,
plugin
);
}
/*********************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment