1.1 --- a/attributedialog.cpp Fri Nov 09 12:07:20 2007 +0000
1.2 +++ b/attributedialog.cpp Wed Dec 05 14:58:03 2007 +0000
1.3 @@ -1,11 +1,79 @@
1.4 #include "attributedialog.h"
1.5
1.6 +#include "attributewidget.h"
1.7 +
1.8 +#include <QtGui/QApplication>
1.9 +#include <QtGui/QButtonGroup>
1.10
1.11 AttributeDialog::AttributeDialog (QWidget *parent):QDialog (parent)
1.12 {
1.13 - ui.setupUi (this);
1.14 + if (this->objectName().isEmpty())
1.15 + this->setObjectName(QString::fromUtf8("AttributeDialog"));
1.16 + QSize size(468, 75);
1.17 + size = size.expandedTo(this->minimumSizeHint());
1.18 + this->resize(size);
1.19 + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
1.20 + sizePolicy.setHorizontalStretch(0);
1.21 + sizePolicy.setVerticalStretch(0);
1.22 + sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
1.23 + this->setSizePolicy(sizePolicy);
1.24 +
1.25 + vboxLayout = new QVBoxLayout(this);
1.26 + vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
1.27 +
1.28 + tableLayout = new QVBoxLayout();
1.29 + tableLayout->setObjectName(QString::fromUtf8("tableLayout"));
1.30 +
1.31 + hboxLayout = new QHBoxLayout();
1.32 + hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
1.33 + addButton = new QPushButton(this);
1.34 + addButton->setObjectName(QString::fromUtf8("addButton"));
1.35 +
1.36 + hboxLayout->addWidget(addButton);
1.37 +
1.38 + spacerItem = new QSpacerItem(111, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
1.39 +
1.40 + hboxLayout->addItem(spacerItem);
1.41 +
1.42 + closeButton = new QPushButton(this);
1.43 + closeButton->setObjectName(QString::fromUtf8("closeButton"));
1.44 +
1.45 + hboxLayout->addWidget(closeButton);
1.46 +
1.47 + vboxLayout->addLayout(tableLayout);
1.48 + vboxLayout->addLayout(hboxLayout);
1.49 +
1.50 +
1.51 +
1.52 + setWindowTitle(QApplication::translate("AttributeDialog", "Attributes", 0, QApplication::UnicodeUTF8));
1.53 + addButton->setText(QApplication::translate("AttributeDialog", "Add key", 0, QApplication::UnicodeUTF8));
1.54 + closeButton->setText(QApplication::translate("AttributeDialog", "Close", 0, QApplication::UnicodeUTF8));
1.55 +
1.56 + connect (addButton, SIGNAL (clicked()), this, SLOT (addKey()));
1.57 + connect (closeButton, SIGNAL (clicked()), this, SLOT (accept()));
1.58 +
1.59 + table=NULL;
1.60 }
1.61
1.62 +void AttributeDialog::setTable (AttributeTable *t)
1.63 +{
1.64 + table=t;
1.65 + updateTable();
1.66 +}
1.67 +
1.68 +void AttributeDialog::setBranch (BranchObj *bo)
1.69 +{
1.70 + branch=bo;
1.71 + updateTable();
1.72 +}
1.73 +
1.74 +void AttributeDialog::addKey()
1.75 +{
1.76 + AttributeWidget *aw1=new AttributeWidget (this);
1.77 + aw1->show();
1.78 + tableLayout->addWidget (aw1);
1.79 +
1.80 +}
1.81
1.82 void AttributeDialog::closeEvent( QCloseEvent* ce )
1.83 {
1.84 @@ -15,5 +83,27 @@
1.85 return;
1.86 }
1.87
1.88 +void AttributeDialog::updateTable()
1.89 +{
1.90 + if (table)
1.91 + {
1.92 + // Update list of keys and values
1.93 + QStringList keyList=table->getKeys();
1.94 + AttributeWidget *aw;
1.95 + int i;
1.96 + for (i=0; i<keyList.count();i++)
1.97 + {
1.98 + aw=new AttributeWidget (this);
1.99 + aw->setKey (keyList.at(i) );
1.100 + aw->setValues (table->getValues (keyList.at(i) ));
1.101 + aw->show();
1.102 + tableLayout->addWidget (aw);
1.103 + }
1.104
1.105 + // Update attributes in dialog from data in selected branch
1.106
1.107 + // TODO
1.108 + }
1.109 +
1.110 +}
1.111 +