Verified Commit 79a48334 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove version check through virtual method

For the check to be made the plugin has to be instantiated first, but if it
is incompatible it will already crash the app at this point.

Considering that all plugins are in this repo one can safely assume that all plugins
will be build against the current interface.
parent c1d32178
......@@ -118,9 +118,6 @@ public:
return loaded;
}
/// Check whether the plugin matches the version of KT
virtual bool versionCheck(const QString &version) const = 0;
/// Returns the name of the parent part the GUI of the plugin should be created in
virtual QString parentPart() const
{
......
......@@ -84,19 +84,12 @@ void PluginManager::load(const KPluginMetaData &data, int idx)
return;
}
if (!plugin->versionCheck(QStringLiteral(VERSION))) {
Out(SYS_GEN | LOG_NOTICE) << QStringLiteral("Plugin %1 version does not match KTorrent version, unloading it.").arg(pluginsMetaData.at(idx).fileName())
<< endl;
delete plugin;
} else {
plugin->setCore(core);
plugin->setGUI(gui);
plugin->load();
gui->mergePluginGui(plugin);
plugin->loaded = true;
loaded.insert(idx, plugin, true);
}
plugin->setCore(core);
plugin->setGUI(gui);
plugin->load();
gui->mergePluginGui(plugin);
plugin->loaded = true;
loaded.insert(idx, plugin, true);
}
void PluginManager::unload(const KPluginMetaData &data, int idx)
......
......@@ -197,11 +197,6 @@ void BWSchedulerPlugin::onLoaded(Schedule *ns)
timerTriggered();
}
bool BWSchedulerPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void BWSchedulerPlugin::colorsChanged()
{
if (m_editor) {
......
......@@ -34,7 +34,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
public Q_SLOTS:
void timerTriggered();
......
......@@ -40,11 +40,6 @@ DownloadOrderPlugin::~DownloadOrderPlugin()
{
}
bool DownloadOrderPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void DownloadOrderPlugin::load()
{
TorrentActivityInterface *ta = getGUI()->getTorrentActivity();
......
......@@ -24,7 +24,6 @@ public:
DownloadOrderPlugin(QObject *parent, const QVariantList &args);
~DownloadOrderPlugin() override;
bool versionCheck(const QString &version) const override;
void load() override;
void unload() override;
void currentTorrentChanged(bt::TorrentInterface *tc) override;
......
......@@ -160,11 +160,6 @@ void InfoWidgetPlugin::currentTorrentChanged(bt::TorrentInterface *tc)
createMonitor(tc);
}
bool InfoWidgetPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void InfoWidgetPlugin::applySettings()
{
// if the colors are invalid, set the default colors
......
......@@ -40,7 +40,6 @@ public:
void unload() override;
void guiUpdate() override;
void currentTorrentChanged(bt::TorrentInterface *tc) override;
bool versionCheck(const QString &version) const override;
/// Show PeerView in main window
void showPeerView(bool show);
......
......@@ -94,11 +94,6 @@ bool IPFilterPlugin::loadedAndRunning()
return ip_filter;
}
bool IPFilterPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void IPFilterPlugin::checkAutoUpdate()
{
auto_update_timer.stop();
......
......@@ -34,7 +34,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
/// Loads the KT format list filter
void loadFilters();
......
......@@ -128,10 +128,5 @@ void LogViewerPlugin::guiUpdate()
lv->processPending();
}
bool LogViewerPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
}
#include "logviewerplugin.moc"
......@@ -35,7 +35,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
void guiUpdate() override;
private Q_SLOTS:
......
......@@ -54,11 +54,6 @@ void MagnetGeneratorPlugin::load()
currentTorrentChanged(ta->getCurrentTorrent());
}
bool MagnetGeneratorPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void MagnetGeneratorPlugin::unload()
{
getGUI()->removePrefPage(pref);
......
......@@ -22,7 +22,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
QString parentPart() const override
{
return QStringLiteral("torrentactivity");
......
......@@ -51,11 +51,6 @@ void MediaPlayerPlugin::unload()
act = nullptr;
}
bool MediaPlayerPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
}
#include "mediaplayerplugin.moc"
......@@ -27,7 +27,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
private:
MediaPlayerActivity *act;
......
......@@ -88,10 +88,6 @@ void ScanFolderPlugin::updateScanFolders()
scanner->setFolderList(folders);
}
bool ScanFolderPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
}
#include "scanfolderplugin.moc"
......@@ -30,7 +30,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
public Q_SLOTS:
void updateScanFolders();
......
......@@ -75,11 +75,6 @@ void ScanForLostFilesPlugin::updateScanForLostFiles()
}
}
bool ScanForLostFilesPlugin::versionCheck(const QString &version) const
{
return version == QStringLiteral(VERSION);
}
void ScanForLostFilesPlugin::addToGUI()
{
switch (m_pos) {
......
......@@ -36,7 +36,6 @@ public:
void load() override;
void unload() override;
bool versionCheck(const QString &version) const override;
public Q_SLOTS:
void updateScanForLostFiles();
......
Supports Markdown
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