Refactor say and utility menu.

Took 54 minutes

Took 2 minutes

Took 5 minutes

Took 11 minutes
This commit is contained in:
Lukas Brübach 2025-09-12 09:10:27 +02:00
parent 8bc2127b4d
commit 6c7871af5b
9 changed files with 232 additions and 130 deletions

View file

@ -0,0 +1,46 @@
#ifndef COCKATRICE_UTILITY_MENU_H
#define COCKATRICE_UTILITY_MENU_H
#include <QMenu>
class Player;
class UtilityMenu : public QMenu
{
Q_OBJECT
public slots:
void populatePredefinedTokensMenu();
void retranslateUi();
void setShortcutsActive();
void setShortcutsInactive();
public:
explicit UtilityMenu(Player *player, QMenu *playerMenu);
[[nodiscard]] bool createAnotherTokenActionExists() const
{
return aCreateAnotherToken != nullptr;
}
void setAndEnableCreateAnotherTokenAction(QString text)
{
aCreateAnotherToken->setText(text);
aCreateAnotherToken->setEnabled(true);
}
QStringList getPredefinedTokens() const
{
return predefinedTokens;
}
private:
Player *player;
QStringList predefinedTokens;
QMenu *createPredefinedTokenMenu;
QAction *aIncrementAllCardCounters;
QAction *aUntapAll, *aRollDie;
QAction *aCreateToken, *aCreateAnotherToken;
};
#endif // COCKATRICE_UTILITY_MENU_H