Plugin::Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, const QString &settingsGroup, LXQtPanel *panel) : QFrame(panel), mDesktopFile(desktopFile), mPluginLoader(0), mPlugin(0), mPluginWidget(0), mAlignment(AlignLeft), mPanel(panel) { mSettings = PluginSettingsFactory::create(settings, settingsGroup); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); setWindowTitle(desktopFile.name()); mName = desktopFile.name(); QStringList dirs; dirs << QProcessEnvironment::systemEnvironment().value("LXQTPANEL_PLUGIN_PATH").split(":"); dirs << PLUGIN_DIR; bool found = false; if(ILXQtPanelPluginLibrary const * pluginLib = findStaticPlugin(desktopFile.id())) { // this is a static plugin found = true; loadLib(pluginLib); } else { // this plugin is a dynamically loadable module QString baseName = QString("lib%1.so").arg(desktopFile.id()); foreach(QString dirName, dirs) { QFileInfo fi(QDir(dirName), baseName); if (fi.exists()) { found = true; if (loadModule(fi.absoluteFilePath())) break; } } }
Plugin::Plugin(const LxQt::PluginInfo &desktopFile, const QString &settingsFile, const QString &settingsGroup, LxQtPanel *panel) : QFrame(panel), mDesktopFile(desktopFile), mPluginLoader(0), mPlugin(0), mPluginWidget(0), mAlignment(AlignLeft), mSettingsGroup(settingsGroup), mPanel(panel) { mSettings = new LxQt::Settings(settingsFile, QSettings::IniFormat, this); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); mSettings->beginGroup(settingsGroup); mSettingsHash = calcSettingsHash(); setWindowTitle(desktopFile.name()); mName = desktopFile.name(); QStringList dirs; dirs << QProcessEnvironment::systemEnvironment().value("LXQTPANEL_PLUGIN_PATH").split(":"); dirs << PLUGIN_DIR; QString baseName = QString("lib%1.so").arg(desktopFile.id()); bool found = false; foreach(QString dirName, dirs) { QFileInfo fi(QDir(dirName), baseName); if (fi.exists()) { found = true; if (loadLib(fi.absoluteFilePath())) break; } }