mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 04:43:56 -07:00
Merge branch 'master' into tooomm-qt5
This commit is contained in:
commit
ae9ce701f4
290 changed files with 10683 additions and 4451 deletions
|
|
@ -6,12 +6,12 @@
|
|||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrlQuery>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
#include <version_string.h>
|
||||
|
||||
DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent)
|
||||
: QObject(parent), cardDatabase(_cardDatabase)
|
||||
DeckStatsInterface::DeckStatsInterface(QObject *parent) : QObject(parent)
|
||||
{
|
||||
manager = new QNetworkAccessManager(this);
|
||||
connect(manager, &QNetworkAccessManager::finished, this, &DeckStatsInterface::queryFinished);
|
||||
|
|
@ -70,8 +70,8 @@ void DeckStatsInterface::analyzeDeck(const DeckList &deck)
|
|||
|
||||
void DeckStatsInterface::copyDeckWithoutTokens(const DeckList &source, DeckList &destination)
|
||||
{
|
||||
auto copyIfNotAToken = [this, &destination](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
||||
auto copyIfNotAToken = [&destination](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
||||
if (dbCard && !dbCard->getIsToken()) {
|
||||
DecklistCardNode *addedCard = destination.addCard(card->getName(), node->getName(), -1);
|
||||
addedCard->setNumber(card->getNumber());
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef DECKSTATS_INTERFACE_H
|
||||
#define DECKSTATS_INTERFACE_H
|
||||
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
|
||||
class QByteArray;
|
||||
|
|
@ -21,8 +20,6 @@ class DeckStatsInterface : public QObject
|
|||
private:
|
||||
QNetworkAccessManager *manager;
|
||||
|
||||
CardDatabase &cardDatabase;
|
||||
|
||||
/**
|
||||
* Deckstats doesn't recognize token cards, and instead tries to find the
|
||||
* closest non-token card instead. So we construct a new deck which has no
|
||||
|
|
@ -35,7 +32,7 @@ private slots:
|
|||
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
|
||||
|
||||
public:
|
||||
explicit DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
||||
explicit DeckStatsInterface(QObject *parent = nullptr);
|
||||
void analyzeDeck(const DeckList &deck);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrlQuery>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
#include <version_string.h>
|
||||
|
||||
TappedOutInterface::TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent)
|
||||
: QObject(parent), cardDatabase(_cardDatabase)
|
||||
TappedOutInterface::TappedOutInterface(QObject *parent) : QObject(parent)
|
||||
{
|
||||
manager = new QNetworkAccessManager(this);
|
||||
connect(manager, &QNetworkAccessManager::finished, this, &TappedOutInterface::queryFinished);
|
||||
|
|
@ -97,8 +97,8 @@ void TappedOutInterface::analyzeDeck(const DeckList &deck)
|
|||
|
||||
void TappedOutInterface::copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard)
|
||||
{
|
||||
auto copyMainOrSide = [this, &mainboard, &sideboard](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = cardDatabase.query()->getCardInfo(card->getName());
|
||||
auto copyMainOrSide = [&mainboard, &sideboard](const auto node, const auto card) {
|
||||
CardInfoPtr dbCard = CardDatabaseManager::query()->getCardInfo(card->getName());
|
||||
if (!dbCard || dbCard->getIsToken()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef TAPPEDOUT_INTERFACE_H
|
||||
#define TAPPEDOUT_INTERFACE_H
|
||||
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <QLoggingCategory>
|
||||
#include <QObject>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface");
|
||||
|
||||
|
|
@ -29,14 +29,13 @@ class TappedOutInterface : public QObject
|
|||
private:
|
||||
QNetworkAccessManager *manager;
|
||||
|
||||
CardDatabase &cardDatabase;
|
||||
void copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard);
|
||||
private slots:
|
||||
void queryFinished(QNetworkReply *reply);
|
||||
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
|
||||
|
||||
public:
|
||||
explicit TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
|
||||
explicit TappedOutInterface(QObject *parent = nullptr);
|
||||
void analyzeDeck(const DeckList &deck);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -309,9 +309,11 @@ SettingsCache::SettingsCache()
|
|||
cardViewExpandedRowsMax = settings->value("interface/cardViewExpandedRowsMax", 20).toInt();
|
||||
closeEmptyCardView = settings->value("interface/closeEmptyCardView", true).toBool();
|
||||
focusCardViewSearchBar = settings->value("interface/focusCardViewSearchBar", true).toBool();
|
||||
keepGameChatFocus = settings->value("interface/keepGameChatFocus", false).toBool();
|
||||
|
||||
showDragSelectionCount = settings->value("interface/showlassoselectioncount", true).toBool();
|
||||
showTotalSelectionCount = settings->value("interface/showpersistentselectioncount", true).toBool();
|
||||
showSubtypeSelectionTally = settings->value("interface/showsubtypeselectiontally", true).toBool();
|
||||
|
||||
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
||||
showGameSelectorFilterToolbar = settings->value("menu/showgameselectorfiltertoolbar", true).toBool();
|
||||
|
|
@ -370,6 +372,7 @@ SettingsCache::SettingsCache()
|
|||
|
||||
openDeckInNewTab = settings->value("editor/openDeckInNewTab", false).toBool();
|
||||
rewindBufferingMs = settings->value("replay/rewindBufferingMs", 200).toInt();
|
||||
styleUserList = settings->value("appearance/styleUserList", true).toBool();
|
||||
chatMention = settings->value("chat/mention", true).toBool();
|
||||
chatMentionCompleter = settings->value("chat/mentioncompleter", true).toBool();
|
||||
chatMentionForeground = settings->value("chat/mentionforeground", true).toBool();
|
||||
|
|
@ -388,6 +391,7 @@ SettingsCache::SettingsCache()
|
|||
|
||||
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
|
||||
ignoreUnregisteredUserMessages = settings->value("chat/ignore_unregistered_messages", false).toBool();
|
||||
ignoreNonBuddyUserMessages = settings->value("chat/ignore_nonbuddy_messages", false).toBool();
|
||||
|
||||
scaleCards = settings->value("cards/scaleCards", true).toBool();
|
||||
verticalCardOverlapPercent = settings->value("cards/verticalCardOverlapPercent", 33).toInt();
|
||||
|
|
@ -456,6 +460,13 @@ void SettingsCache::setFocusCardViewSearchBar(QT_STATE_CHANGED_T value)
|
|||
settings->setValue("interface/focusCardViewSearchBar", focusCardViewSearchBar);
|
||||
}
|
||||
|
||||
void SettingsCache::setKeepGameChatFocus(QT_STATE_CHANGED_T value)
|
||||
{
|
||||
keepGameChatFocus = value;
|
||||
settings->setValue("interface/keepGameChatFocus", keepGameChatFocus);
|
||||
emit keepGameChatFocusChanged(keepGameChatFocus);
|
||||
}
|
||||
|
||||
void SettingsCache::setKnownMissingFeatures(const QString &_knownMissingFeatures)
|
||||
{
|
||||
knownMissingFeatures = _knownMissingFeatures;
|
||||
|
|
@ -1036,6 +1047,13 @@ void SettingsCache::setRewindBufferingMs(int _rewindBufferingMs)
|
|||
settings->setValue("replay/rewindBufferingMs", rewindBufferingMs);
|
||||
}
|
||||
|
||||
void SettingsCache::setStyleUserList(QT_STATE_CHANGED_T _styleUserList)
|
||||
{
|
||||
styleUserList = static_cast<bool>(_styleUserList);
|
||||
settings->setValue("appearance/styleUserList", styleUserList);
|
||||
emit styleUserListChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setChatMention(QT_STATE_CHANGED_T _chatMention)
|
||||
{
|
||||
chatMention = static_cast<bool>(_chatMention);
|
||||
|
|
@ -1117,6 +1135,12 @@ void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignore
|
|||
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
|
||||
}
|
||||
|
||||
void SettingsCache::setIgnoreNonBuddyUserMessages(QT_STATE_CHANGED_T _ignoreNonBuddyUserMessages)
|
||||
{
|
||||
ignoreNonBuddyUserMessages = static_cast<bool>(_ignoreNonBuddyUserMessages);
|
||||
settings->setValue("chat/ignore_nonbuddy_messages", ignoreNonBuddyUserMessages);
|
||||
}
|
||||
|
||||
void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
||||
{
|
||||
pixmapCacheSize = _pixmapCacheSize;
|
||||
|
|
@ -1372,6 +1396,12 @@ void SettingsCache::setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSele
|
|||
settings->setValue("interface/showpersistentselectioncount", showTotalSelectionCount);
|
||||
}
|
||||
|
||||
void SettingsCache::setShowSubtypeSelectionTally(QT_STATE_CHANGED_T _showSubtypeSelectionTally)
|
||||
{
|
||||
showSubtypeSelectionTally = static_cast<bool>(_showSubtypeSelectionTally);
|
||||
settings->setValue("interface/showsubtypeselectiontally", showSubtypeSelectionTally);
|
||||
}
|
||||
|
||||
void SettingsCache::loadPaths()
|
||||
{
|
||||
QString dataPath = getDataPath();
|
||||
|
|
|
|||
|
|
@ -183,17 +183,20 @@ signals:
|
|||
void soundThemeChanged();
|
||||
void ignoreUnregisteredUsersChanged();
|
||||
void ignoreUnregisteredUserMessagesChanged();
|
||||
void ignoreNonBuddyUserMessagesChanged();
|
||||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||
void networkCacheSizeChanged(int newSizeInMBs);
|
||||
void redirectCacheTtlChanged(int newTtl);
|
||||
void cardPictureLoaderCacheMethodChanged(int cardPictureLoaderCacheMethod);
|
||||
void localCardImageStorageNamingSchemeChanged(int localCardImageStorageNamingScheme);
|
||||
void masterVolumeChanged(int value);
|
||||
void styleUserListChanged();
|
||||
void chatMentionCompleterChanged();
|
||||
void downloadSpoilerTimeIndexChanged();
|
||||
void downloadSpoilerStatusChanged();
|
||||
void useTearOffMenusChanged(bool state);
|
||||
void roundCardCornersChanged(bool roundCardCorners);
|
||||
void keepGameChatFocusChanged(bool value);
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
|
|
@ -282,6 +285,7 @@ private:
|
|||
bool autoRotateSidewaysLayoutCards;
|
||||
bool openDeckInNewTab;
|
||||
int rewindBufferingMs;
|
||||
bool styleUserList;
|
||||
bool chatMention;
|
||||
bool chatMentionCompleter;
|
||||
QString chatMentionColor;
|
||||
|
|
@ -294,6 +298,7 @@ private:
|
|||
QString soundThemeName;
|
||||
bool ignoreUnregisteredUsers;
|
||||
bool ignoreUnregisteredUserMessages;
|
||||
bool ignoreNonBuddyUserMessages;
|
||||
QString picUrl;
|
||||
QString picUrlFallback;
|
||||
QString clientID;
|
||||
|
|
@ -304,6 +309,7 @@ private:
|
|||
int cardViewExpandedRowsMax;
|
||||
bool closeEmptyCardView;
|
||||
bool focusCardViewSearchBar;
|
||||
bool keepGameChatFocus;
|
||||
int pixmapCacheSize;
|
||||
int networkCacheSize;
|
||||
int redirectCacheTtl;
|
||||
|
|
@ -349,6 +355,7 @@ private:
|
|||
bool showStatusBar;
|
||||
bool showDragSelectionCount;
|
||||
bool showTotalSelectionCount;
|
||||
bool showSubtypeSelectionTally;
|
||||
|
||||
public:
|
||||
SettingsCache();
|
||||
|
|
@ -472,6 +479,10 @@ public:
|
|||
{
|
||||
return showTotalSelectionCount;
|
||||
}
|
||||
[[nodiscard]] bool getShowSubtypeSelectionTally() const
|
||||
{
|
||||
return showSubtypeSelectionTally;
|
||||
}
|
||||
[[nodiscard]] bool getNotificationsEnabled() const
|
||||
{
|
||||
return notificationsEnabled;
|
||||
|
|
@ -734,6 +745,10 @@ public:
|
|||
{
|
||||
return rewindBufferingMs;
|
||||
}
|
||||
[[nodiscard]] bool getStyleUserList() const
|
||||
{
|
||||
return styleUserList;
|
||||
}
|
||||
[[nodiscard]] bool getChatMention() const
|
||||
{
|
||||
return chatMention;
|
||||
|
|
@ -788,6 +803,10 @@ public:
|
|||
{
|
||||
return ignoreUnregisteredUserMessages;
|
||||
}
|
||||
[[nodiscard]] bool getIgnoreNonBuddyUserMessages() const
|
||||
{
|
||||
return ignoreNonBuddyUserMessages;
|
||||
}
|
||||
[[nodiscard]] int getPixmapCacheSize() const
|
||||
{
|
||||
return pixmapCacheSize;
|
||||
|
|
@ -929,6 +948,7 @@ public:
|
|||
void setCardViewExpandedRowsMax(int value);
|
||||
void setCloseEmptyCardView(QT_STATE_CHANGED_T value);
|
||||
void setFocusCardViewSearchBar(QT_STATE_CHANGED_T value);
|
||||
void setKeepGameChatFocus(QT_STATE_CHANGED_T value);
|
||||
QString getClientID() override
|
||||
{
|
||||
return clientID;
|
||||
|
|
@ -961,6 +981,10 @@ public:
|
|||
{
|
||||
return focusCardViewSearchBar;
|
||||
}
|
||||
[[nodiscard]] bool getKeepGameChatFocus() const
|
||||
{
|
||||
return keepGameChatFocus;
|
||||
}
|
||||
[[nodiscard]] ShortcutsSettings &shortcuts() const
|
||||
{
|
||||
return *shortcutsSettings;
|
||||
|
|
@ -1100,6 +1124,7 @@ public slots:
|
|||
void setAutoRotateSidewaysLayoutCards(QT_STATE_CHANGED_T _autoRotateSidewaysLayoutCards);
|
||||
void setOpenDeckInNewTab(QT_STATE_CHANGED_T _openDeckInNewTab);
|
||||
void setRewindBufferingMs(int _rewindBufferingMs);
|
||||
void setStyleUserList(QT_STATE_CHANGED_T _styleUserList);
|
||||
void setChatMention(QT_STATE_CHANGED_T _chatMention);
|
||||
void setChatMentionCompleter(QT_STATE_CHANGED_T _chatMentionCompleter);
|
||||
void setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground);
|
||||
|
|
@ -1111,6 +1136,7 @@ public slots:
|
|||
void setSoundThemeName(const QString &_soundThemeName);
|
||||
void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers);
|
||||
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
|
||||
void setIgnoreNonBuddyUserMessages(QT_STATE_CHANGED_T _ignoreNonBuddyUserMessages);
|
||||
void setPixmapCacheSize(const int _pixmapCacheSize);
|
||||
void setCardImageCacheMethod(CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod);
|
||||
void setNetworkCacheSizeInMB(const int _networkCacheSize);
|
||||
|
|
@ -1155,5 +1181,6 @@ public slots:
|
|||
void setRoundCardCorners(bool _roundCardCorners);
|
||||
void setShowDragSelectionCount(QT_STATE_CHANGED_T _showDragSelectionCount);
|
||||
void setShowTotalSelectionCount(QT_STATE_CHANGED_T _showTotalSelectionCount);
|
||||
void setShowSubtypeSelectionTally(QT_STATE_CHANGED_T _showSubtypeSelectionTally);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -223,6 +223,10 @@ private:
|
|||
{"TabDeckEditor/aLoadDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck..."),
|
||||
parseSequenceString("Ctrl+O"),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aLoadDeckFromWebsite",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load deck from online service..."),
|
||||
parseSequenceString("Ctrl+Shift+O"),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aLoadDeckFromClipboard",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
|
||||
parseSequenceString("Ctrl+Shift+V"),
|
||||
|
|
@ -283,6 +287,10 @@ private:
|
|||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
|
||||
parseSequenceString("Ctrl+Shift+V"),
|
||||
ShortcutGroup::Game_Lobby)},
|
||||
{"DeckViewContainer/loadFromWebsiteButton",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load from website..."),
|
||||
parseSequenceString("Ctrl+Shift+O"),
|
||||
ShortcutGroup::Game_Lobby)},
|
||||
{"DeckViewContainer/unloadDeckButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Unload Deck"),
|
||||
parseSequenceString("Ctrl+Alt+U"),
|
||||
ShortcutGroup::Game_Lobby)},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue