예제 #1
0
/**
 * \brief create a PluginLoader
 *
 * Create a PluginLoader autoDelete is set to false
 *
 * \code
 * Opie::Core::OGenericPluginLoader loader("myapp-plugin");
 * Opie::Core::OPluginItem::List  lst = loader.filtered();
 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){
 *    MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface));
 * }
 * \endcode
 *
 * \code
 * Opie::Core::OGenericPluginLoader loader("myapp-plugin");
 * Opie::Core::OPluginItem::List  lst = loader.filtered();
 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){
 *    MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface));
 * }
 * ...
 * loader.clear();
 *
 * \endcode
 *
 * @param name The name of the plugin directory.
 * @param isSorted Tell the PluginLoader if your Plugins are sorted
 */
OGenericPluginLoader::OGenericPluginLoader( const QString& name,  bool isSorted)
    : m_dir( name ), m_autoDelete( false ), m_isSafeMode( false ),
      m_isSorted( isSorted )
{
    setPluginDir( QPEApplication::qpeDir() + "plugins/"+name );
    readConfig();
}
예제 #2
0
void Scripting::createDefaultPluginDir() {
    auto pluginDir = getPluginDir();
    if (!pluginDir.isEmpty() && QDir(pluginDir).exists()) {
        return;
    }
    pluginDir = getDefaultPluginDir();
    if (!QDir().mkpath(pluginDir)) {
        QMessageBox errorBox(QMessageBox::Warning, "Python Plugin Manager: Error",
                             QString("Cannot create plugin directory:\n%1").arg(pluginDir),
                             QMessageBox::Ok, NULL);
        errorBox.exec();
        return;
    }
    setPluginDir(pluginDir);
}