Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/sidebar.cc')
-rw-r--r--src/sidebar.cc45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/sidebar.cc b/src/sidebar.cc
index 1cdc590..ed757d4 100644
--- a/src/sidebar.cc
+++ b/src/sidebar.cc
@@ -5,10 +5,11 @@
the GNU General Public License version 2
*/
-#include <QVBoxLayout>
+#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
+#include <QVBoxLayout>
#include "sidebar.h"
#include "entitywidget.h"
@@ -78,6 +79,20 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
box_entityradius->addWidget(edit_entityradius);
connect(edit_entityradius, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityRadius(const QString &)));
+ // template
+ QHBoxLayout *box_entitytemplate = new QHBoxLayout();
+ QLabel *label_entitytemplate = new QLabel(tr("template"));
+ combo_entitytemplate_type = new QComboBox();
+ combo_entitytemplate_type->addItem(tr("template"));
+ combo_entitytemplate_type->addItem(tr("ship"));
+ combo_entitytemplate_type->setEditable(false);
+ edit_entitytemplate = new QLineEdit();
+ box_entitytemplate->addWidget(label_entitytemplate);
+ box_entitytemplate->addWidget(combo_entitytemplate_type);
+ box_entitytemplate->addWidget(edit_entitytemplate);
+ connect(combo_entitytemplate_type, SIGNAL(activated(int)), this, SLOT(updateEntityTemplateType(int)));
+ connect(edit_entitytemplate, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityTemplateLabel(const QString &)));
+
// entity values
QLabel *label_entityproperties = new QLabel(tr("properties"));
text_entityvalues = new QTextEdit();
@@ -110,6 +125,8 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
box_global->addLayout(box_entityangles);
box_global->addLayout(box_entityradius);
+ box_global->addLayout(box_entitytemplate);
+
box_global->addWidget(label_entityproperties);
box_global->addWidget(text_entityvalues,1);
@@ -226,6 +243,20 @@ void SideBar::updateEntityRadius(const QString &value)
}
}
+void SideBar::updateEntityTemplateType(int template_type)
+{
+ if (last_selected) {
+ last_selected->set_template_type(template_type);
+ }
+}
+
+void SideBar::UpdateEntityTemplateLabel(const QString &template_label)
+{
+ if (last_selected) {
+ last_selected->set_template_label(template_label);
+ }
+}
+
void SideBar::updateEntityValues()
{
if (last_selected) {
@@ -281,6 +312,12 @@ void SideBar::setProperties(EntityProperties *properties)
edit_entityradius->setEnabled(false);
edit_entityradius->clear();
+ combo_entitytemplate_type->setEnabled(false);
+ combo_entitytemplate_type->setCurrentIndex(0);
+
+ edit_entitytemplate->setEnabled(false);
+ edit_entitytemplate->clear();
+
text_entityvalues->setEnabled(false);
text_entityvalues->clear();
@@ -332,6 +369,12 @@ void SideBar::setProperties(EntityProperties *properties)
value.setNum(properties->radius());
edit_entityradius->setText(value);
+ combo_entitytemplate_type->setEnabled(true);
+ combo_entitytemplate_type->setCurrentIndex(properties->template_type());
+
+ edit_entitytemplate->setEnabled(true);
+ edit_entitytemplate->setText(properties->template_label());
+
text_entityvalues->setEnabled(true);
text_entityvalues->setPlainText(properties->values());