more unfinished changes, process tab for dashboard
This commit is contained in:
+138
-182
@@ -1,205 +1,161 @@
|
||||
#pragma once
|
||||
|
||||
#include "configobject.hpp"
|
||||
#include "anim.hpp"
|
||||
#include "appearance.hpp"
|
||||
#include "config.hpp"
|
||||
#include "font.hpp"
|
||||
|
||||
#include <QVariantList>
|
||||
#include <limits>
|
||||
#include <qlist.h>
|
||||
#include <qobject.h>
|
||||
#include <qqmlengine.h>
|
||||
#include <qqmlintegration.h>
|
||||
#include <qqmlregistration.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "settings/objectnode.hpp"
|
||||
#include "anim.hpp"
|
||||
#include "common.hpp"
|
||||
#include "font.hpp"
|
||||
|
||||
namespace ZShell::config {
|
||||
|
||||
class AnimCurves : public ConfigObject {
|
||||
Q_OBJECT
|
||||
QML_ANONYMOUS
|
||||
class AnimCurves : public settings::ObjectNode {
|
||||
CONFIG_NODE(AnimCurves, settings::ObjectNode)
|
||||
|
||||
CFG_PROPERTY(QList<qreal>, emphasized)
|
||||
CFG_PROPERTY(QList<qreal>, emphasizedAccel)
|
||||
CFG_PROPERTY(QList<qreal>, emphasizedDecel)
|
||||
CFG_PROPERTY(QList<qreal>, standard)
|
||||
CFG_PROPERTY(QList<qreal>, standardAccel)
|
||||
CFG_PROPERTY(QList<qreal>, standardDecel)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveFastSpatial)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveDefaultSpatial)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveSlowSpatial)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveFastEffects)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveDefaultEffects)
|
||||
CFG_PROPERTY(QList<qreal>, expressiveSlowEffects)
|
||||
|
||||
public:
|
||||
explicit AnimCurves(QObject* parent = nullptr)
|
||||
: ConfigObject(parent)
|
||||
, m_emphasized(
|
||||
{0.05,
|
||||
0,
|
||||
2.0 / 15.0,
|
||||
0.06,
|
||||
1.0 / 6.0,
|
||||
0.4,
|
||||
5.0 / 24.0,
|
||||
0.82,
|
||||
0.25,
|
||||
1,
|
||||
1,
|
||||
1})
|
||||
, m_emphasizedAccel({0.3, 0, 0.8, 0.15, 1, 1})
|
||||
, m_emphasizedDecel({0.05, 0.7, 0.1, 1, 1, 1})
|
||||
, m_standard({0.2, 0, 0, 1, 1, 1})
|
||||
, m_standardAccel({0.3, 0, 1, 1, 1, 1})
|
||||
, m_standardDecel({0, 0, 0, 1, 1, 1})
|
||||
, m_expressiveFastSpatial({0.42, 1.67, 0.21, 0.9, 1, 1})
|
||||
, m_expressiveDefaultSpatial({0.38, 1.21, 0.22, 1, 1, 1})
|
||||
, m_expressiveSlowSpatial({0.39, 1.29, 0.35, 0.98, 1, 1})
|
||||
, m_expressiveFastEffects({0.31, 0.94, 0.34, 1, 1, 1})
|
||||
, m_expressiveDefaultEffects({0.34, 0.8, 0.34, 1, 1, 1})
|
||||
, m_expressiveSlowEffects({0.34, 0.88, 0.34, 1, 1, 1}) {}
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
emphasized,
|
||||
DEFAULT_ARG(
|
||||
{0.05,
|
||||
0,
|
||||
2.0 / 15.0,
|
||||
0.06,
|
||||
1.0 / 6.0,
|
||||
0.4,
|
||||
5.0 / 24.0,
|
||||
0.82,
|
||||
0.25,
|
||||
1,
|
||||
1,
|
||||
1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>, emphasizedAccel, DEFAULT_ARG({0.3, 0, 0.8, 0.15, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>, emphasizedDecel, DEFAULT_ARG({0.05, 0.7, 0.1, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>, standard, DEFAULT_ARG({0.2, 0, 0, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>, standardAccel, DEFAULT_ARG({0.3, 0, 1, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>, standardDecel, DEFAULT_ARG({0, 0, 0, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveFastSpatial,
|
||||
DEFAULT_ARG({0.42, 1.67, 0.21, 0.9, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveDefaultSpatial,
|
||||
DEFAULT_ARG({0.38, 1.21, 0.22, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveSlowSpatial,
|
||||
DEFAULT_ARG({0.39, 1.29, 0.35, 0.98, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveFastEffects,
|
||||
DEFAULT_ARG({0.31, 0.94, 0.34, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveDefaultEffects,
|
||||
DEFAULT_ARG({0.34, 0.8, 0.34, 1, 1, 1}))
|
||||
CONFIG_GLOBAL_PROPERTY(
|
||||
QList<qreal>,
|
||||
expressiveSlowEffects,
|
||||
DEFAULT_ARG({0.34, 0.88, 0.34, 1, 1, 1}))
|
||||
};
|
||||
|
||||
class AnimTokens : public ConfigObject {
|
||||
Q_OBJECT
|
||||
QML_ANONYMOUS
|
||||
class RoundingTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(RoundingTokens, settings::ObjectNode)
|
||||
|
||||
Q_PROPERTY(ZShell::config::AnimDurations* durations READ durations CONSTANT)
|
||||
|
||||
Q_PROPERTY(QEasingCurve emphasized READ emphasized NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve emphasizedAccel READ emphasizedAccel NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve emphasizedDecel READ emphasizedDecel NOTIFY curvesChanged)
|
||||
Q_PROPERTY(QEasingCurve standard READ standard NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve standardAccel READ standardAccel NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve standardDecel READ standardDecel NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveFastSpatial READ expressiveFastSpatial NOTIFY
|
||||
curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveDefaultSpatial READ expressiveDefaultSpatial
|
||||
NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveSlowSpatial READ expressiveSlowSpatial NOTIFY
|
||||
curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveFastEffects READ expressiveFastEffects NOTIFY
|
||||
curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveDefaultEffects READ expressiveDefaultEffects
|
||||
NOTIFY curvesChanged)
|
||||
Q_PROPERTY(
|
||||
QEasingCurve expressiveSlowEffects READ expressiveSlowEffects NOTIFY
|
||||
curvesChanged)
|
||||
|
||||
public:
|
||||
explicit AnimTokens(QObject* parent = nullptr)
|
||||
: ConfigObject(parent)
|
||||
, m_curves(new AnimCurves(this))
|
||||
, m_easing(new AnimEasing(this)) {
|
||||
connect(
|
||||
m_easing,
|
||||
&AnimEasing::curvesChanged,
|
||||
this,
|
||||
&AnimTokens::curvesChanged);
|
||||
m_easing->bindCurves(m_curves);
|
||||
}
|
||||
|
||||
[[nodiscard]] AnimDurations* durations() const {
|
||||
return Config::instance()->appearance()->anim()->durations();
|
||||
}
|
||||
|
||||
[[nodiscard]] QEasingCurve emphasized() const {
|
||||
return m_easing->emphasized();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve emphasizedAccel() const {
|
||||
return m_easing->emphasizedAccel();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve emphasizedDecel() const {
|
||||
return m_easing->emphasizedDecel();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve standard() const { return m_easing->standard(); }
|
||||
[[nodiscard]] QEasingCurve standardAccel() const {
|
||||
return m_easing->standardAccel();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve standardDecel() const {
|
||||
return m_easing->standardDecel();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveFastSpatial() const {
|
||||
return m_easing->expressiveFastSpatial();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveDefaultSpatial() const {
|
||||
return m_easing->expressiveDefaultSpatial();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveSlowSpatial() const {
|
||||
return m_easing->expressiveSlowSpatial();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveFastEffects() const {
|
||||
return m_easing->expressiveFastEffects();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveDefaultEffects() const {
|
||||
return m_easing->expressiveDefaultEffects();
|
||||
}
|
||||
[[nodiscard]] QEasingCurve expressiveSlowEffects() const {
|
||||
return m_easing->expressiveSlowEffects();
|
||||
}
|
||||
|
||||
signals:
|
||||
void curvesChanged();
|
||||
|
||||
private:
|
||||
AnimCurves* m_curves;
|
||||
AnimEasing* m_easing;
|
||||
CONFIG_PROPERTY(int, extraSmall, 4)
|
||||
CONFIG_PROPERTY(int, small, 8)
|
||||
CONFIG_PROPERTY(int, medium, 12)
|
||||
CONFIG_PROPERTY(int, large, 16)
|
||||
CONFIG_PROPERTY(int, largeIncreased, 20)
|
||||
CONFIG_PROPERTY(int, extraLarge, 28)
|
||||
CONFIG_PROPERTY(int, extraLargeIncreased, 32)
|
||||
CONFIG_PROPERTY(int, extraExtraLarge, 48)
|
||||
CONFIG_PROPERTY(int, full, std::numeric_limits<int>::max())
|
||||
};
|
||||
|
||||
class BarTokens : public ConfigObject {
|
||||
Q_OBJECT
|
||||
QML_ANONYMOUS
|
||||
class SpacingTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(SpacingTokens, settings::ObjectNode)
|
||||
|
||||
CFG_PROPERTY(int, innerSize, 28)
|
||||
|
||||
public:
|
||||
explicit BarTokens(QObject* parent = nullptr) : ConfigObject(parent) {}
|
||||
CONFIG_PROPERTY(int, extraSmall, 4)
|
||||
CONFIG_PROPERTY(int, small, 8)
|
||||
CONFIG_PROPERTY(int, medium, 12)
|
||||
CONFIG_PROPERTY(int, large, 16)
|
||||
CONFIG_PROPERTY(int, largeIncreased, 20)
|
||||
CONFIG_PROPERTY(int, extraLarge, 28)
|
||||
CONFIG_PROPERTY(int, extraLargeIncreased, 32)
|
||||
CONFIG_PROPERTY(int, extraExtraLarge, 48)
|
||||
};
|
||||
|
||||
class Tokens : public ConfigObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
class PaddingTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(PaddingTokens, settings::ObjectNode)
|
||||
|
||||
Q_PROPERTY(
|
||||
ZShell::config::AppearanceRounding* rounding READ rounding CONSTANT)
|
||||
Q_PROPERTY(ZShell::config::AppearancePadding* padding READ padding CONSTANT)
|
||||
Q_PROPERTY(ZShell::config::AppearanceSpacing* spacing READ spacing CONSTANT)
|
||||
CONFIG_SUBOBJECT(FontTokens, font)
|
||||
CONFIG_SUBOBJECT(AnimTokens, anim)
|
||||
CONFIG_PROPERTY(int, extraSmall, 4)
|
||||
CONFIG_PROPERTY(int, smaller, 5)
|
||||
CONFIG_PROPERTY(int, small, 8)
|
||||
CONFIG_PROPERTY(int, medium, 12)
|
||||
CONFIG_PROPERTY(int, large, 16)
|
||||
CONFIG_PROPERTY(int, largeIncreased, 20)
|
||||
CONFIG_PROPERTY(int, extraLarge, 28)
|
||||
CONFIG_PROPERTY(int, extraLargeIncreased, 32)
|
||||
CONFIG_PROPERTY(int, extraExtraLarge, 48)
|
||||
};
|
||||
|
||||
class AnimDurationTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(AnimDurationTokens, settings::ObjectNode)
|
||||
|
||||
CONFIG_GLOBAL_PROPERTY(int, small, 200)
|
||||
CONFIG_GLOBAL_PROPERTY(int, normal, 400)
|
||||
CONFIG_GLOBAL_PROPERTY(int, large, 600)
|
||||
CONFIG_GLOBAL_PROPERTY(int, extraLarge, 1000)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveFastSpatial, 350)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveDefaultSpatial, 500)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveSlowSpatial, 650)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveFastEffects, 150)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveDefaultEffects, 200)
|
||||
CONFIG_GLOBAL_PROPERTY(int, expressiveSlowEffects, 300)
|
||||
};
|
||||
|
||||
class AppearanceTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(AppearanceTokens, settings::ObjectNode)
|
||||
|
||||
CONFIG_SUBOBJECT(AnimCurves, curves)
|
||||
CONFIG_SUBOBJECT(RoundingTokens, rounding)
|
||||
CONFIG_SUBOBJECT(SpacingTokens, spacing)
|
||||
CONFIG_SUBOBJECT(PaddingTokens, padding)
|
||||
CONFIG_SUBOBJECT(AnimDurationTokens, animDurations)
|
||||
};
|
||||
|
||||
class BarTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(BarTokens, settings::ObjectNode)
|
||||
|
||||
CONFIG_PROPERTY(int, innerSize, 28)
|
||||
};
|
||||
|
||||
class DashboardTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(DashboardTokens, settings::ObjectNode)
|
||||
|
||||
CONFIG_PROPERTY(int, processesWidth, 1200)
|
||||
CONFIG_PROPERTY(int, processesHeight, 800)
|
||||
CONFIG_PROPERTY(int, processesHeaderHeight, 40)
|
||||
CONFIG_PROPERTY(int, processesRowHeight, 40)
|
||||
};
|
||||
|
||||
class SizeTokens : public settings::ObjectNode {
|
||||
CONFIG_NODE(SizeTokens, settings::ObjectNode)
|
||||
|
||||
CONFIG_SUBOBJECT(DashboardTokens, dashboard)
|
||||
CONFIG_SUBOBJECT(BarTokens, bar)
|
||||
|
||||
public:
|
||||
explicit Tokens(QObject* parent = nullptr)
|
||||
: ConfigObject(parent)
|
||||
, m_font(new FontTokens(this))
|
||||
, m_anim(new AnimTokens(this))
|
||||
, m_bar(new BarTokens(this)) {
|
||||
if (!Config::instance()) new Config();
|
||||
}
|
||||
|
||||
[[nodiscard]] AppearanceRounding* rounding() const {
|
||||
return Config::instance()->appearance()->rounding();
|
||||
}
|
||||
[[nodiscard]] AppearancePadding* padding() const {
|
||||
return Config::instance()->appearance()->padding();
|
||||
}
|
||||
[[nodiscard]] AppearanceSpacing* spacing() const {
|
||||
return Config::instance()->appearance()->spacing();
|
||||
}
|
||||
|
||||
static Tokens* create(QQmlEngine*, QJSEngine*) { return new Tokens(); }
|
||||
};
|
||||
|
||||
} // namespace ZShell::config
|
||||
|
||||
Reference in New Issue
Block a user