1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Confirmation before close

This commit is contained in:
nordsoft 2022-09-10 04:04:38 +04:00
parent 7acaa1daa9
commit 0a81c82971
2 changed files with 170 additions and 133 deletions

View File

@ -144,6 +144,20 @@ MainWindow::~MainWindow()
delete ui; delete ui;
} }
void MainWindow::closeEvent(QCloseEvent *event)
{
if(unsaved)
{
auto sure = QMessageBox::question(this, "Confirmation", "You have unsaved changes, are you sure that you want to quit?");
if(sure == QMessageBox::No)
{
event->ignore();
return;
}
}
QMainWindow::closeEvent(event);
}
void MainWindow::setStatusMessage(const QString & status) void MainWindow::setStatusMessage(const QString & status)
{ {
statusBar()->showMessage(status); statusBar()->showMessage(status);
@ -306,11 +320,11 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticO
if(catalog.count(ID)) if(catalog.count(ID))
continue; continue;
addGroupIntoCatalog(groupName, staticOnly, ID); addGroupIntoCatalog(groupName, true, staticOnly, ID);
} }
} }
void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticOnly, int ID) void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool useCustomName, bool staticOnly, int ID)
{ {
QStandardItem * itemGroup = nullptr; QStandardItem * itemGroup = nullptr;
auto itms = objectsModel.findItems(QString::fromStdString(groupName)); auto itms = objectsModel.findItems(QString::fromStdString(groupName));
@ -325,7 +339,6 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticO
} }
auto knownSubObjects = VLC->objtypeh->knownSubObjects(ID); auto knownSubObjects = VLC->objtypeh->knownSubObjects(ID);
bool singleSubObject = knownSubObjects.size() == 1;
for(auto secondaryID : knownSubObjects) for(auto secondaryID : knownSubObjects)
{ {
auto factory = VLC->objtypeh->getHandlerFor(ID, secondaryID); auto factory = VLC->objtypeh->getHandlerFor(ID, secondaryID);
@ -334,7 +347,12 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticO
if(staticOnly && !factory->isStaticObject()) if(staticOnly && !factory->isStaticObject())
continue; continue;
auto * itemType = new QStandardItem(QString::fromStdString(factory->subTypeName)); auto subGroupName = QString::fromStdString(factory->subTypeName);
auto customName = factory->getCustomName();
if(customName)
subGroupName = tr(customName->c_str());
auto * itemType = new QStandardItem(subGroupName);
for(int templateId = 0; templateId < templates.size(); ++templateId) for(int templateId = 0; templateId < templates.size(); ++templateId)
{ {
auto templ = templates[templateId]; auto templ = templates[templateId];
@ -364,15 +382,23 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticO
{"animationEditor", QString::fromStdString(templ.editorAnimationFile)}, {"animationEditor", QString::fromStdString(templ.editorAnimationFile)},
{"animation", QString::fromStdString(templ.animationFile)}, {"animation", QString::fromStdString(templ.animationFile)},
{"preview", jsonFromPixmap(preview)}}; {"preview", jsonFromPixmap(preview)}};
//create object to extract name
std::unique_ptr<CGObjectInstance> temporaryObj(factory->create(templ));
QString translated = useCustomName ? tr(temporaryObj->getObjectName().c_str()) : subGroupName;
//do not have extra level //do not have extra level
if(singleTemplate) if(singleTemplate)
{ {
if(useCustomName)
itemType->setText(translated);
itemType->setIcon(QIcon(preview)); itemType->setIcon(QIcon(preview));
itemType->setData(data); itemType->setData(data);
} }
else else
{ {
if(useCustomName)
itemType->setText(translated);
auto * item = new QStandardItem(QIcon(preview), QString::fromStdString(templ.stringID)); auto * item = new QStandardItem(QIcon(preview), QString::fromStdString(templ.stringID));
item->setData(data); item->setData(data);
itemType->appendRow(item); itemType->appendRow(item);
@ -385,6 +411,8 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool staticO
void MainWindow::loadObjectsTree() void MainWindow::loadObjectsTree()
{ {
try
{
ui->terrainFilterCombo->addItem(""); ui->terrainFilterCombo->addItem("");
//adding terrains //adding terrains
for(auto & terrain : Terrain::Manager::terrains()) for(auto & terrain : Terrain::Manager::terrains())
@ -416,146 +444,153 @@ void MainWindow::loadObjectsTree()
//adding objects //adding objects
addGroupIntoCatalog("TOWNS", false, Obj::TOWN); addGroupIntoCatalog("TOWNS", false, false, Obj::TOWN);
addGroupIntoCatalog("TOWNS", false, Obj::RANDOM_TOWN); addGroupIntoCatalog("TOWNS", false, false, Obj::RANDOM_TOWN);
addGroupIntoCatalog("TOWNS", false, Obj::SHIPYARD); addGroupIntoCatalog("TOWNS", true, false, Obj::SHIPYARD);
addGroupIntoCatalog("TOWNS", false, Obj::GARRISON); addGroupIntoCatalog("TOWNS", true, false, Obj::GARRISON);
addGroupIntoCatalog("TOWNS", false, Obj::GARRISON2); addGroupIntoCatalog("TOWNS", true, false, Obj::GARRISON2);
addGroupIntoCatalog("MISC", false, Obj::ALTAR_OF_SACRIFICE); addGroupIntoCatalog("MISC", true, false, Obj::ALTAR_OF_SACRIFICE);
addGroupIntoCatalog("MISC", false, Obj::ARENA); addGroupIntoCatalog("MISC", true, false, Obj::ARENA);
addGroupIntoCatalog("MISC", false, Obj::BLACK_MARKET); addGroupIntoCatalog("MISC", true, false, Obj::BLACK_MARKET);
addGroupIntoCatalog("MISC", false, Obj::BORDERGUARD); addGroupIntoCatalog("MISC", true, false, Obj::BUOY);
addGroupIntoCatalog("MISC", false, Obj::KEYMASTER); addGroupIntoCatalog("MISC", true, false, Obj::CARTOGRAPHER);
addGroupIntoCatalog("MISC", false, Obj::BUOY); addGroupIntoCatalog("MISC", true, false, Obj::SWAN_POND);
addGroupIntoCatalog("MISC", false, Obj::CAMPFIRE); addGroupIntoCatalog("MISC", true, false, Obj::COVER_OF_DARKNESS);
addGroupIntoCatalog("MISC", false, Obj::CARTOGRAPHER); addGroupIntoCatalog("MISC", true, false, Obj::CORPSE);
addGroupIntoCatalog("MISC", false, Obj::SWAN_POND); addGroupIntoCatalog("MISC", true, false, Obj::FAERIE_RING);
addGroupIntoCatalog("MISC", false, Obj::COVER_OF_DARKNESS); addGroupIntoCatalog("MISC", true, false, Obj::FOUNTAIN_OF_FORTUNE);
addGroupIntoCatalog("MISC", false, Obj::CORPSE); addGroupIntoCatalog("MISC", true, false, Obj::FOUNTAIN_OF_YOUTH);
addGroupIntoCatalog("MISC", false, Obj::MARLETTO_TOWER); addGroupIntoCatalog("MISC", true, false, Obj::GARDEN_OF_REVELATION);
addGroupIntoCatalog("MISC", false, Obj::DERELICT_SHIP); addGroupIntoCatalog("MISC", true, false, Obj::HILL_FORT);
addGroupIntoCatalog("MISC", false, Obj::FAERIE_RING); addGroupIntoCatalog("MISC", true, false, Obj::IDOL_OF_FORTUNE);
addGroupIntoCatalog("MISC", false, Obj::FLOTSAM); addGroupIntoCatalog("MISC", true, false, Obj::LIBRARY_OF_ENLIGHTENMENT);
addGroupIntoCatalog("MISC", false, Obj::FOUNTAIN_OF_FORTUNE); //addGroupIntoCatalog("MISC", true, false, Obj::LIGHTHOUSE); //TODO: allow to edit owner
addGroupIntoCatalog("MISC", false, Obj::FOUNTAIN_OF_YOUTH); addGroupIntoCatalog("MISC", true, false, Obj::SCHOOL_OF_MAGIC);
addGroupIntoCatalog("MISC", false, Obj::GARDEN_OF_REVELATION); addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_SPRING);
addGroupIntoCatalog("MISC", false, Obj::HILL_FORT); addGroupIntoCatalog("MISC", true, false, Obj::MAGIC_WELL);
addGroupIntoCatalog("MISC", false, Obj::IDOL_OF_FORTUNE); addGroupIntoCatalog("MISC", true, false, Obj::MERCENARY_CAMP);
addGroupIntoCatalog("MISC", false, Obj::LIBRARY_OF_ENLIGHTENMENT); addGroupIntoCatalog("MISC", true, false, Obj::MERMAID);
addGroupIntoCatalog("MISC", false, Obj::LIGHTHOUSE); addGroupIntoCatalog("MISC", true, false, Obj::MYSTICAL_GARDEN);
addGroupIntoCatalog("MISC", false, Obj::SCHOOL_OF_MAGIC); addGroupIntoCatalog("MISC", true, false, Obj::OASIS);
addGroupIntoCatalog("MISC", false, Obj::MAGIC_SPRING); addGroupIntoCatalog("MISC", true, false, Obj::LEAN_TO);
addGroupIntoCatalog("MISC", false, Obj::MAGIC_WELL); addGroupIntoCatalog("MISC", true, false, Obj::OBELISK);
addGroupIntoCatalog("MISC", false, Obj::MERCENARY_CAMP); addGroupIntoCatalog("MISC", true, false, Obj::REDWOOD_OBSERVATORY);
addGroupIntoCatalog("MISC", false, Obj::MERMAID); addGroupIntoCatalog("MISC", true, false, Obj::PILLAR_OF_FIRE);
addGroupIntoCatalog("MISC", false, Obj::MYSTICAL_GARDEN); addGroupIntoCatalog("MISC", true, false, Obj::STAR_AXIS);
addGroupIntoCatalog("MISC", false, Obj::OASIS); addGroupIntoCatalog("MISC", true, false, Obj::RALLY_FLAG);
addGroupIntoCatalog("MISC", false, Obj::OBELISK); addGroupIntoCatalog("MISC", true, false, Obj::WATERING_HOLE);
addGroupIntoCatalog("MISC", false, Obj::REDWOOD_OBSERVATORY); addGroupIntoCatalog("MISC", true, false, Obj::SCHOLAR);
addGroupIntoCatalog("MISC", false, Obj::OCEAN_BOTTLE); addGroupIntoCatalog("MISC", true, false, Obj::SHRINE_OF_MAGIC_INCANTATION);
addGroupIntoCatalog("MISC", false, Obj::PILLAR_OF_FIRE); addGroupIntoCatalog("MISC", true, false, Obj::SHRINE_OF_MAGIC_GESTURE);
addGroupIntoCatalog("MISC", false, Obj::STAR_AXIS); addGroupIntoCatalog("MISC", true, false, Obj::SHRINE_OF_MAGIC_THOUGHT);
addGroupIntoCatalog("MISC", false, Obj::RALLY_FLAG); addGroupIntoCatalog("MISC", true, false, Obj::SIRENS);
addGroupIntoCatalog("MISC", false, Obj::LEAN_TO); addGroupIntoCatalog("MISC", true, false, Obj::STABLES);
addGroupIntoCatalog("MISC", false, Obj::WATERING_HOLE); addGroupIntoCatalog("MISC", true, false, Obj::TAVERN);
addGroupIntoCatalog("PRISON", false, Obj::PRISON); addGroupIntoCatalog("MISC", true, false, Obj::TEMPLE);
addGroupIntoCatalog("ARTIFACTS", false, Obj::ARTIFACT); addGroupIntoCatalog("MISC", true, false, Obj::DEN_OF_THIEVES);
addGroupIntoCatalog("ARTIFACTS", false, Obj::RANDOM_ART); addGroupIntoCatalog("MISC", true, false, Obj::TRADING_POST);
addGroupIntoCatalog("ARTIFACTS", false, Obj::RANDOM_TREASURE_ART); addGroupIntoCatalog("MISC", true, false, Obj::TRADING_POST_SNOW);
addGroupIntoCatalog("ARTIFACTS", false, Obj::RANDOM_MINOR_ART); addGroupIntoCatalog("MISC", true, false, Obj::LEARNING_STONE);
addGroupIntoCatalog("ARTIFACTS", false, Obj::RANDOM_MAJOR_ART); addGroupIntoCatalog("MISC", true, false, Obj::TREE_OF_KNOWLEDGE);
addGroupIntoCatalog("ARTIFACTS", false, Obj::RANDOM_RELIC_ART); addGroupIntoCatalog("MISC", true, false, Obj::UNIVERSITY);
addGroupIntoCatalog("RESOURCES", false, Obj::PANDORAS_BOX); addGroupIntoCatalog("MISC", true, false, Obj::WAGON);
addGroupIntoCatalog("RESOURCES", false, Obj::RANDOM_RESOURCE); addGroupIntoCatalog("MISC", true, false, Obj::SCHOOL_OF_WAR);
addGroupIntoCatalog("RESOURCES", false, Obj::RESOURCE); addGroupIntoCatalog("MISC", true, false, Obj::WAR_MACHINE_FACTORY);
addGroupIntoCatalog("RESOURCES", false, Obj::SEA_CHEST); addGroupIntoCatalog("MISC", true, false, Obj::WARRIORS_TOMB);
addGroupIntoCatalog("RESOURCES", false, Obj::TREASURE_CHEST); addGroupIntoCatalog("MISC", true, false, Obj::WITCH_HUT);
addGroupIntoCatalog("RESOURCES", false, Obj::SPELL_SCROLL); addGroupIntoCatalog("MISC", true, false, Obj::FREELANCERS_GUILD);
addGroupIntoCatalog("BANKS", false, Obj::CREATURE_BANK); addGroupIntoCatalog("MISC", true, false, Obj::SANCTUARY);
addGroupIntoCatalog("BANKS", false, Obj::DRAGON_UTOPIA); addGroupIntoCatalog("MISC", true, false, Obj::MARLETTO_TOWER);
addGroupIntoCatalog("DWELLINGS", false, Obj::CREATURE_GENERATOR1); //addGroupIntoCatalog("PRISON", true, false, Obj::PRISON);
addGroupIntoCatalog("DWELLINGS", false, Obj::CREATURE_GENERATOR2); addGroupIntoCatalog("ARTIFACTS", true, false, Obj::ARTIFACT);
addGroupIntoCatalog("DWELLINGS", false, Obj::CREATURE_GENERATOR3); addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_ART);
addGroupIntoCatalog("DWELLINGS", false, Obj::CREATURE_GENERATOR4); addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_TREASURE_ART);
addGroupIntoCatalog("DWELLINGS", false, Obj::RANDOM_DWELLING); addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_MINOR_ART);
addGroupIntoCatalog("DWELLINGS", false, Obj::RANDOM_DWELLING_LVL); addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_MAJOR_ART);
addGroupIntoCatalog("DWELLINGS", false, Obj::RANDOM_DWELLING_FACTION); addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_RELIC_ART);
addGroupIntoCatalog("GROUNDS", false, Obj::CURSED_GROUND1); addGroupIntoCatalog("ARTIFACTS", true, false, Obj::SPELL_SCROLL);
addGroupIntoCatalog("GROUNDS", false, Obj::MAGIC_PLAINS1); addGroupIntoCatalog("RESOURCES", true, false, Obj::PANDORAS_BOX);
addGroupIntoCatalog("GROUNDS", false, Obj::CLOVER_FIELD); addGroupIntoCatalog("RESOURCES", true, false, Obj::RANDOM_RESOURCE);
addGroupIntoCatalog("GROUNDS", false, Obj::CURSED_GROUND2); addGroupIntoCatalog("RESOURCES", false, false, Obj::RESOURCE);
addGroupIntoCatalog("GROUNDS", false, Obj::EVIL_FOG); addGroupIntoCatalog("RESOURCES", true, false, Obj::SEA_CHEST);
addGroupIntoCatalog("GROUNDS", false, Obj::FAVORABLE_WINDS); addGroupIntoCatalog("RESOURCES", true, false, Obj::TREASURE_CHEST);
addGroupIntoCatalog("GROUNDS", false, Obj::FIERY_FIELDS); addGroupIntoCatalog("RESOURCES", true, false, Obj::CAMPFIRE);
addGroupIntoCatalog("GROUNDS", false, Obj::HOLY_GROUNDS); addGroupIntoCatalog("RESOURCES", true, false, Obj::SHIPWRECK_SURVIVOR);
addGroupIntoCatalog("GROUNDS", false, Obj::LUCID_POOLS); addGroupIntoCatalog("RESOURCES", true, false, Obj::FLOTSAM);
addGroupIntoCatalog("GROUNDS", false, Obj::MAGIC_CLOUDS); addGroupIntoCatalog("BANKS", true, false, Obj::CREATURE_BANK);
addGroupIntoCatalog("GROUNDS", false, Obj::MAGIC_PLAINS2); addGroupIntoCatalog("BANKS", true, false, Obj::DRAGON_UTOPIA);
addGroupIntoCatalog("GROUNDS", false, Obj::ROCKLANDS); addGroupIntoCatalog("BANKS", true, false, Obj::CRYPT);
addGroupIntoCatalog("TELEPORTS", false, Obj::MONOLITH_ONE_WAY_ENTRANCE); addGroupIntoCatalog("BANKS", true, false, Obj::DERELICT_SHIP);
addGroupIntoCatalog("TELEPORTS", false, Obj::MONOLITH_ONE_WAY_EXIT); addGroupIntoCatalog("BANKS", true, false, Obj::PYRAMID);
addGroupIntoCatalog("TELEPORTS", false, Obj::MONOLITH_TWO_WAY); addGroupIntoCatalog("BANKS", true, false, Obj::SHIPWRECK);
addGroupIntoCatalog("TELEPORTS", false, Obj::SUBTERRANEAN_GATE); addGroupIntoCatalog("DWELLINGS", true, false, Obj::CREATURE_GENERATOR1);
addGroupIntoCatalog("TELEPORTS", false, Obj::WHIRLPOOL); addGroupIntoCatalog("DWELLINGS", true, false, Obj::CREATURE_GENERATOR2);
addGroupIntoCatalog("MINES", false, Obj::MINE); addGroupIntoCatalog("DWELLINGS", true, false, Obj::CREATURE_GENERATOR3);
addGroupIntoCatalog("MINES", false, Obj::ABANDONED_MINE); addGroupIntoCatalog("DWELLINGS", true, false, Obj::CREATURE_GENERATOR4);
addGroupIntoCatalog("MINES", false, Obj::WINDMILL); addGroupIntoCatalog("DWELLINGS", true, false, Obj::REFUGEE_CAMP);
addGroupIntoCatalog("MINES", false, Obj::WATER_WHEEL); addGroupIntoCatalog("DWELLINGS", false, false, Obj::RANDOM_DWELLING);
addGroupIntoCatalog("TRIGGERS", false, Obj::EVENT); addGroupIntoCatalog("DWELLINGS", false, false, Obj::RANDOM_DWELLING_LVL);
addGroupIntoCatalog("TRIGGERS", false, Obj::GRAIL); addGroupIntoCatalog("DWELLINGS", false, false, Obj::RANDOM_DWELLING_FACTION);
addGroupIntoCatalog("TRIGGERS", false, Obj::SIGN); addGroupIntoCatalog("GROUNDS", true, false, Obj::CURSED_GROUND1);
addGroupIntoCatalog("MONSTERS", false, Obj::MONSTER); addGroupIntoCatalog("GROUNDS", true, false, Obj::MAGIC_PLAINS1);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER); addGroupIntoCatalog("GROUNDS", true, false, Obj::CLOVER_FIELD);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L1); addGroupIntoCatalog("GROUNDS", true, false, Obj::CURSED_GROUND2);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L2); addGroupIntoCatalog("GROUNDS", true, false, Obj::EVIL_FOG);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L3); addGroupIntoCatalog("GROUNDS", true, false, Obj::FAVORABLE_WINDS);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L4); addGroupIntoCatalog("GROUNDS", true, false, Obj::FIERY_FIELDS);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L5); addGroupIntoCatalog("GROUNDS", true, false, Obj::HOLY_GROUNDS);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L6); addGroupIntoCatalog("GROUNDS", true, false, Obj::LUCID_POOLS);
addGroupIntoCatalog("MONSTERS", false, Obj::RANDOM_MONSTER_L7); addGroupIntoCatalog("GROUNDS", true, false, Obj::MAGIC_CLOUDS);
addGroupIntoCatalog("QUESTS", false, Obj::SEER_HUT); addGroupIntoCatalog("GROUNDS", true, false, Obj::MAGIC_PLAINS2);
addGroupIntoCatalog("QUESTS", false, Obj::BORDER_GATE); addGroupIntoCatalog("GROUNDS", true, false, Obj::ROCKLANDS);
addGroupIntoCatalog("QUESTS", false, Obj::QUEST_GUARD); addGroupIntoCatalog("GROUNDS", true, false, Obj::HOLE);
addGroupIntoCatalog("QUESTS", false, Obj::HUT_OF_MAGI); addGroupIntoCatalog("TELEPORTS", true, false, Obj::MONOLITH_ONE_WAY_ENTRANCE);
addGroupIntoCatalog("QUESTS", false, Obj::EYE_OF_MAGI); addGroupIntoCatalog("TELEPORTS", true, false, Obj::MONOLITH_ONE_WAY_EXIT);
addGroupIntoCatalog("TELEPORTS", true, false, Obj::MONOLITH_TWO_WAY);
addGroupIntoCatalog("TELEPORTS", true, false, Obj::SUBTERRANEAN_GATE);
addGroupIntoCatalog("TELEPORTS", true, false, Obj::WHIRLPOOL);
addGroupIntoCatalog("MINES", true, false, Obj::MINE);
addGroupIntoCatalog("MINES", false, false, Obj::ABANDONED_MINE);
addGroupIntoCatalog("MINES", true, false, Obj::WINDMILL);
addGroupIntoCatalog("MINES", true, false, Obj::WATER_WHEEL);
addGroupIntoCatalog("TRIGGERS", true, false, Obj::EVENT);
addGroupIntoCatalog("TRIGGERS", true, false, Obj::GRAIL);
addGroupIntoCatalog("TRIGGERS", true, false, Obj::SIGN);
addGroupIntoCatalog("TRIGGERS", true, false, Obj::OCEAN_BOTTLE);
addGroupIntoCatalog("MONSTERS", false, false, Obj::MONSTER);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L1);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L2);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L3);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L4);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L5);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L6);
addGroupIntoCatalog("MONSTERS", true, false, Obj::RANDOM_MONSTER_L7);
addGroupIntoCatalog("QUESTS", true, false, Obj::SEER_HUT);
addGroupIntoCatalog("QUESTS", true, false, Obj::BORDER_GATE);
addGroupIntoCatalog("QUESTS", true, false, Obj::QUEST_GUARD);
addGroupIntoCatalog("QUESTS", true, false, Obj::HUT_OF_MAGI);
addGroupIntoCatalog("QUESTS", true, false, Obj::EYE_OF_MAGI);
addGroupIntoCatalog("QUESTS", true, false, Obj::BORDERGUARD);
addGroupIntoCatalog("QUESTS", true, false, Obj::KEYMASTER);
addGroupIntoCatalog("OBSTACLES", true); addGroupIntoCatalog("OBSTACLES", true);
addGroupIntoCatalog("OTHER", false); //addGroupIntoCatalog("OTHER", false);
/* /*
HERO = 34, HERO = 34,
LEAN_TO = 39, LEAN_TO = 39,
PYRAMID = 63,//subtype 0
WOG_OBJECT = 63,//subtype > 0 WOG_OBJECT = 63,//subtype > 0
RANDOM_HERO = 70, RANDOM_HERO = 70,
REFUGEE_CAMP = 78,
SANCTUARY = 80,
SCHOLAR = 81,
CRYPT = 84,
SHIPWRECK = 85,
SHIPWRECK_SURVIVOR = 86,
SHRINE_OF_MAGIC_INCANTATION = 88,
SHRINE_OF_MAGIC_GESTURE = 89,
SHRINE_OF_MAGIC_THOUGHT = 90,
SIRENS = 92,
STABLES = 94,
TAVERN = 95,
TEMPLE = 96,
DEN_OF_THIEVES = 97,
TRADING_POST = 99,
LEARNING_STONE = 100,
TREE_OF_KNOWLEDGE = 102,
UNIVERSITY = 104,
WAGON = 105,
WAR_MACHINE_FACTORY = 106,
SCHOOL_OF_WAR = 107,
WARRIORS_TOMB = 108,
WITCH_HUT = 113,
HOLE = 124,
FREELANCERS_GUILD = 213, FREELANCERS_GUILD = 213,
HERO_PLACEHOLDER = 214, HERO_PLACEHOLDER = 214,
TRADING_POST_SNOW = 221, TRADING_POST_SNOW = 221,
*/ */
}
catch(const std::exception & e)
{
QMessageBox::critical(this, "Mods loading problem", "Critical error during Mods loading. Disable some mods and restart.");
}
} }
void MainWindow::on_actionLevel_triggered() void MainWindow::on_actionLevel_triggered()

View File

@ -103,10 +103,12 @@ public slots:
private: private:
void preparePreview(const QModelIndex &index, bool createNew); void preparePreview(const QModelIndex &index, bool createNew);
void addGroupIntoCatalog(const std::string & groupName, bool staticOnly); void addGroupIntoCatalog(const std::string & groupName, bool staticOnly);
void addGroupIntoCatalog(const std::string & groupName, bool staticOnly, int ID); void addGroupIntoCatalog(const std::string & groupName, bool useCustomName, bool staticOnly, int ID);
void changeBrushState(int idx); void changeBrushState(int idx);
void setTitle(); void setTitle();
void closeEvent(QCloseEvent *event) override;
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;