Theme colors via config ui|theme_main_color

This commit is contained in:
Christophe Deschamps 2025-10-03 10:25:05 +02:00
parent 8a2e842cd7
commit 295dbcb4c3
12 changed files with 107 additions and 43 deletions

View file

@ -140,6 +140,9 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) {
INIT_CORE_MEMBER(DisableCommandLine, settingsModel)
INIT_CORE_MEMBER(DisableCallForward, settingsModel)
INIT_CORE_MEMBER(CallForwardToAddress, settingsModel)
INIT_CORE_MEMBER(ThemeMainColor, settingsModel)
INIT_CORE_MEMBER(ThemeAboutPictureUrl, settingsModel)
}
SettingsCore::SettingsCore(const SettingsCore &settingsCore) {
@ -452,6 +455,10 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
disableCallForward, DisableCallForward)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QString,
callForwardToAddress, CallForwardToAddress)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QString,
themeAboutPictureUrl, ThemeAboutPictureUrl)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QString,
themeMainColor, ThemeMainColor)
auto coreModelConnection = SafeConnection<SettingsCore, CoreModel>::create(me, CoreModel::getInstance());

View file

@ -252,6 +252,9 @@ public:
DECLARE_CORE_GETSET_MEMBER(QString, callForwardToAddress, CallForwardToAddress)
DECLARE_CORE_GET_CONSTANT(QFont, emojiFont, EmojiFont)
DECLARE_CORE_GET_CONSTANT(QFont, textMessageFont, TextMessageFont)
// Theme
DECLARE_CORE_GETSET_MEMBER(QString, themeMainColor, ThemeMainColor)
DECLARE_CORE_GETSET_MEMBER(QString, themeAboutPictureUrl, ThemeAboutPictureUrl)
signals:

View file

@ -1,11 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11134_54320)">
<path d="M0 0H24V24H0V0Z" fill="#F9F9F9"/>
<path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4C16.42 4 20 7.58 20 12C20 16.42 16.42 20 12 20Z" fill="#FE5E00"/>
</g>
<defs>
<clipPath id="clip0_11134_54320">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 509 B

View file

@ -1,12 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11134_54326)">
<path d="M0 0H24V24H0V0Z" fill="#F9F9F9"/>
<path d="M12 7C9.24 7 7 9.24 7 12C7 14.76 9.24 17 12 17C14.76 17 17 14.76 17 12C17 9.24 14.76 7 12 7ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4C16.42 4 20 7.58 20 12C20 16.42 16.42 20 12 20Z" fill="#FE5E00"/>
</g>
<defs>
<clipPath id="clip0_11134_54326">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 602 B

View file

@ -897,6 +897,9 @@ void SettingsModel::notifyConfigReady(){
DEFINE_NOTIFY_CONFIG_READY(usernameOnlyForCardDAVLookupsInCalls, UsernameOnlyForCardDAVLookupsInCalls)
DEFINE_NOTIFY_CONFIG_READY(commandLine, CommandLine)
DEFINE_NOTIFY_CONFIG_READY(disableCommandLine, DisableCommandLine)
DEFINE_NOTIFY_CONFIG_READY(themeMainColor, ThemeMainColor)
DEFINE_NOTIFY_CONFIG_READY(themeAboutPictureUrl, ThemeAboutPictureUrl)
}
DEFINE_GETSET_CONFIG(SettingsModel, bool, Bool, disableChatFeature, DisableChatFeature, "disable_chat_feature", false)
@ -1042,4 +1045,14 @@ DEFINE_GETSET_CONFIG(SettingsModel,
DisableCallForward,
"disable_call_forward",
true)
DEFINE_GETSET_CONFIG_STRING(SettingsModel,
themeMainColor,
ThemeMainColor,
"theme_main_color",
"orange")
DEFINE_GETSET_CONFIG_STRING(SettingsModel,
themeAboutPictureUrl,
ThemeAboutPictureUrl,
"theme_about_picture_url",
"")
// clang-format on

View file

@ -213,6 +213,8 @@ public:
DECLARE_GETSET(bool, disableCallForward, DisableCallForward)
DECLARE_GETSET(QString, callForwardToAddress, CallForwardToAddress)
DECLARE_GETSET(QString, chatNotificationSoundPath, ChatNotificationSoundPath)
DECLARE_GETSET(QString, themeMainColor, ThemeMainColor)
DECLARE_GETSET(QString, themeAboutPictureUrl, ThemeAboutPictureUrl)
signals:
void logsUploadUrlChanged();

View file

