Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frédéric Larue
CommonGUI
Commits
a1fb2573
Commit
a1fb2573
authored
Feb 21, 2019
by
Frédéric Larue
Browse files
Functions added to AlgorithmSelector in order to access to available tools.
parent
57185657
Changes
2
Hide whitespace changes
Inline
Side-by-side
GUI_main/AlgorithmSelector.cpp
View file @
a1fb2573
...
...
@@ -77,6 +77,7 @@ void AlgorithmSelector::populateTools( ToolInterface *plugin )
foreach
(
UIParamAction
*
act
,
tool
.
param
->
GetActions
()
)
connect
(
act
->
Widget
(),
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
emitActionSignal
())
);
m_ToolsByName
[
plugin
->
name
(
i
)
]
=
tool
;
m_ToolsByCategory
[
categoryId
].
push_back
(
tool
);
m_ui
->
widgetToolGroupBoxes
->
layout
()
->
addWidget
(
tool
.
param
);
}
...
...
GUI_main/AlgorithmSelector.h
View file @
a1fb2573
...
...
@@ -30,6 +30,7 @@ class AlgorithmSelector : public QWidget
{
Q_OBJECT
public:
struct
ToolDescriptor
{
ToolInterface
*
plugin
;
...
...
@@ -37,6 +38,7 @@ class AlgorithmSelector : public QWidget
int
id
;
};
private:
Ui
::
AlgorithmSelector
*
m_ui
;
QButtonGroup
*
m_CategoryButtonGroup
;
...
...
@@ -45,6 +47,7 @@ class AlgorithmSelector : public QWidget
UIParamSet
*
m_SelectedToolParam
;
QString
m_ActionId
;
QMap
<
QString
,
ToolDescriptor
>
m_ToolsByName
;
QVector
<
QVector
<
ToolDescriptor
>
>
m_ToolsByCategory
;
QVector
<
int
>
m_LastUsedInCategory
;
...
...
@@ -53,31 +56,33 @@ public:
AlgorithmSelector
(
QWidget
*
parent
=
NULL
);
~
AlgorithmSelector
();
void
populateTools
(
ToolInterface
*
tool
);
void
releaseAllTools
();
void
finalizeTools
();
inline
QString
currentToolName
()
const
{
return
m_SelectedTool
->
plugin
->
name
(
m_SelectedTool
->
id
);
}
void
populateTools
(
ToolInterface
*
tool
);
void
releaseAllTools
();
void
finalizeTools
();
inline
QString
currentToolName
()
const
{
return
m_SelectedTool
->
plugin
->
name
(
m_SelectedTool
->
id
);
}
inline
QList
<
ToolDescriptor
>
allTools
()
const
{
return
m_ToolsByName
.
values
();
}
inline
const
ToolDescriptor
*
getToolByName
(
const
QString
&
name
)
const
{
auto
found
=
m_ToolsByName
.
find
(
name
);
return
(
found
==
m_ToolsByName
.
end
())
?
NULL
:
&*
found
;
}
protected:
void
changeEvent
(
QEvent
*
e
);
void
changeEvent
(
QEvent
*
e
);
private
slots
:
void
selectCategory
(
int
categoryId
);
void
selectTool
(
int
n
);
void
selectCategory
(
int
categoryId
);
void
selectTool
(
int
n
);
public
slots
:
void
emitApplySignal
();
void
emitActionSignal
();
void
applyCurrentToolOn
(
const
QList
<
GenericUIData
*>
&
items
,
UIMainWindow
*
mainwin
,
GLViewer
*
glviewer
,
UIProject
*
project
);
inline
void
emitLog
(
const
QString
&
msg
)
{
emit
logEmitted
(
msg
);
}
void
emitApplySignal
();
void
emitActionSignal
();
void
applyCurrentToolOn
(
const
QList
<
GenericUIData
*>
&
items
,
UIMainWindow
*
mainwin
,
GLViewer
*
glviewer
,
UIProject
*
project
);
inline
void
emitLog
(
const
QString
&
msg
)
{
emit
logEmitted
(
msg
);
}
signals:
void
askItemsToApplyToolOn
();
void
toolExecutionFinished
(
bool
);
void
logEmitted
(
const
QString
&
msg
);
void
askItemsToApplyToolOn
();
void
toolExecutionFinished
(
bool
);
void
logEmitted
(
const
QString
&
msg
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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