mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 06:38:07 +00:00
feat(Colors): supports colors override with linphonerc
This commit is contained in:
parent
c579092e65
commit
c4e6e50b8f
2 changed files with 25 additions and 13 deletions
|
|
@ -20,8 +20,30 @@
|
|||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include <QMetaProperty>
|
||||
|
||||
#include "../../../utils/Utils.hpp"
|
||||
#include "../../core/CoreManager.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 @@
|
|||
// =============================================================================
|
||||
|
||||
#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); \
|
||||
void set ## COLOR(const QColor &color) { \
|
||||
m ## COLOR = QColor(color.rgb()); \
|
||||
m ## COLOR = color; \
|
||||
emit colorT ## COLOR ## Changed(m ## COLOR); \
|
||||
} \
|
||||
QColor m ## COLOR = VALUE;
|
||||
|
|
@ -102,19 +99,11 @@ signals:
|
|||
void colorTeChanged (const QColor &color);
|
||||
void colorTfChanged (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 colorTiChanged (const QColor &color);
|
||||
void colorTi30Changed (const QColor &color);
|
||||
void colorTjChanged (const QColor &color);
|
||||
void colorTj75Changed (const QColor &color);
|
||||
void colorTkChanged (const QColor &color);
|
||||
void colorTk50Changed (const QColor &color);
|
||||
void colorTlChanged (const QColor &color);
|
||||
void colorTl50Changed (const QColor &color);
|
||||
void colorTl80Changed (const QColor &color);
|
||||
void colorTmChanged (const QColor &color);
|
||||
void colorTnChanged (const QColor &color);
|
||||
void colorToChanged (const QColor &color);
|
||||
|
|
@ -129,6 +118,7 @@ signals:
|
|||
void colorTxChanged (const QColor &color);
|
||||
void colorTyChanged (const QColor &color);
|
||||
void colorTzChanged (const QColor &color);
|
||||
|
||||
void colorTerrorChanged (const QColor &color);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue