예제 #1
0
//-----------------------------------------------------------------------------
// Function: ApiDefinitionEditor()
//-----------------------------------------------------------------------------
ApiDefinitionEditor::ApiDefinitionEditor(QWidget *parent, LibraryInterface* libHandler,
                                         QSharedPointer<ApiDefinition> apiDef)
    : TabDocument(parent, DOC_PROTECTION_SUPPORT),
      libHandler_(libHandler),
      apiDef_(apiDef),
      comDefVLNVEdit_(VLNV::COMDEFINITION, libHandler, parent, this),
      dataTypeList_(tr("Data types"), this),
      functionEditor_(this)
{
    // Initialize the editors.
    dataTypeList_.initialize(apiDef->getDataTypes());

    functionEditor_.updateDataTypes(apiDef->getDataTypes());
    functionEditor_.restore(*apiDef);

    comDefVLNVEdit_.setTitle(tr("COM definition reference (optional)"));
    comDefVLNVEdit_.setVLNV(apiDef->getComDefinitionRef());
    updateComDefinition();

    connect(&dataTypeList_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&dataTypeList_, SIGNAL(contentChanged()), this, SLOT(updateDataTypeLists()), Qt::UniqueConnection);
    connect(&comDefVLNVEdit_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&comDefVLNVEdit_, SIGNAL(contentChanged()), this, SLOT(updateComDefinition()), Qt::UniqueConnection);
    connect(&functionEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);

    // Setup the layout.
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(&dataTypeList_);
    layout->addWidget(&comDefVLNVEdit_);
    layout->addWidget(&functionEditor_, 1);

    setModified(false);

    // Set the document name and type.
    VLNV const* vlnv = apiDef_->getVlnv();
    setDocumentName(vlnv->getName() + " (" + vlnv->getVersion() + ")");
    setDocumentType(tr("API Definition"));

    // Open in unlocked mode by default only if the version is draft.
    setProtection(vlnv->getVersion() != "draft");
}
예제 #2
0
   //Constructors
ActionModel::ActionModel (QObject *const parent)
: CoaXmlItemModel(parent)
{
   BEGIN;
   setDocumentType(DOCDESCRIPTION);
   setDocumentVersion(DOCVERSION);

   //Mapping attribute name 2 id and opposit

   //for actions
   setAttributeAndId("action", "name"      ,0 );
   setAttributeAndId("action", "icon"      ,1 );
   setAttributeAndId("action", "text"      ,2 );
   setAttributeAndId("action", "tooltip"   ,3 );
   setAttributeAndId("action", "shortcut"  ,4 );
   setAttributeAndId("action", "whatsthis" ,5 );

   //for folders
   setAttributeAndId("folder", "name"      ,0 );
   setAttributeAndId("folder", "folded"    ,1 );

}
void GoogleDocument::setId (const QString & id)
{
    m_id = id;

    setDocumentType(id.left(id.indexOf(":")));
}