1.1 --- a/attributedialog.cpp Mon Jan 07 14:52:49 2008 +0000
1.2 +++ b/attributedialog.cpp Mon Jan 07 14:52:49 2008 +0000
1.3 @@ -58,15 +58,47 @@
1.4 void AttributeDialog::setTable (AttributeTable *t)
1.5 {
1.6 table=t;
1.7 - updateTable();
1.8 }
1.9
1.10 void AttributeDialog::setBranch (BranchObj *bo)
1.11 {
1.12 branch=bo;
1.13 - updateTable();
1.14 }
1.15
1.16 +void AttributeDialog::setMode (const AttributeDialogMode &m)
1.17 +{
1.18 + mode=m;
1.19 +
1.20 + QString title;
1.21 + if (mode==Definition)
1.22 + title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit definitions", 0, QApplication::UnicodeUTF8);
1.23 + else
1.24 + title= QApplication::translate("Attribute Dialog","AttributeDialog - Edit %1", 0, QApplication::UnicodeUTF8).arg("objname");
1.25 + setWindowTitle(title);
1.26 +}
1.27 +
1.28 +void AttributeDialog::updateTable()
1.29 +{
1.30 + if (table)
1.31 + {
1.32 + // Update list of keys and values
1.33 + QStringList keyList=table->getKeys();
1.34 + AttributeWidget *aw;
1.35 + for (int i=0; i<keyList.count();i++)
1.36 + {
1.37 + aw=new AttributeWidget (this);
1.38 + aw->setKey (keyList.at(i) );
1.39 + // FIXME aw->setValues (table->getValues (keyList.at(i) ));
1.40 + aw->show();
1.41 + tableLayout->addWidget (aw);
1.42 + }
1.43 +
1.44 + // Update attributes in dialog from data in selected branch
1.45 +
1.46 + // TODO
1.47 + }
1.48 +
1.49 +}
1.50 void AttributeDialog::addKey()
1.51 {
1.52 AttributeWidget *aw1=new AttributeWidget (this);
1.53 @@ -83,27 +115,4 @@
1.54 return;
1.55 }
1.56
1.57 -void AttributeDialog::updateTable()
1.58 -{
1.59 - if (table)
1.60 - {
1.61 - // Update list of keys and values
1.62 - QStringList keyList=table->getKeys();
1.63 - AttributeWidget *aw;
1.64 - int i;
1.65 - for (i=0; i<keyList.count();i++)
1.66 - {
1.67 - aw=new AttributeWidget (this);
1.68 - aw->setKey (keyList.at(i) );
1.69 - aw->setValues (table->getValues (keyList.at(i) ));
1.70 - aw->show();
1.71 - tableLayout->addWidget (aw);
1.72 - }
1.73
1.74 - // Update attributes in dialog from data in selected branch
1.75 -
1.76 - // TODO
1.77 - }
1.78 -
1.79 -}
1.80 -
2.1 --- a/attributedialog.h Mon Jan 07 14:52:49 2008 +0000
2.2 +++ b/attributedialog.h Mon Jan 07 14:52:49 2008 +0000
2.3 @@ -12,6 +12,12 @@
2.4 #include <QtGui/QVBoxLayout>
2.5
2.6
2.7 +/*! \brief Set the dialog mode */
2.8 +enum AttributeDialogMode {
2.9 + Definition, //!< Edit attribute definitions (AttributeDef)
2.10 + Object //!< Edit attributes of OrnamentedObj
2.11 +};
2.12 +
2.13 class AttributeDialog:public QDialog
2.14 {
2.15 Q_OBJECT
2.16 @@ -19,13 +25,14 @@
2.17 AttributeDialog (QWidget *parent=0 );
2.18 void setTable (AttributeTable *table=0);
2.19 void setBranch (BranchObj *bo);
2.20 + void setMode (const AttributeDialogMode &m);
2.21 + void updateTable();
2.22 signals:
2.23 void windowClosed();
2.24 private slots:
2.25 void addKey();
2.26 protected:
2.27 void closeEvent(QCloseEvent*);
2.28 - void updateTable();
2.29 private:
2.30 QVBoxLayout *vboxLayout;
2.31 QVBoxLayout *tableLayout;
2.32 @@ -34,6 +41,7 @@
2.33 QSpacerItem *spacerItem;
2.34 QPushButton *closeButton;
2.35
2.36 + AttributeDialogMode mode;
2.37 AttributeTable *table;
2.38 BranchObj *branch;
2.39 };