mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into yellow
This commit is contained in:
commit
fdf06ea819
5 changed files with 95 additions and 91 deletions
|
@ -37,7 +37,6 @@ void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness
|
||||||
_fragColor0 = vec4(albedo, mix(packShadedMetallic(metallic), packScatteringMetallic(metallic), check));
|
_fragColor0 = vec4(albedo, mix(packShadedMetallic(metallic), packScatteringMetallic(metallic), check));
|
||||||
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
||||||
_fragColor2 = vec4(mix(emissive, vec3(scattering), check), occlusion);
|
_fragColor2 = vec4(mix(emissive, vec3(scattering), check), occlusion);
|
||||||
|
|
||||||
_fragColor3 = vec4(isEmissiveEnabled() * emissive, 1.0);
|
_fragColor3 = vec4(isEmissiveEnabled() * emissive, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +48,6 @@ void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float r
|
||||||
_fragColor0 = vec4(albedo, packLightmappedMetallic(metallic));
|
_fragColor0 = vec4(albedo, packLightmappedMetallic(metallic));
|
||||||
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
||||||
_fragColor2 = vec4(isLightmapEnabled() * lightmap, 1.0);
|
_fragColor2 = vec4(isLightmapEnabled() * lightmap, 1.0);
|
||||||
|
|
||||||
_fragColor3 = vec4(isLightmapEnabled() * lightmap * albedo, 1.0);
|
_fragColor3 = vec4(isLightmapEnabled() * lightmap * albedo, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ void packDeferredFragmentUnlit(vec3 normal, float alpha, vec3 color) {
|
||||||
}
|
}
|
||||||
_fragColor0 = vec4(color, packUnlit());
|
_fragColor0 = vec4(color, packUnlit());
|
||||||
_fragColor1 = vec4(packNormal(normal), 1.0);
|
_fragColor1 = vec4(packNormal(normal), 1.0);
|
||||||
// _fragColor2 = vec4(vec3(0.0), 1.0);
|
_fragColor2 = vec4(vec3(0.0), 1.0);
|
||||||
_fragColor3 = vec4(color, 1.0);
|
_fragColor3 = vec4(color, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +67,8 @@ void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, floa
|
||||||
}
|
}
|
||||||
_fragColor0 = vec4(albedo.rgb, alpha);
|
_fragColor0 = vec4(albedo.rgb, alpha);
|
||||||
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
_fragColor1 = vec4(packNormal(normal), clamp(roughness, 0.0, 1.0));
|
||||||
|
_fragColor2 = vec4(vec3(0.0), 1.0);
|
||||||
|
_fragColor3 = vec4(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
<@endif@>
|
<@endif@>
|
||||||
|
|
|
@ -41,33 +41,17 @@ namespace gr {
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
struct LightLocations {
|
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& program);
|
||||||
bool shadowTransform{ false };
|
|
||||||
void initialize(const gpu::ShaderPointer& program) {
|
|
||||||
shadowTransform = program->getReflection().validUniformBuffer(ru::Buffer::ShadowParams);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& program, LightLocationsPtr& locations);
|
|
||||||
|
|
||||||
void DeferredLightingEffect::init() {
|
void DeferredLightingEffect::init() {
|
||||||
_directionalAmbientSphereLightLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::directional_ambient_light, false, _directionalAmbientSphereLight);
|
||||||
_directionalSkyboxLightLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::directional_skybox_light, false, _directionalSkyboxLight);
|
||||||
|
|
||||||
_directionalAmbientSphereLightShadowLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::directional_ambient_light_shadow, false, _directionalAmbientSphereLightShadow);
|
||||||
_directionalSkyboxLightShadowLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::directional_skybox_light_shadow, false, _directionalSkyboxLightShadow);
|
||||||
|
|
||||||
_localLightLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::local_lights_shading, true, _localLight);
|
||||||
_localLightOutlineLocations = std::make_shared<LightLocations>();
|
loadLightProgram(shader::render_utils::program::local_lights_drawOutline, true, _localLightOutline);
|
||||||
|
|
||||||
loadLightProgram(shader::render_utils::program::directional_ambient_light, false, _directionalAmbientSphereLight, _directionalAmbientSphereLightLocations);
|
|
||||||
loadLightProgram(shader::render_utils::program::directional_skybox_light, false, _directionalSkyboxLight, _directionalSkyboxLightLocations);
|
|
||||||
|
|
||||||
loadLightProgram(shader::render_utils::program::directional_ambient_light_shadow, false, _directionalAmbientSphereLightShadow, _directionalAmbientSphereLightShadowLocations);
|
|
||||||
loadLightProgram(shader::render_utils::program::directional_skybox_light_shadow, false, _directionalSkyboxLightShadow, _directionalSkyboxLightShadowLocations);
|
|
||||||
|
|
||||||
loadLightProgram(shader::render_utils::program::local_lights_shading, true, _localLight, _localLightLocations);
|
|
||||||
loadLightProgram(shader::render_utils::program::local_lights_drawOutline, true, _localLightOutline, _localLightOutlineLocations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: figure out how to move lightFrame into a varying in GeometryCache and RenderPipelines
|
// FIXME: figure out how to move lightFrame into a varying in GeometryCache and RenderPipelines
|
||||||
|
@ -123,15 +107,9 @@ void DeferredLightingEffect::unsetLocalLightsBatch(gpu::Batch& batch) {
|
||||||
batch.setUniformBuffer(ru::Buffer::LightClusterFrustumGrid, nullptr);
|
batch.setUniformBuffer(ru::Buffer::LightClusterFrustumGrid, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpu::ShaderPointer makeLightProgram(int programId, LightLocationsPtr& locations) {
|
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& pipeline) {
|
||||||
|
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(programId);
|
gpu::ShaderPointer program = gpu::Shader::createProgram(programId);
|
||||||
locations->initialize(program);
|
|
||||||
return program;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadLightProgram(int programId, bool lightVolume, gpu::PipelinePointer& pipeline, LightLocationsPtr& locations) {
|
|
||||||
|
|
||||||
gpu::ShaderPointer program = makeLightProgram(programId, locations);
|
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setColorWriteMask(true, true, true, false);
|
state->setColorWriteMask(true, true, true, false);
|
||||||
|
@ -456,7 +434,6 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
||||||
|
|
||||||
// Setup the global directional pass pipeline
|
// Setup the global directional pass pipeline
|
||||||
auto program = deferredLightingEffect->_directionalSkyboxLight;
|
auto program = deferredLightingEffect->_directionalSkyboxLight;
|
||||||
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
|
|
||||||
{
|
{
|
||||||
if (keyLightCastShadows) {
|
if (keyLightCastShadows) {
|
||||||
|
|
||||||
|
@ -464,20 +441,16 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
||||||
// otherwise use the ambient sphere version
|
// otherwise use the ambient sphere version
|
||||||
if (hasAmbientMap) {
|
if (hasAmbientMap) {
|
||||||
program = deferredLightingEffect->_directionalSkyboxLightShadow;
|
program = deferredLightingEffect->_directionalSkyboxLightShadow;
|
||||||
locations = deferredLightingEffect->_directionalSkyboxLightShadowLocations;
|
|
||||||
} else {
|
} else {
|
||||||
program = deferredLightingEffect->_directionalAmbientSphereLightShadow;
|
program = deferredLightingEffect->_directionalAmbientSphereLightShadow;
|
||||||
locations = deferredLightingEffect->_directionalAmbientSphereLightShadowLocations;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the keylight has an ambient Map then use the Skybox version of the pass
|
// If the keylight has an ambient Map then use the Skybox version of the pass
|
||||||
// otherwise use the ambient sphere version
|
// otherwise use the ambient sphere version
|
||||||
if (hasAmbientMap) {
|
if (hasAmbientMap) {
|
||||||
program = deferredLightingEffect->_directionalSkyboxLight;
|
program = deferredLightingEffect->_directionalSkyboxLight;
|
||||||
locations = deferredLightingEffect->_directionalSkyboxLightLocations;
|
|
||||||
} else {
|
} else {
|
||||||
program = deferredLightingEffect->_directionalAmbientSphereLight;
|
program = deferredLightingEffect->_directionalAmbientSphereLight;
|
||||||
locations = deferredLightingEffect->_directionalAmbientSphereLightLocations;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,6 @@
|
||||||
#include "SubsurfaceScattering.h"
|
#include "SubsurfaceScattering.h"
|
||||||
#include "AmbientOcclusionEffect.h"
|
#include "AmbientOcclusionEffect.h"
|
||||||
|
|
||||||
|
|
||||||
struct LightLocations;
|
|
||||||
using LightLocationsPtr = std::shared_ptr<LightLocations>;
|
|
||||||
|
|
||||||
// THis is where we currently accumulate the local lights, let s change that sooner than later
|
// THis is where we currently accumulate the local lights, let s change that sooner than later
|
||||||
class DeferredLightingEffect : public Dependency {
|
class DeferredLightingEffect : public Dependency {
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
@ -72,15 +68,6 @@ private:
|
||||||
gpu::PipelinePointer _localLight;
|
gpu::PipelinePointer _localLight;
|
||||||
gpu::PipelinePointer _localLightOutline;
|
gpu::PipelinePointer _localLightOutline;
|
||||||
|
|
||||||
LightLocationsPtr _directionalSkyboxLightLocations;
|
|
||||||
LightLocationsPtr _directionalAmbientSphereLightLocations;
|
|
||||||
|
|
||||||
LightLocationsPtr _directionalSkyboxLightShadowLocations;
|
|
||||||
LightLocationsPtr _directionalAmbientSphereLightShadowLocations;
|
|
||||||
|
|
||||||
LightLocationsPtr _localLightLocations;
|
|
||||||
LightLocationsPtr _localLightOutlineLocations;
|
|
||||||
|
|
||||||
friend class LightClusteringPass;
|
friend class LightClusteringPass;
|
||||||
friend class RenderDeferredSetup;
|
friend class RenderDeferredSetup;
|
||||||
friend class RenderDeferredLocals;
|
friend class RenderDeferredLocals;
|
||||||
|
|
|
@ -18,7 +18,7 @@ layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
const float depth = 1.0;
|
const float depth = 1.0;
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const mat4 UNIT_QUAD = mat4(
|
||||||
vec4(-1.0, -1.0, depth, 1.0),
|
vec4(-1.0, -1.0, depth, 1.0),
|
||||||
vec4(1.0, -1.0, depth, 1.0),
|
vec4(1.0, -1.0, depth, 1.0),
|
||||||
vec4(-1.0, 1.0, depth, 1.0),
|
vec4(-1.0, 1.0, depth, 1.0),
|
||||||
|
@ -26,7 +26,7 @@ void main(void) {
|
||||||
);
|
);
|
||||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||||
|
|
||||||
_texCoord01.xy = (pos.xy + 1.0) * 0.5;
|
_texCoord01 = vec4((pos.xy + 1.0) * 0.5, 0.0, 0.0);
|
||||||
|
|
||||||
gl_Position = pos;
|
gl_Position = pos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,48 +115,39 @@ protected:
|
||||||
const Lambda _triggerHandler;
|
const Lambda _triggerHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BoolPreference : public Preference {
|
||||||
template <typename T>
|
|
||||||
class TypedPreference : public Preference {
|
|
||||||
public:
|
|
||||||
using Getter = std::function<T()>;
|
|
||||||
using Setter = std::function<void(const T&)>;
|
|
||||||
|
|
||||||
TypedPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
|
||||||
: Preference(category, name), _getter(getter), _setter(setter) { }
|
|
||||||
|
|
||||||
T getValue() const { return _value; }
|
|
||||||
void setValue(const T& value) { if (_value != value) { _value = value; emitValueChanged(); } }
|
|
||||||
void load() override { _value = _getter(); }
|
|
||||||
void save() const override {
|
|
||||||
T oldValue = _getter();
|
|
||||||
if (_value != oldValue) {
|
|
||||||
_setter(_value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
T _value;
|
|
||||||
const Getter _getter;
|
|
||||||
const Setter _setter;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BoolPreference : public TypedPreference<bool> {
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool value READ getValue WRITE setValue NOTIFY valueChanged)
|
Q_PROPERTY(bool value READ getValue WRITE setValue NOTIFY valueChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Getter = std::function<bool()>;
|
||||||
|
using Setter = std::function<void(const bool&)>;
|
||||||
|
|
||||||
BoolPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
BoolPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: TypedPreference(category, name, getter, setter) { }
|
: Preference(category, name), _getter(getter), _setter(setter) { }
|
||||||
|
|
||||||
|
bool getValue() const { return _value; }
|
||||||
|
void setValue(const bool& value) { if (_value != value) { _value = value; emitValueChanged(); } }
|
||||||
|
void load() override { _value = _getter(); }
|
||||||
|
void save() const override {
|
||||||
|
bool oldValue = _getter();
|
||||||
|
if (_value != oldValue) {
|
||||||
|
_setter(_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool _value;
|
||||||
|
const Getter _getter;
|
||||||
|
const Setter _setter;
|
||||||
|
|
||||||
void emitValueChanged() override { emit valueChanged(); }
|
void emitValueChanged() override { emit valueChanged(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FloatPreference : public TypedPreference<float> {
|
class FloatPreference : public Preference {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
|
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
|
||||||
Q_PROPERTY(float min READ getMin CONSTANT)
|
Q_PROPERTY(float min READ getMin CONSTANT)
|
||||||
|
@ -165,8 +156,21 @@ class FloatPreference : public TypedPreference<float> {
|
||||||
Q_PROPERTY(float decimals READ getDecimals CONSTANT)
|
Q_PROPERTY(float decimals READ getDecimals CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Getter = std::function<float()>;
|
||||||
|
using Setter = std::function<void(const float&)>;
|
||||||
|
|
||||||
FloatPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
FloatPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: TypedPreference(category, name, getter, setter) { }
|
: Preference(category, name), _getter(getter), _setter(setter) { }
|
||||||
|
|
||||||
|
float getValue() const { return _value; }
|
||||||
|
void setValue(const float& value) { if (_value != value) { _value = value; emitValueChanged(); } }
|
||||||
|
void load() override { _value = _getter(); }
|
||||||
|
void save() const override {
|
||||||
|
float oldValue = _getter();
|
||||||
|
if (_value != oldValue) {
|
||||||
|
_setter(_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float getMin() const { return _min; }
|
float getMin() const { return _min; }
|
||||||
void setMin(float min) { _min = min; };
|
void setMin(float min) { _min = min; };
|
||||||
|
@ -186,14 +190,17 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
void emitValueChanged() override { emit valueChanged(); }
|
void emitValueChanged() override { emit valueChanged(); }
|
||||||
|
|
||||||
|
float _value;
|
||||||
|
const Getter _getter;
|
||||||
|
const Setter _setter;
|
||||||
|
|
||||||
float _decimals { 0 };
|
float _decimals { 0 };
|
||||||
float _min { 0 };
|
float _min { 0 };
|
||||||
float _max { 1 };
|
float _max { 1 };
|
||||||
float _step { 0.1f };
|
float _step { 0.1f };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IntPreference : public Preference {
|
||||||
class IntPreference : public TypedPreference<int> {
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
|
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
|
||||||
Q_PROPERTY(float min READ getMin CONSTANT)
|
Q_PROPERTY(float min READ getMin CONSTANT)
|
||||||
|
@ -202,8 +209,21 @@ class IntPreference : public TypedPreference<int> {
|
||||||
Q_PROPERTY(int decimals READ getDecimals CONSTANT)
|
Q_PROPERTY(int decimals READ getDecimals CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Getter = std::function<int()>;
|
||||||
|
using Setter = std::function<void(const int&)>;
|
||||||
|
|
||||||
IntPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
IntPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: TypedPreference(category, name, getter, setter) { }
|
: Preference(category, name), _getter(getter), _setter(setter) { }
|
||||||
|
|
||||||
|
int getValue() const { return _value; }
|
||||||
|
void setValue(const int& value) { if (_value != value) { _value = value; emitValueChanged(); } }
|
||||||
|
void load() override { _value = _getter(); }
|
||||||
|
void save() const override {
|
||||||
|
int oldValue = _getter();
|
||||||
|
if (_value != oldValue) {
|
||||||
|
_setter(_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float getMin() const { return _min; }
|
float getMin() const { return _min; }
|
||||||
void setMin(float min) { _min = min; };
|
void setMin(float min) { _min = min; };
|
||||||
|
@ -221,6 +241,10 @@ signals:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int _value;
|
||||||
|
const Getter _getter;
|
||||||
|
const Setter _setter;
|
||||||
|
|
||||||
void emitValueChanged() override { emit valueChanged(); }
|
void emitValueChanged() override { emit valueChanged(); }
|
||||||
|
|
||||||
int _min { std::numeric_limits<int>::min() };
|
int _min { std::numeric_limits<int>::min() };
|
||||||
|
@ -229,19 +253,37 @@ protected:
|
||||||
int _decimals { 0 };
|
int _decimals { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class StringPreference : public TypedPreference<QString> {
|
class StringPreference : public Preference {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString value READ getValue WRITE setValue NOTIFY valueChanged)
|
Q_PROPERTY(QString value READ getValue WRITE setValue NOTIFY valueChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using Getter = std::function<QString()>;
|
||||||
|
using Setter = std::function<void(const QString&)>;
|
||||||
|
|
||||||
StringPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
StringPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: TypedPreference(category, name, getter, setter) { }
|
: Preference(category, name), _getter(getter), _setter(setter) { }
|
||||||
|
|
||||||
|
|
||||||
|
QString getValue() const { return _value; }
|
||||||
|
void setValue(const QString& value) { if (_value != value) { _value = value; emitValueChanged(); } }
|
||||||
|
void load() override { _value = _getter(); }
|
||||||
|
void save() const override {
|
||||||
|
QString oldValue = _getter();
|
||||||
|
if (_value != oldValue) {
|
||||||
|
_setter(_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void emitValueChanged() override { emit valueChanged(); }
|
void emitValueChanged() override { emit valueChanged(); }
|
||||||
|
|
||||||
|
QString _value;
|
||||||
|
const Getter _getter;
|
||||||
|
const Setter _setter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SliderPreference : public FloatPreference {
|
class SliderPreference : public FloatPreference {
|
||||||
|
@ -303,7 +345,7 @@ public:
|
||||||
ComboBoxPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
ComboBoxPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: EditPreference(category, name, getter, setter) { }
|
: EditPreference(category, name, getter, setter) { }
|
||||||
Type getType() override { return ComboBox; }
|
Type getType() override { return ComboBox; }
|
||||||
|
|
||||||
const QStringList& getItems() { return _items; }
|
const QStringList& getItems() { return _items; }
|
||||||
void setItems(const QStringList& items) { _items = items; }
|
void setItems(const QStringList& items) { _items = items; }
|
||||||
|
|
||||||
|
@ -342,6 +384,9 @@ class CheckPreference : public BoolPreference {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool indented READ getIndented CONSTANT)
|
Q_PROPERTY(bool indented READ getIndented CONSTANT)
|
||||||
public:
|
public:
|
||||||
|
using Getter = std::function<bool()>;
|
||||||
|
using Setter = std::function<void(const bool&)>;
|
||||||
|
|
||||||
CheckPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
CheckPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||||
: BoolPreference(category, name, getter, setter) { }
|
: BoolPreference(category, name, getter, setter) { }
|
||||||
Type getType() override { return Checkbox; }
|
Type getType() override { return Checkbox; }
|
||||||
|
|
Loading…
Reference in a new issue