From 96f17eaf3a1f66d7eefd66e51e2137ea404459f4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 19 Feb 2012 11:54:26 +0000 Subject: Read entity properties, added entity selection and scaling. --- src/editorwindow.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/editorwindow.cc') diff --git a/src/editorwindow.cc b/src/editorwindow.cc index 20e8403..3435d43 100644 --- a/src/editorwindow.cc +++ b/src/editorwindow.cc @@ -23,6 +23,7 @@ EditorWindow::EditorWindow(QWidget *parent) : QWidget(parent) { editorwindow_mapwidget = new MapWidget(this); editorwindow_sidebar = new SideBar(this); + connect(editorwindow_mapwidget, SIGNAL(selected(MapEntity *)), editorwindow_sidebar, SLOT(setEntity(MapEntity *))); } void EditorWindow::resizeEvent (QResizeEvent *event) @@ -53,13 +54,14 @@ bool EditorWindow::loadFile(const QString &filename) MapEntity *entity = 0; bool in_entity = false; float x, y, z; + float f; QString str; while (ini.getline(textstream)) { if (ini.got_section()) { - qDebug() << "got section" << ini.section(); + //qDebug() << "got section" << ini.section(); if (ini.got_section("zone")) { in_entity = false; @@ -84,6 +86,7 @@ bool EditorWindow::loadFile(const QString &filename) } else if (ini.got_section("planet")) { in_entity = true; + } else { entity = 0; in_entity = false; @@ -96,10 +99,22 @@ bool EditorWindow::loadFile(const QString &filename) } else if(ini.got_key()) { if (in_entity) { + // read entity properties into the MapWidget instance + if (ini.got_key_vector3f("location" , x, y, z)) { entity->set_location(x, y, z); //qDebug() << "got location " << x << " " << y << " " << z; + + } else if (ini.got_key_string("label", str)) { + entity->set_label(str); + + } else if (ini.got_key_string("name", str)) { + entity->set_name(str); + + } else if (ini.got_key_float("radius", f)) { + entity->set_radius(f); } + } else if (ini.in_section("zone")) { if (ini.got_key_string("name", str)) { -- cgit v1.2.3