29 #include "editcomponentwidget.h"
31 #include <QVBoxLayout>
34 #include <QPushButton>
35 #include <QMessageBox>
36 #include <arcs/arcslog.h>
44 setWindowTitle(
"Component:" + aac->
getProperty(
"id").toString());
46 this->setLayout(
new QVBoxLayout());
49 componentText =
new QTextEdit(
this);
50 componentText->setAcceptRichText(
false);
51 layout()->addWidget(
new QLabel(
"Textual representation"));
52 layout()->addWidget(componentText);
54 componentText->setText(aac->
toString());
55 componentRepresentation = aac->
toString();
57 validateButton =
new QPushButton(
"Apply to component",
this);
58 layout()->addWidget(validateButton);
60 connect(validateButton,SIGNAL(clicked()),
this,SLOT(validate()));
61 this->addActions(componentText->createStandardContextMenu()->actions());
65 void EditComponentWidget::validate()
70 if ( component->
parseString(componentText->toPlainText()))
72 QMessageBox::information(
this,
"Component content validation",
"The component textual representation has been validated.",QMessageBox::Ok);
73 componentRepresentation = componentText->toPlainText();
77 QMessageBox::critical(
this,
"Component content validation",
"The component textual representation is not valid thus we are using the old one.");
79 componentText->setText(componentRepresentation);
virtual QString toString()=0
Defines a basic seralization mechanism.
QVariant getProperty(QString name)
Gets a meta-property from this component.
Class handling the generic description of a component.
static ARCSLog * getInstance()
returns the only instance of the logging system that is available
virtual bool parseString(QString s)=0
Defines a basic seralization mechanism.