Commit 1302194c authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin

plugin: support for preferences in callView

Change-Id: I12241fa07e9ac6bcdbfdac29154d86528e606611
parent dfeaa870
......@@ -28,34 +28,33 @@
// LRC
#include "typedefs.h"
namespace lrc
namespace lrc {
namespace api {
namespace plugin {
/**
* This class describes current plugin Details
*/
struct PluginDetails
{
QString name = "";
QString path = "";
QString iconPath = "";
bool loaded = false;
};
namespace api
struct MediaHandlerDetails
{
QString id = "";
QString name = "";
QString iconPath = "";
QString pluginId = "";
};
} // namespace plugin
namespace plugin
class LIB_EXPORT PluginModel : public QObject
{
/**
* This class describes current plugin Details
*/
struct PluginDetails
{
QString name = "";
QString path = "";
QString iconPath = "";
bool loaded = false;
};
struct MediaHandlerDetails
{
QString id = "";
QString name = "";
QString iconPath = "";
};
}
class LIB_EXPORT PluginModel : public QObject {
Q_OBJECT
public:
PluginModel();
......@@ -148,7 +147,9 @@ public:
* Modify preference of installed plugin
* @return true if preference was succesfully modified
*/
Q_INVOKABLE bool setPluginPreference(const QString& path, const QString& key, const QString& value);
Q_INVOKABLE bool setPluginPreference(const QString& path,
const QString& key,
const QString& value);
/**
* Get preferences values of installed plugin
......@@ -163,14 +164,13 @@ public:
Q_INVOKABLE bool resetPluginPreferencesValues(const QString& path);
/**
* Add a possible value to a preference that can be edited by the user
* the only possibility at the moment is USERLIST option
* @return if addition was successfull
*/
* Add a possible value to a preference that can be edited by the user
* the only possibility at the moment is USERLIST option
* @return if addition was successfull
*/
Q_INVOKABLE bool addValueToPreference(const QString& pluginId,
const QString& preferenceKey,
const QString& value);
};
} // namespace api
......
......@@ -18,7 +18,7 @@
#include "api/pluginmodel.h"
// Std
#include <algorithm> // std::sort
#include <algorithm> // std::sort
#include <chrono>
#include <csignal>
#include <iomanip> // for std::put_time
......@@ -35,17 +35,15 @@
// Ring daemon
// LRC
#include "dbus/pluginmanager.h"
namespace lrc
{
namespace lrc {
using namespace api;
PluginModel::PluginModel()
: QObject()
: QObject()
{}
PluginModel::~PluginModel() {}
......@@ -82,8 +80,7 @@ PluginModel::getPluginDetails(const QString& path)
}
MapStringString details = PluginManager::instance().getPluginDetails(path);
plugin::PluginDetails result;
if (!details.empty())
{
if (!details.empty()) {
result.name = details["name"];
result.path = path;
result.iconPath = details["iconPath"];
......@@ -100,8 +97,7 @@ PluginModel::getPluginDetails(const QString& path)
bool
PluginModel::installPlugin(const QString& jplPath, bool force)
{
if (getPluginsEnabled())
{
if (getPluginsEnabled()) {
return PluginManager::instance().installPlugin(jplPath, force);
}
return false;
......@@ -136,7 +132,7 @@ void
PluginModel::toggleCallMediaHandler(const QString& id)
{
MapStringString toggleInfo = PluginManager::instance().getCallMediaHandlerStatus();
if (toggleInfo["name"] == id){
if (toggleInfo["name"] == id) {
PluginManager::instance().toggleCallMediaHandler(id, false);
} else {
PluginManager::instance().toggleCallMediaHandler(id, true);
......@@ -157,11 +153,11 @@ PluginModel::getCallMediaHandlerDetails(const QString& id)
}
MapStringString mediaHandlerDetails = PluginManager::instance().getCallMediaHandlerDetails(id);
plugin::MediaHandlerDetails result;
if (!mediaHandlerDetails.empty())
{
if (!mediaHandlerDetails.empty()) {
result.id = id;
result.iconPath = mediaHandlerDetails["iconPath"];
result.name = mediaHandlerDetails["name"];
result.pluginId = mediaHandlerDetails["pluginId"];
}
return result;
......@@ -193,8 +189,8 @@ PluginModel::resetPluginPreferencesValues(const QString& path)
bool
PluginModel::addValueToPreference(const QString& pluginId,
const QString& preferenceKey,
const QString& value)
const QString& preferenceKey,
const QString& value)
{
return PluginManager::instance().addValueToPreference(pluginId, preferenceKey, value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment