diff --git a/mapeditor/inspector/armywidget.cpp b/mapeditor/inspector/armywidget.cpp index 8027356dc..9deaca6b3 100644 --- a/mapeditor/inspector/armywidget.cpp +++ b/mapeditor/inspector/armywidget.cpp @@ -1,3 +1,13 @@ +/* + * armywidget.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 "armywidget.h" #include "ui_armywidget.h" #include "CCreatureHandler.h" diff --git a/mapeditor/inspector/armywidget.h b/mapeditor/inspector/armywidget.h index 367182adc..8067b39a7 100644 --- a/mapeditor/inspector/armywidget.h +++ b/mapeditor/inspector/armywidget.h @@ -1,5 +1,13 @@ -#ifndef ARMYWIDGET_H -#define ARMYWIDGET_H +/* + * armywidget.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 #include "../lib/mapObjects/CArmedInstance.h" @@ -46,4 +54,3 @@ private: CArmedInstance & army; }; -#endif // ARMYWIDGET_H diff --git a/mapeditor/inspector/inspector.cpp b/mapeditor/inspector/inspector.cpp index 6819bcd03..3b13948b4 100644 --- a/mapeditor/inspector/inspector.cpp +++ b/mapeditor/inspector/inspector.cpp @@ -1,3 +1,12 @@ +/* + * inspector.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 "inspector.h" #include "../lib/CArtHandler.h" diff --git a/mapeditor/inspector/inspector.h b/mapeditor/inspector/inspector.h index f4d866433..b8bce345d 100644 --- a/mapeditor/inspector/inspector.h +++ b/mapeditor/inspector/inspector.h @@ -1,5 +1,13 @@ -#ifndef INSPECTOR_H -#define INSPECTOR_H +/* + * inspector.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 #include @@ -151,4 +159,3 @@ public: QStringList options; }; -#endif // INSPECTOR_H diff --git a/mapeditor/inspector/messagewidget.cpp b/mapeditor/inspector/messagewidget.cpp index a514f531b..3e6ddda18 100644 --- a/mapeditor/inspector/messagewidget.cpp +++ b/mapeditor/inspector/messagewidget.cpp @@ -1,3 +1,12 @@ +/* + * messagewidget.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 "messagewidget.h" #include "ui_messagewidget.h" diff --git a/mapeditor/inspector/messagewidget.h b/mapeditor/inspector/messagewidget.h index b8fce8e00..2d9259b9b 100644 --- a/mapeditor/inspector/messagewidget.h +++ b/mapeditor/inspector/messagewidget.h @@ -1,6 +1,13 @@ -#ifndef MESSAGEWIDGET_H -#define MESSAGEWIDGET_H - +/* + * messagewidget.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 namespace Ui { @@ -34,4 +41,3 @@ public: void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; }; -#endif // MESSAGEWIDGET_H diff --git a/mapeditor/inspector/rewardswidget.cpp b/mapeditor/inspector/rewardswidget.cpp index 5a7389063..7e36ef8a0 100644 --- a/mapeditor/inspector/rewardswidget.cpp +++ b/mapeditor/inspector/rewardswidget.cpp @@ -1,3 +1,12 @@ +/* + * rewardswidget.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 "rewardswidget.h" #include "ui_rewardswidget.h" #include "../lib/VCMI_Lib.h" diff --git a/mapeditor/inspector/rewardswidget.h b/mapeditor/inspector/rewardswidget.h index 3da2fbcb5..67ff4d0a6 100644 --- a/mapeditor/inspector/rewardswidget.h +++ b/mapeditor/inspector/rewardswidget.h @@ -1,6 +1,13 @@ -#ifndef REWARDSWIDGET_H -#define REWARDSWIDGET_H - +/* + * rewardswidget.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 #include "../lib/mapObjects/CGPandoraBox.h" #include "../lib/mapping/CMap.h" @@ -75,5 +82,3 @@ private: CGPandoraBox & pandora; const CMap & map; }; - -#endif // REWARDSWIDGET_H diff --git a/mapeditor/inspector/townbulidingswidget.cpp b/mapeditor/inspector/townbulidingswidget.cpp index 992966633..63deef5ea 100644 --- a/mapeditor/inspector/townbulidingswidget.cpp +++ b/mapeditor/inspector/townbulidingswidget.cpp @@ -1,3 +1,12 @@ +/* + * townbuildingswidget.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 "townbulidingswidget.h" #include "ui_townbulidingswidget.h" #include "../lib/CModHandler.h" @@ -159,30 +168,27 @@ void TownBulidingsWidget::addBuildings(const CTown & ctown) ui->treeView->resizeColumnToContents(2); } -std::set TownBulidingsWidget::getForbiddenBuildings() +std::set TownBulidingsWidget::getBuildingsFromModel(int modelColumn, Qt::CheckState checkState) { std::set result; for(int i = 0; i < model.rowCount(); ++i) { - if(auto * item = model.item(i, 1)) - if(item->checkState() == Qt::Unchecked) + if(auto * item = model.item(i, modelColumn)) + if(item->checkState() == checkState) result.emplace(item->data(Qt::UserRole).toInt()); } return result; } +std::set TownBulidingsWidget::getForbiddenBuildings() +{ + return getBuildingsFromModel(1, Qt::Unchecked); +} + std::set TownBulidingsWidget::getBuiltBuildings() { - std::set result; - for(int i = 0; i < model.rowCount(); ++i) - { - if(auto * item = model.item(i, 2)) - if(item->checkState() == Qt::Checked) - result.emplace(item->data(Qt::UserRole).toInt()); - } - - return result; + return getBuildingsFromModel(2, Qt::Checked); } void TownBulidingsWidget::on_treeView_expanded(const QModelIndex &index) diff --git a/mapeditor/inspector/townbulidingswidget.h b/mapeditor/inspector/townbulidingswidget.h index 64d253b0b..93ab3118b 100644 --- a/mapeditor/inspector/townbulidingswidget.h +++ b/mapeditor/inspector/townbulidingswidget.h @@ -1,5 +1,13 @@ -#ifndef TOWNBULIDINGSWIDGET_H -#define TOWNBULIDINGSWIDGET_H +/* + * townbuildingswidget.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 #include "../lib/mapObjects/CGTownInstance.h" @@ -28,6 +36,8 @@ private slots: void on_treeView_collapsed(const QModelIndex &index); private: + std::set getBuildingsFromModel(int modelColumn, Qt::CheckState checkState); + Ui::TownBulidingsWidget *ui; CGTownInstance & town; mutable QStandardItemModel model; @@ -50,4 +60,3 @@ private: //std::set }; -#endif // TOWNBULIDINGSWIDGET_H