1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
vcmi/mapeditor/mapsettings.h

84 lines
1.8 KiB
C
Raw Normal View History

2022-10-12 23:51:55 +02:00
/*
* mapsettings.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
*
*/
2022-09-24 22:55:05 +02:00
#pragma once
2022-09-18 01:23:17 +02:00
#include <QDialog>
#include "mapcontroller.h"
namespace Ui {
class MapSettings;
}
class MapSettings : public QDialog
{
Q_OBJECT
public:
explicit MapSettings(MapController & controller, QWidget *parent = nullptr);
~MapSettings();
private slots:
void on_pushButton_clicked();
2022-12-03 01:04:03 +02:00
void on_victoryComboBox_currentIndexChanged(int index);
void on_loseComboBox_currentIndexChanged(int index);
2023-04-12 00:13:53 +02:00
void on_heroLevelLimitCheck_toggled(bool checked);
2023-04-17 01:01:29 +02:00
void on_modResolution_map_clicked();
void on_modResolution_full_clicked();
void on_treeMods_itemChanged(QTreeWidgetItem *item, int column);
2022-09-18 01:23:17 +02:00
private:
2022-12-22 04:26:38 +02:00
std::string getTownName(int townObjectIdx);
2022-12-22 14:23:54 +02:00
std::string getHeroName(int townObjectIdx);
2022-12-22 19:58:13 +02:00
std::string getMonsterName(int townObjectIdx);
2022-12-22 14:23:54 +02:00
2023-04-17 01:01:29 +02:00
void updateModWidgetBasedOnMods(const ModCompatibilityInfo & mods);
2022-12-22 14:23:54 +02:00
template<class T>
std::vector<int> getObjectIndexes() const
{
std::vector<int> result;
for(int i = 0; i < controller.map()->objects.size(); ++i)
{
if(auto town = dynamic_cast<T*>(controller.map()->objects[i].get()))
result.push_back(i);
}
return result;
}
template<class T>
int getObjectByPos(const int3 & pos)
{
for(int i = 0; i < controller.map()->objects.size(); ++i)
{
if(auto town = dynamic_cast<T*>(controller.map()->objects[i].get()))
{
if(town->pos == pos)
return i;
}
}
return -1;
}
2022-12-22 04:26:38 +02:00
2022-09-18 01:23:17 +02:00
Ui::MapSettings *ui;
MapController & controller;
2022-12-03 01:04:03 +02:00
QComboBox * victoryTypeWidget = nullptr, * loseTypeWidget = nullptr;
2022-12-22 14:23:54 +02:00
QComboBox * victorySelectWidget = nullptr, * loseSelectWidget = nullptr;
2022-12-03 01:04:03 +02:00
QLineEdit * victoryValueWidget = nullptr, * loseValueWidget = nullptr;
2022-09-18 01:23:17 +02:00
};