bool SceneComponent::deserialize(Serializer& serializer) { if (!Component::deserialize(serializer)) { return false; } if (!serializer.load("visible", mVisible)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"visible\" in : ", getId()); mVisible = true; } std::string parent; if (!serializer.load("parent", parent)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"parent\" in : ", getId()); parent = ""; } attachToParent(parent); sf::Vector2f pos; if (!serializer.load("pos", pos)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"pos\" in : ", getId()); pos = sf::Vector2f(); } setPosition(pos); float rot; if (!serializer.load("rot", rot)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"rot\" in : ", getId()); rot = 0.f; } setRotation(rot); sf::Vector2f sca; if (!serializer.load("sca", sca)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"sca\" in : ", getId()); sca = sf::Vector2f(1.f, 1.f); } setScale(sca); float z; if (!serializer.load("z", z)) { getLog() << ke::Log::Warning << ke::Variant("SceneComponent::deserialize : Can't find \"z\" in : ", getId()); z = 0.f; } setZ(z); return true; }
void FormSimulator::setIsSticked(bool is_sticked) { if (is_sticked && !m_isSticked) { attachToParent(); } else if (!is_sticked && m_isSticked) { unAttachFromParent(); } m_isSticked = is_sticked; qApp->settings()->setValue(APP_CFG_SIMULATOR, "is_sticked", is_sticked); }
void FileNVRAM::registerNVRAM() { // Create entry in device tree -> IODeviceTree:/options setName("AppleEFINVRAM"); setName("options", gIODTPlane); IORegistryEntry* root = IORegistryEntry::fromPath("/", gIODTPlane); attachToParent(root, gIODTPlane); registerService(); // Register with the platform expert const OSSymbol* funcSym = OSSymbol::withCString("RegisterNVRAM"); if (funcSym) { callPlatformFunction(funcSym, false, this, NULL, NULL, NULL); funcSym->release(); } }
void FormSimulator::conditionallyAttachToParent() { if (m_isSticked) { attachToParent(); } }