aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/universal
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-08-19 15:53:15 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-08-19 14:11:57 +0000
commit47f32f2f768edbaa96c9356f0b2b4cb4f566b814 (patch)
treea69acb6c0ff62ecfb48ed612918d5c8440484e93 /src/imports/controls/universal
parentacf84ce9f386f7e8ab0ecea03a8247ce97c363a1 (diff)
Universal: rename DefaultX variables to GlobalX
For example, DefaultAccent will become GlobalAccent. This better reflects the reality that these are not true defaults because they can be overridden by settings and makes it easier to read the code. Change-Id: I2a7afa3ec8fd6db620d054b6e1f6860b2d3e1d02 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/controls/universal')
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index f4ec1fe7..51776fbd 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -132,15 +132,15 @@ static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Color accent)
return colors[accent];
}
-static QQuickUniversalStyle::Theme DefaultTheme = QQuickUniversalStyle::Light;
-static QRgb DefaultAccent = qquickuniversal_accent_color(QQuickUniversalStyle::Cobalt);
-static QRgb DefaultForeground = qquickuniversal_light_color(QQuickUniversalStyle::BaseHigh);
-static QRgb DefaultBackground = qquickuniversal_light_color(QQuickUniversalStyle::AltHigh);
+static QQuickUniversalStyle::Theme GlobalTheme = QQuickUniversalStyle::Light;
+static QRgb GlobalAccent = qquickuniversal_accent_color(QQuickUniversalStyle::Cobalt);
+static QRgb GlobalForeground = qquickuniversal_light_color(QQuickUniversalStyle::BaseHigh);
+static QRgb GlobalBackground = qquickuniversal_light_color(QQuickUniversalStyle::AltHigh);
QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QQuickStyleAttached(parent),
m_explicitTheme(false), m_explicitAccent(false), m_explicitForeground(false), m_explicitBackground(false),
- m_hasForeground(false), m_hasBackground(false), m_theme(DefaultTheme),
- m_accent(DefaultAccent), m_foreground(DefaultForeground), m_background(DefaultBackground)
+ m_hasForeground(false), m_hasBackground(false), m_theme(GlobalTheme),
+ m_accent(GlobalAccent), m_foreground(GlobalForeground), m_background(GlobalBackground)
{
init();
}
@@ -199,7 +199,7 @@ void QQuickUniversalStyle::resetTheme()
m_explicitTheme = false;
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritTheme(universal ? universal->theme() : DefaultTheme);
+ inheritTheme(universal ? universal->theme() : GlobalTheme);
}
QVariant QQuickUniversalStyle::accent() const
@@ -249,7 +249,7 @@ void QQuickUniversalStyle::resetAccent()
m_explicitAccent = false;
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritAccent(universal ? universal->m_accent : DefaultAccent);
+ inheritAccent(universal ? universal->m_accent : GlobalAccent);
}
QVariant QQuickUniversalStyle::foreground() const
@@ -304,7 +304,7 @@ void QQuickUniversalStyle::resetForeground()
m_hasForeground = false;
m_explicitForeground = false;
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritForeground(universal ? universal->m_foreground : DefaultForeground, universal ? universal->m_hasForeground : false);
+ inheritForeground(universal ? universal->m_foreground : GlobalForeground, universal ? universal->m_hasForeground : false);
}
QVariant QQuickUniversalStyle::background() const
@@ -359,7 +359,7 @@ void QQuickUniversalStyle::resetBackground()
m_hasBackground = false;
m_explicitBackground = false;
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritBackground(universal ? universal->m_background : DefaultBackground, universal ? universal->m_hasBackground : false);
+ inheritBackground(universal ? universal->m_background : GlobalBackground, universal ? universal->m_hasBackground : false);
}
QColor QQuickUniversalStyle::color(Color color) const
@@ -521,26 +521,26 @@ static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSe
void QQuickUniversalStyle::init()
{
- static bool defaultsInitialized = false;
- if (!defaultsInitialized) {
+ static bool globalsInitialized = false;
+ if (!globalsInitialized) {
QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Universal"));
bool ok = false;
QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_THEME", settings, QStringLiteral("Theme"));
Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
if (ok)
- DefaultTheme = m_theme = themeEnum;
+ GlobalTheme = m_theme = themeEnum;
else if (!themeValue.isEmpty())
qWarning().nospace().noquote() << "Universal: unknown theme value: " << themeValue;
QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_ACCENT", settings, QStringLiteral("Accent"));
Color accentEnum = toEnumValue<Color>(accentValue, &ok);
if (ok) {
- DefaultAccent = m_accent = qquickuniversal_accent_color(accentEnum);
+ GlobalAccent = m_accent = qquickuniversal_accent_color(accentEnum);
} else if (!accentValue.isEmpty()) {
QColor color(accentValue.constData());
if (color.isValid())
- DefaultAccent = m_accent = color.rgba();
+ GlobalAccent = m_accent = color.rgba();
else
qWarning().nospace().noquote() << "Universal: unknown accent value: " << accentValue;
}
@@ -548,11 +548,11 @@ void QQuickUniversalStyle::init()
QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND", settings, QStringLiteral("Foreground"));
Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
if (ok) {
- DefaultForeground = m_foreground = qquickuniversal_accent_color(foregroundEnum);
+ GlobalForeground = m_foreground = qquickuniversal_accent_color(foregroundEnum);
} else if (!foregroundValue.isEmpty()) {
QColor color(foregroundValue.constData());
if (color.isValid())
- DefaultForeground = m_foreground = color.rgba();
+ GlobalForeground = m_foreground = color.rgba();
else
qWarning().nospace().noquote() << "Universal: unknown foreground value: " << foregroundValue;
}
@@ -560,16 +560,16 @@ void QQuickUniversalStyle::init()
QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND", settings, QStringLiteral("Background"));
Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
if (ok) {
- DefaultBackground = m_background = qquickuniversal_accent_color(backgroundEnum);
+ GlobalBackground = m_background = qquickuniversal_accent_color(backgroundEnum);
} else if (!backgroundValue.isEmpty()) {
QColor color(backgroundValue.constData());
if (color.isValid())
- DefaultBackground = m_background = color.rgba();
+ GlobalBackground = m_background = color.rgba();
else
qWarning().nospace().noquote() << "Universal: unknown background value: " << backgroundValue;
}
- defaultsInitialized = true;
+ globalsInitialized = true;
}
QQuickStyleAttached::init(); // TODO: lazy init?