Commit c4e6e50b authored by Wescoeur's avatar Wescoeur

feat(Colors): supports colors override with linphonerc

parent c579092e
...@@ -20,8 +20,30 @@ ...@@ -20,8 +20,30 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include <QMetaProperty>
#include "../../../utils/Utils.hpp"
#include "../../core/CoreManager.hpp"
#include "Colors.hpp" #include "Colors.hpp"
#define COLORS_SECTION "ui_colors"
using namespace std;
// ============================================================================= // =============================================================================
Colors::Colors (QObject *parent) : QObject(parent) {} Colors::Colors (QObject *parent) : QObject(parent) {
shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig();
const QMetaObject *info = metaObject();
for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) {
const QMetaProperty &metaProperty = info->property(i);
string colorName = metaProperty.name();
string colorValue = config->getString(COLORS_SECTION, colorName, "");
if (!colorValue.empty())
setProperty(colorName.c_str(), QColor(::Utils::coreStringToAppString(colorValue)));
}
}
...@@ -29,12 +29,9 @@ ...@@ -29,12 +29,9 @@
// ============================================================================= // =============================================================================
#define ADD_COLOR(COLOR, VALUE) \ #define ADD_COLOR(COLOR, VALUE) \
signals: \
void COLOR ## Changed(const QColor &color); \
private: \
Q_PROPERTY(QColor COLOR MEMBER m ## COLOR WRITE set ## COLOR NOTIFY colorT ## COLOR ## Changed); \ Q_PROPERTY(QColor COLOR MEMBER m ## COLOR WRITE set ## COLOR NOTIFY colorT ## COLOR ## Changed); \
void set ## COLOR(const QColor &color) { \ void set ## COLOR(const QColor &color) { \
m ## COLOR = QColor(color.rgb()); \ m ## COLOR = color; \
emit colorT ## COLOR ## Changed(m ## COLOR); \ emit colorT ## COLOR ## Changed(m ## COLOR); \
} \ } \
QColor m ## COLOR = VALUE; QColor m ## COLOR = VALUE;
...@@ -102,19 +99,11 @@ signals: ...@@ -102,19 +99,11 @@ signals:
void colorTeChanged (const QColor &color); void colorTeChanged (const QColor &color);
void colorTfChanged (const QColor &color); void colorTfChanged (const QColor &color);
void colorTgChanged (const QColor &color); void colorTgChanged (const QColor &color);
void colorTg10Changed (const QColor &color);
void colorTg20Changed (const QColor &color);
void colorTg90Changed (const QColor &color);
void colorThChanged (const QColor &color); void colorThChanged (const QColor &color);
void colorTiChanged (const QColor &color); void colorTiChanged (const QColor &color);
void colorTi30Changed (const QColor &color);
void colorTjChanged (const QColor &color); void colorTjChanged (const QColor &color);
void colorTj75Changed (const QColor &color);
void colorTkChanged (const QColor &color); void colorTkChanged (const QColor &color);
void colorTk50Changed (const QColor &color);
void colorTlChanged (const QColor &color); void colorTlChanged (const QColor &color);
void colorTl50Changed (const QColor &color);
void colorTl80Changed (const QColor &color);
void colorTmChanged (const QColor &color); void colorTmChanged (const QColor &color);
void colorTnChanged (const QColor &color); void colorTnChanged (const QColor &color);
void colorToChanged (const QColor &color); void colorToChanged (const QColor &color);
...@@ -129,6 +118,7 @@ signals: ...@@ -129,6 +118,7 @@ signals:
void colorTxChanged (const QColor &color); void colorTxChanged (const QColor &color);
void colorTyChanged (const QColor &color); void colorTyChanged (const QColor &color);
void colorTzChanged (const QColor &color); void colorTzChanged (const QColor &color);
void colorTerrorChanged (const QColor &color); void colorTerrorChanged (const QColor &color);
}; };
......
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