summaryrefslogtreecommitdiff
path: root/src/diagramdocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/diagramdocument.cpp')
-rw-r--r--src/diagramdocument.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/diagramdocument.cpp b/src/diagramdocument.cpp
index 9df8b75..ced24bc 100644
--- a/src/diagramdocument.cpp
+++ b/src/diagramdocument.cpp
@@ -37,12 +37,14 @@ public:
gridSize(10),
gridVisible(true),
gridPen(QColor(185, 185, 185), 0),
- printing(false)
+ printing(false),
+ notation(Relational)
{}
int gridSize;
bool gridVisible;
QPen gridPen;
bool printing;
+ Notation notation;
};
DiagramDocument::DiagramDocument(QObject *parent)
@@ -51,6 +53,24 @@ DiagramDocument::DiagramDocument(QObject *parent)
m_undoStack = new QUndoStack(this);
}
+DiagramDocument::Notation
+DiagramDocument::notation() const
+{
+ return d->notation;
+}
+
+void
+DiagramDocument::setNotation(Notation notation)
+{
+ if (d->notation != notation) {
+ d->notation = notation;
+ // FIXME
+ foreach (DatabaseRelationship *connection, itemsByType<DatabaseRelationship>())
+ connection->updateLayout();
+ update();
+ }
+}
+
int
DiagramDocument::gridSize() const
{
@@ -284,6 +304,8 @@ DiagramDocument::save(const QString &fileName)
root.setAttribute("xmlns", "http://oxygene.sk/ns/diagram/1/");
doc.appendChild(root);
+ appendEnumElement(doc, root, "notation", d->notation, this, "Notation");
+
QDomElement itemList = doc.createElement("item-list");
root.appendChild(itemList);
@@ -322,6 +344,9 @@ DiagramDocument::load(const QString &fileName)
}
setFileName(fileName);
QDomElement root = doc.firstChildElement("diagram");
+
+ d->notation = readEnumElement(root, "notation", Relational, this, "Notation");
+
QDomElement itemListElement = root.firstChildElement("item-list");
QDomElement itemElement = itemListElement.firstChildElement("item");
while (!itemElement.isNull()) {