Skip to content

Commit

Permalink
plugingenerator: Fix scopyPDK bugs.
Browse files Browse the repository at this point in the history
Signed-off-by: andreidanila1 <[email protected]>
  • Loading branch information
andreidanila1 committed Aug 27, 2024
1 parent 3c9c809 commit e273fa2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private:
void loadPlugin(QString file);
bool pluginCategory(QString category);

scopy::Plugin *m_plugin = nullptr;
scopy::Plugin *m_plugin;
bool m_loaded;
};

Expand Down
13 changes: 9 additions & 4 deletions tools/plugingenerator/templates/pdk/pdk_src_template.mako
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void PDKWindow::onDisconnect()
m_tabWidget->removeTab(idx);
m_toolList.removeOne(t);
}
onLoad();
}

void PDKWindow::onInit()
Expand Down Expand Up @@ -531,9 +532,9 @@ void MainWidget::onConnect()
void MainWidget::onDisconnect()
{
m_pluginManager->plugin()->onDisconnect();
onUnload();
changeVisibility(m_disconnBtn, m_connBtn);
m_unloadBtn->setEnabled(true);
m_state = State::Loaded;
Q_EMIT disconnected();
}

Expand Down Expand Up @@ -610,6 +611,8 @@ void MainWidget::onLoad()
changeVisibility(m_unloadBtn, m_loadBtn);
m_state = State::Loaded;
updateStatusLbl("");
m_deviceTypeCb->setEnabled(false);
m_uriEdit->setEnabled(false);
Q_EMIT loaded();
}

Expand All @@ -620,6 +623,8 @@ void MainWidget::onUnload()
enableBrowseInit(true);
changeVisibility(m_unloadBtn, m_loadBtn);
m_state = State::Unloaded;
m_deviceTypeCb->setEnabled(true);
m_uriEdit->setEnabled(true);
Q_EMIT unloaded();
}

Expand Down Expand Up @@ -679,6 +684,7 @@ bool MainWidget::isCompatible(QString uri, QString cat)
PluginManager::PluginManager(QString pluginPath, QObject *parent)
: QObject(parent)
, m_loaded(false)
, m_plugin(nullptr)
{
loadPlugin(pluginPath);
}
Expand Down Expand Up @@ -731,15 +737,14 @@ bool PluginManager::pluginCategory(QString category)

bool PluginManager::pluginCompatibility(QString param, QString category)
{
initPlugin();
bool isCategory = pluginCategory(category);
if(!isCategory)
return false;
if(!m_plugin->compatible(param, category)) {
if(!m_plugin->compatible(param, category))
return false;
}
m_plugin->setParam(param, category);
m_plugin->setEnabled(true);
initPlugin();
return true;
}

Expand Down

0 comments on commit e273fa2

Please sign in to comment.