From edaf63323dfb5cff1aa2187bf1e1244c88ed0cae Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 26 Feb 2012 11:52:25 +0000 Subject: Mapped edit entity actions to MapWidget, added initial addEntity action. --- src/editorwindow.cc | 15 +++++++++++++++ src/editorwindow.h | 16 ++++++++++++++++ src/mainwindow.cc | 4 +++- src/mapwidget.cc | 10 ++++++++++ src/mapwidget.h | 11 +++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/editorwindow.cc b/src/editorwindow.cc index 2423cff..c0f5e41 100644 --- a/src/editorwindow.cc +++ b/src/editorwindow.cc @@ -242,5 +242,20 @@ bool EditorWindow::saveFile(const QString &filename) } +void EditorWindow::addEntity() +{ + EntityWidget *entitywidget = editorwindow_mapwidget->addEntity(); + entitywidget->properties()->set_type("entity"); +} + +void EditorWindow::duplicateSelected() +{ + editorwindow_mapwidget->duplicateSelected(); +} + +void EditorWindow::deleteSelected() +{ + editorwindow_mapwidget->duplicateSelected(); +} } diff --git a/src/editorwindow.h b/src/editorwindow.h index 89dcae4..12aec59 100644 --- a/src/editorwindow.h +++ b/src/editorwindow.h @@ -43,6 +43,22 @@ public slots: bool loadFile(const QString &filename); bool saveFile(const QString &filename); + + /** + * @brief add a new entity to the map + * */ + void addEntity(); + + /** + * @brief delete selected entities + * */ + void deleteSelected(); + + /** + * @brief duplicate selected entities + * */ + void duplicateSelected(); + protected: virtual void resizeEvent (QResizeEvent *event); diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 6985506..18f9630 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -207,7 +207,9 @@ void MainWindow::slot_save() void MainWindow::slot_add() { - qDebug() << "slot_add"; + if (active_child()) { + active_child()->addEntity(); + } } void MainWindow::slot_delete() diff --git a/src/mapwidget.cc b/src/mapwidget.cc index fe84ada..44ed785 100644 --- a/src/mapwidget.cc +++ b/src/mapwidget.cc @@ -280,4 +280,14 @@ void MapWidget::save(QTextStream &textstream) } } +void MapWidget::duplicateSelected() +{ + +} + +void MapWidget::deleteSelected() +{ + +} + } diff --git a/src/mapwidget.h b/src/mapwidget.h index a7dbb66..087fd3d 100644 --- a/src/mapwidget.h +++ b/src/mapwidget.h @@ -86,6 +86,17 @@ public slots: * */ void resizeChildren(); + /** + * @brief delete selected entities + * */ + void deleteSelected(); + + /** + * @brief duplicate selected entities + * */ + void duplicateSelected(); + + private slots: /** * @brief called when an entity on the map has been clicked -- cgit v1.2.3