6#include <PhosphorShaders/phosphorshaders_export.h>
44 "ShaderFamilyCount must match the number of ShaderFamily enumerators");
69template<
typename ParameterList>
73 for (
const auto& parameter : parameters) {
74 if (parameter.minValue.isValid() || parameter.maxValue.isValid()) {
75 bounds.insert(parameter.id,
PresetValueRange(parameter.minValue, parameter.maxValue));
165 return !
id.isEmpty() && !
packId.isEmpty();
183 return !(*
this == other);
196PHOSPHORSHADERS_EXPORT QVariantMap
overlayPresetDeltas(
const QVariantMap& base,
const QVariantMap& deltas);
Definition ShaderProfile.h:21
PresetValueBounds presetBoundsFrom(const ParameterList ¶meters)
Collect PresetValueBounds from any family's declared parameter list.
Definition ShaderPreset.h:70
ShaderFamily
Which shader family a preset belongs to.
Definition ShaderPreset.h:28
@ Pointer
Definition ShaderPreset.h:31
@ Overlay
Definition ShaderPreset.h:32
@ Surface
Definition ShaderPreset.h:30
@ Animation
Definition ShaderPreset.h:29
QPair< QVariant, QVariant > PresetValueRange
A pack's declared numeric range for one parameter: { min, max }, either of which may be an invalid QV...
Definition ShaderPreset.h:51
PHOSPHORSHADERS_EXPORT QVariantMap overlayPresetDeltas(const QVariantMap &base, const QVariantMap &deltas)
Overlay deltas onto base and return the result — the one definition of how a preset and an assignment...
constexpr std::size_t ShaderFamilyCount
How many families there are, for the one-slot-per-family arrays that index by static_cast<std::size_t...
Definition ShaderPreset.h:42
PHOSPHORSHADERS_EXPORT QLatin1StringView shaderFamilyToken(ShaderFamily family)
Wire token for family: "animation" / "surface" / "pointer" / "overlay".
QHash< QString, PresetValueRange > PresetValueBounds
The declared ranges for a pack's parameters, by parameter id.
Definition ShaderPreset.h:61
One named parameter tuning for one shader pack.
Definition ShaderPreset.h:98
QString name
Display name.
Definition ShaderPreset.h:111
QString packId
The pack this preset tunes.
Definition ShaderPreset.h:115
bool operator!=(const ShaderPreset &other) const
Definition ShaderPreset.h:181
QJsonObject toJson() const
Serialise a USER preset.
QVariantMap params
The tuning itself: { paramId -> value }.
Definition ShaderPreset.h:120
static bool isUsableId(const QString &id)
Whether id is safe to use as both an identity and a path component.
static constexpr qsizetype MaxIdChars
Longest id isUsableId accepts.
Definition ShaderPreset.h:138
static ShaderPreset fromJson(const QJsonObject &obj, const QString &fallbackId=QString())
Parse a user preset file body.
static constexpr qsizetype MaxValueChars
Longest string VALUE kept in a preset's parameter map (an image path or a colour literal).
Definition ShaderPreset.h:153
static constexpr qsizetype MaxNameChars
Longest display name fromJson keeps, matching the cap the settings app's rename dialog applies to a t...
Definition ShaderPreset.h:134
bool isValid() const
Definition ShaderPreset.h:163
bool readOnly
True for a pack-declared preset.
Definition ShaderPreset.h:125
QString sourcePath
Absolute path of the file backing a user preset.
Definition ShaderPreset.h:129
QString id
Stable id, MEANT to be unique within (family, packId) — the settings app mints a UUID for each user p...
Definition ShaderPreset.h:107
bool operator==(const ShaderPreset &other) const
static constexpr qsizetype MaxParams
Most parameter entries fromJson keeps, and the cap the settings bridge applies when it WRITES a prese...
Definition ShaderPreset.h:148