Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-02-19 22:11:38 +0000
committerStijn Buys <ingar@osirion.org>2012-02-19 22:11:38 +0000
commit43c292e1dda7c789a31cdb679065c75d8f8cebba (patch)
treed4ebeebe2adf53d688942f786f42fcdbc21bad1c
parentc3afc2172e6a272e330ae6c2a3aad377eb876ba9 (diff)
Added entity type label.
-rw-r--r--src/editorwindow.cc1
-rw-r--r--src/entityproperties.h17
-rw-r--r--src/sidebar.cc19
-rw-r--r--src/sidebar.h1
4 files changed, 35 insertions, 3 deletions
diff --git a/src/editorwindow.cc b/src/editorwindow.cc
index 5ae0be8..759263f 100644
--- a/src/editorwindow.cc
+++ b/src/editorwindow.cc
@@ -115,6 +115,7 @@ bool EditorWindow::loadFile(const QString &filename)
if (in_entity) {
entity = editorwindow_mapwidget->addEntity();
+ entity->properties()->set_type(ini.section());
}
if (entity && in_subsection) {
entity->properties()->add_subsection(ini.section());
diff --git a/src/entityproperties.h b/src/entityproperties.h
index 9ea38b5..6189309 100644
--- a/src/entityproperties.h
+++ b/src/entityproperties.h
@@ -25,6 +25,13 @@ public:
/* ---- inspectors ---- */
/**
+ * @brief returns the type string of this object
+ * */
+ inline const QString & type() const {
+ return properties_type;
+ }
+
+ /**
* @brief returns the object radius
* */
inline const float radius() const {
@@ -49,7 +56,14 @@ public:
* @brief add a value key pair to the subsection string of this object
* */
void add_subsection_value(const QString &key, const QString &value);
-
+
+ /**
+ * @brief set the type string of this object
+ * */
+ inline void set_type(const QString &type) {
+ properties_type = type;
+ }
+
/**
* @brief set the object radius
* */
@@ -61,6 +75,7 @@ private:
float properties_radius;
QString properties_subsections;
+ QString properties_type;
};
} // namespace editor
diff --git a/src/sidebar.cc b/src/sidebar.cc
index f3ac033..0a75b1b 100644
--- a/src/sidebar.cc
+++ b/src/sidebar.cc
@@ -22,11 +22,16 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
label_zone = new QLabel(tr("Zone Name"));
label_zone->setAlignment(Qt::AlignHCenter);
+ // entity type
+ label_entitytype = new QLabel(tr("[type]"));
+ label_entitytype->setAlignment(Qt::AlignHCenter);
+
// entity label
QHBoxLayout *box_entitylabel = new QHBoxLayout();
QLabel *label_entitylabel = new QLabel(tr("label"));
- edit_entitylabel = new QLineEdit(tr("entity_label"));
+ edit_entitylabel = new QLineEdit(tr("entity_label"));
+
box_entitylabel->addWidget(label_entitylabel);
box_entitylabel->addWidget(edit_entitylabel);
@@ -70,6 +75,9 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
box_global->addWidget(label_zone);
box_global->addSpacing(8);
+
+ box_global->addWidget(label_entitytype);
+
box_global->addLayout(box_entitylabel);
box_global->addLayout(box_entityname);
box_global->addLayout(box_entitylocation);
@@ -129,6 +137,8 @@ void SideBar::setProperties(EntityProperties *properties)
last_selected = properties;
if (!properties) {
+ label_entitytype->clear();
+
edit_entitylabel->setEnabled(false);
edit_entitylabel->clear();
@@ -155,7 +165,12 @@ void SideBar::setProperties(EntityProperties *properties)
} else {
QString value;
-
+
+ value = '[';
+ value += properties->type();
+ value += ']';
+ label_entitytype->setText(value);
+
edit_entitylabel->setEnabled(true);
edit_entitylabel->setText(properties->label());
diff --git a/src/sidebar.h b/src/sidebar.h
index 0f6b35c..cfa87c7 100644
--- a/src/sidebar.h
+++ b/src/sidebar.h
@@ -58,6 +58,7 @@ signals:
private:
QLabel *label_zone;
+ QLabel *label_entitytype;
QLineEdit *edit_entitylabel;
QLineEdit *edit_entityname;