diff options
-rw-r--r-- | src/editorwindow.cc | 2 | ||||
-rw-r--r-- | src/entityproperties.cc | 5 | ||||
-rw-r--r-- | src/mainwindow.cc | 8 | ||||
-rw-r--r-- | src/sidebar.cc | 32 | ||||
-rw-r--r-- | src/sidebar.h | 4 |
5 files changed, 36 insertions, 15 deletions
diff --git a/src/editorwindow.cc b/src/editorwindow.cc index c0f5e41..f54bd6e 100644 --- a/src/editorwindow.cc +++ b/src/editorwindow.cc @@ -13,7 +13,7 @@ #include <QtGui> #include <QFile> - #include <QSplitter> +#include <QSplitter> #include <QTextStream> #include <QDebug> diff --git a/src/entityproperties.cc b/src/entityproperties.cc index 3a0dff6..88de704 100644 --- a/src/entityproperties.cc +++ b/src/entityproperties.cc @@ -10,10 +10,13 @@ namespace editor { -EntityProperties::EntityProperties() +EntityProperties::EntityProperties() : + Properties(), + properties_type("entity") { properties_radius = 0; properties_template_type = 0; + } EntityProperties::~EntityProperties() diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 18f9630..414c07b 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -214,12 +214,16 @@ void MainWindow::slot_add() void MainWindow::slot_delete() { - qDebug() << "slot_delete"; + if (active_child()) { + active_child()->deleteSelected(); + } } void MainWindow::slot_duplicate() { - qDebug() << "slot_duplicate"; + if (active_child()) { + active_child()->duplicateSelected(); + } } } diff --git a/src/sidebar.cc b/src/sidebar.cc index 9412dc9..44fd56e 100644 --- a/src/sidebar.cc +++ b/src/sidebar.cc @@ -24,8 +24,22 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent) label_zone->setAlignment(Qt::AlignHCenter); // entity type - label_entitytype = new QLabel(tr("[type]")); - label_entitytype->setAlignment(Qt::AlignHCenter); + QHBoxLayout *box_entitytype = new QHBoxLayout(); + QLabel *label_entitytype = new QLabel(tr("type")); + combo_entitytype = new QComboBox(); + // TODO this should probably be read from entities.ini + // note that EditorWindow::loadFile should use the same list + combo_entitytype->addItem(tr("entity")); + combo_entitytype->addItem(tr("planet")); + combo_entitytype->addItem(tr("station")); + combo_entitytype->addItem(tr("star")); + combo_entitytype->addItem(tr("jumpgate")); + combo_entitytype->addItem(tr("jumppoint")); + combo_entitytype->addItem(tr("navpoint")); + combo_entitytype->setEditable(true); + box_entitytype->addWidget(label_entitytype); + box_entitytype->addWidget(combo_entitytype); + // entity label QHBoxLayout *box_entitylabel = new QHBoxLayout(); @@ -115,9 +129,9 @@ SideBar::SideBar(QWidget *parent) : QWidget(parent) QVBoxLayout *box_global = new QVBoxLayout(); box_global->addWidget(label_zone); - box_global->addSpacing(8); + box_global->addSpacing(16); - box_global->addWidget(label_entitytype); + box_global->addLayout(box_entitytype); box_global->addLayout(box_entitylabel); box_global->addLayout(box_entityname); @@ -283,7 +297,9 @@ void SideBar::setProperties(EntityProperties *properties) last_selected = properties; if (!properties) { - label_entitytype->clear(); + + combo_entitytype->setEnabled(false); + combo_entitytype->clearEditText(); edit_entitylabel->setEnabled(false); edit_entitylabel->clear(); @@ -330,10 +346,8 @@ void SideBar::setProperties(EntityProperties *properties) } else { QString value; - value = '['; - value += properties->type(); - value += ']'; - label_entitytype->setText(value); + combo_entitytype->setEnabled(true); + combo_entitytype->setEditText(properties->type()); edit_entitylabel->setEnabled(true); edit_entitylabel->setText(properties->label()); diff --git a/src/sidebar.h b/src/sidebar.h index f919b33..0b03f78 100644 --- a/src/sidebar.h +++ b/src/sidebar.h @@ -81,8 +81,8 @@ signals: private: QLabel *label_zone; - QLabel *label_entitytype; - QLineEdit *edit_entitylabel; + QComboBox *combo_entitytype; + QLineEdit *edit_entitylabel; QLineEdit *edit_entityname; QLineEdit *edit_entitylocation_x; |