diff options
Diffstat (limited to 'src/sidebar.cc')
-rw-r--r-- | src/sidebar.cc | 32 |
1 files changed, 23 insertions, 9 deletions
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()); |