add disable tearoffmenu option (#3826)
This commit is contained in:
parent
bcf505c98b
commit
cd29e2f252
11 changed files with 90 additions and 40 deletions
|
@ -30,13 +30,12 @@ AbstractCounter::AbstractCounter(Player *_player,
|
||||||
shortcutActive = false;
|
shortcutActive = false;
|
||||||
|
|
||||||
if (player->getLocalOrJudge()) {
|
if (player->getLocalOrJudge()) {
|
||||||
menu = new QMenu(name);
|
menu = new TearOffMenu(name);
|
||||||
menu->setTearOffEnabled(true);
|
|
||||||
aSet = new QAction(this);
|
aSet = new QAction(this);
|
||||||
connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter()));
|
connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter()));
|
||||||
menu->addAction(aSet);
|
menu->addAction(aSet);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
for (int i = 10; i >= -10; --i)
|
for (int i = 10; i >= -10; --i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,8 +48,10 @@ AbstractCounter::AbstractCounter(Player *_player,
|
||||||
connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter()));
|
connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter()));
|
||||||
menu->addAction(aIncrement);
|
menu->addAction(aIncrement);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
menu = nullptr;
|
menu = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
@ -107,8 +108,9 @@ void AbstractCounter::setShortcutsInactive()
|
||||||
|
|
||||||
void AbstractCounter::refreshShortcuts()
|
void AbstractCounter::refreshShortcuts()
|
||||||
{
|
{
|
||||||
if (shortcutActive)
|
if (shortcutActive) {
|
||||||
setShortcutsActive();
|
setShortcutsActive();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractCounter::setValue(int _value)
|
void AbstractCounter::setValue(int _value)
|
||||||
|
@ -220,4 +222,4 @@ void AbstractCounterDialog::changeValue(int diff)
|
||||||
return;
|
return;
|
||||||
curValue += diff;
|
curValue += diff;
|
||||||
setTextValue(QString::number(curValue));
|
setTextValue(QString::number(curValue));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef COUNTER_H
|
#ifndef COUNTER_H
|
||||||
#define COUNTER_H
|
#define COUNTER_H
|
||||||
|
|
||||||
|
#include "tearoffmenu.h"
|
||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
|
@ -28,7 +30,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QAction *aSet, *aDec, *aInc;
|
QAction *aSet, *aDec, *aInc;
|
||||||
QMenu *menu;
|
TearOffMenu *menu;
|
||||||
bool dialogSemaphore, deleteAfterDialog;
|
bool dialogSemaphore, deleteAfterDialog;
|
||||||
bool shownInCounterArea;
|
bool shownInCounterArea;
|
||||||
bool shortcutActive;
|
bool shortcutActive;
|
||||||
|
|
|
@ -382,12 +382,17 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens());
|
annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens());
|
||||||
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int)));
|
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int)));
|
||||||
|
|
||||||
|
useTearOffMenusCheckBox.setChecked(settingsCache->getUseTearOffMenus());
|
||||||
|
connect(&useTearOffMenusCheckBox, &QCheckBox::stateChanged, settingsCache,
|
||||||
|
[](int state) { settingsCache->setUseTearOffMenus(state == Qt::Checked); });
|
||||||
|
|
||||||
auto *generalGrid = new QGridLayout;
|
auto *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
||||||
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
||||||
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
||||||
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
||||||
|
generalGrid->addWidget(&useTearOffMenusCheckBox, 5, 0);
|
||||||
|
|
||||||
generalGroupBox = new QGroupBox;
|
generalGroupBox = new QGroupBox;
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
@ -421,6 +426,7 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
doubleClickToPlayCheckBox.setText(tr("&Double-click cards to play them (instead of single-click)"));
|
doubleClickToPlayCheckBox.setText(tr("&Double-click cards to play them (instead of single-click)"));
|
||||||
playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
|
playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
|
||||||
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
|
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
|
||||||
|
useTearOffMenusCheckBox.setText(tr("Use tear-off menus, allowing right click menus to persist on screen"));
|
||||||
animationGroupBox->setTitle(tr("Animation settings"));
|
animationGroupBox->setTitle(tr("Animation settings"));
|
||||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ private:
|
||||||
QCheckBox doubleClickToPlayCheckBox;
|
QCheckBox doubleClickToPlayCheckBox;
|
||||||
QCheckBox playToStackCheckBox;
|
QCheckBox playToStackCheckBox;
|
||||||
QCheckBox annotateTokensCheckBox;
|
QCheckBox annotateTokensCheckBox;
|
||||||
|
QCheckBox useTearOffMenusCheckBox;
|
||||||
QCheckBox tapAnimationCheckBox;
|
QCheckBox tapAnimationCheckBox;
|
||||||
QGroupBox *generalGroupBox;
|
QGroupBox *generalGroupBox;
|
||||||
QGroupBox *animationGroupBox;
|
QGroupBox *animationGroupBox;
|
||||||
|
@ -281,4 +282,4 @@ protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -240,21 +240,18 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
connect(aMoveBottomCardToGrave, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave()));
|
connect(aMoveBottomCardToGrave, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave()));
|
||||||
}
|
}
|
||||||
|
|
||||||
playerMenu = new QMenu(QString());
|
playerMenu = new TearOffMenu();
|
||||||
table->setMenu(playerMenu);
|
table->setMenu(playerMenu);
|
||||||
playerMenu->setTearOffEnabled(true);
|
|
||||||
|
|
||||||
if (local || judge) {
|
if (local || judge) {
|
||||||
handMenu = playerMenu->addMenu(QString());
|
handMenu = playerMenu->addTearOffMenu(QString());
|
||||||
handMenu->setTearOffEnabled(true);
|
|
||||||
handMenu->addAction(aViewHand);
|
handMenu->addAction(aViewHand);
|
||||||
playerLists.append(mRevealHand = handMenu->addMenu(QString()));
|
playerLists.append(mRevealHand = handMenu->addMenu(QString()));
|
||||||
playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString()));
|
playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString()));
|
||||||
handMenu->addSeparator();
|
handMenu->addSeparator();
|
||||||
handMenu->addAction(aMulligan);
|
handMenu->addAction(aMulligan);
|
||||||
handMenu->addSeparator();
|
handMenu->addSeparator();
|
||||||
moveHandMenu = handMenu->addMenu(QString());
|
moveHandMenu = handMenu->addTearOffMenu(QString());
|
||||||
moveHandMenu->setTearOffEnabled(true);
|
|
||||||
moveHandMenu->addAction(aMoveHandToTopLibrary);
|
moveHandMenu->addAction(aMoveHandToTopLibrary);
|
||||||
moveHandMenu->addAction(aMoveHandToBottomLibrary);
|
moveHandMenu->addAction(aMoveHandToBottomLibrary);
|
||||||
moveHandMenu->addSeparator();
|
moveHandMenu->addSeparator();
|
||||||
|
@ -263,8 +260,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
moveHandMenu->addAction(aMoveHandToRfg);
|
moveHandMenu->addAction(aMoveHandToRfg);
|
||||||
hand->setMenu(handMenu);
|
hand->setMenu(handMenu);
|
||||||
|
|
||||||
libraryMenu = playerMenu->addMenu(QString());
|
libraryMenu = playerMenu->addTearOffMenu(QString());
|
||||||
libraryMenu->setTearOffEnabled(true);
|
|
||||||
libraryMenu->addAction(aDrawCard);
|
libraryMenu->addAction(aDrawCard);
|
||||||
libraryMenu->addAction(aDrawCards);
|
libraryMenu->addAction(aDrawCards);
|
||||||
libraryMenu->addAction(aUndoDraw);
|
libraryMenu->addAction(aUndoDraw);
|
||||||
|
@ -294,8 +290,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
libraryMenu = nullptr;
|
libraryMenu = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
graveMenu = playerMenu->addMenu(QString());
|
graveMenu = playerMenu->addTearOffMenu(QString());
|
||||||
graveMenu->setTearOffEnabled(true);
|
|
||||||
graveMenu->addAction(aViewGraveyard);
|
graveMenu->addAction(aViewGraveyard);
|
||||||
|
|
||||||
if (local || judge) {
|
if (local || judge) {
|
||||||
|
@ -308,15 +303,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
}
|
}
|
||||||
grave->setMenu(graveMenu, aViewGraveyard);
|
grave->setMenu(graveMenu, aViewGraveyard);
|
||||||
|
|
||||||
rfgMenu = playerMenu->addMenu(QString());
|
rfgMenu = playerMenu->addTearOffMenu(QString());
|
||||||
rfgMenu->setTearOffEnabled(true);
|
|
||||||
rfgMenu->addAction(aViewRfg);
|
rfgMenu->addAction(aViewRfg);
|
||||||
rfg->setMenu(rfgMenu, aViewRfg);
|
rfg->setMenu(rfgMenu, aViewRfg);
|
||||||
|
|
||||||
if (local || judge) {
|
if (local || judge) {
|
||||||
graveMenu->addSeparator();
|
graveMenu->addSeparator();
|
||||||
moveGraveMenu = graveMenu->addMenu(QString());
|
moveGraveMenu = graveMenu->addTearOffMenu(QString());
|
||||||
moveGraveMenu->setTearOffEnabled(true);
|
|
||||||
moveGraveMenu->addAction(aMoveGraveToTopLibrary);
|
moveGraveMenu->addAction(aMoveGraveToTopLibrary);
|
||||||
moveGraveMenu->addAction(aMoveGraveToBottomLibrary);
|
moveGraveMenu->addAction(aMoveGraveToBottomLibrary);
|
||||||
moveGraveMenu->addSeparator();
|
moveGraveMenu->addSeparator();
|
||||||
|
@ -325,8 +318,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
moveGraveMenu->addAction(aMoveGraveToRfg);
|
moveGraveMenu->addAction(aMoveGraveToRfg);
|
||||||
|
|
||||||
rfgMenu->addSeparator();
|
rfgMenu->addSeparator();
|
||||||
moveRfgMenu = rfgMenu->addMenu(QString());
|
moveRfgMenu = rfgMenu->addTearOffMenu(QString());
|
||||||
moveRfgMenu->setTearOffEnabled(true);
|
|
||||||
moveRfgMenu->addAction(aMoveRfgToTopLibrary);
|
moveRfgMenu->addAction(aMoveRfgToTopLibrary);
|
||||||
moveRfgMenu->addAction(aMoveRfgToBottomLibrary);
|
moveRfgMenu->addAction(aMoveRfgToBottomLibrary);
|
||||||
moveRfgMenu->addSeparator();
|
moveRfgMenu->addSeparator();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "carddatabase.h"
|
#include "carddatabase.h"
|
||||||
#include "pb/card_attributes.pb.h"
|
#include "pb/card_attributes.pb.h"
|
||||||
#include "pb/game_event.pb.h"
|
#include "pb/game_event.pb.h"
|
||||||
|
#include "tearoffmenu.h"
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
@ -203,9 +204,9 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabGame *game;
|
TabGame *game;
|
||||||
QMenu *playerMenu, *handMenu, *moveHandMenu, *graveMenu, *moveGraveMenu, *rfgMenu, *moveRfgMenu, *libraryMenu,
|
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mRevealLibrary, *mRevealTopCard, *mRevealHand,
|
||||||
*sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mRevealLibrary, *mRevealTopCard, *mRevealHand,
|
|
||||||
*mRevealRandomHandCard, *mRevealRandomGraveyardCard;
|
*mRevealRandomHandCard, *mRevealRandomGraveyardCard;
|
||||||
|
TearOffMenu *moveGraveMenu, *moveRfgMenu, *graveMenu, *moveHandMenu, *handMenu, *libraryMenu, *rfgMenu, *playerMenu;
|
||||||
QList<QMenu *> playerLists;
|
QList<QMenu *> playerLists;
|
||||||
QList<QAction *> allPlayersActions;
|
QList<QAction *> allPlayersActions;
|
||||||
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
|
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, *aMoveHandToGrave, *aMoveHandToRfg,
|
||||||
|
|
|
@ -231,6 +231,9 @@ SettingsCache::SettingsCache()
|
||||||
startingHandSize = settings->value("interface/startinghandsize", 7).toInt();
|
startingHandSize = settings->value("interface/startinghandsize", 7).toInt();
|
||||||
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
||||||
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
||||||
|
knownMissingFeatures = settings->value("interface/knownmissingfeatures", "").toString();
|
||||||
|
useTearOffMenus = settings->value("interface/usetearoffmenus", true).toBool();
|
||||||
|
|
||||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||||
|
@ -278,12 +281,18 @@ SettingsCache::SettingsCache()
|
||||||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||||
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
||||||
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
||||||
knownMissingFeatures = settings->value("interface/knownmissingfeatures", "").toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setKnownMissingFeatures(QString _knownMissingFeatures)
|
void SettingsCache::setUseTearOffMenus(bool _useTearOffMenus)
|
||||||
{
|
{
|
||||||
knownMissingFeatures = std::move(_knownMissingFeatures);
|
useTearOffMenus = _useTearOffMenus;
|
||||||
|
settings->setValue("interface/usetearoffmenus", useTearOffMenus);
|
||||||
|
emit useTearOffMenusChanged(useTearOffMenus);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setKnownMissingFeatures(const QString &_knownMissingFeatures)
|
||||||
|
{
|
||||||
|
knownMissingFeatures = _knownMissingFeatures;
|
||||||
settings->setValue("interface/knownmissingfeatures", knownMissingFeatures);
|
settings->setValue("interface/knownmissingfeatures", knownMissingFeatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,15 +601,15 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
||||||
emit pixmapCacheSizeChanged(pixmapCacheSize);
|
emit pixmapCacheSizeChanged(pixmapCacheSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setClientID(QString _clientID)
|
void SettingsCache::setClientID(const QString &_clientID)
|
||||||
{
|
{
|
||||||
clientID = std::move(_clientID);
|
clientID = _clientID;
|
||||||
settings->setValue("personal/clientid", clientID);
|
settings->setValue("personal/clientid", clientID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setClientVersion(QString _clientVersion)
|
void SettingsCache::setClientVersion(const QString &_clientVersion)
|
||||||
{
|
{
|
||||||
clientVersion = std::move(_clientVersion);
|
clientVersion = _clientVersion;
|
||||||
settings->setValue("personal/clientversion", clientVersion);
|
settings->setValue("personal/clientversion", clientVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ signals:
|
||||||
void chatMentionCompleterChanged();
|
void chatMentionCompleterChanged();
|
||||||
void downloadSpoilerTimeIndexChanged();
|
void downloadSpoilerTimeIndexChanged();
|
||||||
void downloadSpoilerStatusChanged();
|
void downloadSpoilerStatusChanged();
|
||||||
|
void useTearOffMenusChanged(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
|
@ -102,6 +103,7 @@ private:
|
||||||
QString clientID;
|
QString clientID;
|
||||||
QString clientVersion;
|
QString clientVersion;
|
||||||
QString knownMissingFeatures;
|
QString knownMissingFeatures;
|
||||||
|
bool useTearOffMenus;
|
||||||
int pixmapCacheSize;
|
int pixmapCacheSize;
|
||||||
bool scaleCards;
|
bool scaleCards;
|
||||||
bool showMessagePopups;
|
bool showMessagePopups;
|
||||||
|
@ -398,9 +400,10 @@ public:
|
||||||
{
|
{
|
||||||
return maxFontSize;
|
return maxFontSize;
|
||||||
}
|
}
|
||||||
void setClientID(QString clientID);
|
void setClientID(const QString &clientID);
|
||||||
void setClientVersion(QString clientVersion);
|
void setClientVersion(const QString &clientVersion);
|
||||||
void setKnownMissingFeatures(QString _knownMissingFeatures);
|
void setKnownMissingFeatures(const QString &_knownMissingFeatures);
|
||||||
|
void setUseTearOffMenus(bool _useTearOffMenus);
|
||||||
QString getClientID()
|
QString getClientID()
|
||||||
{
|
{
|
||||||
return clientID;
|
return clientID;
|
||||||
|
@ -413,6 +416,10 @@ public:
|
||||||
{
|
{
|
||||||
return knownMissingFeatures;
|
return knownMissingFeatures;
|
||||||
}
|
}
|
||||||
|
bool getUseTearOffMenus()
|
||||||
|
{
|
||||||
|
return useTearOffMenus;
|
||||||
|
}
|
||||||
ShortcutsSettings &shortcuts() const
|
ShortcutsSettings &shortcuts() const
|
||||||
{
|
{
|
||||||
return *shortcutsSettings;
|
return *shortcutsSettings;
|
||||||
|
|
|
@ -1408,8 +1408,7 @@ void TabGame::createMenuItems()
|
||||||
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||||
aCloseReplay = nullptr;
|
aCloseReplay = nullptr;
|
||||||
|
|
||||||
phasesMenu = new QMenu(this);
|
phasesMenu = new TearOffMenu(this);
|
||||||
phasesMenu->setTearOffEnabled(true);
|
|
||||||
|
|
||||||
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
|
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
|
||||||
QAction *temp = new QAction(QString(), this);
|
QAction *temp = new QAction(QString(), this);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "pb/event_leave.pb.h"
|
#include "pb/event_leave.pb.h"
|
||||||
#include "pb/serverinfo_game.pb.h"
|
#include "pb/serverinfo_game.pb.h"
|
||||||
#include "tab.h"
|
#include "tab.h"
|
||||||
|
#include "tearoffmenu.h"
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -163,8 +164,8 @@ private:
|
||||||
*replayControlWidget;
|
*replayControlWidget;
|
||||||
QDockWidget *cardInfoDock, *messageLayoutDock, *playerListDock, *replayDock;
|
QDockWidget *cardInfoDock, *messageLayoutDock, *playerListDock, *replayDock;
|
||||||
QAction *playersSeparator;
|
QAction *playersSeparator;
|
||||||
QMenu *gameMenu, *phasesMenu, *viewMenu, *cardInfoDockMenu, *messageLayoutDockMenu, *playerListDockMenu,
|
QMenu *gameMenu, *viewMenu, *cardInfoDockMenu, *messageLayoutDockMenu, *playerListDockMenu, *replayDockMenu;
|
||||||
*replayDockMenu;
|
TearOffMenu *phasesMenu;
|
||||||
QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextPhaseAction, *aNextTurn,
|
QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextPhaseAction, *aNextTurn,
|
||||||
*aReverseTurn, *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout;
|
*aReverseTurn, *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout;
|
||||||
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aMessageLayoutDockVisible, *aMessageLayoutDockFloating,
|
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aMessageLayoutDockVisible, *aMessageLayoutDockFloating,
|
||||||
|
|
30
cockatrice/src/tearoffmenu.h
Normal file
30
cockatrice/src/tearoffmenu.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settingscache.h"
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
class TearOffMenu : public QMenu
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
||||||
|
{
|
||||||
|
connect(settingsCache, &SettingsCache::useTearOffMenusChanged, this,
|
||||||
|
[=](bool state) { setTearOffEnabled(state); });
|
||||||
|
setTearOffEnabled(settingsCache->getUseTearOffMenus());
|
||||||
|
}
|
||||||
|
|
||||||
|
TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||||
|
{
|
||||||
|
connect(settingsCache, &SettingsCache::useTearOffMenusChanged, this,
|
||||||
|
[=](bool state) { setTearOffEnabled(state); });
|
||||||
|
setTearOffEnabled(settingsCache->getUseTearOffMenus());
|
||||||
|
}
|
||||||
|
|
||||||
|
TearOffMenu *addTearOffMenu(const QString &title)
|
||||||
|
{
|
||||||
|
TearOffMenu *menu = new TearOffMenu(title, this);
|
||||||
|
addMenu(menu);
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue