mirror of
https://github.com/isledecomp/SIEdit.git
synced 2025-03-26 04:33:07 -04:00
app: add ability to edit extra data
This commit is contained in:
parent
f56b409bf1
commit
b022227ef9
2 changed files with 20 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <QFileDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QSplitter>
|
||||
|
@ -66,6 +67,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
{
|
||||
int prow = 0;
|
||||
|
||||
properties_layout->addWidget(new QLabel(tr("Extra")), prow, 0);
|
||||
|
||||
m_extraEdit = new QLineEdit(this);
|
||||
connect(m_extraEdit, &QLineEdit::textChanged, this, &MainWindow::ExtraChanged);
|
||||
properties_layout->addWidget(m_extraEdit, prow, 1);
|
||||
|
||||
prow++;
|
||||
|
||||
properties_layout->addWidget(new QLabel(tr("Location")), prow, 0);
|
||||
|
||||
m_LocationEdit = new Vector3Edit();
|
||||
|
@ -149,6 +158,7 @@ void MainWindow::SetPanel(Panel *panel, si::Object *chunk)
|
|||
properties_group_->setEnabled(chunk);
|
||||
|
||||
if (chunk) {
|
||||
m_extraEdit->setText(QString::fromUtf8(chunk->extra_.data()));
|
||||
m_LocationEdit->SetValue(chunk->location_);
|
||||
m_UpEdit->SetValue(chunk->up_);
|
||||
start_time_edit_->setValue(chunk->time_offset_);
|
||||
|
@ -334,6 +344,14 @@ void MainWindow::ViewSIFile()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::ExtraChanged(const QString &v)
|
||||
{
|
||||
if (last_set_data_) {
|
||||
last_set_data_->extra_ = bytearray(v.toUtf8(), v.size() + 1);
|
||||
last_set_data_->extra_[v.size()] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::LocationChanged(const Vector3 &v)
|
||||
{
|
||||
if (last_set_data_) {
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
|
||||
QGroupBox *properties_group_;
|
||||
|
||||
QLineEdit *m_extraEdit;
|
||||
Vector3Edit *m_LocationEdit;
|
||||
Vector3Edit *m_UpEdit;
|
||||
|
||||
|
@ -77,6 +78,7 @@ private slots:
|
|||
|
||||
void ViewSIFile();
|
||||
|
||||
void ExtraChanged(const QString &v);
|
||||
void LocationChanged(const si::Vector3 &v);
|
||||
void UpChanged(const si::Vector3 &v);
|
||||
void StartTimeChanged(int t);
|
||||
|
|
Loading…
Add table
Reference in a new issue