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.cc95
1 files changed, 71 insertions, 24 deletions
diff --git a/src/sidebar.cc b/src/sidebar.cc
index 44fd56e..9299f40 100644
--- a/src/sidebar.cc
+++ b/src/sidebar.cc
@@ -10,6 +10,7 @@
#include <QLineEdit>
#include <QTextEdit>
#include <QVBoxLayout>
+#include <QSplitter>
#include "sidebar.h"
#include "entitywidget.h"
@@ -19,10 +20,16 @@ namespace editor
SideBar::SideBar(QWidget *parent) : QWidget(parent)
{
+ // global vertical layout
+ QVBoxLayout *box_global = new QVBoxLayout();
+
// zone name
label_zone = new QLabel(tr("Zone Name"));
label_zone->setAlignment(Qt::AlignHCenter);
+ box_global->addWidget(label_zone);
+ box_global->addSpacing(16);
+
// entity type
QHBoxLayout *box_entitytype = new QHBoxLayout();
QLabel *label_entitytype = new QLabel(tr("type"));
@@ -37,9 +44,13 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
combo_entitytype->addItem(tr("jumppoint"));
combo_entitytype->addItem(tr("navpoint"));
combo_entitytype->setEditable(true);
+
box_entitytype->addWidget(label_entitytype);
box_entitytype->addWidget(combo_entitytype);
+ box_global->addLayout(box_entitytype);
+
+ connect(combo_entitytype, SIGNAL(editTextChanged(const QString &)), this, SLOT(updateEntityType(const QString &)));
// entity label
QHBoxLayout *box_entitylabel = new QHBoxLayout();
@@ -47,26 +58,37 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
edit_entitylabel = new QLineEdit(tr("entity_label"));
box_entitylabel->addWidget(label_entitylabel);
box_entitylabel->addWidget(edit_entitylabel);
+
+ box_global->addLayout(box_entitylabel);
+
connect(edit_entitylabel, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityLabel(const QString &)));
// entity name
QHBoxLayout *box_entityname = new QHBoxLayout();
QLabel *label_entityname = new QLabel(tr("name"));
edit_entityname = new QLineEdit(tr("Entity Name"));
+
box_entityname->addWidget(label_entityname);
box_entityname->addWidget(edit_entityname);
- connect(edit_entityname, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityName(const QString &)));
+ box_global->addLayout(box_entityname);
+
+ connect(edit_entityname, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityName(const QString &)));
+
// entity location
QHBoxLayout *box_entitylocation = new QHBoxLayout();
QLabel *label_entitylocation = new QLabel(tr("location"));
edit_entitylocation_x = new QLineEdit(tr("x"));
edit_entitylocation_y = new QLineEdit(tr("y"));
edit_entitylocation_z = new QLineEdit(tr("z"));
+
box_entitylocation->addWidget(label_entitylocation);
box_entitylocation->addWidget(edit_entitylocation_x);
box_entitylocation->addWidget(edit_entitylocation_y);
box_entitylocation->addWidget(edit_entitylocation_z);
+
+ box_global->addLayout(box_entitylocation);
+
connect(edit_entitylocation_x, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityLocationX(const QString &)));
connect(edit_entitylocation_y, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityLocationY(const QString &)));
connect(edit_entitylocation_z, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityLocationZ(const QString &)));
@@ -77,10 +99,14 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
edit_entityangles_yaw = new QLineEdit(tr("yaw"));
edit_entityangles_pitch = new QLineEdit(tr("pitch"));
edit_entityangles_roll = new QLineEdit(tr("roll"));
+
box_entityangles->addWidget(label_entityangles);
box_entityangles->addWidget(edit_entityangles_yaw);
box_entityangles->addWidget(edit_entityangles_pitch);
box_entityangles->addWidget(edit_entityangles_roll);
+
+ box_global->addLayout(box_entityangles);
+
connect(edit_entityangles_yaw, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityAnglesYaw(const QString &)));
connect(edit_entityangles_pitch, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityAnglesPitch(const QString &)));
connect(edit_entityangles_roll, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityAnglesRoll(const QString &)));
@@ -89,8 +115,12 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
QHBoxLayout *box_entityradius = new QHBoxLayout();
QLabel *label_entityradius = new QLabel(tr("radius"));
edit_entityradius = new QLineEdit(tr("radius"));
+
box_entityradius->addWidget(label_entityradius);
box_entityradius->addWidget(edit_entityradius);
+
+ box_global->addLayout(box_entityradius);
+
connect(edit_entityradius, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityRadius(const QString &)));
// template
@@ -101,60 +131,77 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent)
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);
+
+ box_global->addLayout(box_entitytemplate);
+
connect(combo_entitytemplate_type, SIGNAL(activated(int)), this, SLOT(updateEntityTemplateType(int)));
connect(edit_entitytemplate, SIGNAL(textChanged(const QString &)), this, SLOT(updateEntityTemplateLabel(const QString &)));
+ QSplitter *splitter_global = new QSplitter(Qt::Vertical);
+
// entity values
+ QVBoxLayout *box_values = new QVBoxLayout();
+ QWidget *container_values = new QWidget();
QLabel *label_entityproperties = new QLabel(tr("properties"));
text_entityvalues = new QTextEdit();
text_entityvalues ->setTabChangesFocus(true);
+
+ box_values->addWidget(label_entityproperties);
+ box_values->addWidget(text_entityvalues,1);
+
+ container_values->setLayout(box_values);
+ splitter_global->addWidget(container_values);
+
connect(text_entityvalues, SIGNAL(textChanged()), this, SLOT(updateEntityValues()));
// entity info
+ QVBoxLayout *box_info = new QVBoxLayout();
+ QWidget *container_info = new QWidget();
QLabel *label_info = new QLabel(tr("info"));
text_info = new QTextEdit();
text_info ->setTabChangesFocus(true);
+
+ box_info->addWidget(label_info);
+ box_info->addWidget(text_info,1);
+
+ container_info->setLayout(box_info);
+ splitter_global->addWidget(container_info);
+
connect(text_info, SIGNAL(textChanged()), this, SLOT(updateEntityInfo()));
// entity subsections
+ QVBoxLayout *box_subsections = new QVBoxLayout();
+ QWidget *container_subsections = new QWidget();
QLabel *label_entitysubsections = new QLabel(tr("subsections"));
text_subsections = new QTextEdit();
text_subsections ->setTabChangesFocus(true);
- connect(text_subsections, SIGNAL(textChanged()), this, SLOT(updateEntitySubSections()));
-
- // global vertical layout
- QVBoxLayout *box_global = new QVBoxLayout();
-
- box_global->addWidget(label_zone);
- box_global->addSpacing(16);
-
- box_global->addLayout(box_entitytype);
-
- box_global->addLayout(box_entitylabel);
- box_global->addLayout(box_entityname);
- box_global->addLayout(box_entitylocation);
- 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);
+ box_subsections->addWidget(label_entitysubsections);
+ box_subsections->addWidget(text_subsections,1);
- box_global->addWidget(label_info);
- box_global->addWidget(text_info,1);
+ container_subsections->setLayout(box_subsections);
+ splitter_global->addWidget(container_subsections);
- box_global->addWidget(label_entitysubsections);
- box_global->addWidget(text_subsections,1);
+ box_global->addWidget(splitter_global);
+ connect(text_subsections, SIGNAL(textChanged()), this, SLOT(updateEntitySubSections()));
+
setLayout(box_global);
setProperties(0);
}
+void SideBar::updateEntityType(const QString &value)
+{
+ if (last_selected) {
+ last_selected->set_type(value);
+ }
+}
+
void SideBar::updateEntityLabel(const QString &value)
{
if (last_selected) {