summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Lalinský <lalinsky@gmail.com>2008-12-11 12:34:38 +0100
committerLukáš Lalinský <lalinsky@gmail.com>2008-12-11 12:34:38 +0100
commit3b49b6a0d4c4d2ee94faeff207da10c452f70b07 (patch)
tree69ed42124a9b94be0f126c3b78e86f23812f3b3f
parentf4d9a3f2ad1896c5117ce1d3af3b8b3a433b3961 (diff)
downloaddbmodel-3b49b6a0d4c4d2ee94faeff207da10c452f70b07.tar.gz
dbmodel-3b49b6a0d4c4d2ee94faeff207da10c452f70b07.tar.bz2
Support for generic diagram item properties editors + add relationship props editor UI
-rw-r--r--src/diagramdocument.cpp15
-rw-r--r--src/diagramdocument.h2
-rw-r--r--src/diagramitem.cpp6
-rw-r--r--src/diagramitem.h3
-rw-r--r--src/diagramitemfactory.h62
-rw-r--r--src/diagramitemproperties.cpp61
-rw-r--r--src/diagramitemproperties.h45
-rw-r--r--src/items/database/columnlistview.cpp3
-rw-r--r--src/items/database/database.pri9
-rw-r--r--src/items/database/databaserelationship.cpp7
-rw-r--r--src/items/database/databaserelationship.h2
-rw-r--r--src/items/database/databaserelationshipproperties.cpp60
-rw-r--r--src/items/database/databaserelationshipproperties.h43
-rw-r--r--src/items/database/databasetable.cpp7
-rw-r--r--src/items/database/databasetable.h2
-rw-r--r--src/items/database/databasetableproperties.cpp149
-rw-r--r--src/items/database/databasetableproperties.h (renamed from src/items/database/tableproperties.h)31
-rw-r--r--src/items/database/tableproperties.cpp97
-rw-r--r--src/items/database/tableproperties.ui137
-rw-r--r--src/main.cpp1
-rw-r--r--src/mainwindow.cpp90
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/src.pro2
-rw-r--r--src/utils/factory.h26
-rw-r--r--src/utils/singelton.h2
-rw-r--r--translations/dbmodel_sk.ts167
26 files changed, 697 insertions, 338 deletions
diff --git a/src/diagramdocument.cpp b/src/diagramdocument.cpp
index 1f34d9f..9df8b75 100644
--- a/src/diagramdocument.cpp
+++ b/src/diagramdocument.cpp
@@ -138,6 +138,19 @@ DiagramDocument::itemsByType()
return result;
}
+QList<DiagramItem *>
+DiagramDocument::selectedItems()
+{
+ QList<DiagramItem *> result;
+ foreach(QGraphicsItem *item, QGraphicsScene::selectedItems()) {
+ DiagramItem *typedItem = dynamic_cast<DiagramItem *>(item);
+ if (typedItem) {
+ result.append(typedItem);
+ }
+ }
+ return result;
+}
+
void
DiagramDocument::itemMoved(DiagramItem *item)
{
@@ -230,7 +243,7 @@ DiagramDocument::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
DatabaseTable *
DiagramDocument::selectedTable()
{
- QList<QGraphicsItem *> items = selectedItems();
+ QList<DiagramItem *> items = selectedItems();
if (items.size() != 1)
return NULL;
return qgraphicsitem_cast<DatabaseTable *>(items[0]);
diff --git a/src/diagramdocument.h b/src/diagramdocument.h
index 350879c..ffb38ac 100644
--- a/src/diagramdocument.h
+++ b/src/diagramdocument.h
@@ -53,6 +53,8 @@ public:
DatabaseTable *selectedTable();
void deleteSelectedItems();
+ QList<DiagramItem *> selectedItems();
+
void save(const QString &fileName);
void load(const QString &fileName);
diff --git a/src/diagramitem.cpp b/src/diagramitem.cpp
index 1d75039..5b5133e 100644
--- a/src/diagramitem.cpp
+++ b/src/diagramitem.cpp
@@ -109,3 +109,9 @@ DiagramItem::fromMimeData(const QMimeData *mimeData)
item->createId();
return item;
}
+
+DiagramItemProperties *
+DiagramItem::createPropertiesEditor(QWidget *parent)
+{
+ return NULL;
+}
diff --git a/src/diagramitem.h b/src/diagramitem.h
index 3444f8d..76b8a0e 100644
--- a/src/diagramitem.h
+++ b/src/diagramitem.h
@@ -23,6 +23,7 @@
#include <QUuid>
class QMimeData;
class DiagramDocument;
+class DiagramItemProperties;
class DiagramItem : public QObject, public QGraphicsItem
{
@@ -51,6 +52,8 @@ public:
virtual QMimeData *toMimeData();
static DiagramItem *fromMimeData(const QMimeData *mimeData);
+ static DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0);
+
public:
QUuid m_id;
};
diff --git a/src/diagramitemfactory.h b/src/diagramitemfactory.h
index 274957e..5874541 100644
--- a/src/diagramitemfactory.h
+++ b/src/diagramitemfactory.h
@@ -17,15 +17,69 @@
#ifndef DIAGRAMITEMFACTORY_H
#define DIAGRAMITEMFACTORY_H
-#include "utils/factory.h"
-
+#include <QMap>
+#include <QStringList>
+#include "utils/singelton.h"
class DiagramItem;
+class DiagramItemProperties;
-class DiagramItemFactory : public Factory<DiagramItemFactory, DiagramItem>
+class DiagramItemFactory : public Singelton<DiagramItemFactory>
{
-private:
+
+ class CreatorBase
+ {
+ public:
+ virtual DiagramItem *create() = 0;
+ virtual DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0) = 0;
+ };
+
+ template <typename ItemType>
+ class Creator : public CreatorBase
+ {
+ public:
+ DiagramItem *create()
+ { return new ItemType(); }
+ DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0)
+ { return ItemType::createPropertiesEditor(parent); }
+ };
+
+public:
+
+ static DiagramItem *create(const QString &key)
+ {
+ DiagramItemFactory *inst = DiagramItemFactory::instance();
+ if (!inst->m_map.contains(key))
+ return NULL;
+ return inst->m_map[key]->create();
+ }
+
+ static DiagramItemProperties *createPropertiesEditor(const QString &key, QWidget *parent = 0)
+ {
+ DiagramItemFactory *inst = DiagramItemFactory::instance();
+ if (!inst->m_map.contains(key))
+ return NULL;
+ return inst->m_map[key]->createPropertiesEditor(parent);
+ }
+
+ static QStringList keys()
+ {
+ DiagramItemFactory *inst = DiagramItemFactory::instance();
+ return inst->m_map.keys();
+ }
+
+protected:
+
+ template <typename Type> void add()
+ {
+ m_map[Type::staticTypeName()] = new Creator<Type>();
+ }
+
+ QMap<QString, CreatorBase*> m_map;
+
DiagramItemFactory();
friend class Singelton<DiagramItemFactory>;
};
+#define FACTORY_ADD_TYPE(ST) add<ST>();
+
#endif
diff --git a/src/diagramitemproperties.cpp b/src/diagramitemproperties.cpp
new file mode 100644
index 0000000..9568d5a
--- /dev/null
+++ b/src/diagramitemproperties.cpp
@@ -0,0 +1,61 @@
+// Copyright (C) 2008 Lukas Lalinsky
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#include "diagramitemproperties.h"
+
+class DiagramItemProperties::DiagramItemPropertiesPrivate
+{
+public:
+ DiagramItemPropertiesPrivate()
+ : currentItem(0)
+ {}
+ DiagramItem *currentItem;
+};
+
+DiagramItemProperties::DiagramItemProperties(QWidget *parent)
+ : QTabWidget(parent), d(new DiagramItemPropertiesPrivate)
+{
+}
+
+DiagramItemProperties::~DiagramItemProperties()
+{
+ delete d;
+}
+
+int
+DiagramItemProperties::addPage(const QString &label, QWidget *page)
+{
+ return addTab(page, label);
+}
+
+DiagramItem *
+DiagramItemProperties::currentItem() const
+{
+ return d->currentItem;
+}
+
+void
+DiagramItemProperties::setCurrentItem(DiagramItem *item)
+{
+ DiagramItem *oldItem = d->currentItem;
+ d->currentItem = item;
+ switchCurrentItem(oldItem, item);
+}
+
+void
+DiagramItemProperties::switchCurrentItem(DiagramItem *oldItem, DiagramItem *newItem)
+{
+}
diff --git a/src/diagramitemproperties.h b/src/diagramitemproperties.h
new file mode 100644
index 0000000..038c75f
--- /dev/null
+++ b/src/diagramitemproperties.h
@@ -0,0 +1,45 @@
+// Copyright (C) 2008 Lukas Lalinsky
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#ifndef DIAGRAMITEMPROPERTIES_H
+#define DIAGRAMITEMPROPERTIES_H
+
+#include <QTabWidget>
+class DiagramItem;
+
+class DiagramItemProperties : public QTabWidget
+{
+ Q_OBJECT
+
+public:
+ DiagramItemProperties(QWidget *parent = 0);
+ ~DiagramItemProperties();
+
+ DiagramItem *currentItem() const;
+
+public slots:
+ void setCurrentItem(DiagramItem *item);
+
+protected:
+ int addPage(const QString &label, QWidget *page);
+ virtual void switchCurrentItem(DiagramItem *oldItem, DiagramItem *newItem);
+
+private:
+ class DiagramItemPropertiesPrivate;
+ DiagramItemPropertiesPrivate *d;
+};
+
+#endif
diff --git a/src/items/database/columnlistview.cpp b/src/items/database/columnlistview.cpp
index 4edb4ee..cbfb4b9 100644
--- a/src/items/database/columnlistview.cpp
+++ b/src/items/database/columnlistview.cpp
@@ -23,6 +23,9 @@
ColumnListView::ColumnListView(QWidget *parent)
: QTreeView(parent)
{
+ setRootIsDecorated(false);
+ setItemsExpandable(false);
+ setExpandsOnDoubleClick(false);
setModel(new ColumnListModel(this));
}
diff --git a/src/items/database/database.pri b/src/items/database/database.pri
index 53d4f6f..9a7ebe9 100644
--- a/src/items/database/database.pri
+++ b/src/items/database/database.pri
@@ -7,8 +7,9 @@ SOURCES += \
columnlistmodel.cpp \
columnlistview.cpp \
databasetable.cpp \
+ databasetableproperties.cpp \
databaserelationship.cpp \
- tableproperties.cpp
+ databaserelationshipproperties.cpp
HEADERS += \
databasecommands.h \
@@ -17,8 +18,6 @@ HEADERS += \
columnlistmodel.h \
columnlistview.h \
databasetable.h \
+ databasetableproperties.h \
databaserelationship.h \
- tableproperties.h
-
-FORMS += \
- tableproperties.ui
+ databaserelationshipproperties.h
diff --git a/src/items/database/databaserelationship.cpp b/src/items/database/databaserelationship.cpp
index 8eb0e2f..5adda58 100644
--- a/src/items/database/databaserelationship.cpp
+++ b/src/items/database/databaserelationship.cpp
@@ -19,6 +19,7 @@
#include "diagramdocument.h"
#include "databasetable.h"
#include "databaserelationship.h"
+#include "databaserelationshipproperties.h"
#include "range.h"
DatabaseRelationship::DatabaseRelationship(DiagramItem *parent)
@@ -249,3 +250,9 @@ DatabaseRelationship::saveToXml(QDomDocument doc, QDomElement element)
{
DiagramConnection::saveToXml(doc, element);
}
+
+DiagramItemProperties *
+DatabaseRelationship::createPropertiesEditor(QWidget *parent)
+{
+ return new DatabaseRelationshipProperties(parent);
+}
diff --git a/src/items/database/databaserelationship.h b/src/items/database/databaserelationship.h
index e9e26d0..0447d3b 100644
--- a/src/items/database/databaserelationship.h
+++ b/src/items/database/databaserelationship.h
@@ -47,6 +47,8 @@ public:
void updatePositions();
+ static DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0);
+
protected slots:
void updateLayout();
diff --git a/src/items/database/databaserelationshipproperties.cpp b/src/items/database/databaserelationshipproperties.cpp
new file mode 100644
index 0000000..cb3866d
--- /dev/null
+++ b/src/items/database/databaserelationshipproperties.cpp
@@ -0,0 +1,60 @@
+// Copyright (C) 2008 Lukas Lalinsky
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include "databaserelationshipproperties.h"
+
+class DatabaseRelationshipProperties::PrivateData
+{
+public:
+ PrivateData()
+ {}
+
+ QWidget *nameEdit;
+ QCheckBox *generateNameCheckBox;
+};
+
+DatabaseRelationshipProperties::DatabaseRelationshipProperties(QWidget *parent)
+ : DiagramItemProperties(parent), d(new PrivateData)
+{
+ addPage(tr("&Relationship"), createRelationshipPage());
+}
+
+QWidget *
+DatabaseRelationshipProperties::createRelationshipPage()
+{
+ QWidget *page = new QWidget(this);
+ QGridLayout *layout = new QGridLayout(page);
+
+ d->nameEdit = new QLineEdit(page);
+ layout->addWidget(new QLabel(tr("Name:"), page), 0, 0);
+ layout->addWidget(d->nameEdit, 0, 1);
+ d->generateNameCheckBox = new QCheckBox(tr("Generated"), page);
+ connect(d->generateNameCheckBox, SIGNAL(toggled(bool)), d->nameEdit, SLOT(setDisabled(bool)));
+ d->generateNameCheckBox->setChecked(true);
+ layout->addWidget(d->generateNameCheckBox, 0, 2);
+ layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 0, 1, 3);
+
+ return page;
+}
+
+void
+DatabaseRelationshipProperties::switchCurrentItem(DiagramItem *oldItem, DiagramItem *newItem)
+{
+}
diff --git a/src/items/database/databaserelationshipproperties.h b/src/items/database/databaserelationshipproperties.h
new file mode 100644
index 0000000..2cf8f29
--- /dev/null
+++ b/src/items/database/databaserelationshipproperties.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2008 Lukas Lalinsky
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#ifndef DATABASERELATIONSHIPPROPERTIES_H
+#define DATABASERELATIONSHIPPROPERTIES_H
+
+#include "diagramitemproperties.h"
+class DatabaseRelationship;
+
+class DatabaseRelationshipProperties : public DiagramItemProperties
+{
+ Q_OBJECT
+
+public:
+ DatabaseRelationshipProperties(QWidget *parent = 0);
+ DatabaseRelationship *currentRelationship();
+
+protected:
+ void switchCurrentItem(DiagramItem *oldItem, DiagramItem *newItem);
+
+protected slots:
+
+private:
+ class PrivateData;
+ PrivateData *d;
+
+ QWidget *createRelationshipPage();
+};
+
+#endif
diff --git a/src/items/database/databasetable.cpp b/src/items/database/databasetable.cpp
index 059284f..5c80629 100644
--- a/src/items/database/databasetable.cpp
+++ b/src/items/database/databasetable.cpp
@@ -18,6 +18,7 @@
#include <QMimeData>
#include <QDebug>
#include "databasetable.h"
+#include "databasetableproperties.h"
#include "diagramdocument.h"
#include "column.h"
#include "columnlist.h"
@@ -220,3 +221,9 @@ DatabaseTable::saveToXml(QDomDocument doc, QDomElement element)
appendStringElement(doc, columnElement, "notes", column->notes());
}
}
+
+DiagramItemProperties *
+DatabaseTable::createPropertiesEditor(QWidget *parent)
+{
+ return new DatabaseTableProperties(parent);
+}
diff --git a/src/items/database/databasetable.h b/src/items/database/databasetable.h
index 4402586..da03a1a 100644
--- a/src/items/database/databasetable.h
+++ b/src/items/database/databasetable.h
@@ -57,6 +57,8 @@ public:
// QMimeData *toMimeData();
+ static DiagramItemProperties *createPropertiesEditor(QWidget *parent = 0);
+
signals:
void propertyChanged(const QString &name, const QVariant &value);
diff --git a/src/items/database/databasetableproperties.cpp b/src/items/database/databasetableproperties.cpp
new file mode 100644
index 0000000..4c7b138
--- /dev/null
+++ b/src/items/database/databasetableproperties.cpp
@@ -0,0 +1,149 @@
+// Copyright (C) 2008 Lukas Lalinsky
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include "commands.h"
+#include "columnlist.h"
+#include "columnlistview.h"
+#include "databasetable.h"
+#include "databasetableproperties.h"
+#include "diagramdocument.h"
+
+class DatabaseTableProperties::PrivateData
+{
+public:
+ PrivateData()
+ {}
+
+ QLineEdit *nameEdit;
+ ColumnListView *columnListView;
+ QPushButton *addColumnButton;
+ QPushButton *removeColumnButton;
+ QPushButton *moveColumnUpButton;
+ QPushButton *moveColumnDownButton;
+};
+
+DatabaseTableProperties::DatabaseTableProperties(QWidget *parent)
+ : DiagramItemProperties(parent), d(new PrivateData)
+{
+ addPage(tr("&Table"), createTablePage());
+ addPage(tr("&Columns"), createColumnsPage());
+}
+
+DatabaseTable *
+DatabaseTableProperties::currentTable()
+{
+ return static_cast<DatabaseTable *>(currentItem());
+}
+
+QWidget *
+DatabaseTableProperties::createTablePage()
+{
+ QWidget *page = new QWidget(this);
+ QGridLayout *layout = new QGridLayout(page);
+
+ d->nameEdit = new QLineEdit(page);
+ connect(d->nameEdit, SIGNAL(textEdited(const QString &)), SLOT(setTableName(const QString &)));
+ layout->addWidget(new QLabel(tr("Name:"), page), 0, 0);
+ layout->addWidget(d->nameEdit, 0, 1);
+ layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 0, 1, 2);
+
+ return page;
+}
+
+QWidget *
+DatabaseTableProperties::createColumnsPage()
+{
+ QWidget *page = new QWidget(this);
+ QGridLayout *layout = new QGridLayout(page);
+
+ d->columnListView = new ColumnListView(page);
+ layout->addWidget(d->columnListView, 0, 0, 5, 1);
+
+ connect(d->columnListView->selectionModel(),
+ SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+ SLOT(updateColumnSelection()));
+
+ d->addColumnButton = new QPushButton(tr("&Add"), page);
+ d->removeColumnButton = new QPushButton(tr("&Remove"), page);
+ d->moveColumnUpButton = new QPushButton(tr("Move &Up"), page);
+ d->moveColumnDownButton = new QPushButton(tr("Move &Down"), page);
+ layout->addWidget(d->addColumnButton, 0, 1);
+ layout->addWidget(d->removeColumnButton, 1, 1);
+ layout->addWidget(d->moveColumnUpButton, 2, 1);
+ layout->addWidget(d->moveColumnDownButton, 3, 1);
+ layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 1, 1, 1);
+
+ connect(d->addColumnButton, SIGNAL(clicked()), d->columnListView, SLOT(addColumn()));
+ connect(d->removeColumnButton, SIGNAL(clicked()), d->columnListView, SLOT(removeColumn()));
+ connect(d->moveColumnUpButton, SIGNAL(clicked()), d->columnListView, SLOT(moveColumnUp()));
+ connect(d->moveColumnDownButton, SIGNAL(clicked()), d->columnListView, SLOT(moveColumnDown()));
+
+ return page;
+}
+
+void
+DatabaseTableProperties::switchCurrentItem(DiagramItem *oldItem, DiagramItem *)
+{
+ if (oldItem)
+ disconnect(oldItem, 0, this, 0);
+ DatabaseTable *table = currentTable();
+ if (table) {
+ d->nameEdit->setText(table->name());
+ d->columnListView->setColumnList(table->columnList());
+ connect(table, SIGNAL(propertyChanged(const QString &, const QVariant &)), SLOT(updateProperty(const QString &, const QVariant &)));
+ }
+ else {
+ d->nameEdit->clear();
+ d->columnListView->setColumnList(NULL);
+ }
+ updateColumnSelection();
+}
+
+void
+DatabaseTableProperties::updateProperty(const QString &name, const QVariant &value)
+{
+ if (name == "name") {
+ d->nameEdit->setText(value.toString());
+ }
+}
+
+void
+DatabaseTableProperties::setTableName(const QString &name)
+{
+ DatabaseTable *table = currentTable();
+ table->document()->undoStack()->push(new SetObjectPropertyCommand(table, "name", name));
+}
+
+void
+DatabaseTableProperties::updateColumnSelection()
+{
+ QList<int> columns = d->columnListView->selectedColumns();
+ if (columns.isEmpty()) {
+ d->removeColumnButton->setEnabled(false);
+ d->moveColumnUpButton->setEnabled(false);
+ d->moveColumnDownButton->setEnabled(false);
+ }
+ else {
+ int index = columns[0];
+ d->removeColumnButton->setEnabled(true);
+ d->moveColumnUpButton->setEnabled(index > 0);
+ d->moveColumnDownButton->setEnabled(index + 1 < currentTable()->columnList()->columnCount());
+ }
+}
diff --git a/src/items/database/tableproperties.h b/src/items/database/databasetableproperties.h
index 6ad51a5..cd7fa14 100644
--- a/src/items/database/tableproperties.h
+++ b/src/items/database/databasetableproperties.h
@@ -14,35 +14,34 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#ifndef TABLEPROPERTIES_H
-#define TABLEPROPERTIES_H
-
-#include <QWidget>
-#include <QTreeWidget>
-#include "ui_tableproperties.h"
+#ifndef DATABASETABLEPROPERTIES_H
+#define DATABASETABLEPROPERTIES_H
+#include "diagramitemproperties.h"
class DatabaseTable;
-class MainWindow;
-class TableProperties : public QWidget
+class DatabaseTableProperties : public DiagramItemProperties
{
Q_OBJECT
public:
- TableProperties(MainWindow *window, QWidget *parent = 0);
+ DatabaseTableProperties(QWidget *parent = 0);
+ DatabaseTable *currentTable();
- DatabaseTable *table() { return m_table; }
- void setTable(DatabaseTable *table);
+protected:
+ void switchCurrentItem(DiagramItem *oldItem, DiagramItem *newItem);
protected slots:
- void setSelectedTableName(const QString &name);
- void updateColumnSelection();
void updateProperty(const QString &name, const QVariant &value);
+ void updateColumnSelection();
+ void setTableName(const QString &name);
private:
- MainWindow *m_window;
- DatabaseTable *m_table;
- Ui_TableProperties ui;
+ class PrivateData;
+ PrivateData *d;
+
+ QWidget *createTablePage();
+ QWidget *createColumnsPage();
};
#endif
diff --git a/src/items/database/tableproperties.cpp b/src/items/database/tableproperties.cpp
deleted file mode 100644
index 11b3fc4..0000000
--- a/src/items/database/tableproperties.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2008 Lukas Lalinsky
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-#include "tableproperties.h"
-#include "databasetable.h"
-#include "mainwindow.h"
-#include "commands.h"
-#include "column.h"
-#include <QCheckBox>
-#include <QDebug>
-
-TableProperties::TableProperties(MainWindow *window, QWidget *parent)
- : QWidget(parent), m_window(window), m_table(0)
-{
- ui.setupUi(this);
- setTable(0);
- connect(ui.nameEdit,
- SIGNAL(textEdited(const QString &)),
- SLOT(setSelectedTableName(const QString &)));
- connect(ui.addColumnButton, SIGNAL(clicked()), ui.columnsWidget, SLOT(addColumn()));
- connect(ui.removeColumnButton, SIGNAL(clicked()), ui.columnsWidget, SLOT(removeColumn()));
- connect(ui.moveColumnUpButton, SIGNAL(clicked()), ui.columnsWidget, SLOT(moveColumnUp()));
- connect(ui.moveColumnDownButton, SIGNAL(clicked()), ui.columnsWidget, SLOT(moveColumnDown()));
- connect(ui.columnsWidget->selectionModel(),
- SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
- SLOT(updateColumnSelection()));
-}
-
-void
-TableProperties::setSelectedTableName(const QString &name)
-{
- if (m_table) {
- m_window->currentUndoStack()->push(new SetObjectPropertyCommand(m_table, "name", name));
- }
-}
-
-void
-TableProperties::setTable(DatabaseTable *table)
-{
- // Disconnect all connections from the previous table
- if (m_table) {
- disconnect(m_table, 0, this, 0);
- }
-
- m_table = NULL;
- if (table == NULL) {
- setEnabled(false);
- ui.nameEdit->clear();
- ui.columnsWidget->setColumnList(0);
- }
- else {
- setEnabled(true);
- ui.nameEdit->setText(table->name());
- ui.columnsWidget->setColumnList(table->columnList());
- connect(table, SIGNAL(propertyChanged(const QString &, const QVariant &)), SLOT(updateProperty(const QString &, const QVariant &)));
- }
- m_table = table;
- updateColumnSelection();
-}
-
-void
-TableProperties::updateProperty(const QString &name, const QVariant &value)
-{
- if (name == "name") {
- ui.nameEdit->setText(value.toString());
- }
-}
-
-void
-TableProperties::updateColumnSelection()
-{
- QList<int> columns = ui.columnsWidget->selectedColumns();
- if (columns.isEmpty()) {
- ui.removeColumnButton->setEnabled(false);
- ui.moveColumnUpButton->setEnabled(false);
- ui.moveColumnDownButton->setEnabled(false);
- }
- else {
- int index = columns[0];
- ui.removeColumnButton->setEnabled(true);
- ui.moveColumnUpButton->setEnabled(index > 0);
- ui.moveColumnDownButton->setEnabled(index + 1 < m_table->columnList()->columnCount());
- }
-}
diff --git a/src/items/database/tableproperties.ui b/src/items/database/tableproperties.ui
deleted file mode 100644
index 0ad531a..0000000
--- a/src/items/database/tableproperties.ui
+++ /dev/null
@@ -1,137 +0,0 @@
-<ui version="4.0" >
- <class>TableProperties</class>
- <widget class="QWidget" name="TableProperties" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>471</width>
- <height>192</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QTabWidget" name="tabWidget" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab" >
- <attribute name="title" >
- <string>&amp;Definition</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_2" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="nameEdit" />
- </item>
- <item row="1" column="0" colspan="2" >
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>158</width>
- <height>113</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2" >
- <attribute name="title" >
- <string>&amp;Columns</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_3" >
- <item rowspan="5" row="0" column="0" >
- <widget class="ColumnListView" name="columnsWidget" >
- <property name="rootIsDecorated" >
- <bool>false</bool>
- </property>
- <property name="itemsExpandable" >
- <bool>false</bool>
- </property>
- <property name="expandsOnDoubleClick" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="addColumnButton" >
- <property name="toolTip" >
- <string>Add new column</string>
- </property>
- <property name="text" >
- <string>&amp;Add</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="removeColumnButton" >
- <property name="toolTip" >
- <string>Remove selected column</string>
- </property>
- <property name="text" >
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="moveColumnUpButton" >
- <property name="toolTip" >
- <string>Move selected column up</string>
- </property>
- <property name="text" >
- <string>Move &amp;Up</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="QPushButton" name="moveColumnDownButton" >
- <property name="toolTip" >
- <string>Move selected column down</string>
- </property>
- <property name="text" >
- <string>Move &amp;Down</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <spacer name="verticalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>17</width>
- <height>21</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>ColumnListView</class>
- <extends>QTreeView</extends>
- <header>items/database/columnlistview.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/main.cpp b/src/main.cpp
index 0b7ece9..37fabe6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -15,6 +15,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <QDebug>
+#include <QLocale>
#include <QTranslator>
#include <QApplication>
#include "mainwindow.h"
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 0a8a160..52cf5e6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -15,6 +15,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <cmath>
+#include <QApplication>
#include <QByteArray>
#include <QCloseEvent>
#include <QMenuBar>
@@ -28,20 +29,37 @@
#include <QSettings>
#include <QMessageBox>
#include <QDebug>
-#include "mainwindow.h"
-#include "items/database/databasetable.h"
+#include <QDockWidget>
+#include <QStackedWidget>
+#include "diagramitem.h"
+#include "diagramitemfactory.h"
+#include "diagramitemproperties.h"
#include "commands.h"
#include "utils/iconprovider.h"
+#include "mainwindow.h"
using namespace std;
+class MainWindow::MainWindowPrivate
+{
+public:
+ MainWindowPrivate()
+ {}
+
+ QDockWidget *itemPropsDock;
+ QStackedWidget *propertyEditorsStack;
+ QMap<QString, int> propertyEditorsIndexes;
+};
+
MainWindow::MainWindow()
- : QMainWindow(), m_model(NULL)
+ : QMainWindow(), d(new MainWindowPrivate), m_model(NULL)
{
m_undoGroup = new QUndoGroup(this);
- setupActions();
setupUi();
+ setupActions();
+ setupToolBar();
+ setupMenuBar();
newModel();
QIcon icon;
@@ -64,6 +82,7 @@ MainWindow::~MainWindow()
if (m_model) {
m_undoGroup->removeStack(m_model->undoStack());
}
+ delete d;
}
void
@@ -129,20 +148,25 @@ MainWindow::saveWindowState()
void
MainWindow::setupUi()
{
- setupToolBar();
- setupMenuBar();
-
- m_properties = new TableProperties(this, this);
+ d->itemPropsDock = new QDockWidget(tr("&Properties"), this);
+ d->itemPropsDock->setObjectName("itemPropsDock");
+ d->itemPropsDock->setFeatures(
+ QDockWidget::AllDockWidgetFeatures |
+ QDockWidget::DockWidgetVerticalTitleBar);
+ addDockWidget(Qt::BottomDockWidgetArea, d->itemPropsDock);
+
+ d->propertyEditorsStack = new QStackedWidget(d->itemPropsDock);
+ d->propertyEditorsStack->addWidget(new QWidget(this));
+ foreach (QString name, DiagramItemFactory::keys()) {
+ QWidget *editor = DiagramItemFactory::createPropertiesEditor(name, this);
+ if (editor)
+ d->propertyEditorsIndexes[name] = d->propertyEditorsStack->addWidget(editor);
+ }
+ d->itemPropsDock->setWidget(d->propertyEditorsStack);
m_view = new DiagramView(this);
- m_splitter = new QSplitter(Qt::Vertical, this);
- setCentralWidget(m_splitter);
- m_splitter->addWidget(m_view);
- m_splitter->addWidget(m_properties);
-
- m_splitter->setStretchFactor(0, 6);
- m_splitter->setStretchFactor(1, 1);
+ setCentralWidget(m_view);
}
void
@@ -347,6 +371,8 @@ MainWindow::setupMenuBar()
menu->addAction(m_actionDelete);
QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
+ viewMenu->addAction(d->itemPropsDock->toggleViewAction());
+ viewMenu->addSeparator();
viewMenu->addAction(m_actionShowGrid);
menu = menuBar()->addMenu(tr("&Help"));
@@ -493,9 +519,29 @@ MainWindow::newModel(DiagramDocument *newModel)
void
MainWindow::updateSelection()
{
- DatabaseTable *table = m_model->selectedTable();
- m_properties->setTable(table);
- if (table) {
+ QList<DiagramItem *> items = m_model->selectedItems();
+
+ // Update the property editor
+ bool enablePropertiesEditor = false;
+ DiagramItemProperties *previousEditor = qobject_cast<DiagramItemProperties *>(d->propertyEditorsStack->currentWidget());
+ if (previousEditor)
+ previousEditor->setCurrentItem(NULL);
+ if (items.size() == 1) {
+ DiagramItem *item = items.first();
+ QString itemTypeName = item->typeName();
+ if (d->propertyEditorsIndexes.contains(itemTypeName)) {
+ int index = d->propertyEditorsIndexes.value(itemTypeName);
+ d->propertyEditorsStack->setCurrentIndex(index);
+ static_cast<DiagramItemProperties *>(d->propertyEditorsStack->currentWidget())->setCurrentItem(item);
+ enablePropertiesEditor = true;
+ }
+ }
+ if (!enablePropertiesEditor)
+ d->propertyEditorsStack->setCurrentIndex(0);
+ d->propertyEditorsStack->setEnabled(enablePropertiesEditor);
+
+ // Update edit actions
+ if (items.size() > 0) {
m_actionCut->setEnabled(true);
m_actionCopy->setEnabled(true);
m_actionDelete->setEnabled(true);
@@ -597,16 +643,16 @@ MainWindow::updateRecentFileActions()
void
MainWindow::cut()
{
- DatabaseTable *table = m_model->selectedTable();
+/* DatabaseTable *table = m_model->selectedTable();
QApplication::clipboard()->setMimeData(table->toMimeData());
- m_model->deleteSelectedItems();
+ m_model->deleteSelectedItems();*/
}
void
MainWindow::copy()
{
- DatabaseTable *table = m_model->selectedTable();
- QApplication::clipboard()->setMimeData(table->toMimeData());
+/* DatabaseTable *table = m_model->selectedTable();
+ QApplication::clipboard()->setMimeData(table->toMimeData());*/
}
void
diff --git a/src/mainwindow.h b/src/mainwindow.h
index cc52934..d1d3e2a 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -25,7 +25,6 @@
#include <QAction>
#include "diagramview.h"
#include "diagramdocument.h"
-#include "items/database/tableproperties.h"
class MainWindow: public QMainWindow
{
@@ -88,9 +87,10 @@ protected:
void restoreWindowState();
private:
+ class MainWindowPrivate;
+ MainWindowPrivate *const d;
+
QUndoGroup *m_undoGroup;
- QSplitter *m_splitter;
- TableProperties *m_properties;
DiagramView *m_view;
DiagramDocument *m_model;
diff --git a/src/src.pro b/src/src.pro
index d637a89..22d66de 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -10,6 +10,7 @@ SOURCES = \
diagramconnection.cpp \
diagramitem.cpp \
diagramitemfactory.cpp \
+ diagramitemproperties.cpp \
diagramobject.cpp \
commands.cpp
HEADERS = \
@@ -19,6 +20,7 @@ HEADERS = \
diagramconnection.h \
diagramitem.h \
diagramitemfactory.h \
+ diagramitemproperties.h \
diagramobject.h \
range.h \
commands.h
diff --git a/src/utils/factory.h b/src/utils/factory.h
index 0ed4b96..e9c86a5 100644
--- a/src/utils/factory.h
+++ b/src/utils/factory.h
@@ -21,7 +21,24 @@
#include <QStringList>
#include "singelton.h"
-template <typename T, typename TI>
+template <typename TI>
+class FactoryHelperBase
+{
+public:
+ virtual TI *create() = 0;
+};
+
+template <typename TI, typename ST>
+class FactoryHelper : public FactoryHelperBase<TI>
+{
+public:
+ TI *create()
+ {
+ return new ST();
+ }
+};
+
+template <typename T, typename TI, typename Helper>
class Factory : public Singelton<T>
{
public:
@@ -30,7 +47,7 @@ public:
T *inst = T::instance();
if (!inst->m_map.contains(key))
return NULL;
- return inst->m_map[key]();
+ return inst->m_map[key].create();
}
static QStringList keys()
{
@@ -38,10 +55,9 @@ public:
return inst->m_map.keys();
}
protected:
- template <typename ST> void add() { m_map[ST::staticTypeName()] = &(createObject<ST>); }
- template <typename ST> static TI *createObject() { return new ST(); }
+ template <typename ST> void add() { m_map[ST::staticTypeName()] = Helper<TI, ST>(); }
typedef TI *(*CreateFunc)();
- QMap<QString, CreateFunc> m_map;
+ QMap<QString, FactoryHelperBase> m_map;
};
#define FACTORY_ADD_TYPE(ST) add<ST>();
diff --git a/src/utils/singelton.h b/src/utils/singelton.h
index 743c5ba..d791e51 100644
--- a/src/utils/singelton.h
+++ b/src/utils/singelton.h
@@ -27,6 +27,8 @@ public:
_instance = new T();
return _instance;
}
+protected:
+ Singelton() {}
};
#endif
diff --git a/translations/dbmodel_sk.ts b/translations/dbmodel_sk.ts
index 2b267a5..2617dbd 100644
--- a/translations/dbmodel_sk.ts
+++ b/translations/dbmodel_sk.ts
@@ -30,226 +30,272 @@
</message>
</context>
<context>
+ <name>DatabaseRelationshipProperties</name>
+ <message>
+ <location filename="../src/items/database/databaserelationshipproperties.cpp" line="34"/>
+ <source>&amp;Relationship</source>
+ <translation>&amp;Vzťah</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databaserelationshipproperties.cpp" line="44"/>
+ <source>Name:</source>
+ <translation>Názov:</translation>
+ </message>
+</context>
+<context>
+ <name>DatabaseTableProperties</name>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="44"/>
+ <source>&amp;Table</source>
+ <translation>&amp;Tabuľka</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="45"/>
+ <source>&amp;Columns</source>
+ <translation>Stĺ&amp;ce</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="62"/>
+ <source>Name:</source>
+ <translation>Názov:</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="80"/>
+ <source>Move &amp;Up</source>
+ <translation>Posunúť &amp;hore</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="81"/>
+ <source>Move &amp;Down</source>
+ <translation>Posunúť &amp;dole</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="78"/>
+ <source>&amp;Add</source>
+ <translation>Prid&amp;ať</translation>
+ </message>
+ <message>
+ <location filename="../src/items/database/databasetableproperties.cpp" line="79"/>
+ <source>&amp;Remove</source>
+ <translation>Odst&amp;rániť</translation>
+ </message>
+</context>
+<context>
<name>MainWindow</name>
<message>
- <location filename="../src/mainwindow.cpp" line="145"/>
+ <location filename="../src/mainwindow.cpp" line="176"/>
<source>&amp;New</source>
<translation>&amp;Nový</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="147"/>
+ <location filename="../src/mainwindow.cpp" line="179"/>
<source>Ctrl+N</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="151"/>
+ <location filename="../src/mainwindow.cpp" line="183"/>
<source>&amp;Open...</source>
<translation>&amp;Otvoriť...
</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="153"/>
+ <location filename="../src/mainwindow.cpp" line="185"/>
<source>Ctrl+O</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="157"/>
+ <location filename="../src/mainwindow.cpp" line="189"/>
<source>&amp;Save</source>
<translation>&amp;Uložiť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="159"/>
+ <location filename="../src/mainwindow.cpp" line="191"/>
<source>Ctrl+S</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="164"/>
+ <location filename="../src/mainwindow.cpp" line="196"/>
<source>Save &amp;As...</source>
<translation>Uložiť &amp;ako...</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="173"/>
+ <location filename="../src/mainwindow.cpp" line="205"/>
<source>Export...</source>
<translation>Exportovať...</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="183"/>
+ <location filename="../src/mainwindow.cpp" line="215"/>
<source>Select</source>
<translation>Výber</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="189"/>
+ <location filename="../src/mainwindow.cpp" line="221"/>
<source>Add new table</source>
<translation>Pridať novú tabuľku</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="194"/>
+ <location filename="../src/mainwindow.cpp" line="226"/>
<source>Add new relation</source>
<translation>Pridať nový vzťah</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="198"/>
+ <location filename="../src/mainwindow.cpp" line="230"/>
<source>&amp;Undo</source>
<translation>Vrátit &amp;späť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="199"/>
+ <location filename="../src/mainwindow.cpp" line="231"/>
<source>Ctrl+Z</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="201"/>
+ <location filename="../src/mainwindow.cpp" line="233"/>
<source>Re&amp;do</source>
<translation>&amp;Opakovať vrátené</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="202"/>
+ <location filename="../src/mainwindow.cpp" line="234"/>
<source>Ctrl+Shift+Z</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="290"/>
+ <location filename="../src/mainwindow.cpp" line="346"/>
<source>&amp;File</source>
<translation>&amp;Súbor</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="256"/>
+ <location filename="../src/mainwindow.cpp" line="312"/>
<source>&amp;Mode</source>
<translation>&amp;Mód</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>50%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>70%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>85%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>100%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>125%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="265"/>
+ <location filename="../src/mainwindow.cpp" line="321"/>
<source>150%</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="304"/>
+ <location filename="../src/mainwindow.cpp" line="276"/>
<source>&amp;Quit</source>
<translation>&amp;Koniec</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="304"/>
+ <location filename="../src/mainwindow.cpp" line="278"/>
<source>Ctrl+Q</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="228"/>
+ <location filename="../src/mainwindow.cpp" line="260"/>
<source>&amp;Delete</source>
<translation>&amp;Odstrániť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="230"/>
+ <location filename="../src/mainwindow.cpp" line="262"/>
<source>Del</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="418"/>
+ <location filename="../src/mainwindow.cpp" line="485"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="418"/>
+ <location filename="../src/mainwindow.cpp" line="485"/>
<source>Unknown format.</source>
<translation>Neznámy formát.</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="306"/>
+ <location filename="../src/mainwindow.cpp" line="363"/>
<source>&amp;Edit</source>
<translation>&amp;Upraviť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="123"/>
- <source>Database Modeller</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../src/mainwindow.cpp" line="210"/>
+ <location filename="../src/mainwindow.cpp" line="242"/>
<source>Cu&amp;t</source>
<translation>Vystri&amp;hnúť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="212"/>
+ <location filename="../src/mainwindow.cpp" line="244"/>
<source>Ctrl+X</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="216"/>
+ <location filename="../src/mainwindow.cpp" line="248"/>
<source>&amp;Copy</source>
<translation>&amp;Kopírovať</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="218"/>
+ <location filename="../src/mainwindow.cpp" line="250"/>
<source>Ctrl+C</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="222"/>
+ <location filename="../src/mainwindow.cpp" line="254"/>
<source>&amp;Paste</source>
<translation>&amp;Vložiť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="224"/>
+ <location filename="../src/mainwindow.cpp" line="256"/>
<source>Ctrl+V</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="272"/>
+ <location filename="../src/mainwindow.cpp" line="373"/>
<source>&amp;View</source>
<translation>&amp;Zobraziť</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="348"/>
+ <location filename="../src/mainwindow.cpp" line="411"/>
<source>The document has been modified.
Do you want to save your changes?</source>
<translation>Dokument bol zmenený. Chcete uložiť Vaše zmeny?</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="531"/>
+ <location filename="../src/mainwindow.cpp" line="627"/>
<source>&amp;%1. %2</source>
<translation></translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="234"/>
+ <location filename="../src/mainwindow.cpp" line="266"/>
<source>&amp;About...</source>
<translation>&amp;O aplikácii...</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="316"/>
+ <location filename="../src/mainwindow.cpp" line="378"/>
<source>&amp;Help</source>
<translation>&amp;Pomocník</translation>
</message>
<message>
- <location filename="../src/mainwindow.cpp" line="584"/>
+ <location filename="../src/mainwindow.cpp" line="680"/>
<source>About</source>
<translation>O aplikácii</translation>
</message>
<message encoding="UTF-8">
- <location filename="../src/mainwindow.cpp" line="590"/>
+ <location filename="../src/mainwindow.cpp" line="686"/>
<source>&lt;p&gt;
&lt;b&gt;Database Modeller&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://oxygene.sk/lukas/dbmodel/&quot;&gt;http://oxygene.sk/lukas/dbmodel/&lt;/a&gt;&lt;br /&gt;
@@ -258,6 +304,31 @@ Copyright (C) 2008 Lukáš Lalinský
</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="../src/mainwindow.cpp" line="152"/>
+ <source>&amp;Properties</source>
+ <translation>&amp;Vlastnosti</translation>
+ </message>
+ <message>
+ <location filename="../src/mainwindow.cpp" line="270"/>
+ <source>&amp;Close</source>
+ <translation>Za&amp;vrieť</translation>
+ </message>
+ <message>
+ <location filename="../src/mainwindow.cpp" line="272"/>
+ <source>Ctrl+W</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="../src/mainwindow.cpp" line="282"/>
+ <source>Show &amp;Grid</source>
+ <translation>Zobraziť m&amp;riežku</translation>
+ </message>
+ <message>
+ <location filename="../src/mainwindow.cpp" line="695"/>
+ <source>Untitled</source>
+ <translation>Nepomenované</translation>
+ </message>
</context>
<context>
<name>TableProperties</name>