void EntityModel::addComponentNode(Lumix::ComponentUID cmp, int component_index)
{
	Node& node = getRoot().addChild(getComponentName(cmp),
									component_index + COMPONENT_OFFSET);
	node.m_getter = []() -> QVariant
	{
		return "";
	};
	node.onCreateEditor = [this, cmp](QWidget* parent,
									  const QStyleOptionViewItem&)
	{
		auto widget = new QWidget(parent);
		QHBoxLayout* layout = new QHBoxLayout(widget);
		layout->setContentsMargins(0, 0, 0, 0);
		layout->addStretch(1);
		auto button = new QPushButton("Remove", widget);
		connect(button,
				&QPushButton::clicked,
				[this, cmp]()
				{
					m_editor.destroyComponent(cmp);
				});
		layout->addWidget(button);
		return widget;
	};
	node.enablePeristentEditor();
	auto& descriptors = m_editor.getEngine().getPropertyDescriptors(cmp.type);
	for (int j = 0; j < descriptors.size(); ++j)
	{
		auto* desc = descriptors[j];
		
		addPropertyNode(node, desc, cmp, false);
	}
	emit m_view.componentNodeCreated(node, cmp);
}
Exemplo n.º 2
0
        nint INServiceFactory::compareTo(const INObject * other) const
        {
            if (this == other)
                return 0;
            try
            {
                const INServiceFactory * obj = dynamic_cast<const INServiceFactory *>(other);

                if (obj != NULL)
                {
                    int result = 0;
                    if ((result = getComponentName().compare(obj->getComponentName())) == 0)
                    {
                        result = getFactoryName().compare(obj->getFactoryName());
                    }
                    return result;
                }
                else
                {
                    return 1;
                }
            }
            catch (bad_cast &)
            {
                return 1;
            }
        }
Exemplo n.º 3
0
 /**
  * @brief add a new Component to the entity
  * @warning if already exist the component is deleted so remove first;
  **/
 void addComponent(Component *component) {
     std::string name = getComponentName(component);
     if (components.find(name) != components.end()) {
         std::cerr << "Component " << name << " already exist" << std::endl;
     }
     else {
         components[name] = component;
     }
 }
Exemplo n.º 4
0
 void addScript(ScriptComponent *script) {
     std::string name = getComponentName(script);
     if (scripts.find(name) != scripts.end()) {
         delete script;
         std::cerr << "Components already exist" << std::endl;
     }
     else {
         scripts[name] = script;
     }
 }
Exemplo n.º 5
0
const NAString
StmtDDLDropComponentPrivilege::displayLabel2() const
{
  NAString aLabel("Component name: ");
  aLabel += getComponentName();
  aLabel += " Drop behavior: ";
  if (dropBehavior_ == COM_CASCADE_DROP_BEHAVIOR)
     aLabel += "CASCADE";
  else
     aLabel += "RESTRICT";
      
  return aLabel;
}
Exemplo n.º 6
0
	void FocusFrame::draw(sf::RenderWindow* render) {
		if(m_style == NULL) {
			log_err "No style has been applied to the component "+getComponentName() end_log_err;
			return;
		}
		if(!m_visible) {
			return;
		}
		util::CoordInt coord = getRealCoord();
		BasicStyle::State state = BasicStyle::normal;

		int borderWidth = m_style->topleft(state)->getGlobalBounds().width;
		int borderHeight = m_style->topleft(state)->getGlobalBounds().height;
		m_style->topleft(state)->setPosition(coord.x, coord.y);
		render->draw(*m_style->topleft(state));

		m_style->top(state)->setPosition(coord.x+borderWidth, coord.y);
		m_style->top(state)->setScale(m_width-borderWidth*2, 1.0);
		render->draw(*m_style->top(state));

		m_style->topright(state)->setPosition(coord.x+m_width-borderWidth, coord.y);
		render->draw(*m_style->topright(state));

		m_style->right(state)->setPosition(coord.x+m_width-borderWidth, coord.y+borderHeight);
		m_style->right(state)->setScale(1.0, m_height-borderHeight*2);
		render->draw(*m_style->right(state));

		m_style->botright(state)->setPosition(coord.x+m_width-borderWidth, coord.y+m_height-borderHeight);
		render->draw(*m_style->botright(state));

		m_style->bot(state)->setPosition(coord.x+borderWidth, coord.y+m_height-borderHeight);
		m_style->bot(state)->setScale(m_width-borderWidth*2, 1.0);
		render->draw(*m_style->bot(state));

		m_style->botleft(state)->setPosition(coord.x, coord.y+m_height-borderHeight);
		render->draw(*m_style->botleft(state));

		m_style->left(state)->setPosition(coord.x, coord.y+borderHeight);
		m_style->left(state)->setScale(1.0, m_height-borderHeight*2);
		render->draw(*m_style->left(state));

		m_style->center(state)->setPosition(coord.x+borderWidth, coord.y+borderHeight);
		m_style->center(state)->setScale(m_width-borderWidth*2, m_height-borderHeight*2);
		render->draw(*m_style->center(state));

		m_text.draw(render);
	}
Exemplo n.º 7
0
int GuestFile::i_setFileStatus(FileStatus_T fileStatus, int fileRc)
{
    LogFlowThisFuncEnter();

    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, fileRc=%Rrc\n",
                     mData.mStatus, fileStatus, fileRc));

#ifdef VBOX_STRICT
    if (fileStatus == FileStatus_Error)
    {
        AssertMsg(RT_FAILURE(fileRc), ("Guest rc must be an error (%Rrc)\n", fileRc));
    }
    else
        AssertMsg(RT_SUCCESS(fileRc), ("Guest rc must not be an error (%Rrc)\n", fileRc));
#endif

    if (mData.mStatus != fileStatus)
    {
        mData.mStatus    = fileStatus;
        mData.mLastError = fileRc;

        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
        HRESULT hr = errorInfo.createObject();
        ComAssertComRC(hr);
        if (RT_FAILURE(fileRc))
        {
            hr = errorInfo->initEx(VBOX_E_IPRT_ERROR, fileRc,
                                   COM_IIDOF(IGuestFile), getComponentName(),
                                   i_guestErrorToString(fileRc));
            ComAssertComRC(hr);
        }

        alock.release(); /* Release lock before firing off event. */

        fireGuestFileStateChangedEvent(mEventSource, mSession,
                                       this, fileStatus, errorInfo);
    }

    return VINF_SUCCESS;
}
Exemplo n.º 8
0
std::string ShadowNode::getDebugName() const {
  return getComponentName();
}
const NAString StmtDDLRevokeComponentPrivilege::displayLabel1() const
{
    NAString aLabel("Component name: ");
    aLabel += getComponentName();
    return aLabel;
}
 size_t ComponentManager::getComponentUid(const Component& c) const {
     return std::hash<std::string>()(getComponentName(c));
 }