static void loadPluginDir(const QString& s, const PluginType t) { if (debugMsg) qWarning("scan plugin dir <%s>\n", s.toLatin1().constData()); #ifdef __WINDOWS__ QDir pluginDir(s, QString("*.dll")); #else QDir pluginDir(s, QString("*.so")); #endif if (pluginDir.exists()) { QFileInfoList list = pluginDir.entryInfoList(); QFileInfoList::iterator it = list.begin(); while (it != list.end()) { // Disable known broken plugins that may crash oom on startup QStringList blacklist; blacklist.append("dssi-vst.so"); blacklist.append("liteon_biquad-vst.so"); blacklist.append("liteon_biquad-vst_64bit.so"); blacklist.append("fx_blur-vst.so"); blacklist.append("fx_blur-vst_64bit.so"); blacklist.append("Scrubby_64bit.so"); blacklist.append("Skidder_64bit.so"); blacklist.append("libwormhole2_64bit.so"); blacklist.append("vexvst.so"); if (blacklist.contains( ((QFileInfo*)&*it)->fileName()) ) { ++it; continue; } loadPluginLib(&*it, t); ++it; } } }
DesktopScene::DesktopScene(QObject * parent) : QGraphicsScene(parent), m_wheelDesktopSwitch(false), m_menu(0), m_activePlugin(0) { m_power = new PowerManager(this); m_screenSaver = new ScreenSaver(this); DesktopConfig::instance()->config->beginGroup("razor"); QStringList plugins = DesktopConfig::instance()->config->value("plugins").toStringList(); m_menuFile = DesktopConfig::instance()->config->value("menu_file", "").toString(); m_wheelDesktopSwitch = DesktopConfig::instance()->config->value("mouse_wheel_desktop_switch", false).toBool(); DesktopConfig::instance()->config->endGroup(); if (m_menuFile.isEmpty()) m_menuFile = XdgMenu::getMenuFileName(); m_xdgMenu.setEnvironments(QStringList() << "X-RAZOR" << "Razor"); bool res = m_xdgMenu.read(m_menuFile); connect(&m_xdgMenu, SIGNAL(changed()), this, SLOT(buildMenu())); if (res) { QTimer::singleShot(1000, this, SLOT(buildMenu())); } else { QMessageBox::warning(0, "Menu Parse error", m_xdgMenu.errorString()); return; } m_actArrangeWidgets = new QAction(tr("Unlock Desktop..."), this); m_actArrangeWidgets->setIcon(XdgIcon::fromTheme("object-locked")); m_actArrangeWidgets->setCheckable(true); connect(m_actArrangeWidgets, SIGNAL(toggled(bool)), this, SLOT(arrangeWidgets(bool))); m_actAddNewPlugin = new QAction(tr("Add New Desktop Widget..."), this); connect(m_actAddNewPlugin, SIGNAL(triggered()), this, SLOT(showAddPluginDialog())); m_actRemovePlugin = new QAction(tr("Remove Plugin..."), this); connect(m_actRemovePlugin, SIGNAL(triggered()), this, SLOT(removePlugin())); m_actConfigurePlugin = new QAction(tr("Configure Plugin..."), this); connect(m_actConfigurePlugin, SIGNAL(triggered()), this, SLOT(configurePlugin())); m_actSetbackground = new QAction(tr("Set Desktop Background..."), this); m_actSetbackground->setIcon(XdgIcon::fromTheme("preferences-desktop-wallpaper")); connect(m_actSetbackground, SIGNAL(triggered()), this, SLOT(setDesktopBackground())); m_actAbout = new QAction(tr("About Razor..."), this); m_actAbout->setIcon(XdgIcon::fromTheme("help-browser")); connect(m_actAbout, SIGNAL(triggered()), this, SLOT(about())); // load plugins QStringList desktopDirs = pluginDesktopDirs(); foreach (QString configId, plugins) { DesktopConfig::instance()->config->beginGroup(configId); QString libName(DesktopConfig::instance()->config->value("plugin", "").toString()); qreal x = DesktopConfig::instance()->config->value("x", 10.0).toReal(); qreal y = DesktopConfig::instance()->config->value("y", 10.0).toReal(); qreal w = DesktopConfig::instance()->config->value("w", 10.0).toReal(); qreal h = DesktopConfig::instance()->config->value("h", 10.0).toReal(); QPointF position(x, y); QSizeF size(w, h); DesktopConfig::instance()->config->endGroup(); RazorPluginInfoList list = RazorPluginInfo::search(desktopDirs, "RazorDesktop/Plugin", QString("%1.desktop").arg(libName)); if( !list.count()) { qWarning() << QString("Plugin \"%1\" not found.").arg(libName); continue; } QLibrary* lib = loadPluginLib(list.first()); if (!lib) { qWarning() << "RazorWorkSpace::setConfig() Library" << libName << "is not loaded"; continue; } DesktopWidgetPlugin * item = m_plugins[configId]; if (!item) { item = loadPlugin(lib, configId); m_plugins.insert(configId, item); } item->setSizeAndPosition(position, size); }