diff -r 7ba1c04d96d5 -r 4998bb082c73 attributedialog.cpp --- a/attributedialog.cpp Fri Nov 09 12:07:20 2007 +0000 +++ b/attributedialog.cpp Wed Dec 05 14:58:03 2007 +0000 @@ -1,11 +1,79 @@ #include "attributedialog.h" +#include "attributewidget.h" + +#include +#include AttributeDialog::AttributeDialog (QWidget *parent):QDialog (parent) { - ui.setupUi (this); + if (this->objectName().isEmpty()) + this->setObjectName(QString::fromUtf8("AttributeDialog")); + QSize size(468, 75); + size = size.expandedTo(this->minimumSizeHint()); + this->resize(size); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); + this->setSizePolicy(sizePolicy); + + vboxLayout = new QVBoxLayout(this); + vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); + + tableLayout = new QVBoxLayout(); + tableLayout->setObjectName(QString::fromUtf8("tableLayout")); + + hboxLayout = new QHBoxLayout(); + hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); + addButton = new QPushButton(this); + addButton->setObjectName(QString::fromUtf8("addButton")); + + hboxLayout->addWidget(addButton); + + spacerItem = new QSpacerItem(111, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + hboxLayout->addItem(spacerItem); + + closeButton = new QPushButton(this); + closeButton->setObjectName(QString::fromUtf8("closeButton")); + + hboxLayout->addWidget(closeButton); + + vboxLayout->addLayout(tableLayout); + vboxLayout->addLayout(hboxLayout); + + + + setWindowTitle(QApplication::translate("AttributeDialog", "Attributes", 0, QApplication::UnicodeUTF8)); + addButton->setText(QApplication::translate("AttributeDialog", "Add key", 0, QApplication::UnicodeUTF8)); + closeButton->setText(QApplication::translate("AttributeDialog", "Close", 0, QApplication::UnicodeUTF8)); + + connect (addButton, SIGNAL (clicked()), this, SLOT (addKey())); + connect (closeButton, SIGNAL (clicked()), this, SLOT (accept())); + + table=NULL; } +void AttributeDialog::setTable (AttributeTable *t) +{ + table=t; + updateTable(); +} + +void AttributeDialog::setBranch (BranchObj *bo) +{ + branch=bo; + updateTable(); +} + +void AttributeDialog::addKey() +{ + AttributeWidget *aw1=new AttributeWidget (this); + aw1->show(); + tableLayout->addWidget (aw1); + +} void AttributeDialog::closeEvent( QCloseEvent* ce ) { @@ -15,5 +83,27 @@ return; } +void AttributeDialog::updateTable() +{ + if (table) + { + // Update list of keys and values + QStringList keyList=table->getKeys(); + AttributeWidget *aw; + int i; + for (i=0; isetKey (keyList.at(i) ); + aw->setValues (table->getValues (keyList.at(i) )); + aw->show(); + tableLayout->addWidget (aw); + } + // Update attributes in dialog from data in selected branch + // TODO + } + +} +