From db96e33ffd47da60bba918df32922ef9c07bf2be Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 13 Nov 2018 11:36:34 -0600 Subject: [PATCH] Begin event view overhaul --- forms/eventpropertiesframe.ui | 944 +++++++++++++++++++++++++++++++--- forms/mainwindow.ui | 389 +++++++++++--- src/mainwindow.cpp | 107 +++- 3 files changed, 1271 insertions(+), 169 deletions(-) diff --git a/forms/eventpropertiesframe.ui b/forms/eventpropertiesframe.ui index 5007d951..af691bcc 100644 --- a/forms/eventpropertiesframe.ui +++ b/forms/eventpropertiesframe.ui @@ -7,7 +7,7 @@ 0 0 284 - 146 + 1084 @@ -37,7 +37,7 @@ 1 - + @@ -200,63 +200,890 @@ - - - - 0 - 0 - - - - - 9 - - - 0 - - - 0 - - - - - Sprite - - - comboBox_sprite - - + + + + + + + + Sprite + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - + + + + + + Movement + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Movement Radius X + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Movement Radius Y + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Script + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Event Flag + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Trainer + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Sight Radius / Berry Tree ID + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Destination Map + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Destination Warp + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Script + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Var + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Var Value + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Weather + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Player Facing Direction + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Script + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Item + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + Flag + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + + + + + + + + + + Secret Base ID + + + comboBox_sprite + + + + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + + + @@ -279,7 +1106,6 @@ spinBox_x spinBox_y spinBox_z - comboBox_sprite diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index eac8a866..5037faef 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -158,7 +158,7 @@ - 0 + 1 false @@ -1177,7 +1177,7 @@ - + true @@ -1340,89 +1340,6 @@ 3 - - - - Selected - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QAbstractScrollArea::AdjustIgnored - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 428 - 586 - - - - - 0 - 0 - - - - - - - - - - - @@ -1537,6 +1454,308 @@ + + + + 4 + + + + Objects + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 432 + 584 + + + + + 0 + 0 + + + + + + + + + + Warps + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 432 + 584 + + + + + 0 + 0 + + + + + + + + + + Triggers + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 432 + 584 + + + + + 0 + 0 + + + + + + + + + + BGs + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 432 + 584 + + + + + 0 + 0 + + + + + + + + + + Multiple + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 432 + 565 + + + + + 0 + 0 + + + + + + + + + + + + + There are no events on the current map. + + + Qt::AlignCenter + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e1b4fdab..b34168a1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -892,6 +892,7 @@ void MainWindow::updateSelectedObjects() { editor->selected_events->append(selectedEvent); editor->redrawObject(selectedEvent); events->append(selectedEvent); + } } @@ -938,7 +939,7 @@ void MainWindow::updateSelectedObjects() { frame->ui->label_spritePixmap->setPixmap(item->event->pixmap); connect(item, SIGNAL(spriteChanged(QPixmap)), frame->ui->label_spritePixmap, SLOT(setPixmap(QPixmap))); - frame->ui->sprite->setVisible(false); + /*frame->ui->sprite->setVisible(false); QMap field_labels; field_labels["script_label"] = "Script"; @@ -960,32 +961,45 @@ void MainWindow::updateSelectedObjects() { field_labels["flag"] = "Flag"; field_labels["secret_base_id"] = "Secret Base Id"; - QStringList fields; + QStringList fields;*/ + + for (QWidget *widget : frame->findChildren(QString(), Qt::FindDirectChildrenOnly)) + { + widget->hide(); + } if (event_type == EventType::Object) { - frame->ui->sprite->setVisible(true); + frame->ui->object->setVisible(true); frame->ui->comboBox_sprite->addItems(event_obj_gfx_constants.keys()); frame->ui->comboBox_sprite->setCurrentText(item->event->get("sprite")); connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString))); - /* - frame->ui->script->setVisible(true); - frame->ui->comboBox_script->addItem(item->event->get("script_label")); + frame->ui->comboBox_movement->setCurrentText(item->event->get("movement_type")); + item->bind(frame->ui->comboBox_movement, "movement_type"); + + frame->ui->comboBox_movementRadiusX->setCurrentText(item->event->get("radius_x")); + item->bind(frame->ui->comboBox_movementRadiusX, "radius_x"); + + frame->ui->comboBox_movementRadiusY->setCurrentText(item->event->get("radius_y")); + item->bind(frame->ui->comboBox_movementRadiusY, "radius_y"); + + //frame->ui->script->setVisible(true); + //frame->ui->comboBox_script->addItem(item->event->get("script_label")); frame->ui->comboBox_script->setCurrentText(item->event->get("script_label")); //item->bind(frame->ui->comboBox_script, "script_label"); - connect(frame->ui->comboBox_script, SIGNAL(activated(QString)), item, SLOT(set_script(QString))); + //connect(frame->ui->comboBox_script, SIGNAL(activated(QString)), item, SLOT(set_script(QString))); //connect(frame->ui->comboBox_script, static_cast(&QComboBox::activated), item, [item](QString script_label){ item->event->put("script_label", script_label); }); //connect(item, SIGNAL(scriptChanged(QString)), frame->ui->comboBox_script, SLOT(setValue(QString))); - */ + item->bind(frame->ui->comboBox_script, "script_label"); - fields << "movement_type"; + /*fields << "movement_type"; fields << "radius_x"; fields << "radius_y"; fields << "script_label"; fields << "event_flag"; fields << "is_trainer"; - fields << "sight_radius_tree_id"; + fields << "sight_radius_tree_id";*/ } else if (event_type == EventType::Warp) { fields << "destination_map_name"; @@ -1116,26 +1130,69 @@ void MainWindow::updateSelectedObjects() { //int scroll = ui->scrollArea_4->verticalScrollBar()->value(); - QWidget *target = ui->scrollAreaWidgetContents; + QWidget *target = ui->eventsMultiple_ScrollAreaContents; - if (target->children().length()) { - qDeleteAll(target->children()); + if (events->length() == 1) + { + QString event_type = (*events)[0]->event->get("event_type"); + + if (event_type == EventType::Object) { + target = ui->eventsObjects_ScrollAreaContents; + ui->tabWidget_EventType->setCurrentIndex(0); + } + else if (event_type == EventType::Warp) { + target = ui->eventsWarps_ScrollAreaContents; + ui->tabWidget_EventType->setCurrentIndex(1); + } + else if (event_type == EventType::CoordScript || event_type == EventType::CoordWeather) { + target = ui->eventsTriggers_ScrollAreaContents; + ui->tabWidget_EventType->setCurrentIndex(2); + } + else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) { + target = ui->eventsBGs_ScrollAreaContents; + ui->tabWidget_EventType->setCurrentIndex(3); + } + ui->tabWidget_EventType->removeTab(ui->tabWidget_EventType->indexOf(ui->tab_Multiple)); + + if (target->children().length()) { + qDeleteAll(target->children()); + } + } + else if (events->length() > 1) + { + ui->tabWidget_EventType->addTab(ui->tab_Multiple, "Multiple"); + ui->tabWidget_EventType->setCurrentWidget(ui->tab_Multiple); } - QVBoxLayout *layout = new QVBoxLayout(target); - target->setLayout(layout); - ui->scrollArea_4->setWidgetResizable(true); - ui->scrollArea_4->setWidget(target); + if (events->length() != 0) + { + if (target->children().length()) { + qDeleteAll(target->children()); + } - for (EventPropertiesFrame *frame : frames) { - layout->addWidget(frame); + QVBoxLayout *layout = new QVBoxLayout(target); + target->setLayout(layout); + //ui->scrollArea_4->setWidgetResizable(true); + //ui->scrollArea_4->setWidget(target); + + for (EventPropertiesFrame *frame : frames) { + layout->addWidget(frame); + } + + layout->addStretch(1); + + // doesn't work + //QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); + //ui->scrollArea_4->ensureVisible(0, scroll); + + ui->label_NoEvents->hide(); + ui->tabWidget_EventType->show(); + } + else + { + ui->tabWidget_EventType->hide(); + ui->label_NoEvents->show(); } - - layout->addStretch(1); - - // doesn't work - //QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - //ui->scrollArea_4->ensureVisible(0, scroll); } void MainWindow::on_toolButton_deleteObject_clicked()