mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-07 23:33:15 +02:00
banned entities in template editor
This commit is contained in:
@@ -57,7 +57,7 @@ if(ENABLE_TEMPLATE_EDITOR)
|
|||||||
templateeditor/graphicelements/CardItem.cpp
|
templateeditor/graphicelements/CardItem.cpp
|
||||||
templateeditor/graphicelements/LineItem.cpp
|
templateeditor/graphicelements/LineItem.cpp
|
||||||
templateeditor/GeometryAlgorithm.cpp
|
templateeditor/GeometryAlgorithm.cpp
|
||||||
templateeditor/terrainselector.cpp
|
templateeditor/entitiesselector.cpp
|
||||||
templateeditor/factionselector.cpp
|
templateeditor/factionselector.cpp
|
||||||
templateeditor/mineselector.cpp
|
templateeditor/mineselector.cpp
|
||||||
templateeditor/treasureselector.cpp
|
templateeditor/treasureselector.cpp
|
||||||
@@ -124,7 +124,7 @@ if(ENABLE_TEMPLATE_EDITOR)
|
|||||||
templateeditor/graphicelements/CardItem.h
|
templateeditor/graphicelements/CardItem.h
|
||||||
templateeditor/graphicelements/LineItem.h
|
templateeditor/graphicelements/LineItem.h
|
||||||
templateeditor/GeometryAlgorithm.h
|
templateeditor/GeometryAlgorithm.h
|
||||||
templateeditor/terrainselector.h
|
templateeditor/entitiesselector.h
|
||||||
templateeditor/factionselector.h
|
templateeditor/factionselector.h
|
||||||
templateeditor/mineselector.h
|
templateeditor/mineselector.h
|
||||||
templateeditor/treasureselector.h
|
templateeditor/treasureselector.h
|
||||||
@@ -169,7 +169,7 @@ if(ENABLE_TEMPLATE_EDITOR)
|
|||||||
set(editor_FORMS
|
set(editor_FORMS
|
||||||
${editor_FORMS}
|
${editor_FORMS}
|
||||||
templateeditor/templateeditor.ui
|
templateeditor/templateeditor.ui
|
||||||
templateeditor/terrainselector.ui
|
templateeditor/entitiesselector.ui
|
||||||
templateeditor/factionselector.ui
|
templateeditor/factionselector.ui
|
||||||
templateeditor/mineselector.ui
|
templateeditor/mineselector.ui
|
||||||
templateeditor/treasureselector.ui
|
templateeditor/treasureselector.ui
|
||||||
|
|||||||
135
mapeditor/templateeditor/entitiesselector.cpp
Normal file
135
mapeditor/templateeditor/entitiesselector.cpp
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* entitiesselector.cpp, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdInc.h"
|
||||||
|
|
||||||
|
#include "entitiesselector.h"
|
||||||
|
#include "ui_entitiesselector.h"
|
||||||
|
|
||||||
|
#include "../../lib/GameLibrary.h"
|
||||||
|
#include "../../lib/TerrainHandler.h"
|
||||||
|
#include "../../lib/spells/CSpellHandler.h"
|
||||||
|
#include "../../lib/CSkillHandler.h"
|
||||||
|
#include "../../lib/entities/artifact/CArtHandler.h"
|
||||||
|
#include "../../lib/entities/hero/CHeroHandler.h"
|
||||||
|
|
||||||
|
template<typename T, typename Variant>
|
||||||
|
size_t countInVariantSet(const Variant& var, const T& value) {
|
||||||
|
return std::visit([&](const auto& setRefWrapper) -> size_t {
|
||||||
|
const auto& setRef = setRefWrapper.get();
|
||||||
|
using SetType = std::decay_t<decltype(setRef)>;
|
||||||
|
using ValueType = typename SetType::value_type;
|
||||||
|
if constexpr (std::is_same_v<ValueType, T>) {
|
||||||
|
return setRef.count(value);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}, var);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename HandlerType, typename VariantSet>
|
||||||
|
void fillListWidgetFromHandler(QListWidget* listWidget, const HandlerType* handler, const VariantSet& entities)
|
||||||
|
{
|
||||||
|
listWidget->clear();
|
||||||
|
|
||||||
|
for (auto const& objectPtr : handler->objects)
|
||||||
|
{
|
||||||
|
auto* item = new QListWidgetItem(QString::fromStdString(objectPtr->getNameTranslated()));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(objectPtr->getIndex()));
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
|
item->setCheckState(countInVariantSet(entities, objectPtr->getId()) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
listWidget->addItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||||
|
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||||
|
|
||||||
|
using HandlerVariant = std::variant<
|
||||||
|
const TerrainTypeHandler*,
|
||||||
|
const CSpellHandler*,
|
||||||
|
const CArtHandler*,
|
||||||
|
const CSkillHandler*,
|
||||||
|
const CHeroHandler*
|
||||||
|
>;
|
||||||
|
|
||||||
|
EntitiesSelector::EntitiesSelector(EntityIds & entities) :
|
||||||
|
ui(new Ui::EntitiesSelector),
|
||||||
|
entitiesSelected(entities)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
|
HandlerVariant handler;
|
||||||
|
std::visit(overloaded{
|
||||||
|
[&](std::reference_wrapper<std::set<TerrainId>> terrainSet) {
|
||||||
|
handler = LIBRARY->terrainTypeHandler.get();
|
||||||
|
setWindowTitle(tr("Terrain Selector"));
|
||||||
|
},
|
||||||
|
[&](std::reference_wrapper<std::set<SpellID>> spellSet) {
|
||||||
|
handler = LIBRARY->spellh.get();
|
||||||
|
setWindowTitle(tr("Spell Selector"));
|
||||||
|
},
|
||||||
|
[&](std::reference_wrapper<std::set<ArtifactID>> artifactSet) {
|
||||||
|
handler = LIBRARY->arth.get();
|
||||||
|
setWindowTitle(tr("Artifact Selector"));
|
||||||
|
},
|
||||||
|
[&](std::reference_wrapper<std::set<SecondarySkill>> secondarySkillSet) {
|
||||||
|
handler = LIBRARY->skillh.get();
|
||||||
|
setWindowTitle(tr("Skill Selector"));
|
||||||
|
},
|
||||||
|
[&](std::reference_wrapper<std::set<HeroTypeID>> heroTypeSet) {
|
||||||
|
handler = LIBRARY->heroh.get();
|
||||||
|
setWindowTitle(tr("Hero Type Selector"));
|
||||||
|
}
|
||||||
|
}, entitiesSelected);
|
||||||
|
std::visit([&](auto const* handlerPtr){
|
||||||
|
fillListWidgetFromHandler(ui->listWidgetEntities, handlerPtr, entities);
|
||||||
|
}, handler);
|
||||||
|
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntitiesSelector::showEntitiesSelector(EntityIds & entities)
|
||||||
|
{
|
||||||
|
auto * dialog = new EntitiesSelector(entities);
|
||||||
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
dialog->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntitiesSelector::on_buttonBoxResult_accepted()
|
||||||
|
{
|
||||||
|
std::visit([](auto& setRefWrapper) {
|
||||||
|
setRefWrapper.get().clear();
|
||||||
|
}, entitiesSelected);
|
||||||
|
for(int i = 0; i < ui->listWidgetEntities->count(); ++i)
|
||||||
|
{
|
||||||
|
auto * item = ui->listWidgetEntities->item(i);
|
||||||
|
if(item->checkState() == Qt::Checked)
|
||||||
|
{
|
||||||
|
int id = item->data(Qt::UserRole).toInt();
|
||||||
|
|
||||||
|
std::visit([id](auto& setRefWrapper) {
|
||||||
|
using SetType = std::decay_t<decltype(setRefWrapper.get())>;
|
||||||
|
using ValueType = typename SetType::value_type;
|
||||||
|
ValueType value{id};
|
||||||
|
setRefWrapper.get().insert(std::move(value));
|
||||||
|
}, entitiesSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntitiesSelector::on_buttonBoxResult_rejected()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
39
mapeditor/templateeditor/entitiesselector.h
Normal file
39
mapeditor/templateeditor/entitiesselector.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* entitiesselector.h, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "../StdInc.h"
|
||||||
|
#include "../../lib/constants/EntityIdentifiers.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EntitiesSelector;
|
||||||
|
}
|
||||||
|
|
||||||
|
using EntityIds = std::variant<std::reference_wrapper<std::set<TerrainId>>, std::reference_wrapper<std::set<SpellID>>, std::reference_wrapper<std::set<ArtifactID>>, std::reference_wrapper<std::set<SecondarySkill>>, std::reference_wrapper<std::set<HeroTypeID>>>;
|
||||||
|
|
||||||
|
class EntitiesSelector : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EntitiesSelector(EntityIds & entities);
|
||||||
|
|
||||||
|
static void showEntitiesSelector(EntityIds & entities);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_buttonBoxResult_accepted();
|
||||||
|
void on_buttonBoxResult_rejected();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::EntitiesSelector *ui;
|
||||||
|
|
||||||
|
EntityIds & entitiesSelected;
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>TerrainSelector</class>
|
<class>EntitiesSelector</class>
|
||||||
<widget class="QDialog" name="TerrainSelector">
|
<widget class="QDialog" name="EntitiesSelector">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -11,18 +11,18 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Select Terrains</string>
|
<string>Select Entities</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelTerrains">
|
<widget class="QLabel" name="labelEntities">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select Terrains</string>
|
<string>Select Entities</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidgetTerrains"/>
|
<widget class="QListWidget" name="listWidgetEntities"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBoxResult">
|
<widget class="QDialogButtonBox" name="buttonBoxResult">
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "ui_templateeditor.h"
|
#include "ui_templateeditor.h"
|
||||||
#include "graphicelements/CardItem.h"
|
#include "graphicelements/CardItem.h"
|
||||||
#include "graphicelements/LineItem.h"
|
#include "graphicelements/LineItem.h"
|
||||||
#include "terrainselector.h"
|
#include "entitiesselector.h"
|
||||||
#include "factionselector.h"
|
#include "factionselector.h"
|
||||||
#include "mineselector.h"
|
#include "mineselector.h"
|
||||||
#include "treasureselector.h"
|
#include "treasureselector.h"
|
||||||
@@ -1012,12 +1012,14 @@ void TemplateEditor::on_pushButtonConnectionAdd_clicked()
|
|||||||
|
|
||||||
void TemplateEditor::on_pushButtonOpenTerrainTypes_clicked()
|
void TemplateEditor::on_pushButtonOpenTerrainTypes_clicked()
|
||||||
{
|
{
|
||||||
TerrainSelector::showTerrainSelector(templates[selectedTemplate]->getZones().at(selectedZone)->terrainTypes);
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->getZones().at(selectedZone)->terrainTypes);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemplateEditor::on_pushButtonOpenBannedTerrainTypes_clicked()
|
void TemplateEditor::on_pushButtonOpenBannedTerrainTypes_clicked()
|
||||||
{
|
{
|
||||||
TerrainSelector::showTerrainSelector(templates[selectedTemplate]->getZones().at(selectedZone)->bannedTerrains);
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->getZones().at(selectedZone)->bannedTerrains);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemplateEditor::on_pushButtonAllowedTowns_clicked()
|
void TemplateEditor::on_pushButtonAllowedTowns_clicked()
|
||||||
@@ -1062,3 +1064,27 @@ void TemplateEditor::on_pushButtonCustomObjects_clicked()
|
|||||||
//TODO: Implement dialog
|
//TODO: Implement dialog
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Not implemented yet!"));
|
QMessageBox::critical(this, tr("Error"), tr("Not implemented yet!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TemplateEditor::on_pushButtonEntitiesBannedSpells_clicked()
|
||||||
|
{
|
||||||
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->bannedSpells);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TemplateEditor::on_pushButtonEntitiesBannedArtifacts_clicked()
|
||||||
|
{
|
||||||
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->bannedArtifacts);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TemplateEditor::on_pushButtonEntitiesBannedSkills_clicked()
|
||||||
|
{
|
||||||
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->bannedSkills);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TemplateEditor::on_pushButtonEntitiesBannedHeroes_clicked()
|
||||||
|
{
|
||||||
|
EntityIds entitiesVariant = std::ref(templates[selectedTemplate]->bannedHeroes);
|
||||||
|
EntitiesSelector::showEntitiesSelector(entitiesVariant);
|
||||||
|
}
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ private slots:
|
|||||||
void on_pushButtonTreasure_clicked();
|
void on_pushButtonTreasure_clicked();
|
||||||
void on_pushButtonMines_clicked();
|
void on_pushButtonMines_clicked();
|
||||||
void on_pushButtonCustomObjects_clicked();
|
void on_pushButtonCustomObjects_clicked();
|
||||||
|
void on_pushButtonEntitiesBannedSpells_clicked();
|
||||||
|
void on_pushButtonEntitiesBannedArtifacts_clicked();
|
||||||
|
void on_pushButtonEntitiesBannedSkills_clicked();
|
||||||
|
void on_pushButtonEntitiesBannedHeroes_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool getAnswerAboutUnsavedChanges();
|
bool getAnswerAboutUnsavedChanges();
|
||||||
|
|||||||
@@ -200,15 +200,15 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageGeneral">
|
<widget class="QWidget" name="pageGeneral">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-148</y>
|
<y>-316</y>
|
||||||
<width>449</width>
|
<width>449</width>
|
||||||
<height>662</height>
|
<height>830</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
@@ -496,6 +496,43 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxEntities">
|
||||||
|
<property name="title">
|
||||||
|
<string>Entities</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonEntitiesBannedSpells">
|
||||||
|
<property name="text">
|
||||||
|
<string>Banned Spells</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonEntitiesBannedArtifacts">
|
||||||
|
<property name="text">
|
||||||
|
<string>Banned Artifacts</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonEntitiesBannedSkills">
|
||||||
|
<property name="text">
|
||||||
|
<string>Banned Skills</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonEntitiesBannedHeroes">
|
||||||
|
<property name="text">
|
||||||
|
<string>Banned Heroes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -515,7 +552,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-980</y>
|
<y>0</y>
|
||||||
<width>449</width>
|
<width>449</width>
|
||||||
<height>1494</height>
|
<height>1494</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* terrainselector.cpp, part of VCMI engine
|
|
||||||
*
|
|
||||||
* Authors: listed in file AUTHORS in main folder
|
|
||||||
*
|
|
||||||
* License: GNU General Public License v2.0 or later
|
|
||||||
* Full text of license available in license.txt file, in main folder
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "StdInc.h"
|
|
||||||
|
|
||||||
#include "terrainselector.h"
|
|
||||||
#include "ui_terrainselector.h"
|
|
||||||
|
|
||||||
#include "../../lib/GameLibrary.h"
|
|
||||||
#include "../../lib/TerrainHandler.h"
|
|
||||||
|
|
||||||
TerrainSelector::TerrainSelector(std::set<TerrainId> & terrains) :
|
|
||||||
ui(new Ui::TerrainSelector),
|
|
||||||
terrainsSelected(terrains)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
setWindowTitle(tr("Terrain Selector"));
|
|
||||||
|
|
||||||
setWindowModality(Qt::ApplicationModal);
|
|
||||||
|
|
||||||
for(auto const & objectPtr : LIBRARY->terrainTypeHandler->objects)
|
|
||||||
{
|
|
||||||
auto * item = new QListWidgetItem(QString::fromStdString(objectPtr->getNameTranslated()));
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(objectPtr->getIndex()));
|
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
|
||||||
item->setCheckState(terrains.count(objectPtr->getId()) ? Qt::Checked : Qt::Unchecked);
|
|
||||||
ui->listWidgetTerrains->addItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TerrainSelector::showTerrainSelector(std::set<TerrainId> & terrains)
|
|
||||||
{
|
|
||||||
auto * dialog = new TerrainSelector(terrains);
|
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
dialog->exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TerrainSelector::on_buttonBoxResult_accepted()
|
|
||||||
{
|
|
||||||
terrainsSelected.clear();
|
|
||||||
for(int i = 0; i < ui->listWidgetTerrains->count(); ++i)
|
|
||||||
{
|
|
||||||
auto * item = ui->listWidgetTerrains->item(i);
|
|
||||||
if(item->checkState() == Qt::Checked)
|
|
||||||
terrainsSelected.insert(item->data(Qt::UserRole).toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TerrainSelector::on_buttonBoxResult_rejected()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* terrainselector.h, part of VCMI engine
|
|
||||||
*
|
|
||||||
* Authors: listed in file AUTHORS in main folder
|
|
||||||
*
|
|
||||||
* License: GNU General Public License v2.0 or later
|
|
||||||
* Full text of license available in license.txt file, in main folder
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#include "../StdInc.h"
|
|
||||||
#include "../../lib/constants/EntityIdentifiers.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class TerrainSelector;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TerrainSelector : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit TerrainSelector(std::set<TerrainId> & terrains);
|
|
||||||
|
|
||||||
static void showTerrainSelector(std::set<TerrainId> & terrains);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_buttonBoxResult_accepted();
|
|
||||||
void on_buttonBoxResult_rejected();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::TerrainSelector *ui;
|
|
||||||
|
|
||||||
std::set<TerrainId> & terrainsSelected;
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user