Project

General

Profile

Feature #529 » 0016-Ruledit-Make-edit_terrain-to-inherit-values_dlg.patch

S3_1 - Marko Lindqvist, 05/02/2024 08:38 PM

View differences:

tools/ruledit/edit_terrain.cpp
#include <QCheckBox>
#include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QSpinBox>
#include <QToolButton>
......
/**********************************************************************//**
Setup edit_terrain object
**************************************************************************/
edit_terrain::edit_terrain(ruledit_gui *ui_in, struct terrain *ter_in) : QDialog()
edit_terrain::edit_terrain(ruledit_gui *ui_in, struct terrain *ter_in) : values_dlg()
{
QHBoxLayout *main_layout = new QHBoxLayout(this);
QGridLayout *ter_layout = new QGridLayout();
QLabel *label;
QPushButton *button;
int row = 0;
int rowcount;
int column;
......
ter_layout->addWidget(label, row, 0);
ter_layout->addWidget(gfx_tag_alt, row++, 1);
button = new QPushButton(QString::fromUtf8(R__("Helptext")), this);
connect(button, SIGNAL(pressed()), this, SLOT(helptext()));
ter_layout->addWidget(button, row++, 1);
label = new QLabel(QString::fromUtf8(R__("Native to")));
natives_layout->addWidget(label, 0, 0);
for (int i = 0; i < game.control.num_unit_classes; i++) {
......
int rowcount;
int column;
close_help();
// Save values from text fields.
gfx_tag_given();
gfx_tag_alt_given();
......
sz_strlcpy(ter->graphic_alt, tag_bytes);
}
/**********************************************************************//**
User pressed helptext button
**************************************************************************/
void edit_terrain::helptext()
{
open_help(&ter->helptext);
}
tools/ruledit/edit_terrain.h
// Qt
#include <QDialog>
// ruledit
#include "values_dlg.h"
class QGridLayout;
class QLineEdit;
class QSpinBox;
class ruledit_gui;
class edit_terrain : public QDialog
class edit_terrain : public values_dlg
{
Q_OBJECT
......
void set_defense_value(int value);
void gfx_tag_given();
void gfx_tag_alt_given();
void helptext();
};
#endif // FC__EDIT_TERRAIN_H
(2-2/2)