1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/mapeditor/mapsettings.cpp

42 lines
986 B
C++
Raw Normal View History

2022-09-04 02:12:33 +02:00
#include "mapsettings.h"
#include "ui_mapsettings.h"
2022-09-04 18:16:36 +02:00
#include "mainwindow.h"
2022-09-04 02:12:33 +02:00
2022-09-05 02:19:21 +02:00
MapSettings::MapSettings(MapController & ctrl, QWidget *parent) :
QDialog(parent),
2022-09-04 18:16:36 +02:00
ui(new Ui::MapSettings),
2022-09-05 02:19:21 +02:00
controller(ctrl)
2022-09-04 02:12:33 +02:00
{
ui->setupUi(this);
2022-09-04 18:16:36 +02:00
2022-09-05 02:19:21 +02:00
assert(controller.map());
2022-09-04 18:16:36 +02:00
2022-09-05 02:19:21 +02:00
ui->mapNameEdit->setText(QString::fromStdString(controller.map()->name));
ui->mapDescriptionEdit->setPlainText(QString::fromStdString(controller.map()->description));
2022-09-04 18:16:36 +02:00
show();
//ui8 difficulty;
//ui8 levelLimit;
//std::string victoryMessage;
//std::string defeatMessage;
//ui16 victoryIconIndex;
//ui16 defeatIconIndex;
//std::vector<PlayerInfo> players; /// The default size of the vector is PlayerColor::PLAYER_LIMIT.
2022-09-04 02:12:33 +02:00
}
MapSettings::~MapSettings()
{
delete ui;
}
2022-09-04 18:16:36 +02:00
void MapSettings::on_pushButton_clicked()
{
2022-09-05 02:19:21 +02:00
controller.map()->name = ui->mapNameEdit->text().toStdString();
controller.map()->description = ui->mapDescriptionEdit->toPlainText().toStdString();
controller.commitChangeWithoutRedraw();
2022-09-04 18:16:36 +02:00
close();
}