Shorcut read from settings
This commit is contained in:
parent
644ea0482f
commit
b0bf94e378
14 changed files with 353 additions and 78 deletions
|
@ -94,6 +94,7 @@ SET(cockatrice_SOURCES
|
||||||
src/qt-json/json.cpp
|
src/qt-json/json.cpp
|
||||||
src/soundengine.cpp
|
src/soundengine.cpp
|
||||||
src/pending_command.cpp
|
src/pending_command.cpp
|
||||||
|
src/shortcutssettings.cpp
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "abstractcounter.h"
|
#include "abstractcounter.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "settingscache.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
@ -65,9 +66,17 @@ void AbstractCounter::retranslateUi()
|
||||||
void AbstractCounter::setShortcutsActive()
|
void AbstractCounter::setShortcutsActive()
|
||||||
{
|
{
|
||||||
if (name == "life") {
|
if (name == "life") {
|
||||||
aSet->setShortcut(QKeySequence("Ctrl+L"));
|
aSet->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aDec->setShortcut(QKeySequence("F11"));
|
"AbstractCounter/aSet",
|
||||||
aInc->setShortcut(QKeySequence("F12"));
|
QKeySequence("Ctrl+L")));
|
||||||
|
|
||||||
|
aDec->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"AbstractCounter/aDec",
|
||||||
|
QKeySequence("F11")));
|
||||||
|
|
||||||
|
aInc->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"AbstractCounter/aInc",
|
||||||
|
QKeySequence("F12")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "dlg_load_deck_from_clipboard.h"
|
#include "dlg_load_deck_from_clipboard.h"
|
||||||
#include "deck_loader.h"
|
#include "deck_loader.h"
|
||||||
|
#include "settingscache.h"
|
||||||
|
|
||||||
DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent)
|
DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent)
|
||||||
: QDialog(parent), deckList(0)
|
: QDialog(parent), deckList(0)
|
||||||
|
@ -17,7 +18,9 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent)
|
||||||
contentsEdit = new QPlainTextEdit;
|
contentsEdit = new QPlainTextEdit;
|
||||||
|
|
||||||
refreshButton = new QPushButton(tr("&Refresh"));
|
refreshButton = new QPushButton(tr("&Refresh"));
|
||||||
refreshButton->setShortcut(QKeySequence("F5"));
|
refreshButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||||
|
"DlgLoadDeckFromClipboard/refreshButton",
|
||||||
|
QKeySequence("F5")));
|
||||||
connect(refreshButton, SIGNAL(clicked()), this, SLOT(actRefresh()));
|
connect(refreshButton, SIGNAL(clicked()), this, SLOT(actRefresh()));
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "gameview.h"
|
#include "gameview.h"
|
||||||
#include "gamescene.h"
|
#include "gamescene.h"
|
||||||
|
#include "settingscache.h"
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QRubberBand>
|
#include <QRubberBand>
|
||||||
|
@ -19,7 +20,9 @@ GameView::GameView(QGraphicsScene *scene, QWidget *parent)
|
||||||
connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand()));
|
connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand()));
|
||||||
|
|
||||||
aCloseMostRecentZoneView = new QAction(this);
|
aCloseMostRecentZoneView = new QAction(this);
|
||||||
aCloseMostRecentZoneView->setShortcut(QKeySequence("Esc"));
|
aCloseMostRecentZoneView->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"GameView/aCloseMostRecentZoneView",
|
||||||
|
QKeySequence("Esc")));
|
||||||
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
|
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
|
||||||
addAction(aCloseMostRecentZoneView);
|
addAction(aCloseMostRecentZoneView);
|
||||||
|
|
||||||
|
|
|
@ -691,25 +691,44 @@ void Player::retranslateUi()
|
||||||
aFlip->setText(tr("&Flip"));
|
aFlip->setText(tr("&Flip"));
|
||||||
aPeek->setText(tr("&Peek at card face"));
|
aPeek->setText(tr("&Peek at card face"));
|
||||||
aClone->setText(tr("&Clone"));
|
aClone->setText(tr("&Clone"));
|
||||||
aClone->setShortcut(QKeySequence("Ctrl+J"));
|
aClone->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aClone", QKeySequence("Ctrl+J")));
|
||||||
|
|
||||||
aAttach->setText(tr("Attac&h to card..."));
|
aAttach->setText(tr("Attac&h to card..."));
|
||||||
aAttach->setShortcut(QKeySequence("Ctrl+A"));
|
aAttach->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aAttach", QKeySequence("Ctrl+A")));
|
||||||
|
|
||||||
aUnattach->setText(tr("Unattac&h"));
|
aUnattach->setText(tr("Unattac&h"));
|
||||||
aDrawArrow->setText(tr("&Draw arrow..."));
|
aDrawArrow->setText(tr("&Draw arrow..."));
|
||||||
|
|
||||||
aIncP->setText(tr("&Increase power"));
|
aIncP->setText(tr("&Increase power"));
|
||||||
aIncP->setShortcut(QKeySequence("Ctrl++"));
|
aIncP->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/IncP", QKeySequence("Ctrl++")));
|
||||||
|
|
||||||
aDecP->setText(tr("&Decrease power"));
|
aDecP->setText(tr("&Decrease power"));
|
||||||
aDecP->setShortcut(QKeySequence("Ctrl+-"));
|
aDecP->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aDecP", QKeySequence("Ctrl+-")));
|
||||||
|
|
||||||
aIncT->setText(tr("I&ncrease toughness"));
|
aIncT->setText(tr("I&ncrease toughness"));
|
||||||
aIncT->setShortcut(QKeySequence("Alt++"));
|
aIncT->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aIncT", QKeySequence("Alt++")));
|
||||||
|
|
||||||
aDecT->setText(tr("D&ecrease toughness"));
|
aDecT->setText(tr("D&ecrease toughness"));
|
||||||
aDecT->setShortcut(QKeySequence("Alt+-"));
|
aDecT->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aDecT", QKeySequence("Alt+-")));
|
||||||
|
|
||||||
aIncPT->setText(tr("In&crease power and toughness"));
|
aIncPT->setText(tr("In&crease power and toughness"));
|
||||||
aIncPT->setShortcut(QKeySequence("Ctrl+Alt++"));
|
aIncPT->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aIncPT", QKeySequence("Ctrl+Alt++")));
|
||||||
|
|
||||||
aDecPT->setText(tr("Dec&rease power and toughness"));
|
aDecPT->setText(tr("Dec&rease power and toughness"));
|
||||||
aDecPT->setShortcut(QKeySequence("Ctrl+Alt+-"));
|
aDecPT->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aDecPT", QKeySequence("Ctrl+Alt+-")));
|
||||||
|
|
||||||
aSetPT->setText(tr("Set &power and toughness..."));
|
aSetPT->setText(tr("Set &power and toughness..."));
|
||||||
aSetPT->setShortcut(QKeySequence("Ctrl+P"));
|
aSetPT->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aSetPT", QKeySequence("Ctrl+P")));
|
||||||
|
|
||||||
aSetAnnotation->setText(tr("&Set annotation..."));
|
aSetAnnotation->setText(tr("&Set annotation..."));
|
||||||
QStringList counterColors;
|
QStringList counterColors;
|
||||||
counterColors.append(tr("Red"));
|
counterColors.append(tr("Red"));
|
||||||
|
@ -725,7 +744,8 @@ void Player::retranslateUi()
|
||||||
aMoveToBottomLibrary->setText(tr("&Bottom of library"));
|
aMoveToBottomLibrary->setText(tr("&Bottom of library"));
|
||||||
aMoveToHand->setText(tr("&Hand"));
|
aMoveToHand->setText(tr("&Hand"));
|
||||||
aMoveToGraveyard->setText(tr("&Graveyard"));
|
aMoveToGraveyard->setText(tr("&Graveyard"));
|
||||||
aMoveToGraveyard->setShortcut(QKeySequence("Ctrl+Del"));
|
aMoveToGraveyard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aMoveToGraveyard", QKeySequence("Ctrl+Del")));
|
||||||
aMoveToExile->setText(tr("&Exile"));
|
aMoveToExile->setText(tr("&Exile"));
|
||||||
|
|
||||||
QMapIterator<QString, CardZone *> zoneIterator(zones);
|
QMapIterator<QString, CardZone *> zoneIterator(zones);
|
||||||
|
@ -737,20 +757,50 @@ void Player::setShortcutsActive()
|
||||||
{
|
{
|
||||||
shortcutsActive = true;
|
shortcutsActive = true;
|
||||||
|
|
||||||
aViewSideboard->setShortcut(QKeySequence("Ctrl+F3"));
|
aViewSideboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aViewLibrary->setShortcut(QKeySequence("F3"));
|
"Player/aViewSideboard", QKeySequence("Ctrl+F3")));
|
||||||
aViewTopCards->setShortcut(QKeySequence("Ctrl+W"));
|
|
||||||
aViewGraveyard->setShortcut(QKeySequence("F4"));
|
aViewLibrary->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aDrawCard->setShortcut(QKeySequence("Ctrl+D"));
|
"Player/aViewLibrary", QKeySequence("F3")));
|
||||||
aDrawCards->setShortcut(QKeySequence("Ctrl+E"));
|
|
||||||
aUndoDraw->setShortcut(QKeySequence("Ctrl+Shift+D"));
|
aViewTopCards->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aMulligan->setShortcut(QKeySequence("Ctrl+M"));
|
"Player/aViewTopCards", QKeySequence("Ctrl+W")));
|
||||||
aShuffle->setShortcut(QKeySequence("Ctrl+S"));
|
|
||||||
aUntapAll->setShortcut(QKeySequence("Ctrl+U"));
|
aViewGraveyard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aRollDie->setShortcut(QKeySequence("Ctrl+I"));
|
"Player/aViewGraveyard", QKeySequence("F4")));
|
||||||
aCreateToken->setShortcut(QKeySequence("Ctrl+T"));
|
|
||||||
aCreateAnotherToken->setShortcut(QKeySequence("Ctrl+G"));
|
aDrawCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
aAlwaysRevealTopCard->setShortcut(QKeySequence("Ctrl+N"));
|
"Player/aDrawCard", QKeySequence("Ctrl+D")));
|
||||||
|
|
||||||
|
aDrawCards->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aDrawCards", QKeySequence("Ctrl+E")));
|
||||||
|
|
||||||
|
aUndoDraw->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aUndoDraw", QKeySequence("Ctrl+Shift+D")));
|
||||||
|
|
||||||
|
aMulligan->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aMulligan", QKeySequence("Ctrl+M")));
|
||||||
|
|
||||||
|
aShuffle->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aShuffle", QKeySequence("Ctrl+S")));
|
||||||
|
|
||||||
|
aUntapAll->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aUntapAll", QKeySequence("Ctrl+U")));
|
||||||
|
|
||||||
|
aRollDie->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aRollDie", QKeySequence("Ctrl+I")));
|
||||||
|
|
||||||
|
aCreateToken->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aCreateToken",
|
||||||
|
QKeySequence("Ctrl+T")));
|
||||||
|
|
||||||
|
aCreateAnotherToken->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aCreateAnotherToken",
|
||||||
|
QKeySequence("Ctrl+G")));
|
||||||
|
|
||||||
|
aAlwaysRevealTopCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"Player/aAlwaysRevealTopCard",
|
||||||
|
QKeySequence("Ctrl+N")));
|
||||||
|
|
||||||
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
QMapIterator<int, AbstractCounter *> counterIterator(counters);
|
||||||
while (counterIterator.hasNext())
|
while (counterIterator.hasNext())
|
||||||
|
@ -788,10 +838,15 @@ void Player::initSayMenu()
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("messages");
|
settings.beginGroup("messages");
|
||||||
int count = settings.value("count", 0).toInt();
|
int count = settings.value("count", 0).toInt();
|
||||||
|
QString base = settingsCache->shortcuts().getSingleShortcut(
|
||||||
|
"Player/say", QKeySequence("Ctrl")).toString();
|
||||||
|
base = base.append("+");
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
QAction *newAction = new QAction(settings.value(QString("msg%1").arg(i)).toString(), this);
|
QAction *newAction = new QAction(settings.value(QString("msg%1").arg(i)).toString(), this);
|
||||||
if (i <= 10)
|
if (i <= 10){
|
||||||
newAction->setShortcut(QKeySequence(QString("Ctrl+%1").arg((i + 1) % 10)));
|
newAction->setShortcut(QKeySequence(base + QString::number((i + 1) % 10)));
|
||||||
|
}
|
||||||
connect(newAction, SIGNAL(triggered()), this, SLOT(actSayMessage()));
|
connect(newAction, SIGNAL(triggered()), this, SLOT(actSayMessage()));
|
||||||
sayMenu->addAction(newAction);
|
sayMenu->addAction(newAction);
|
||||||
}
|
}
|
||||||
|
@ -805,13 +860,20 @@ void Player::setDeck(const DeckLoader &_deck)
|
||||||
createPredefinedTokenMenu->clear();
|
createPredefinedTokenMenu->clear();
|
||||||
predefinedTokens.clear();
|
predefinedTokens.clear();
|
||||||
InnerDecklistNode *tokenZone = dynamic_cast<InnerDecklistNode *>(deck->getRoot()->findChild("tokens"));
|
InnerDecklistNode *tokenZone = dynamic_cast<InnerDecklistNode *>(deck->getRoot()->findChild("tokens"));
|
||||||
|
|
||||||
|
QString base = settingsCache->shortcuts().getSingleShortcut(
|
||||||
|
"Player/token", QKeySequence("Alt")).toString();
|
||||||
|
base = base.append("+");
|
||||||
|
|
||||||
if (tokenZone)
|
if (tokenZone)
|
||||||
for (int i = 0; i < tokenZone->size(); ++i) {
|
for (int i = 0; i < tokenZone->size(); ++i) {
|
||||||
const QString tokenName = tokenZone->at(i)->getName();
|
const QString tokenName = tokenZone->at(i)->getName();
|
||||||
predefinedTokens.append(tokenName);
|
predefinedTokens.append(tokenName);
|
||||||
QAction *a = createPredefinedTokenMenu->addAction(tokenName);
|
QAction *a = createPredefinedTokenMenu->addAction(tokenName);
|
||||||
if (i < 10)
|
if (i < 10)
|
||||||
a->setShortcut(QKeySequence("Alt+" + QString::number((i + 1) % 10)));
|
{
|
||||||
|
a->setShortcut(QKeySequence(base + QString::number((i + 1) % 10)));
|
||||||
|
}
|
||||||
connect(a, SIGNAL(triggered()), this, SLOT(actCreatePredefinedToken()));
|
connect(a, SIGNAL(triggered()), this, SLOT(actCreatePredefinedToken()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString SettingsCache::getLayoutsSettingsPath()
|
QString SettingsCache::getSettingsPath()
|
||||||
{
|
{
|
||||||
QString file = "";
|
QString file = "";
|
||||||
|
|
||||||
#ifndef PORTABLE_BUILD
|
#ifndef PORTABLE_BUILD
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
file = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
file = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||||
#else
|
#else
|
||||||
file = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
file = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||||
#endif
|
#endif
|
||||||
file.append("/settings/layouts/");
|
file.append("/settings/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
|
@ -25,6 +25,7 @@ QString SettingsCache::getLayoutsSettingsPath()
|
||||||
SettingsCache::SettingsCache()
|
SettingsCache::SettingsCache()
|
||||||
{
|
{
|
||||||
settings = new QSettings(this);
|
settings = new QSettings(this);
|
||||||
|
shortcutsSettings = new ShortcutsSettings(getSettingsPath(),this);
|
||||||
|
|
||||||
lang = settings->value("personal/lang").toString();
|
lang = settings->value("personal/lang").toString();
|
||||||
keepalive = settings->value("personal/keepalive", 5).toInt();
|
keepalive = settings->value("personal/keepalive", 5).toInt();
|
||||||
|
@ -118,8 +119,8 @@ SettingsCache::SettingsCache()
|
||||||
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
||||||
clientID = settings->value("personal/clientid", "notset").toString();
|
clientID = settings->value("personal/clientid", "notset").toString();
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
|
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
deckEditorLayoutState = layout_settings.value("layouts/deckEditor_state").toByteArray();
|
deckEditorLayoutState = layout_settings.value("layouts/deckEditor_state").toByteArray();
|
||||||
|
@ -497,8 +498,8 @@ void SettingsCache::setDeckEditorLayoutState(const QByteArray &value)
|
||||||
{
|
{
|
||||||
deckEditorLayoutState = value;
|
deckEditorLayoutState = value;
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
layout_settings.setValue("layouts/deckEditor_state",value);
|
layout_settings.setValue("layouts/deckEditor_state",value);
|
||||||
}
|
}
|
||||||
|
@ -507,8 +508,8 @@ void SettingsCache::setDeckEditorGeometry(const QByteArray &value)
|
||||||
{
|
{
|
||||||
deckEditorGeometry = value;
|
deckEditorGeometry = value;
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
layout_settings.setValue("layouts/deckEditor_geometry",value);
|
layout_settings.setValue("layouts/deckEditor_geometry",value);
|
||||||
}
|
}
|
||||||
|
@ -517,8 +518,8 @@ void SettingsCache::setDeckEditorCardSize(const QSize &value)
|
||||||
{
|
{
|
||||||
deckEditorCardSize = value;
|
deckEditorCardSize = value;
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
layout_settings.setValue("layouts/deckEditor_CardSize",value);
|
layout_settings.setValue("layouts/deckEditor_CardSize",value);
|
||||||
}
|
}
|
||||||
|
@ -527,8 +528,8 @@ void SettingsCache::setDeckEditorDeckSize(const QSize &value)
|
||||||
{
|
{
|
||||||
deckEditorDeckSize = value;
|
deckEditorDeckSize = value;
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
layout_settings.setValue("layouts/deckEditor_DeckSize",value);
|
layout_settings.setValue("layouts/deckEditor_DeckSize",value);
|
||||||
}
|
}
|
||||||
|
@ -537,8 +538,8 @@ void SettingsCache::setDeckEditorFilterSize(const QSize &value)
|
||||||
{
|
{
|
||||||
deckEditorFilterSize = value;
|
deckEditorFilterSize = value;
|
||||||
|
|
||||||
QString file = getLayoutsSettingsPath();
|
QString file = getSettingsPath();
|
||||||
file.append("deckLayout.ini");
|
file.append("layouts/deckLayout.ini");
|
||||||
QSettings layout_settings(file , QSettings::IniFormat);
|
QSettings layout_settings(file , QSettings::IniFormat);
|
||||||
layout_settings.setValue("layouts/deckEditor_FilterSize",value);
|
layout_settings.setValue("layouts/deckEditor_FilterSize",value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include "shortcutssettings.h"
|
||||||
|
|
||||||
// the falbacks are used for cards without a muid
|
// the falbacks are used for cards without a muid
|
||||||
#define PIC_URL_DEFAULT "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card"
|
#define PIC_URL_DEFAULT "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card"
|
||||||
|
@ -45,7 +46,7 @@ signals:
|
||||||
void masterVolumeChanged(int value);
|
void masterVolumeChanged(int value);
|
||||||
private:
|
private:
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
|
ShortcutsSettings *shortcutsSettings;
|
||||||
QByteArray mainWindowGeometry;
|
QByteArray mainWindowGeometry;
|
||||||
QString lang;
|
QString lang;
|
||||||
QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath;
|
QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath;
|
||||||
|
@ -102,7 +103,7 @@ private:
|
||||||
int keepalive;
|
int keepalive;
|
||||||
QByteArray deckEditorLayoutState, deckEditorGeometry;
|
QByteArray deckEditorLayoutState, deckEditorGeometry;
|
||||||
QSize deckEditorFilterSize, deckEditorDeckSize, deckEditorCardSize;
|
QSize deckEditorFilterSize, deckEditorDeckSize, deckEditorCardSize;
|
||||||
QString getLayoutsSettingsPath();
|
QString getSettingsPath();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsCache();
|
SettingsCache();
|
||||||
|
@ -187,6 +188,7 @@ public:
|
||||||
void setDeckEditorDeckSize(const QSize &value);
|
void setDeckEditorDeckSize(const QSize &value);
|
||||||
QSize getDeckEditorFilterSize() const { return deckEditorFilterSize; }
|
QSize getDeckEditorFilterSize() const { return deckEditorFilterSize; }
|
||||||
void setDeckEditorFilterSize(const QSize &value);
|
void setDeckEditorFilterSize(const QSize &value);
|
||||||
|
ShortcutsSettings& shortcuts() const { return *shortcutsSettings; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMainWindowGeometry(const QByteArray &_mainWindowGeometry);
|
void setMainWindowGeometry(const QByteArray &_mainWindowGeometry);
|
||||||
|
|
102
cockatrice/src/shortcutssettings.cpp
Normal file
102
cockatrice/src/shortcutssettings.cpp
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
#include "shortcutssettings.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
QList<QKeySequence> ShortcutsSettings::parseSecuenceString(QString stringSecuence)
|
||||||
|
{
|
||||||
|
QStringList secuences = stringSecuence.split(";");
|
||||||
|
QList<QKeySequence> secuenceList;
|
||||||
|
for(QStringList::const_iterator ss = secuences.cbegin(); ss != secuences.cend(); ++ss)
|
||||||
|
{
|
||||||
|
secuenceList.append(QKeySequence(*ss, QKeySequence::PortableText));
|
||||||
|
}
|
||||||
|
|
||||||
|
return secuenceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShortcutsSettings::ShortcutsSettings(QString settingsPath, QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
this->settingsFilePath = settingsPath;
|
||||||
|
this->settingsFilePath.append("shortcuts.ini");
|
||||||
|
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
|
||||||
|
|
||||||
|
shortCutsFile.beginGroup("Custom");
|
||||||
|
const QStringList customKeys = shortCutsFile.allKeys();
|
||||||
|
for(QStringList::const_iterator it = customKeys.cbegin(); it != customKeys.cend(); ++it)
|
||||||
|
{
|
||||||
|
QString stringSecuence = shortCutsFile.value(*it).toString();
|
||||||
|
QList<QKeySequence> secuenceList = parseSecuenceString(stringSecuence);
|
||||||
|
shortCuts.insert(*it, secuenceList);
|
||||||
|
}
|
||||||
|
shortCutsFile.endGroup();
|
||||||
|
|
||||||
|
shortCutsFile.beginGroup("Defaults");
|
||||||
|
const QStringList defaultKeys = shortCutsFile.allKeys();
|
||||||
|
for(QStringList::const_iterator it = defaultKeys.cbegin(); it != defaultKeys.cend(); ++it)
|
||||||
|
{
|
||||||
|
QString stringSecuence = shortCutsFile.value(*it).toString();
|
||||||
|
QList<QKeySequence> secuenceList = parseSecuenceString(stringSecuence);
|
||||||
|
defaultShortCuts.insert(*it, secuenceList);
|
||||||
|
}
|
||||||
|
shortCutsFile.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QKeySequence> ShortcutsSettings::getShortcut(QString name, QList<QKeySequence> defaultShortCut)
|
||||||
|
{
|
||||||
|
if(shortCuts.contains(name))
|
||||||
|
return shortCuts.value(name);
|
||||||
|
|
||||||
|
setShortcuts(name, defaultShortCut);
|
||||||
|
|
||||||
|
defaultShortCuts[name] = defaultShortCut;
|
||||||
|
|
||||||
|
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
|
||||||
|
shortCutsFile.beginGroup("Defaults");
|
||||||
|
shortCutsFile.setValue(name, stringifySecuence(defaultShortCut));
|
||||||
|
shortCutsFile.endGroup();
|
||||||
|
return defaultShortCut;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QKeySequence> ShortcutsSettings::getShortcut(QString name, QKeySequence defaultShortCut)
|
||||||
|
{
|
||||||
|
return getShortcut(name, QList<QKeySequence>() << defaultShortCut);
|
||||||
|
}
|
||||||
|
|
||||||
|
QKeySequence ShortcutsSettings::getSingleShortcut(QString name, QKeySequence defaultShortCut)
|
||||||
|
{
|
||||||
|
return getShortcut(name,defaultShortCut).at(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QKeySequence> ShortcutsSettings::getDefaultShortCut(QString name)
|
||||||
|
{
|
||||||
|
return defaultShortCuts.value(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShortcutsSettings::stringifySecuence(QList<QKeySequence> secuence) const
|
||||||
|
{
|
||||||
|
QString stringSecuence;
|
||||||
|
for(int i=0; i < secuence.size(); ++i)
|
||||||
|
{
|
||||||
|
stringSecuence.append(secuence.at(i).toString(QKeySequence::PortableText));
|
||||||
|
if(i < secuence.size() - 1)
|
||||||
|
stringSecuence.append(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringSecuence;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsSettings::setShortcuts(QString name, QList<QKeySequence> secuence)
|
||||||
|
{
|
||||||
|
shortCuts[name] = secuence;
|
||||||
|
|
||||||
|
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
|
||||||
|
shortCutsFile.beginGroup("Custom");
|
||||||
|
QString stringSecuence = stringifySecuence(secuence);
|
||||||
|
shortCutsFile.setValue(name, stringSecuence);
|
||||||
|
shortCutsFile.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsSettings::setShortcuts(QString name, QKeySequence secuence)
|
||||||
|
{
|
||||||
|
setShortcuts(name, QList<QKeySequence>() << secuence);
|
||||||
|
}
|
||||||
|
|
37
cockatrice/src/shortcutssettings.h
Normal file
37
cockatrice/src/shortcutssettings.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef SHORTCUTSSETTINGS_H
|
||||||
|
#define SHORTCUTSSETTINGS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QKeySequence>
|
||||||
|
|
||||||
|
class ShortcutsSettings : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ShortcutsSettings(QString settingsFilePath, QObject *parent = 0);
|
||||||
|
~ShortcutsSettings() { }
|
||||||
|
|
||||||
|
QList<QKeySequence> getShortcut(QString name, QList<QKeySequence> defaultShortCut);
|
||||||
|
QList<QKeySequence> getShortcut(QString name, QKeySequence defaultShortCut);
|
||||||
|
QKeySequence getSingleShortcut(QString name, QKeySequence defaultShortCut);
|
||||||
|
QList<QKeySequence> getDefaultShortCut(QString name);
|
||||||
|
|
||||||
|
void setShortcuts(QString name, QList<QKeySequence> secuence);
|
||||||
|
void setShortcuts(QString name, QKeySequence secuence);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString settingsFilePath;
|
||||||
|
QMap<QString,QList<QKeySequence> > shortCuts;
|
||||||
|
QMap<QString,QList<QKeySequence> > defaultShortCuts;
|
||||||
|
|
||||||
|
QString stringifySecuence(QList<QKeySequence> secuence) const;
|
||||||
|
QList<QKeySequence> parseSecuenceString(QString stringSecuence);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHORTCUTSSETTINGS_H
|
|
@ -254,26 +254,44 @@ void TabDeckEditor::createFiltersDock()
|
||||||
void TabDeckEditor::createMenus()
|
void TabDeckEditor::createMenus()
|
||||||
{
|
{
|
||||||
aNewDeck = new QAction(QString(), this);
|
aNewDeck = new QAction(QString(), this);
|
||||||
aNewDeck->setShortcuts(QKeySequence::New);
|
aNewDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aNewDeck",
|
||||||
|
QKeySequence::New));
|
||||||
connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
|
connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
|
||||||
|
|
||||||
aLoadDeck = new QAction(QString(), this);
|
aLoadDeck = new QAction(QString(), this);
|
||||||
aLoadDeck->setShortcuts(QKeySequence::Open);
|
aLoadDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aLoadDeck",
|
||||||
|
QKeySequence::Open));
|
||||||
connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck()));
|
connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck()));
|
||||||
|
|
||||||
aSaveDeck = new QAction(QString(), this);
|
aSaveDeck = new QAction(QString(), this);
|
||||||
aSaveDeck->setShortcuts(QKeySequence::Save);
|
aSaveDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aSaveDeck",
|
||||||
|
QKeySequence::Save));
|
||||||
|
|
||||||
connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck()));
|
connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck()));
|
||||||
aSaveDeckAs = new QAction(QString(), this);
|
aSaveDeckAs = new QAction(QString(), this);
|
||||||
// aSaveDeckAs->setShortcuts(QKeySequence::SaveAs);
|
// aSaveDeckAs->setShortcuts(QKeySequence::SaveAs);
|
||||||
connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs()));
|
connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs()));
|
||||||
|
|
||||||
aLoadDeckFromClipboard = new QAction(QString(), this);
|
aLoadDeckFromClipboard = new QAction(QString(), this);
|
||||||
connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard()));
|
connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard()));
|
||||||
aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste);
|
aLoadDeckFromClipboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aLoadDeckFromClipboard",
|
||||||
|
QKeySequence::Paste));
|
||||||
|
|
||||||
aSaveDeckToClipboard = new QAction(QString(), this);
|
aSaveDeckToClipboard = new QAction(QString(), this);
|
||||||
connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
|
connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
|
||||||
aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy);
|
aSaveDeckToClipboard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aSaveDeckToClipboard",
|
||||||
|
QKeySequence::Copy));
|
||||||
|
|
||||||
aPrintDeck = new QAction(QString(), this);
|
aPrintDeck = new QAction(QString(), this);
|
||||||
aPrintDeck->setShortcuts(QKeySequence::Print);
|
aPrintDeck->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aPrintDeck",QKeySequence::Print));
|
||||||
connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
|
connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
|
||||||
|
|
||||||
aAnalyzeDeck = new QAction(QString(), this);
|
aAnalyzeDeck = new QAction(QString(), this);
|
||||||
connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck()));
|
connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck()));
|
||||||
aClose = new QAction(QString(), this);
|
aClose = new QAction(QString(), this);
|
||||||
|
@ -514,7 +532,9 @@ void TabDeckEditor::retranslateUi()
|
||||||
|
|
||||||
aClearFilterAll->setText(tr("&Clear all filters"));
|
aClearFilterAll->setText(tr("&Clear all filters"));
|
||||||
aClearFilterOne->setText(tr("Delete selected"));
|
aClearFilterOne->setText(tr("Delete selected"));
|
||||||
aClearFilterOne->setShortcut(QKeySequence("Backspace"));
|
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aClearFilterOne",
|
||||||
|
QKeySequence("Backspace")));
|
||||||
|
|
||||||
nameLabel->setText(tr("Deck &name:"));
|
nameLabel->setText(tr("Deck &name:"));
|
||||||
commentsLabel->setText(tr("&Comments:"));
|
commentsLabel->setText(tr("&Comments:"));
|
||||||
|
@ -533,17 +553,27 @@ void TabDeckEditor::retranslateUi()
|
||||||
aAnalyzeDeck->setText(tr("&Analyze deck on deckstats.net"));
|
aAnalyzeDeck->setText(tr("&Analyze deck on deckstats.net"));
|
||||||
aOpenCustomFolder->setText(tr("Open custom image folder"));
|
aOpenCustomFolder->setText(tr("Open custom image folder"));
|
||||||
aClose->setText(tr("&Close"));
|
aClose->setText(tr("&Close"));
|
||||||
aClose->setShortcut(QKeySequence("Ctrl+Q"));
|
aClose->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aClose",
|
||||||
|
QKeySequence("Ctrl+Q")));
|
||||||
|
|
||||||
aAddCard->setText(tr("Add card to &maindeck"));
|
aAddCard->setText(tr("Add card to &maindeck"));
|
||||||
aAddCardToSideboard->setText(tr("Add card to &sideboard"));
|
aAddCardToSideboard->setText(tr("Add card to &sideboard"));
|
||||||
|
|
||||||
aRemoveCard->setText(tr("&Remove row"));
|
aRemoveCard->setText(tr("&Remove row"));
|
||||||
aRemoveCard->setShortcut(QKeySequence("Del"));
|
aRemoveCard->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aRemoveCard",
|
||||||
|
QKeySequence("Del")));
|
||||||
|
|
||||||
aIncrement->setText(tr("&Increment number"));
|
aIncrement->setText(tr("&Increment number"));
|
||||||
aIncrement->setShortcut(QKeySequence("+"));
|
aIncrement->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aIncrement",
|
||||||
|
QKeySequence("+")));
|
||||||
|
|
||||||
aDecrement->setText(tr("&Decrement number"));
|
aDecrement->setText(tr("&Decrement number"));
|
||||||
aDecrement->setShortcut(QKeySequence("-"));
|
aDecrement->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabDeckEditor/aDecrement",
|
||||||
|
QKeySequence("-")));
|
||||||
|
|
||||||
deckMenu->setTitle(tr("&Deck Editor"));
|
deckMenu->setTitle(tr("&Deck Editor"));
|
||||||
dbMenu->setTitle(tr("C&ard Database"));
|
dbMenu->setTitle(tr("C&ard Database"));
|
||||||
|
|
|
@ -125,9 +125,13 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
void DeckViewContainer::retranslateUi()
|
void DeckViewContainer::retranslateUi()
|
||||||
{
|
{
|
||||||
loadLocalButton->setText(tr("Load local deck"));
|
loadLocalButton->setText(tr("Load local deck"));
|
||||||
loadLocalButton->setShortcut(QKeySequence("Ctrl+O"));
|
loadLocalButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||||
|
"DeckViewContainer/loadLocalButton",
|
||||||
|
QKeySequence("Ctrl+O")));
|
||||||
loadRemoteButton->setText(tr("Load deck from server"));
|
loadRemoteButton->setText(tr("Load deck from server"));
|
||||||
loadRemoteButton->setShortcut(QKeySequence("Ctrl+Alt+O"));
|
loadRemoteButton->setShortcut(settingsCache->shortcuts().getSingleShortcut(
|
||||||
|
"DeckViewContainer/loadRemoteButton",
|
||||||
|
QKeySequence("Ctrl+Alt+O")));
|
||||||
readyStartButton->setText(tr("Ready to s&tart"));
|
readyStartButton->setText(tr("Ready to s&tart"));
|
||||||
updateSideboardLockButtonText();
|
updateSideboardLockButtonText();
|
||||||
}
|
}
|
||||||
|
@ -469,12 +473,12 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
||||||
QAction *temp = new QAction(QString(), this);
|
QAction *temp = new QAction(QString(), this);
|
||||||
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction()));
|
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction()));
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0: temp->setShortcut(QKeySequence("F5")); break;
|
case 0: temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase0" ,QKeySequence("F5"))); break;
|
||||||
case 2: temp->setShortcut(QKeySequence("F6")); break;
|
case 2: temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase2" ,QKeySequence("F6"))); break;
|
||||||
case 3: temp->setShortcut(QKeySequence("F7")); break;
|
case 3: temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase3" ,QKeySequence("F7"))); break;
|
||||||
case 4: temp->setShortcut(QKeySequence("F8")); break;
|
case 4: temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase4" ,QKeySequence("F8"))); break;
|
||||||
case 9: temp->setShortcut(QKeySequence("F9")); break;
|
case 9: temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase9" ,QKeySequence("F9"))); break;
|
||||||
case 10: temp->setShortcut(QKeySequence("F10")); break;
|
case 10:temp->setShortcuts(settingsCache->shortcuts().getShortcut("TabGame/phase10" ,QKeySequence("F10"))); break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
phasesMenu->addAction(temp);
|
phasesMenu->addAction(temp);
|
||||||
|
@ -545,37 +549,57 @@ void TabGame::retranslateUi()
|
||||||
gameMenu->setTitle(tr("&Game"));
|
gameMenu->setTitle(tr("&Game"));
|
||||||
if (aNextPhase) {
|
if (aNextPhase) {
|
||||||
aNextPhase->setText(tr("Next &phase"));
|
aNextPhase->setText(tr("Next &phase"));
|
||||||
aNextPhase->setShortcuts(QList<QKeySequence>() << QKeySequence("Ctrl+Space") << QKeySequence("Tab"));
|
aNextPhase->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aNextPhase",
|
||||||
|
QList<QKeySequence>()
|
||||||
|
<< QKeySequence("Ctrl+Space")
|
||||||
|
<< QKeySequence("Tab")));
|
||||||
}
|
}
|
||||||
if (aNextTurn) {
|
if (aNextTurn) {
|
||||||
aNextTurn->setText(tr("Next &turn"));
|
aNextTurn->setText(tr("Next &turn"));
|
||||||
aNextTurn->setShortcuts(QList<QKeySequence>() << QKeySequence("Ctrl+Return") << QKeySequence("Ctrl+Enter"));
|
aNextTurn->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aNextTurn",
|
||||||
|
QList<QKeySequence>()
|
||||||
|
<< QKeySequence("Ctrl+Return")
|
||||||
|
<< QKeySequence("Ctrl+Enter")));
|
||||||
}
|
}
|
||||||
if (aRemoveLocalArrows) {
|
if (aRemoveLocalArrows) {
|
||||||
aRemoveLocalArrows->setText(tr("&Remove all local arrows"));
|
aRemoveLocalArrows->setText(tr("&Remove all local arrows"));
|
||||||
aRemoveLocalArrows->setShortcut(QKeySequence("Ctrl+R"));
|
aRemoveLocalArrows->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aRemoveLocalArrows",
|
||||||
|
QKeySequence("Ctrl+R")));
|
||||||
}
|
}
|
||||||
if (aRotateViewCW) {
|
if (aRotateViewCW) {
|
||||||
aRotateViewCW->setText(tr("Rotate View Cl&ockwise"));
|
aRotateViewCW->setText(tr("Rotate View Cl&ockwise"));
|
||||||
aRotateViewCW->setShortcut(QKeySequence("Ctrl+]"));
|
aRotateViewCW->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aRotateViewCW",
|
||||||
|
QKeySequence("Ctrl+]")));
|
||||||
}
|
}
|
||||||
if (aRotateViewCCW) {
|
if (aRotateViewCCW) {
|
||||||
aRotateViewCCW->setText(tr("Rotate View Co&unterclockwise"));
|
aRotateViewCCW->setText(tr("Rotate View Co&unterclockwise"));
|
||||||
aRotateViewCCW->setShortcut(QKeySequence("Ctrl+["));
|
aRotateViewCCW->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aRotateViewCCW",
|
||||||
|
QKeySequence("Ctrl+[")));
|
||||||
}
|
}
|
||||||
if (aGameInfo)
|
if (aGameInfo)
|
||||||
aGameInfo->setText(tr("Game &information"));
|
aGameInfo->setText(tr("Game &information"));
|
||||||
if (aConcede) {
|
if (aConcede) {
|
||||||
aConcede->setText(tr("&Concede"));
|
aConcede->setText(tr("&Concede"));
|
||||||
aConcede->setShortcut(QKeySequence("F2"));
|
aConcede->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aRotateViewCCW",
|
||||||
|
QKeySequence("F2")));
|
||||||
}
|
}
|
||||||
if (aLeaveGame) {
|
if (aLeaveGame) {
|
||||||
aLeaveGame->setText(tr("&Leave game"));
|
aLeaveGame->setText(tr("&Leave game"));
|
||||||
aLeaveGame->setShortcut(QKeySequence("Ctrl+Q"));
|
aLeaveGame->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aLeaveGame",
|
||||||
|
QKeySequence("Ctrl+Q")));
|
||||||
}
|
}
|
||||||
if (aCloseReplay) {
|
if (aCloseReplay) {
|
||||||
aCloseReplay->setText(tr("C&lose replay"));
|
aCloseReplay->setText(tr("C&lose replay"));
|
||||||
aCloseReplay->setShortcut(QKeySequence("Ctrl+Q"));
|
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut(
|
||||||
|
"TabGame/aCloseReplay",
|
||||||
|
QKeySequence("Ctrl+Q")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sayLabel)
|
if (sayLabel)
|
||||||
|
|
|
@ -59,7 +59,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
||||||
QMenu *chatSettingsMenu = new QMenu(this);
|
QMenu *chatSettingsMenu = new QMenu(this);
|
||||||
|
|
||||||
aClearChat = chatSettingsMenu->addAction(QString());
|
aClearChat = chatSettingsMenu->addAction(QString());
|
||||||
aClearChat->setShortcut(QKeySequence("F12"));
|
aClearChat->setShortcuts(settingsCache->shortcuts().getShortcut("tab_room/aClearChat", QKeySequence("F12")));
|
||||||
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat()));
|
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat()));
|
||||||
|
|
||||||
chatSettingsMenu->addSeparator();
|
chatSettingsMenu->addSeparator();
|
||||||
|
|
|
@ -458,7 +458,7 @@ void MainWindow::retranslateUi()
|
||||||
aWatchReplay->setText(tr("&Watch replay..."));
|
aWatchReplay->setText(tr("&Watch replay..."));
|
||||||
aDeckEditor->setText(tr("&Deck editor"));
|
aDeckEditor->setText(tr("&Deck editor"));
|
||||||
aFullScreen->setText(tr("&Full screen"));
|
aFullScreen->setText(tr("&Full screen"));
|
||||||
aFullScreen->setShortcut(QKeySequence("Ctrl+F"));
|
aFullScreen->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aFullScreen", QKeySequence("Ctrl+F")));
|
||||||
aRegister->setText(tr("&Register to server..."));
|
aRegister->setText(tr("&Register to server..."));
|
||||||
aSettings->setText(tr("&Settings..."));
|
aSettings->setText(tr("&Settings..."));
|
||||||
aExit->setText(tr("&Exit"));
|
aExit->setText(tr("&Exit"));
|
||||||
|
|
|
@ -13,6 +13,7 @@ SET(oracle_SOURCES
|
||||||
src/oracleimporter.cpp
|
src/oracleimporter.cpp
|
||||||
../cockatrice/src/carddatabase.cpp
|
../cockatrice/src/carddatabase.cpp
|
||||||
../cockatrice/src/settingscache.cpp
|
../cockatrice/src/settingscache.cpp
|
||||||
|
../cockatrice/src/shortcutssettings.cpp
|
||||||
../cockatrice/src/qt-json/json.cpp
|
../cockatrice/src/qt-json/json.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue