PlayerSelectionDialog.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * PlayerSelectionDialog.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <QDialog>
  12. #include <QVBoxLayout>
  13. #include "../lib/constants/EntityIdentifiers.h"
  14. class QRadioButton;
  15. class QButtonGroup;
  16. class MainWindow;
  17. /// Dialog shown when a hero cannot be placed as NEUTRAL.
  18. /// Allows the user to select a valid player via checkboxes,
  19. /// or using the existing keyboard shortcuts from MainWindow's player QActions.
  20. class PlayerSelectionDialog : public QDialog
  21. {
  22. Q_OBJECT
  23. public:
  24. explicit PlayerSelectionDialog(MainWindow * mainWindow);
  25. PlayerColor getSelectedPlayer() const;
  26. private:
  27. const int dialogWidth = 320;
  28. QButtonGroup * buttonGroup;
  29. PlayerColor selectedPlayer;
  30. QFont font;
  31. QVBoxLayout mainLayout;
  32. QVBoxLayout radioButtonsLayout;
  33. void setupDialogComponents();
  34. void addRadioButton(QAction * action, PlayerColor player);
  35. };