refactor: move inline getter impls to cpp file
This commit is contained in:
parent
e16a70bee7
commit
129b063381
12 changed files with 95 additions and 33 deletions
|
|
@ -9,6 +9,46 @@ namespace caelestia::config {
|
|||
AnimTokens::AnimTokens(QObject* parent)
|
||||
: QObject(parent) {}
|
||||
|
||||
QEasingCurve AnimTokens::emphasized() const {
|
||||
return m_emphasized;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::emphasizedAccel() const {
|
||||
return m_emphasizedAccel;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::emphasizedDecel() const {
|
||||
return m_emphasizedDecel;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::standard() const {
|
||||
return m_standard;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::standardAccel() const {
|
||||
return m_standardAccel;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::standardDecel() const {
|
||||
return m_standardDecel;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::expressiveFastSpatial() const {
|
||||
return m_expressiveFastSpatial;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::expressiveDefaultSpatial() const {
|
||||
return m_expressiveDefaultSpatial;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::expressiveSlowSpatial() const {
|
||||
return m_expressiveSlowSpatial;
|
||||
}
|
||||
|
||||
AnimDurations* AnimTokens::durations() const {
|
||||
return m_durations;
|
||||
}
|
||||
|
||||
QEasingCurve AnimTokens::buildCurve(const QList<qreal>& points) {
|
||||
QEasingCurve curve(QEasingCurve::BezierSpline);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,25 +33,16 @@ public:
|
|||
void bindCurves(AnimCurves* curves);
|
||||
void bindDurations(AnimDurations* durations);
|
||||
|
||||
[[nodiscard]] QEasingCurve emphasized() const { return m_emphasized; }
|
||||
|
||||
[[nodiscard]] QEasingCurve emphasizedAccel() const { return m_emphasizedAccel; }
|
||||
|
||||
[[nodiscard]] QEasingCurve emphasizedDecel() const { return m_emphasizedDecel; }
|
||||
|
||||
[[nodiscard]] QEasingCurve standard() const { return m_standard; }
|
||||
|
||||
[[nodiscard]] QEasingCurve standardAccel() const { return m_standardAccel; }
|
||||
|
||||
[[nodiscard]] QEasingCurve standardDecel() const { return m_standardDecel; }
|
||||
|
||||
[[nodiscard]] QEasingCurve expressiveFastSpatial() const { return m_expressiveFastSpatial; }
|
||||
|
||||
[[nodiscard]] QEasingCurve expressiveDefaultSpatial() const { return m_expressiveDefaultSpatial; }
|
||||
|
||||
[[nodiscard]] QEasingCurve expressiveSlowSpatial() const { return m_expressiveSlowSpatial; }
|
||||
|
||||
[[nodiscard]] AnimDurations* durations() const { return m_durations; }
|
||||
[[nodiscard]] QEasingCurve emphasized() const;
|
||||
[[nodiscard]] QEasingCurve emphasizedAccel() const;
|
||||
[[nodiscard]] QEasingCurve emphasizedDecel() const;
|
||||
[[nodiscard]] QEasingCurve standard() const;
|
||||
[[nodiscard]] QEasingCurve standardAccel() const;
|
||||
[[nodiscard]] QEasingCurve standardDecel() const;
|
||||
[[nodiscard]] QEasingCurve expressiveFastSpatial() const;
|
||||
[[nodiscard]] QEasingCurve expressiveDefaultSpatial() const;
|
||||
[[nodiscard]] QEasingCurve expressiveSlowSpatial() const;
|
||||
[[nodiscard]] AnimDurations* durations() const;
|
||||
|
||||
signals:
|
||||
void curvesChanged();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ Config::Config(ConfigScope* scope, QObject* parent)
|
|||
connectScope();
|
||||
}
|
||||
|
||||
ConfigScope* Config::scope() const {
|
||||
return m_scope;
|
||||
}
|
||||
|
||||
void Config::connectScope() {
|
||||
if (!m_scope)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Config : public QObject {
|
|||
public:
|
||||
explicit Config(ConfigScope* scope, QObject* parent = nullptr);
|
||||
|
||||
[[nodiscard]] ConfigScope* scope() const { return m_scope; }
|
||||
[[nodiscard]] ConfigScope* scope() const;
|
||||
|
||||
[[nodiscard]] const AppearanceConfig* appearance() const;
|
||||
[[nodiscard]] const GeneralConfig* general() const;
|
||||
|
|
|
|||
|
|
@ -198,6 +198,18 @@ void ConfigObject::resyncFromGlobal() {
|
|||
}
|
||||
}
|
||||
|
||||
bool ConfigObject::isPropertyLoaded(const QString& name) const {
|
||||
return m_loadedKeys.contains(name);
|
||||
}
|
||||
|
||||
bool ConfigObject::isOverlay() const {
|
||||
return m_global != nullptr;
|
||||
}
|
||||
|
||||
bool ConfigObject::isGlobalOnly(const QString& name) const {
|
||||
return m_globalOnlyKeys.contains(name);
|
||||
}
|
||||
|
||||
void ConfigObject::markPropertyLoaded(const QString& name) {
|
||||
m_loadedKeys.insert(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,11 +87,9 @@ public:
|
|||
void resyncFromGlobal();
|
||||
void clearLoadedKeys();
|
||||
|
||||
[[nodiscard]] bool isPropertyLoaded(const QString& name) const { return m_loadedKeys.contains(name); }
|
||||
|
||||
[[nodiscard]] bool isOverlay() const { return m_global != nullptr; }
|
||||
|
||||
[[nodiscard]] bool isGlobalOnly(const QString& name) const { return m_globalOnlyKeys.contains(name); }
|
||||
[[nodiscard]] bool isPropertyLoaded(const QString& name) const;
|
||||
[[nodiscard]] bool isOverlay() const;
|
||||
[[nodiscard]] bool isGlobalOnly(const QString& name) const;
|
||||
|
||||
Q_INVOKABLE void resetOption(const QString& name);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,18 @@ namespace caelestia::config {
|
|||
ConfigScope::ConfigScope(QQuickItem* parent)
|
||||
: QQuickItem(parent) {}
|
||||
|
||||
QString ConfigScope::screen() const {
|
||||
return m_screen;
|
||||
}
|
||||
|
||||
GlobalConfig* ConfigScope::config() const {
|
||||
return m_config;
|
||||
}
|
||||
|
||||
TokenConfig* ConfigScope::tokens() const {
|
||||
return m_tokens;
|
||||
}
|
||||
|
||||
void ConfigScope::setScreen(const QString& screen) {
|
||||
if (m_screen == screen)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -21,13 +21,11 @@ class ConfigScope : public QQuickItem {
|
|||
public:
|
||||
explicit ConfigScope(QQuickItem* parent = nullptr);
|
||||
|
||||
[[nodiscard]] QString screen() const { return m_screen; }
|
||||
|
||||
[[nodiscard]] QString screen() const;
|
||||
void setScreen(const QString& screen);
|
||||
|
||||
[[nodiscard]] GlobalConfig* config() const { return m_config; }
|
||||
|
||||
[[nodiscard]] TokenConfig* tokens() const { return m_tokens; }
|
||||
[[nodiscard]] GlobalConfig* config() const;
|
||||
[[nodiscard]] TokenConfig* tokens() const;
|
||||
|
||||
static ConfigScope* find(QObject* object);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ QString watchRoot() {
|
|||
RootConfig::RootConfig(QObject* parent)
|
||||
: ConfigObject(parent) {}
|
||||
|
||||
bool RootConfig::recentlySaved() const {
|
||||
return m_recentlySaved;
|
||||
}
|
||||
|
||||
QStringList RootConfig::collectUnknownKeys(const ConfigObject* obj, const QJsonObject& json) {
|
||||
QStringList unknown;
|
||||
const auto* meta = obj->metaObject();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
// Returns nullopt if retrying, empty string on success, error message on failure.
|
||||
[[nodiscard]] std::optional<QString> reloadFromFile();
|
||||
|
||||
[[nodiscard]] bool recentlySaved() const { return m_recentlySaved; }
|
||||
[[nodiscard]] bool recentlySaved() const;
|
||||
|
||||
Q_INVOKABLE void save();
|
||||
Q_INVOKABLE void reload();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ const SizeTokens* Tokens::sizes() const {
|
|||
return TokenConfig::instance()->sizes();
|
||||
}
|
||||
|
||||
const AnimTokens* Tokens::anim() const {
|
||||
return m_anim;
|
||||
}
|
||||
|
||||
TokenConfig* Tokens::forScreen(const QString& screen) {
|
||||
return TokenConfig::forScreen(screen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ public:
|
|||
[[nodiscard]] const AppearanceTransparency* transparency() const;
|
||||
|
||||
[[nodiscard]] const SizeTokens* sizes() const;
|
||||
|
||||
[[nodiscard]] const AnimTokens* anim() const { return m_anim; }
|
||||
[[nodiscard]] const AnimTokens* anim() const;
|
||||
|
||||
[[nodiscard]] Q_INVOKABLE static TokenConfig* forScreen(const QString& screen);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue