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

87 lines
1.9 KiB
C++
Raw Normal View History

2022-10-08 22:32:02 +02:00
/*
* 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
2022-10-16 13:37:01 +02:00
#include "../StdInc.h"
2022-09-18 01:23:17 +02:00
#include <QDialog>
2023-09-16 05:34:27 +02:00
#include "../lib/mapObjects/CRewardableObject.h"
2022-09-18 01:23:17 +02:00
namespace Ui {
class RewardsWidget;
}
class RewardsWidget : public QDialog
{
Q_OBJECT
public:
2022-10-12 23:40:52 +02:00
2023-09-16 05:34:27 +02:00
explicit RewardsWidget(const CMap &, CRewardableObject &, QWidget *parent = nullptr);
2022-09-18 01:23:17 +02:00
~RewardsWidget();
void obtainData();
bool commitChanges();
private slots:
2023-09-16 05:34:27 +02:00
void on_addVisitInfo_clicked();
void on_removeVisitInfo_clicked();
void on_selectMode_currentIndexChanged(int index);
void on_resetPeriod_valueChanged(int arg1);
void on_visitInfoList_itemSelectionChanged();
void on_visitInfoList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_rCreatureAdd_clicked();
2022-09-18 01:23:17 +02:00
2023-09-16 05:34:27 +02:00
void on_rCreatureRemove_clicked();
2022-09-18 01:23:17 +02:00
2023-09-16 05:34:27 +02:00
void on_lCreatureAdd_clicked();
2022-09-18 01:23:17 +02:00
2023-09-16 05:34:27 +02:00
void on_lCreatureRemove_clicked();
2022-09-18 01:23:17 +02:00
2023-09-16 05:34:27 +02:00
void on_castSpellCheck_toggled(bool checked);
2022-09-18 01:23:17 +02:00
2023-09-16 05:34:27 +02:00
void on_bonusAdd_clicked();
void on_bonusRemove_clicked();
2022-09-18 01:23:17 +02:00
private:
2023-09-16 05:34:27 +02:00
void saveCurrentVisitInfo(int index);
void loadCurrentVisitInfo(int index);
void onCreatureAdd(QTableWidget * listWidget, QComboBox * comboWidget, QSpinBox * spinWidget);
2022-09-18 01:23:17 +02:00
Ui::RewardsWidget *ui;
2023-09-16 05:34:27 +02:00
CRewardableObject & object;
2022-09-18 01:23:17 +02:00
const CMap & map;
};
2022-10-16 01:20:24 +02:00
class RewardsDelegate : public QStyledItemDelegate
2022-09-18 01:23:17 +02:00
{
Q_OBJECT
public:
2023-09-16 05:34:27 +02:00
RewardsDelegate(const CMap &, CRewardableObject &);
2022-09-18 01:23:17 +02:00
using QStyledItemDelegate::QStyledItemDelegate;
2022-10-16 01:20:24 +02:00
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
2022-09-18 01:23:17 +02:00
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
2022-10-16 01:20:24 +02:00
private:
2023-09-16 05:34:27 +02:00
CRewardableObject & object;
2022-10-16 01:20:24 +02:00
const CMap & map;
};