Ejemplo n.º 1
0
void ObjectWidget::changeObject(QASAbstractObject* obj, bool fullObject) {
  if (m_object)
    disconnect(m_object, SIGNAL(changed()), this, SLOT(onChanged()));
  if (m_irtObject)
    disconnect(m_irtObject, SIGNAL(changed()),
               this, SLOT(updateContextLabel()));
  m_irtObject = NULL;

  m_object = qobject_cast<QASObject*>(obj);
  if (!obj)
    return;
  m_short = !fullObject;

  connect(m_object, SIGNAL(changed()), this, SLOT(onChanged()));

  m_objectWidget->changeObject(obj);
  m_shortObjectWidget->changeObject(obj);

  m_contextLabel->setVisible(false);
  m_contextButton->setVisible(false);
  if (m_object->type() == "comment" && m_object->inReplyTo()) {
    m_irtObject = m_object->inReplyTo();
    connect(m_irtObject, SIGNAL(changed()), this, SLOT(updateContextLabel()));

    if (!m_irtObject->url().isEmpty())
      updateContextLabel();
  }

  if (m_short) {
    m_contextLabel->setVisible(false);
    m_contextButton->setVisible(false);
    m_objectWidget->setVisible(false);
    m_shortObjectWidget->setVisible(true);
  } else {
    m_shortObjectWidget->setVisible(false);
    m_objectWidget->setVisible(true);
  }

  QASActor* author = m_object->author();
  if (author && author->url().isEmpty())
    refreshObject(m_object);
}
Ejemplo n.º 2
0
// selection changed
void Editor::engineObjectSelected(Object * object)
{
  m_object = object;
  refreshObject();
}