fix: ensure tokens are not bound multiple times
This commit is contained in:
parent
f15b234753
commit
08cc492698
2 changed files with 6 additions and 0 deletions
|
|
@ -80,6 +80,9 @@ GlobalConfig* GlobalConfig::instance() {
|
|||
}
|
||||
|
||||
void GlobalConfig::bindAppearanceTokens() {
|
||||
if (m_tokensBound)
|
||||
return;
|
||||
|
||||
auto* tokens = TokenConfig::instance();
|
||||
if (!tokens) {
|
||||
qCDebug(lcConfig) << "GlobalConfig::bindAppearanceTokens: TokenConfig not yet available";
|
||||
|
|
@ -93,6 +96,7 @@ void GlobalConfig::bindAppearanceTokens() {
|
|||
m_appearance->padding()->bindTokens(tokenAppearance->padding());
|
||||
m_appearance->font()->size()->bindTokens(tokenAppearance->fontSize());
|
||||
m_appearance->anim()->durations()->bindTokens(tokenAppearance->animDurations());
|
||||
m_tokensBound = true;
|
||||
}
|
||||
|
||||
GlobalConfig* GlobalConfig::create(QQmlEngine* engine, QJSEngine* jsEngine) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ private:
|
|||
friend class MonitorConfigManager;
|
||||
explicit GlobalConfig(QObject* parent = nullptr);
|
||||
explicit GlobalConfig(GlobalConfig* fallback, const QString& filePath, QObject* parent);
|
||||
|
||||
bool m_tokensBound = false;
|
||||
};
|
||||
|
||||
class ConfigScope;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue