From 745eb5ceb19a0ae7e54594ec92420fccc7707569 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 29 Sep 2023 05:08:45 +0300 Subject: [PATCH 41/41] 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 9f536137db..aea9fd2bc9 100644 --- a/tools/ruledit/edit_impr.cpp +++ b/tools/ruledit/edit_impr.cpp @@ -105,6 +105,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_alt, 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); @@ -120,6 +138,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; } @@ -134,6 +154,8 @@ void edit_impr::refresh() genus_button->setText(impr_genus_id_name(impr->genus)); gfx_tag->setText(impr->graphic_str); gfx_tag_alt->setText(impr->graphic_alt); + sound_tag->setText(impr->soundtag); + sound_tag_alt->setText(impr->soundtag_alt); } /**********************************************************************//** @@ -191,3 +213,23 @@ void edit_impr::gfx_tag_alt_given() sz_strlcpy(impr->graphic_alt, 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 ab6baf55cb..3816a830eb 100644 --- a/tools/ruledit/edit_impr.h +++ b/tools/ruledit/edit_impr.h @@ -43,6 +43,8 @@ class edit_impr : public QDialog QToolButton *genus_button; QLineEdit *gfx_tag; QLineEdit *gfx_tag_alt; + QLineEdit *sound_tag; + QLineEdit *sound_tag_alt; protected: void closeEvent(QCloseEvent *cevent); @@ -53,6 +55,8 @@ class edit_impr : public QDialog void genus_menu(QAction *action); void gfx_tag_given(); void gfx_tag_alt_given(); + void sound_tag_given(); + void sound_tag_alt_given(); }; -- 2.40.1