Renamed file + reduced window size + resfresh on change
This commit is contained in:
parent
d3d6f70496
commit
c6aba5a6d0
22 changed files with 463 additions and 470 deletions
|
@ -95,7 +95,7 @@ SET(cockatrice_SOURCES
|
|||
src/soundengine.cpp
|
||||
src/pending_command.cpp
|
||||
src/shortcutssettings.cpp
|
||||
src/sequenceEdit/secuenceedit.cpp
|
||||
src/sequenceEdit/sequenceedit.cpp
|
||||
src/sequenceEdit/shortcutstab.cpp
|
||||
${VERSION_STRING_CPP}
|
||||
)
|
||||
|
|
|
@ -18,6 +18,8 @@ AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name,
|
|||
setAcceptHoverEvents(true);
|
||||
#endif
|
||||
|
||||
shortcutActive = false;
|
||||
|
||||
if (player->getLocal()) {
|
||||
menu = new QMenu(name);
|
||||
aSet = new QAction(this);
|
||||
|
@ -40,6 +42,8 @@ AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name,
|
|||
} else
|
||||
menu = 0;
|
||||
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
|
@ -66,6 +70,7 @@ void AbstractCounter::retranslateUi()
|
|||
void AbstractCounter::setShortcutsActive()
|
||||
{
|
||||
if (name == "life") {
|
||||
shortcutActive = true;
|
||||
aSet->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSet"));
|
||||
aDec->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDec"));
|
||||
aInc->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aInc"));
|
||||
|
@ -74,6 +79,7 @@ void AbstractCounter::setShortcutsActive()
|
|||
|
||||
void AbstractCounter::setShortcutsInactive()
|
||||
{
|
||||
shortcutActive = false;
|
||||
if (name == "life") {
|
||||
aSet->setShortcut(QKeySequence());
|
||||
aDec->setShortcut(QKeySequence());
|
||||
|
@ -81,6 +87,12 @@ void AbstractCounter::setShortcutsInactive()
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractCounter::refreshShortcuts()
|
||||
{
|
||||
if(shortcutActive)
|
||||
setShortcutsActive();
|
||||
}
|
||||
|
||||
void AbstractCounter::setValue(int _value)
|
||||
{
|
||||
value = _value;
|
||||
|
|
|
@ -26,6 +26,7 @@ private:
|
|||
bool dialogSemaphore, deleteAfterDialog;
|
||||
bool shownInCounterArea;
|
||||
private slots:
|
||||
void refreshShortcuts();
|
||||
void incrementCounter();
|
||||
void setCounter();
|
||||
public:
|
||||
|
@ -44,6 +45,7 @@ public:
|
|||
|
||||
void setShortcutsActive();
|
||||
void setShortcutsInactive();
|
||||
bool shortcutActive;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,8 +18,6 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent)
|
|||
contentsEdit = new QPlainTextEdit;
|
||||
|
||||
refreshButton = new QPushButton(tr("&Refresh"));
|
||||
refreshButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||
"DlgLoadDeckFromClipboard/refreshButton"));
|
||||
connect(refreshButton, SIGNAL(clicked()), this, SLOT(actRefresh()));
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
|
@ -37,6 +35,8 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent)
|
|||
resize(500, 500);
|
||||
|
||||
actRefresh();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
||||
void DlgLoadDeckFromClipboard::actRefresh()
|
||||
|
@ -44,6 +44,11 @@ void DlgLoadDeckFromClipboard::actRefresh()
|
|||
contentsEdit->setPlainText(QApplication::clipboard()->text());
|
||||
}
|
||||
|
||||
void DlgLoadDeckFromClipboard::refreshShortcuts()
|
||||
{
|
||||
refreshButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DlgLoadDeckFromClipboard/refreshButton"));
|
||||
}
|
||||
|
||||
void DlgLoadDeckFromClipboard::actOK()
|
||||
{
|
||||
QString buffer = contentsEdit->toPlainText();
|
||||
|
|
|
@ -12,6 +12,7 @@ class DlgLoadDeckFromClipboard : public QDialog {
|
|||
private slots:
|
||||
void actOK();
|
||||
void actRefresh();
|
||||
void refreshShortcuts();
|
||||
private:
|
||||
DeckLoader *deckList;
|
||||
public:
|
||||
|
|
|
@ -20,11 +20,11 @@ GameView::GameView(QGraphicsScene *scene, QWidget *parent)
|
|||
connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand()));
|
||||
|
||||
aCloseMostRecentZoneView = new QAction(this);
|
||||
aCloseMostRecentZoneView->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aCloseMostRecentZoneView"));
|
||||
|
||||
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
|
||||
addAction(aCloseMostRecentZoneView);
|
||||
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
||||
}
|
||||
|
||||
|
@ -61,3 +61,8 @@ void GameView::stopRubberBand()
|
|||
{
|
||||
rubberBand->hide();
|
||||
}
|
||||
|
||||
void GameView::refreshShortcuts()
|
||||
{
|
||||
aCloseMostRecentZoneView->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ private slots:
|
|||
void startRubberBand(const QPointF &selectionOrigin);
|
||||
void resizeRubberBand(const QPointF &cursorPoint);
|
||||
void stopRubberBand();
|
||||
void refreshShortcuts();
|
||||
public slots:
|
||||
void updateSceneRect(const QRectF &rect);
|
||||
public:
|
||||
|
|
|
@ -454,6 +454,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
|||
|
||||
rearrangeZones();
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
@ -683,123 +685,46 @@ void Player::retranslateUi()
|
|||
}
|
||||
|
||||
aPlay->setText(tr("&Play"));
|
||||
aPlay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPlay"));
|
||||
|
||||
aHide->setText(tr("&Hide"));
|
||||
aPlayFacedown->setText(tr("Play &Face Down"));
|
||||
|
||||
aTap->setText(tr("&Tap"));
|
||||
aTap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aTap"));
|
||||
|
||||
aUntap->setText(tr("&Untap"));
|
||||
aUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aUntap"));
|
||||
|
||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||
aDoesntUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDoesntUntap"));
|
||||
|
||||
aFlip->setText(tr("&Flip"));
|
||||
aFlip->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aFlip"));
|
||||
|
||||
aPeek->setText(tr("&Peek at card face"));
|
||||
aPeek->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPeek"));
|
||||
|
||||
aClone->setText(tr("&Clone"));
|
||||
aClone->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aClone"));
|
||||
|
||||
aAttach->setText(tr("Attac&h to card..."));
|
||||
aAttach->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aAttach"));
|
||||
|
||||
aUnattach->setText(tr("Unattac&h"));
|
||||
aUnattach->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aUnattach"));
|
||||
|
||||
aDrawArrow->setText(tr("&Draw arrow..."));
|
||||
aDrawArrow->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDrawArrow"));
|
||||
|
||||
aIncP->setText(tr("&Increase power"));
|
||||
aIncP->setShortcuts(settingsCache->shortcuts().getShortcut("Player/IncP"));
|
||||
|
||||
aDecP->setText(tr("&Decrease power"));
|
||||
aDecP->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecP"));
|
||||
|
||||
aIncT->setText(tr("I&ncrease toughness"));
|
||||
aIncT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncT"));
|
||||
|
||||
aDecT->setText(tr("D&ecrease toughness"));
|
||||
aDecT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecT"));
|
||||
|
||||
aIncPT->setText(tr("In&crease power and toughness"));
|
||||
aIncPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncPT"));
|
||||
|
||||
aDecPT->setText(tr("Dec&rease power and toughness"));
|
||||
aDecPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecPT"));
|
||||
|
||||
aSetPT->setText(tr("Set &power and toughness..."));
|
||||
aSetPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetPT"));
|
||||
|
||||
aSetAnnotation->setText(tr("&Set annotation..."));
|
||||
aSetAnnotation->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetAnnotation"));
|
||||
|
||||
QStringList counterColors;
|
||||
counterColors.append(tr("Red"));
|
||||
counterColors.append(tr("Yellow"));
|
||||
counterColors.append(tr("Green"));
|
||||
|
||||
QList<QKeySequence> addCCShortCuts;
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aCCRed"));
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aCCYellow"));
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aCCGreen"));
|
||||
|
||||
QList<QKeySequence> removeCCShortCuts;
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aRCRed"));
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aRCYellow"));
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aRCGreen"));
|
||||
|
||||
QList<QKeySequence> setCCShortCuts;
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aSCRed"));
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aSCYellow"));
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut(
|
||||
"Player/aSCGreen"));
|
||||
|
||||
for (int i = 0; i < aAddCounter.size(); ++i){
|
||||
aAddCounter[i]->setText(tr("&Add counter (%1)").arg(counterColors[i]));
|
||||
aAddCounter[i]->setShortcut(addCCShortCuts[i]);
|
||||
}
|
||||
for (int i = 0; i < aRemoveCounter.size(); ++i){
|
||||
aRemoveCounter[i]->setText(tr("&Remove counter (%1)").arg(counterColors[i]));
|
||||
aRemoveCounter[i]->setShortcut(removeCCShortCuts[i]);
|
||||
}
|
||||
for (int i = 0; i < aSetCounter.size(); ++i){
|
||||
aSetCounter[i]->setText(tr("&Set counters (%1)...").arg(counterColors[i]));
|
||||
aSetCounter[i]->setShortcut(setCCShortCuts[i]);
|
||||
}
|
||||
|
||||
aMoveToTopLibrary->setText(tr("&Top of library"));
|
||||
aMoveToTopLibrary->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMoveToTopLibrary"));
|
||||
|
||||
aMoveToBottomLibrary->setText(tr("&Bottom of library"));
|
||||
aMoveToBottomLibrary->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMoveToBottomLibrary"));
|
||||
|
||||
aMoveToHand->setText(tr("&Hand"));
|
||||
aMoveToHand->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMoveToHand"));
|
||||
|
||||
aMoveToGraveyard->setText(tr("&Graveyard"));
|
||||
aMoveToGraveyard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMoveToGraveyard"));
|
||||
|
||||
aMoveToExile->setText(tr("&Exile"));
|
||||
aMoveToExile->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMoveToExile"));
|
||||
|
||||
QMapIterator<QString, CardZone *> zoneIterator(zones);
|
||||
while (zoneIterator.hasNext())
|
||||
|
@ -810,54 +735,73 @@ void Player::setShortcutsActive()
|
|||
{
|
||||
shortcutsActive = true;
|
||||
|
||||
aViewSideboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aViewSideboard"));
|
||||
aPlay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPlay"));
|
||||
aTap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aTap"));
|
||||
aUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aUntap"));
|
||||
aDoesntUntap->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDoesntUntap"));
|
||||
aFlip->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aFlip"));
|
||||
aPeek->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aPeek"));
|
||||
aClone->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aClone"));
|
||||
aAttach->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aAttach"));
|
||||
aUnattach->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aUnattach"));
|
||||
aDrawArrow->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDrawArrow"));
|
||||
aIncP->setShortcuts(settingsCache->shortcuts().getShortcut("Player/IncP"));
|
||||
aDecP->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecP"));
|
||||
aIncT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncT"));
|
||||
aDecT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecT"));
|
||||
aIncPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncPT"));
|
||||
aDecPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecPT"));
|
||||
aSetPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetPT"));
|
||||
aSetAnnotation->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetAnnotation"));
|
||||
aMoveToTopLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToTopLibrary"));
|
||||
aMoveToBottomLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToBottomLibrary"));
|
||||
aMoveToHand->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToHand"));
|
||||
aMoveToGraveyard->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToGraveyard"));
|
||||
aMoveToExile->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToExile"));
|
||||
|
||||
aViewLibrary->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aViewLibrary"));
|
||||
QList<QKeySequence> addCCShortCuts;
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aCCRed"));
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aCCYellow"));
|
||||
addCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aCCGreen"));
|
||||
|
||||
aViewTopCards->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aViewTopCards"));
|
||||
QList<QKeySequence> removeCCShortCuts;
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aRCRed"));
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aRCYellow"));
|
||||
removeCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aRCGreen"));
|
||||
|
||||
aViewGraveyard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aViewGraveyard"));
|
||||
QList<QKeySequence> setCCShortCuts;
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aSCRed"));
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aSCYellow"));
|
||||
setCCShortCuts.append(settingsCache->shortcuts().getSingleShortcut("Player/aSCGreen"));
|
||||
|
||||
aViewRfg->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aViewRfg"));
|
||||
|
||||
aDrawCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aDrawCard"));
|
||||
|
||||
aDrawCards->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aDrawCards"));
|
||||
|
||||
aUndoDraw->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aUndoDraw"));
|
||||
|
||||
aMulligan->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aMulligan"));
|
||||
|
||||
aShuffle->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aShuffle"));
|
||||
|
||||
aUntapAll->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aUntapAll"));
|
||||
|
||||
aRollDie->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aRollDie"));
|
||||
|
||||
aCreateToken->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aCreateToken"));
|
||||
|
||||
aCreateAnotherToken->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aCreateAnotherToken"));
|
||||
|
||||
aAlwaysRevealTopCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aAlwaysRevealTopCard"));
|
||||
for (int i = 0; i < aAddCounter.size(); ++i){
|
||||
aAddCounter[i]->setShortcut(addCCShortCuts.at(i));
|
||||
}
|
||||
for (int i = 0; i < aRemoveCounter.size(); ++i){
|
||||
aRemoveCounter[i]->setShortcut(removeCCShortCuts.at(i));
|
||||
}
|
||||
for (int i = 0; i < aSetCounter.size(); ++i){
|
||||
aSetCounter[i]->setShortcut(setCCShortCuts.at(i));
|
||||
}
|
||||
|
||||
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
||||
while (counterIterator.hasNext())
|
||||
counterIterator.next().value()->setShortcutsActive();
|
||||
|
||||
aViewSideboard->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aViewSideboard"));
|
||||
aViewLibrary->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aViewLibrary"));
|
||||
aViewTopCards->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aViewTopCards"));
|
||||
aViewGraveyard->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aViewGraveyard"));
|
||||
aDrawCard->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aDrawCard"));
|
||||
aDrawCards->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aDrawCards"));
|
||||
aUndoDraw->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aUndoDraw"));
|
||||
aMulligan->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aMulligan"));
|
||||
aShuffle->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aShuffle"));
|
||||
aUntapAll->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aUntapAll"));
|
||||
aRollDie->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aRollDie"));
|
||||
aCreateToken->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aCreateToken"));
|
||||
aCreateAnotherToken->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aCreateAnotherToken"));
|
||||
aAlwaysRevealTopCard->setShortcut(settingsCache->shortcuts().getSingleShortcut("Player/aAlwaysRevealTopCard"));
|
||||
}
|
||||
|
||||
void Player::setShortcutsInactive()
|
||||
|
@ -2346,6 +2290,12 @@ void Player::actPlayFacedown()
|
|||
playCard(game->getActiveCard(), true, false);
|
||||
}
|
||||
|
||||
void Player::refreshShortcuts()
|
||||
{
|
||||
if(shortcutsActive)
|
||||
setShortcutsActive();
|
||||
}
|
||||
|
||||
void Player::updateCardMenu(CardItem *card)
|
||||
{
|
||||
QMenu *cardMenu = card->getCardMenu();
|
||||
|
|
|
@ -159,6 +159,7 @@ private slots:
|
|||
void actPlay();
|
||||
void actHide();
|
||||
void actPlayFacedown();
|
||||
void refreshShortcuts();
|
||||
|
||||
private:
|
||||
TabGame *game;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "secuenceedit.h"
|
||||
#include "sequenceedit.h"
|
||||
#include "../settingscache.h"
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
@ -7,7 +7,7 @@
|
|||
#include <QKeyEvent>
|
||||
#include <QToolTip>
|
||||
|
||||
SecuenceEdit::SecuenceEdit(QString _shorcutName, QWidget *parent) : QWidget(parent)
|
||||
SequenceEdit::SequenceEdit(QString _shorcutName, QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
shorcutName = _shorcutName;
|
||||
currentKey = 0;
|
||||
|
@ -19,16 +19,21 @@ SecuenceEdit::SecuenceEdit(QString _shorcutName, QWidget *parent) : QWidget(pare
|
|||
clearButton = new QPushButton("", this);
|
||||
defaultButton = new QPushButton("", this);
|
||||
|
||||
lineEdit->setMinimumWidth(100);
|
||||
lineEdit->setMinimumWidth(70);
|
||||
clearButton->setMaximumWidth(lineEdit->height());
|
||||
defaultButton->setMaximumWidth(lineEdit->height());
|
||||
clearButton->setMaximumHeight(lineEdit->height());
|
||||
defaultButton->setMaximumHeight(lineEdit->height());
|
||||
|
||||
clearButton->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
|
||||
defaultButton->setIcon(QIcon(":/resources/icon_update.png"));
|
||||
|
||||
clearButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
defaultButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
layout->setSpacing(0);
|
||||
layout->setSpacing(1);
|
||||
layout->addWidget(lineEdit);
|
||||
layout->addWidget(clearButton);
|
||||
layout->addWidget(defaultButton);
|
||||
|
@ -40,12 +45,12 @@ SecuenceEdit::SecuenceEdit(QString _shorcutName, QWidget *parent) : QWidget(pare
|
|||
lineEdit->setText(settingsCache->shortcuts().getShortcutString(shorcutName));
|
||||
}
|
||||
|
||||
QString SecuenceEdit::getSecuence()
|
||||
QString SequenceEdit::getSecuence()
|
||||
{
|
||||
return lineEdit->text();
|
||||
}
|
||||
|
||||
void SecuenceEdit::removeLastShortcut()
|
||||
void SequenceEdit::removeLastShortcut()
|
||||
{
|
||||
QString secuences = lineEdit->text();
|
||||
if(!secuences.isEmpty())
|
||||
|
@ -60,13 +65,13 @@ void SecuenceEdit::removeLastShortcut()
|
|||
}
|
||||
}
|
||||
|
||||
void SecuenceEdit::restoreDefault()
|
||||
void SequenceEdit::restoreDefault()
|
||||
{
|
||||
lineEdit->setText(settingsCache->shortcuts().getDefaultShortcutString(shorcutName));
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
bool SecuenceEdit::eventFilter(QObject *, QEvent * event)
|
||||
bool SequenceEdit::eventFilter(QObject *, QEvent * event)
|
||||
{
|
||||
if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
|
||||
{
|
||||
|
@ -81,7 +86,7 @@ bool SecuenceEdit::eventFilter(QObject *, QEvent * event)
|
|||
return false;
|
||||
}
|
||||
|
||||
void SecuenceEdit::processKey(QKeyEvent* e)
|
||||
void SequenceEdit::processKey(QKeyEvent* e)
|
||||
{
|
||||
int key = e->key();
|
||||
if(key != Qt::Key_Control && key != Qt::Key_Shift
|
||||
|
@ -96,7 +101,7 @@ void SecuenceEdit::processKey(QKeyEvent* e)
|
|||
finishShortcut();
|
||||
}
|
||||
|
||||
int SecuenceEdit::translateModifiers(Qt::KeyboardModifiers state, const QString &text)
|
||||
int SequenceEdit::translateModifiers(Qt::KeyboardModifiers state, const QString &text)
|
||||
{
|
||||
int result = 0;
|
||||
// The shift modifier only counts when it is not used to type a symbol
|
||||
|
@ -116,7 +121,7 @@ int SecuenceEdit::translateModifiers(Qt::KeyboardModifiers state, const QString
|
|||
return result;
|
||||
}
|
||||
|
||||
void SecuenceEdit::finishShortcut()
|
||||
void SequenceEdit::finishShortcut()
|
||||
{
|
||||
QKeySequence secuence(keys);
|
||||
if(!secuence.isEmpty() && valid)
|
||||
|
@ -143,7 +148,7 @@ void SecuenceEdit::finishShortcut()
|
|||
updateSettings();
|
||||
}
|
||||
|
||||
void SecuenceEdit::updateSettings()
|
||||
void SequenceEdit::updateSettings()
|
||||
{
|
||||
settingsCache->shortcuts().setShortcuts(shorcutName,lineEdit->text());
|
||||
}
|
|
@ -8,11 +8,11 @@ class QLineEdit;
|
|||
class QPushButton;
|
||||
class QEvent;
|
||||
|
||||
class SecuenceEdit : public QWidget
|
||||
class SequenceEdit : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SecuenceEdit(QString _shorcutName, QWidget *parent = 0);
|
||||
SequenceEdit(QString _shorcutName, QWidget *parent = 0);
|
||||
QString getSecuence();
|
||||
signals:
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -83,6 +83,7 @@ void ShortcutsSettings::setShortcuts(QString name, QList<QKeySequence> secuence)
|
|||
QString stringSecuence = stringifySecuence(secuence);
|
||||
shortCutsFile.setValue(name, stringSecuence);
|
||||
shortCutsFile.endGroup();
|
||||
emit shortCutchanged();
|
||||
}
|
||||
|
||||
void ShortcutsSettings::setShortcuts(QString name, QKeySequence secuence)
|
||||
|
|
|
@ -24,6 +24,9 @@ public:
|
|||
void setShortcuts(QString name, QString secuences);
|
||||
|
||||
bool isValid(QString name, QString secuences);
|
||||
signals:
|
||||
void shortCutchanged();
|
||||
|
||||
private:
|
||||
QString settingsFilePath;
|
||||
QMap<QString,QList<QKeySequence> > shortCuts;
|
||||
|
|
|
@ -257,71 +257,45 @@ void TabDeckEditor::createMenus()
|
|||
{
|
||||
aNewDeck = new QAction(QString(), this);
|
||||
connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
|
||||
aNewDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aNewDeck"));
|
||||
|
||||
aLoadDeck = new QAction(QString(), this);
|
||||
connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck()));
|
||||
aLoadDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aLoadDeck"));
|
||||
|
||||
aSaveDeck = new QAction(QString(), this);
|
||||
connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck()));
|
||||
aSaveDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aSaveDeck"));
|
||||
|
||||
aSaveDeckAs = new QAction(QString(), this);
|
||||
connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs()));
|
||||
aSaveDeckAs->setShortcuts(QKeySequence::SaveAs);
|
||||
aSaveDeckAs->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aSaveDeckAs"));
|
||||
|
||||
aOpenCustomsetsFolder = new QAction(QString(), this);
|
||||
connect(aOpenCustomsetsFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomsetsFolder()));
|
||||
|
||||
aLoadDeckFromClipboard = new QAction(QString(), this);
|
||||
connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard()));
|
||||
aLoadDeckFromClipboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aLoadDeckFromClipboard"));
|
||||
|
||||
aSaveDeckToClipboard = new QAction(QString(), this);
|
||||
connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
|
||||
aSaveDeckToClipboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aSaveDeckToClipboard"));
|
||||
|
||||
aPrintDeck = new QAction(QString(), this);
|
||||
connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
|
||||
aPrintDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aPrintDeck"));
|
||||
|
||||
aAnalyzeDeck = new QAction(QString(), this);
|
||||
connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck()));
|
||||
aAnalyzeDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aAnalyzeDeck"));
|
||||
|
||||
aClose = new QAction(QString(), this);
|
||||
connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest()));
|
||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClose"));
|
||||
|
||||
aOpenCustomFolder = new QAction(QString(), this);
|
||||
connect(aOpenCustomFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomFolder()));
|
||||
aOpenCustomFolder->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aOpenCustomFolder"));
|
||||
|
||||
aEditSets = new QAction(QString(), this);
|
||||
connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets()));
|
||||
aEditSets->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aEditSets"));
|
||||
|
||||
aEditTokens = new QAction(QString(), this);
|
||||
connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens()));
|
||||
aEditTokens->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aEditTokens"));
|
||||
|
||||
aResetLayout = new QAction(QString(), this);
|
||||
connect(aResetLayout,SIGNAL(triggered()),this,SLOT(restartLayout()));
|
||||
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aResetLayout"));
|
||||
|
||||
deckMenu = new QMenu(this);
|
||||
deckMenu->addAction(aNewDeck);
|
||||
|
@ -344,14 +318,10 @@ void TabDeckEditor::createMenus()
|
|||
aClearFilterAll = new QAction(QString(), this);
|
||||
aClearFilterAll->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
|
||||
connect(aClearFilterAll, SIGNAL(triggered()), this, SLOT(actClearFilterAll()));
|
||||
aClearFilterAll->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aClearFilterAll"));
|
||||
|
||||
aClearFilterOne = new QAction(QString(), this);
|
||||
aClearFilterOne->setIcon(QIcon(":/resources/decrement.svg"));
|
||||
connect(aClearFilterOne, SIGNAL(triggered()), this, SLOT(actClearFilterOne()));
|
||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aClearFilterOne"));
|
||||
|
||||
dbMenu = new QMenu(this);
|
||||
dbMenu->addAction(aEditSets);
|
||||
|
@ -458,7 +428,7 @@ void TabDeckEditor::createCentralFrame()
|
|||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->setObjectName("mainLayout");
|
||||
mainLayout->addWidget(MainWindow);
|
||||
setLayout(mainLayout);
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
void TabDeckEditor::restartLayout()
|
||||
|
@ -498,6 +468,30 @@ void TabDeckEditor::freeDocksSize()
|
|||
filterDock->setMaximumSize(5000,5000);
|
||||
}
|
||||
|
||||
void TabDeckEditor::refreshShortcuts()
|
||||
{
|
||||
aNewDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aNewDeck"));
|
||||
aLoadDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aLoadDeck"));
|
||||
aSaveDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeck"));
|
||||
aSaveDeckAs->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeckAs"));
|
||||
aLoadDeckFromClipboard->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aLoadDeckFromClipboard"));
|
||||
aPrintDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aPrintDeck"));
|
||||
aAnalyzeDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aAnalyzeDeck"));
|
||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClose"));
|
||||
aOpenCustomFolder->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aOpenCustomFolder"));
|
||||
aEditSets->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aEditSets"));
|
||||
aEditTokens->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aEditTokens"));
|
||||
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aResetLayout"));
|
||||
aClearFilterAll->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterAll"));
|
||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterOne"));
|
||||
aSaveDeckToClipboard->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeckToClipboard"));
|
||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterOne"));
|
||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClose"));
|
||||
aRemoveCard->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aRemoveCard"));
|
||||
aIncrement->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aIncrement"));
|
||||
aDecrement->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aDecrement"));
|
||||
}
|
||||
|
||||
void TabDeckEditor::loadLayout()
|
||||
{
|
||||
MainWindow->restoreState(settingsCache->getDeckEditorLayoutState());
|
||||
|
@ -538,6 +532,9 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
this->installEventFilter(this);
|
||||
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(checkFirstRunDetected()));
|
||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||
}
|
||||
|
@ -553,8 +550,6 @@ void TabDeckEditor::retranslateUi()
|
|||
|
||||
aClearFilterAll->setText(tr("&Clear all filters"));
|
||||
aClearFilterOne->setText(tr("Delete selected"));
|
||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aClearFilterOne"));
|
||||
|
||||
nameLabel->setText(tr("Deck &name:"));
|
||||
commentsLabel->setText(tr("&Comments:"));
|
||||
|
@ -574,23 +569,15 @@ void TabDeckEditor::retranslateUi()
|
|||
aOpenCustomFolder->setText(tr("Open custom image folder"));
|
||||
aOpenCustomsetsFolder->setText(tr("Open custom sets folder"));
|
||||
aClose->setText(tr("&Close"));
|
||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aClose"));
|
||||
|
||||
aAddCard->setText(tr("Add card to &maindeck"));
|
||||
aAddCardToSideboard->setText(tr("Add card to &sideboard"));
|
||||
|
||||
aRemoveCard->setText(tr("&Remove row"));
|
||||
aRemoveCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aRemoveCard"));
|
||||
|
||||
aIncrement->setText(tr("&Increment number"));
|
||||
aIncrement->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aIncrement"));
|
||||
|
||||
aDecrement->setText(tr("&Decrement number"));
|
||||
aDecrement->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"TabDeckEditor/aDecrement"));
|
||||
|
||||
deckMenu->setTitle(tr("&Deck Editor"));
|
||||
dbMenu->setTitle(tr("C&ard Database"));
|
||||
|
|
|
@ -83,6 +83,7 @@ class TabDeckEditor : public Tab {
|
|||
void loadLayout();
|
||||
void restartLayout();
|
||||
void freeDocksSize();
|
||||
void refreshShortcuts();
|
||||
|
||||
private:
|
||||
CardInfo *currentCardInfo() const;
|
||||
|
|
|
@ -120,16 +120,14 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
|||
setLayout(deckViewLayout);
|
||||
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
||||
void DeckViewContainer::retranslateUi()
|
||||
{
|
||||
loadLocalButton->setText(tr("Load local deck"));
|
||||
loadLocalButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||
"DeckViewContainer/loadLocalButton"));
|
||||
loadRemoteButton->setText(tr("Load deck from server"));
|
||||
loadRemoteButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||
"DeckViewContainer/loadRemoteButton"));
|
||||
readyStartButton->setText(tr("Ready to s&tart"));
|
||||
updateSideboardLockButtonText();
|
||||
}
|
||||
|
@ -150,6 +148,58 @@ void DeckViewContainer::updateSideboardLockButtonText()
|
|||
sideboardLockButton->setText(tr("S&ideboard locked"));
|
||||
}
|
||||
|
||||
void DeckViewContainer::refreshShortcuts()
|
||||
{
|
||||
loadLocalButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/loadLocalButton"));
|
||||
loadRemoteButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/loadRemoteButton"));
|
||||
}
|
||||
|
||||
void TabGame::refreshShortcuts()
|
||||
{
|
||||
for (int i = 0; i < phaseActions.size(); ++i) {
|
||||
QAction *temp = phaseActions.at(i);
|
||||
switch (i) {
|
||||
case 0: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase0")); break;
|
||||
case 1: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase1")); break;
|
||||
case 2: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase2")); break;
|
||||
case 3: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase3")); break;
|
||||
case 4: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase4")); break;
|
||||
case 5: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase5")); break;
|
||||
case 6: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase6")); break;
|
||||
case 7: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase7")); break;
|
||||
case 8: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase8")); break;
|
||||
case 9: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase9")); break;
|
||||
case 10:temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase10")); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNextPhase) {
|
||||
aNextPhase->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextPhase"));
|
||||
}
|
||||
if (aNextTurn) {
|
||||
aNextTurn->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextTurn"));
|
||||
}
|
||||
if (aRemoveLocalArrows) {
|
||||
aRemoveLocalArrows->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRemoveLocalArrows"));
|
||||
}
|
||||
if (aRotateViewCW) {
|
||||
aRotateViewCW->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRotateViewCW"));
|
||||
}
|
||||
if (aRotateViewCCW) {
|
||||
aRotateViewCCW->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRotateViewCCW"));
|
||||
}
|
||||
if (aConcede) {
|
||||
aConcede->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aConcede"));
|
||||
}
|
||||
if (aLeaveGame) {
|
||||
aLeaveGame->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aLeaveGame"));
|
||||
}
|
||||
if (aCloseReplay) {
|
||||
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseReplay"));
|
||||
}
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadLocalDeck()
|
||||
{
|
||||
QFileDialog dialog(this, tr("Load deck"));
|
||||
|
@ -361,6 +411,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
addTabMenu(gameMenu);
|
||||
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
setLayout(superMainLayout);
|
||||
|
||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
||||
|
@ -470,23 +522,10 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
|||
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
|
||||
QAction *temp = new QAction(QString(), this);
|
||||
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction()));
|
||||
switch (i) {
|
||||
case 0: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase0")); break;
|
||||
case 1: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase1")); break;
|
||||
case 2: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase2")); break;
|
||||
case 3: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase3")); break;
|
||||
case 4: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase4")); break;
|
||||
case 5: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase5")); break;
|
||||
case 6: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase6")); break;
|
||||
case 7: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase7")); break;
|
||||
case 8: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase8")); break;
|
||||
case 9: temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase9")); break;
|
||||
case 10:temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase10")); break;
|
||||
default: ;
|
||||
}
|
||||
phasesMenu->addAction(temp);
|
||||
phaseActions.append(temp);
|
||||
}
|
||||
|
||||
phasesMenu->addSeparator();
|
||||
phasesMenu->addAction(aNextPhase);
|
||||
|
||||
|
@ -505,6 +544,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
|||
addTabMenu(gameMenu);
|
||||
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
setLayout(mainLayout);
|
||||
|
||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
||||
|
@ -552,45 +593,29 @@ void TabGame::retranslateUi()
|
|||
gameMenu->setTitle(tr("&Game"));
|
||||
if (aNextPhase) {
|
||||
aNextPhase->setText(tr("Next &phase"));
|
||||
aNextPhase->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aNextPhase"));
|
||||
}
|
||||
if (aNextTurn) {
|
||||
aNextTurn->setText(tr("Next &turn"));
|
||||
aNextTurn->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aNextTurn"));
|
||||
}
|
||||
if (aRemoveLocalArrows) {
|
||||
aRemoveLocalArrows->setText(tr("&Remove all local arrows"));
|
||||
aRemoveLocalArrows->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aRemoveLocalArrows"));
|
||||
}
|
||||
if (aRotateViewCW) {
|
||||
aRotateViewCW->setText(tr("Rotate View Cl&ockwise"));
|
||||
aRotateViewCW->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aRotateViewCW"));
|
||||
}
|
||||
if (aRotateViewCCW) {
|
||||
aRotateViewCCW->setText(tr("Rotate View Co&unterclockwise"));
|
||||
aRotateViewCCW->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aRotateViewCCW"));
|
||||
}
|
||||
if (aGameInfo)
|
||||
aGameInfo->setText(tr("Game &information"));
|
||||
if (aConcede) {
|
||||
aConcede->setText(tr("&Concede"));
|
||||
aConcede->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aConcede"));
|
||||
}
|
||||
if (aLeaveGame) {
|
||||
aLeaveGame->setText(tr("&Leave game"));
|
||||
aLeaveGame->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aLeaveGame"));
|
||||
}
|
||||
if (aCloseReplay) {
|
||||
aCloseReplay->setText(tr("C&lose replay"));
|
||||
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"Player/aCloseReplay"));
|
||||
}
|
||||
|
||||
if (sayLabel)
|
||||
|
|
|
@ -84,6 +84,7 @@ private slots:
|
|||
void sideboardPlanChanged();
|
||||
void sideboardLockButtonClicked();
|
||||
void updateSideboardLockButtonText();
|
||||
void refreshShortcuts();
|
||||
signals:
|
||||
void newCardAdded(AbstractCardItem *card);
|
||||
public:
|
||||
|
@ -199,6 +200,7 @@ private slots:
|
|||
|
||||
void addMentionTag(QString value);
|
||||
void commandFinished(const Response &response);
|
||||
void refreshShortcuts();
|
||||
public:
|
||||
TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, const Event_GameJoined &event, const QMap<int, QString> &_roomGameTypes);
|
||||
TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay);
|
||||
|
|
|
@ -68,7 +68,6 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
QMenu *chatSettingsMenu = new QMenu(this);
|
||||
|
||||
aClearChat = chatSettingsMenu->addAction(QString());
|
||||
aClearChat->setShortcuts(settingsCache->shortcuts().getShortcut("tab_room/aClearChat"));
|
||||
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat()));
|
||||
|
||||
chatSettingsMenu->addSeparator();
|
||||
|
@ -132,6 +131,8 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
||||
TabRoom::~TabRoom()
|
||||
|
@ -282,6 +283,11 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
|||
emit userEvent(false);
|
||||
}
|
||||
|
||||
void TabRoom::refreshShortcuts()
|
||||
{
|
||||
aClearChat->setShortcuts(settingsCache->shortcuts().getShortcut("tab_room/aClearChat"));
|
||||
}
|
||||
|
||||
void TabRoom::addMentionTag(QString mentionTag) {
|
||||
sayEdit->insert(mentionTag + " ");
|
||||
sayEdit->setFocus();
|
||||
|
|
|
@ -73,6 +73,7 @@ private slots:
|
|||
void processJoinRoomEvent(const Event_JoinRoom &event);
|
||||
void processLeaveRoomEvent(const Event_LeaveRoom &event);
|
||||
void processRoomSayEvent(const Event_RoomSay &event);
|
||||
void refreshShortcuts();
|
||||
public:
|
||||
TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerInfo_User *_ownUser, const ServerInfo_Room &info);
|
||||
~TabRoom();
|
||||
|
|
|
@ -456,40 +456,14 @@ void MainWindow::retranslateUi()
|
|||
setClientStatusTitle();
|
||||
|
||||
aConnect->setText(tr("&Connect..."));
|
||||
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aConnect"));
|
||||
|
||||
aDisconnect->setText(tr("&Disconnect"));
|
||||
aDisconnect->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aDisconnect"));
|
||||
|
||||
aSinglePlayer->setText(tr("Start &local game..."));
|
||||
aSinglePlayer->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aSinglePlayer"));
|
||||
|
||||
aWatchReplay->setText(tr("&Watch replay..."));
|
||||
aWatchReplay->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aWatchReplay"));
|
||||
|
||||
aDeckEditor->setText(tr("&Deck editor"));
|
||||
aDeckEditor->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aDeckEditor"));
|
||||
|
||||
aFullScreen->setText(tr("&Full screen"));
|
||||
aFullScreen->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aFullScreen"));
|
||||
|
||||
aRegister->setText(tr("&Register to server..."));
|
||||
aRegister->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aRegister"));
|
||||
|
||||
aSettings->setText(tr("&Settings..."));
|
||||
aSettings->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aSettings"));
|
||||
|
||||
aExit->setText(tr("&Exit"));
|
||||
aExit->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aExit"));
|
||||
|
||||
#if defined(__APPLE__) /* For OSX */
|
||||
cockatriceMenu->setTitle(tr("A&ctions"));
|
||||
|
@ -499,11 +473,7 @@ void MainWindow::retranslateUi()
|
|||
|
||||
aAbout->setText(tr("&About Cockatrice"));
|
||||
helpMenu->setTitle(tr("&Help"));
|
||||
|
||||
aCheckCardUpdates->setText(tr("Check for card updates..."));
|
||||
aCheckCardUpdates->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||
"MainWindow/aCheckCardUpdates"));
|
||||
|
||||
tabSupervisor->retranslateUi();
|
||||
}
|
||||
|
||||
|
@ -622,6 +592,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
createTrayActions();
|
||||
createTrayIcon();
|
||||
}
|
||||
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -801,3 +774,17 @@ void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus)
|
|||
// this will force a database reload
|
||||
settingsCache->setCardDatabasePath(settingsCache->getCardDatabasePath());
|
||||
}
|
||||
|
||||
void MainWindow::refreshShortcuts()
|
||||
{
|
||||
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aConnect"));
|
||||
aDisconnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aDisconnect"));
|
||||
aSinglePlayer->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aSinglePlayer"));
|
||||
aWatchReplay->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aWatchReplay"));
|
||||
aDeckEditor->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aDeckEditor"));
|
||||
aFullScreen->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aFullScreen"));
|
||||
aRegister->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aRegister"));
|
||||
aSettings->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aSettings"));
|
||||
aExit->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aExit"));
|
||||
aCheckCardUpdates->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aCheckCardUpdates"));
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ private slots:
|
|||
void actCheckCardUpdates();
|
||||
void cardUpdateError(QProcess::ProcessError err);
|
||||
void cardUpdateFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void refreshShortcuts();
|
||||
private:
|
||||
static const QString appName;
|
||||
void setClientStatusTitle();
|
||||
|
|
Loading…
Reference in a new issue