2025-03-25 15:39:42 +01:00
|
|
|
/*
|
|
|
|
|
* PlayerSelectionDialog.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 <QDialog>
|
2025-04-13 17:18:13 +02:00
|
|
|
#include <QVBoxLayout>
|
2025-04-05 18:13:24 +02:00
|
|
|
#include "../lib/constants/EntityIdentifiers.h"
|
|
|
|
|
|
|
|
|
|
class QCheckBox;
|
|
|
|
|
class MainWindow;
|
2025-03-25 15:39:42 +01:00
|
|
|
|
|
|
|
|
/// Dialog shown when a hero cannot be placed as NEUTRAL.
|
|
|
|
|
/// Allows the user to select a valid player via checkboxes,
|
|
|
|
|
/// or using the existing keyboard shortcuts from MainWindow's player QActions.
|
|
|
|
|
class PlayerSelectionDialog : public QDialog
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2025-04-05 18:13:24 +02:00
|
|
|
explicit PlayerSelectionDialog(MainWindow * mainWindow = nullptr);
|
2025-03-25 15:39:42 +01:00
|
|
|
PlayerColor getSelectedPlayer() const;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onCheckboxToggled(bool checked);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::vector<QCheckBox *> checkboxes;
|
|
|
|
|
PlayerColor selectedPlayer;
|
|
|
|
|
|
|
|
|
|
QFont font;
|
|
|
|
|
QVBoxLayout mainLayout;
|
|
|
|
|
QVBoxLayout checkboxLayout;
|
|
|
|
|
|
2025-04-05 18:13:24 +02:00
|
|
|
bool defaultCheckedSet = false;
|
|
|
|
|
|
2025-03-25 15:39:42 +01:00
|
|
|
void setupDialogComponents();
|
2025-04-05 18:13:24 +02:00
|
|
|
void addCheckbox(QAction * checkboxAction, PlayerColor player, bool isEnabled);
|
2025-03-25 15:39:42 +01:00
|
|
|
|
|
|
|
|
};
|