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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
b78c9abb
Commit
b78c9abb
authored
Nov 23, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: ajout plugin.cpp
parent
4a3261fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
218 additions
and
0 deletions
+218
-0
SCHNApps/src/plugin.cpp
SCHNApps/src/plugin.cpp
+218
-0
No files found.
SCHNApps/src/plugin.cpp
0 → 100644
View file @
b78c9abb
#include "plugin.h"
Plugin
::
Plugin
(
const
QString
&
name
,
const
QString
&
filePath
)
{
}
Plugin
::~
Plugin
()
{
foreach
(
Scene
*
scene
,
l_scenes
)
removeScene
(
scene
);
foreach
(
QWidget
*
tabWidget
,
l_tabWidgets
)
removeTabInDock
(
tabWidget
);
foreach
(
QAction
*
action
,
l_menuActions
)
removeMenuAction
(
action
);
foreach
(
QAction
*
action
,
l_toolbarActions
)
removeToolbarAction
(
action
);
// unloadDependantPlugins();
// removeAllDependencyLinks();
}
void
Plugin
::
updateGL
()
{
foreach
(
Scene
*
s
,
l_scenes
)
s
->
updateGL
();
}
void
Plugin
::
updateGL
(
Scene
*
s
)
{
s
->
updateGL
();
}
/*********************************************************
* MANAGE MAPS
*********************************************************/
bool
Plugin
::
addMap
(
MapHandler
*
map
)
{
if
(
(
m_maxNumberOfMaps
==
UNLIMITED_NUMBER_OF_MAPS
||
l_maps
.
size
()
<
m_maxNumberOfMaps
)
&&
map
&&
!
l_maps
.
contains
(
map
)
)
{
l_maps
.
push_back
(
map
);
cb_mapAdded
(
map
);
return
true
;
}
else
return
false
;
}
void
Plugin
::
removeMap
(
MapHandler
*
map
)
{
if
(
l_maps
.
removeOne
(
map
))
cb_mapRemoved
(
map
);
}
bool
Plugin
::
hasMap
(
MapHandler
*
map
)
{
return
l_maps
.
contains
(
map
);
}
QList
<
MapHandler
*>
Plugin
::
getMaps
()
{
return
l_maps
;
}
void
Plugin
::
setMaxNumberOfMaps
(
int
n
)
{
if
(
n
>=
l_maps
.
size
()
||
n
==
UNLIMITED_NUMBER_OF_MAPS
)
m_maxNumberOfMaps
=
n
;
}
int
Plugin
::
getCurrentNumberOfMaps
()
{
return
l_maps
.
size
();
}
int
Plugin
::
getRemainingNumberOfMaps
()
{
if
(
m_maxNumberOfMaps
!=
UNLIMITED_NUMBER_OF_MAPS
)
return
m_maxNumberOfMaps
-
l_maps
.
size
();
else
return
UNLIMITED_NUMBER_OF_MAPS
;
}
/*********************************************************
* MANAGE SCENES
*********************************************************/
bool
Plugin
::
addScene
(
Scene
*
scene
)
{
if
(
s
&&
!
l_scenes
.
contains
(
scene
))
{
l_scenes
.
push_back
(
scene
);
scene
->
addPlugin
(
this
);
scene
->
updateGL
();
cb_sceneAdded
(
scene
);
return
true
;
}
else
return
false
;
}
void
Plugin
::
removeScene
(
Scene
*
scene
)
{
if
(
l_scenes
.
removeOne
(
scene
))
{
scene
->
removePlugin
(
this
);
scene
->
updateGL
();
cb_sceneRemoved
(
scene
);
}
}
bool
Plugin
::
hasScene
(
Scene
*
scene
)
{
return
l_scenes
.
contains
(
scene
);
}
QList
<
Scene
*>
Plugin
::
getScenes
()
{
return
l_scenes
;
}
/*********************************************************
* MANAGE DOCK TABS
*********************************************************/
bool
Plugin
::
addTabInDock
(
QWidget
*
tabWidget
,
const
QString
&
tabText
)
{
if
(
m_window
)
{
l_tabWidgets
.
push_back
(
tabWidget
);
m_window
->
addTabInDock
(
tabWidget
,
tabText
);
return
true
;
}
else
{
System
::
Error
::
code
=
System
::
Error
::
BAD_LINK_PLUGIN_WINDOW_f
(
m_name
);
return
false
;
}
}
void
Plugin
::
removeTabInDock
(
QWidget
*
tabWidget
)
{
if
(
m_window
)
{
l_tabWidgets
.
removeOne
(
tabWidget
);
m_window
->
removeTabInDock
(
tabWidget
);
}
}
/*********************************************************
* MANAGE MENU ACTIONS
*********************************************************/
bool
Plugin
::
addMenuAction
(
const
QString
&
menuPath
,
QAction
*
action
)
{
if
(
action
&&
!
l_menuActions
.
contains
(
action
))
{
m_window
->
addMenuAction
(
menuPath
,
action
);
l_menuActions
.
push_back
(
action
);
return
true
;
}
else
return
false
;
}
void
Plugin
::
removeMenuAction
(
QAction
*
action
)
{
if
(
l_menuActions
.
removeOne
(
action
))
m_window
->
removeMenuAction
(
action
);
}
/*********************************************************
* MANAGE TOOLBAR ACTIONS
*********************************************************/
bool
Plugin
::
addToolbarAction
(
QAction
*
action
)
{
if
(
action
&&
!
l_toolbarActions
.
contains
(
action
))
{
m_window
->
addToolbarAction
(
action
);
l_toolbarActions
.
push_back
(
action
);
return
true
;
}
else
return
false
;
}
void
Plugin
::
removeToolbarAction
(
QAction
*
action
)
{
if
(
l_toolbarActions
.
removeOne
(
action
))
m_window
->
removeToolbarAction
(
action
);
}
/*********************************************************
* MANAGE SCENE VIEW BUTTONS
*********************************************************/
/*
bool Plugin::addSceneViewButton(Scene* scene, ViewButton* viewButton)
{
if(scene && viewButton)
return scene->addViewButton(viewButton);
return false;
}
void Plugin::removeSceneViewButton(Scene* scene, ViewButton* viewButton)
{
if(scene && viewButton)
scene->removeViewButton(viewButton);
}
*/
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