| 50 | } |
| 51 | |
| 52 | bool PluginLoader::load() { |
| 53 | if (!m_loader) |
| 54 | m_loader = new QPluginLoader(m_fileName); |
| 55 | if (!m_loader->isLoaded()) { |
| 56 | if (m_loader->load()) { |
| 57 | // TODO |
| 58 | // VersionedPlugin *plugin = qobject_cast<VersionedPlugin *>(m_loader->instance()); |
| 59 | // if (plugin) { |
| 60 | // int version = plugin->pluginTargetAppVersion(); |
| 61 | // QString appName = plugin->pluginTargetAppName(); |
| 62 | // if (SciDAVis::appName == appName && |
| 63 | // (SciDAVis::version() & 0xFFFF00) == (version & 0xFFFF00)) { |
| 64 | // m_statusString = i18n("Plugin '%1' successfully loaded.", m_fileName); |
| 65 | // m_status = Active; |
| 66 | // } else { |
| 67 | // m_statusString = i18n("Plugin '%1' was created for incompatible version: %2 %3.%4.x", |
| 68 | // m_fileName, appName, (version & 0xFF0000) >> 16, (version & 0x00FF00) >> 8); |
| 69 | // m_status = IncompatibleApp; |
| 70 | // } |
| 71 | // } else { |
| 72 | // m_statusString = i18n("Plugin '%1' is not a %2 plugin.", m_fileName, SciDAVis::appName); |
| 73 | // m_status = NoVersionedPlugin; |
| 74 | // } |
| 75 | } else { |
| 76 | m_statusString = m_loader->errorString(); |
| 77 | m_status = PluginStatus::ErrorFromQt; |
| 78 | } |
| 79 | } |
| 80 | return (PluginStatus::Active == m_status); |
| 81 | } |
| 82 | |
| 83 | bool PluginLoader::unload() { |
| 84 | if (m_loader && m_loader->isLoaded()) |