void ITunesPluginInstaller::install() { qDebug() << "Found installed iTunes plugin?" << isPluginInstalled(); QString installedVersion; QString shippedVersion; disableLegacyHelperApp(); if ( isPluginInstalled() ) { installedVersion = pListVersion( k_iTunesPluginDir + kPListFile ); qDebug() << "Found installed iTunes plugin version:" << installedVersion; } else //TODO don't bootstrap if installation fails m_needsTwiddlyBootstrap = true; shippedVersion = pListVersion( k_shippedPluginDir + kPListFile ); if ( shippedVersion.isEmpty() ) { qDebug() << "Could not locate shipped iTunes plugin!"; } else { qDebug() << "Found shipped iTunes plugin version:" << shippedVersion; if ( installedVersion != shippedVersion ) { qDebug() << "Installing shipped iTunes plugin..."; CloseAppsDialog* closeApps = new CloseAppsDialog(); if ( closeApps->result() != QDialog::Accepted ) closeApps->exec(); else closeApps->deleteLater(); if ( !removeInstalledPlugin() ) { qDebug() << "Removing installed plugin from" << k_iTunesPluginDir << "failed!"; } else { qDebug() << "Successfully removed installed plugin."; if ( installPlugin() ) { qDebug() << "Successfully installed the plugin."; } else qDebug() << "Installing the plugin failed!"; } } else qDebug() << "Installed iTunes plugin is up-to-date."; } }
PluginDialog::PluginDialog() { #ifdef Q_WS_WIN os = "windows"; #endif #ifdef Q_WS_X11 os = "X11"; #endif setWindowIcon(QIcon(":/plug.png")); listWidget = new QTreeWidget(this); listWidget->setIconSize(QSize(24, 24)); listWidget->header()->hide(); info = new QPushButton(tr("plus d'info")); installButton = new QPushButton(tr("Installer")); line = new QLineEdit; line->setPlaceholderText(tr("Rechercher")); connect(info, SIGNAL(clicked()), this, SLOT(getInfo())); connect(installButton, SIGNAL(clicked()), this, SLOT(installPlugin())); connect(listWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(indexChanged())); connect(line, SIGNAL(textChanged(QString)), this, SLOT(search())); QVBoxLayout *lay = new QVBoxLayout; QHBoxLayout *hLay = new QHBoxLayout; lay->addWidget(listWidget); hLay->addStretch(); hLay->addWidget(info); hLay->addWidget(line); hLay->addWidget(installButton); lay->addLayout(hLay); hLay->setStretchFactor(line, 100); setLayout(lay); QSettings set(qApp->applicationDirPath() + "/pluginsList.ini", QSettings::IniFormat); set.beginGroup(os); QStringList items = set.value("list").toStringList(); set.endGroup(); fillTree(items); indexChanged(); resize(500, 400); }
void cPluginManager::autoLoadPlugins() { cAudioVector<cAudioString>::Type fileList = getFilesInDirectory("."); for(size_t i=0; i<fileList.size(); ++i) { if(fileList[i].substr(0, 4) == "cAp_") { #ifdef CAUDIO_PLATFORM_WIN if(fileList[i].substr(fileList[i].length()-4, 4) == ".dll") #elif defined(CAUDIO_PLATFORM_LINUX) if(fileList[i].substr(fileList[i].length()-3, 3) == ".so") #elif defined(CAUDIO_PLATFORM_MAC) if(fileList[i].substr(fileList[i].length()-6, 6) == ".dylib") #endif { //Found a plugin, load it installPlugin(cAudioString("./" + fileList[i]).c_str(), NULL); } } } }
bool cPluginManager::installPlugin(const char* filename, const char* name) { DYNLIB_HANDLE m_hInst = DYNLIB_LOAD(filename); if(m_hInst) { GetPluginModule moduleFunc = (GetPluginModule)DYNLIB_GETSYM(m_hInst, "GetPluginModule"); if(moduleFunc) { IAudioPlugin* plugin = moduleFunc(CAUDIO_VERSION); if(plugin) { DynamicallyLoadedPlugins[plugin] = m_hInst; return installPlugin(plugin, name); } } else getLogger()->logError("cPluginManager", "installPlugin Error: %s.", getError().c_str()); } return false; }
bool cPluginManager::installPlugin(const char* filename, const char* name) { #ifdef CAUDIO_COMPILE_WITH_DYNAMIC_PLUGIN_SUPPORT DYNLIB_HANDLE m_hInst = DYNLIB_LOAD(filename); if(m_hInst) { GetPluginModule moduleFunc = (GetPluginModule)DYNLIB_GETSYM(m_hInst, "GetPluginModule"); if(moduleFunc) { IAudioPlugin* plugin = moduleFunc(CAUDIO_VERSION); if(plugin) { DynamicallyLoadedPlugins[plugin] = m_hInst; return installPlugin(plugin, name); } } } #endif return false; }