Commit a1fb2573 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Functions added to AlgorithmSelector in order to access to available tools.

parent 57185657
......@@ -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 );
}
......
......@@ -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 );
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment