From dc796cda6ba0a484f2440cc14e783a66a82ec6ba Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 29 Sep 2023 05:03:36 +0300 Subject: [PATCH 43/43] Ruledit: Add building sound tag editing See osdn #48750 Signed-off-by: Marko Lindqvist --- tools/ruledit/edit_impr.cpp | 42 +++++++++++++++++++++++++++++++++++++ tools/ruledit/edit_impr.h | 4 ++++ 2 files changed, 46 insertions(+) diff --git a/tools/ruledit/edit_impr.cpp b/tools/ruledit/edit_impr.cpp index 06b9ab8d7b..fd736a2871 100644 --- a/tools/ruledit/edit_impr.cpp +++ b/tools/ruledit/edit_impr.cpp @@ -114,6 +114,24 @@ edit_impr::edit_impr(ruledit_gui *ui_in, struct impr_type *impr_in) : QDialog() impr_layout->addWidget(label, row, 0); impr_layout->addWidget(gfx_tag_alt2, row++, 1); + label = new QLabel(QString::fromUtf8(R__("Sound tag"))); + label->setParent(this); + + sound_tag = new QLineEdit(this); + connect(sound_tag, SIGNAL(returnPressed()), this, SLOT(sound_tag_given())); + + impr_layout->addWidget(label, row, 0); + impr_layout->addWidget(sound_tag, row++, 1); + + label = new QLabel(QString::fromUtf8(R__("Alt sound tag"))); + label->setParent(this); + + sound_tag_alt = new QLineEdit(this); + connect(sound_tag_alt, SIGNAL(returnPressed()), this, SLOT(sound_tag_alt_given())); + + impr_layout->addWidget(label, row, 0); + impr_layout->addWidget(sound_tag_alt, row++, 1); + refresh(); main_layout->addLayout(impr_layout); @@ -129,6 +147,8 @@ void edit_impr::closeEvent(QCloseEvent *cevent) // Save values from text fields. gfx_tag_given(); gfx_tag_alt_given(); + sound_tag_given(); + sound_tag_alt_given(); impr->ruledit_dlg = nullptr; } @@ -144,6 +164,8 @@ void edit_impr::refresh() gfx_tag->setText(impr->graphic_str); gfx_tag_alt->setText(impr->graphic_alt); gfx_tag_alt2->setText(impr->graphic_alt2); + sound_tag->setText(impr->soundtag); + sound_tag_alt->setText(impr->soundtag_alt); } /**********************************************************************//** @@ -211,3 +233,23 @@ void edit_impr::gfx_tag_alt2_given() sz_strlcpy(impr->graphic_alt2, tag_bytes); } + +/**********************************************************************//** + User entered new sound tag. +**************************************************************************/ +void edit_impr::sound_tag_given() +{ + QByteArray tag_bytes = sound_tag->text().toUtf8(); + + sz_strlcpy(impr->soundtag, tag_bytes); +} + +/**********************************************************************//** + User entered new alternative sound tag. +**************************************************************************/ +void edit_impr::sound_tag_alt_given() +{ + QByteArray tag_bytes = sound_tag_alt->text().toUtf8(); + + sz_strlcpy(impr->soundtag_alt, tag_bytes); +} diff --git a/tools/ruledit/edit_impr.h b/tools/ruledit/edit_impr.h index e49aaf0e9b..fee7dc5d1a 100644 --- a/tools/ruledit/edit_impr.h +++ b/tools/ruledit/edit_impr.h @@ -44,6 +44,8 @@ class edit_impr : public QDialog QLineEdit *gfx_tag; QLineEdit *gfx_tag_alt; QLineEdit *gfx_tag_alt2; + QLineEdit *sound_tag; + QLineEdit *sound_tag_alt; protected: void closeEvent(QCloseEvent *cevent); @@ -55,6 +57,8 @@ class edit_impr : public QDialog void gfx_tag_given(); void gfx_tag_alt_given(); void gfx_tag_alt2_given(); + void sound_tag_given(); + void sound_tag_alt_given(); }; -- 2.40.1