mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
chore: change all is/as castings to use typeid so no string comparison takes place
This commit is contained in:
parent
71bba11152
commit
918b80ae69
@ -197,7 +197,7 @@ void CWallpaperApplication::loadBackgrounds () {
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Core::CProject> CWallpaperApplication::loadBackground (const std::string& bg) {
|
||||
std::unique_ptr<Core::CProject> CWallpaperApplication::loadBackground (const std::string& bg) {
|
||||
const auto container = std::make_shared <CCombinedContainer> ();
|
||||
|
||||
this->setupContainer (container, bg);
|
||||
|
@ -89,7 +89,7 @@ class CWallpaperApplication {
|
||||
* @param bg
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] std::shared_ptr<Core::CProject> loadBackground (const std::string& bg);
|
||||
[[nodiscard]] std::unique_ptr<Core::CProject> loadBackground (const std::string& bg);
|
||||
/**
|
||||
* Prepares all background's values and updates their properties if required
|
||||
*/
|
||||
|
@ -17,11 +17,10 @@ using namespace WallpaperEngine::Assets;
|
||||
using namespace WallpaperEngine::Core::UserSettings;
|
||||
|
||||
CObject::CObject (
|
||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||
std::vector<int> dependencies
|
||||
) :
|
||||
m_type (std::move(type)),
|
||||
m_visible (visible),
|
||||
m_id (id),
|
||||
m_name (std::move(name)),
|
||||
|
@ -32,17 +32,23 @@ class CObject {
|
||||
static const CObject* fromJSON (const json& data, const Wallpapers::CScene* scene, const std::shared_ptr<const CContainer>& container);
|
||||
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<int>& getDependencies () const;
|
||||
@ -58,13 +64,13 @@ class CObject {
|
||||
|
||||
protected:
|
||||
CObject (
|
||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||
const Wallpapers::CScene* scene, const CUserSettingBoolean* visible, int id, std::string name,
|
||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||
std::vector<int> dependencies);
|
||||
|
||||
private:
|
||||
const std::string m_type;
|
||||
virtual ~CObject () = default;
|
||||
|
||||
private:
|
||||
const CUserSettingBoolean* m_visible;
|
||||
int m_id;
|
||||
const std::string m_name;
|
||||
|
@ -34,7 +34,7 @@ CProject::~CProject () {
|
||||
this->m_properties.clear ();
|
||||
}
|
||||
|
||||
std::shared_ptr<CProject> CProject::fromFile (const std::string& filename, std::shared_ptr<const CContainer> container) {
|
||||
std::unique_ptr<CProject> CProject::fromFile (const std::string& filename, std::shared_ptr<const CContainer> container) {
|
||||
json content = json::parse (container->readFileAsString (filename));
|
||||
|
||||
const auto dependency = jsonFindDefault<std::string> (content, "dependency", "No dependency");
|
||||
@ -71,7 +71,7 @@ std::shared_ptr<CProject> CProject::fromFile (const std::string& filename, std::
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<CProject> project = std::make_shared <CProject> (
|
||||
std::unique_ptr<CProject> project = std::make_unique <CProject> (
|
||||
jsonFindRequired <std::string> (content, "title", "Project title missing"),
|
||||
type,
|
||||
jsonFindDefault <std::string> (content, "workshopid", std::to_string (backgroundId--)),
|
||||
|
@ -26,7 +26,7 @@ class CProject {
|
||||
bool supportsaudioprocessing, const std::map<std::string, Projects::CProperty*>& properties);
|
||||
~CProject();
|
||||
|
||||
static std::shared_ptr<CProject> fromFile (const std::string& filename, std::shared_ptr<const CContainer> container);
|
||||
static std::unique_ptr<CProject> fromFile (const std::string& filename, std::shared_ptr<const CContainer> container);
|
||||
|
||||
[[nodiscard]] const CWallpaper* getWallpaper () const;
|
||||
[[nodiscard]] const std::string& getTitle () const;
|
||||
|
@ -4,9 +4,8 @@
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
|
||||
CWallpaper::CWallpaper (std::string type, const CProject& project) :
|
||||
m_project (project),
|
||||
m_type (std::move(type)) {}
|
||||
CWallpaper::CWallpaper (const CProject& project) :
|
||||
m_project (project) {}
|
||||
|
||||
const CProject& CWallpaper::getProject () const {
|
||||
return this->m_project;
|
||||
|
@ -10,30 +10,35 @@ class CProject;
|
||||
|
||||
class CWallpaper {
|
||||
public:
|
||||
template <class T> const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
if (is<T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
template <class T> T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
if (is<T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
CWallpaper (std::string type, const CProject& project);
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return typeid(*this) == typeid(T);
|
||||
}
|
||||
|
||||
const CProject& getProject () const;
|
||||
|
||||
protected:
|
||||
friend class CProject;
|
||||
|
||||
explicit CWallpaper (const CProject& project);
|
||||
virtual ~CWallpaper() = default;
|
||||
|
||||
private:
|
||||
const CProject& m_project;
|
||||
|
||||
const std::string m_type;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core
|
||||
|
@ -18,7 +18,7 @@ CImage::CImage (
|
||||
const CUserSettingFloat* alpha, float brightness, uint32_t colorBlendMode, glm::vec2 parallaxDepth, bool fullscreen,
|
||||
bool passthrough, bool autosize, std::vector<const Objects::CEffect*> effects, std::vector<int> dependencies
|
||||
) :
|
||||
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
||||
CObject (scene, visible, id, std::move(name), origin, scale, angles, std::move(dependencies)),
|
||||
m_size (size),
|
||||
m_parallaxDepth (parallaxDepth),
|
||||
m_material (material),
|
||||
@ -139,5 +139,3 @@ bool CImage::isAutosize () const {
|
||||
const std::vector<const CEffect*>& CImage::getEffects () const {
|
||||
return this->m_effects;
|
||||
}
|
||||
|
||||
const std::string CImage::Type = "image";
|
@ -93,11 +93,6 @@ class CImage : public CObject {
|
||||
bool fullscreen, bool passthrough, bool autosize, std::vector<const Objects::CEffect*> effects,
|
||||
std::vector<int> dependencies);
|
||||
|
||||
/**
|
||||
* Type value used to differentiate the different types of objects in a background
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
/** The image's size */
|
||||
const glm::vec2 m_size;
|
||||
|
@ -51,7 +51,7 @@ CParticle::CParticle (
|
||||
const std::vector<const Particles::CEmitter*>& emitters,
|
||||
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies
|
||||
) :
|
||||
CObject (scene, visible, id, name, Type, origin, scale, angles, std::move(dependencies)),
|
||||
CObject (scene, visible, id, name, origin, scale, angles, std::move(dependencies)),
|
||||
m_starttime (starttime),
|
||||
m_maxcount (maxcount),
|
||||
m_controlpoints (controlpoints),
|
||||
@ -69,5 +69,3 @@ const std::vector<const Particles::CControlPoint*>& CParticle::getControlPoints
|
||||
const std::vector<const Particles::CInitializer*>& CParticle::getInitializers () const {
|
||||
return this->m_initializers;
|
||||
}
|
||||
|
||||
const std::string CParticle::Type = "particle";
|
@ -43,11 +43,6 @@ class CParticle : public CObject {
|
||||
const std::vector<const Particles::CEmitter*>& emitters,
|
||||
const std::vector<const Particles::CInitializer*>& initializers, std::vector<int> dependencies);
|
||||
|
||||
/**
|
||||
* Type value used to differentiate the different types of objects in a background
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
/** The time at which the particle system should start emitting */
|
||||
const uint32_t m_starttime;
|
||||
|
@ -11,7 +11,7 @@ CSound::CSound (
|
||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles, bool repeat,
|
||||
std::vector<std::string> sounds, std::vector<int> dependencies
|
||||
) :
|
||||
CObject (scene, visible, id, std::move(name), Type, origin, scale, angles, std::move(dependencies)),
|
||||
CObject (scene, visible, id, std::move(name), origin, scale, angles, std::move(dependencies)),
|
||||
m_repeat (repeat),
|
||||
m_sounds (std::move(sounds)) {}
|
||||
|
||||
@ -51,5 +51,3 @@ const std::vector<std::string>& CSound::getSounds () const {
|
||||
bool CSound::isRepeat () const {
|
||||
return this->m_repeat;
|
||||
}
|
||||
|
||||
const std::string CSound::Type = "sound";
|
@ -39,11 +39,6 @@ class CSound : public CObject {
|
||||
const CUserSettingVector3* origin, const CUserSettingVector3* scale, const CUserSettingVector3* angles,
|
||||
bool repeat, std::vector<std::string> sounds, std::vector<int> dependencies);
|
||||
|
||||
/**
|
||||
* Type value used to differentiate the different types of objects in a background
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
/** If the sounds should repeat or not */
|
||||
bool m_repeat;
|
||||
|
@ -3,10 +3,3 @@
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstant::CShaderConstant (std::string type) :
|
||||
m_type (std::move(type)) {}
|
||||
|
||||
const std::string& CShaderConstant::getType () const {
|
||||
return this->m_type;
|
||||
}
|
||||
|
@ -10,33 +10,31 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants {
|
||||
*/
|
||||
class CShaderConstant : public DynamicValues::CDynamicValue {
|
||||
public:
|
||||
explicit CShaderConstant (std::string type);
|
||||
virtual ~CShaderConstant () = default;
|
||||
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type name of this constant
|
||||
*/
|
||||
[[nodiscard]] const std::string& getType () const;
|
||||
|
||||
/**
|
||||
* @return String representation of the constant's value
|
||||
*/
|
||||
[[nodiscard]] virtual std::string toString () const = 0;
|
||||
|
||||
private:
|
||||
const std::string m_type;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -2,13 +2,10 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantFloat::CShaderConstantFloat (float value) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantFloat::CShaderConstantFloat (float value) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
std::string CShaderConstantFloat::toString () const {
|
||||
return std::to_string (this->getFloat ());
|
||||
}
|
||||
|
||||
const std::string CShaderConstantFloat::Type = "float";
|
@ -12,11 +12,6 @@ class CShaderConstantFloat : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantFloat (float value);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -2,13 +2,10 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantInteger::CShaderConstantInteger (int32_t value) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantInteger::CShaderConstantInteger (int32_t value) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
std::string CShaderConstantInteger::toString () const {
|
||||
return std::to_string (this->getInt ());
|
||||
}
|
||||
|
||||
const std::string CShaderConstantInteger::Type = "int";
|
@ -12,11 +12,6 @@ class CShaderConstantInteger : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantInteger (int32_t value);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -3,13 +3,10 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantProperty::CShaderConstantProperty (const CProperty* property) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantProperty::CShaderConstantProperty (const CProperty* property) {
|
||||
property->connectOutgoing (this);
|
||||
}
|
||||
|
||||
std::string CShaderConstantProperty::toString () const {
|
||||
return "no string representation yet!";
|
||||
}
|
||||
|
||||
const std::string CShaderConstantProperty::Type = "property";
|
@ -15,11 +15,6 @@ class CShaderConstantProperty : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantProperty (const CProperty* property);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantVector2::CShaderConstantVector2 (glm::vec2 value) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantVector2::CShaderConstantVector2 (glm::vec2 value) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
@ -17,5 +16,3 @@ std::string CShaderConstantVector2::toString () const {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string CShaderConstantVector2::Type = "vec2";
|
@ -14,11 +14,6 @@ class CShaderConstantVector2 : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantVector2 (glm::vec2 value);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantVector3::CShaderConstantVector3 (glm::vec3 value) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantVector3::CShaderConstantVector3 (glm::vec3 value) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
@ -19,5 +18,3 @@ std::string CShaderConstantVector3::toString () const {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string CShaderConstantVector3::Type = "vec3";
|
@ -13,11 +13,6 @@ class CShaderConstantVector3 : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantVector3 (glm::vec3 value);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
|
||||
CShaderConstantVector4::CShaderConstantVector4 (glm::vec4 value) :
|
||||
CShaderConstant (Type) {
|
||||
CShaderConstantVector4::CShaderConstantVector4 (glm::vec4 value) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
@ -21,5 +20,3 @@ std::string CShaderConstantVector4::toString () const {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string CShaderConstantVector4::Type = "vec4";
|
@ -13,11 +13,6 @@ class CShaderConstantVector4 : public CShaderConstant {
|
||||
public:
|
||||
explicit CShaderConstantVector4 (glm::vec4 value);
|
||||
|
||||
/**
|
||||
* Type string indicator
|
||||
*/
|
||||
static const std::string Type;
|
||||
|
||||
[[nodiscard]] std::string toString () const override;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Objects::Effects::Constants
|
||||
|
@ -13,6 +13,26 @@ class CInitializer {
|
||||
public:
|
||||
static const CInitializer* fromJSON (const json& data);
|
||||
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The name of the particle initializer, indicates what type of initialization to do
|
||||
*/
|
||||
@ -25,6 +45,8 @@ class CInitializer {
|
||||
protected:
|
||||
CInitializer (uint32_t id, std::string name);
|
||||
|
||||
virtual ~CInitializer() = default;
|
||||
|
||||
private:
|
||||
/** ID for ordering purposes */
|
||||
const uint32_t m_id;
|
||||
|
@ -13,15 +13,15 @@ using namespace WallpaperEngine::Core::Projects;
|
||||
CProperty* CProperty::fromJSON (const json& data, const std::string& name) {
|
||||
const auto type = jsonFindRequired (data, "type", "Project properties must have the type field");
|
||||
|
||||
if (*type == CPropertyColor::Type)
|
||||
if (*type == "color")
|
||||
return CPropertyColor::fromJSON (data, name);
|
||||
if (*type == CPropertyBoolean::Type)
|
||||
if (*type == "bool")
|
||||
return CPropertyBoolean::fromJSON (data, name);
|
||||
if (*type == CPropertySlider::Type)
|
||||
if (*type == "slider")
|
||||
return CPropertySlider::fromJSON (data, name);
|
||||
if (*type == CPropertyCombo::Type)
|
||||
if (*type == "combo")
|
||||
return CPropertyCombo::fromJSON (data, name);
|
||||
if (*type == CPropertyText::Type)
|
||||
if (*type == "text")
|
||||
return CPropertyText::fromJSON (data, name);
|
||||
|
||||
// show the error and ignore this property
|
||||
@ -31,8 +31,7 @@ CProperty* CProperty::fromJSON (const json& data, const std::string& name) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CProperty::CProperty (std::string name, std::string type, std::string text) :
|
||||
m_type (std::move(type)),
|
||||
CProperty::CProperty (std::string name, std::string text) :
|
||||
m_name (std::move(name)),
|
||||
m_text (std::move(text)) {}
|
||||
|
||||
@ -52,10 +51,6 @@ const std::string& CProperty::getName () const {
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
const std::string& CProperty::getType () const {
|
||||
return this->m_type;
|
||||
}
|
||||
|
||||
const std::string& CProperty::getText () const {
|
||||
return this->m_text;
|
||||
}
|
@ -19,17 +19,23 @@ class CProperty : public CDynamicValue {
|
||||
static CProperty* fromJSON (const json& data, const std::string& name);
|
||||
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,9 +53,9 @@ class CProperty : public CDynamicValue {
|
||||
*/
|
||||
[[nodiscard]] const std::string& getName () const;
|
||||
/**
|
||||
* @return Type of the property
|
||||
* @return Textual type representation of this property
|
||||
*/
|
||||
[[nodiscard]] const std::string& getType () const;
|
||||
[[nodiscard]] virtual const char* getType () const = 0;
|
||||
/**
|
||||
* @return Text of the property
|
||||
*/
|
||||
@ -64,12 +70,10 @@ class CProperty : public CDynamicValue {
|
||||
protected:
|
||||
void propagate () const override;
|
||||
|
||||
CProperty (std::string name, std::string type, std::string text);
|
||||
CProperty (std::string name, std::string text);
|
||||
|
||||
/** Functions to call when this property's value changes */
|
||||
mutable std::vector<function_type> m_subscriptions;
|
||||
/** Type of property */
|
||||
const std::string m_type;
|
||||
/** Name of the property */
|
||||
const std::string m_name;
|
||||
/** Description of the property for the user */
|
||||
|
@ -31,7 +31,9 @@ std::string CPropertyBoolean::dump () const {
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
CPropertyBoolean::CPropertyBoolean (bool value, std::string name, std::string text) :
|
||||
CProperty (std::move(name), Type, std::move(text)) {}
|
||||
const char* CPropertyBoolean::getType () const {
|
||||
return "bool";
|
||||
}
|
||||
|
||||
const std::string CPropertyBoolean::Type = "bool";
|
||||
CPropertyBoolean::CPropertyBoolean (bool value, std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {}
|
||||
|
@ -12,12 +12,9 @@ class CPropertyBoolean final : public CProperty {
|
||||
public:
|
||||
static CPropertyBoolean* fromJSON (const json& data, std::string name);
|
||||
|
||||
/** @inheritdoc */
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
/** @inheritdoc */
|
||||
void set (const std::string& value) override;
|
||||
|
||||
static const std::string Type;
|
||||
[[nodiscard]] const char* getType () const override;
|
||||
|
||||
private:
|
||||
CPropertyBoolean (bool value, std::string name, std::string text);
|
||||
|
@ -45,9 +45,11 @@ std::string CPropertyColor::dump () const {
|
||||
return ss.str ();
|
||||
}
|
||||
|
||||
CPropertyColor::CPropertyColor (const std::string& color, std::string name, std::string text) :
|
||||
CProperty (std::move(name), Type, std::move(text)) {
|
||||
this->set (color);
|
||||
const char* CPropertyColor::getType () const {
|
||||
return "color";
|
||||
}
|
||||
|
||||
const std::string CPropertyColor::Type = "color";
|
||||
CPropertyColor::CPropertyColor (const std::string& color, std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {
|
||||
this->set (color);
|
||||
}
|
||||
|
@ -16,8 +16,7 @@ class CPropertyColor final : public CProperty {
|
||||
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
static const std::string Type;
|
||||
[[nodiscard]] const char* getType () const override;
|
||||
|
||||
private:
|
||||
CPropertyColor (const std::string& color, std::string name, std::string text);
|
||||
|
@ -40,7 +40,7 @@ CPropertyCombo* CPropertyCombo::fromJSON (const json& data, std::string name) {
|
||||
CPropertyCombo::CPropertyCombo (
|
||||
std::string name, std::string text, const std::string& defaultValue, std::vector<const CPropertyComboValue*> values
|
||||
) :
|
||||
CProperty (std::move(name), Type, std::move(text)),
|
||||
CProperty (std::move(name), std::move(text)),
|
||||
m_values (std::move(values)) {
|
||||
this->set (defaultValue);
|
||||
}
|
||||
@ -108,4 +108,6 @@ int CPropertyCombo::translateValueToIndex (const std::string& value) const {
|
||||
return index;
|
||||
}
|
||||
|
||||
const std::string CPropertyCombo::Type = "combo";
|
||||
const char* CPropertyCombo::getType () const {
|
||||
return "combo";
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ class CPropertyCombo final : public CProperty {
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
int translateValueToIndex (const std::string& value) const;
|
||||
|
||||
static const std::string Type;
|
||||
[[nodiscard]] const char* getType () const override;
|
||||
|
||||
private:
|
||||
CPropertyCombo (
|
||||
|
@ -53,13 +53,15 @@ void CPropertySlider::set (const std::string& value) {
|
||||
this->update (newValue);
|
||||
}
|
||||
|
||||
const char* CPropertySlider::getType () const {
|
||||
return "slider";
|
||||
}
|
||||
|
||||
CPropertySlider::CPropertySlider (float value, const std::string& name, const std::string& text, float min,
|
||||
float max, float step) :
|
||||
CProperty (name, Type, text),
|
||||
CProperty (name, text),
|
||||
m_min (min),
|
||||
m_max (max),
|
||||
m_step (step) {
|
||||
this->update (value);
|
||||
}
|
||||
|
||||
const std::string CPropertySlider::Type = "slider";
|
@ -28,8 +28,7 @@ class CPropertySlider final : public CProperty {
|
||||
[[nodiscard]] const float& getStep () const;
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
static const std::string Type;
|
||||
[[nodiscard]] const char* getType () const override;
|
||||
|
||||
private:
|
||||
CPropertySlider (float value, const std::string& name, const std::string& text, float min, float max, float step);
|
||||
|
@ -26,7 +26,9 @@ void CPropertyText::set (const std::string& value) {
|
||||
this->m_text = value;
|
||||
}
|
||||
|
||||
CPropertyText::CPropertyText (std::string name, std::string text) :
|
||||
CProperty (std::move(name), Type, std::move(text)) {}
|
||||
const char* CPropertyText::getType () const {
|
||||
return "text";
|
||||
}
|
||||
|
||||
const std::string CPropertyText::Type = "text";
|
||||
CPropertyText::CPropertyText (std::string name, std::string text) :
|
||||
CProperty (std::move(name), std::move(text)) {}
|
||||
|
@ -13,8 +13,7 @@ class CPropertyText final : public CProperty {
|
||||
static CPropertyText* fromJSON (const json& data, std::string name);
|
||||
[[nodiscard]] std::string dump () const override;
|
||||
void set (const std::string& value) override;
|
||||
|
||||
static const std::string Type;
|
||||
[[nodiscard]] const char* getType () const override;
|
||||
|
||||
private:
|
||||
CPropertyText (std::string name, std::string text);
|
||||
|
@ -18,7 +18,7 @@ using namespace WallpaperEngine::Core::UserSettings;
|
||||
CUserSettingBoolean::CUserSettingBoolean (
|
||||
bool hasCondition, bool defaultValue, const Projects::CProperty* source, std::string expectedValue
|
||||
) :
|
||||
CUserSettingValue (Type),
|
||||
CUserSettingValue (),
|
||||
m_hasCondition (hasCondition),
|
||||
m_source (source),
|
||||
m_expectedValue (std::move(expectedValue)) {
|
||||
@ -91,5 +91,3 @@ const CUserSettingBoolean* CUserSettingBoolean::fromJSON (const nlohmann::json&
|
||||
const CUserSettingBoolean* CUserSettingBoolean::fromScalar (const bool value) {
|
||||
return new CUserSettingBoolean (false, value, nullptr, "");
|
||||
}
|
||||
|
||||
std::string CUserSettingBoolean::Type = "boolean";
|
@ -14,7 +14,6 @@ class CUserSettingBoolean : public CUserSettingValue {
|
||||
|
||||
static const CUserSettingBoolean* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||
static const CUserSettingBoolean* fromScalar (bool value);
|
||||
static std::string Type;
|
||||
|
||||
private:
|
||||
CUserSettingBoolean (
|
||||
|
@ -15,7 +15,7 @@ using namespace WallpaperEngine::Core::UserSettings;
|
||||
CUserSettingFloat::CUserSettingFloat (
|
||||
bool hasCondition, float defaultValue, const Projects::CProperty* source, std::string expectedValue
|
||||
) :
|
||||
CUserSettingValue (Type),
|
||||
CUserSettingValue (),
|
||||
m_default (defaultValue),
|
||||
m_hasCondition (hasCondition),
|
||||
m_source (source),
|
||||
@ -85,5 +85,3 @@ const CUserSettingFloat* CUserSettingFloat::fromJSON (const nlohmann::json& data
|
||||
const CUserSettingFloat* CUserSettingFloat::fromScalar (const float value) {
|
||||
return new CUserSettingFloat (false, value, nullptr, "");
|
||||
}
|
||||
|
||||
std::string CUserSettingFloat::Type = "float";
|
@ -14,7 +14,6 @@ class CUserSettingFloat : public CUserSettingValue {
|
||||
|
||||
static const CUserSettingFloat* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||
static const CUserSettingFloat* fromScalar (float value);
|
||||
static std::string Type;
|
||||
|
||||
private:
|
||||
CUserSettingFloat (
|
||||
|
@ -3,6 +3,3 @@
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Core::UserSettings;
|
||||
|
||||
CUserSettingValue::CUserSettingValue (std::string type) :
|
||||
m_type (std::move(type)) {}
|
@ -10,23 +10,26 @@ using namespace WallpaperEngine::Core::DynamicValues;
|
||||
class CUserSettingValue : public CDynamicValue {
|
||||
public:
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit CUserSettingValue (std::string type);
|
||||
|
||||
private:
|
||||
const std::string m_type;
|
||||
virtual ~CUserSettingValue() = default;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::UserSettings
|
||||
|
@ -15,7 +15,7 @@ using namespace WallpaperEngine::Core::UserSettings;
|
||||
CUserSettingVector3::CUserSettingVector3 (
|
||||
bool hasCondition, glm::vec3 defaultValue, const Projects::CProperty* source, std::string expectedValue
|
||||
) :
|
||||
CUserSettingValue (Type),
|
||||
CUserSettingValue (),
|
||||
m_hasCondition (hasCondition),
|
||||
m_source (source),
|
||||
m_expectedValue (std::move(expectedValue)) {
|
||||
@ -85,5 +85,3 @@ const CUserSettingVector3* CUserSettingVector3::fromJSON (const nlohmann::json&
|
||||
const CUserSettingVector3* CUserSettingVector3::fromScalar (const glm::vec3 value) {
|
||||
return new CUserSettingVector3 (false, value, nullptr, "");
|
||||
}
|
||||
|
||||
std::string CUserSettingVector3::Type = "color";
|
@ -16,7 +16,6 @@ class CUserSettingVector3 : public CUserSettingValue {
|
||||
|
||||
static const CUserSettingVector3* fromJSON (const nlohmann::json& data, const CProject& project);
|
||||
static const CUserSettingVector3* fromScalar (glm::vec3 value);
|
||||
static std::string Type;
|
||||
|
||||
private:
|
||||
CUserSettingVector3 (
|
||||
|
@ -18,7 +18,7 @@ CScene::CScene (
|
||||
float cameraShakeAmplitude, float cameraShakeRoughness, float cameraShakeSpeed,
|
||||
const CUserSettingVector3* clearColor, const Scenes::CProjection* orthogonalProjection, glm::vec3 skylightColor
|
||||
) :
|
||||
CWallpaper (Type, project),
|
||||
CWallpaper (project),
|
||||
m_container (std::move(container)),
|
||||
m_camera (camera),
|
||||
m_ambientColor (ambientColor),
|
||||
@ -167,5 +167,3 @@ const Scenes::CProjection* CScene::getOrthogonalProjection () const {
|
||||
const glm::vec3& CScene::getSkylightColor () const {
|
||||
return this->m_skylightColor;
|
||||
}
|
||||
|
||||
const std::string CScene::Type = "scene";
|
||||
|
@ -52,8 +52,6 @@ class CScene : public CWallpaper {
|
||||
float cameraShakeAmplitude, float cameraShakeRoughness, float cameraShakeSpeed,
|
||||
const CUserSettingVector3* clearColor, const Scenes::CProjection* orthogonalProjection, glm::vec3 skylightColor);
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
void insertObject (const CObject* object);
|
||||
|
||||
[[nodiscard]] std::shared_ptr<const CContainer> getContainer () const;
|
||||
|
@ -6,11 +6,9 @@ using namespace WallpaperEngine::Core;
|
||||
using namespace WallpaperEngine::Core::Wallpapers;
|
||||
|
||||
CVideo::CVideo (std::string filename, const CProject& project) :
|
||||
CWallpaper (Type, project),
|
||||
CWallpaper (project),
|
||||
m_filename (std::move(filename)) {}
|
||||
|
||||
const std::string& CVideo::getFilename () const {
|
||||
return this->m_filename;
|
||||
}
|
||||
|
||||
const std::string CVideo::Type = "video";
|
||||
|
@ -21,7 +21,5 @@ class CVideo : public CWallpaper {
|
||||
friend class CWallpaper;
|
||||
|
||||
const std::string m_filename;
|
||||
|
||||
static const std::string Type;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core
|
||||
|
@ -10,7 +10,5 @@ const std::string& CWeb::getFilename () const {
|
||||
}
|
||||
|
||||
CWeb::CWeb (std::string filename, const CProject& project) :
|
||||
CWallpaper (Type, project),
|
||||
CWallpaper (project),
|
||||
m_filename (std::move(filename)) {}
|
||||
|
||||
const std::string CWeb::Type = "web";
|
||||
|
@ -29,8 +29,6 @@ namespace WallpaperEngine::Core::Wallpapers
|
||||
|
||||
const std::string m_filename;
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
@ -6,9 +6,8 @@ using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render;
|
||||
using namespace WallpaperEngine::Render::Wallpapers;
|
||||
|
||||
CObject::CObject (Wallpapers::CScene* scene, std::string type, const Core::CObject* object) :
|
||||
CObject::CObject (Wallpapers::CScene* scene, const Core::CObject* object) :
|
||||
Helpers::CContextAware (scene),
|
||||
m_type (std::move (type)),
|
||||
m_scene (scene),
|
||||
m_object (object) {}
|
||||
|
||||
|
@ -14,18 +14,24 @@ class CScene;
|
||||
namespace WallpaperEngine::Render {
|
||||
class CObject : public Helpers::CContextAware {
|
||||
public:
|
||||
template <class T> const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
template <class T> T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> bool is () {
|
||||
return this->m_type == T::Type;
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
virtual void render () = 0;
|
||||
@ -35,12 +41,10 @@ class CObject : public Helpers::CContextAware {
|
||||
[[nodiscard]] int getId () const;
|
||||
|
||||
protected:
|
||||
CObject (Wallpapers::CScene* scene, std::string type, const Core::CObject* object);
|
||||
~CObject () override = default;
|
||||
CObject (Wallpapers::CScene* scene, const Core::CObject* object);
|
||||
virtual ~CObject () override = default;
|
||||
|
||||
private:
|
||||
std::string m_type;
|
||||
|
||||
Wallpapers::CScene* m_scene;
|
||||
const Core::CObject* m_object;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
CWallpaper::CWallpaper (
|
||||
const Core::CWallpaper* wallpaperData, std::string type, CRenderContext& context,CAudioContext& audioContext,
|
||||
const Core::CWallpaper* wallpaperData, CRenderContext& context,CAudioContext& audioContext,
|
||||
const CWallpaperState::TextureUVsScaling& scalingMode,
|
||||
const WallpaperEngine::Assets::ITexture::TextureFlags& clampMode
|
||||
) :
|
||||
@ -26,7 +26,6 @@ CWallpaper::CWallpaper (
|
||||
a_TexCoord (GL_NONE),
|
||||
m_vaoBuffer (GL_NONE),
|
||||
m_destFramebuffer (GL_NONE),
|
||||
m_type (std::move (type)),
|
||||
m_audioContext (audioContext),
|
||||
m_state (scalingMode, clampMode) {
|
||||
// generate the VAO to stop opengl from complaining
|
||||
|
@ -30,21 +30,27 @@ class CContextAware;
|
||||
|
||||
class CWallpaper : public Helpers::CContextAware {
|
||||
public:
|
||||
template <class T> [[nodiscard]]const T* as () const {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<const T*> (this);
|
||||
template <class T> [[nodiscard]] const T* as () const {
|
||||
if (is <T> ()) {
|
||||
return static_cast <const T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] T* as () {
|
||||
assert (is<T> ());
|
||||
return reinterpret_cast<T*> (this);
|
||||
if (is <T> ()) {
|
||||
return static_cast <T*> (this);
|
||||
}
|
||||
|
||||
throw std::bad_cast ();
|
||||
}
|
||||
|
||||
template <class T> [[nodiscard]] bool is () const {
|
||||
return this->m_type == T::Type;
|
||||
return typeid (*this) == typeid(T);
|
||||
}
|
||||
|
||||
~CWallpaper () override;
|
||||
virtual ~CWallpaper () override;
|
||||
|
||||
/**
|
||||
* Performs a render pass of the wallpaper
|
||||
@ -154,7 +160,7 @@ class CWallpaper : public Helpers::CContextAware {
|
||||
|
||||
protected:
|
||||
CWallpaper (
|
||||
const Core::CWallpaper* wallpaperData, std::string type, CRenderContext& context, CAudioContext& audioContext,
|
||||
const Core::CWallpaper* wallpaperData, CRenderContext& context, CAudioContext& audioContext,
|
||||
const CWallpaperState::TextureUVsScaling& scalingMode,
|
||||
const WallpaperEngine::Assets::ITexture::TextureFlags& clampMode);
|
||||
|
||||
@ -189,8 +195,6 @@ class CWallpaper : public Helpers::CContextAware {
|
||||
GLuint m_destFramebuffer;
|
||||
/** Setups OpenGL's shaders for this wallpaper backbuffer */
|
||||
void setupShaders ();
|
||||
/** The type of background this wallpaper is */
|
||||
std::string m_type;
|
||||
/** List of FBOs registered for this wallpaper */
|
||||
std::map<std::string, std::shared_ptr<const CFBO>> m_fbos;
|
||||
/** Audio context that is using this wallpaper */
|
||||
|
@ -5,7 +5,7 @@ using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render::Objects;
|
||||
|
||||
CImage::CImage (Wallpapers::CScene* scene, const Core::Objects::CImage* image) :
|
||||
Render::CObject (scene, Type, image),
|
||||
Render::CObject (scene, image),
|
||||
m_texture (nullptr),
|
||||
m_sceneSpacePosition (GL_NONE),
|
||||
m_copySpacePosition (GL_NONE),
|
||||
@ -481,5 +481,3 @@ GLuint CImage::getTexCoordCopy () const {
|
||||
GLuint CImage::getTexCoordPass () const {
|
||||
return this->m_texcoordPass;
|
||||
}
|
||||
|
||||
const std::string CImage::Type = "image";
|
@ -56,8 +56,6 @@ class CImage final : public CObject {
|
||||
void pinpongFramebuffer (std::shared_ptr<const CFBO>* drawTo, std::shared_ptr<const ITexture>* asInput);
|
||||
|
||||
protected:
|
||||
static const std::string Type;
|
||||
|
||||
void setupPasses ();
|
||||
|
||||
void updateScreenSpacePosition ();
|
||||
|
@ -5,7 +5,7 @@
|
||||
using namespace WallpaperEngine::Render::Objects;
|
||||
|
||||
CSound::CSound (Wallpapers::CScene* scene, const Core::Objects::CSound* sound) :
|
||||
CObject (scene, Type, sound),
|
||||
CObject (scene, sound),
|
||||
m_sound (sound) {
|
||||
if (this->getContext ().getApp ().getContext ().settings.audio.enabled)
|
||||
this->load ();
|
||||
@ -38,5 +38,3 @@ void CSound::load () {
|
||||
}
|
||||
|
||||
void CSound::render () {}
|
||||
|
||||
const std::string CSound::Type = "sound";
|
@ -20,8 +20,6 @@ class CSound final : public CObject {
|
||||
void render () override;
|
||||
|
||||
protected:
|
||||
static const std::string Type;
|
||||
|
||||
void load ();
|
||||
|
||||
private:
|
||||
|
@ -21,7 +21,7 @@ CScene::CScene (
|
||||
const CWallpaperState::TextureUVsScaling& scalingMode,
|
||||
const WallpaperEngine::Assets::ITexture::TextureFlags& clampMode
|
||||
) :
|
||||
CWallpaper (scene, Type, context, audioContext, scalingMode, clampMode),
|
||||
CWallpaper (scene, context, audioContext, scalingMode, clampMode),
|
||||
m_mousePosition (),
|
||||
m_mousePositionLast (),
|
||||
m_parallaxDisplacement () {
|
||||
@ -271,5 +271,3 @@ glm::vec2* CScene::getParallaxDisplacement () {
|
||||
const std::vector<CObject*>& CScene::getObjectsByRenderOrder () const {
|
||||
return this->m_objectsByRenderOrder;
|
||||
}
|
||||
|
||||
const std::string CScene::Type = "scene";
|
||||
|
@ -38,8 +38,6 @@ class CScene final : public CWallpaper {
|
||||
|
||||
friend class CWallpaper;
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
Render::CObject* createObject (const Core::CObject* object);
|
||||
|
||||
|
@ -16,7 +16,7 @@ CVideo::CVideo (
|
||||
const CWallpaperState::TextureUVsScaling& scalingMode,
|
||||
const WallpaperEngine::Assets::ITexture::TextureFlags& clampMode
|
||||
) :
|
||||
CWallpaper (video, Type, context, audioContext, scalingMode, clampMode),
|
||||
CWallpaper (video, context, audioContext, scalingMode, clampMode),
|
||||
m_mpvGl (nullptr),
|
||||
m_paused (false),
|
||||
m_width (16),
|
||||
@ -141,5 +141,3 @@ int CVideo::getWidth () const {
|
||||
int CVideo::getHeight () const {
|
||||
return this->m_height;
|
||||
}
|
||||
|
||||
const std::string CVideo::Type = "video";
|
||||
|
@ -28,8 +28,6 @@ class CVideo final : public CWallpaper {
|
||||
|
||||
friend class CWallpaper;
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
mpv_handle* m_mpv;
|
||||
mpv_render_context* m_mpvGl;
|
||||
|
@ -15,7 +15,7 @@ CWeb::CWeb (
|
||||
CWebBrowserContext& browserContext, const CWallpaperState::TextureUVsScaling& scalingMode,
|
||||
const WallpaperEngine::Assets::ITexture::TextureFlags& clampMode
|
||||
) :
|
||||
CWallpaper (web, Type, context, audioContext, scalingMode, clampMode),
|
||||
CWallpaper (web, context, audioContext, scalingMode, clampMode),
|
||||
m_browserContext (browserContext),
|
||||
m_browser (),
|
||||
m_client (),
|
||||
@ -122,5 +122,3 @@ CWeb::~CWeb () {
|
||||
|
||||
delete this->m_renderHandler;
|
||||
}
|
||||
|
||||
const std::string CWeb::Type = "web";
|
@ -45,8 +45,6 @@ class CWeb : public CWallpaper
|
||||
|
||||
friend class CWallpaper;
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
WallpaperEngine::WebBrowser::CWebBrowserContext& m_browserContext;
|
||||
CefRefPtr<CefBrowser> m_browser;
|
||||
|
Loading…
Reference in New Issue
Block a user