Logo Search packages:      
Sourcecode: qstardict version File versions  Download package

void QStarDict::DictCore::setLoadedPlugins ( const QStringList &  loadedPlugins  ) 

Sets a loaded plugins. If plugin cannot be loaded it will not be added to loadedPlugins list.

Definition at line 118 of file dictcore.cpp.

References plugin().

Referenced by loadSettings().

{
    for (QHash <QString, QPluginLoader*>::iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
    {
        delete (*i)->instance();
        delete *i;
    }
    m_plugins.clear();

    for (QStringList::const_iterator i = loadedPlugins.begin(); i != loadedPlugins.end(); ++i)
    {
#ifdef Q_OS_UNIX
        QString pluginFilename = QSTARDICT_PLUGINS_DIR "/" "lib" + *i + ".so";
#elif defined Q_OS_WIN
        // TODO
        QString pluginFilename = QSTARDICT_PLUGINS_DIR "/" "lib" + *i + ".dll";
#else
#error "Function DictCore::setLoadedPlugins(const QStringList &loadedPlugins) is not available on this platform"
#endif
        QPluginLoader *plugin = new QPluginLoader(pluginFilename);
        if (! plugin->load())
        {
            qWarning() << plugin->errorString();
            delete plugin;
            continue;
        }
        m_plugins[*i] = plugin;
    }
}


Generated by  Doxygen 1.6.0   Back to index