@ -194,6 +194,7 @@ list(APPEND _LINPHONEAPP_QML_SINGLETONS
view/Style/DefaultStyle.qml
view/Style/FileViewStyle.qml
view/Style/Typography.qml
view/Style/Themes.qml
)
set(_LINPHONEAPP_QML_FILES ${_LINPHONEAPP_QML_FILES} PARENT_SCOPE)

View file

@ -27,8 +27,8 @@ Control.Slider {
height: parent.height
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: 0.0; color: "#FF9E79" }
GradientStop { position: 1.0; color: "#FE5E00" }
GradientStop { position: 0.0; color: DefaultStyle.main1_300 }
GradientStop { position: 1.0; color: DefaultStyle.main1_500_main }
}
radius: Math.round(40 * DefaultStyle.dp)
}

View file

@ -99,7 +99,8 @@ ColumnLayout {
delegate: ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: Math.round(8 * DefaultStyle.dp)
Control.RadioButton {
RadioButton {
color: DefaultStyle.main1_500_main
enabled: modelData.disabled !== true
opacity: modelData.disabled !== true ? 1.0 : 0.5
checked: modelData.lifetime === mainItem.selectedLifetime
@ -110,19 +111,12 @@ ColumnLayout {
text: modelData.title
color: DefaultStyle.main2_600
font: Typography.p1
leftPadding: Math.round(8 * DefaultStyle.dp)
leftPadding: Math.round(20 * DefaultStyle.dp)
wrapMode: Text.NoWrap
elide: Text.ElideRight
anchors.left: ico.right
}
indicator: Image {
id: ico
source: parent.checked ? AppIcons.radioOn : AppIcons.radioOff
width: Math.round(24 * DefaultStyle.dp)
height: Math.round(24 * DefaultStyle.dp)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
//visible: index < (model.count - 1)

View file

@ -157,7 +157,5 @@ QtObject {
property string pdf: "image://internal/pdf.svg"
property string photo: "image://internal/photo.svg"
property string ephemeralSettings: "image://internal/ephemeral-settings.svg"
property string radioOn: "image://internal/radio_on.svg"
property string radioOff: "image://internal/radio_off.svg"
property string hourglass: "image://internal/hourglass-simple.svg"
}

View file

@ -1,14 +1,18 @@
pragma Singleton
import QtQuick
import Linphone
import SettingsCpp
QtObject {
property color main1_100: "#FFEACB"
property color main1_200: "#FFD098"
property color main1_300: "#FFB266"
property color main1_500_main: "#FE5E00"
property color main1_600: "#DA4400"
property color main1_700: "#B72D00"
property var currentTheme: Themes.themes[SettingsCpp.themeMainColor]
property color main1_100: currentTheme.main100
property color main1_200: currentTheme.main200
property color main1_300: currentTheme.main300
property color main1_500_main: currentTheme.main500
property color main1_600: currentTheme.main600
property color main1_700: currentTheme.main700
property color main2_0: "#FAFEFF"
property color main2_100: "#EEF6F8"

View file

@ -0,0 +1,65 @@
pragma Singleton
import QtQuick
QtObject {
property var themes: {
return {
"orange": {
"main100": "#FFEACB",
"main200": "#FFD098",
"main300": "#FFB266",
"main500": "#FF5E00",
"main600": "#DA4400",
"main700": "#B72D00"
},
"yellow": {
"main100": "#FFF5D6",
"main200": "#FFEFB2",
"main300": "#FFE799",
"main500": "#F5BC00",
"main600": "#C69300",
"main700": "#A37D00"
},
"green": {
"main100": "#DCF9E7",
"main200": "#BDF0CF",
"main300": "#A8F0C2",
"main500": "#25D366",
"main600": "#1FA352",
"main700": "#1C9C4B"
},
"blue": {
"main100": "#D6F4FF",
"main200": "#B2E9FF",
"main300": "#99E4FF",
"main500": "#00AFF0",
"main600": "#008CC0",
"main700": "#0078A3"
},
"red": {
"main100": "#FBE1DA",
"main200": "#F8C1B6",
"main300": "#F5B53A",
"main500": "#E14318",
"main600": "#C23814",
"main700": "#A63211"
},
"pink": {
"main100": "#FFD6F1",
"main200": "#FFB8E8",
"main300": "#FF99DD",
"main500": "#FF00A9",
"main600": "#D60090",
"main700": "#B8007A"
},
"purple": {
"main100": "#FFD6FF",
"main200": "#F0B3F0",
"main300": "#FF99FF",
"main500": "#800080",
"main600": "#660066",
"main700": "#520052"
}
}
}
}