Fix release tests (#4063)
This commit is contained in:
parent
80f613a77a
commit
44297dcd1c
57 changed files with 1114 additions and 697 deletions
|
@ -22,7 +22,7 @@ AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, int _id
|
||||||
setFlag(ItemIsSelectable);
|
setFlag(ItemIsSelectable);
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
|
||||||
connect(settingsCache, SIGNAL(displayCardNamesChanged()), this, SLOT(callUpdate()));
|
connect(&SettingsCache::instance(), SIGNAL(displayCardNamesChanged()), this, SLOT(callUpdate()));
|
||||||
cardInfoUpdated();
|
cardInfoUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
||||||
|
|
||||||
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
||||||
{
|
{
|
||||||
const int MAX_FONT_SIZE = settingsCache->getMaxFontSize();
|
const int MAX_FONT_SIZE = SettingsCache::instance().getMaxFontSize();
|
||||||
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
||||||
|
|
||||||
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
||||||
|
@ -133,7 +133,7 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
||||||
else
|
else
|
||||||
painter->drawRect(QRectF(1, 1, CARD_WIDTH - 2, CARD_HEIGHT - 1.5));
|
painter->drawRect(QRectF(1, 1, CARD_WIDTH - 2, CARD_HEIGHT - 1.5));
|
||||||
|
|
||||||
if (translatedPixmap.isNull() || settingsCache->getDisplayCardNames() || facedown) {
|
if (translatedPixmap.isNull() || SettingsCache::instance().getDisplayCardNames() || facedown) {
|
||||||
painter->save();
|
painter->save();
|
||||||
transformPainter(painter, translatedSize, angle);
|
transformPainter(painter, translatedSize, angle);
|
||||||
painter->setPen(Qt::white);
|
painter->setPen(Qt::white);
|
||||||
|
@ -203,7 +203,7 @@ void AbstractCardItem::setHovered(bool _hovered)
|
||||||
processHoverEvent();
|
processHoverEvent();
|
||||||
isHovered = _hovered;
|
isHovered = _hovered;
|
||||||
setZValue(_hovered ? 2000000004 : realZValue);
|
setZValue(_hovered ? 2000000004 : realZValue);
|
||||||
setScale(_hovered && settingsCache->getScaleCards() ? 1.1 : 1);
|
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
|
||||||
setTransformOriginPoint(_hovered ? CARD_WIDTH / 2 : 0, _hovered ? CARD_HEIGHT / 2 : 0);
|
setTransformOriginPoint(_hovered ? CARD_WIDTH / 2 : 0, _hovered ? CARD_HEIGHT / 2 : 0);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tapped = _tapped;
|
tapped = _tapped;
|
||||||
if (settingsCache->getTapAnimation() && canAnimate)
|
if (SettingsCache::instance().getTapAnimation() && canAnimate)
|
||||||
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
||||||
else {
|
else {
|
||||||
tapAngle = tapped ? 90 : 0;
|
tapAngle = tapped ? 90 : 0;
|
||||||
|
@ -313,4 +313,4 @@ QVariant AbstractCardItem::itemChange(QGraphicsItem::GraphicsItemChange change,
|
||||||
return value;
|
return value;
|
||||||
} else
|
} else
|
||||||
return QGraphicsItem::itemChange(change, value);
|
return QGraphicsItem::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ AbstractCounter::AbstractCounter(Player *_player,
|
||||||
menu = nullptr;
|
menu = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
@ -87,16 +87,17 @@ void AbstractCounter::setShortcutsActive()
|
||||||
if (!player->getLocal()) {
|
if (!player->getLocal()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
if (name == "life") {
|
if (name == "life") {
|
||||||
shortcutActive = true;
|
shortcutActive = true;
|
||||||
aSet->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSet"));
|
aSet->setShortcuts(shortcuts.getShortcut("Player/aSet"));
|
||||||
aDec->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDec"));
|
aDec->setShortcuts(shortcuts.getShortcut("Player/aDec"));
|
||||||
aInc->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aInc"));
|
aInc->setShortcuts(shortcuts.getShortcut("Player/aInc"));
|
||||||
} else if (useNameForShortcut) {
|
} else if (useNameForShortcut) {
|
||||||
shortcutActive = true;
|
shortcutActive = true;
|
||||||
aSet->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetCounter_" + name));
|
aSet->setShortcuts(shortcuts.getShortcut("Player/aSetCounter_" + name));
|
||||||
aDec->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecCounter_" + name));
|
aDec->setShortcuts(shortcuts.getShortcut("Player/aDecCounter_" + name));
|
||||||
aInc->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncCounter_" + name));
|
aInc->setShortcuts(shortcuts.getShortcut("Player/aIncCounter_" + name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,12 +240,12 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
if (startZone->getName().compare("hand") == 0) {
|
if (startZone->getName().compare("hand") == 0) {
|
||||||
startCard->playCard(false);
|
startCard->playCard(false);
|
||||||
CardInfoPtr ci = startCard->getInfo();
|
CardInfoPtr ci = startCard->getInfo();
|
||||||
if (ci && (((!settingsCache->getPlayToStack() && ci->getTableRow() == 3) ||
|
if (ci && (((!SettingsCache::instance().getPlayToStack() && ci->getTableRow() == 3) ||
|
||||||
((settingsCache->getPlayToStack() && ci->getTableRow() != 0) &&
|
((SettingsCache::instance().getPlayToStack() && ci->getTableRow() != 0) &&
|
||||||
startCard->getZone()->getName().toStdString() != "stack"))))
|
startCard->getZone()->getName().toStdString() != "stack"))))
|
||||||
cmd.set_start_zone("stack");
|
cmd.set_start_zone("stack");
|
||||||
else
|
else
|
||||||
cmd.set_start_zone(settingsCache->getPlayToStack() ? "stack" : "table");
|
cmd.set_start_zone(SettingsCache::instance().getPlayToStack() ? "stack" : "table");
|
||||||
}
|
}
|
||||||
player->sendGameCommand(cmd);
|
player->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,27 +68,27 @@ QString CardSet::getCorrectedShortName() const
|
||||||
|
|
||||||
void CardSet::loadSetOptions()
|
void CardSet::loadSetOptions()
|
||||||
{
|
{
|
||||||
sortKey = settingsCache->cardDatabase().getSortKey(shortName);
|
sortKey = SettingsCache::instance().cardDatabase().getSortKey(shortName);
|
||||||
enabled = settingsCache->cardDatabase().isEnabled(shortName);
|
enabled = SettingsCache::instance().cardDatabase().isEnabled(shortName);
|
||||||
isknown = settingsCache->cardDatabase().isKnown(shortName);
|
isknown = SettingsCache::instance().cardDatabase().isKnown(shortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardSet::setSortKey(unsigned int _sortKey)
|
void CardSet::setSortKey(unsigned int _sortKey)
|
||||||
{
|
{
|
||||||
sortKey = _sortKey;
|
sortKey = _sortKey;
|
||||||
settingsCache->cardDatabase().setSortKey(shortName, _sortKey);
|
SettingsCache::instance().cardDatabase().setSortKey(shortName, _sortKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardSet::setEnabled(bool _enabled)
|
void CardSet::setEnabled(bool _enabled)
|
||||||
{
|
{
|
||||||
enabled = _enabled;
|
enabled = _enabled;
|
||||||
settingsCache->cardDatabase().setEnabled(shortName, _enabled);
|
SettingsCache::instance().cardDatabase().setEnabled(shortName, _enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardSet::setIsKnown(bool _isknown)
|
void CardSet::setIsKnown(bool _isknown)
|
||||||
{
|
{
|
||||||
isknown = _isknown;
|
isknown = _isknown;
|
||||||
settingsCache->cardDatabase().setIsKnown(shortName, _isknown);
|
SettingsCache::instance().cardDatabase().setIsKnown(shortName, _isknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SetList::KeyCompareFunctor
|
class SetList::KeyCompareFunctor
|
||||||
|
@ -337,7 +337,7 @@ CardDatabase::CardDatabase(QObject *parent) : QObject(parent), loadStatus(NotLoa
|
||||||
connect(parser, SIGNAL(addSet(CardSetPtr)), this, SLOT(addSet(CardSetPtr)), Qt::DirectConnection);
|
connect(parser, SIGNAL(addSet(CardSetPtr)), this, SLOT(addSet(CardSetPtr)), Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(settingsCache, SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabases()));
|
connect(&SettingsCache::instance(), SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabases()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CardDatabase::~CardDatabase()
|
CardDatabase::~CardDatabase()
|
||||||
|
@ -515,12 +515,12 @@ LoadStatus CardDatabase::loadCardDatabases()
|
||||||
|
|
||||||
clear(); // remove old db
|
clear(); // remove old db
|
||||||
|
|
||||||
loadStatus = loadCardDatabase(settingsCache->getCardDatabasePath()); // load main card database
|
loadStatus = loadCardDatabase(SettingsCache::instance().getCardDatabasePath()); // load main card database
|
||||||
loadCardDatabase(settingsCache->getTokenDatabasePath()); // load tokens database
|
loadCardDatabase(SettingsCache::instance().getTokenDatabasePath()); // load tokens database
|
||||||
loadCardDatabase(settingsCache->getSpoilerCardDatabasePath()); // load spoilers database
|
loadCardDatabase(SettingsCache::instance().getSpoilerCardDatabasePath()); // load spoilers database
|
||||||
|
|
||||||
// load custom card databases
|
// load custom card databases
|
||||||
QDir dir(settingsCache->getCustomCardDatabasePath());
|
QDir dir(SettingsCache::instance().getCustomCardDatabasePath());
|
||||||
for (const QString &fileName :
|
for (const QString &fileName :
|
||||||
dir.entryList(QStringList("*.xml"), QDir::Files | QDir::Readable, QDir::Name | QDir::IgnoreCase)) {
|
dir.entryList(QStringList("*.xml"), QDir::Files | QDir::Readable, QDir::Name | QDir::IgnoreCase)) {
|
||||||
loadCardDatabase(dir.absoluteFilePath(fileName));
|
loadCardDatabase(dir.absoluteFilePath(fileName));
|
||||||
|
@ -625,7 +625,8 @@ void CardDatabase::notifyEnabledSetsChanged()
|
||||||
|
|
||||||
bool CardDatabase::saveCustomTokensToFile()
|
bool CardDatabase::saveCustomTokensToFile()
|
||||||
{
|
{
|
||||||
QString fileName = settingsCache->getCustomCardDatabasePath() + "/" + CardDatabase::TOKENS_SETNAME + ".xml";
|
QString fileName =
|
||||||
|
SettingsCache::instance().getCustomCardDatabasePath() + "/" + CardDatabase::TOKENS_SETNAME + ".xml";
|
||||||
|
|
||||||
SetNameMap tmpSets;
|
SetNameMap tmpSets;
|
||||||
CardSetPtr customTokensSet = getSet(CardDatabase::TOKENS_SETNAME);
|
CardSetPtr customTokensSet = getSet(CardDatabase::TOKENS_SETNAME);
|
||||||
|
|
|
@ -55,7 +55,7 @@ CardFrame::CardFrame(const QString &cardName, QWidget *parent) : QTabWidget(pare
|
||||||
tab3Layout->addWidget(splitter);
|
tab3Layout->addWidget(splitter);
|
||||||
tab3->setLayout(tab3Layout);
|
tab3->setLayout(tab3Layout);
|
||||||
|
|
||||||
setViewMode(settingsCache->getCardInfoViewMode());
|
setViewMode(SettingsCache::instance().getCardInfoViewMode());
|
||||||
|
|
||||||
setCard(db->getCard(cardName));
|
setCard(db->getCard(cardName));
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ void CardFrame::setViewMode(int mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->setCardInfoViewMode(mode);
|
SettingsCache::instance().setCardInfoViewMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardFrame::setCard(CardInfoPtr card)
|
void CardFrame::setCard(CardInfoPtr card)
|
||||||
|
|
|
@ -367,7 +367,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
cardMenu->exec(event->screenPos());
|
cardMenu->exec(event->screenPos());
|
||||||
}
|
}
|
||||||
} else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
} else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
||||||
(!settingsCache->getDoubleClickToPlay())) {
|
(!SettingsCache::instance().getDoubleClickToPlay())) {
|
||||||
bool hideCard = false;
|
bool hideCard = false;
|
||||||
if (zone && zone->getIsView()) {
|
if (zone && zone->getIsView()) {
|
||||||
ZoneViewZone *view = static_cast<ZoneViewZone *>(zone);
|
ZoneViewZone *view = static_cast<ZoneViewZone *>(zone);
|
||||||
|
@ -387,7 +387,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((event->modifiers() != Qt::AltModifier) && (settingsCache->getDoubleClickToPlay()) &&
|
if ((event->modifiers() != Qt::AltModifier) && (SettingsCache::instance().getDoubleClickToPlay()) &&
|
||||||
(event->buttons() == Qt::LeftButton)) {
|
(event->buttons() == Qt::LeftButton)) {
|
||||||
if (revealedCard)
|
if (revealedCard)
|
||||||
zone->removeCard(this);
|
zone->removeCard(this);
|
||||||
|
|
|
@ -218,11 +218,11 @@ void ChatView::appendMessage(QString message,
|
||||||
}
|
}
|
||||||
cursor.setCharFormat(defaultFormat);
|
cursor.setCharFormat(defaultFormat);
|
||||||
|
|
||||||
bool mentionEnabled = settingsCache->getChatMention();
|
bool mentionEnabled = SettingsCache::instance().getChatMention();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
highlightedWords = settingsCache->getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
highlightedWords = settingsCache->getHighlightWords().split(' ', QString::SkipEmptyParts);
|
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', QString::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parse the message
|
// parse the message
|
||||||
|
@ -321,8 +321,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
|
||||||
// You have received a valid mention!!
|
// You have received a valid mention!!
|
||||||
soundEngine->playSound("chat_mention");
|
soundEngine->playSound("chat_mention");
|
||||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||||
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white)
|
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
||||||
: QBrush(Qt::black));
|
: QBrush(Qt::black));
|
||||||
cursor.insertText(mention, mentionFormat);
|
cursor.insertText(mention, mentionFormat);
|
||||||
message = message.mid(mention.size());
|
message = message.mid(mention.size());
|
||||||
showSystemPopup(sender);
|
showSystemPopup(sender);
|
||||||
|
@ -343,8 +343,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
|
||||||
// Moderator Sending Global Message
|
// Moderator Sending Global Message
|
||||||
soundEngine->playSound("all_mention");
|
soundEngine->playSound("all_mention");
|
||||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||||
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white)
|
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
||||||
: QBrush(Qt::black));
|
: QBrush(Qt::black));
|
||||||
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
|
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
|
||||||
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
|
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
|
||||||
showSystemPopup(sender);
|
showSystemPopup(sender);
|
||||||
|
@ -391,8 +391,8 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
|
||||||
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
|
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
|
||||||
// You have received a valid mention of custom word!!
|
// You have received a valid mention of custom word!!
|
||||||
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
|
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
|
||||||
highlightFormat.setForeground(settingsCache->getChatHighlightForeground() ? QBrush(Qt::white)
|
highlightFormat.setForeground(SettingsCache::instance().getChatHighlightForeground() ? QBrush(Qt::white)
|
||||||
: QBrush(Qt::black));
|
: QBrush(Qt::black));
|
||||||
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
|
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
|
||||||
cursor.insertText(rest, defaultFormat);
|
cursor.insertText(rest, defaultFormat);
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
|
@ -448,7 +448,7 @@ void ChatView::actMessageClicked()
|
||||||
void ChatView::showSystemPopup(QString &sender)
|
void ChatView::showSystemPopup(QString &sender)
|
||||||
{
|
{
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
if (settingsCache->getShowMentionPopup()) {
|
if (SettingsCache::instance().getShowMentionPopup()) {
|
||||||
QString ref = sender.left(sender.length() - 2);
|
QString ref = sender.left(sender.length() - 2);
|
||||||
emit showMentionPopup(ref);
|
emit showMentionPopup(ref);
|
||||||
}
|
}
|
||||||
|
@ -457,14 +457,14 @@ void ChatView::showSystemPopup(QString &sender)
|
||||||
QColor ChatView::getCustomMentionColor()
|
QColor ChatView::getCustomMentionColor()
|
||||||
{
|
{
|
||||||
QColor customColor;
|
QColor customColor;
|
||||||
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
|
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
||||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor ChatView::getCustomHighlightColor()
|
QColor ChatView::getCustomHighlightColor()
|
||||||
{
|
{
|
||||||
QColor customColor;
|
QColor customColor;
|
||||||
customColor.setNamedColor("#" + settingsCache->getChatHighlightColor());
|
customColor.setNamedColor("#" + SettingsCache::instance().getChatHighlightColor());
|
||||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ bool LineEditUnfocusable::isUnfocusShortcut(QKeyEvent *event)
|
||||||
keyNoMod = QKeySequence(event->key()).toString();
|
keyNoMod = QKeySequence(event->key()).toString();
|
||||||
|
|
||||||
QKeySequence key(modifier + keyNoMod);
|
QKeySequence key(modifier + keyNoMod);
|
||||||
QList<QKeySequence> unfocusShortcut = settingsCache->shortcuts().getShortcut("Textbox/unfocusTextBox");
|
QList<QKeySequence> unfocusShortcut = SettingsCache::instance().shortcuts().getShortcut("Textbox/unfocusTextBox");
|
||||||
|
|
||||||
for (QList<QKeySequence>::iterator i = unfocusShortcut.begin(); i != unfocusShortcut.end(); ++i) {
|
for (QList<QKeySequence>::iterator i = unfocusShortcut.begin(); i != unfocusShortcut.end(); ++i) {
|
||||||
if (key.matches(*i) == QKeySequence::ExactMatch)
|
if (key.matches(*i) == QKeySequence::ExactMatch)
|
||||||
|
|
|
@ -63,11 +63,11 @@ DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
||||||
autoConnectCheckBox = new QCheckBox(tr("A&uto connect"));
|
autoConnectCheckBox = new QCheckBox(tr("A&uto connect"));
|
||||||
autoConnectCheckBox->setToolTip(tr("Automatically connect to the most recent login when Cockatrice opens"));
|
autoConnectCheckBox->setToolTip(tr("Automatically connect to the most recent login when Cockatrice opens"));
|
||||||
|
|
||||||
if (settingsCache->servers().getSavePassword()) {
|
if (SettingsCache::instance().servers().getSavePassword()) {
|
||||||
autoConnectCheckBox->setChecked(static_cast<bool>(settingsCache->servers().getAutoConnect()));
|
autoConnectCheckBox->setChecked(static_cast<bool>(SettingsCache::instance().servers().getAutoConnect()));
|
||||||
autoConnectCheckBox->setEnabled(true);
|
autoConnectCheckBox->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
settingsCache->servers().setAutoConnect(0);
|
SettingsCache::instance().servers().setAutoConnect(0);
|
||||||
autoConnectCheckBox->setChecked(false);
|
autoConnectCheckBox->setChecked(false);
|
||||||
autoConnectCheckBox->setEnabled(false);
|
autoConnectCheckBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -192,8 +192,8 @@ void DlgConnect::rebuildComboBoxList(int failure)
|
||||||
UserConnection_Information uci;
|
UserConnection_Information uci;
|
||||||
savedHostList = uci.getServerInfo();
|
savedHostList = uci.getServerInfo();
|
||||||
|
|
||||||
bool autoConnectEnabled = static_cast<bool>(settingsCache->servers().getAutoConnect());
|
bool autoConnectEnabled = static_cast<bool>(SettingsCache::instance().servers().getAutoConnect());
|
||||||
QString autoConnectSaveName = settingsCache->servers().getSaveName();
|
QString autoConnectSaveName = SettingsCache::instance().servers().getSaveName();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
@ -297,23 +297,24 @@ void DlgConnect::passwordSaved(int state)
|
||||||
|
|
||||||
void DlgConnect::actOk()
|
void DlgConnect::actOk()
|
||||||
{
|
{
|
||||||
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
|
|
||||||
if (newHostButton->isChecked()) {
|
if (newHostButton->isChecked()) {
|
||||||
if (saveEdit->text().isEmpty()) {
|
if (saveEdit->text().isEmpty()) {
|
||||||
QMessageBox::critical(this, tr("Connection Warning"), tr("You need to name your new connection profile."));
|
QMessageBox::critical(this, tr("Connection Warning"), tr("You need to name your new connection profile."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().addNewServer(saveEdit->text().trimmed(), hostEdit->text().trimmed(),
|
servers.addNewServer(saveEdit->text().trimmed(), hostEdit->text().trimmed(), portEdit->text().trimmed(),
|
||||||
portEdit->text().trimmed(), playernameEdit->text().trimmed(),
|
playernameEdit->text().trimmed(), passwordEdit->text(), savePasswordCheckBox->isChecked());
|
||||||
passwordEdit->text(), savePasswordCheckBox->isChecked());
|
|
||||||
} else {
|
} else {
|
||||||
settingsCache->servers().updateExistingServer(saveEdit->text().trimmed(), hostEdit->text().trimmed(),
|
servers.updateExistingServer(saveEdit->text().trimmed(), hostEdit->text().trimmed(), portEdit->text().trimmed(),
|
||||||
portEdit->text().trimmed(), playernameEdit->text().trimmed(),
|
playernameEdit->text().trimmed(), passwordEdit->text(),
|
||||||
passwordEdit->text(), savePasswordCheckBox->isChecked());
|
savePasswordCheckBox->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().setPrevioushostName(saveEdit->text());
|
servers.setPrevioushostName(saveEdit->text());
|
||||||
settingsCache->servers().setAutoConnect(autoConnectCheckBox->isChecked());
|
servers.setAutoConnect(autoConnectCheckBox->isChecked());
|
||||||
|
|
||||||
if (playernameEdit->text().isEmpty()) {
|
if (playernameEdit->text().isEmpty()) {
|
||||||
QMessageBox::critical(this, tr("Connect Warning"), tr("The player name can't be empty."));
|
QMessageBox::critical(this, tr("Connect Warning"), tr("The player name can't be empty."));
|
||||||
|
@ -347,4 +348,4 @@ void DlgConnect::actForgotPassword()
|
||||||
{
|
{
|
||||||
emit sigStartForgotPasswordRequest();
|
emit sigStartForgotPasswordRequest();
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
||||||
chooseTokenFromDeckRadioButton = new QRadioButton(tr("Show tokens from this &deck"));
|
chooseTokenFromDeckRadioButton = new QRadioButton(tr("Show tokens from this &deck"));
|
||||||
connect(chooseTokenFromDeckRadioButton, SIGNAL(toggled(bool)), this, SLOT(actChooseTokenFromDeck(bool)));
|
connect(chooseTokenFromDeckRadioButton, SIGNAL(toggled(bool)), this, SLOT(actChooseTokenFromDeck(bool)));
|
||||||
|
|
||||||
QByteArray deckHeaderState = settingsCache->layouts().getDeckEditorDbHeaderState();
|
QByteArray deckHeaderState = SettingsCache::instance().layouts().getDeckEditorDbHeaderState();
|
||||||
chooseTokenView = new QTreeView;
|
chooseTokenView = new QTreeView;
|
||||||
chooseTokenView->setModel(cardDatabaseDisplayModel);
|
chooseTokenView->setModel(cardDatabaseDisplayModel);
|
||||||
chooseTokenView->setUniformRowHeights(true);
|
chooseTokenView->setUniformRowHeights(true);
|
||||||
|
@ -137,13 +137,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
||||||
setWindowTitle(tr("Create token"));
|
setWindowTitle(tr("Create token"));
|
||||||
|
|
||||||
resize(600, 500);
|
resize(600, 500);
|
||||||
restoreGeometry(settingsCache->getTokenDialogGeometry());
|
restoreGeometry(SettingsCache::instance().getTokenDialogGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::closeEvent(QCloseEvent *event)
|
void DlgCreateToken::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
settingsCache->setTokenDialogGeometry(saveGeometry());
|
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||||
|
@ -161,7 +161,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
||||||
const QChar cardColor = cardInfo->getColorChar();
|
const QChar cardColor = cardInfo->getColorChar();
|
||||||
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||||
ptEdit->setText(cardInfo->getPowTough());
|
ptEdit->setText(cardInfo->getPowTough());
|
||||||
if (settingsCache->getAnnotateTokens())
|
if (SettingsCache::instance().getAnnotateTokens())
|
||||||
annotationEdit->setText(cardInfo->getText());
|
annotationEdit->setText(cardInfo->getText());
|
||||||
} else {
|
} else {
|
||||||
nameEdit->setText("");
|
nameEdit->setText("");
|
||||||
|
@ -205,13 +205,13 @@ void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
||||||
|
|
||||||
void DlgCreateToken::actOk()
|
void DlgCreateToken::actOk()
|
||||||
{
|
{
|
||||||
settingsCache->setTokenDialogGeometry(saveGeometry());
|
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::actReject()
|
void DlgCreateToken::actReject()
|
||||||
{
|
{
|
||||||
settingsCache->setTokenDialogGeometry(saveGeometry());
|
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ void DlgCreateGame::sharedCtor()
|
||||||
QRadioButton *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this);
|
QRadioButton *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this);
|
||||||
gameTypeLayout->addWidget(gameTypeRadioButton);
|
gameTypeLayout->addWidget(gameTypeRadioButton);
|
||||||
gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton);
|
gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton);
|
||||||
bool isChecked = settingsCache->getGameTypes().contains(gameTypeIterator.value() + ", ");
|
bool isChecked = SettingsCache::instance().getGameTypes().contains(gameTypeIterator.value() + ", ");
|
||||||
gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked);
|
gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked);
|
||||||
}
|
}
|
||||||
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
||||||
|
@ -115,20 +115,20 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
rememberGameSettings->setChecked(settingsCache->getRememberGameSettings());
|
rememberGameSettings->setChecked(SettingsCache::instance().getRememberGameSettings());
|
||||||
descriptionEdit->setText(settingsCache->getGameDescription());
|
descriptionEdit->setText(SettingsCache::instance().getGameDescription());
|
||||||
maxPlayersEdit->setValue(settingsCache->getMaxPlayers());
|
maxPlayersEdit->setValue(SettingsCache::instance().getMaxPlayers());
|
||||||
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) {
|
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) {
|
||||||
onlyBuddiesCheckBox->setChecked(settingsCache->getOnlyBuddies());
|
onlyBuddiesCheckBox->setChecked(SettingsCache::instance().getOnlyBuddies());
|
||||||
onlyRegisteredCheckBox->setChecked(settingsCache->getOnlyRegistered());
|
onlyRegisteredCheckBox->setChecked(SettingsCache::instance().getOnlyRegistered());
|
||||||
} else {
|
} else {
|
||||||
onlyBuddiesCheckBox->setEnabled(false);
|
onlyBuddiesCheckBox->setEnabled(false);
|
||||||
onlyRegisteredCheckBox->setEnabled(false);
|
onlyRegisteredCheckBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
spectatorsAllowedCheckBox->setChecked(settingsCache->getSpectatorsAllowed());
|
spectatorsAllowedCheckBox->setChecked(SettingsCache::instance().getSpectatorsAllowed());
|
||||||
spectatorsNeedPasswordCheckBox->setChecked(settingsCache->getSpectatorsNeedPassword());
|
spectatorsNeedPasswordCheckBox->setChecked(SettingsCache::instance().getSpectatorsNeedPassword());
|
||||||
spectatorsCanTalkCheckBox->setChecked(settingsCache->getSpectatorsCanTalk());
|
spectatorsCanTalkCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanTalk());
|
||||||
spectatorsSeeEverythingCheckBox->setChecked(settingsCache->getSpectatorsCanSeeEverything());
|
spectatorsSeeEverythingCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanSeeEverything());
|
||||||
|
|
||||||
if (!rememberGameSettings->isChecked()) {
|
if (!rememberGameSettings->isChecked()) {
|
||||||
actReset();
|
actReset();
|
||||||
|
@ -237,17 +237,17 @@ void DlgCreateGame::actOK()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->setRememberGameSettings(rememberGameSettings->isChecked());
|
SettingsCache::instance().setRememberGameSettings(rememberGameSettings->isChecked());
|
||||||
if (rememberGameSettings->isChecked()) {
|
if (rememberGameSettings->isChecked()) {
|
||||||
settingsCache->setGameDescription(descriptionEdit->text());
|
SettingsCache::instance().setGameDescription(descriptionEdit->text());
|
||||||
settingsCache->setMaxPlayers(maxPlayersEdit->value());
|
SettingsCache::instance().setMaxPlayers(maxPlayersEdit->value());
|
||||||
settingsCache->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
SettingsCache::instance().setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||||
settingsCache->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
SettingsCache::instance().setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||||
settingsCache->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
SettingsCache::instance().setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||||
settingsCache->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
SettingsCache::instance().setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||||
settingsCache->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
SettingsCache::instance().setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||||
settingsCache->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
SettingsCache::instance().setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||||
settingsCache->setGameTypes(gameTypes);
|
SettingsCache::instance().setGameTypes(gameTypes);
|
||||||
}
|
}
|
||||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||||
|
|
|
@ -14,8 +14,8 @@ DlgEditPassword::DlgEditPassword(QWidget *parent) : QDialog(parent)
|
||||||
oldPasswordLabel = new QLabel(tr("Old password:"));
|
oldPasswordLabel = new QLabel(tr("Old password:"));
|
||||||
oldPasswordEdit = new QLineEdit();
|
oldPasswordEdit = new QLineEdit();
|
||||||
|
|
||||||
if (settingsCache->servers().getSavePassword())
|
if (SettingsCache::instance().servers().getSavePassword())
|
||||||
oldPasswordEdit->setText(settingsCache->servers().getPassword());
|
oldPasswordEdit->setText(SettingsCache::instance().servers().getPassword());
|
||||||
|
|
||||||
oldPasswordLabel->setBuddy(oldPasswordEdit);
|
oldPasswordLabel->setBuddy(oldPasswordEdit);
|
||||||
oldPasswordEdit->setEchoMode(QLineEdit::Password);
|
oldPasswordEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
@ -60,6 +60,6 @@ void DlgEditPassword::actOk()
|
||||||
}
|
}
|
||||||
|
|
||||||
// always save the password so it will be picked up by the connect dialog
|
// always save the password so it will be picked up by the connect dialog
|
||||||
settingsCache->servers().setPassword(newPasswordEdit->text());
|
SettingsCache::instance().servers().setPassword(newPasswordEdit->text());
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QStrin
|
||||||
countryEdit->insertItem(0, tr("Undefined"));
|
countryEdit->insertItem(0, tr("Undefined"));
|
||||||
countryEdit->setCurrentIndex(0);
|
countryEdit->setCurrentIndex(0);
|
||||||
|
|
||||||
QStringList countries = settingsCache->getCountries();
|
QStringList countries = SettingsCache::instance().getCountries();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
foreach (QString c, countries) {
|
foreach (QString c, countries) {
|
||||||
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
||||||
|
|
|
@ -16,19 +16,18 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
|
||||||
QString lastfphost;
|
QString lastfphost;
|
||||||
QString lastfpport;
|
QString lastfpport;
|
||||||
QString lastfpplayername;
|
QString lastfpplayername;
|
||||||
lastfphost = settingsCache->servers().getHostname("server.cockatrice.us");
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
lastfpport = settingsCache->servers().getPort("4747");
|
lastfphost = servers.getHostname("server.cockatrice.us");
|
||||||
lastfpplayername = settingsCache->servers().getPlayerName("Player");
|
lastfpport = servers.getPort("4747");
|
||||||
|
lastfpplayername = servers.getPlayerName("Player");
|
||||||
|
|
||||||
if (!settingsCache->servers().getFPHostname().isEmpty() && !settingsCache->servers().getFPPort().isEmpty() &&
|
if (!servers.getFPHostname().isEmpty() && !servers.getFPPort().isEmpty() && !servers.getFPPlayerName().isEmpty()) {
|
||||||
!settingsCache->servers().getFPPlayerName().isEmpty()) {
|
lastfphost = servers.getFPHostname();
|
||||||
lastfphost = settingsCache->servers().getFPHostname();
|
lastfpport = servers.getFPPort();
|
||||||
lastfpport = settingsCache->servers().getFPPort();
|
lastfpplayername = servers.getFPPlayerName();
|
||||||
lastfpplayername = settingsCache->servers().getFPPlayerName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsCache->servers().getFPHostname().isEmpty() && settingsCache->servers().getFPPort().isEmpty() &&
|
if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) {
|
||||||
settingsCache->servers().getFPPlayerName().isEmpty()) {
|
|
||||||
QMessageBox::warning(this, tr("Forgot Password Challenge Warning"),
|
QMessageBox::warning(this, tr("Forgot Password Challenge Warning"),
|
||||||
tr("Oops, looks like something has gone wrong. Please restart the forgot password "
|
tr("Oops, looks like something has gone wrong. Please restart the forgot password "
|
||||||
"process by using the forgot password button on the connection screen."));
|
"process by using the forgot password button on the connection screen."));
|
||||||
|
@ -51,8 +50,7 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
|
||||||
emailEdit = new QLineEdit();
|
emailEdit = new QLineEdit();
|
||||||
emailLabel->setBuddy(emailLabel);
|
emailLabel->setBuddy(emailLabel);
|
||||||
|
|
||||||
if (!settingsCache->servers().getFPHostname().isEmpty() && !settingsCache->servers().getFPPort().isEmpty() &&
|
if (!servers.getFPHostname().isEmpty() && !servers.getFPPort().isEmpty() && !servers.getFPPlayerName().isEmpty()) {
|
||||||
!settingsCache->servers().getFPPlayerName().isEmpty()) {
|
|
||||||
hostLabel->hide();
|
hostLabel->hide();
|
||||||
hostEdit->hide();
|
hostEdit->hide();
|
||||||
portLabel->hide();
|
portLabel->hide();
|
||||||
|
@ -92,9 +90,10 @@ void DlgForgotPasswordChallenge::actOk()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().setFPHostName(hostEdit->text());
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
settingsCache->servers().setFPPort(portEdit->text());
|
servers.setFPHostName(hostEdit->text());
|
||||||
settingsCache->servers().setFPPlayerName(playernameEdit->text());
|
servers.setFPPort(portEdit->text());
|
||||||
|
servers.setFPPlayerName(playernameEdit->text());
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,15 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa
|
||||||
QString lastfphost;
|
QString lastfphost;
|
||||||
QString lastfpport;
|
QString lastfpport;
|
||||||
QString lastfpplayername;
|
QString lastfpplayername;
|
||||||
lastfphost = settingsCache->servers().getHostname("server.cockatrice.us");
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
lastfpport = settingsCache->servers().getPort("4747");
|
lastfphost = servers.getHostname("server.cockatrice.us");
|
||||||
lastfpplayername = settingsCache->servers().getPlayerName("Player");
|
lastfpport = servers.getPort("4747");
|
||||||
|
lastfpplayername = servers.getPlayerName("Player");
|
||||||
|
|
||||||
if (!settingsCache->servers().getFPHostname().isEmpty() && !settingsCache->servers().getFPPort().isEmpty() &&
|
if (!servers.getFPHostname().isEmpty() && !servers.getFPPort().isEmpty() && !servers.getFPPlayerName().isEmpty()) {
|
||||||
!settingsCache->servers().getFPPlayerName().isEmpty()) {
|
lastfphost = servers.getFPHostname();
|
||||||
lastfphost = settingsCache->servers().getFPHostname();
|
lastfpport = servers.getFPPort();
|
||||||
lastfpport = settingsCache->servers().getFPPort();
|
lastfpplayername = servers.getFPPlayerName();
|
||||||
lastfpplayername = settingsCache->servers().getFPPlayerName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hostLabel = new QLabel(tr("&Host:"));
|
hostLabel = new QLabel(tr("&Host:"));
|
||||||
|
@ -68,9 +68,10 @@ void DlgForgotPasswordRequest::actOk()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().setFPHostName(hostEdit->text());
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
settingsCache->servers().setFPPort(portEdit->text());
|
servers.setFPHostName(hostEdit->text());
|
||||||
settingsCache->servers().setFPPlayerName(playernameEdit->text());
|
servers.setFPPort(portEdit->text());
|
||||||
|
servers.setFPPlayerName(playernameEdit->text());
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,18 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
|
||||||
QString lastfphost;
|
QString lastfphost;
|
||||||
QString lastfpport;
|
QString lastfpport;
|
||||||
QString lastfpplayername;
|
QString lastfpplayername;
|
||||||
lastfphost = settingsCache->servers().getHostname("server.cockatrice.us");
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
lastfpport = settingsCache->servers().getPort("4747");
|
lastfphost = servers.getHostname("server.cockatrice.us");
|
||||||
lastfpplayername = settingsCache->servers().getPlayerName("Player");
|
lastfpport = servers.getPort("4747");
|
||||||
|
lastfpplayername = servers.getPlayerName("Player");
|
||||||
|
|
||||||
if (!settingsCache->servers().getFPHostname().isEmpty() && !settingsCache->servers().getFPPort().isEmpty() &&
|
if (!servers.getFPHostname().isEmpty() && !servers.getFPPort().isEmpty() && !servers.getFPPlayerName().isEmpty()) {
|
||||||
!settingsCache->servers().getFPPlayerName().isEmpty()) {
|
lastfphost = servers.getFPHostname();
|
||||||
lastfphost = settingsCache->servers().getFPHostname();
|
lastfpport = servers.getFPPort();
|
||||||
lastfpport = settingsCache->servers().getFPPort();
|
lastfpplayername = servers.getFPPlayerName();
|
||||||
lastfpplayername = settingsCache->servers().getFPPlayerName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsCache->servers().getFPHostname().isEmpty() && settingsCache->servers().getFPPort().isEmpty() &&
|
if (servers.getFPHostname().isEmpty() && servers.getFPPort().isEmpty() && servers.getFPPlayerName().isEmpty()) {
|
||||||
settingsCache->servers().getFPPlayerName().isEmpty()) {
|
|
||||||
QMessageBox::warning(this, tr("Forgot Password Reset Warning"),
|
QMessageBox::warning(this, tr("Forgot Password Reset Warning"),
|
||||||
tr("Oops, looks like something has gone wrong. Please re-start the forgot password "
|
tr("Oops, looks like something has gone wrong. Please re-start the forgot password "
|
||||||
"process by using the forgot password button on the connection screen."));
|
"process by using the forgot password button on the connection screen."));
|
||||||
|
@ -61,8 +60,7 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
|
||||||
newpasswordverifyLabel->setBuddy(newpasswordEdit);
|
newpasswordverifyLabel->setBuddy(newpasswordEdit);
|
||||||
newpasswordverifyEdit->setEchoMode(QLineEdit::Password);
|
newpasswordverifyEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
if (!settingsCache->servers().getFPHostname().isEmpty() && !settingsCache->servers().getFPPort().isEmpty() &&
|
if (!servers.getFPHostname().isEmpty() && !servers.getFPPort().isEmpty() && !servers.getFPPlayerName().isEmpty()) {
|
||||||
!settingsCache->servers().getFPPlayerName().isEmpty()) {
|
|
||||||
hostLabel->hide();
|
hostLabel->hide();
|
||||||
hostEdit->hide();
|
hostEdit->hide();
|
||||||
portLabel->hide();
|
portLabel->hide();
|
||||||
|
@ -121,9 +119,10 @@ void DlgForgotPasswordReset::actOk()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().setFPHostName(hostEdit->text());
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
settingsCache->servers().setFPPort(portEdit->text());
|
servers.setFPHostName(hostEdit->text());
|
||||||
settingsCache->servers().setFPPlayerName(playernameEdit->text());
|
servers.setFPPort(portEdit->text());
|
||||||
|
servers.setFPPlayerName(playernameEdit->text());
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(pa
|
||||||
resize(500, 500);
|
resize(500, 500);
|
||||||
|
|
||||||
actRefresh();
|
actRefresh();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ void DlgLoadDeckFromClipboard::actRefresh()
|
||||||
|
|
||||||
void DlgLoadDeckFromClipboard::refreshShortcuts()
|
void DlgLoadDeckFromClipboard::refreshShortcuts()
|
||||||
{
|
{
|
||||||
refreshButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DlgLoadDeckFromClipboard/refreshButton"));
|
refreshButton->setShortcut(
|
||||||
|
SettingsCache::instance().shortcuts().getSingleShortcut("DlgLoadDeckFromClipboard/refreshButton"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgLoadDeckFromClipboard::actOK()
|
void DlgLoadDeckFromClipboard::actOK()
|
||||||
|
|
|
@ -13,20 +13,21 @@
|
||||||
|
|
||||||
DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent)
|
DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
hostLabel = new QLabel(tr("&Host:"));
|
hostLabel = new QLabel(tr("&Host:"));
|
||||||
hostEdit = new QLineEdit(settingsCache->servers().getHostname("server.cockatrice.us"));
|
hostEdit = new QLineEdit(servers.getHostname("server.cockatrice.us"));
|
||||||
hostLabel->setBuddy(hostEdit);
|
hostLabel->setBuddy(hostEdit);
|
||||||
|
|
||||||
portLabel = new QLabel(tr("&Port:"));
|
portLabel = new QLabel(tr("&Port:"));
|
||||||
portEdit = new QLineEdit(settingsCache->servers().getPort("4747"));
|
portEdit = new QLineEdit(servers.getPort("4747"));
|
||||||
portLabel->setBuddy(portEdit);
|
portLabel->setBuddy(portEdit);
|
||||||
|
|
||||||
playernameLabel = new QLabel(tr("Player &name:"));
|
playernameLabel = new QLabel(tr("Player &name:"));
|
||||||
playernameEdit = new QLineEdit(settingsCache->servers().getPlayerName("Player"));
|
playernameEdit = new QLineEdit(servers.getPlayerName("Player"));
|
||||||
playernameLabel->setBuddy(playernameEdit);
|
playernameLabel->setBuddy(playernameEdit);
|
||||||
|
|
||||||
passwordLabel = new QLabel(tr("P&assword:"));
|
passwordLabel = new QLabel(tr("P&assword:"));
|
||||||
passwordEdit = new QLineEdit(settingsCache->servers().getPassword());
|
passwordEdit = new QLineEdit(servers.getPassword());
|
||||||
passwordLabel->setBuddy(passwordEdit);
|
passwordLabel->setBuddy(passwordEdit);
|
||||||
passwordEdit->setEchoMode(QLineEdit::Password);
|
passwordEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent)
|
||||||
countryEdit->addItem(QPixmap("theme:countries/zm"), "zm");
|
countryEdit->addItem(QPixmap("theme:countries/zm"), "zm");
|
||||||
countryEdit->addItem(QPixmap("theme:countries/zw"), "zw");
|
countryEdit->addItem(QPixmap("theme:countries/zw"), "zw");
|
||||||
countryEdit->setCurrentIndex(0);
|
countryEdit->setCurrentIndex(0);
|
||||||
QStringList countries = settingsCache->getCountries();
|
QStringList countries = SettingsCache::instance().getCountries();
|
||||||
foreach (QString c, countries)
|
foreach (QString c, countries)
|
||||||
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
||||||
|
|
||||||
|
@ -354,11 +355,12 @@ void DlgRegister::actOk()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->servers().setHostName(hostEdit->text());
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
settingsCache->servers().setPort(portEdit->text());
|
servers.setHostName(hostEdit->text());
|
||||||
settingsCache->servers().setPlayerName(playernameEdit->text());
|
servers.setPort(portEdit->text());
|
||||||
|
servers.setPlayerName(playernameEdit->text());
|
||||||
// always save the password so it will be picked up by the connect dialog
|
// always save the password so it will be picked up by the connect dialog
|
||||||
settingsCache->servers().setPassword(passwordEdit->text());
|
servers.setPassword(passwordEdit->text());
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
GeneralSettingsPage::GeneralSettingsPage()
|
GeneralSettingsPage::GeneralSettingsPage()
|
||||||
{
|
{
|
||||||
QString setLanguage = settingsCache->getLang();
|
QString setLanguage = SettingsCache::instance().getLang();
|
||||||
QStringList qmFiles = findQmFiles();
|
QStringList qmFiles = findQmFiles();
|
||||||
for (int i = 0; i < qmFiles.size(); i++) {
|
for (int i = 0; i < qmFiles.size(); i++) {
|
||||||
QString langName = languageName(qmFiles[i]);
|
QString langName = languageName(qmFiles[i]);
|
||||||
|
@ -53,32 +53,34 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
// updates
|
// updates
|
||||||
QList<ReleaseChannel *> channels = settingsCache->getUpdateReleaseChannels();
|
QList<ReleaseChannel *> channels = SettingsCache::instance().getUpdateReleaseChannels();
|
||||||
foreach (ReleaseChannel *chan, channels) {
|
foreach (ReleaseChannel *chan, channels) {
|
||||||
updateReleaseChannelBox.insertItem(chan->getIndex(), tr(chan->getName().toUtf8()));
|
updateReleaseChannelBox.insertItem(chan->getIndex(), tr(chan->getName().toUtf8()));
|
||||||
}
|
}
|
||||||
updateReleaseChannelBox.setCurrentIndex(settingsCache->getUpdateReleaseChannel()->getIndex());
|
updateReleaseChannelBox.setCurrentIndex(SettingsCache::instance().getUpdateReleaseChannel()->getIndex());
|
||||||
|
|
||||||
updateNotificationCheckBox.setChecked(settingsCache->getNotifyAboutUpdates());
|
updateNotificationCheckBox.setChecked(SettingsCache::instance().getNotifyAboutUpdates());
|
||||||
newVersionOracleCheckBox.setChecked(settingsCache->getNotifyAboutNewVersion());
|
newVersionOracleCheckBox.setChecked(SettingsCache::instance().getNotifyAboutNewVersion());
|
||||||
|
|
||||||
// pixmap cache
|
// pixmap cache
|
||||||
pixmapCacheEdit.setMinimum(PIXMAPCACHE_SIZE_MIN);
|
pixmapCacheEdit.setMinimum(PIXMAPCACHE_SIZE_MIN);
|
||||||
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
|
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
|
||||||
pixmapCacheEdit.setMaximum(PIXMAPCACHE_SIZE_MAX);
|
pixmapCacheEdit.setMaximum(PIXMAPCACHE_SIZE_MAX);
|
||||||
pixmapCacheEdit.setSingleStep(64);
|
pixmapCacheEdit.setSingleStep(64);
|
||||||
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
|
pixmapCacheEdit.setValue(SettingsCache::instance().getPixmapCacheSize());
|
||||||
pixmapCacheEdit.setSuffix(" MB");
|
pixmapCacheEdit.setSuffix(" MB");
|
||||||
|
|
||||||
showTipsOnStartup.setChecked(settingsCache->getShowTipsOnStartup());
|
showTipsOnStartup.setChecked(SettingsCache::instance().getShowTipsOnStartup());
|
||||||
|
|
||||||
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
|
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
|
||||||
connect(&pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int)));
|
connect(&pixmapCacheEdit, SIGNAL(valueChanged(int)), &SettingsCache::instance(), SLOT(setPixmapCacheSize(int)));
|
||||||
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), settingsCache,
|
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setUpdateReleaseChannel(int)));
|
SLOT(setUpdateReleaseChannel(int)));
|
||||||
connect(&updateNotificationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotifyAboutUpdate(int)));
|
connect(&updateNotificationCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
connect(&newVersionOracleCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotifyAboutNewVersion(int)));
|
SLOT(setNotifyAboutUpdate(int)));
|
||||||
connect(&showTipsOnStartup, SIGNAL(clicked(bool)), settingsCache, SLOT(setShowTipsOnStartup(bool)));
|
connect(&newVersionOracleCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setNotifyAboutNewVersion(int)));
|
||||||
|
connect(&showTipsOnStartup, SIGNAL(clicked(bool)), &SettingsCache::instance(), SLOT(setShowTipsOnStartup(bool)));
|
||||||
|
|
||||||
auto *personalGrid = new QGridLayout;
|
auto *personalGrid = new QGridLayout;
|
||||||
personalGrid->addWidget(&languageLabel, 0, 0);
|
personalGrid->addWidget(&languageLabel, 0, 0);
|
||||||
|
@ -94,32 +96,32 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
personalGroupBox = new QGroupBox;
|
personalGroupBox = new QGroupBox;
|
||||||
personalGroupBox->setLayout(personalGrid);
|
personalGroupBox->setLayout(personalGrid);
|
||||||
|
|
||||||
deckPathEdit = new QLineEdit(settingsCache->getDeckPath());
|
deckPathEdit = new QLineEdit(SettingsCache::instance().getDeckPath());
|
||||||
deckPathEdit->setReadOnly(true);
|
deckPathEdit->setReadOnly(true);
|
||||||
QPushButton *deckPathButton = new QPushButton("...");
|
QPushButton *deckPathButton = new QPushButton("...");
|
||||||
connect(deckPathButton, SIGNAL(clicked()), this, SLOT(deckPathButtonClicked()));
|
connect(deckPathButton, SIGNAL(clicked()), this, SLOT(deckPathButtonClicked()));
|
||||||
|
|
||||||
replaysPathEdit = new QLineEdit(settingsCache->getReplaysPath());
|
replaysPathEdit = new QLineEdit(SettingsCache::instance().getReplaysPath());
|
||||||
replaysPathEdit->setReadOnly(true);
|
replaysPathEdit->setReadOnly(true);
|
||||||
QPushButton *replaysPathButton = new QPushButton("...");
|
QPushButton *replaysPathButton = new QPushButton("...");
|
||||||
connect(replaysPathButton, SIGNAL(clicked()), this, SLOT(replaysPathButtonClicked()));
|
connect(replaysPathButton, SIGNAL(clicked()), this, SLOT(replaysPathButtonClicked()));
|
||||||
|
|
||||||
picsPathEdit = new QLineEdit(settingsCache->getPicsPath());
|
picsPathEdit = new QLineEdit(SettingsCache::instance().getPicsPath());
|
||||||
picsPathEdit->setReadOnly(true);
|
picsPathEdit->setReadOnly(true);
|
||||||
QPushButton *picsPathButton = new QPushButton("...");
|
QPushButton *picsPathButton = new QPushButton("...");
|
||||||
connect(picsPathButton, SIGNAL(clicked()), this, SLOT(picsPathButtonClicked()));
|
connect(picsPathButton, SIGNAL(clicked()), this, SLOT(picsPathButtonClicked()));
|
||||||
|
|
||||||
cardDatabasePathEdit = new QLineEdit(settingsCache->getCardDatabasePath());
|
cardDatabasePathEdit = new QLineEdit(SettingsCache::instance().getCardDatabasePath());
|
||||||
cardDatabasePathEdit->setReadOnly(true);
|
cardDatabasePathEdit->setReadOnly(true);
|
||||||
QPushButton *cardDatabasePathButton = new QPushButton("...");
|
QPushButton *cardDatabasePathButton = new QPushButton("...");
|
||||||
connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked()));
|
connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked()));
|
||||||
|
|
||||||
tokenDatabasePathEdit = new QLineEdit(settingsCache->getTokenDatabasePath());
|
tokenDatabasePathEdit = new QLineEdit(SettingsCache::instance().getTokenDatabasePath());
|
||||||
tokenDatabasePathEdit->setReadOnly(true);
|
tokenDatabasePathEdit->setReadOnly(true);
|
||||||
QPushButton *tokenDatabasePathButton = new QPushButton("...");
|
QPushButton *tokenDatabasePathButton = new QPushButton("...");
|
||||||
connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked()));
|
connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked()));
|
||||||
|
|
||||||
if (settingsCache->getIsPortableBuild()) {
|
if (SettingsCache::instance().getIsPortableBuild()) {
|
||||||
deckPathEdit->setEnabled(false);
|
deckPathEdit->setEnabled(false);
|
||||||
replaysPathEdit->setEnabled(false);
|
replaysPathEdit->setEnabled(false);
|
||||||
picsPathEdit->setEnabled(false);
|
picsPathEdit->setEnabled(false);
|
||||||
|
@ -185,7 +187,7 @@ void GeneralSettingsPage::deckPathButtonClicked()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
deckPathEdit->setText(path);
|
deckPathEdit->setText(path);
|
||||||
settingsCache->setDeckPath(path);
|
SettingsCache::instance().setDeckPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::replaysPathButtonClicked()
|
void GeneralSettingsPage::replaysPathButtonClicked()
|
||||||
|
@ -195,7 +197,7 @@ void GeneralSettingsPage::replaysPathButtonClicked()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
replaysPathEdit->setText(path);
|
replaysPathEdit->setText(path);
|
||||||
settingsCache->setReplaysPath(path);
|
SettingsCache::instance().setReplaysPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::picsPathButtonClicked()
|
void GeneralSettingsPage::picsPathButtonClicked()
|
||||||
|
@ -205,7 +207,7 @@ void GeneralSettingsPage::picsPathButtonClicked()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
picsPathEdit->setText(path);
|
picsPathEdit->setText(path);
|
||||||
settingsCache->setPicsPath(path);
|
SettingsCache::instance().setPicsPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
||||||
|
@ -215,7 +217,7 @@ void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cardDatabasePathEdit->setText(path);
|
cardDatabasePathEdit->setText(path);
|
||||||
settingsCache->setCardDatabasePath(path);
|
SettingsCache::instance().setCardDatabasePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
||||||
|
@ -225,12 +227,12 @@ void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tokenDatabasePathEdit->setText(path);
|
tokenDatabasePathEdit->setText(path);
|
||||||
settingsCache->setTokenDatabasePath(path);
|
SettingsCache::instance().setTokenDatabasePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::languageBoxChanged(int index)
|
void GeneralSettingsPage::languageBoxChanged(int index)
|
||||||
{
|
{
|
||||||
settingsCache->setLang(languageBox.itemData(index).toString());
|
SettingsCache::instance().setLang(languageBox.itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::retranslateUi()
|
void GeneralSettingsPage::retranslateUi()
|
||||||
|
@ -238,7 +240,7 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
personalGroupBox->setTitle(tr("Personal settings"));
|
personalGroupBox->setTitle(tr("Personal settings"));
|
||||||
languageLabel.setText(tr("Language:"));
|
languageLabel.setText(tr("Language:"));
|
||||||
|
|
||||||
if (settingsCache->getIsPortableBuild()) {
|
if (SettingsCache::instance().getIsPortableBuild()) {
|
||||||
pathsGroupBox->setTitle(tr("Paths (editing disabled in portable mode)"));
|
pathsGroupBox->setTitle(tr("Paths (editing disabled in portable mode)"));
|
||||||
} else {
|
} else {
|
||||||
pathsGroupBox->setTitle(tr("Paths"));
|
pathsGroupBox->setTitle(tr("Paths"));
|
||||||
|
@ -258,7 +260,7 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
|
|
||||||
AppearanceSettingsPage::AppearanceSettingsPage()
|
AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
{
|
{
|
||||||
QString themeName = settingsCache->getThemeName();
|
QString themeName = SettingsCache::instance().getThemeName();
|
||||||
|
|
||||||
QStringList themeDirs = themeManager->getAvailableThemes().keys();
|
QStringList themeDirs = themeManager->getAvailableThemes().keys();
|
||||||
for (int i = 0; i < themeDirs.size(); i++) {
|
for (int i = 0; i < themeDirs.size(); i++) {
|
||||||
|
@ -276,11 +278,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
themeGroupBox = new QGroupBox;
|
themeGroupBox = new QGroupBox;
|
||||||
themeGroupBox->setLayout(themeGrid);
|
themeGroupBox->setLayout(themeGrid);
|
||||||
|
|
||||||
displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
|
displayCardNamesCheckBox.setChecked(SettingsCache::instance().getDisplayCardNames());
|
||||||
connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
|
connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setDisplayCardNames(int)));
|
||||||
|
|
||||||
cardScalingCheckBox.setChecked(settingsCache->getScaleCards());
|
cardScalingCheckBox.setChecked(SettingsCache::instance().getScaleCards());
|
||||||
connect(&cardScalingCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setCardScaling(int)));
|
connect(&cardScalingCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setCardScaling(int)));
|
||||||
|
|
||||||
auto *cardsGrid = new QGridLayout;
|
auto *cardsGrid = new QGridLayout;
|
||||||
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
|
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
|
||||||
|
@ -289,11 +292,13 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
cardsGroupBox = new QGroupBox;
|
cardsGroupBox = new QGroupBox;
|
||||||
cardsGroupBox->setLayout(cardsGrid);
|
cardsGroupBox->setLayout(cardsGrid);
|
||||||
|
|
||||||
horizontalHandCheckBox.setChecked(settingsCache->getHorizontalHand());
|
horizontalHandCheckBox.setChecked(SettingsCache::instance().getHorizontalHand());
|
||||||
connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));
|
connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setHorizontalHand(int)));
|
||||||
|
|
||||||
leftJustifiedHandCheckBox.setChecked(settingsCache->getLeftJustified());
|
leftJustifiedHandCheckBox.setChecked(SettingsCache::instance().getLeftJustified());
|
||||||
connect(&leftJustifiedHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setLeftJustified(int)));
|
connect(&leftJustifiedHandCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setLeftJustified(int)));
|
||||||
|
|
||||||
auto *handGrid = new QGridLayout;
|
auto *handGrid = new QGridLayout;
|
||||||
handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
|
handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
|
||||||
|
@ -302,18 +307,18 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
handGroupBox = new QGroupBox;
|
handGroupBox = new QGroupBox;
|
||||||
handGroupBox->setLayout(handGrid);
|
handGroupBox->setLayout(handGrid);
|
||||||
|
|
||||||
invertVerticalCoordinateCheckBox.setChecked(settingsCache->getInvertVerticalCoordinate());
|
invertVerticalCoordinateCheckBox.setChecked(SettingsCache::instance().getInvertVerticalCoordinate());
|
||||||
connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache,
|
connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setInvertVerticalCoordinate(int)));
|
SLOT(setInvertVerticalCoordinate(int)));
|
||||||
|
|
||||||
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
|
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
|
||||||
minPlayersForMultiColumnLayoutEdit.setValue(settingsCache->getMinPlayersForMultiColumnLayout());
|
minPlayersForMultiColumnLayoutEdit.setValue(SettingsCache::instance().getMinPlayersForMultiColumnLayout());
|
||||||
connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache,
|
connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setMinPlayersForMultiColumnLayout(int)));
|
SLOT(setMinPlayersForMultiColumnLayout(int)));
|
||||||
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
|
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
|
||||||
|
|
||||||
connect(&maxFontSizeForCardsEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMaxFontSize(int)));
|
connect(&maxFontSizeForCardsEdit, SIGNAL(valueChanged(int)), &SettingsCache::instance(), SLOT(setMaxFontSize(int)));
|
||||||
maxFontSizeForCardsEdit.setValue(settingsCache->getMaxFontSize());
|
maxFontSizeForCardsEdit.setValue(SettingsCache::instance().getMaxFontSize());
|
||||||
maxFontSizeForCardsLabel.setBuddy(&maxFontSizeForCardsEdit);
|
maxFontSizeForCardsLabel.setBuddy(&maxFontSizeForCardsEdit);
|
||||||
maxFontSizeForCardsEdit.setMinimum(9);
|
maxFontSizeForCardsEdit.setMinimum(9);
|
||||||
maxFontSizeForCardsEdit.setMaximum(100);
|
maxFontSizeForCardsEdit.setMaximum(100);
|
||||||
|
@ -341,7 +346,7 @@ void AppearanceSettingsPage::themeBoxChanged(int index)
|
||||||
{
|
{
|
||||||
QStringList themeDirs = themeManager->getAvailableThemes().keys();
|
QStringList themeDirs = themeManager->getAvailableThemes().keys();
|
||||||
if (index >= 0 && index < themeDirs.count())
|
if (index >= 0 && index < themeDirs.count())
|
||||||
settingsCache->setThemeName(themeDirs.at(index));
|
SettingsCache::instance().setThemeName(themeDirs.at(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppearanceSettingsPage::retranslateUi()
|
void AppearanceSettingsPage::retranslateUi()
|
||||||
|
@ -365,33 +370,36 @@ void AppearanceSettingsPage::retranslateUi()
|
||||||
|
|
||||||
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
{
|
{
|
||||||
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
|
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().getNotificationsEnabled());
|
||||||
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache,
|
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setNotificationsEnabled(int)));
|
SLOT(setNotificationsEnabled(int)));
|
||||||
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int)));
|
connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSpecNotificationEnabled(int)));
|
||||||
|
|
||||||
specNotificationsEnabledCheckBox.setChecked(settingsCache->getSpectatorNotificationsEnabled());
|
specNotificationsEnabledCheckBox.setChecked(SettingsCache::instance().getSpectatorNotificationsEnabled());
|
||||||
specNotificationsEnabledCheckBox.setEnabled(settingsCache->getNotificationsEnabled());
|
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled());
|
||||||
connect(&specNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache,
|
connect(&specNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setSpectatorNotificationsEnabled(int)));
|
SLOT(setSpectatorNotificationsEnabled(int)));
|
||||||
|
|
||||||
buddyConnectNotificationsEnabledCheckBox.setChecked(settingsCache->getBuddyConnectNotificationsEnabled());
|
buddyConnectNotificationsEnabledCheckBox.setChecked(
|
||||||
buddyConnectNotificationsEnabledCheckBox.setEnabled(settingsCache->getNotificationsEnabled());
|
SettingsCache::instance().getBuddyConnectNotificationsEnabled());
|
||||||
connect(&buddyConnectNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache,
|
buddyConnectNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled());
|
||||||
|
connect(&buddyConnectNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setBuddyConnectNotificationsEnabled(int)));
|
SLOT(setBuddyConnectNotificationsEnabled(int)));
|
||||||
|
|
||||||
doubleClickToPlayCheckBox.setChecked(settingsCache->getDoubleClickToPlay());
|
doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().getDoubleClickToPlay());
|
||||||
connect(&doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
|
connect(&doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setDoubleClickToPlay(int)));
|
||||||
|
|
||||||
playToStackCheckBox.setChecked(settingsCache->getPlayToStack());
|
playToStackCheckBox.setChecked(SettingsCache::instance().getPlayToStack());
|
||||||
connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
|
connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setPlayToStack(int)));
|
||||||
|
|
||||||
annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens());
|
annotateTokensCheckBox.setChecked(SettingsCache::instance().getAnnotateTokens());
|
||||||
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int)));
|
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
|
SLOT(setAnnotateTokens(int)));
|
||||||
|
|
||||||
useTearOffMenusCheckBox.setChecked(settingsCache->getUseTearOffMenus());
|
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().getUseTearOffMenus());
|
||||||
connect(&useTearOffMenusCheckBox, &QCheckBox::stateChanged, settingsCache,
|
connect(&useTearOffMenusCheckBox, &QCheckBox::stateChanged, &SettingsCache::instance(),
|
||||||
[](int state) { settingsCache->setUseTearOffMenus(state == Qt::Checked); });
|
[](int state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); });
|
||||||
|
|
||||||
auto *generalGrid = new QGridLayout;
|
auto *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0);
|
||||||
|
@ -410,8 +418,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
notificationsGroupBox = new QGroupBox;
|
notificationsGroupBox = new QGroupBox;
|
||||||
notificationsGroupBox->setLayout(notificationsGrid);
|
notificationsGroupBox->setLayout(notificationsGrid);
|
||||||
|
|
||||||
tapAnimationCheckBox.setChecked(settingsCache->getTapAnimation());
|
tapAnimationCheckBox.setChecked(SettingsCache::instance().getTapAnimation());
|
||||||
connect(&tapAnimationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setTapAnimation(int)));
|
connect(&tapAnimationCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setTapAnimation(int)));
|
||||||
|
|
||||||
auto *animationGrid = new QGridLayout;
|
auto *animationGrid = new QGridLayout;
|
||||||
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
||||||
|
@ -449,8 +457,8 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
|
|
||||||
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
{
|
{
|
||||||
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
|
picDownloadCheckBox.setChecked(SettingsCache::instance().getPicDownload());
|
||||||
connect(&picDownloadCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownload(int)));
|
connect(&picDownloadCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setPicDownload(int)));
|
||||||
|
|
||||||
urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||||
urlLinkLabel.setOpenExternalLinks(true);
|
urlLinkLabel.setOpenExternalLinks(true);
|
||||||
|
@ -461,9 +469,9 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
auto *lpGeneralGrid = new QGridLayout;
|
auto *lpGeneralGrid = new QGridLayout;
|
||||||
auto *lpSpoilerGrid = new QGridLayout;
|
auto *lpSpoilerGrid = new QGridLayout;
|
||||||
|
|
||||||
mcDownloadSpoilersCheckBox.setChecked(settingsCache->getDownloadSpoilersStatus());
|
mcDownloadSpoilersCheckBox.setChecked(SettingsCache::instance().getDownloadSpoilersStatus());
|
||||||
|
|
||||||
mpSpoilerSavePathLineEdit = new QLineEdit(settingsCache->getSpoilerCardDatabasePath());
|
mpSpoilerSavePathLineEdit = new QLineEdit(SettingsCache::instance().getSpoilerCardDatabasePath());
|
||||||
mpSpoilerSavePathLineEdit->setReadOnly(true);
|
mpSpoilerSavePathLineEdit->setReadOnly(true);
|
||||||
mpSpoilerPathButton = new QPushButton("...");
|
mpSpoilerPathButton = new QPushButton("...");
|
||||||
connect(mpSpoilerPathButton, SIGNAL(clicked()), this, SLOT(spoilerPathButtonClicked()));
|
connect(mpSpoilerPathButton, SIGNAL(clicked()), this, SLOT(spoilerPathButtonClicked()));
|
||||||
|
@ -483,8 +491,8 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
connect(urlList->model(), SIGNAL(rowsMoved(const QModelIndex, int, int, const QModelIndex, int)), this,
|
connect(urlList->model(), SIGNAL(rowsMoved(const QModelIndex, int, int, const QModelIndex, int)), this,
|
||||||
SLOT(urlListChanged(const QModelIndex, int, int, const QModelIndex, int)));
|
SLOT(urlListChanged(const QModelIndex, int, int, const QModelIndex, int)));
|
||||||
|
|
||||||
for (int i = 0; i < settingsCache->downloads().getCount(); i++)
|
for (int i = 0; i < SettingsCache::instance().downloads().getCount(); i++)
|
||||||
urlList->addItem(settingsCache->downloads().getDownloadUrlAt(i));
|
urlList->addItem(SettingsCache::instance().downloads().getDownloadUrlAt(i));
|
||||||
|
|
||||||
auto aAdd = new QAction(this);
|
auto aAdd = new QAction(this);
|
||||||
aAdd->setIcon(QPixmap("theme:icons/increment"));
|
aAdd->setIcon(QPixmap("theme:icons/increment"));
|
||||||
|
@ -524,7 +532,8 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
lpSpoilerGrid->addWidget(&infoOnSpoilersLabel, 3, 0, 1, 3, Qt::AlignTop);
|
lpSpoilerGrid->addWidget(&infoOnSpoilersLabel, 3, 0, 1, 3, Qt::AlignTop);
|
||||||
|
|
||||||
// On a change to the check box, hide/unhide the other fields
|
// On a change to the check box, hide/unhide the other fields
|
||||||
connect(&mcDownloadSpoilersCheckBox, SIGNAL(toggled(bool)), settingsCache, SLOT(setDownloadSpoilerStatus(bool)));
|
connect(&mcDownloadSpoilersCheckBox, SIGNAL(toggled(bool)), &SettingsCache::instance(),
|
||||||
|
SLOT(setDownloadSpoilerStatus(bool)));
|
||||||
connect(&mcDownloadSpoilersCheckBox, SIGNAL(toggled(bool)), this, SLOT(setSpoilersEnabled(bool)));
|
connect(&mcDownloadSpoilersCheckBox, SIGNAL(toggled(bool)), this, SLOT(setSpoilersEnabled(bool)));
|
||||||
|
|
||||||
mpGeneralGroupBox = new QGroupBox;
|
mpGeneralGroupBox = new QGroupBox;
|
||||||
|
@ -542,15 +551,15 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
|
|
||||||
void DeckEditorSettingsPage::resetDownloadedURLsButtonClicked()
|
void DeckEditorSettingsPage::resetDownloadedURLsButtonClicked()
|
||||||
{
|
{
|
||||||
settingsCache->downloads().clear();
|
SettingsCache::instance().downloads().clear();
|
||||||
urlList->clear();
|
urlList->clear();
|
||||||
urlList->addItems(settingsCache->downloads().getAllURLs());
|
urlList->addItems(SettingsCache::instance().downloads().getAllURLs());
|
||||||
QMessageBox::information(this, tr("Success"), tr("Download URLs have been reset."));
|
QMessageBox::information(this, tr("Success"), tr("Download URLs have been reset."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorSettingsPage::clearDownloadedPicsButtonClicked()
|
void DeckEditorSettingsPage::clearDownloadedPicsButtonClicked()
|
||||||
{
|
{
|
||||||
QString picsPath = settingsCache->getPicsPath() + "/downloadedPics/";
|
QString picsPath = SettingsCache::instance().getPicsPath() + "/downloadedPics/";
|
||||||
QStringList dirs = QDir(picsPath).entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
QStringList dirs = QDir(picsPath).entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||||
bool outerSuccessRemove = true;
|
bool outerSuccessRemove = true;
|
||||||
for (const auto &dir : dirs) {
|
for (const auto &dir : dirs) {
|
||||||
|
@ -616,10 +625,10 @@ void DeckEditorSettingsPage::actEditURL()
|
||||||
void DeckEditorSettingsPage::storeSettings()
|
void DeckEditorSettingsPage::storeSettings()
|
||||||
{
|
{
|
||||||
qInfo() << "URL Priority Reset";
|
qInfo() << "URL Priority Reset";
|
||||||
settingsCache->downloads().clear();
|
SettingsCache::instance().downloads().clear();
|
||||||
for (int i = 0; i < urlList->count(); i++) {
|
for (int i = 0; i < urlList->count(); i++) {
|
||||||
qInfo() << "Priority" << i << ":" << urlList->item(i)->text();
|
qInfo() << "Priority" << i << ":" << urlList->item(i)->text();
|
||||||
settingsCache->downloads().setDownloadUrlAt(i, urlList->item(i)->text());
|
SettingsCache::instance().downloads().setDownloadUrlAt(i, urlList->item(i)->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +657,7 @@ void DeckEditorSettingsPage::unlockSettings()
|
||||||
|
|
||||||
QString DeckEditorSettingsPage::getLastUpdateTime()
|
QString DeckEditorSettingsPage::getLastUpdateTime()
|
||||||
{
|
{
|
||||||
QString fileName = settingsCache->getSpoilerCardDatabasePath();
|
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QDir fileDir(fi.path());
|
QDir fileDir(fi.path());
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
@ -668,7 +677,7 @@ void DeckEditorSettingsPage::spoilerPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
mpSpoilerSavePathLineEdit->setText(lsPath + "/spoiler.xml");
|
mpSpoilerSavePathLineEdit->setText(lsPath + "/spoiler.xml");
|
||||||
settingsCache->setSpoilerDatabasePath(lsPath + "/spoiler.xml");
|
SettingsCache::instance().setSpoilerDatabasePath(lsPath + "/spoiler.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorSettingsPage::setSpoilersEnabled(bool anInput)
|
void DeckEditorSettingsPage::setSpoilersEnabled(bool anInput)
|
||||||
|
@ -704,43 +713,45 @@ void DeckEditorSettingsPage::retranslateUi()
|
||||||
|
|
||||||
MessagesSettingsPage::MessagesSettingsPage()
|
MessagesSettingsPage::MessagesSettingsPage()
|
||||||
{
|
{
|
||||||
chatMentionCheckBox.setChecked(settingsCache->getChatMention());
|
chatMentionCheckBox.setChecked(SettingsCache::instance().getChatMention());
|
||||||
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
|
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setChatMention(int)));
|
||||||
|
|
||||||
chatMentionCompleterCheckbox.setChecked(settingsCache->getChatMentionCompleter());
|
chatMentionCompleterCheckbox.setChecked(SettingsCache::instance().getChatMentionCompleter());
|
||||||
connect(&chatMentionCompleterCheckbox, SIGNAL(stateChanged(int)), settingsCache,
|
connect(&chatMentionCompleterCheckbox, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setChatMentionCompleter(int)));
|
SLOT(setChatMentionCompleter(int)));
|
||||||
|
|
||||||
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
|
ignoreUnregUsersMainChat.setChecked(SettingsCache::instance().getIgnoreUnregisteredUsers());
|
||||||
ignoreUnregUserMessages.setChecked(settingsCache->getIgnoreUnregisteredUserMessages());
|
ignoreUnregUserMessages.setChecked(SettingsCache::instance().getIgnoreUnregisteredUserMessages());
|
||||||
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
|
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), settingsCache,
|
SLOT(setIgnoreUnregisteredUsers(int)));
|
||||||
|
connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), &SettingsCache::instance(),
|
||||||
SLOT(setIgnoreUnregisteredUserMessages(int)));
|
SLOT(setIgnoreUnregisteredUserMessages(int)));
|
||||||
|
|
||||||
invertMentionForeground.setChecked(settingsCache->getChatMentionForeground());
|
invertMentionForeground.setChecked(SettingsCache::instance().getChatMentionForeground());
|
||||||
connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));
|
connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));
|
||||||
|
|
||||||
invertHighlightForeground.setChecked(settingsCache->getChatHighlightForeground());
|
invertHighlightForeground.setChecked(SettingsCache::instance().getChatHighlightForeground());
|
||||||
connect(&invertHighlightForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextHighlightColor(int)));
|
connect(&invertHighlightForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextHighlightColor(int)));
|
||||||
|
|
||||||
mentionColor = new QLineEdit();
|
mentionColor = new QLineEdit();
|
||||||
mentionColor->setText(settingsCache->getChatMentionColor());
|
mentionColor->setText(SettingsCache::instance().getChatMentionColor());
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString)));
|
connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString)));
|
||||||
|
|
||||||
messagePopups.setChecked(settingsCache->getShowMessagePopup());
|
messagePopups.setChecked(SettingsCache::instance().getShowMessagePopup());
|
||||||
connect(&messagePopups, SIGNAL(stateChanged(int)), settingsCache, SLOT(setShowMessagePopups(int)));
|
connect(&messagePopups, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setShowMessagePopups(int)));
|
||||||
|
|
||||||
mentionPopups.setChecked(settingsCache->getShowMentionPopup());
|
mentionPopups.setChecked(SettingsCache::instance().getShowMentionPopup());
|
||||||
connect(&mentionPopups, SIGNAL(stateChanged(int)), settingsCache, SLOT(setShowMentionPopups(int)));
|
connect(&mentionPopups, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setShowMentionPopups(int)));
|
||||||
|
|
||||||
roomHistory.setChecked(settingsCache->getRoomHistory());
|
roomHistory.setChecked(SettingsCache::instance().getRoomHistory());
|
||||||
connect(&roomHistory, SIGNAL(stateChanged(int)), settingsCache, SLOT(setRoomHistory(int)));
|
connect(&roomHistory, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setRoomHistory(int)));
|
||||||
|
|
||||||
customAlertString = new QLineEdit();
|
customAlertString = new QLineEdit();
|
||||||
customAlertString->setPlaceholderText(tr("Word1 Word2 Word3"));
|
customAlertString->setPlaceholderText(tr("Word1 Word2 Word3"));
|
||||||
customAlertString->setText(settingsCache->getHighlightWords());
|
customAlertString->setText(SettingsCache::instance().getHighlightWords());
|
||||||
connect(customAlertString, SIGNAL(textChanged(QString)), settingsCache, SLOT(setHighlightWords(QString)));
|
connect(customAlertString, SIGNAL(textChanged(QString)), &SettingsCache::instance(),
|
||||||
|
SLOT(setHighlightWords(QString)));
|
||||||
|
|
||||||
auto *chatGrid = new QGridLayout;
|
auto *chatGrid = new QGridLayout;
|
||||||
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
||||||
|
@ -757,7 +768,7 @@ MessagesSettingsPage::MessagesSettingsPage()
|
||||||
chatGroupBox->setLayout(chatGrid);
|
chatGroupBox->setLayout(chatGrid);
|
||||||
|
|
||||||
highlightColor = new QLineEdit();
|
highlightColor = new QLineEdit();
|
||||||
highlightColor->setText(settingsCache->getChatHighlightColor());
|
highlightColor->setText(SettingsCache::instance().getChatHighlightColor());
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
connect(highlightColor, SIGNAL(textChanged(QString)), this, SLOT(updateHighlightColor(QString)));
|
connect(highlightColor, SIGNAL(textChanged(QString)), this, SLOT(updateHighlightColor(QString)));
|
||||||
|
|
||||||
|
@ -772,9 +783,9 @@ MessagesSettingsPage::MessagesSettingsPage()
|
||||||
|
|
||||||
messageList = new QListWidget;
|
messageList = new QListWidget;
|
||||||
|
|
||||||
int count = settingsCache->messages().getCount();
|
int count = SettingsCache::instance().messages().getCount();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
messageList->addItem(settingsCache->messages().getMessageAt(i));
|
messageList->addItem(SettingsCache::instance().messages().getMessageAt(i));
|
||||||
|
|
||||||
aAdd = new QAction(this);
|
aAdd = new QAction(this);
|
||||||
aAdd->setIcon(QPixmap("theme:icons/increment"));
|
aAdd->setIcon(QPixmap("theme:icons/increment"));
|
||||||
|
@ -820,7 +831,7 @@ void MessagesSettingsPage::updateColor(const QString &value)
|
||||||
QColor colorToSet;
|
QColor colorToSet;
|
||||||
colorToSet.setNamedColor("#" + value);
|
colorToSet.setNamedColor("#" + value);
|
||||||
if (colorToSet.isValid()) {
|
if (colorToSet.isValid()) {
|
||||||
settingsCache->setChatMentionColor(value);
|
SettingsCache::instance().setChatMentionColor(value);
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -830,40 +841,42 @@ void MessagesSettingsPage::updateHighlightColor(const QString &value)
|
||||||
QColor colorToSet;
|
QColor colorToSet;
|
||||||
colorToSet.setNamedColor("#" + value);
|
colorToSet.setNamedColor("#" + value);
|
||||||
if (colorToSet.isValid()) {
|
if (colorToSet.isValid()) {
|
||||||
settingsCache->setChatHighlightColor(value);
|
SettingsCache::instance().setChatHighlightColor(value);
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateTextColor(int value)
|
void MessagesSettingsPage::updateTextColor(int value)
|
||||||
{
|
{
|
||||||
settingsCache->setChatMentionForeground(value);
|
SettingsCache::instance().setChatMentionForeground(value);
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateTextHighlightColor(int value)
|
void MessagesSettingsPage::updateTextHighlightColor(int value)
|
||||||
{
|
{
|
||||||
settingsCache->setChatHighlightForeground(value);
|
SettingsCache::instance().setChatHighlightForeground(value);
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateMentionPreview()
|
void MessagesSettingsPage::updateMentionPreview()
|
||||||
{
|
{
|
||||||
mentionColor->setStyleSheet("QLineEdit{background:#" + settingsCache->getChatMentionColor() +
|
mentionColor->setStyleSheet(
|
||||||
";color: " + (settingsCache->getChatMentionForeground() ? "white" : "black") + ";}");
|
"QLineEdit{background:#" + SettingsCache::instance().getChatMentionColor() +
|
||||||
|
";color: " + (SettingsCache::instance().getChatMentionForeground() ? "white" : "black") + ";}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateHighlightPreview()
|
void MessagesSettingsPage::updateHighlightPreview()
|
||||||
{
|
{
|
||||||
highlightColor->setStyleSheet("QLineEdit{background:#" + settingsCache->getChatHighlightColor() + ";color: " +
|
highlightColor->setStyleSheet(
|
||||||
(settingsCache->getChatHighlightForeground() ? "white" : "black") + ";}");
|
"QLineEdit{background:#" + SettingsCache::instance().getChatHighlightColor() +
|
||||||
|
";color: " + (SettingsCache::instance().getChatHighlightForeground() ? "white" : "black") + ";}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::storeSettings()
|
void MessagesSettingsPage::storeSettings()
|
||||||
{
|
{
|
||||||
settingsCache->messages().setCount(messageList->count());
|
SettingsCache::instance().messages().setCount(messageList->count());
|
||||||
for (int i = 0; i < messageList->count(); i++)
|
for (int i = 0; i < messageList->count(); i++)
|
||||||
settingsCache->messages().setMessageAt(i, messageList->item(i)->text());
|
SettingsCache::instance().messages().setMessageAt(i, messageList->item(i)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::actAdd()
|
void MessagesSettingsPage::actAdd()
|
||||||
|
@ -918,10 +931,10 @@ void MessagesSettingsPage::retranslateUi()
|
||||||
|
|
||||||
SoundSettingsPage::SoundSettingsPage()
|
SoundSettingsPage::SoundSettingsPage()
|
||||||
{
|
{
|
||||||
soundEnabledCheckBox.setChecked(settingsCache->getSoundEnabled());
|
soundEnabledCheckBox.setChecked(SettingsCache::instance().getSoundEnabled());
|
||||||
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
|
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setSoundEnabled(int)));
|
||||||
|
|
||||||
QString themeName = settingsCache->getSoundThemeName();
|
QString themeName = SettingsCache::instance().getSoundThemeName();
|
||||||
|
|
||||||
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
||||||
for (int i = 0; i < themeDirs.size(); i++) {
|
for (int i = 0; i < themeDirs.size(); i++) {
|
||||||
|
@ -936,16 +949,16 @@ SoundSettingsPage::SoundSettingsPage()
|
||||||
masterVolumeSlider = new QSlider(Qt::Horizontal);
|
masterVolumeSlider = new QSlider(Qt::Horizontal);
|
||||||
masterVolumeSlider->setMinimum(0);
|
masterVolumeSlider->setMinimum(0);
|
||||||
masterVolumeSlider->setMaximum(100);
|
masterVolumeSlider->setMaximum(100);
|
||||||
masterVolumeSlider->setValue(settingsCache->getMasterVolume());
|
masterVolumeSlider->setValue(SettingsCache::instance().getMasterVolume());
|
||||||
masterVolumeSlider->setToolTip(QString::number(settingsCache->getMasterVolume()));
|
masterVolumeSlider->setToolTip(QString::number(SettingsCache::instance().getMasterVolume()));
|
||||||
connect(settingsCache, SIGNAL(masterVolumeChanged(int)), this, SLOT(masterVolumeChanged(int)));
|
connect(&SettingsCache::instance(), SIGNAL(masterVolumeChanged(int)), this, SLOT(masterVolumeChanged(int)));
|
||||||
connect(masterVolumeSlider, SIGNAL(sliderReleased()), soundEngine, SLOT(testSound()));
|
connect(masterVolumeSlider, SIGNAL(sliderReleased()), soundEngine, SLOT(testSound()));
|
||||||
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMasterVolume(int)));
|
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), &SettingsCache::instance(), SLOT(setMasterVolume(int)));
|
||||||
|
|
||||||
masterVolumeSpinBox = new QSpinBox();
|
masterVolumeSpinBox = new QSpinBox();
|
||||||
masterVolumeSpinBox->setMinimum(0);
|
masterVolumeSpinBox->setMinimum(0);
|
||||||
masterVolumeSpinBox->setMaximum(100);
|
masterVolumeSpinBox->setMaximum(100);
|
||||||
masterVolumeSpinBox->setValue(settingsCache->getMasterVolume());
|
masterVolumeSpinBox->setValue(SettingsCache::instance().getMasterVolume());
|
||||||
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), masterVolumeSpinBox, SLOT(setValue(int)));
|
connect(masterVolumeSlider, SIGNAL(valueChanged(int)), masterVolumeSpinBox, SLOT(setValue(int)));
|
||||||
connect(masterVolumeSpinBox, SIGNAL(valueChanged(int)), masterVolumeSlider, SLOT(setValue(int)));
|
connect(masterVolumeSpinBox, SIGNAL(valueChanged(int)), masterVolumeSlider, SLOT(setValue(int)));
|
||||||
|
|
||||||
|
@ -971,7 +984,7 @@ void SoundSettingsPage::themeBoxChanged(int index)
|
||||||
{
|
{
|
||||||
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
||||||
if (index >= 0 && index < themeDirs.count())
|
if (index >= 0 && index < themeDirs.count())
|
||||||
settingsCache->setSoundThemeName(themeDirs.at(index));
|
SettingsCache::instance().setSoundThemeName(themeDirs.at(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundSettingsPage::masterVolumeChanged(int value)
|
void SoundSettingsPage::masterVolumeChanged(int value)
|
||||||
|
@ -1046,7 +1059,7 @@ ShortcutSettingsPage::ShortcutSettingsPage()
|
||||||
connect(btnClearAll, SIGNAL(clicked()), this, SLOT(clearShortcuts()));
|
connect(btnClearAll, SIGNAL(clicked()), this, SLOT(clearShortcuts()));
|
||||||
connect(shortcutsTable, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this,
|
connect(shortcutsTable, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this,
|
||||||
SLOT(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
SLOT(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
|
|
||||||
createShortcuts();
|
createShortcuts();
|
||||||
}
|
}
|
||||||
|
@ -1059,8 +1072,8 @@ void ShortcutSettingsPage::currentItemChanged(QTreeWidgetItem *current, QTreeWid
|
||||||
editTextBox->setShortcutName("");
|
editTextBox->setShortcutName("");
|
||||||
} else {
|
} else {
|
||||||
QString key = current->data(2, Qt::DisplayRole).toString();
|
QString key = current->data(2, Qt::DisplayRole).toString();
|
||||||
QString group = settingsCache->shortcuts().getShortcut(key).getGroupName();
|
QString group = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
|
||||||
QString action = settingsCache->shortcuts().getShortcut(key).getName();
|
QString action = SettingsCache::instance().shortcuts().getShortcut(key).getName();
|
||||||
currentActionGroupName->setText(group);
|
currentActionGroupName->setText(group);
|
||||||
currentActionName->setText(action);
|
currentActionName->setText(action);
|
||||||
editTextBox->setShortcutName(key);
|
editTextBox->setShortcutName(key);
|
||||||
|
@ -1071,7 +1084,7 @@ void ShortcutSettingsPage::resetShortcuts()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, tr("Restore all default shortcuts"),
|
if (QMessageBox::question(this, tr("Restore all default shortcuts"),
|
||||||
tr("Do you really want to restore all default shortcuts?")) == QMessageBox::Yes) {
|
tr("Do you really want to restore all default shortcuts?")) == QMessageBox::Yes) {
|
||||||
settingsCache->shortcuts().resetAllShortcuts();
|
SettingsCache::instance().shortcuts().resetAllShortcuts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,10 +1092,10 @@ void ShortcutSettingsPage::createShortcuts()
|
||||||
{
|
{
|
||||||
QHash<QString, QTreeWidgetItem *> parentItems;
|
QHash<QString, QTreeWidgetItem *> parentItems;
|
||||||
QTreeWidgetItem *curParent = nullptr;
|
QTreeWidgetItem *curParent = nullptr;
|
||||||
for (const auto &key : settingsCache->shortcuts().getAllShortcutKeys()) {
|
for (const auto &key : SettingsCache::instance().shortcuts().getAllShortcutKeys()) {
|
||||||
QString name = settingsCache->shortcuts().getShortcut(key).getName();
|
QString name = SettingsCache::instance().shortcuts().getShortcut(key).getName();
|
||||||
QString group = settingsCache->shortcuts().getShortcut(key).getGroupName();
|
QString group = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
|
||||||
QString shortcut = settingsCache->shortcuts().getShortcutString(key);
|
QString shortcut = SettingsCache::instance().shortcuts().getShortcutString(key);
|
||||||
|
|
||||||
if (parentItems.contains(group)) {
|
if (parentItems.contains(group)) {
|
||||||
curParent = parentItems.value(group);
|
curParent = parentItems.value(group);
|
||||||
|
@ -1112,14 +1125,14 @@ void ShortcutSettingsPage::refreshShortcuts()
|
||||||
for (int j = 0; j < curParent->childCount(); ++j) {
|
for (int j = 0; j < curParent->childCount(); ++j) {
|
||||||
curChild = curParent->child(j);
|
curChild = curParent->child(j);
|
||||||
QString key = curChild->data(2, Qt::DisplayRole).toString();
|
QString key = curChild->data(2, Qt::DisplayRole).toString();
|
||||||
QString name = settingsCache->shortcuts().getShortcut(key).getName();
|
QString name = SettingsCache::instance().shortcuts().getShortcut(key).getName();
|
||||||
QString shortcut = settingsCache->shortcuts().getShortcutString(key);
|
QString shortcut = SettingsCache::instance().shortcuts().getShortcutString(key);
|
||||||
curChild->setText(0, name);
|
curChild->setText(0, name);
|
||||||
curChild->setText(1, shortcut);
|
curChild->setText(1, shortcut);
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
// the first child also updates the parent's group name
|
// the first child also updates the parent's group name
|
||||||
QString group = settingsCache->shortcuts().getShortcut(key).getGroupName();
|
QString group = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
|
||||||
curParent->setText(0, group);
|
curParent->setText(0, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1145,7 @@ void ShortcutSettingsPage::clearShortcuts()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, tr("Clear all default shortcuts"),
|
if (QMessageBox::question(this, tr("Clear all default shortcuts"),
|
||||||
tr("Do you really want to clear all shortcuts?")) == QMessageBox::Yes) {
|
tr("Do you really want to clear all shortcuts?")) == QMessageBox::Yes) {
|
||||||
settingsCache->shortcuts().clearAllShortcuts();
|
SettingsCache::instance().shortcuts().clearAllShortcuts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,7 +1173,7 @@ DlgSettings::DlgSettings(QWidget *parent) : QDialog(parent)
|
||||||
this->setMinimumSize(rec.width() / 2, rec.height() - 100);
|
this->setMinimumSize(rec.width() / 2, rec.height() - 100);
|
||||||
this->setBaseSize(rec.width(), rec.height());
|
this->setBaseSize(rec.width(), rec.height());
|
||||||
|
|
||||||
connect(settingsCache, SIGNAL(langChanged()), this, SLOT(updateLanguage()));
|
connect(&SettingsCache::instance(), SIGNAL(langChanged()), this, SLOT(updateLanguage()));
|
||||||
|
|
||||||
contentsWidget = new QListWidget;
|
contentsWidget = new QListWidget;
|
||||||
contentsWidget->setViewMode(QListView::IconMode);
|
contentsWidget->setViewMode(QListView::IconMode);
|
||||||
|
@ -1322,7 +1335,7 @@ void DlgSettings::closeEvent(QCloseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QDir(settingsCache->getDeckPath()).exists() || settingsCache->getDeckPath().isEmpty()) {
|
if (!QDir(SettingsCache::instance().getDeckPath()).exists() || SettingsCache::instance().getDeckPath().isEmpty()) {
|
||||||
// TODO: Prompt to create it
|
// TODO: Prompt to create it
|
||||||
if (QMessageBox::critical(
|
if (QMessageBox::critical(
|
||||||
this, tr("Error"),
|
this, tr("Error"),
|
||||||
|
@ -1333,7 +1346,7 @@ void DlgSettings::closeEvent(QCloseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QDir(settingsCache->getPicsPath()).exists() || settingsCache->getPicsPath().isEmpty()) {
|
if (!QDir(SettingsCache::instance().getPicsPath()).exists() || SettingsCache::instance().getPicsPath().isEmpty()) {
|
||||||
// TODO: Prompt to create it
|
// TODO: Prompt to create it
|
||||||
if (QMessageBox::critical(this, tr("Error"),
|
if (QMessageBox::critical(this, tr("Error"),
|
||||||
tr("The path to your card pictures directory is invalid. Would you like to go back "
|
tr("The path to your card pictures directory is invalid. Would you like to go back "
|
||||||
|
|
|
@ -42,7 +42,7 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
||||||
tipNumber = new QLabel();
|
tipNumber = new QLabel();
|
||||||
tipNumber->setAlignment(Qt::AlignCenter);
|
tipNumber->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
QList<int> seenTips = settingsCache->getSeenTips();
|
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
||||||
newTipsAvailable = false;
|
newTipsAvailable = false;
|
||||||
currentTip = 0;
|
currentTip = 0;
|
||||||
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
||||||
|
@ -74,8 +74,9 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
||||||
connect(previousButton, SIGNAL(clicked()), this, SLOT(previousClicked()));
|
connect(previousButton, SIGNAL(clicked()), this, SLOT(previousClicked()));
|
||||||
|
|
||||||
showTipsOnStartupCheck = new QCheckBox("Show tips on startup");
|
showTipsOnStartupCheck = new QCheckBox("Show tips on startup");
|
||||||
showTipsOnStartupCheck->setChecked(settingsCache->getShowTipsOnStartup());
|
showTipsOnStartupCheck->setChecked(SettingsCache::instance().getShowTipsOnStartup());
|
||||||
connect(showTipsOnStartupCheck, SIGNAL(clicked(bool)), settingsCache, SLOT(setShowTipsOnStartup(bool)));
|
connect(showTipsOnStartupCheck, SIGNAL(clicked(bool)), &SettingsCache::instance(),
|
||||||
|
SLOT(setShowTipsOnStartup(bool)));
|
||||||
buttonBar = new QHBoxLayout();
|
buttonBar = new QHBoxLayout();
|
||||||
buttonBar->addWidget(showTipsOnStartupCheck);
|
buttonBar->addWidget(showTipsOnStartupCheck);
|
||||||
buttonBar->addWidget(tipNumber);
|
buttonBar->addWidget(tipNumber);
|
||||||
|
@ -130,10 +131,10 @@ void DlgTipOfTheDay::updateTip(int tipId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store tip id as seen
|
// Store tip id as seen
|
||||||
QList<int> seenTips = settingsCache->getSeenTips();
|
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
||||||
if (!seenTips.contains(tipId)) {
|
if (!seenTips.contains(tipId)) {
|
||||||
seenTips.append(tipId);
|
seenTips.append(tipId);
|
||||||
settingsCache->setSeenTips(seenTips);
|
SettingsCache::instance().setSeenTips(seenTips);
|
||||||
}
|
}
|
||||||
|
|
||||||
TipOfTheDay tip = tipDatabase->getTip(tipId);
|
TipOfTheDay tip = tipDatabase->getTip(tipId);
|
||||||
|
|
|
@ -24,7 +24,7 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
|
||||||
statusLabel->setWordWrap(true);
|
statusLabel->setWordWrap(true);
|
||||||
descriptionLabel =
|
descriptionLabel =
|
||||||
new QLabel(tr("Current release channel") +
|
new QLabel(tr("Current release channel") +
|
||||||
QString(": %1").arg(tr(settingsCache->getUpdateReleaseChannel()->getName().toUtf8())),
|
QString(": %1").arg(tr(SettingsCache::instance().getUpdateReleaseChannel()->getName().toUtf8())),
|
||||||
this);
|
this);
|
||||||
progress = new QProgressBar(this);
|
progress = new QProgressBar(this);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
|
||||||
connect(uDownloader, SIGNAL(progressMade(qint64, qint64)), this, SLOT(downloadProgressMade(qint64, qint64)));
|
connect(uDownloader, SIGNAL(progressMade(qint64, qint64)), this, SLOT(downloadProgressMade(qint64, qint64)));
|
||||||
connect(uDownloader, SIGNAL(error(QString)), this, SLOT(downloadError(QString)));
|
connect(uDownloader, SIGNAL(error(QString)), this, SLOT(downloadError(QString)));
|
||||||
|
|
||||||
ReleaseChannel *channel = settingsCache->getUpdateReleaseChannel();
|
ReleaseChannel *channel = SettingsCache::instance().getUpdateReleaseChannel();
|
||||||
connect(channel, SIGNAL(finishedCheck(bool, bool, Release *)), this,
|
connect(channel, SIGNAL(finishedCheck(bool, bool, Release *)), this,
|
||||||
SLOT(finishedUpdateCheck(bool, bool, Release *)));
|
SLOT(finishedUpdateCheck(bool, bool, Release *)));
|
||||||
connect(channel, SIGNAL(error(QString)), this, SLOT(updateCheckError(QString)));
|
connect(channel, SIGNAL(error(QString)), this, SLOT(updateCheckError(QString)));
|
||||||
|
@ -83,7 +83,7 @@ void DlgUpdate::closeDialog()
|
||||||
|
|
||||||
void DlgUpdate::gotoDownloadPage()
|
void DlgUpdate::gotoDownloadPage()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl(settingsCache->getUpdateReleaseChannel()->getManualDownloadUrl());
|
QDesktopServices::openUrl(SettingsCache::instance().getUpdateReleaseChannel()->getManualDownloadUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::downloadUpdate()
|
void DlgUpdate::downloadUpdate()
|
||||||
|
@ -106,7 +106,7 @@ void DlgUpdate::beginUpdateCheck()
|
||||||
progress->setMinimum(0);
|
progress->setMinimum(0);
|
||||||
progress->setMaximum(0);
|
progress->setMaximum(0);
|
||||||
setLabel(tr("Checking for updates..."));
|
setLabel(tr("Checking for updates..."));
|
||||||
settingsCache->getUpdateReleaseChannel()->checkForUpdates();
|
SettingsCache::instance().getUpdateReleaseChannel()->checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Release *release)
|
void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Release *release)
|
||||||
|
@ -136,7 +136,7 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Releas
|
||||||
tr("You are already running the latest version available in the chosen release channel.") + "<br>" +
|
tr("You are already running the latest version available in the chosen release channel.") + "<br>" +
|
||||||
"<b>" + tr("Current version") + QString(":</b> %1<br>").arg(VERSION_STRING) + "<b>" +
|
"<b>" + tr("Current version") + QString(":</b> %1<br>").arg(VERSION_STRING) + "<b>" +
|
||||||
tr("Selected release channel") +
|
tr("Selected release channel") +
|
||||||
QString(":</b> %1").arg(tr(settingsCache->getUpdateReleaseChannel()->getName().toUtf8())));
|
QString(":</b> %1").arg(tr(SettingsCache::instance().getUpdateReleaseChannel()->getName().toUtf8())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
||||||
|
|
||||||
coClearLog = new QCheckBox;
|
coClearLog = new QCheckBox;
|
||||||
coClearLog->setText(tr("Clear log when closing"));
|
coClearLog->setText(tr("Clear log when closing"));
|
||||||
coClearLog->setChecked(settingsCache->servers().getClearDebugLogStatus(false));
|
coClearLog->setChecked(SettingsCache::instance().servers().getClearDebugLogStatus(false));
|
||||||
connect(coClearLog, SIGNAL(toggled(bool)), this, SLOT(actCheckBoxChanged(bool)));
|
connect(coClearLog, SIGNAL(toggled(bool)), this, SLOT(actCheckBoxChanged(bool)));
|
||||||
mainLayout->addWidget(coClearLog);
|
mainLayout->addWidget(coClearLog);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
||||||
|
|
||||||
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
||||||
{
|
{
|
||||||
settingsCache->servers().setClearDebugLogStatus(abNewValue);
|
SettingsCache::instance().servers().setClearDebugLogStatus(abNewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgViewLog::loadInitialLogBuffer()
|
void DlgViewLog::loadInitialLogBuffer()
|
||||||
|
|
|
@ -20,7 +20,7 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent)
|
||||||
{
|
{
|
||||||
animationTimer = new QBasicTimer;
|
animationTimer = new QBasicTimer;
|
||||||
addItem(phasesToolbar);
|
addItem(phasesToolbar);
|
||||||
connect(settingsCache, SIGNAL(minPlayersForMultiColumnLayoutChanged()), this, SLOT(rearrange()));
|
connect(&SettingsCache::instance(), SIGNAL(minPlayersForMultiColumnLayoutChanged()), this, SLOT(rearrange()));
|
||||||
|
|
||||||
rearrange();
|
rearrange();
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void GameScene::rearrange()
|
||||||
}
|
}
|
||||||
|
|
||||||
const int playersCount = playersPlaying.size();
|
const int playersCount = playersPlaying.size();
|
||||||
const int columns = playersCount < settingsCache->getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
const int columns = playersCount < SettingsCache::instance().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||||
const int rows = ceil((qreal)playersCount / columns);
|
const int rows = ceil((qreal)playersCount / columns);
|
||||||
qreal sceneHeight = 0, sceneWidth = -playerAreaSpacing;
|
qreal sceneHeight = 0, sceneWidth = -playerAreaSpacing;
|
||||||
QList<int> columnWidth;
|
QList<int> columnWidth;
|
||||||
|
|
|
@ -345,18 +345,18 @@ void GamesProxyModel::resetFilterParameters()
|
||||||
|
|
||||||
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
|
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||||
{
|
{
|
||||||
|
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||||
unavailableGamesVisible = settingsCache->gameFilters().isUnavailableGamesVisible();
|
unavailableGamesVisible = gameFilters.isUnavailableGamesVisible();
|
||||||
showPasswordProtectedGames = settingsCache->gameFilters().isShowPasswordProtectedGames();
|
showPasswordProtectedGames = gameFilters.isShowPasswordProtectedGames();
|
||||||
hideIgnoredUserGames = settingsCache->gameFilters().isHideIgnoredUserGames();
|
hideIgnoredUserGames = gameFilters.isHideIgnoredUserGames();
|
||||||
gameNameFilter = settingsCache->gameFilters().getGameNameFilter();
|
gameNameFilter = gameFilters.getGameNameFilter();
|
||||||
maxPlayersFilterMin = settingsCache->gameFilters().getMinPlayers();
|
maxPlayersFilterMin = gameFilters.getMinPlayers();
|
||||||
maxPlayersFilterMax = settingsCache->gameFilters().getMaxPlayers();
|
maxPlayersFilterMax = gameFilters.getMaxPlayers();
|
||||||
|
|
||||||
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
||||||
while (gameTypesIterator.hasNext()) {
|
while (gameTypesIterator.hasNext()) {
|
||||||
gameTypesIterator.next();
|
gameTypesIterator.next();
|
||||||
if (settingsCache->gameFilters().isGameTypeEnabled(gameTypesIterator.value())) {
|
if (gameFilters.isGameTypeEnabled(gameTypesIterator.value())) {
|
||||||
gameTypeFilter.insert(gameTypesIterator.key());
|
gameTypeFilter.insert(gameTypesIterator.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,21 +366,22 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
||||||
|
|
||||||
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
|
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||||
{
|
{
|
||||||
settingsCache->gameFilters().setShowBuddiesOnlyGames(showBuddiesOnlyGames);
|
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||||
settingsCache->gameFilters().setUnavailableGamesVisible(unavailableGamesVisible);
|
gameFilters.setShowBuddiesOnlyGames(showBuddiesOnlyGames);
|
||||||
settingsCache->gameFilters().setShowPasswordProtectedGames(showPasswordProtectedGames);
|
gameFilters.setUnavailableGamesVisible(unavailableGamesVisible);
|
||||||
settingsCache->gameFilters().setHideIgnoredUserGames(hideIgnoredUserGames);
|
gameFilters.setShowPasswordProtectedGames(showPasswordProtectedGames);
|
||||||
settingsCache->gameFilters().setGameNameFilter(gameNameFilter);
|
gameFilters.setHideIgnoredUserGames(hideIgnoredUserGames);
|
||||||
|
gameFilters.setGameNameFilter(gameNameFilter);
|
||||||
|
|
||||||
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
|
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
|
||||||
while (gameTypeIterator.hasNext()) {
|
while (gameTypeIterator.hasNext()) {
|
||||||
gameTypeIterator.next();
|
gameTypeIterator.next();
|
||||||
bool enabled = gameTypeFilter.contains(gameTypeIterator.key());
|
bool enabled = gameTypeFilter.contains(gameTypeIterator.key());
|
||||||
settingsCache->gameFilters().setGameTypeEnabled(gameTypeIterator.value(), enabled);
|
gameFilters.setGameTypeEnabled(gameTypeIterator.value(), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->gameFilters().setMinPlayers(maxPlayersFilterMin);
|
gameFilters.setMinPlayers(maxPlayersFilterMin);
|
||||||
settingsCache->gameFilters().setMaxPlayers(maxPlayersFilterMax);
|
gameFilters.setMaxPlayers(maxPlayersFilterMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
||||||
|
|
|
@ -24,7 +24,7 @@ GameView::GameView(QGraphicsScene *scene, QWidget *parent) : QGraphicsView(scene
|
||||||
|
|
||||||
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
|
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
|
||||||
addAction(aCloseMostRecentZoneView);
|
addAction(aCloseMostRecentZoneView);
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
||||||
}
|
}
|
||||||
|
@ -65,5 +65,6 @@ void GameView::stopRubberBand()
|
||||||
|
|
||||||
void GameView::refreshShortcuts()
|
void GameView::refreshShortcuts()
|
||||||
{
|
{
|
||||||
aCloseMostRecentZoneView->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
aCloseMostRecentZoneView->setShortcuts(
|
||||||
|
SettingsCache::instance().shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,11 @@ void HandlePublicServers::updateServerINISettings(QMap<QString, QVariant> jsonMa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverFound) {
|
if (serverFound) {
|
||||||
settingsCache->servers().updateExistingServerWithoutLoss(serverName, serverAddress, serverPort, serverSite);
|
SettingsCache::instance().servers().updateExistingServerWithoutLoss(serverName, serverAddress, serverPort,
|
||||||
|
serverSite);
|
||||||
} else {
|
} else {
|
||||||
settingsCache->servers().addNewServer(serverName, serverAddress, serverPort, "", "", false, serverSite);
|
SettingsCache::instance().servers().addNewServer(serverName, serverAddress, serverPort, "", "", false,
|
||||||
|
serverSite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ void HandlePublicServers::updateServerINISettings(QMap<QString, QVariant> jsonMa
|
||||||
QString serverAddr = pair.first;
|
QString serverAddr = pair.first;
|
||||||
|
|
||||||
if (publicServersToRemove.indexOf(serverAddr) != -1) {
|
if (publicServersToRemove.indexOf(serverAddr) != -1) {
|
||||||
settingsCache->servers().removeServer(serverAddr);
|
SettingsCache::instance().servers().removeServer(serverAddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone
|
||||||
{
|
{
|
||||||
QPoint point = dropPoint + scenePos().toPoint();
|
QPoint point = dropPoint + scenePos().toPoint();
|
||||||
int x = -1;
|
int x = -1;
|
||||||
if (settingsCache->getHorizontalHand()) {
|
if (SettingsCache::instance().getHorizontalHand()) {
|
||||||
for (x = 0; x < cards.size(); x++)
|
for (x = 0; x < cards.size(); x++)
|
||||||
if (point.x() < static_cast<CardItem *>(cards.at(x))->scenePos().x())
|
if (point.x() < static_cast<CardItem *>(cards.at(x))->scenePos().x())
|
||||||
break;
|
break;
|
||||||
|
@ -68,7 +68,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone
|
||||||
|
|
||||||
QRectF HandZone::boundingRect() const
|
QRectF HandZone::boundingRect() const
|
||||||
{
|
{
|
||||||
if (settingsCache->getHorizontalHand())
|
if (SettingsCache::instance().getHorizontalHand())
|
||||||
return QRectF(0, 0, width, CARD_HEIGHT + 10);
|
return QRectF(0, 0, width, CARD_HEIGHT + 10);
|
||||||
else
|
else
|
||||||
return QRectF(0, 0, 100, zoneHeight);
|
return QRectF(0, 0, 100, zoneHeight);
|
||||||
|
@ -83,8 +83,8 @@ void HandZone::reorganizeCards()
|
||||||
{
|
{
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
const int cardCount = cards.size();
|
const int cardCount = cards.size();
|
||||||
if (settingsCache->getHorizontalHand()) {
|
if (SettingsCache::instance().getHorizontalHand()) {
|
||||||
bool leftJustified = settingsCache->getLeftJustified();
|
bool leftJustified = SettingsCache::instance().getLeftJustified();
|
||||||
qreal cardWidth = cards.at(0)->boundingRect().width();
|
qreal cardWidth = cards.at(0)->boundingRect().width();
|
||||||
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
||||||
qreal totalWidth =
|
qreal totalWidth =
|
||||||
|
@ -131,7 +131,7 @@ void HandZone::reorganizeCards()
|
||||||
|
|
||||||
void HandZone::setWidth(qreal _width)
|
void HandZone::setWidth(qreal _width)
|
||||||
{
|
{
|
||||||
if (settingsCache->getHorizontalHand()) {
|
if (SettingsCache::instance().getHorizontalHand()) {
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
width = _width;
|
width = _width;
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
|
|
||||||
CardDatabase *db;
|
CardDatabase *db;
|
||||||
QTranslator *translator, *qtTranslator;
|
QTranslator *translator, *qtTranslator;
|
||||||
SettingsCache *settingsCache;
|
|
||||||
RNG_Abstract *rng;
|
RNG_Abstract *rng;
|
||||||
SoundEngine *soundEngine;
|
SoundEngine *soundEngine;
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
|
@ -66,7 +65,7 @@ static void CockatriceLogger(QtMsgType type, const QMessageLogContext &ctx, cons
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
QString lang = settingsCache->getLang();
|
QString lang = SettingsCache::instance().getLang();
|
||||||
|
|
||||||
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
qApp->installTranslator(qtTranslator);
|
qApp->installTranslator(qtTranslator);
|
||||||
|
@ -133,7 +132,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
rng = new RNG_SFMT;
|
rng = new RNG_SFMT;
|
||||||
settingsCache = new SettingsCache;
|
|
||||||
themeManager = new ThemeManager;
|
themeManager = new ThemeManager;
|
||||||
soundEngine = new SoundEngine;
|
soundEngine = new SoundEngine;
|
||||||
db = new CardDatabase;
|
db = new CardDatabase;
|
||||||
|
@ -154,7 +152,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
ui.setWindowIcon(QPixmap("theme:cockatrice"));
|
ui.setWindowIcon(QPixmap("theme:cockatrice"));
|
||||||
|
|
||||||
settingsCache->setClientID(generateClientID());
|
SettingsCache::instance().setClientID(generateClientID());
|
||||||
|
|
||||||
// If spoiler mode is enabled, we will download the spoilers
|
// If spoiler mode is enabled, we will download the spoilers
|
||||||
// then reload the DB. otherwise just reload the DB
|
// then reload the DB. otherwise just reload the DB
|
||||||
|
@ -168,7 +166,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
qDebug("Event loop finished, terminating...");
|
qDebug("Event loop finished, terminating...");
|
||||||
delete db;
|
delete db;
|
||||||
delete settingsCache;
|
|
||||||
delete rng;
|
delete rng;
|
||||||
PingPixmapGenerator::clear();
|
PingPixmapGenerator::clear();
|
||||||
CountryPixmapGenerator::clear();
|
CountryPixmapGenerator::clear();
|
||||||
|
|
|
@ -27,10 +27,9 @@
|
||||||
// never cache more than 300 cards at once for a single deck
|
// never cache more than 300 cards at once for a single deck
|
||||||
#define CACHED_CARD_PER_DECK_MAX 300
|
#define CACHED_CARD_PER_DECK_MAX 300
|
||||||
|
|
||||||
PictureToLoad::PictureToLoad(CardInfoPtr _card) : card(std::move(_card))
|
PictureToLoad::PictureToLoad(CardInfoPtr _card)
|
||||||
|
: card(std::move(_card)), urlTemplates(SettingsCache::instance().downloads().getAllURLs())
|
||||||
{
|
{
|
||||||
urlTemplates = settingsCache->downloads().getAllURLs();
|
|
||||||
|
|
||||||
if (card) {
|
if (card) {
|
||||||
for (const auto &set : card->getSets()) {
|
for (const auto &set : card->getSets()) {
|
||||||
sortedSets << set.getPtr();
|
sortedSets << set.getPtr();
|
||||||
|
@ -105,15 +104,14 @@ QString PictureToLoad::getSetName() const
|
||||||
// Card back returned by gatherer when card is not found
|
// Card back returned by gatherer when card is not found
|
||||||
QStringList PictureLoaderWorker::md5Blacklist = QStringList() << "db0c48db407a907c16ade38de048a441";
|
QStringList PictureLoaderWorker::md5Blacklist = QStringList() << "db0c48db407a907c16ade38de048a441";
|
||||||
|
|
||||||
PictureLoaderWorker::PictureLoaderWorker() : QObject(nullptr), downloadRunning(false), loadQueueRunning(false)
|
PictureLoaderWorker::PictureLoaderWorker()
|
||||||
|
: QObject(nullptr), picsPath(SettingsCache::instance().getPicsPath()),
|
||||||
|
customPicsPath(SettingsCache::instance().getCustomPicsPath()),
|
||||||
|
picDownload(SettingsCache::instance().getPicDownload()), downloadRunning(false), loadQueueRunning(false)
|
||||||
{
|
{
|
||||||
picsPath = settingsCache->getPicsPath();
|
|
||||||
customPicsPath = settingsCache->getCustomPicsPath();
|
|
||||||
picDownload = settingsCache->getPicDownload();
|
|
||||||
|
|
||||||
connect(this, SIGNAL(startLoadQueue()), this, SLOT(processLoadQueue()), Qt::QueuedConnection);
|
connect(this, SIGNAL(startLoadQueue()), this, SLOT(processLoadQueue()), Qt::QueuedConnection);
|
||||||
connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged()));
|
||||||
connect(settingsCache, SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||||
|
|
||||||
networkManager = new QNetworkAccessManager(this);
|
networkManager = new QNetworkAccessManager(this);
|
||||||
connect(networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(picDownloadFinished(QNetworkReply *)));
|
connect(networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(picDownloadFinished(QNetworkReply *)));
|
||||||
|
@ -475,21 +473,21 @@ void PictureLoaderWorker::enqueueImageLoad(CardInfoPtr card)
|
||||||
void PictureLoaderWorker::picDownloadChanged()
|
void PictureLoaderWorker::picDownloadChanged()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
picDownload = settingsCache->getPicDownload();
|
picDownload = SettingsCache::instance().getPicDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureLoaderWorker::picsPathChanged()
|
void PictureLoaderWorker::picsPathChanged()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
picsPath = settingsCache->getPicsPath();
|
picsPath = SettingsCache::instance().getPicsPath();
|
||||||
customPicsPath = settingsCache->getCustomPicsPath();
|
customPicsPath = SettingsCache::instance().getCustomPicsPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureLoader::PictureLoader() : QObject(nullptr)
|
PictureLoader::PictureLoader() : QObject(nullptr)
|
||||||
{
|
{
|
||||||
worker = new PictureLoaderWorker;
|
worker = new PictureLoaderWorker;
|
||||||
connect(settingsCache, SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(picsPathChanged()), this, SLOT(picsPathChanged()));
|
||||||
connect(settingsCache, SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||||
|
|
||||||
connect(worker, SIGNAL(imageLoaded(CardInfoPtr, const QImage &)), this,
|
connect(worker, SIGNAL(imageLoaded(CardInfoPtr, const QImage &)), this,
|
||||||
SLOT(imageLoaded(CardInfoPtr, const QImage &)));
|
SLOT(imageLoaded(CardInfoPtr, const QImage &)));
|
||||||
|
@ -589,4 +587,4 @@ void PictureLoader::picDownloadChanged()
|
||||||
void PictureLoader::picsPathChanged()
|
void PictureLoader::picsPathChanged()
|
||||||
{
|
{
|
||||||
QPixmapCache::clear();
|
QPixmapCache::clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
userInfo = new ServerInfo_User;
|
userInfo = new ServerInfo_User;
|
||||||
userInfo->CopyFrom(info);
|
userInfo->CopyFrom(info);
|
||||||
|
|
||||||
connect(settingsCache, SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones()));
|
connect(&SettingsCache::instance(), SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones()));
|
||||||
connect(settingsCache, SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones()));
|
connect(&SettingsCache::instance(), SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones()));
|
||||||
|
|
||||||
playerArea = new PlayerArea(this);
|
playerArea = new PlayerArea(this);
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
|
|
||||||
rearrangeZones();
|
rearrangeZones();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ void Player::playerListActionTriggered()
|
||||||
void Player::rearrangeZones()
|
void Player::rearrangeZones()
|
||||||
{
|
{
|
||||||
QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0);
|
QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0);
|
||||||
if (settingsCache->getHorizontalHand()) {
|
if (SettingsCache::instance().getHorizontalHand()) {
|
||||||
if (mirrored) {
|
if (mirrored) {
|
||||||
if (hand->contentsKnown()) {
|
if (hand->contentsKnown()) {
|
||||||
handVisible = true;
|
handVisible = true;
|
||||||
|
@ -638,7 +638,7 @@ void Player::updateBoundingRect()
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
|
qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
|
||||||
if (settingsCache->getHorizontalHand()) {
|
if (SettingsCache::instance().getHorizontalHand()) {
|
||||||
qreal handHeight = handVisible ? hand->boundingRect().height() : 0;
|
qreal handHeight = handVisible ? hand->boundingRect().height() : 0;
|
||||||
bRect = QRectF(0, 0, width + table->boundingRect().width(), table->boundingRect().height() + handHeight);
|
bRect = QRectF(0, 0, width + table->boundingRect().width(), table->boundingRect().height() + handHeight);
|
||||||
} else {
|
} else {
|
||||||
|
@ -788,7 +788,7 @@ void Player::retranslateUi()
|
||||||
void Player::setShortcutsActive()
|
void Player::setShortcutsActive()
|
||||||
{
|
{
|
||||||
shortcutsActive = true;
|
shortcutsActive = true;
|
||||||
ShortcutsSettings &shortcuts = settingsCache->shortcuts();
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
|
|
||||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
||||||
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
|
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
|
||||||
|
@ -909,10 +909,10 @@ void Player::initSayMenu()
|
||||||
{
|
{
|
||||||
sayMenu->clear();
|
sayMenu->clear();
|
||||||
|
|
||||||
int count = settingsCache->messages().getCount();
|
int count = SettingsCache::instance().messages().getCount();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
auto *newAction = new QAction(settingsCache->messages().getMessageAt(i), this);
|
auto *newAction = new QAction(SettingsCache::instance().messages().getMessageAt(i), this);
|
||||||
if (i <= 10) {
|
if (i <= 10) {
|
||||||
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
|
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1019,7 @@ void Player::actDrawCard()
|
||||||
|
|
||||||
void Player::actMulligan()
|
void Player::actMulligan()
|
||||||
{
|
{
|
||||||
int startSize = settingsCache->getStartingHandSize();
|
int startSize = SettingsCache::instance().getStartingHandSize();
|
||||||
int handSize = zones.value("hand")->getCards().size();
|
int handSize = zones.value("hand")->getCards().size();
|
||||||
int deckSize = zones.value("deck")->getCards().size() + handSize;
|
int deckSize = zones.value("deck")->getCards().size() + handSize;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -1040,7 +1040,7 @@ void Player::actMulligan()
|
||||||
}
|
}
|
||||||
sendGameCommand(cmd);
|
sendGameCommand(cmd);
|
||||||
if (startSize != number) {
|
if (startSize != number) {
|
||||||
settingsCache->setStartingHandSize(number);
|
SettingsCache::instance().setStartingHandSize(number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,7 +1439,7 @@ void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, b
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||||
if (settingsCache->getAnnotateTokens()) {
|
if (SettingsCache::instance().getAnnotateTokens()) {
|
||||||
cmd.set_annotation(cardInfo->getText().toStdString());
|
cmd.set_annotation(cardInfo->getText().toStdString());
|
||||||
} else {
|
} else {
|
||||||
cmd.set_annotation("");
|
cmd.set_annotation("");
|
||||||
|
@ -2140,7 +2140,7 @@ void Player::playCard(CardItem *card, bool faceDown, bool tapped)
|
||||||
}
|
}
|
||||||
|
|
||||||
int tableRow = info->getTableRow();
|
int tableRow = info->getTableRow();
|
||||||
bool playToStack = settingsCache->getPlayToStack();
|
bool playToStack = SettingsCache::instance().getPlayToStack();
|
||||||
QString currentZone = card->getZone()->getName();
|
QString currentZone = card->getZone()->getName();
|
||||||
if (currentZone == "stack" && tableRow == 3) {
|
if (currentZone == "stack" && tableRow == 3) {
|
||||||
cmd.set_target_zone("grave");
|
cmd.set_target_zone("grave");
|
||||||
|
@ -3209,7 +3209,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu)
|
||||||
if (createRelatedCards) {
|
if (createRelatedCards) {
|
||||||
if (shortcutsActive) {
|
if (shortcutsActive) {
|
||||||
createRelatedCards->setShortcut(
|
createRelatedCards->setShortcut(
|
||||||
settingsCache->shortcuts().getSingleShortcut("Player/aCreateRelatedTokens"));
|
SettingsCache::instance().shortcuts().getSingleShortcut("Player/aCreateRelatedTokens"));
|
||||||
}
|
}
|
||||||
connect(createRelatedCards, SIGNAL(triggered()), this, SLOT(actCreateAllRelatedCards()));
|
connect(createRelatedCards, SIGNAL(triggered()), this, SLOT(actCreateAllRelatedCards()));
|
||||||
cardMenu->addAction(createRelatedCards);
|
cardMenu->addAction(createRelatedCards);
|
||||||
|
@ -3239,7 +3239,7 @@ QString Player::getName() const
|
||||||
qreal Player::getMinimumWidth() const
|
qreal Player::getMinimumWidth() const
|
||||||
{
|
{
|
||||||
qreal result = table->getMinimumWidth() + CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
|
qreal result = table->getMinimumWidth() + CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
|
||||||
if (!settingsCache->getHorizontalHand()) {
|
if (!SettingsCache::instance().getHorizontalHand()) {
|
||||||
result += hand->boundingRect().width();
|
result += hand->boundingRect().width();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -3275,7 +3275,7 @@ void Player::processSceneSizeChange(int newPlayerWidth)
|
||||||
{
|
{
|
||||||
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
||||||
qreal tableWidth = newPlayerWidth - CARD_HEIGHT - 15 - counterAreaWidth - stack->boundingRect().width();
|
qreal tableWidth = newPlayerWidth - CARD_HEIGHT - 15 - counterAreaWidth - stack->boundingRect().width();
|
||||||
if (!settingsCache->getHorizontalHand()) {
|
if (!SettingsCache::instance().getHorizontalHand()) {
|
||||||
tableWidth -= hand->boundingRect().width();
|
tableWidth -= hand->boundingRect().width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3292,7 +3292,7 @@ void Player::setLastToken(CardInfoPtr cardInfo)
|
||||||
lastTokenName = cardInfo->getName();
|
lastTokenName = cardInfo->getName();
|
||||||
lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower();
|
lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower();
|
||||||
lastTokenPT = cardInfo->getPowTough();
|
lastTokenPT = cardInfo->getPowTough();
|
||||||
lastTokenAnnotation = settingsCache->getAnnotateTokens() ? cardInfo->getText() : "";
|
lastTokenAnnotation = SettingsCache::instance().getAnnotateTokens() ? cardInfo->getText() : "";
|
||||||
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
||||||
lastTokenDestroy = true;
|
lastTokenDestroy = true;
|
||||||
aCreateAnotherToken->setText(tr("C&reate another %1 token").arg(lastTokenName));
|
aCreateAnotherToken->setText(tr("C&reate another %1 token").arg(lastTokenName));
|
||||||
|
|
|
@ -30,7 +30,7 @@ RemoteClient::RemoteClient(QObject *parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
clearNewClientFeatures();
|
clearNewClientFeatures();
|
||||||
int keepalive = settingsCache->getKeepAlive();
|
int keepalive = SettingsCache::instance().getKeepAlive();
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
timer->setInterval(keepalive * 1000);
|
timer->setInterval(keepalive * 1000);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(ping()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(ping()));
|
||||||
|
@ -227,8 +227,8 @@ void RemoteClient::loginResponse(const Response &response)
|
||||||
emit ignoreListReceived(ignoreList);
|
emit ignoreListReceived(ignoreList);
|
||||||
|
|
||||||
if (newMissingFeatureFound(possibleMissingFeatures) && resp.missing_features_size() > 0 &&
|
if (newMissingFeatureFound(possibleMissingFeatures) && resp.missing_features_size() > 0 &&
|
||||||
settingsCache->getNotifyAboutUpdates()) {
|
SettingsCache::instance().getNotifyAboutUpdates()) {
|
||||||
settingsCache->setKnownMissingFeatures(possibleMissingFeatures);
|
SettingsCache::instance().setKnownMissingFeatures(possibleMissingFeatures);
|
||||||
emit notifyUserAboutUpdate();
|
emit notifyUserAboutUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ void RemoteClient::ping()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int keepalive = settingsCache->getKeepAlive();
|
int keepalive = SettingsCache::instance().getKeepAlive();
|
||||||
int maxTime = timeRunning - lastDataReceived;
|
int maxTime = timeRunning - lastDataReceived;
|
||||||
emit maxPingTime(maxTime, maxTimeout);
|
emit maxPingTime(maxTime, maxTimeout);
|
||||||
if (maxTime >= (keepalive * maxTimeout)) {
|
if (maxTime >= (keepalive * maxTimeout)) {
|
||||||
|
@ -498,13 +498,13 @@ void RemoteClient::activateToServer(const QString &_token)
|
||||||
|
|
||||||
void RemoteClient::disconnectFromServer()
|
void RemoteClient::disconnectFromServer()
|
||||||
{
|
{
|
||||||
settingsCache->servers().setAutoConnect(false);
|
SettingsCache::instance().servers().setAutoConnect(false);
|
||||||
emit sigDisconnectFromServer();
|
emit sigDisconnectFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteClient::getSrvClientID(const QString _hostname)
|
QString RemoteClient::getSrvClientID(const QString _hostname)
|
||||||
{
|
{
|
||||||
QString srvClientID = settingsCache->getClientID();
|
QString srvClientID = SettingsCache::instance().getClientID();
|
||||||
QHostInfo hostInfo = QHostInfo::fromName(_hostname);
|
QHostInfo hostInfo = QHostInfo::fromName(_hostname);
|
||||||
if (!hostInfo.error()) {
|
if (!hostInfo.error()) {
|
||||||
QHostAddress hostAddress = hostInfo.addresses().first();
|
QHostAddress hostAddress = hostInfo.addresses().first();
|
||||||
|
@ -524,7 +524,7 @@ bool RemoteClient::newMissingFeatureFound(QString _serversMissingFeatures)
|
||||||
QStringList serversMissingFeaturesList = _serversMissingFeatures.split(",");
|
QStringList serversMissingFeaturesList = _serversMissingFeatures.split(",");
|
||||||
foreach (const QString &feature, serversMissingFeaturesList) {
|
foreach (const QString &feature, serversMissingFeaturesList) {
|
||||||
if (!feature.isEmpty()) {
|
if (!feature.isEmpty()) {
|
||||||
if (!settingsCache->getKnownMissingFeatures().contains(feature))
|
if (!SettingsCache::instance().getKnownMissingFeatures().contains(feature))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -534,14 +534,14 @@ bool RemoteClient::newMissingFeatureFound(QString _serversMissingFeatures)
|
||||||
void RemoteClient::clearNewClientFeatures()
|
void RemoteClient::clearNewClientFeatures()
|
||||||
{
|
{
|
||||||
QString newKnownMissingFeatures;
|
QString newKnownMissingFeatures;
|
||||||
QStringList existingKnownMissingFeatures = settingsCache->getKnownMissingFeatures().split(",");
|
QStringList existingKnownMissingFeatures = SettingsCache::instance().getKnownMissingFeatures().split(",");
|
||||||
foreach (const QString &existingKnownFeature, existingKnownMissingFeatures) {
|
foreach (const QString &existingKnownFeature, existingKnownMissingFeatures) {
|
||||||
if (!existingKnownFeature.isEmpty()) {
|
if (!existingKnownFeature.isEmpty()) {
|
||||||
if (!clientFeatures.contains(existingKnownFeature))
|
if (!clientFeatures.contains(existingKnownFeature))
|
||||||
newKnownMissingFeatures.append("," + existingKnownFeature);
|
newKnownMissingFeatures.append("," + existingKnownFeature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsCache->setKnownMissingFeatures(newKnownMissingFeatures);
|
SettingsCache::instance().setKnownMissingFeatures(newKnownMissingFeatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteClient::requestForgotPasswordToServer(const QString &hostname, unsigned int port, const QString &_userName)
|
void RemoteClient::requestForgotPasswordToServer(const QString &hostname, unsigned int port, const QString &_userName)
|
||||||
|
|
|
@ -45,7 +45,7 @@ void SequenceEdit::setShortcutName(const QString &_shortcutName)
|
||||||
clearButton->setEnabled(true);
|
clearButton->setEnabled(true);
|
||||||
defaultButton->setEnabled(true);
|
defaultButton->setEnabled(true);
|
||||||
lineEdit->setEnabled(true);
|
lineEdit->setEnabled(true);
|
||||||
lineEdit->setText(settingsCache->shortcuts().getShortcutString(shortcutName));
|
lineEdit->setText(SettingsCache::instance().shortcuts().getShortcutString(shortcutName));
|
||||||
lineEdit->setPlaceholderText(tr("Hit the key/combination of keys you want to set for this action"));
|
lineEdit->setPlaceholderText(tr("Hit the key/combination of keys you want to set for this action"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,13 +72,13 @@ void SequenceEdit::removeLastShortcut()
|
||||||
|
|
||||||
void SequenceEdit::restoreDefault()
|
void SequenceEdit::restoreDefault()
|
||||||
{
|
{
|
||||||
lineEdit->setText(settingsCache->shortcuts().getDefaultShortcutString(shortcutName));
|
lineEdit->setText(SettingsCache::instance().shortcuts().getDefaultShortcutString(shortcutName));
|
||||||
updateSettings();
|
updateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceEdit::refreshShortcut()
|
void SequenceEdit::refreshShortcut()
|
||||||
{
|
{
|
||||||
lineEdit->setText(settingsCache->shortcuts().getShortcutString(shortcutName));
|
lineEdit->setText(SettingsCache::instance().shortcuts().getShortcutString(shortcutName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceEdit::clear()
|
void SequenceEdit::clear()
|
||||||
|
@ -159,8 +159,8 @@ void SequenceEdit::finishShortcut()
|
||||||
QKeySequence sequence(keys);
|
QKeySequence sequence(keys);
|
||||||
if (!sequence.isEmpty() && valid) {
|
if (!sequence.isEmpty() && valid) {
|
||||||
QString sequenceString = sequence.toString();
|
QString sequenceString = sequence.toString();
|
||||||
if (settingsCache->shortcuts().isKeyAllowed(shortcutName, sequenceString)) {
|
if (SettingsCache::instance().shortcuts().isKeyAllowed(shortcutName, sequenceString)) {
|
||||||
if (settingsCache->shortcuts().isValid(shortcutName, sequenceString)) {
|
if (SettingsCache::instance().shortcuts().isValid(shortcutName, sequenceString)) {
|
||||||
if (!lineEdit->text().isEmpty()) {
|
if (!lineEdit->text().isEmpty()) {
|
||||||
if (lineEdit->text().contains(sequenceString)) {
|
if (lineEdit->text().contains(sequenceString)) {
|
||||||
return;
|
return;
|
||||||
|
@ -184,7 +184,7 @@ void SequenceEdit::finishShortcut()
|
||||||
|
|
||||||
void SequenceEdit::updateSettings()
|
void SequenceEdit::updateSettings()
|
||||||
{
|
{
|
||||||
settingsCache->shortcuts().setShortcuts(shortcutName, lineEdit->text());
|
SettingsCache::instance().shortcuts().setShortcuts(shortcutName, lineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceEdit::retranslateUi()
|
void SequenceEdit::retranslateUi()
|
||||||
|
|
|
@ -6,10 +6,13 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QGlobalStatic>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC(SettingsCache, settingsCache);
|
||||||
|
|
||||||
QString SettingsCache::getDataPath()
|
QString SettingsCache::getDataPath()
|
||||||
{
|
{
|
||||||
if (isPortableBuild)
|
if (isPortableBuild)
|
||||||
|
@ -967,3 +970,8 @@ void SettingsCache::setMaxFontSize(int _max)
|
||||||
maxFontSize = _max;
|
maxFontSize = _max;
|
||||||
settings->setValue("game/maxfontsize", maxFontSize);
|
settings->setValue("game/maxfontsize", maxFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsCache &SettingsCache::instance()
|
||||||
|
{
|
||||||
|
return *settingsCache;
|
||||||
|
}
|
||||||
|
|
|
@ -462,6 +462,8 @@ public:
|
||||||
{
|
{
|
||||||
return mbDownloadSpoilers;
|
return mbDownloadSpoilers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SettingsCache &instance();
|
||||||
public slots:
|
public slots:
|
||||||
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
||||||
|
|
||||||
|
@ -529,6 +531,4 @@ public slots:
|
||||||
void setMaxFontSize(int _max);
|
void setMaxFontSize(int _max);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SettingsCache *settingsCache;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,8 +18,8 @@ SoundEngine::SoundEngine(QObject *parent) : QObject(parent), player(0)
|
||||||
inputBuffer = new QBuffer(this);
|
inputBuffer = new QBuffer(this);
|
||||||
|
|
||||||
ensureThemeDirectoryExists();
|
ensureThemeDirectoryExists();
|
||||||
connect(settingsCache, SIGNAL(soundThemeChanged()), this, SLOT(themeChangedSlot()));
|
connect(&SettingsCache::instance(), SIGNAL(soundThemeChanged()), this, SLOT(themeChangedSlot()));
|
||||||
connect(settingsCache, SIGNAL(soundEnabledChanged()), this, SLOT(soundEnabledChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(soundEnabledChanged()), this, SLOT(soundEnabledChanged()));
|
||||||
|
|
||||||
soundEnabledChanged();
|
soundEnabledChanged();
|
||||||
themeChangedSlot();
|
themeChangedSlot();
|
||||||
|
@ -37,7 +37,7 @@ SoundEngine::~SoundEngine()
|
||||||
|
|
||||||
void SoundEngine::soundEnabledChanged()
|
void SoundEngine::soundEnabledChanged()
|
||||||
{
|
{
|
||||||
if (settingsCache->getSoundEnabled()) {
|
if (SettingsCache::instance().getSoundEnabled()) {
|
||||||
qDebug("SoundEngine: enabling sound");
|
qDebug("SoundEngine: enabling sound");
|
||||||
if (!player) {
|
if (!player) {
|
||||||
QAudioFormat format;
|
QAudioFormat format;
|
||||||
|
@ -77,7 +77,7 @@ void SoundEngine::playSound(QString fileName)
|
||||||
inputBuffer->setData(audioData[fileName]);
|
inputBuffer->setData(audioData[fileName]);
|
||||||
inputBuffer->open(QIODevice::ReadOnly);
|
inputBuffer->open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
player->setVolume(settingsCache->getMasterVolume() / 100.0);
|
player->setVolume(SettingsCache::instance().getMasterVolume() / 100.0);
|
||||||
player->stop();
|
player->stop();
|
||||||
player->start(inputBuffer);
|
player->start(inputBuffer);
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,10 @@ void SoundEngine::testSound()
|
||||||
|
|
||||||
void SoundEngine::ensureThemeDirectoryExists()
|
void SoundEngine::ensureThemeDirectoryExists()
|
||||||
{
|
{
|
||||||
if (settingsCache->getSoundThemeName().isEmpty() ||
|
if (SettingsCache::instance().getSoundThemeName().isEmpty() ||
|
||||||
!getAvailableThemes().contains(settingsCache->getSoundThemeName())) {
|
!getAvailableThemes().contains(SettingsCache::instance().getSoundThemeName())) {
|
||||||
qDebug() << "Sounds theme name not set, setting default value";
|
qDebug() << "Sounds theme name not set, setting default value";
|
||||||
settingsCache->setSoundThemeName(DEFAULT_THEME_NAME);
|
SettingsCache::instance().setSoundThemeName(DEFAULT_THEME_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
||||||
|
|
||||||
// load themes from user profile dir
|
// load themes from user profile dir
|
||||||
|
|
||||||
dir.setPath(settingsCache->getDataPath() + "/sounds");
|
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
||||||
|
|
||||||
foreach (QString themeName, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
foreach (QString themeName, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||||
if (!availableThemes.contains(themeName))
|
if (!availableThemes.contains(themeName))
|
||||||
|
@ -131,7 +131,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
||||||
|
|
||||||
void SoundEngine::themeChangedSlot()
|
void SoundEngine::themeChangedSlot()
|
||||||
{
|
{
|
||||||
QString themeName = settingsCache->getSoundThemeName();
|
QString themeName = SettingsCache::instance().getSoundThemeName();
|
||||||
qDebug() << "Sound theme changed:" << themeName;
|
qDebug() << "Sound theme changed:" << themeName;
|
||||||
|
|
||||||
QDir dir = getAvailableThemes().value(themeName);
|
QDir dir = getAvailableThemes().value(themeName);
|
||||||
|
@ -188,4 +188,4 @@ void SoundEngine::themeChangedSlot()
|
||||||
}
|
}
|
||||||
|
|
||||||
soundEnabledChanged();
|
soundEnabledChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
||||||
{
|
{
|
||||||
isSpoilerDownloadEnabled = settingsCache->getDownloadSpoilersStatus();
|
isSpoilerDownloadEnabled = SettingsCache::instance().getDownloadSpoilersStatus();
|
||||||
if (isSpoilerDownloadEnabled) {
|
if (isSpoilerDownloadEnabled) {
|
||||||
// Start the process of checking if we're in spoiler season
|
// Start the process of checking if we're in spoiler season
|
||||||
// File exists means we're in spoiler season
|
// File exists means we're in spoiler season
|
||||||
|
@ -73,7 +73,7 @@ void SpoilerBackgroundUpdater::actDownloadFinishedSpoilersFile()
|
||||||
|
|
||||||
bool SpoilerBackgroundUpdater::deleteSpoilerFile()
|
bool SpoilerBackgroundUpdater::deleteSpoilerFile()
|
||||||
{
|
{
|
||||||
QString fileName = settingsCache->getSpoilerCardDatabasePath();
|
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QDir fileDir(fi.path());
|
QDir fileDir(fi.path());
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
@ -124,7 +124,7 @@ void SpoilerBackgroundUpdater::actCheckIfSpoilerSeasonEnabled()
|
||||||
|
|
||||||
bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
|
bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
|
||||||
{
|
{
|
||||||
QString fileName = settingsCache->getSpoilerCardDatabasePath();
|
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QDir fileDir(fi.path());
|
QDir fileDir(fi.path());
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ void TabDeckEditor::createCentralFrame()
|
||||||
SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
|
SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
|
||||||
connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard()));
|
connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard()));
|
||||||
|
|
||||||
QByteArray dbHeaderState = settingsCache->layouts().getDeckEditorDbHeaderState();
|
QByteArray dbHeaderState = SettingsCache::instance().layouts().getDeckEditorDbHeaderState();
|
||||||
if (dbHeaderState.isNull()) {
|
if (dbHeaderState.isNull()) {
|
||||||
// first run
|
// first run
|
||||||
databaseView->setColumnWidth(0, 200);
|
databaseView->setColumnWidth(0, 200);
|
||||||
|
@ -532,35 +532,35 @@ void TabDeckEditor::freeDocksSize()
|
||||||
|
|
||||||
void TabDeckEditor::refreshShortcuts()
|
void TabDeckEditor::refreshShortcuts()
|
||||||
{
|
{
|
||||||
aNewDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aNewDeck"));
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
aLoadDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aLoadDeck"));
|
aNewDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aNewDeck"));
|
||||||
aSaveDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeck"));
|
aLoadDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeck"));
|
||||||
aExportDeckDecklist->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aExportDeckDecklist"));
|
aSaveDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeck"));
|
||||||
aSaveDeckAs->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeckAs"));
|
aExportDeckDecklist->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aExportDeckDecklist"));
|
||||||
aLoadDeckFromClipboard->setShortcuts(
|
aSaveDeckAs->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckAs"));
|
||||||
settingsCache->shortcuts().getShortcut("TabDeckEditor/aLoadDeckFromClipboard"));
|
aLoadDeckFromClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeckFromClipboard"));
|
||||||
aPrintDeck->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aPrintDeck"));
|
aPrintDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aPrintDeck"));
|
||||||
aAnalyzeDeckDeckstats->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aAnalyzeDeck"));
|
aAnalyzeDeckDeckstats->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aAnalyzeDeck"));
|
||||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClose"));
|
aClose->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClose"));
|
||||||
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aResetLayout"));
|
aResetLayout->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aResetLayout"));
|
||||||
aClearFilterAll->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterAll"));
|
aClearFilterAll->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClearFilterAll"));
|
||||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterOne"));
|
aClearFilterOne->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClearFilterOne"));
|
||||||
|
|
||||||
aSaveDeckToClipboard->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeckToClipboard"));
|
aSaveDeckToClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboard"));
|
||||||
aSaveDeckToClipboardRaw->setShortcuts(
|
aSaveDeckToClipboardRaw->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboardRaw"));
|
||||||
settingsCache->shortcuts().getShortcut("TabDeckEditor/aSaveDeckToClipboardRaw"));
|
|
||||||
|
|
||||||
aClearFilterOne->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClearFilterOne"));
|
aClearFilterOne->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClearFilterOne"));
|
||||||
aClose->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aClose"));
|
aClose->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClose"));
|
||||||
aRemoveCard->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aRemoveCard"));
|
aRemoveCard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aRemoveCard"));
|
||||||
aIncrement->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aIncrement"));
|
aIncrement->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aIncrement"));
|
||||||
aDecrement->setShortcuts(settingsCache->shortcuts().getShortcut("TabDeckEditor/aDecrement"));
|
aDecrement->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aDecrement"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::loadLayout()
|
void TabDeckEditor::loadLayout()
|
||||||
{
|
{
|
||||||
restoreState(settingsCache->layouts().getDeckEditorLayoutState());
|
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||||
restoreGeometry(settingsCache->layouts().getDeckEditorGeometry());
|
restoreState(layouts.getDeckEditorLayoutState());
|
||||||
|
restoreGeometry(layouts.getDeckEditorGeometry());
|
||||||
|
|
||||||
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
||||||
aFilterDockVisible->setChecked(filterDock->isVisible());
|
aFilterDockVisible->setChecked(filterDock->isVisible());
|
||||||
|
@ -574,14 +574,14 @@ void TabDeckEditor::loadLayout()
|
||||||
aFilterDockFloating->setChecked(filterDock->isFloating());
|
aFilterDockFloating->setChecked(filterDock->isFloating());
|
||||||
aDeckDockFloating->setChecked(deckDock->isFloating());
|
aDeckDockFloating->setChecked(deckDock->isFloating());
|
||||||
|
|
||||||
cardInfoDock->setMinimumSize(settingsCache->layouts().getDeckEditorCardSize());
|
cardInfoDock->setMinimumSize(layouts.getDeckEditorCardSize());
|
||||||
cardInfoDock->setMaximumSize(settingsCache->layouts().getDeckEditorCardSize());
|
cardInfoDock->setMaximumSize(layouts.getDeckEditorCardSize());
|
||||||
|
|
||||||
filterDock->setMinimumSize(settingsCache->layouts().getDeckEditorFilterSize());
|
filterDock->setMinimumSize(layouts.getDeckEditorFilterSize());
|
||||||
filterDock->setMaximumSize(settingsCache->layouts().getDeckEditorFilterSize());
|
filterDock->setMaximumSize(layouts.getDeckEditorFilterSize());
|
||||||
|
|
||||||
deckDock->setMinimumSize(settingsCache->layouts().getDeckEditorDeckSize());
|
deckDock->setMinimumSize(layouts.getDeckEditorDeckSize());
|
||||||
deckDock->setMaximumSize(settingsCache->layouts().getDeckEditorDeckSize());
|
deckDock->setMaximumSize(layouts.getDeckEditorDeckSize());
|
||||||
|
|
||||||
QTimer::singleShot(100, this, SLOT(freeDocksSize()));
|
QTimer::singleShot(100, this, SLOT(freeDocksSize()));
|
||||||
}
|
}
|
||||||
|
@ -604,7 +604,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||||
this->installEventFilter(this);
|
this->installEventFilter(this);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||||
|
@ -766,7 +766,7 @@ void TabDeckEditor::actLoadDeck()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QFileDialog dialog(this, tr("Load deck"));
|
QFileDialog dialog(this, tr("Load deck"));
|
||||||
dialog.setDirectory(settingsCache->getDeckPath());
|
dialog.setDirectory(SettingsCache::instance().getDeckPath());
|
||||||
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
||||||
if (!dialog.exec())
|
if (!dialog.exec())
|
||||||
return;
|
return;
|
||||||
|
@ -820,7 +820,7 @@ bool TabDeckEditor::actSaveDeck()
|
||||||
bool TabDeckEditor::actSaveDeckAs()
|
bool TabDeckEditor::actSaveDeckAs()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this, tr("Save deck"));
|
QFileDialog dialog(this, tr("Save deck"));
|
||||||
dialog.setDirectory(settingsCache->getDeckPath());
|
dialog.setDirectory(SettingsCache::instance().getDeckPath());
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
dialog.setDefaultSuffix("cod");
|
dialog.setDefaultSuffix("cod");
|
||||||
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
||||||
|
@ -1144,11 +1144,12 @@ bool TabDeckEditor::eventFilter(QObject *o, QEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o == this && e->type() == QEvent::Hide) {
|
if (o == this && e->type() == QEvent::Hide) {
|
||||||
settingsCache->layouts().setDeckEditorLayoutState(saveState());
|
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||||
settingsCache->layouts().setDeckEditorGeometry(saveGeometry());
|
layouts.setDeckEditorLayoutState(saveState());
|
||||||
settingsCache->layouts().setDeckEditorCardSize(cardInfoDock->size());
|
layouts.setDeckEditorGeometry(saveGeometry());
|
||||||
settingsCache->layouts().setDeckEditorFilterSize(filterDock->size());
|
layouts.setDeckEditorCardSize(cardInfoDock->size());
|
||||||
settingsCache->layouts().setDeckEditorDeckSize(deckDock->size());
|
layouts.setDeckEditorFilterSize(filterDock->size());
|
||||||
|
layouts.setDeckEditorDeckSize(deckDock->size());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1215,7 +1216,7 @@ void TabDeckEditor::dockTopLevelChanged(bool topLevel)
|
||||||
|
|
||||||
void TabDeckEditor::saveDbHeaderState()
|
void TabDeckEditor::saveDbHeaderState()
|
||||||
{
|
{
|
||||||
settingsCache->layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
SettingsCache::instance().layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::setSaveStatus(bool newStatus)
|
void TabDeckEditor::setSaveStatus(bool newStatus)
|
||||||
|
|
|
@ -31,7 +31,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
||||||
: Tab(_tabSupervisor), client(_client)
|
: Tab(_tabSupervisor), client(_client)
|
||||||
{
|
{
|
||||||
localDirModel = new QFileSystemModel(this);
|
localDirModel = new QFileSystemModel(this);
|
||||||
localDirModel->setRootPath(settingsCache->getDeckPath());
|
localDirModel->setRootPath(SettingsCache::instance().getDeckPath());
|
||||||
localDirModel->sort(0, Qt::AscendingOrder);
|
localDirModel->sort(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
localDirView = new QTreeView;
|
localDirView = new QTreeView;
|
||||||
|
|
|
@ -135,7 +135,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
setLayout(deckViewLayout);
|
setLayout(deckViewLayout);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,97 +166,98 @@ void DeckViewContainer::updateSideboardLockButtonText()
|
||||||
|
|
||||||
void DeckViewContainer::refreshShortcuts()
|
void DeckViewContainer::refreshShortcuts()
|
||||||
{
|
{
|
||||||
loadLocalButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/loadLocalButton"));
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
loadRemoteButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/loadRemoteButton"));
|
loadLocalButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadLocalButton"));
|
||||||
readyStartButton->setShortcut(settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/readyStartButton"));
|
loadRemoteButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadRemoteButton"));
|
||||||
sideboardLockButton->setShortcut(
|
readyStartButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/readyStartButton"));
|
||||||
settingsCache->shortcuts().getSingleShortcut("DeckViewContainer/sideboardLockButton"));
|
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::refreshShortcuts()
|
void TabGame::refreshShortcuts()
|
||||||
{
|
{
|
||||||
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
for (int i = 0; i < phaseActions.size(); ++i) {
|
for (int i = 0; i < phaseActions.size(); ++i) {
|
||||||
QAction *temp = phaseActions.at(i);
|
QAction *temp = phaseActions.at(i);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase0"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase0"));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase1"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase1"));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase2"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase2"));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase3"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase3"));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase4"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase4"));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase5"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase5"));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase6"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase6"));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase7"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase7"));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase8"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase8"));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase9"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase9"));
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
temp->setShortcuts(settingsCache->shortcuts().getShortcut("Player/phase10"));
|
temp->setShortcuts(shortcuts.getShortcut("Player/phase10"));
|
||||||
break;
|
break;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNextPhase) {
|
if (aNextPhase) {
|
||||||
aNextPhase->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextPhase"));
|
aNextPhase->setShortcuts(shortcuts.getShortcut("Player/aNextPhase"));
|
||||||
}
|
}
|
||||||
if (aNextPhaseAction) {
|
if (aNextPhaseAction) {
|
||||||
aNextPhaseAction->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextPhaseAction"));
|
aNextPhaseAction->setShortcuts(shortcuts.getShortcut("Player/aNextPhaseAction"));
|
||||||
}
|
}
|
||||||
if (aNextTurn) {
|
if (aNextTurn) {
|
||||||
aNextTurn->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextTurn"));
|
aNextTurn->setShortcuts(shortcuts.getShortcut("Player/aNextTurn"));
|
||||||
}
|
}
|
||||||
if (aReverseTurn) {
|
if (aReverseTurn) {
|
||||||
aReverseTurn->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aReverseTurn"));
|
aReverseTurn->setShortcuts(shortcuts.getShortcut("Player/aReverseTurn"));
|
||||||
}
|
}
|
||||||
if (aRemoveLocalArrows) {
|
if (aRemoveLocalArrows) {
|
||||||
aRemoveLocalArrows->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRemoveLocalArrows"));
|
aRemoveLocalArrows->setShortcuts(shortcuts.getShortcut("Player/aRemoveLocalArrows"));
|
||||||
}
|
}
|
||||||
if (aRotateViewCW) {
|
if (aRotateViewCW) {
|
||||||
aRotateViewCW->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRotateViewCW"));
|
aRotateViewCW->setShortcuts(shortcuts.getShortcut("Player/aRotateViewCW"));
|
||||||
}
|
}
|
||||||
if (aRotateViewCCW) {
|
if (aRotateViewCCW) {
|
||||||
aRotateViewCCW->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aRotateViewCCW"));
|
aRotateViewCCW->setShortcuts(shortcuts.getShortcut("Player/aRotateViewCCW"));
|
||||||
}
|
}
|
||||||
if (aConcede) {
|
if (aConcede) {
|
||||||
aConcede->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aConcede"));
|
aConcede->setShortcuts(shortcuts.getShortcut("Player/aConcede"));
|
||||||
}
|
}
|
||||||
if (aLeaveGame) {
|
if (aLeaveGame) {
|
||||||
aLeaveGame->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aLeaveGame"));
|
aLeaveGame->setShortcuts(shortcuts.getShortcut("Player/aLeaveGame"));
|
||||||
}
|
}
|
||||||
if (aCloseReplay) {
|
if (aCloseReplay) {
|
||||||
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseReplay"));
|
aCloseReplay->setShortcuts(shortcuts.getShortcut("Player/aCloseReplay"));
|
||||||
}
|
}
|
||||||
if (aResetLayout) {
|
if (aResetLayout) {
|
||||||
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aResetLayout"));
|
aResetLayout->setShortcuts(shortcuts.getShortcut("Player/aResetLayout"));
|
||||||
}
|
}
|
||||||
if (aFocusChat) {
|
if (aFocusChat) {
|
||||||
aFocusChat->setShortcuts(settingsCache->shortcuts().getShortcut("tab_game/aFocusChat"));
|
aFocusChat->setShortcuts(shortcuts.getShortcut("tab_game/aFocusChat"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::loadLocalDeck()
|
void DeckViewContainer::loadLocalDeck()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this, tr("Load deck"));
|
QFileDialog dialog(this, tr("Load deck"));
|
||||||
dialog.setDirectory(settingsCache->getDeckPath());
|
dialog.setDirectory(SettingsCache::instance().getDeckPath());
|
||||||
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
dialog.setNameFilters(DeckLoader::fileNameFilters);
|
||||||
if (!dialog.exec())
|
if (!dialog.exec())
|
||||||
return;
|
return;
|
||||||
|
@ -394,7 +395,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
||||||
createReplayMenuItems();
|
createReplayMenuItems();
|
||||||
createViewMenuItems();
|
createViewMenuItems();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
messageLog->logReplayStarted(gameInfo.game_id());
|
messageLog->logReplayStarted(gameInfo.game_id());
|
||||||
|
|
||||||
|
@ -433,7 +434,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
||||||
createMenuItems();
|
createMenuItems();
|
||||||
createViewMenuItems();
|
createViewMenuItems();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
// append game to rooms game list for others to see
|
// append game to rooms game list for others to see
|
||||||
|
@ -458,7 +459,7 @@ void TabGame::linkCardToChat(QString cardName)
|
||||||
|
|
||||||
void TabGame::emitUserEvent()
|
void TabGame::emitUserEvent()
|
||||||
{
|
{
|
||||||
bool globalEvent = !spectator || settingsCache->getSpectatorNotificationsEnabled();
|
bool globalEvent = !spectator || SettingsCache::instance().getSpectatorNotificationsEnabled();
|
||||||
emit userEvent(globalEvent);
|
emit userEvent(globalEvent);
|
||||||
updatePlayerListDockTitle();
|
updatePlayerListDockTitle();
|
||||||
}
|
}
|
||||||
|
@ -771,7 +772,8 @@ void TabGame::actRotateViewCCW()
|
||||||
|
|
||||||
void TabGame::actCompleterChanged()
|
void TabGame::actCompleterChanged()
|
||||||
{
|
{
|
||||||
settingsCache->getChatMentionCompleter() ? completer->setCompletionRole(2) : completer->setCompletionRole(1);
|
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||||
|
: completer->setCompletionRole(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
|
Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
|
||||||
|
@ -1525,28 +1527,29 @@ void TabGame::createViewMenuItems()
|
||||||
|
|
||||||
void TabGame::loadLayout()
|
void TabGame::loadLayout()
|
||||||
{
|
{
|
||||||
|
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||||
if (replayDock) {
|
if (replayDock) {
|
||||||
restoreGeometry(settingsCache->layouts().getReplayPlayAreaGeometry());
|
restoreGeometry(layouts.getReplayPlayAreaGeometry());
|
||||||
restoreState(settingsCache->layouts().getReplayPlayAreaLayoutState());
|
restoreState(layouts.getReplayPlayAreaLayoutState());
|
||||||
|
|
||||||
cardInfoDock->setMinimumSize(settingsCache->layouts().getReplayCardInfoSize());
|
cardInfoDock->setMinimumSize(layouts.getReplayCardInfoSize());
|
||||||
cardInfoDock->setMaximumSize(settingsCache->layouts().getReplayCardInfoSize());
|
cardInfoDock->setMaximumSize(layouts.getReplayCardInfoSize());
|
||||||
messageLayoutDock->setMinimumSize(settingsCache->layouts().getReplayMessageLayoutSize());
|
messageLayoutDock->setMinimumSize(layouts.getReplayMessageLayoutSize());
|
||||||
messageLayoutDock->setMaximumSize(settingsCache->layouts().getReplayMessageLayoutSize());
|
messageLayoutDock->setMaximumSize(layouts.getReplayMessageLayoutSize());
|
||||||
playerListDock->setMinimumSize(settingsCache->layouts().getReplayPlayerListSize());
|
playerListDock->setMinimumSize(layouts.getReplayPlayerListSize());
|
||||||
playerListDock->setMaximumSize(settingsCache->layouts().getReplayPlayerListSize());
|
playerListDock->setMaximumSize(layouts.getReplayPlayerListSize());
|
||||||
replayDock->setMinimumSize(settingsCache->layouts().getReplayReplaySize());
|
replayDock->setMinimumSize(layouts.getReplayReplaySize());
|
||||||
replayDock->setMaximumSize(settingsCache->layouts().getReplayReplaySize());
|
replayDock->setMaximumSize(layouts.getReplayReplaySize());
|
||||||
} else {
|
} else {
|
||||||
restoreGeometry(settingsCache->layouts().getGamePlayAreaGeometry());
|
restoreGeometry(layouts.getGamePlayAreaGeometry());
|
||||||
restoreState(settingsCache->layouts().getGamePlayAreaLayoutState());
|
restoreState(layouts.getGamePlayAreaLayoutState());
|
||||||
|
|
||||||
cardInfoDock->setMinimumSize(settingsCache->layouts().getGameCardInfoSize());
|
cardInfoDock->setMinimumSize(layouts.getGameCardInfoSize());
|
||||||
cardInfoDock->setMaximumSize(settingsCache->layouts().getGameCardInfoSize());
|
cardInfoDock->setMaximumSize(layouts.getGameCardInfoSize());
|
||||||
messageLayoutDock->setMinimumSize(settingsCache->layouts().getGameMessageLayoutSize());
|
messageLayoutDock->setMinimumSize(layouts.getGameMessageLayoutSize());
|
||||||
messageLayoutDock->setMaximumSize(settingsCache->layouts().getGameMessageLayoutSize());
|
messageLayoutDock->setMaximumSize(layouts.getGameMessageLayoutSize());
|
||||||
playerListDock->setMinimumSize(settingsCache->layouts().getGamePlayerListSize());
|
playerListDock->setMinimumSize(layouts.getGamePlayerListSize());
|
||||||
playerListDock->setMaximumSize(settingsCache->layouts().getGamePlayerListSize());
|
playerListDock->setMaximumSize(layouts.getGamePlayerListSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
||||||
|
@ -1772,7 +1775,7 @@ void TabGame::createMessageDock(bool bReplay)
|
||||||
if (!bReplay) {
|
if (!bReplay) {
|
||||||
connect(messageLog, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
connect(messageLog, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||||
connect(messageLog, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
connect(messageLog, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||||
connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
||||||
|
|
||||||
timeElapsedLabel = new QLabel;
|
timeElapsedLabel = new QLabel;
|
||||||
timeElapsedLabel->setAlignment(Qt::AlignCenter);
|
timeElapsedLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
@ -1846,19 +1849,20 @@ bool TabGame::eventFilter(QObject *o, QEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o == this && e->type() == QEvent::Hide) {
|
if (o == this && e->type() == QEvent::Hide) {
|
||||||
|
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||||
if (replay) {
|
if (replay) {
|
||||||
settingsCache->layouts().setReplayPlayAreaState(saveState());
|
layouts.setReplayPlayAreaState(saveState());
|
||||||
settingsCache->layouts().setReplayPlayAreaGeometry(saveGeometry());
|
layouts.setReplayPlayAreaGeometry(saveGeometry());
|
||||||
settingsCache->layouts().setReplayCardInfoSize(cardInfoDock->size());
|
layouts.setReplayCardInfoSize(cardInfoDock->size());
|
||||||
settingsCache->layouts().setReplayMessageLayoutSize(messageLayoutDock->size());
|
layouts.setReplayMessageLayoutSize(messageLayoutDock->size());
|
||||||
settingsCache->layouts().setReplayPlayerListSize(playerListDock->size());
|
layouts.setReplayPlayerListSize(playerListDock->size());
|
||||||
settingsCache->layouts().setReplayReplaySize(replayDock->size());
|
layouts.setReplayReplaySize(replayDock->size());
|
||||||
} else {
|
} else {
|
||||||
settingsCache->layouts().setGamePlayAreaState(saveState());
|
layouts.setGamePlayAreaState(saveState());
|
||||||
settingsCache->layouts().setGamePlayAreaGeometry(saveGeometry());
|
layouts.setGamePlayAreaGeometry(saveGeometry());
|
||||||
settingsCache->layouts().setGameCardInfoSize(cardInfoDock->size());
|
layouts.setGameCardInfoSize(cardInfoDock->size());
|
||||||
settingsCache->layouts().setGameMessageLayoutSize(messageLayoutDock->size());
|
layouts.setGameMessageLayoutSize(messageLayoutDock->size());
|
||||||
settingsCache->layouts().setGamePlayerListSize(playerListDock->size());
|
layouts.setGamePlayerListSize(playerListDock->size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -127,7 +127,7 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
userLevel, userPriv, true);
|
userLevel, userPriv, true);
|
||||||
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this))
|
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this))
|
||||||
soundEngine->playSound("private_message");
|
soundEngine->playSound("private_message");
|
||||||
if (settingsCache->getShowMessagePopup() && shouldShowSystemPopup(event))
|
if (SettingsCache::instance().getShowMessagePopup() && shouldShowSystemPopup(event))
|
||||||
showSystemPopup(event);
|
showSystemPopup(event);
|
||||||
if (QString::fromStdString(event.sender_name()).toLower().simplified() == "servatrice")
|
if (QString::fromStdString(event.sender_name()).toLower().simplified() == "servatrice")
|
||||||
sayEdit->setDisabled(true);
|
sayEdit->setDisabled(true);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client) : Tab(_tabSupervisor), client(_client)
|
TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client) : Tab(_tabSupervisor), client(_client)
|
||||||
{
|
{
|
||||||
localDirModel = new QFileSystemModel(this);
|
localDirModel = new QFileSystemModel(this);
|
||||||
localDirModel->setRootPath(settingsCache->getReplaysPath());
|
localDirModel->setRootPath(SettingsCache::instance().getReplaysPath());
|
||||||
localDirModel->sort(0, Qt::AscendingOrder);
|
localDirModel->sort(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
localDirView = new QTreeView;
|
localDirView = new QTreeView;
|
||||||
|
|
|
@ -56,7 +56,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
||||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||||
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||||
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||||
connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
connect(&SettingsCache::instance(), SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
||||||
sayLabel = new QLabel;
|
sayLabel = new QLabel;
|
||||||
sayEdit = new LineEditCompleter;
|
sayEdit = new LineEditCompleter;
|
||||||
sayLabel->setBuddy(sayEdit);
|
sayLabel->setBuddy(sayEdit);
|
||||||
|
@ -122,7 +122,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
||||||
|
|
||||||
sayEdit->setCompleter(completer);
|
sayEdit->setCompleter(completer);
|
||||||
actCompleterChanged();
|
actCompleterChanged();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
@ -233,7 +233,8 @@ void TabRoom::actOpenChatSettings()
|
||||||
|
|
||||||
void TabRoom::actCompleterChanged()
|
void TabRoom::actCompleterChanged()
|
||||||
{
|
{
|
||||||
settingsCache->getChatMentionCompleter() ? completer->setCompletionRole(2) : completer->setCompletionRole(1);
|
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||||
|
: completer->setCompletionRole(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabRoom::processRoomEvent(const RoomEvent &event)
|
void TabRoom::processRoomEvent(const RoomEvent &event)
|
||||||
|
@ -293,11 +294,12 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
||||||
if (twi) {
|
if (twi) {
|
||||||
userLevel = UserLevelFlags(twi->getUserInfo().user_level());
|
userLevel = UserLevelFlags(twi->getUserInfo().user_level());
|
||||||
userPrivLevel = QString::fromStdString(twi->getUserInfo().privlevel());
|
userPrivLevel = QString::fromStdString(twi->getUserInfo().privlevel());
|
||||||
if (settingsCache->getIgnoreUnregisteredUsers() && !userLevel.testFlag(ServerInfo_User::IsRegistered))
|
if (SettingsCache::instance().getIgnoreUnregisteredUsers() &&
|
||||||
|
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.message_type() == Event_RoomSay::ChatHistory && !settingsCache->getRoomHistory())
|
if (event.message_type() == Event_RoomSay::ChatHistory && !SettingsCache::instance().getRoomHistory())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.message_type() == Event_RoomSay::ChatHistory)
|
if (event.message_type() == Event_RoomSay::ChatHistory)
|
||||||
|
@ -312,7 +314,7 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
||||||
|
|
||||||
void TabRoom::refreshShortcuts()
|
void TabRoom::refreshShortcuts()
|
||||||
{
|
{
|
||||||
aClearChat->setShortcuts(settingsCache->shortcuts().getShortcut("tab_room/aClearChat"));
|
aClearChat->setShortcuts(SettingsCache::instance().shortcuts().getShortcut("tab_room/aClearChat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabRoom::addMentionTag(QString mentionTag)
|
void TabRoom::addMentionTag(QString mentionTag)
|
||||||
|
|
|
@ -515,7 +515,7 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
|
||||||
tab->setContentsChanged(true);
|
tab->setContentsChanged(true);
|
||||||
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
||||||
}
|
}
|
||||||
if (globalEvent && settingsCache->getNotificationsEnabled())
|
if (globalEvent && SettingsCache::instance().getNotificationsEnabled())
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
UserListTWI *twi = tabUserLists->getAllUsersList()->getUsers().value(senderName);
|
UserListTWI *twi = tabUserLists->getAllUsersList()->getUsers().value(senderName);
|
||||||
if (twi) {
|
if (twi) {
|
||||||
UserLevelFlags userLevel = UserLevelFlags(twi->getUserInfo().user_level());
|
UserLevelFlags userLevel = UserLevelFlags(twi->getUserInfo().user_level());
|
||||||
if (settingsCache->getIgnoreUnregisteredUserMessages() &&
|
if (SettingsCache::instance().getIgnoreUnregisteredUserMessages() &&
|
||||||
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
||||||
// Flags are additive, so reg/mod/admin are all IsRegistered
|
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||||
return;
|
return;
|
||||||
|
@ -596,7 +596,7 @@ void TabSupervisor::processUserJoined(const ServerInfo_User &userInfoJoined)
|
||||||
setTabIcon(indexOf(tab), QPixmap(avatarPixmap));
|
setTabIcon(indexOf(tab), QPixmap(avatarPixmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsCache->getBuddyConnectNotificationsEnabled()) {
|
if (SettingsCache::instance().getBuddyConnectNotificationsEnabled()) {
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
||||||
: SelectZone(_p, "table", true, false, true, parent), active(false)
|
: SelectZone(_p, "table", true, false, true, parent), active(false)
|
||||||
{
|
{
|
||||||
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
|
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
|
||||||
connect(settingsCache, SIGNAL(invertVerticalCoordinateChanged()), this, SLOT(reorganizeCards()));
|
connect(&SettingsCache::instance(), SIGNAL(invertVerticalCoordinateChanged()), this, SLOT(reorganizeCards()));
|
||||||
|
|
||||||
updateBg();
|
updateBg();
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ QRectF TableZone::boundingRect() const
|
||||||
|
|
||||||
bool TableZone::isInverted() const
|
bool TableZone::isInverted() const
|
||||||
{
|
{
|
||||||
return ((player->getMirrored() && !settingsCache->getInvertVerticalCoordinate()) ||
|
return ((player->getMirrored() && !SettingsCache::instance().getInvertVerticalCoordinate()) ||
|
||||||
(!player->getMirrored() && settingsCache->getInvertVerticalCoordinate()));
|
(!player->getMirrored() && SettingsCache::instance().getInvertVerticalCoordinate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
|
|
@ -9,16 +9,16 @@ class TearOffMenu : public QMenu
|
||||||
public:
|
public:
|
||||||
TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
||||||
{
|
{
|
||||||
connect(settingsCache, &SettingsCache::useTearOffMenusChanged, this,
|
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
||||||
[=](bool state) { setTearOffEnabled(state); });
|
[=](bool state) { setTearOffEnabled(state); });
|
||||||
setTearOffEnabled(settingsCache->getUseTearOffMenus());
|
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
||||||
}
|
}
|
||||||
|
|
||||||
TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||||
{
|
{
|
||||||
connect(settingsCache, &SettingsCache::useTearOffMenusChanged, this,
|
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
||||||
[=](bool state) { setTearOffEnabled(state); });
|
[=](bool state) { setTearOffEnabled(state); });
|
||||||
setTearOffEnabled(settingsCache->getUseTearOffMenus());
|
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
||||||
}
|
}
|
||||||
|
|
||||||
TearOffMenu *addTearOffMenu(const QString &title)
|
TearOffMenu *addTearOffMenu(const QString &title)
|
||||||
|
|
|
@ -19,15 +19,16 @@
|
||||||
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
|
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
ensureThemeDirectoryExists();
|
ensureThemeDirectoryExists();
|
||||||
connect(settingsCache, SIGNAL(themeChanged()), this, SLOT(themeChangedSlot()));
|
connect(&SettingsCache::instance(), SIGNAL(themeChanged()), this, SLOT(themeChangedSlot()));
|
||||||
themeChangedSlot();
|
themeChangedSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::ensureThemeDirectoryExists()
|
void ThemeManager::ensureThemeDirectoryExists()
|
||||||
{
|
{
|
||||||
if (settingsCache->getThemeName().isEmpty() || !getAvailableThemes().contains(settingsCache->getThemeName())) {
|
if (SettingsCache::instance().getThemeName().isEmpty() ||
|
||||||
|
!getAvailableThemes().contains(SettingsCache::instance().getThemeName())) {
|
||||||
qDebug() << "Theme name not set, setting default value";
|
qDebug() << "Theme name not set, setting default value";
|
||||||
settingsCache->setThemeName(DEFAULT_THEME_NAME);
|
SettingsCache::instance().setThemeName(DEFAULT_THEME_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ QStringMap &ThemeManager::getAvailableThemes()
|
||||||
availableThemes.clear();
|
availableThemes.clear();
|
||||||
|
|
||||||
// load themes from user profile dir
|
// load themes from user profile dir
|
||||||
dir.setPath(settingsCache->getDataPath() + "/themes");
|
dir.setPath(SettingsCache::instance().getDataPath() + "/themes");
|
||||||
|
|
||||||
foreach (QString themeName, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
foreach (QString themeName, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||||
if (!availableThemes.contains(themeName))
|
if (!availableThemes.contains(themeName))
|
||||||
|
@ -79,7 +80,7 @@ QBrush ThemeManager::loadBrush(QString fileName, QColor fallbackColor)
|
||||||
|
|
||||||
void ThemeManager::themeChangedSlot()
|
void ThemeManager::themeChangedSlot()
|
||||||
{
|
{
|
||||||
QString themeName = settingsCache->getThemeName();
|
QString themeName = SettingsCache::instance().getThemeName();
|
||||||
qDebug() << "Theme changed:" << themeName;
|
qDebug() << "Theme changed:" << themeName;
|
||||||
|
|
||||||
QDir dir = getAvailableThemes().value(themeName);
|
QDir dir = getAvailableThemes().value(themeName);
|
||||||
|
|
|
@ -23,23 +23,18 @@ QMap<QString, std::pair<QString, UserConnection_Information>> UserConnection_Inf
|
||||||
{
|
{
|
||||||
QMap<QString, std::pair<QString, UserConnection_Information>> serverList;
|
QMap<QString, std::pair<QString, UserConnection_Information>> serverList;
|
||||||
|
|
||||||
int size = settingsCache->servers().getValue("totalServers", "server", "server_details").toInt() + 1;
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
|
|
||||||
|
int size = servers.getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
QString saveName =
|
QString saveName = servers.getValue(QString("saveName%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("saveName%1").arg(i), "server", "server_details").toString();
|
QString serverName = servers.getValue(QString("server%1").arg(i), "server", "server_details").toString();
|
||||||
QString serverName =
|
QString portNum = servers.getValue(QString("port%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("server%1").arg(i), "server", "server_details").toString();
|
QString userName = servers.getValue(QString("username%1").arg(i), "server", "server_details").toString();
|
||||||
QString portNum =
|
QString pass = servers.getValue(QString("password%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("port%1").arg(i), "server", "server_details").toString();
|
bool savePass = servers.getValue(QString("savePassword%1").arg(i), "server", "server_details").toBool();
|
||||||
QString userName =
|
QString site = servers.getValue(QString("site%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("username%1").arg(i), "server", "server_details").toString();
|
|
||||||
QString pass =
|
|
||||||
settingsCache->servers().getValue(QString("password%1").arg(i), "server", "server_details").toString();
|
|
||||||
bool savePass =
|
|
||||||
settingsCache->servers().getValue(QString("savePassword%1").arg(i), "server", "server_details").toBool();
|
|
||||||
QString site =
|
|
||||||
settingsCache->servers().getValue(QString("site%1").arg(i), "server", "server_details").toString();
|
|
||||||
|
|
||||||
UserConnection_Information userInfo(saveName, serverName, portNum, userName, pass, savePass, site);
|
UserConnection_Information userInfo(saveName, serverName, portNum, userName, pass, savePass, site);
|
||||||
serverList.insert(saveName, std::make_pair(serverName, userInfo));
|
serverList.insert(saveName, std::make_pair(serverName, userInfo));
|
||||||
|
@ -52,26 +47,21 @@ QStringList UserConnection_Information::getServerInfo(const QString &find)
|
||||||
{
|
{
|
||||||
QStringList server;
|
QStringList server;
|
||||||
|
|
||||||
int size = settingsCache->servers().getValue("totalServers", "server", "server_details").toInt() + 1;
|
ServersSettings &servers = SettingsCache::instance().servers();
|
||||||
|
|
||||||
|
int size = servers.getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
QString saveName =
|
QString saveName = servers.getValue(QString("saveName%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("saveName%1").arg(i), "server", "server_details").toString();
|
|
||||||
|
|
||||||
if (find != saveName)
|
if (find != saveName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString serverName =
|
QString serverName = servers.getValue(QString("server%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("server%1").arg(i), "server", "server_details").toString();
|
QString portNum = servers.getValue(QString("port%1").arg(i), "server", "server_details").toString();
|
||||||
QString portNum =
|
QString userName = servers.getValue(QString("username%1").arg(i), "server", "server_details").toString();
|
||||||
settingsCache->servers().getValue(QString("port%1").arg(i), "server", "server_details").toString();
|
QString pass = servers.getValue(QString("password%1").arg(i), "server", "server_details").toString();
|
||||||
QString userName =
|
bool savePass = servers.getValue(QString("savePassword%1").arg(i), "server", "server_details").toBool();
|
||||||
settingsCache->servers().getValue(QString("username%1").arg(i), "server", "server_details").toString();
|
QString site = servers.getValue(QString("site%1").arg(i), "server", "server_details").toString();
|
||||||
QString pass =
|
|
||||||
settingsCache->servers().getValue(QString("password%1").arg(i), "server", "server_details").toString();
|
|
||||||
bool savePass =
|
|
||||||
settingsCache->servers().getValue(QString("savePassword%1").arg(i), "server", "server_details").toBool();
|
|
||||||
QString site =
|
|
||||||
settingsCache->servers().getValue(QString("site%1").arg(i), "server", "server_details").toString();
|
|
||||||
|
|
||||||
server.append(saveName);
|
server.append(saveName);
|
||||||
server.append(serverName);
|
server.append(serverName);
|
||||||
|
|
|
@ -223,14 +223,15 @@ void MainWindow::actSinglePlayer()
|
||||||
|
|
||||||
localServer = new LocalServer(this);
|
localServer = new LocalServer(this);
|
||||||
LocalServerInterface *mainLsi = localServer->newConnection();
|
LocalServerInterface *mainLsi = localServer->newConnection();
|
||||||
LocalClient *mainClient = new LocalClient(mainLsi, tr("Player %1").arg(1), settingsCache->getClientID(), this);
|
LocalClient *mainClient =
|
||||||
|
new LocalClient(mainLsi, tr("Player %1").arg(1), SettingsCache::instance().getClientID(), this);
|
||||||
QList<AbstractClient *> localClients;
|
QList<AbstractClient *> localClients;
|
||||||
localClients.append(mainClient);
|
localClients.append(mainClient);
|
||||||
|
|
||||||
for (int i = 0; i < numberPlayers - 1; ++i) {
|
for (int i = 0; i < numberPlayers - 1; ++i) {
|
||||||
LocalServerInterface *slaveLsi = localServer->newConnection();
|
LocalServerInterface *slaveLsi = localServer->newConnection();
|
||||||
LocalClient *slaveClient =
|
LocalClient *slaveClient =
|
||||||
new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), settingsCache->getClientID(), this);
|
new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), SettingsCache::instance().getClientID(), this);
|
||||||
localClients.append(slaveClient);
|
localClients.append(slaveClient);
|
||||||
}
|
}
|
||||||
tabSupervisor->startLocal(localClients);
|
tabSupervisor->startLocal(localClients);
|
||||||
|
@ -243,7 +244,7 @@ void MainWindow::actSinglePlayer()
|
||||||
void MainWindow::actWatchReplay()
|
void MainWindow::actWatchReplay()
|
||||||
{
|
{
|
||||||
QFileDialog dlg(this, tr("Load replay"));
|
QFileDialog dlg(this, tr("Load replay"));
|
||||||
dlg.setDirectory(settingsCache->getReplaysPath());
|
dlg.setDirectory(SettingsCache::instance().getReplaysPath());
|
||||||
dlg.setNameFilters(QStringList() << QObject::tr("Cockatrice replays (*.cor)"));
|
dlg.setNameFilters(QStringList() << QObject::tr("Cockatrice replays (*.cor)"));
|
||||||
if (!dlg.exec())
|
if (!dlg.exec())
|
||||||
return;
|
return;
|
||||||
|
@ -771,8 +772,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), cardUpdateProcess(nullptr),
|
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), cardUpdateProcess(nullptr),
|
||||||
logviewDialog(nullptr)
|
logviewDialog(nullptr)
|
||||||
{
|
{
|
||||||
connect(settingsCache, SIGNAL(pixmapCacheSizeChanged(int)), this, SLOT(pixmapCacheSizeChanged(int)));
|
connect(&SettingsCache::instance(), SIGNAL(pixmapCacheSizeChanged(int)), this, SLOT(pixmapCacheSizeChanged(int)));
|
||||||
pixmapCacheSizeChanged(settingsCache->getPixmapCacheSize());
|
pixmapCacheSizeChanged(SettingsCache::instance().getPixmapCacheSize());
|
||||||
|
|
||||||
client = new RemoteClient;
|
client = new RemoteClient;
|
||||||
connect(client, SIGNAL(connectionClosedEventReceived(const Event_ConnectionClosed &)), this,
|
connect(client, SIGNAL(connectionClosedEventReceived(const Event_ConnectionClosed &)), this,
|
||||||
|
@ -816,7 +817,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
if (!restoreGeometry(settingsCache->getMainWindowGeometry())) {
|
if (!restoreGeometry(SettingsCache::instance().getMainWindowGeometry())) {
|
||||||
setWindowState(Qt::WindowMaximized);
|
setWindowState(Qt::WindowMaximized);
|
||||||
}
|
}
|
||||||
aFullScreen->setChecked(static_cast<bool>(windowState() & Qt::WindowFullScreen));
|
aFullScreen->setChecked(static_cast<bool>(windowState() & Qt::WindowFullScreen));
|
||||||
|
@ -826,7 +827,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
connect(db, SIGNAL(cardDatabaseLoadingFailed()), this, SLOT(cardDatabaseLoadingFailed()));
|
connect(db, SIGNAL(cardDatabaseLoadingFailed()), this, SLOT(cardDatabaseLoadingFailed()));
|
||||||
|
@ -842,21 +843,21 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
void MainWindow::startupConfigCheck()
|
void MainWindow::startupConfigCheck()
|
||||||
{
|
{
|
||||||
if (settingsCache->getClientVersion() == CLIENT_INFO_NOT_SET) {
|
if (SettingsCache::instance().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||||
// no config found, 99% new clean install
|
// no config found, 99% new clean install
|
||||||
qDebug() << "Startup: old client version empty, assuming first start after clean install";
|
qDebug() << "Startup: old client version empty, assuming first start after clean install";
|
||||||
alertForcedOracleRun(VERSION_STRING, false);
|
alertForcedOracleRun(VERSION_STRING, false);
|
||||||
settingsCache->setClientVersion(VERSION_STRING);
|
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
||||||
} else if (settingsCache->getClientVersion() != VERSION_STRING) {
|
} else if (SettingsCache::instance().getClientVersion() != VERSION_STRING) {
|
||||||
// config found, from another (presumably older) version
|
// config found, from another (presumably older) version
|
||||||
qDebug() << "Startup: old client version" << settingsCache->getClientVersion()
|
qDebug() << "Startup: old client version" << SettingsCache::instance().getClientVersion()
|
||||||
<< "differs, assuming first start after update";
|
<< "differs, assuming first start after update";
|
||||||
if (settingsCache->getNotifyAboutNewVersion()) {
|
if (SettingsCache::instance().getNotifyAboutNewVersion()) {
|
||||||
alertForcedOracleRun(VERSION_STRING, true);
|
alertForcedOracleRun(VERSION_STRING, true);
|
||||||
} else {
|
} else {
|
||||||
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
||||||
}
|
}
|
||||||
settingsCache->setClientVersion(VERSION_STRING);
|
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
||||||
} else {
|
} else {
|
||||||
// previous config from this version found
|
// previous config from this version found
|
||||||
qDebug() << "Startup: found config with current version";
|
qDebug() << "Startup: found config with current version";
|
||||||
|
@ -864,7 +865,7 @@ void MainWindow::startupConfigCheck()
|
||||||
|
|
||||||
// Run the tips dialog only on subsequent startups.
|
// Run the tips dialog only on subsequent startups.
|
||||||
// On the first run after an install/update the startup is already crowded enough
|
// On the first run after an install/update the startup is already crowded enough
|
||||||
if (tip->successfulInit && settingsCache->getShowTipsOnStartup() && tip->newTipsAvailable) {
|
if (tip->successfulInit && SettingsCache::instance().getShowTipsOnStartup() && tip->newTipsAvailable) {
|
||||||
tip->raise();
|
tip->raise();
|
||||||
tip->show();
|
tip->show();
|
||||||
}
|
}
|
||||||
|
@ -960,7 +961,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
tip->close();
|
tip->close();
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
settingsCache->setMainWindowGeometry(saveGeometry());
|
SettingsCache::instance().setMainWindowGeometry(saveGeometry());
|
||||||
tabSupervisor->deleteLater();
|
tabSupervisor->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,7 +975,7 @@ void MainWindow::changeEvent(QEvent *event)
|
||||||
if (!connectTo.isEmpty()) {
|
if (!connectTo.isEmpty()) {
|
||||||
qDebug() << "Command line connect to " << connectTo;
|
qDebug() << "Command line connect to " << connectTo;
|
||||||
client->connectToServer(connectTo.host(), connectTo.port(), connectTo.userName(), connectTo.password());
|
client->connectToServer(connectTo.host(), connectTo.port(), connectTo.userName(), connectTo.password());
|
||||||
} else if (settingsCache->servers().getAutoConnect()) {
|
} else if (SettingsCache::instance().servers().getAutoConnect()) {
|
||||||
qDebug() << "Attempting auto-connect...";
|
qDebug() << "Attempting auto-connect...";
|
||||||
DlgConnect dlg(this);
|
DlgConnect dlg(this);
|
||||||
client->connectToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
|
client->connectToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
|
||||||
|
@ -1166,19 +1167,20 @@ void MainWindow::actCheckServerUpdates()
|
||||||
|
|
||||||
void MainWindow::refreshShortcuts()
|
void MainWindow::refreshShortcuts()
|
||||||
{
|
{
|
||||||
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aConnect"));
|
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||||
aDisconnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aDisconnect"));
|
aConnect->setShortcuts(shortcuts.getShortcut("MainWindow/aConnect"));
|
||||||
aSinglePlayer->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aSinglePlayer"));
|
aDisconnect->setShortcuts(shortcuts.getShortcut("MainWindow/aDisconnect"));
|
||||||
aWatchReplay->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aWatchReplay"));
|
aSinglePlayer->setShortcuts(shortcuts.getShortcut("MainWindow/aSinglePlayer"));
|
||||||
aDeckEditor->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aDeckEditor"));
|
aWatchReplay->setShortcuts(shortcuts.getShortcut("MainWindow/aWatchReplay"));
|
||||||
aFullScreen->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aFullScreen"));
|
aDeckEditor->setShortcuts(shortcuts.getShortcut("MainWindow/aDeckEditor"));
|
||||||
aRegister->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aRegister"));
|
aFullScreen->setShortcuts(shortcuts.getShortcut("MainWindow/aFullScreen"));
|
||||||
aSettings->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aSettings"));
|
aRegister->setShortcuts(shortcuts.getShortcut("MainWindow/aRegister"));
|
||||||
aExit->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aExit"));
|
aSettings->setShortcuts(shortcuts.getShortcut("MainWindow/aSettings"));
|
||||||
aManageSets->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aManageSets"));
|
aExit->setShortcuts(shortcuts.getShortcut("MainWindow/aExit"));
|
||||||
aEditTokens->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aEditTokens"));
|
aManageSets->setShortcuts(shortcuts.getShortcut("MainWindow/aManageSets"));
|
||||||
aOpenCustomFolder->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aOpenCustomFolder"));
|
aEditTokens->setShortcuts(shortcuts.getShortcut("MainWindow/aEditTokens"));
|
||||||
aCheckCardUpdates->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aCheckCardUpdates"));
|
aOpenCustomFolder->setShortcuts(shortcuts.getShortcut("MainWindow/aOpenCustomFolder"));
|
||||||
|
aCheckCardUpdates->setShortcuts(shortcuts.getShortcut("MainWindow/aCheckCardUpdates"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyUserAboutUpdate()
|
void MainWindow::notifyUserAboutUpdate()
|
||||||
|
@ -1192,13 +1194,13 @@ void MainWindow::notifyUserAboutUpdate()
|
||||||
|
|
||||||
void MainWindow::actOpenCustomFolder()
|
void MainWindow::actOpenCustomFolder()
|
||||||
{
|
{
|
||||||
QString dir = settingsCache->getCustomPicsPath();
|
QString dir = SettingsCache::instance().getCustomPicsPath();
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::actOpenCustomsetsFolder()
|
void MainWindow::actOpenCustomsetsFolder()
|
||||||
{
|
{
|
||||||
QString dir = settingsCache->getCustomCardDatabasePath();
|
QString dir = SettingsCache::instance().getCustomCardDatabasePath();
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,7 +1225,7 @@ void MainWindow::actAddCustomSet()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir = settingsCache->getCustomCardDatabasePath();
|
QDir dir = SettingsCache::instance().getCustomCardDatabasePath();
|
||||||
int nextPrefix = getNextCustomSetPrefix(dir);
|
int nextPrefix = getNextCustomSetPrefix(dir);
|
||||||
|
|
||||||
bool res;
|
bool res;
|
||||||
|
@ -1296,9 +1298,9 @@ void MainWindow::forgotPasswordSuccess()
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
this, tr("Forgot Password"),
|
this, tr("Forgot Password"),
|
||||||
tr("Your password has been reset successfully, you can now log in using the new credentials."));
|
tr("Your password has been reset successfully, you can now log in using the new credentials."));
|
||||||
settingsCache->servers().setFPHostName("");
|
SettingsCache::instance().servers().setFPHostName("");
|
||||||
settingsCache->servers().setFPPort("");
|
SettingsCache::instance().servers().setFPPort("");
|
||||||
settingsCache->servers().setFPPlayerName("");
|
SettingsCache::instance().servers().setFPPlayerName("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::forgotPasswordError()
|
void MainWindow::forgotPasswordError()
|
||||||
|
@ -1306,9 +1308,9 @@ void MainWindow::forgotPasswordError()
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
this, tr("Forgot Password"),
|
this, tr("Forgot Password"),
|
||||||
tr("Failed to reset user account password, please contact the server operator to reset your password."));
|
tr("Failed to reset user account password, please contact the server operator to reset your password."));
|
||||||
settingsCache->servers().setFPHostName("");
|
SettingsCache::instance().servers().setFPHostName("");
|
||||||
settingsCache->servers().setFPPort("");
|
SettingsCache::instance().servers().setFPPort("");
|
||||||
settingsCache->servers().setFPPlayerName("");
|
SettingsCache::instance().servers().setFPPlayerName("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::promptForgotPasswordReset()
|
void MainWindow::promptForgotPasswordReset()
|
||||||
|
|
|
@ -100,10 +100,10 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int)));
|
connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int)));
|
||||||
connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int)));
|
connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int)));
|
||||||
connect(&pileViewCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSetPileView(int)));
|
connect(&pileViewCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSetPileView(int)));
|
||||||
sortByNameCheckBox.setChecked(settingsCache->getZoneViewSortByName());
|
sortByNameCheckBox.setChecked(SettingsCache::instance().getZoneViewSortByName());
|
||||||
sortByTypeCheckBox.setChecked(settingsCache->getZoneViewSortByType());
|
sortByTypeCheckBox.setChecked(SettingsCache::instance().getZoneViewSortByType());
|
||||||
pileViewCheckBox.setChecked(settingsCache->getZoneViewPileView());
|
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
|
||||||
if (!settingsCache->getZoneViewSortByType())
|
if (!SettingsCache::instance().getZoneViewSortByType())
|
||||||
pileViewCheckBox.setEnabled(false);
|
pileViewCheckBox.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,20 +118,20 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
void ZoneViewWidget::processSortByType(int value)
|
void ZoneViewWidget::processSortByType(int value)
|
||||||
{
|
{
|
||||||
pileViewCheckBox.setEnabled(value);
|
pileViewCheckBox.setEnabled(value);
|
||||||
settingsCache->setZoneViewSortByType(value);
|
SettingsCache::instance().setZoneViewSortByType(value);
|
||||||
zone->setPileView(pileViewCheckBox.isChecked());
|
zone->setPileView(pileViewCheckBox.isChecked());
|
||||||
zone->setSortByType(value);
|
zone->setSortByType(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::processSortByName(int value)
|
void ZoneViewWidget::processSortByName(int value)
|
||||||
{
|
{
|
||||||
settingsCache->setZoneViewSortByName(value);
|
SettingsCache::instance().setZoneViewSortByName(value);
|
||||||
zone->setSortByName(value);
|
zone->setSortByName(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::processSetPileView(int value)
|
void ZoneViewWidget::processSetPileView(int value)
|
||||||
{
|
{
|
||||||
settingsCache->setZoneViewPileView(value);
|
SettingsCache::instance().setZoneViewPileView(value);
|
||||||
zone->setPileView(value);
|
zone->setPileView(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ SET(dbconverter_SOURCES
|
||||||
../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
||||||
../cockatrice/src/carddbparser/cockatricexml3.cpp
|
../cockatrice/src/carddbparser/cockatricexml3.cpp
|
||||||
../cockatrice/src/carddbparser/cockatricexml4.cpp
|
../cockatrice/src/carddbparser/cockatricexml4.cpp
|
||||||
|
../cockatrice/src/settings/settingsmanager.cpp
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +18,11 @@ find_package(Qt5 COMPONENTS Network Widgets REQUIRED)
|
||||||
set(dbconverter_QT_MODULES Qt5::Core Qt5::Network Qt5::Widgets)
|
set(dbconverter_QT_MODULES Qt5::Core Qt5::Network Qt5::Widgets)
|
||||||
SET(QT_DONT_USE_QTGUI TRUE)
|
SET(QT_DONT_USE_QTGUI TRUE)
|
||||||
|
|
||||||
|
QT5_WRAP_CPP(dbconverter_SOURCES
|
||||||
|
../cockatrice/src/settingscache.h
|
||||||
|
../cockatrice/src/settings/carddatabasesettings.h
|
||||||
|
)
|
||||||
|
|
||||||
# Build servatrice binary and link it
|
# Build servatrice binary and link it
|
||||||
ADD_EXECUTABLE(dbconverter MACOSX_BUNDLE ${dbconverter_SOURCES} ${dbconverter_MOC_SRCS})
|
ADD_EXECUTABLE(dbconverter MACOSX_BUNDLE ${dbconverter_SOURCES} ${dbconverter_MOC_SRCS})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
|
||||||
#include "mocks.h"
|
#include "mocks.h"
|
||||||
|
|
||||||
|
CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent)
|
||||||
|
: SettingsManager(settingPath + "cardDatabase.ini", parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){};
|
void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){};
|
||||||
void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){};
|
void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){};
|
||||||
void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){};
|
void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){};
|
||||||
|
@ -17,33 +21,241 @@ bool CardDatabaseSettings::isKnown(QString /* shortName */)
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QString SettingsCache::getDataPath()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSettingsPath()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
void SettingsCache::translateLegacySettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSafeConfigPath(QString /* configEntry */, QString defaultPath) const
|
||||||
|
{
|
||||||
|
return defaultPath;
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSafeConfigFilePath(QString /* configEntry */, QString defaultPath) const
|
||||||
|
{
|
||||||
|
return defaultPath;
|
||||||
|
}
|
||||||
SettingsCache::SettingsCache()
|
SettingsCache::SettingsCache()
|
||||||
|
: settings{new QSettings("global.ini", QSettings::IniFormat, this)},
|
||||||
|
shortcutsSettings{nullptr},
|
||||||
|
cardDatabaseSettings{new CardDatabaseSettings("", this)},
|
||||||
|
serversSettings{nullptr},
|
||||||
|
messageSettings{nullptr},
|
||||||
|
gameFiltersSettings{nullptr},
|
||||||
|
layoutsSettings{nullptr},
|
||||||
|
downloadSettings{nullptr}
|
||||||
{
|
{
|
||||||
cardDatabaseSettings = new CardDatabaseSettings();
|
|
||||||
};
|
|
||||||
SettingsCache::~SettingsCache()
|
|
||||||
{
|
|
||||||
delete cardDatabaseSettings;
|
|
||||||
};
|
|
||||||
QString SettingsCache::getCustomCardDatabasePath() const
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getCardDatabasePath() const
|
void SettingsCache::setUseTearOffMenus(bool /* _useTearOffMenus */)
|
||||||
{
|
{
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getTokenDatabasePath() const
|
void SettingsCache::setKnownMissingFeatures(const QString &/* _knownMissingFeatures */)
|
||||||
{
|
{
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getSpoilerCardDatabasePath() const
|
void SettingsCache::setCardInfoViewMode(const int /* _viewMode */)
|
||||||
{
|
{
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
CardDatabaseSettings &SettingsCache::cardDatabase() const
|
void SettingsCache::setHighlightWords(const QString &/* _highlightWords */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMasterVolume(int /* _masterVolume */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLeftJustified(const int /* _leftJustified */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardScaling(const int /* _scaleCards */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowMessagePopups(const int /* _showMessagePopups */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowMentionPopups(const int /* _showMentionPopus */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setRoomHistory(const int /* _roomHistory */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLang(const QString &/* _lang */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowTipsOnStartup(bool /* _showTipsOnStartup */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSeenTips(const QList<int> &/* _seenTips */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDeckPath(const QString &/* _deckPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setReplaysPath(const QString &/* _replaysPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPicsPath(const QString &/* _picsPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardDatabasePath(const QString &/* _cardDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpoilerDatabasePath(const QString &/* _spoilerDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTokenDatabasePath(const QString &/* _tokenDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setThemeName(const QString &/* _themeName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPicDownload(int /* _picDownload */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotificationsEnabled(int /* _notificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorNotificationsEnabled(int /* _spectatorNotificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setBuddyConnectNotificationsEnabled(int /* _buddyConnectNotificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDoubleClickToPlay(int /* _doubleClickToPlay */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPlayToStack(int /* _playToStack */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setStartingHandSize(int /* _startingHandSize */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setAnnotateTokens(int /* _annotateTokens */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTabGameSplitterSizes(const QByteArray &/* _tabGameSplitterSizes */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDisplayCardNames(int /* _displayCardNames */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setHorizontalHand(int /* _horizontalHand */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setInvertVerticalCoordinate(int /* _invertVerticalCoordinate */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMinPlayersForMultiColumnLayout(int /* _minPlayersForMultiColumnLayout */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTapAnimation(int /* _tapAnimation */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMention(int /* _chatMention */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionCompleter(const int /* _enableMentionCompleter */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionForeground(int /* _chatMentionForeground */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatHighlightForeground(int /* _chatHighlightForeground */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionColor(const QString &/* _chatMentionColor */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatHighlightColor(const QString &/* _chatHighlightColor */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewSortByName(int /* _zoneViewSortByName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewSortByType(int /* _zoneViewSortByType */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewPileView(int /* _zoneViewPileView */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSoundEnabled(int /* _soundEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSoundThemeName(const QString &/* _soundThemeName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setIgnoreUnregisteredUsers(int /* _ignoreUnregisteredUsers */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setIgnoreUnregisteredUserMessages(int /* _ignoreUnregisteredUserMessages */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMainWindowGeometry(const QByteArray &/* _mainWindowGeometry */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTokenDialogGeometry(const QByteArray &/* _tokenDialogGeometry */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPixmapCacheSize(const int /* _pixmapCacheSize */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setClientID(const QString &/* _clientID */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setClientVersion(const QString &/* _clientVersion */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QStringList SettingsCache::getCountries() const
|
||||||
|
{
|
||||||
|
static QStringList countries = QStringList() << "us";
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
void SettingsCache::setGameDescription(const QString /* _gameDescription */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMaxPlayers(const int /* _maxPlayers */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setGameTypes(const QString /* _gameTypes */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setOnlyBuddies(const bool /* _onlyBuddies */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setOnlyRegistered(const bool /* _onlyRegistered */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsAllowed(const bool /* _spectatorsAllowed */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsNeedPassword(const bool /* _spectatorsNeedPassword */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsCanTalk(const bool /* _spectatorsCanTalk */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsCanSeeEverything(const bool /* _spectatorsCanSeeEverything */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotifyAboutUpdate(int /* _notifyaboutupdate */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotifyAboutNewVersion(int /* _notifyaboutnewversion */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDownloadSpoilerStatus(bool /* _spoilerStatus */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setUpdateReleaseChannel(int /* _updateReleaseChannel */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMaxFontSize(int /* _max */)
|
||||||
{
|
{
|
||||||
return *cardDatabaseSettings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||||
|
@ -51,3 +263,8 @@ void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache *settingsCache;
|
SettingsCache *settingsCache;
|
||||||
|
|
||||||
|
SettingsCache& SettingsCache::instance()
|
||||||
|
{
|
||||||
|
return *settingsCache;
|
||||||
|
}
|
||||||
|
|
|
@ -6,40 +6,10 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#define SETTINGSCACHE_H
|
|
||||||
#define PICTURELOADER_H
|
#define PICTURELOADER_H
|
||||||
|
|
||||||
#include "../../cockatrice/src/carddatabase.h"
|
#include "../../cockatrice/src/carddatabase.h"
|
||||||
|
#include "../../cockatrice/src/settingscache.h"
|
||||||
class CardDatabaseSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setSortKey(QString shortName, unsigned int sortKey);
|
|
||||||
void setEnabled(QString shortName, bool enabled);
|
|
||||||
void setIsKnown(QString shortName, bool isknown);
|
|
||||||
|
|
||||||
unsigned int getSortKey(QString shortName);
|
|
||||||
bool isEnabled(QString shortName);
|
|
||||||
bool isKnown(QString shortName);
|
|
||||||
};
|
|
||||||
|
|
||||||
class SettingsCache : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
|
||||||
CardDatabaseSettings *cardDatabaseSettings;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SettingsCache();
|
|
||||||
~SettingsCache();
|
|
||||||
QString getCustomCardDatabasePath() const;
|
|
||||||
QString getCardDatabasePath() const;
|
|
||||||
QString getTokenDatabasePath() const;
|
|
||||||
QString getSpoilerCardDatabasePath() const;
|
|
||||||
CardDatabaseSettings &cardDatabase() const;
|
|
||||||
signals:
|
|
||||||
void cardDatabasePathChanged();
|
|
||||||
};
|
|
||||||
|
|
||||||
extern SettingsCache *settingsCache;
|
extern SettingsCache *settingsCache;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
QTranslator *translator, *qtTranslator;
|
QTranslator *translator, *qtTranslator;
|
||||||
SettingsCache *settingsCache;
|
|
||||||
ThemeManager *themeManager;
|
ThemeManager *themeManager;
|
||||||
|
|
||||||
const QString translationPrefix = "oracle";
|
const QString translationPrefix = "oracle";
|
||||||
|
@ -21,7 +20,7 @@ bool isSpoilersOnly;
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
QString lang = settingsCache->getLang();
|
QString lang = SettingsCache::instance().getLang();
|
||||||
|
|
||||||
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
qApp->installTranslator(qtTranslator);
|
qApp->installTranslator(qtTranslator);
|
||||||
|
@ -53,7 +52,6 @@ int main(int argc, char *argv[])
|
||||||
translationPath = qApp->applicationDirPath() + "/../share/oracle/translations";
|
translationPath = qApp->applicationDirPath() + "/../share/oracle/translations";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
settingsCache = new SettingsCache;
|
|
||||||
themeManager = new ThemeManager;
|
themeManager = new ThemeManager;
|
||||||
|
|
||||||
qtTranslator = new QTranslator;
|
qtTranslator = new QTranslator;
|
||||||
|
|
|
@ -54,10 +54,10 @@
|
||||||
|
|
||||||
OracleWizard::OracleWizard(QWidget *parent) : QWizard(parent)
|
OracleWizard::OracleWizard(QWidget *parent) : QWizard(parent)
|
||||||
{
|
{
|
||||||
settings = new QSettings(settingsCache->getSettingsPath() + "global.ini", QSettings::IniFormat, this);
|
settings = new QSettings(SettingsCache::instance().getSettingsPath() + "global.ini", QSettings::IniFormat, this);
|
||||||
connect(settingsCache, SIGNAL(langChanged()), this, SLOT(updateLanguage()));
|
connect(&SettingsCache::instance(), SIGNAL(langChanged()), this, SLOT(updateLanguage()));
|
||||||
|
|
||||||
importer = new OracleImporter(settingsCache->getDataPath(), this);
|
importer = new OracleImporter(SettingsCache::instance().getDataPath(), this);
|
||||||
|
|
||||||
nam = new QNetworkAccessManager(this);
|
nam = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ IntroPage::IntroPage(QWidget *parent) : OracleWizardPage(parent)
|
||||||
languageLabel = new QLabel(this);
|
languageLabel = new QLabel(this);
|
||||||
versionLabel = new QLabel(this);
|
versionLabel = new QLabel(this);
|
||||||
languageBox = new QComboBox(this);
|
languageBox = new QComboBox(this);
|
||||||
QString setLanguage = settingsCache->getLang();
|
QString setLanguage = SettingsCache::instance().getLang();
|
||||||
|
|
||||||
QStringList qmFiles = findQmFiles();
|
QStringList qmFiles = findQmFiles();
|
||||||
for (int i = 0; i < qmFiles.size(); i++) {
|
for (int i = 0; i < qmFiles.size(); i++) {
|
||||||
|
@ -185,7 +185,7 @@ QString IntroPage::languageName(const QString &qmFile)
|
||||||
|
|
||||||
void IntroPage::languageBoxChanged(int index)
|
void IntroPage::languageBoxChanged(int index)
|
||||||
{
|
{
|
||||||
settingsCache->setLang(languageBox->itemData(index).toString());
|
SettingsCache::instance().setLang(languageBox->itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntroPage::retranslateUi()
|
void IntroPage::retranslateUi()
|
||||||
|
@ -587,7 +587,7 @@ void SaveSetsPage::retranslateUi()
|
||||||
|
|
||||||
saveLabel->setText(tr("Press \"Save\" to store the imported cards in the Cockatrice database."));
|
saveLabel->setText(tr("Press \"Save\" to store the imported cards in the Cockatrice database."));
|
||||||
pathLabel->setText(tr("The card database will be saved at the following location:") + "<br>" +
|
pathLabel->setText(tr("The card database will be saved at the following location:") + "<br>" +
|
||||||
settingsCache->getCardDatabasePath());
|
SettingsCache::instance().getCardDatabasePath());
|
||||||
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
||||||
|
|
||||||
setButtonText(QWizard::NextButton, tr("&Save"));
|
setButtonText(QWizard::NextButton, tr("&Save"));
|
||||||
|
@ -608,7 +608,7 @@ void SaveSetsPage::updateTotalProgress(int cardsImported, int /* setIndex */, co
|
||||||
bool SaveSetsPage::validatePage()
|
bool SaveSetsPage::validatePage()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString defaultPath = settingsCache->getCardDatabasePath();
|
QString defaultPath = SettingsCache::instance().getCardDatabasePath();
|
||||||
QString windowName = tr("Save card database");
|
QString windowName = tr("Save card database");
|
||||||
QString fileType = tr("XML; card database (*.xml)");
|
QString fileType = tr("XML; card database (*.xml)");
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ QString LoadTokensPage::getCustomUrlSettingsKey()
|
||||||
|
|
||||||
QString LoadTokensPage::getDefaultSavePath()
|
QString LoadTokensPage::getDefaultSavePath()
|
||||||
{
|
{
|
||||||
return settingsCache->getTokenDatabasePath();
|
return SettingsCache::instance().getTokenDatabasePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LoadTokensPage::getWindowTitle()
|
QString LoadTokensPage::getWindowTitle()
|
||||||
|
@ -673,7 +673,7 @@ void LoadTokensPage::retranslateUi()
|
||||||
urlLabel->setText(tr("Download URL:"));
|
urlLabel->setText(tr("Download URL:"));
|
||||||
urlButton->setText(tr("Restore default URL"));
|
urlButton->setText(tr("Restore default URL"));
|
||||||
pathLabel->setText(tr("The token database will be saved at the following location:") + "<br>" +
|
pathLabel->setText(tr("The token database will be saved at the following location:") + "<br>" +
|
||||||
settingsCache->getTokenDatabasePath());
|
SettingsCache::instance().getTokenDatabasePath());
|
||||||
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ QString LoadSpoilersPage::getCustomUrlSettingsKey()
|
||||||
|
|
||||||
QString LoadSpoilersPage::getDefaultSavePath()
|
QString LoadSpoilersPage::getDefaultSavePath()
|
||||||
{
|
{
|
||||||
return settingsCache->getTokenDatabasePath();
|
return SettingsCache::instance().getTokenDatabasePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LoadSpoilersPage::getWindowTitle()
|
QString LoadSpoilersPage::getWindowTitle()
|
||||||
|
@ -710,6 +710,6 @@ void LoadSpoilersPage::retranslateUi()
|
||||||
urlLabel->setText(tr("Download URL:"));
|
urlLabel->setText(tr("Download URL:"));
|
||||||
urlButton->setText(tr("Restore default URL"));
|
urlButton->setText(tr("Restore default URL"));
|
||||||
pathLabel->setText(tr("The spoiler database will be saved at the following location:") + "<br>" +
|
pathLabel->setText(tr("The spoiler database will be saved at the following location:") + "<br>" +
|
||||||
settingsCache->getSpoilerCardDatabasePath());
|
SettingsCache::instance().getSpoilerCardDatabasePath());
|
||||||
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
defaultPathCheckBox->setText(tr("Save to a custom path (not recommended)"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
ADD_DEFINITIONS("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"")
|
ADD_DEFINITIONS("-DCARDDB_DATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"")
|
||||||
|
|
||||||
|
find_package(Qt5 COMPONENTS Concurrent Network Widgets Svg REQUIRED)
|
||||||
|
|
||||||
|
QT5_WRAP_CPP(MOCKS_SOURCES
|
||||||
|
../../cockatrice/src/settingscache.h
|
||||||
|
../../cockatrice/src/settings/carddatabasesettings.h
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(carddatabase_test
|
add_executable(carddatabase_test
|
||||||
carddatabase_test.cpp
|
carddatabase_test.cpp
|
||||||
mocks.cpp
|
mocks.cpp
|
||||||
|
@ -6,7 +14,9 @@ add_executable(carddatabase_test
|
||||||
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
||||||
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
||||||
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
||||||
|
../../cockatrice/src/settings/settingsmanager.cpp
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
|
${MOCKS_SOURCES}
|
||||||
)
|
)
|
||||||
add_executable(filter_string_test
|
add_executable(filter_string_test
|
||||||
filter_string_test.cpp
|
filter_string_test.cpp
|
||||||
|
@ -18,14 +28,15 @@ add_executable(filter_string_test
|
||||||
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
../../cockatrice/src/carddbparser/carddatabaseparser.cpp
|
||||||
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
../../cockatrice/src/carddbparser/cockatricexml3.cpp
|
||||||
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
../../cockatrice/src/carddbparser/cockatricexml4.cpp
|
||||||
|
../../cockatrice/src/settings/settingsmanager.cpp
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
|
${MOCKS_SOURCES}
|
||||||
)
|
)
|
||||||
if(NOT GTEST_FOUND)
|
if(NOT GTEST_FOUND)
|
||||||
add_dependencies(carddatabase_test gtest)
|
add_dependencies(carddatabase_test gtest)
|
||||||
add_dependencies(filter_string_test gtest)
|
add_dependencies(filter_string_test gtest)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Concurrent Network Widgets Svg REQUIRED)
|
|
||||||
set(TEST_QT_MODULES Qt5::Concurrent Qt5::Network Qt5::Widgets Qt5::Svg)
|
set(TEST_QT_MODULES Qt5::Concurrent Qt5::Network Qt5::Widgets Qt5::Svg)
|
||||||
|
|
||||||
target_link_libraries(carddatabase_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES})
|
target_link_libraries(carddatabase_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES})
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
|
||||||
#include "mocks.h"
|
#include "mocks.h"
|
||||||
|
|
||||||
|
CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent)
|
||||||
|
: SettingsManager(settingPath + "cardDatabase.ini", parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){};
|
void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){};
|
||||||
void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){};
|
void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){};
|
||||||
void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){};
|
void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){};
|
||||||
|
@ -17,38 +21,254 @@ bool CardDatabaseSettings::isKnown(QString /* shortName */)
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QString SettingsCache::getDataPath()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSettingsPath()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
void SettingsCache::translateLegacySettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSafeConfigPath(QString /* configEntry */, QString defaultPath) const
|
||||||
|
{
|
||||||
|
return defaultPath;
|
||||||
|
}
|
||||||
|
QString SettingsCache::getSafeConfigFilePath(QString /* configEntry */, QString defaultPath) const
|
||||||
|
{
|
||||||
|
return defaultPath;
|
||||||
|
}
|
||||||
SettingsCache::SettingsCache()
|
SettingsCache::SettingsCache()
|
||||||
|
: settings{new QSettings("global.ini", QSettings::IniFormat, this)},
|
||||||
|
shortcutsSettings{nullptr},
|
||||||
|
cardDatabaseSettings{new CardDatabaseSettings("", this)},
|
||||||
|
serversSettings{nullptr},
|
||||||
|
messageSettings{nullptr},
|
||||||
|
gameFiltersSettings{nullptr},
|
||||||
|
layoutsSettings{nullptr},
|
||||||
|
downloadSettings{nullptr},
|
||||||
|
cardDatabasePath{QString("%1/cards.xml").arg(CARDDB_DATADIR)},
|
||||||
|
customCardDatabasePath{QString("%1/customsets/").arg(CARDDB_DATADIR)},
|
||||||
|
spoilerDatabasePath{QString("%1/spoiler.xml").arg(CARDDB_DATADIR)},
|
||||||
|
tokenDatabasePath{QString("%1/tokens.xml").arg(CARDDB_DATADIR)}
|
||||||
{
|
{
|
||||||
cardDatabaseSettings = new CardDatabaseSettings();
|
|
||||||
};
|
|
||||||
SettingsCache::~SettingsCache()
|
|
||||||
{
|
|
||||||
delete cardDatabaseSettings;
|
|
||||||
};
|
|
||||||
QString SettingsCache::getCustomCardDatabasePath() const
|
|
||||||
{
|
|
||||||
return QString("%1/customsets/").arg(CARDDB_DATADIR);
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getCardDatabasePath() const
|
void SettingsCache::setUseTearOffMenus(bool /* _useTearOffMenus */)
|
||||||
{
|
{
|
||||||
return QString("%1/cards.xml").arg(CARDDB_DATADIR);
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getTokenDatabasePath() const
|
void SettingsCache::setKnownMissingFeatures(const QString &/* _knownMissingFeatures */)
|
||||||
{
|
{
|
||||||
return QString("%1/tokens.xml").arg(CARDDB_DATADIR);
|
|
||||||
}
|
}
|
||||||
QString SettingsCache::getSpoilerCardDatabasePath() const
|
void SettingsCache::setCardInfoViewMode(const int /* _viewMode */)
|
||||||
{
|
{
|
||||||
return QString("%1/spoiler.xml").arg(CARDDB_DATADIR);
|
|
||||||
}
|
}
|
||||||
CardDatabaseSettings &SettingsCache::cardDatabase() const
|
void SettingsCache::setHighlightWords(const QString &/* _highlightWords */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMasterVolume(int /* _masterVolume */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLeftJustified(const int /* _leftJustified */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardScaling(const int /* _scaleCards */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowMessagePopups(const int /* _showMessagePopups */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowMentionPopups(const int /* _showMentionPopus */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setRoomHistory(const int /* _roomHistory */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLang(const QString &/* _lang */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setShowTipsOnStartup(bool /* _showTipsOnStartup */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSeenTips(const QList<int> &/* _seenTips */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDeckPath(const QString &/* _deckPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setReplaysPath(const QString &/* _replaysPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPicsPath(const QString &/* _picsPath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardDatabasePath(const QString &/* _cardDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpoilerDatabasePath(const QString &/* _spoilerDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTokenDatabasePath(const QString &/* _tokenDatabasePath */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setThemeName(const QString &/* _themeName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPicDownload(int /* _picDownload */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotificationsEnabled(int /* _notificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorNotificationsEnabled(int /* _spectatorNotificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setBuddyConnectNotificationsEnabled(int /* _buddyConnectNotificationsEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDoubleClickToPlay(int /* _doubleClickToPlay */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPlayToStack(int /* _playToStack */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setStartingHandSize(int /* _startingHandSize */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setAnnotateTokens(int /* _annotateTokens */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTabGameSplitterSizes(const QByteArray &/* _tabGameSplitterSizes */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDisplayCardNames(int /* _displayCardNames */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setHorizontalHand(int /* _horizontalHand */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setInvertVerticalCoordinate(int /* _invertVerticalCoordinate */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMinPlayersForMultiColumnLayout(int /* _minPlayersForMultiColumnLayout */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTapAnimation(int /* _tapAnimation */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMention(int /* _chatMention */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionCompleter(const int /* _enableMentionCompleter */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionForeground(int /* _chatMentionForeground */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatHighlightForeground(int /* _chatHighlightForeground */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatMentionColor(const QString &/* _chatMentionColor */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setChatHighlightColor(const QString &/* _chatHighlightColor */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewSortByName(int /* _zoneViewSortByName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewSortByType(int /* _zoneViewSortByType */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setZoneViewPileView(int /* _zoneViewPileView */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSoundEnabled(int /* _soundEnabled */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSoundThemeName(const QString &/* _soundThemeName */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setIgnoreUnregisteredUsers(int /* _ignoreUnregisteredUsers */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setIgnoreUnregisteredUserMessages(int /* _ignoreUnregisteredUserMessages */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMainWindowGeometry(const QByteArray &/* _mainWindowGeometry */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setTokenDialogGeometry(const QByteArray &/* _tokenDialogGeometry */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setPixmapCacheSize(const int /* _pixmapCacheSize */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setClientID(const QString &/* _clientID */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setClientVersion(const QString &/* _clientVersion */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QStringList SettingsCache::getCountries() const
|
||||||
|
{
|
||||||
|
static QStringList countries = QStringList() << "us";
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
void SettingsCache::setGameDescription(const QString /* _gameDescription */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMaxPlayers(const int /* _maxPlayers */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setGameTypes(const QString /* _gameTypes */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setOnlyBuddies(const bool /* _onlyBuddies */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setOnlyRegistered(const bool /* _onlyRegistered */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsAllowed(const bool /* _spectatorsAllowed */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsNeedPassword(const bool /* _spectatorsNeedPassword */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsCanTalk(const bool /* _spectatorsCanTalk */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setSpectatorsCanSeeEverything(const bool /* _spectatorsCanSeeEverything */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotifyAboutUpdate(int /* _notifyaboutupdate */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setNotifyAboutNewVersion(int /* _notifyaboutnewversion */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDownloadSpoilerStatus(bool /* _spoilerStatus */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setUpdateReleaseChannel(int /* _updateReleaseChannel */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setMaxFontSize(int /* _max */)
|
||||||
{
|
{
|
||||||
return *cardDatabaseSettings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache *settingsCache;
|
SettingsCache *settingsCache;
|
||||||
|
|
||||||
|
SettingsCache& SettingsCache::instance()
|
||||||
|
{
|
||||||
|
return *settingsCache;
|
||||||
|
}
|
||||||
|
|
|
@ -6,46 +6,15 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#define PICTURELOADER_H
|
||||||
|
|
||||||
#include "../../cockatrice/src/carddatabase.h"
|
#include "../../cockatrice/src/carddatabase.h"
|
||||||
|
#include "../../cockatrice/src/settingscache.h"
|
||||||
#define SETTINGSCACHE_H
|
|
||||||
|
|
||||||
|
|
||||||
class CardDatabaseSettings
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setSortKey(QString shortName, unsigned int sortKey);
|
|
||||||
void setEnabled(QString shortName, bool enabled);
|
|
||||||
void setIsKnown(QString shortName, bool isknown);
|
|
||||||
|
|
||||||
unsigned int getSortKey(QString shortName);
|
|
||||||
bool isEnabled(QString shortName);
|
|
||||||
bool isKnown(QString shortName);
|
|
||||||
};
|
|
||||||
|
|
||||||
class SettingsCache : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
|
||||||
CardDatabaseSettings *cardDatabaseSettings;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SettingsCache();
|
|
||||||
~SettingsCache();
|
|
||||||
QString getCustomCardDatabasePath() const;
|
|
||||||
QString getCardDatabasePath() const;
|
|
||||||
QString getTokenDatabasePath() const;
|
|
||||||
QString getSpoilerCardDatabasePath() const;
|
|
||||||
CardDatabaseSettings &cardDatabase() const;
|
|
||||||
signals:
|
|
||||||
void cardDatabasePathChanged();
|
|
||||||
};
|
|
||||||
|
|
||||||
extern SettingsCache *settingsCache;
|
extern SettingsCache *settingsCache;
|
||||||
|
|
||||||
#define PICTURELOADER_H
|
|
||||||
|
|
||||||
class PictureLoader
|
class PictureLoader
|
||||||
{
|
{
|
||||||
void clearPixmapCache(CardInfoPtr card);
|
public:
|
||||||
|
static void clearPixmapCache(CardInfoPtr card);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue