mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-24 23:36:01 -05:00
Don't use Qt pointers.
Took 1 hour 7 minutes
This commit is contained in:
parent
930e4ae98d
commit
fc6ffffcb9
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
||||
{
|
||||
isSpoilerDownloadEnabled = SettingsCache::instance()->getDownloadSpoilersStatus();
|
||||
isSpoilerDownloadEnabled = SettingsCache::instance().getDownloadSpoilersStatus();
|
||||
if (isSpoilerDownloadEnabled) {
|
||||
// Start the process of checking if we're in spoiler season
|
||||
// File exists means we're in spoiler season
|
||||
|
|
@ -74,7 +74,7 @@ void SpoilerBackgroundUpdater::actDownloadFinishedSpoilersFile()
|
|||
|
||||
bool SpoilerBackgroundUpdater::deleteSpoilerFile()
|
||||
{
|
||||
QString fileName = SettingsCache::instance()->getSpoilerCardDatabasePath();
|
||||
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
||||
QFileInfo fi(fileName);
|
||||
QDir fileDir(fi.path());
|
||||
QFile file(fileName);
|
||||
|
|
@ -125,7 +125,7 @@ void SpoilerBackgroundUpdater::actCheckIfSpoilerSeasonEnabled()
|
|||
|
||||
bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
|
||||
{
|
||||
QString fileName = SettingsCache::instance()->getSpoilerCardDatabasePath();
|
||||
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
||||
QFileInfo fi(fileName);
|
||||
QDir fileDir(fi.path());
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ClientUpdateChecker::ClientUpdateChecker(QObject *parent) : QObject(parent)
|
|||
|
||||
void ClientUpdateChecker::check()
|
||||
{
|
||||
auto releaseChannel = SettingsCache::instance()->getUpdateReleaseChannel();
|
||||
auto releaseChannel = SettingsCache::instance().getUpdateReleaseChannel();
|
||||
|
||||
finishedCheckConnection =
|
||||
connect(releaseChannel, &ReleaseChannel::finishedCheck, this, &ClientUpdateChecker::actFinishedCheck);
|
||||
|
|
|
|||
|
|
@ -14,19 +14,11 @@
|
|||
#include <libcockatrice/settings/card_override_settings.h>
|
||||
#include <utility>
|
||||
|
||||
QSharedPointer<SettingsCache> SettingsCache::settingsInstance = nullptr;
|
||||
Q_GLOBAL_STATIC(SettingsCache, settingsCache)
|
||||
|
||||
QSharedPointer<SettingsCache> SettingsCache::instance()
|
||||
SettingsCache &SettingsCache::instance()
|
||||
{
|
||||
if (!settingsInstance) {
|
||||
settingsInstance.reset(new SettingsCache()); // default real instance
|
||||
}
|
||||
return settingsInstance;
|
||||
}
|
||||
|
||||
void SettingsCache::setInstance(QSharedPointer<SettingsCache> newInstance)
|
||||
{
|
||||
settingsInstance = newInstance;
|
||||
return *settingsCache; // returns a QT managed singleton reference
|
||||
}
|
||||
|
||||
QString SettingsCache::getDataPath()
|
||||
|
|
@ -184,7 +176,7 @@ SettingsCache::SettingsCache()
|
|||
QString settingsPath = getSettingsPath();
|
||||
settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this);
|
||||
shortcutsSettings = new ShortcutsSettings(settingsPath, this);
|
||||
cardDatabaseSettings = QSharedPointer<CardDatabaseSettings>(new CardDatabaseSettings(settingsPath, this));
|
||||
cardDatabaseSettings = new CardDatabaseSettings(settingsPath, this);
|
||||
serversSettings = new ServersSettings(settingsPath, this);
|
||||
messageSettings = new MessageSettings(settingsPath, this);
|
||||
gameFiltersSettings = new GameFiltersSettings(settingsPath, this);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ signals:
|
|||
private:
|
||||
QSettings *settings;
|
||||
ShortcutsSettings *shortcutsSettings;
|
||||
QSharedPointer<CardDatabaseSettings> cardDatabaseSettings;
|
||||
CardDatabaseSettings *cardDatabaseSettings;
|
||||
ServersSettings *serversSettings;
|
||||
MessageSettings *messageSettings;
|
||||
GameFiltersSettings *gameFiltersSettings;
|
||||
|
|
@ -325,11 +325,8 @@ private:
|
|||
bool roundCardCorners;
|
||||
bool showStatusBar;
|
||||
|
||||
explicit SettingsCache();
|
||||
|
||||
static QSharedPointer<SettingsCache> settingsInstance;
|
||||
|
||||
public:
|
||||
SettingsCache();
|
||||
QString getDataPath();
|
||||
QString getSettingsPath();
|
||||
QString getCachePath() const;
|
||||
|
|
@ -895,7 +892,7 @@ public:
|
|||
{
|
||||
return *shortcutsSettings;
|
||||
}
|
||||
QSharedPointer<CardDatabaseSettings> cardDatabase() const
|
||||
CardDatabaseSettings *cardDatabase() const
|
||||
{
|
||||
return cardDatabaseSettings;
|
||||
}
|
||||
|
|
@ -946,8 +943,7 @@ public:
|
|||
return roundCardCorners;
|
||||
}
|
||||
|
||||
static QSharedPointer<SettingsCache> instance();
|
||||
static void setInstance(QSharedPointer<SettingsCache> newInstance);
|
||||
static SettingsCache &instance();
|
||||
void resetPaths();
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ ShortcutTreeView::ShortcutTreeView(QWidget *parent) : QTreeView(parent)
|
|||
|
||||
expandAll();
|
||||
|
||||
connect(&SettingsCache::instance()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&ShortcutTreeView::refreshShortcuts);
|
||||
}
|
||||
|
||||
|
|
@ -67,10 +67,10 @@ void ShortcutTreeView::populateShortcutsModel()
|
|||
{
|
||||
QHash<QString, QStandardItem *> parentItems;
|
||||
QStandardItem *curParent = nullptr;
|
||||
for (const auto &key : SettingsCache::instance()->shortcuts().getAllShortcutKeys()) {
|
||||
QString name = SettingsCache::instance()->shortcuts().getShortcut(key).getName();
|
||||
QString group = SettingsCache::instance()->shortcuts().getShortcut(key).getGroupName();
|
||||
QString shortcut = SettingsCache::instance()->shortcuts().getShortcutString(key);
|
||||
for (const auto &key : SettingsCache::instance().shortcuts().getAllShortcutKeys()) {
|
||||
QString name = SettingsCache::instance().shortcuts().getShortcut(key).getName();
|
||||
QString group = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
|
||||
QString shortcut = SettingsCache::instance().shortcuts().getShortcutString(key);
|
||||
|
||||
if (parentItems.contains(group)) {
|
||||
curParent = parentItems.value(group);
|
||||
|
|
@ -110,7 +110,7 @@ static void loopOverModel(QAbstractItemModel *model, const QModelIndex &parent =
|
|||
if (model->hasChildren(friendlyNameIndex)) {
|
||||
const auto childIndex = model->index(0, 2, friendlyNameIndex);
|
||||
const auto key = model->data(childIndex).toString();
|
||||
const auto shortcutGroupName = SettingsCache::instance()->shortcuts().getShortcut(key).getGroupName();
|
||||
const auto shortcutGroupName = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
|
||||
model->setData(friendlyNameIndex, shortcutGroupName);
|
||||
|
||||
loopOverModel(model, friendlyNameIndex);
|
||||
|
|
@ -119,8 +119,8 @@ static void loopOverModel(QAbstractItemModel *model, const QModelIndex &parent =
|
|||
const auto keyIndex = model->index(r, 2, parent);
|
||||
const auto key = model->data(keyIndex).toString();
|
||||
|
||||
const auto shortcutKey = SettingsCache::instance()->shortcuts().getShortcut(key).getName();
|
||||
const auto shortcutSequence = SettingsCache::instance()->shortcuts().getShortcutString(key);
|
||||
const auto shortcutKey = SettingsCache::instance().shortcuts().getShortcut(key).getName();
|
||||
const auto shortcutSequence = SettingsCache::instance().shortcuts().getShortcutString(key);
|
||||
model->setData(friendlyNameIndex, shortcutKey);
|
||||
model->setData(shortcutSequenceIndex, shortcutSequence);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,8 @@
|
|||
SoundEngine::SoundEngine(QObject *parent) : QObject(parent), audioOutput(nullptr), player(nullptr)
|
||||
{
|
||||
ensureThemeDirectoryExists();
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::soundThemeChanged, this, &SoundEngine::themeChangedSlot);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::soundEnabledChanged, this,
|
||||
&SoundEngine::soundEnabledChanged);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::soundThemeChanged, this, &SoundEngine::themeChangedSlot);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::soundEnabledChanged, this, &SoundEngine::soundEnabledChanged);
|
||||
|
||||
soundEnabledChanged();
|
||||
themeChangedSlot();
|
||||
|
|
@ -37,7 +36,7 @@ SoundEngine::~SoundEngine()
|
|||
|
||||
void SoundEngine::soundEnabledChanged()
|
||||
{
|
||||
if (SettingsCache::instance()->getSoundEnabled()) {
|
||||
if (SettingsCache::instance().getSoundEnabled()) {
|
||||
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
||||
if (!player) {
|
||||
player = new QMediaPlayer;
|
||||
|
|
@ -71,7 +70,7 @@ void SoundEngine::playSound(const QString &fileName)
|
|||
}
|
||||
|
||||
player->stop();
|
||||
int volumeSliderValue = SettingsCache::instance()->getMasterVolume();
|
||||
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
||||
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
||||
|
|
@ -89,10 +88,10 @@ void SoundEngine::testSound()
|
|||
|
||||
void SoundEngine::ensureThemeDirectoryExists()
|
||||
{
|
||||
if (SettingsCache::instance()->getSoundThemeName().isEmpty() ||
|
||||
!getAvailableThemes().contains(SettingsCache::instance()->getSoundThemeName())) {
|
||||
if (SettingsCache::instance().getSoundThemeName().isEmpty() ||
|
||||
!getAvailableThemes().contains(SettingsCache::instance().getSoundThemeName())) {
|
||||
qCInfo(SoundEngineLog) << "Sounds theme name not set, setting default value";
|
||||
SettingsCache::instance()->setSoundThemeName(DEFAULT_THEME_NAME);
|
||||
SettingsCache::instance().setSoundThemeName(DEFAULT_THEME_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +102,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
|
||||
// load themes from user profile dir
|
||||
|
||||
dir.setPath(SettingsCache::instance()->getDataPath() + "/sounds");
|
||||
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
||||
|
||||
for (const QString &themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||
if (!availableThemes.contains(themeName))
|
||||
|
|
@ -131,7 +130,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
|
||||
void SoundEngine::themeChangedSlot()
|
||||
{
|
||||
QString themeName = SettingsCache::instance()->getSoundThemeName();
|
||||
QString themeName = SettingsCache::instance().getSoundThemeName();
|
||||
qCInfo(SoundEngineLog) << "Sound theme changed:" << themeName;
|
||||
|
||||
QDir dir = getAvailableThemes().value(themeName);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
|||
public:
|
||||
QString getCardPreferenceOverride(const QString &cardName) const override
|
||||
{
|
||||
return SettingsCache::instance()->cardOverrides().getCardPreferenceOverride(cardName);
|
||||
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,12 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
|||
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
|
||||
connect(item, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
|
||||
}
|
||||
|
|
@ -48,7 +47,7 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
|||
QPainterPath AbstractCardDragItem::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance()->getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,16 +20,15 @@ AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef
|
|||
setFlag(ItemIsSelectable);
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::displayCardNamesChanged, this, [this] { update(); });
|
||||
connect(&SettingsCache::instance(), &SettingsCache::displayCardNamesChanged, this, [this] { update(); });
|
||||
refreshCardInfo();
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
AbstractCardItem::~AbstractCardItem()
|
||||
|
|
@ -45,7 +44,7 @@ QRectF AbstractCardItem::boundingRect() const
|
|||
QPainterPath AbstractCardItem::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance()->getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
@ -95,7 +94,7 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
|||
|
||||
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
||||
{
|
||||
const int MAX_FONT_SIZE = SettingsCache::instance()->getMaxFontSize();
|
||||
const int MAX_FONT_SIZE = SettingsCache::instance().getMaxFontSize();
|
||||
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
||||
|
||||
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
||||
|
|
@ -144,7 +143,7 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
|||
painter->drawPath(shape());
|
||||
}
|
||||
|
||||
if (translatedPixmap.isNull() || SettingsCache::instance()->getDisplayCardNames() || facedown) {
|
||||
if (translatedPixmap.isNull() || SettingsCache::instance().getDisplayCardNames() || facedown) {
|
||||
painter->save();
|
||||
transformPainter(painter, translatedSize, angle);
|
||||
painter->setPen(Qt::white);
|
||||
|
|
@ -155,7 +154,7 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
|||
nameStr = "# " + QString::number(id);
|
||||
else {
|
||||
QString prefix = "";
|
||||
if (SettingsCache::instance()->debug().getShowCardId()) {
|
||||
if (SettingsCache::instance().debug().getShowCardId()) {
|
||||
prefix = "#" + QString::number(id) + " ";
|
||||
}
|
||||
nameStr = prefix + cardRef.name;
|
||||
|
|
@ -216,7 +215,7 @@ void AbstractCardItem::setHovered(bool _hovered)
|
|||
processHoverEvent();
|
||||
isHovered = _hovered;
|
||||
setZValue(_hovered ? 2000000004 : realZValue);
|
||||
setScale(_hovered && SettingsCache::instance()->getScaleCards() ? 1.1 : 1);
|
||||
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
|
||||
setTransformOriginPoint(_hovered ? CARD_WIDTH / 2 : 0, _hovered ? CARD_HEIGHT / 2 : 0);
|
||||
update();
|
||||
}
|
||||
|
|
@ -268,7 +267,7 @@ void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
|
|||
return;
|
||||
|
||||
tapped = _tapped;
|
||||
if (SettingsCache::instance()->getTapAnimation() && canAnimate)
|
||||
if (SettingsCache::instance().getTapAnimation() && canAnimate)
|
||||
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
||||
else {
|
||||
tapAngle = tapped ? 90 : 0;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ AbstractCounter::AbstractCounter(Player *_player,
|
|||
menu = nullptr;
|
||||
}
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&AbstractCounter::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
retranslateUi();
|
||||
|
|
@ -88,7 +88,7 @@ void AbstractCounter::setShortcutsActive()
|
|||
if (!player->getPlayerInfo()->getLocal()) {
|
||||
return;
|
||||
}
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
if (name == "life") {
|
||||
shortcutActive = true;
|
||||
aSet->setShortcuts(shortcuts.getShortcut("Player/aSet"));
|
||||
|
|
|
|||
|
|
@ -238,12 +238,12 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
if (startZone->getName().compare("hand") == 0) {
|
||||
startCard->playCard(false);
|
||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||
if (ci && ((!SettingsCache::instance()->getPlayToStack() && ci->getTableRow() == 3) ||
|
||||
(SettingsCache::instance()->getPlayToStack() && ci->getTableRow() != 0 &&
|
||||
if (ci && ((!SettingsCache::instance().getPlayToStack() && ci->getTableRow() == 3) ||
|
||||
(SettingsCache::instance().getPlayToStack() && ci->getTableRow() != 0 &&
|
||||
startCard->getZone()->getName().toStdString() != "stack")))
|
||||
cmd.set_start_zone("stack");
|
||||
else
|
||||
cmd.set_start_zone(SettingsCache::instance()->getPlayToStack() ? "stack" : "table");
|
||||
cmd.set_start_zone(SettingsCache::instance().getPlayToStack() ? "stack" : "table");
|
||||
}
|
||||
player->getPlayerActions()->sendGameCommand(cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,10 @@ CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef
|
|||
{
|
||||
owner->addCard(this);
|
||||
|
||||
connect(&SettingsCache::instance().get()->cardCounters(), &CardCounterSettings::colorChanged, this,
|
||||
[this](int counterId) {
|
||||
if (counters.contains(counterId))
|
||||
update();
|
||||
});
|
||||
connect(&SettingsCache::instance().cardCounters(), &CardCounterSettings::colorChanged, this, [this](int counterId) {
|
||||
if (counters.contains(counterId))
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
void CardItem::prepareDelete()
|
||||
|
|
@ -72,7 +71,7 @@ void CardItem::retranslateUi()
|
|||
|
||||
void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
auto &cardCounterSettings = SettingsCache::instance()->cardCounters();
|
||||
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
||||
|
||||
painter->save();
|
||||
AbstractCardItem::paint(painter, option, widget);
|
||||
|
|
@ -380,7 +379,7 @@ void CardItem::playCard(bool faceDown)
|
|||
if (tz)
|
||||
emit tz->toggleTapped();
|
||||
else {
|
||||
if (SettingsCache::instance()->getClickPlaysAllSelected()) {
|
||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
||||
faceDown ? zone->getPlayer()->getPlayerActions()->actPlayFacedown()
|
||||
: zone->getPlayer()->getPlayerActions()->actPlay();
|
||||
} else {
|
||||
|
|
@ -410,7 +409,7 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
|
|||
void CardItem::handleClickedToPlay(bool shiftHeld)
|
||||
{
|
||||
if (isUnwritableRevealZone(zone)) {
|
||||
if (SettingsCache::instance()->getClickPlaysAllSelected()) {
|
||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
||||
zone->getPlayer()->getPlayerActions()->actHide();
|
||||
} else {
|
||||
zone->removeCard(this);
|
||||
|
|
@ -432,7 +431,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
}
|
||||
}
|
||||
} else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
||||
(!SettingsCache::instance()->getDoubleClickToPlay())) {
|
||||
(!SettingsCache::instance().getDoubleClickToPlay())) {
|
||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||
}
|
||||
|
||||
|
|
@ -445,7 +444,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if ((event->modifiers() != Qt::AltModifier) && (event->buttons() == Qt::LeftButton) &&
|
||||
(SettingsCache::instance()->getDoubleClickToPlay())) {
|
||||
(SettingsCache::instance().getDoubleClickToPlay())) {
|
||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||
}
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -73,12 +73,11 @@ DeckViewCard::DeckViewCard(QGraphicsItem *parent, const CardRef &cardRef, const
|
|||
{
|
||||
setAcceptHoverEvents(true);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
update();
|
||||
});
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
DeckViewCard::~DeckViewCard()
|
||||
|
|
@ -96,7 +95,7 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||
pen.setJoinStyle(Qt::MiterJoin);
|
||||
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
||||
painter->setPen(pen);
|
||||
qreal cardRadius = SettingsCache::instance()->getRoundCardCorners() ? 0.05 * (CARD_WIDTH - 3) : 0.0;
|
||||
qreal cardRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * (CARD_WIDTH - 3) : 0.0;
|
||||
painter->drawRoundedRect(QRectF(1.5, 1.5, CARD_WIDTH - 3., CARD_HEIGHT - 3.), cardRadius, cardRadius);
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,11 +95,11 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
|||
setLayout(deckViewLayout);
|
||||
|
||||
retranslateUi();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&DeckViewContainer::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||
&DeckViewContainer::setVisualDeckStorageExists);
|
||||
|
||||
switchToDeckSelectView();
|
||||
|
|
@ -142,7 +142,7 @@ static void setVisibility(QPushButton *button, bool visible)
|
|||
|
||||
void DeckViewContainer::switchToDeckSelectView()
|
||||
{
|
||||
if (SettingsCache::instance()->getVisualDeckStorageInGame()) {
|
||||
if (SettingsCache::instance().getVisualDeckStorageInGame()) {
|
||||
deckView->setHidden(true);
|
||||
|
||||
tryCreateVisualDeckStorageWidget();
|
||||
|
|
@ -203,13 +203,13 @@ void DeckViewContainer::updateSideboardLockButtonText()
|
|||
sideboardLockButton->setText(tr("Sideboard locked"));
|
||||
}
|
||||
// setting text on a button removes its shortcut
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
|
||||
}
|
||||
|
||||
void DeckViewContainer::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
loadLocalButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadLocalButton"));
|
||||
loadRemoteButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadRemoteButton"));
|
||||
loadFromClipboardButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/loadFromClipboardButton"));
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
|||
chooseTokenFromDeckRadioButton = new QRadioButton(tr("Show tokens from this &deck"));
|
||||
connect(chooseTokenFromDeckRadioButton, &QRadioButton::toggled, this, &DlgCreateToken::actChooseTokenFromDeck);
|
||||
|
||||
QByteArray deckHeaderState = SettingsCache::instance()->layouts().getDeckEditorDbHeaderState();
|
||||
QByteArray deckHeaderState = SettingsCache::instance().layouts().getDeckEditorDbHeaderState();
|
||||
chooseTokenView = new QTreeView;
|
||||
chooseTokenView->setModel(cardDatabaseDisplayModel);
|
||||
chooseTokenView->setUniformRowHeights(true);
|
||||
|
|
@ -151,13 +151,13 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
|||
setWindowTitle(tr("Create token"));
|
||||
|
||||
resize(600, 500);
|
||||
restoreGeometry(SettingsCache::instance()->getTokenDialogGeometry());
|
||||
restoreGeometry(SettingsCache::instance().getTokenDialogGeometry());
|
||||
}
|
||||
|
||||
void DlgCreateToken::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
SettingsCache::instance()->setTokenDialogGeometry(saveGeometry());
|
||||
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||
}
|
||||
|
||||
void DlgCreateToken::faceDownCheckBoxToggled(bool checked)
|
||||
|
|
@ -190,7 +190,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
|||
const QChar cardColor = cardInfo->getColorChar();
|
||||
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||
ptEdit->setText(cardInfo->getPowTough());
|
||||
if (SettingsCache::instance()->getAnnotateTokens())
|
||||
if (SettingsCache::instance().getAnnotateTokens())
|
||||
annotationEdit->setText(cardInfo->getText());
|
||||
} else {
|
||||
nameEdit->setText("");
|
||||
|
|
@ -234,13 +234,13 @@ void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
|||
|
||||
void DlgCreateToken::actOk()
|
||||
{
|
||||
SettingsCache::instance()->setTokenDialogGeometry(saveGeometry());
|
||||
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||
accept();
|
||||
}
|
||||
|
||||
void DlgCreateToken::actReject()
|
||||
{
|
||||
SettingsCache::instance()->setTokenDialogGeometry(saveGeometry());
|
||||
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
|
||||
reject();
|
||||
}
|
||||
|
||||
|
|
@ -252,5 +252,5 @@ TokenInfo DlgCreateToken::getTokenInfo() const
|
|||
.annotation = annotationEdit->text(),
|
||||
.destroy = destroyCheckBox->isChecked(),
|
||||
.faceDown = faceDownCheckBox->isChecked(),
|
||||
.providerId = SettingsCache::instance()->cardOverrides().getCardPreferenceOverride(nameEdit->text())};
|
||||
.providerId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(nameEdit->text())};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent)
|
|||
{
|
||||
animationTimer = new QBasicTimer;
|
||||
addItem(phasesToolbar);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::minPlayersForMultiColumnLayoutChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::minPlayersForMultiColumnLayoutChanged, this,
|
||||
&GameScene::rearrange);
|
||||
|
||||
rearrange();
|
||||
|
|
@ -206,7 +206,7 @@ QList<Player *> GameScene::rotatePlayers(const QList<Player *> &activePlayers, i
|
|||
|
||||
int GameScene::determineColumnCount(int playerCount)
|
||||
{
|
||||
return playerCount < SettingsCache::instance()->getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||
return playerCount < SettingsCache::instance().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
|||
|
||||
connect(aCloseMostRecentZoneView, &QAction::triggered, scene, &GameScene::closeMostRecentZoneView);
|
||||
addAction(aCloseMostRecentZoneView);
|
||||
connect(&SettingsCache::instance()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&GameView::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
||||
|
|
@ -67,5 +67,5 @@ void GameView::stopRubberBand()
|
|||
void GameView::refreshShortcuts()
|
||||
{
|
||||
aCloseMostRecentZoneView->setShortcuts(
|
||||
SettingsCache::instance()->shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
||||
SettingsCache::instance().shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c
|
|||
finalStr = tr("%1 removes %2 \"%3\" counter(s) from %4 (now %5).", "", delta);
|
||||
}
|
||||
|
||||
auto &cardCounterSettings = SettingsCache::instance()->cardCounters();
|
||||
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
||||
appendHtmlServerMessage(finalStr.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
|
||||
.arg("<font class=\"blue\">" + QString::number(delta) + "</font>")
|
||||
.arg(cardCounterSettings.displayName(counterId))
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ void CardMenu::addRelatedCardActions()
|
|||
if (createRelatedCards) {
|
||||
if (shortcutsActive) {
|
||||
createRelatedCards->setShortcuts(
|
||||
SettingsCache::instance()->shortcuts().getShortcut("Player/aCreateRelatedTokens"));
|
||||
SettingsCache::instance().shortcuts().getShortcut("Player/aCreateRelatedTokens"));
|
||||
}
|
||||
connect(createRelatedCards, &QAction::triggered, player->getPlayerActions(),
|
||||
&PlayerActions::actCreateAllRelatedCards);
|
||||
|
|
@ -447,7 +447,7 @@ void CardMenu::retranslateUi()
|
|||
|
||||
mCardCounters->setTitle(tr("Ca&rd counters"));
|
||||
|
||||
auto &cardCounterSettings = SettingsCache::instance()->cardCounters();
|
||||
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
||||
|
||||
for (int i = 0; i < aAddCounter.size(); ++i) {
|
||||
aAddCounter[i]->setText(tr("&Add counter (%1)").arg(cardCounterSettings.displayName(i)));
|
||||
|
|
@ -462,7 +462,7 @@ void CardMenu::retranslateUi()
|
|||
|
||||
void CardMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aHide->setShortcuts(shortcuts.getShortcut("Player/aHide"));
|
||||
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void GraveyardMenu::retranslateUi()
|
|||
|
||||
void GraveyardMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aViewGraveyard->setShortcuts(shortcuts.getShortcut("Player/aViewGraveyard"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void HandMenu::retranslateUi()
|
|||
|
||||
void HandMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aViewHand->setShortcuts(shortcuts.getShortcut("Player/aViewHand"));
|
||||
aSortHand->setShortcuts(shortcuts.getShortcut("Player/aSortHand"));
|
||||
aMulligan->setShortcuts(shortcuts.getShortcut("Player/aMulligan"));
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ void LibraryMenu::onRevealTopCardTriggered()
|
|||
|
||||
void LibraryMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aViewLibrary->setShortcuts(shortcuts.getShortcut("Player/aViewLibrary"));
|
||||
aViewTopCards->setShortcuts(shortcuts.getShortcut("Player/aViewTopCards"));
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ MoveMenu::MoveMenu(Player *player) : QMenu(tr("Move to"))
|
|||
|
||||
void MoveMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aMoveToTopLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToTopLibrary"));
|
||||
aMoveToBottomLibrary->setShortcuts(shortcuts.getShortcut("Player/aMoveToBottomLibrary"));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
|||
sayMenu = nullptr;
|
||||
}
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&PlayerMenu::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void PtMenu::retranslateUi()
|
|||
|
||||
void PtMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aIncP->setShortcuts(shortcuts.getShortcut("Player/aIncP"));
|
||||
aDecP->setShortcuts(shortcuts.getShortcut("Player/aDecP"));
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
SayMenu::SayMenu(Player *_player) : player(_player)
|
||||
{
|
||||
connect(&SettingsCache::instance().get()->messages(), &MessageSettings::messageMacrosChanged, this,
|
||||
&SayMenu::initSayMenu);
|
||||
connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu);
|
||||
initSayMenu();
|
||||
}
|
||||
|
||||
|
|
@ -15,11 +14,11 @@ void SayMenu::initSayMenu()
|
|||
{
|
||||
clear();
|
||||
|
||||
int count = SettingsCache::instance()->messages().getCount();
|
||||
int count = SettingsCache::instance().messages().getCount();
|
||||
setEnabled(count > 0);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
auto *newAction = new QAction(SettingsCache::instance()->messages().getMessageAt(i), this);
|
||||
auto *newAction = new QAction(SettingsCache::instance().messages().getMessageAt(i), this);
|
||||
if (i < 10) {
|
||||
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void SideboardMenu::retranslateUi()
|
|||
|
||||
void SideboardMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aViewSideboard->setShortcuts(shortcuts.getShortcut("Player/aViewSideboard"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void UtilityMenu::retranslateUi()
|
|||
|
||||
void UtilityMenu::setShortcutsActive()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
if (player->getPlayerInfo()->getLocalOrJudge()) {
|
||||
aIncrementAllCardCounters->setShortcuts(shortcuts.getShortcut("Player/aIncrementAllCardCounters"));
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
|
|||
const CardInfo &info = exactCard.getInfo();
|
||||
|
||||
int tableRow = info.getTableRow();
|
||||
bool playToStack = SettingsCache::instance()->getPlayToStack();
|
||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
||||
QString currentZone = card->getZone()->getName();
|
||||
if (currentZone == "stack" && tableRow == 3) {
|
||||
cmd.set_target_zone("grave");
|
||||
|
|
@ -280,7 +280,7 @@ void PlayerActions::actDrawCard()
|
|||
|
||||
void PlayerActions::actMulligan()
|
||||
{
|
||||
int startSize = SettingsCache::instance()->getStartingHandSize();
|
||||
int startSize = SettingsCache::instance().getStartingHandSize();
|
||||
int handSize = player->getHandZone()->getCards().size();
|
||||
int deckSize = player->getDeckZone()->getCards().size() + handSize; // hand is shuffled back into the deck
|
||||
bool ok;
|
||||
|
|
@ -302,7 +302,7 @@ void PlayerActions::actMulligan()
|
|||
}
|
||||
sendGameCommand(cmd);
|
||||
if (startSize != number) {
|
||||
SettingsCache::instance()->setStartingHandSize(number);
|
||||
SettingsCache::instance().setStartingHandSize(number);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -878,10 +878,10 @@ void PlayerActions::setLastToken(CardInfoPtr cardInfo)
|
|||
lastTokenInfo = {.name = cardInfo->getName(),
|
||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||
.pt = cardInfo->getPowTough(),
|
||||
.annotation = SettingsCache::instance()->getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.annotation = SettingsCache::instance().getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.destroy = true,
|
||||
.providerId =
|
||||
SettingsCache::instance()->cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
|
||||
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
|
||||
|
||||
|
|
@ -1072,7 +1072,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
|
|||
}
|
||||
|
||||
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||
if (SettingsCache::instance()->getAnnotateTokens()) {
|
||||
if (SettingsCache::instance().getAnnotateTokens()) {
|
||||
cmd.set_annotation(cardInfo->getText().toStdString());
|
||||
} else {
|
||||
cmd.set_annotation("");
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
|
||||
{
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::horizontalHandChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
|
||||
&PlayerGraphicsItem::rearrangeZones);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::handJustificationChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this,
|
||||
&PlayerGraphicsItem::rearrangeZones);
|
||||
connect(player, &Player::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ qreal PlayerGraphicsItem::getMinimumWidth() const
|
|||
{
|
||||
qreal result = tableZoneGraphicsItem->getMinimumWidth() + CARD_HEIGHT + 15 + counterAreaWidth +
|
||||
stackZoneGraphicsItem->boundingRect().width();
|
||||
if (!SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (!SettingsCache::instance().getHorizontalHand()) {
|
||||
result += handZoneGraphicsItem->boundingRect().width();
|
||||
}
|
||||
return result;
|
||||
|
|
@ -109,7 +109,7 @@ void PlayerGraphicsItem::processSceneSizeChange(int newPlayerWidth)
|
|||
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
||||
qreal tableWidth =
|
||||
newPlayerWidth - CARD_HEIGHT - 15 - counterAreaWidth - stackZoneGraphicsItem->boundingRect().width();
|
||||
if (!SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (!SettingsCache::instance().getHorizontalHand()) {
|
||||
tableWidth -= handZoneGraphicsItem->boundingRect().width();
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ void PlayerGraphicsItem::rearrangeCounters()
|
|||
void PlayerGraphicsItem::rearrangeZones()
|
||||
{
|
||||
QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0);
|
||||
if (SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
if (mirrored) {
|
||||
if (player->getHandZone()->contentsKnown()) {
|
||||
player->getPlayerInfo()->setHandVisible(true);
|
||||
|
|
@ -199,7 +199,7 @@ void PlayerGraphicsItem::updateBoundingRect()
|
|||
{
|
||||
prepareGeometryChange();
|
||||
qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stackZoneGraphicsItem->boundingRect().width();
|
||||
if (SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
qreal handHeight =
|
||||
player->getPlayerInfo()->getHandVisible() ? handZoneGraphicsItem->boundingRect().height() : 0;
|
||||
bRect = QRectF(0, 0, width + tableZoneGraphicsItem->boundingRect().width(),
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
|||
{
|
||||
QPoint point = dropPoint + scenePos().toPoint();
|
||||
int x = -1;
|
||||
if (SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
for (x = 0; x < getLogic()->getCards().size(); x++)
|
||||
if (point.x() < static_cast<CardItem *>(getLogic()->getCards().at(x))->scenePos().x())
|
||||
break;
|
||||
|
|
@ -54,7 +54,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
|||
|
||||
QRectF HandZone::boundingRect() const
|
||||
{
|
||||
if (SettingsCache::instance()->getHorizontalHand())
|
||||
if (SettingsCache::instance().getHorizontalHand())
|
||||
return QRectF(0, 0, width, CARD_HEIGHT + 10);
|
||||
else
|
||||
return QRectF(0, 0, 100, zoneHeight);
|
||||
|
|
@ -70,8 +70,8 @@ void HandZone::reorganizeCards()
|
|||
{
|
||||
if (!getLogic()->getCards().isEmpty()) {
|
||||
const int cardCount = getLogic()->getCards().size();
|
||||
if (SettingsCache::instance()->getHorizontalHand()) {
|
||||
bool leftJustified = SettingsCache::instance()->getLeftJustified();
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
bool leftJustified = SettingsCache::instance().getLeftJustified();
|
||||
qreal cardWidth = getLogic()->getCards().at(0)->boundingRect().width();
|
||||
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
||||
qreal totalWidth =
|
||||
|
|
@ -122,7 +122,7 @@ void HandZone::sortHand()
|
|||
|
||||
void HandZone::setWidth(qreal _width)
|
||||
{
|
||||
if (SettingsCache::instance()->getHorizontalHand()) {
|
||||
if (SettingsCache::instance().getHorizontalHand()) {
|
||||
prepareGeometryChange();
|
||||
width = _width;
|
||||
reorganizeCards();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ bool ZoneViewZoneLogic::prepareAddCard(int x)
|
|||
|
||||
// autoclose check is done both here and in removeCard
|
||||
|
||||
if (cards.isEmpty() && !doInsert && SettingsCache::instance()->getCloseEmptyCardView()) {
|
||||
if (cards.isEmpty() && !doInsert && SettingsCache::instance().getCloseEmptyCardView()) {
|
||||
emit closeView();
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ void ZoneViewZoneLogic::removeCard(int position, bool toNewZone)
|
|||
// card gets dragged within the view.
|
||||
// Another autoclose check is done in prepareAddCard so that the view autocloses if the last card was moved to an
|
||||
// unrevealed portion of the same zone.
|
||||
if (cards.isEmpty() && SettingsCache::instance()->getCloseEmptyCardView() && toNewZone) {
|
||||
if (cards.isEmpty() && SettingsCache::instance().getCloseEmptyCardView() && toNewZone) {
|
||||
emit closeView();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,12 @@ PileZone::PileZone(PileZoneLogic *_logic, QGraphicsItem *parent) : CardZone(_log
|
|||
.rotate(90)
|
||||
.translate((float)-CARD_WIDTH / 2, (float)-CARD_HEIGHT / 2));
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
prepareGeometryChange();
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
QRectF PileZone::boundingRect() const
|
||||
|
|
@ -39,7 +38,7 @@ QRectF PileZone::boundingRect() const
|
|||
QPainterPath PileZone::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance()->getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse)
|
||||
{
|
||||
qreal cardMinOverlap = cardHeight * SettingsCache::instance()->getStackCardOverlapPercent() / 100;
|
||||
qreal cardMinOverlap = cardHeight * SettingsCache::instance().getStackCardOverlapPercent() / 100;
|
||||
qreal desiredHeight = cardHeight * cardCount - cardMinOverlap * (cardCount - 1);
|
||||
qreal y;
|
||||
if (desiredHeight > totalHeight) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ TableZone::TableZone(TableZoneLogic *_logic, QGraphicsItem *parent) : SelectZone
|
|||
connect(_logic, &TableZoneLogic::contentSizeChanged, this, &TableZone::resizeToContents);
|
||||
connect(_logic, &TableZoneLogic::toggleTapped, this, &TableZone::toggleTapped);
|
||||
connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::invertVerticalCoordinateChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::invertVerticalCoordinateChanged, this,
|
||||
&TableZone::reorganizeCards);
|
||||
|
||||
updateBg();
|
||||
|
|
@ -51,9 +51,9 @@ QRectF TableZone::boundingRect() const
|
|||
bool TableZone::isInverted() const
|
||||
{
|
||||
return ((getLogic()->getPlayer()->getGraphicsItem()->getMirrored() &&
|
||||
!SettingsCache::instance()->getInvertVerticalCoordinate()) ||
|
||||
!SettingsCache::instance().getInvertVerticalCoordinate()) ||
|
||||
(!getLogic()->getPlayer()->getGraphicsItem()->getMirrored() &&
|
||||
SettingsCache::instance()->getInvertVerticalCoordinate()));
|
||||
SettingsCache::instance().getInvertVerticalCoordinate()));
|
||||
}
|
||||
|
||||
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
|||
|
||||
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
|
||||
|
||||
if (SettingsCache::instance()->getFocusCardViewSearchBar()) {
|
||||
if (SettingsCache::instance().getFocusCardViewSearchBar()) {
|
||||
this->setActive(true);
|
||||
searchEdit.setFocus();
|
||||
}
|
||||
|
|
@ -144,9 +144,9 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
|||
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&ZoneViewWidget::processSortBy);
|
||||
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
||||
groupBySelector.setCurrentIndex(SettingsCache::instance()->getZoneViewGroupByIndex());
|
||||
sortBySelector.setCurrentIndex(SettingsCache::instance()->getZoneViewSortByIndex());
|
||||
pileViewCheckBox.setChecked(SettingsCache::instance()->getZoneViewPileView());
|
||||
groupBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewGroupByIndex());
|
||||
sortBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewSortByIndex());
|
||||
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
|
||||
|
||||
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
||||
pileViewCheckBox.setEnabled(false);
|
||||
|
|
@ -176,7 +176,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
|||
void ZoneViewWidget::processGroupBy(int index)
|
||||
{
|
||||
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
||||
SettingsCache::instance()->setZoneViewGroupByIndex(index);
|
||||
SettingsCache::instance().setZoneViewGroupByIndex(index);
|
||||
zone->setGroupBy(option);
|
||||
|
||||
// disable pile view checkbox if we're not grouping by anything
|
||||
|
|
@ -200,13 +200,13 @@ void ZoneViewWidget::processSortBy(int index)
|
|||
return;
|
||||
}
|
||||
|
||||
SettingsCache::instance()->setZoneViewSortByIndex(index);
|
||||
SettingsCache::instance().setZoneViewSortByIndex(index);
|
||||
zone->setSortBy(option);
|
||||
}
|
||||
|
||||
void ZoneViewWidget::processSetPileView(QT_STATE_CHANGED_T value)
|
||||
{
|
||||
SettingsCache::instance()->setZoneViewPileView(value);
|
||||
SettingsCache::instance().setZoneViewPileView(value);
|
||||
zone->setPileView(value);
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ static qreal rowsToHeight(int rows)
|
|||
**/
|
||||
static qreal calcMaxInitialHeight()
|
||||
{
|
||||
return rowsToHeight(SettingsCache::instance()->getCardViewInitialRowsMax());
|
||||
return rowsToHeight(SettingsCache::instance().getCardViewInitialRowsMax());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -379,7 +379,7 @@ void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
|||
void ZoneViewWidget::expandWindow()
|
||||
{
|
||||
qreal maxInitialHeight = calcMaxInitialHeight();
|
||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance()->getCardViewExpandedRowsMax());
|
||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().getCardViewExpandedRowsMax());
|
||||
qreal height = rect().height() - extraHeight - 10;
|
||||
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,8 @@
|
|||
CardPictureLoader::CardPictureLoader() : QObject(nullptr)
|
||||
{
|
||||
worker = new CardPictureLoaderWorker;
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::picsPathChanged, this,
|
||||
&CardPictureLoader::picsPathChanged);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::picDownloadChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, &CardPictureLoader::picsPathChanged);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::picDownloadChanged, this,
|
||||
&CardPictureLoader::picDownloadChanged);
|
||||
|
||||
connect(worker, &CardPictureLoaderWorker::imageLoaded, this, &CardPictureLoader::imageLoaded);
|
||||
|
|
@ -217,7 +216,7 @@ void CardPictureLoader::picsPathChanged()
|
|||
|
||||
bool CardPictureLoader::hasCustomArt()
|
||||
{
|
||||
auto picsPath = SettingsCache::instance()->getPicsPath();
|
||||
auto picsPath = SettingsCache::instance().getPicsPath();
|
||||
QDirIterator it(picsPath, QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
|
||||
// Check if there is at least one non-directory file in the pics path, other
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
static constexpr int REFRESH_INTERVAL_MS = 10 * 1000;
|
||||
|
||||
CardPictureLoaderLocal::CardPictureLoaderLocal(QObject *parent)
|
||||
: QObject(parent), picsPath(SettingsCache::instance()->getPicsPath()),
|
||||
customPicsPath(SettingsCache::instance()->getCustomPicsPath())
|
||||
: QObject(parent), picsPath(SettingsCache::instance().getPicsPath()),
|
||||
customPicsPath(SettingsCache::instance().getCustomPicsPath())
|
||||
{
|
||||
// Hook up signals to settings
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::picsPathChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this,
|
||||
&CardPictureLoaderLocal::picsPathChanged);
|
||||
|
||||
refreshIndex();
|
||||
|
|
@ -150,6 +150,6 @@ QImage CardPictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName,
|
|||
|
||||
void CardPictureLoaderLocal::picsPathChanged()
|
||||
{
|
||||
picsPath = SettingsCache::instance()->getPicsPath();
|
||||
customPicsPath = SettingsCache::instance()->getCustomPicsPath();
|
||||
picsPath = SettingsCache::instance().getPicsPath();
|
||||
customPicsPath = SettingsCache::instance().getCustomPicsPath();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||
|
||||
CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||
: QObject(nullptr), picDownload(SettingsCache::instance()->getPicDownload()), requestQuota(MAX_REQUESTS_PER_SEC)
|
||||
: QObject(nullptr), picDownload(SettingsCache::instance().getPicDownload()), requestQuota(MAX_REQUESTS_PER_SEC)
|
||||
{
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
// We need a timeout to ensure requests don't hang indefinitely in case of
|
||||
|
|
@ -25,18 +25,18 @@ CardPictureLoaderWorker::CardPictureLoaderWorker()
|
|||
networkManager->setTransferTimeout();
|
||||
#endif
|
||||
cache = new QNetworkDiskCache(this);
|
||||
cache->setCacheDirectory(SettingsCache::instance()->getNetworkCachePath());
|
||||
cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath());
|
||||
cache->setMaximumCacheSize(1024L * 1024L *
|
||||
static_cast<qint64>(SettingsCache::instance()->getNetworkCacheSizeInMB()));
|
||||
static_cast<qint64>(SettingsCache::instance().getNetworkCacheSizeInMB()));
|
||||
// Note: the settings is in MB, but QNetworkDiskCache uses bytes
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::networkCacheSizeChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::networkCacheSizeChanged, this,
|
||||
[this](int newSizeInMB) { cache->setMaximumCacheSize(1024L * 1024L * static_cast<qint64>(newSizeInMB)); });
|
||||
networkManager->setCache(cache);
|
||||
// Use a ManualRedirectPolicy since we keep track of redirects in picDownloadFinished
|
||||
// We can't use NoLessSafeRedirectPolicy because it is not applied with AlwaysCache
|
||||
networkManager->setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
|
||||
|
||||
cacheFilePath = SettingsCache::instance()->getRedirectCachePath() + REDIRECT_CACHE_FILENAME;
|
||||
cacheFilePath = SettingsCache::instance().getRedirectCachePath() + REDIRECT_CACHE_FILENAME;
|
||||
loadRedirectCache();
|
||||
cleanStaleEntries();
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ void CardPictureLoaderWorker::cleanStaleEntries()
|
|||
|
||||
auto it = redirectCache.begin();
|
||||
while (it != redirectCache.end()) {
|
||||
if (it.value().second.addDays(SettingsCache::instance()->getRedirectCacheTtl()) < now) {
|
||||
if (it.value().second.addDays(SettingsCache::instance().getRedirectCacheTtl()) < now) {
|
||||
it = redirectCache.erase(it); // Remove stale entry
|
||||
} else {
|
||||
++it;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ static const QStringList MD5_BLACKLIST = {"db0c48db407a907c16ade38de048a441"};
|
|||
|
||||
CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
|
||||
: QObject(nullptr), cardToDownload(CardPictureToLoad(toLoad)),
|
||||
picDownload(SettingsCache::instance()->getPicDownload())
|
||||
picDownload(SettingsCache::instance().getPicDownload())
|
||||
{
|
||||
// Hook up signals to the orchestrator
|
||||
connect(this, &CardPictureLoaderWorkerWork::requestImageDownload, worker, &CardPictureLoaderWorker::queueRequest);
|
||||
|
|
@ -30,7 +30,7 @@ CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoader
|
|||
&CardPictureLoaderWorker::imageRequestSucceeded);
|
||||
|
||||
// Hook up signals to settings
|
||||
connect(SettingsCache::instance().get(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||
|
||||
startNextPicDownload();
|
||||
}
|
||||
|
|
@ -219,5 +219,5 @@ void CardPictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
|
|||
|
||||
void CardPictureLoaderWorkerWork::picDownloadChanged()
|
||||
{
|
||||
picDownload = SettingsCache::instance()->getPicDownload();
|
||||
picDownload = SettingsCache::instance().getPicDownload();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <libcockatrice/card/set/card_set_comparator.h>
|
||||
|
||||
CardPictureToLoad::CardPictureToLoad(const ExactCard &_card)
|
||||
: card(_card), urlTemplates(SettingsCache::instance()->downloads().getAllURLs())
|
||||
: card(_card), urlTemplates(SettingsCache::instance().downloads().getAllURLs())
|
||||
{
|
||||
if (card) {
|
||||
sortedSets = extractSetsSorted(card);
|
||||
|
|
@ -34,12 +34,12 @@ QList<CardSetPtr> CardPictureToLoad::extractSetsSorted(const ExactCard &card)
|
|||
}
|
||||
}
|
||||
if (sortedSets.empty()) {
|
||||
sortedSets << CardSet::newInstance(SettingsCache::instance()->cardDatabase(), "", "", "", QDate());
|
||||
sortedSets << CardSet::newInstance(SettingsCache::instance().cardDatabase(), "", "", "", QDate());
|
||||
}
|
||||
std::sort(sortedSets.begin(), sortedSets.end(), SetPriorityComparator());
|
||||
|
||||
// If the user hasn't disabled arts other than their personal preference...
|
||||
if (!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
||||
qsizetype setIndex = sortedSets.indexOf(card.getPrinting().getSet());
|
||||
if (setIndex > 0) { // we don't need to move the set if it's already first
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ static const QStringList DEFAULT_RESOURCE_PATHS = {":/resources"};
|
|||
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
ensureThemeDirectoryExists();
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::themeChanged, this, &ThemeManager::themeChangedSlot);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this, &ThemeManager::themeChangedSlot);
|
||||
themeChangedSlot();
|
||||
}
|
||||
|
||||
void ThemeManager::ensureThemeDirectoryExists()
|
||||
{
|
||||
if (SettingsCache::instance()->getThemeName().isEmpty() ||
|
||||
!getAvailableThemes().contains(SettingsCache::instance()->getThemeName())) {
|
||||
if (SettingsCache::instance().getThemeName().isEmpty() ||
|
||||
!getAvailableThemes().contains(SettingsCache::instance().getThemeName())) {
|
||||
qCInfo(ThemeManagerLog) << "Theme name not set, setting default value";
|
||||
SettingsCache::instance()->setThemeName(NONE_THEME_NAME);
|
||||
SettingsCache::instance().setThemeName(NONE_THEME_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ QStringMap &ThemeManager::getAvailableThemes()
|
|||
availableThemes.insert(NONE_THEME_NAME, QString());
|
||||
|
||||
// load themes from user profile dir
|
||||
dir.setPath(SettingsCache::instance()->getThemesPath());
|
||||
dir.setPath(SettingsCache::instance().getThemesPath());
|
||||
|
||||
for (QString themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||
if (!availableThemes.contains(themeName)) {
|
||||
|
|
@ -104,7 +104,7 @@ QBrush ThemeManager::loadExtraBrush(QString fileName, QBrush &fallbackBrush)
|
|||
|
||||
void ThemeManager::themeChangedSlot()
|
||||
{
|
||||
QString themeName = SettingsCache::instance()->getThemeName();
|
||||
QString themeName = SettingsCache::instance().getThemeName();
|
||||
qCInfo(ThemeManagerLog) << "Theme changed:" << themeName;
|
||||
|
||||
QString dirPath = getAvailableThemes().value(themeName);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, CardInfoPtr _card) : Q
|
|||
|
||||
populateManaSymbolWidgets();
|
||||
}
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||
&ColorIdentityWidget::toggleUnusedVisibility);
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, QString _manaCost)
|
|||
|
||||
populateManaSymbolWidgets();
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||
&ColorIdentityWidget::toggleUnusedVisibility);
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ void ColorIdentityWidget::populateManaSymbolWidgets()
|
|||
QString fullColorIdentity = "WUBRG";
|
||||
QStringList symbols = parseColorIdentity(manaCost); // Parse mana cost string
|
||||
|
||||
if (SettingsCache::instance()->getVisualDeckStorageDrawUnusedColorIdentities()) {
|
||||
if (SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities()) {
|
||||
for (const QString symbol : fullColorIdentity) {
|
||||
auto *manaSymbol = new ManaSymbolWidget(this, symbol, symbols.contains(symbol));
|
||||
layout->addWidget(manaSymbol);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ ManaSymbolWidget::ManaSymbolWidget(QWidget *parent, QString _symbol, bool _isAct
|
|||
setGraphicsEffect(opacityEffect);
|
||||
updateOpacity();
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageUnusedColorIdentitiesOpacityChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageUnusedColorIdentitiesOpacityChanged, this,
|
||||
&ManaSymbolWidget::updateOpacity);
|
||||
}
|
||||
|
||||
|
|
@ -42,8 +42,7 @@ void ManaSymbolWidget::updateOpacity()
|
|||
opacity = isActive ? 1.0 : 0.5;
|
||||
} else {
|
||||
// It's just for display, they can do whatever they want.
|
||||
opacity =
|
||||
isActive ? 1.0 : SettingsCache::instance()->getVisualDeckStorageUnusedColorIdentitiesOpacity() / 100.0;
|
||||
opacity = isActive ? 1.0 : SettingsCache::instance().getVisualDeckStorageUnusedColorIdentitiesOpacity() / 100.0;
|
||||
}
|
||||
opacityEffect->setOpacity(opacity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
|||
tab3Layout->addWidget(splitter);
|
||||
tab3->setLayout(tab3Layout);
|
||||
|
||||
setViewMode(SettingsCache::instance()->getCardInfoViewMode());
|
||||
setViewMode(SettingsCache::instance().getCardInfoViewMode());
|
||||
}
|
||||
|
||||
void CardInfoFrameWidget::retranslateUi()
|
||||
|
|
@ -128,7 +128,7 @@ void CardInfoFrameWidget::setViewMode(int mode)
|
|||
|
||||
refreshLayout();
|
||||
|
||||
SettingsCache::instance()->setCardInfoViewMode(mode);
|
||||
SettingsCache::instance().setCardInfoViewMode(mode);
|
||||
}
|
||||
|
||||
static bool hasTransformation(const CardInfo &info)
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@ CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent) :
|
|||
setWindowFlags(Qt::ToolTip); // Keeps this widget on top of everything
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
update();
|
||||
});
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -87,7 +86,7 @@ void CardInfoPictureEnlargedWidget::paintEvent(QPaintEvent *event)
|
|||
|
||||
// Define the radius for rounded corners
|
||||
// Adjust the radius as needed for rounded corners
|
||||
qreal radius = SettingsCache::instance()->getRoundCardCorners() ? 0.05 * scaledSize.width() : 0.;
|
||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * scaledSize.width() : 0.;
|
||||
|
||||
QStylePainter painter(this);
|
||||
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
||||
|
|
|
|||
|
|
@ -58,12 +58,11 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT
|
|||
animation->setStartValue(originalPos);
|
||||
animation->setEndValue(originalPos - QPoint(0, animationOffset));
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::roundCardCornersChanged, this,
|
||||
[this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||
Q_UNUSED(_roundCardCorners);
|
||||
|
||||
update();
|
||||
});
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,7 +182,7 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
|
||||
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
|
||||
if (SettingsCache::instance()->getAutoRotateSidewaysLayoutCards()) {
|
||||
if (SettingsCache::instance().getAutoRotateSidewaysLayoutCards()) {
|
||||
if (exactCard.getInfo().getLandscapeOrientation()) {
|
||||
// Rotate pixmap 90 degrees to the left
|
||||
QTransform transform;
|
||||
|
|
@ -213,8 +212,7 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
|||
|
||||
// Compute rounded corner radius
|
||||
// Ensure consistent rounding
|
||||
qreal radius =
|
||||
SettingsCache::instance()->getRoundCardCorners() ? 0.05 * static_cast<qreal>(targetRect.width()) : 0.;
|
||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * static_cast<qreal>(targetRect.width()) : 0.;
|
||||
|
||||
// Draw the pixmap with rounded corners
|
||||
QStylePainter painter(this);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ DeckPreviewCardPictureWidget::DeckPreviewCardPictureWidget(QWidget *parent,
|
|||
singleClickTimer = new QTimer(this);
|
||||
singleClickTimer->setSingleShot(true);
|
||||
connect(singleClickTimer, &QTimer::timeout, this, [this]() { emit imageClicked(lastMouseEvent, this); });
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageSelectionAnimationChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageSelectionAnimationChanged, this,
|
||||
&CardInfoPictureWidget::setRaiseOnEnterEnabled);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(AbstractTabDeck
|
|||
&DeckEditorDatabaseDisplayWidget::updateCard);
|
||||
connect(databaseView, &QTreeView::doubleClicked, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
|
||||
QByteArray dbHeaderState = SettingsCache::instance()->layouts().getDeckEditorDbHeaderState();
|
||||
QByteArray dbHeaderState = SettingsCache::instance().layouts().getDeckEditorDbHeaderState();
|
||||
if (dbHeaderState.isNull()) {
|
||||
// first run
|
||||
databaseView->setColumnWidth(0, 200);
|
||||
|
|
@ -189,7 +189,7 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
|||
QAction *addToDeck, *addToSideboard, *selectPrinting, *edhRecCommander, *edhRecCard;
|
||||
addToDeck = menu.addAction(tr("Add to Deck"));
|
||||
addToSideboard = menu.addAction(tr("Add to Sideboard"));
|
||||
if (!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ void DeckEditorDatabaseDisplayWidget::copyDatabaseCellContents()
|
|||
|
||||
void DeckEditorDatabaseDisplayWidget::saveDbHeaderState()
|
||||
{
|
||||
SettingsCache::instance()->layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
||||
SettingsCache::instance().layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::setFilterTree(FilterTree *filterTree)
|
||||
|
|
|
|||
|
|
@ -63,18 +63,18 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
|
||||
showBannerCardCheckBox = new QCheckBox();
|
||||
showBannerCardCheckBox->setObjectName("showBannerCardCheckBox");
|
||||
showBannerCardCheckBox->setChecked(SettingsCache::instance()->getDeckEditorBannerCardComboBoxVisible());
|
||||
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
showBannerCardCheckBox->setChecked(SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setDeckEditorBannerCardComboBoxVisible);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::deckEditorBannerCardComboBoxVisibleChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::deckEditorBannerCardComboBoxVisibleChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateShowBannerCardComboBox);
|
||||
|
||||
showTagsWidgetCheckBox = new QCheckBox();
|
||||
showTagsWidgetCheckBox->setObjectName("showTagsWidgetCheckBox");
|
||||
showTagsWidgetCheckBox->setChecked(SettingsCache::instance()->getDeckEditorTagsWidgetVisible());
|
||||
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
||||
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setDeckEditorTagsWidgetVisible);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::deckEditorTagsWidgetVisibleChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::deckEditorTagsWidgetVisibleChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateShowTagsWidget);
|
||||
|
||||
quickSettingsWidget->addSettingsWidget(showBannerCardCheckBox);
|
||||
|
|
@ -91,7 +91,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
bannerCardLabel = new QLabel();
|
||||
bannerCardLabel->setObjectName("bannerCardLabel");
|
||||
bannerCardLabel->setText(tr("Banner Card"));
|
||||
bannerCardLabel->setHidden(!SettingsCache::instance()->getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardLabel->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardComboBox = new QComboBox(this);
|
||||
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
||||
// Delay the update to avoid race conditions
|
||||
|
|
@ -99,10 +99,10 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
});
|
||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DeckEditorDeckDockWidget::setBannerCard);
|
||||
bannerCardComboBox->setHidden(!SettingsCache::instance()->getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||
|
||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, deckModel->getDeckList());
|
||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance()->getDeckEditorTagsWidgetVisible());
|
||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
||||
|
||||
activeGroupCriteriaLabel = new QLabel(this);
|
||||
|
||||
|
|
@ -577,7 +577,7 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of
|
|||
|
||||
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
||||
{
|
||||
if (!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
QMenu menu;
|
||||
|
||||
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
|
|
@ -589,7 +589,7 @@ void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
|||
|
||||
void DeckEditorDeckDockWidget::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aRemoveCard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aRemoveCard"));
|
||||
aIncrement->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aIncrement"));
|
||||
aDecrement->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aDecrement"));
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void DeckEditorFilterDockWidget::actClearFilterOne()
|
|||
|
||||
void DeckEditorFilterDockWidget::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
||||
aClearFilterAll->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClearFilterAll"));
|
||||
aClearFilterOne->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClearFilterOne"));
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
|||
autoConnectCheckBox = new QCheckBox(tr("A&uto connect"));
|
||||
autoConnectCheckBox->setToolTip(tr("Automatically connect to the most recent login when Cockatrice opens"));
|
||||
|
||||
auto &servers = SettingsCache::instance()->servers();
|
||||
auto &servers = SettingsCache::instance().servers();
|
||||
if (servers.getSavePassword()) {
|
||||
autoConnectCheckBox->setChecked(servers.getAutoConnect() > 0);
|
||||
autoConnectCheckBox->setEnabled(true);
|
||||
|
|
@ -213,7 +213,7 @@ void DlgConnect::rebuildComboBoxList(int failure)
|
|||
UserConnection_Information uci;
|
||||
savedHostList = uci.getServerInfo();
|
||||
|
||||
auto &servers = SettingsCache::instance()->servers();
|
||||
auto &servers = SettingsCache::instance().servers();
|
||||
bool autoConnectEnabled = servers.getAutoConnect() > 0;
|
||||
QString previousHostName = servers.getPrevioushostName();
|
||||
QString autoConnectSaveName = servers.getSaveName();
|
||||
|
|
@ -330,7 +330,7 @@ void DlgConnect::passwordSaved(QT_STATE_CHANGED_T state)
|
|||
|
||||
void DlgConnect::actOk()
|
||||
{
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
|
||||
if (newHostButton->isChecked()) {
|
||||
if (saveEdit->text().isEmpty()) {
|
||||
|
|
@ -363,7 +363,7 @@ QString DlgConnect::getHost() const
|
|||
|
||||
void DlgConnect::actForgotPassword()
|
||||
{
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
servers.setFPHostName(hostEdit->text());
|
||||
servers.setFPPort(portEdit->text());
|
||||
servers.setFPPlayerName(playernameEdit->text().trimmed());
|
||||
|
|
@ -373,6 +373,6 @@ void DlgConnect::actForgotPassword()
|
|||
|
||||
void DlgConnect::actRemoveSavedServer()
|
||||
{
|
||||
SettingsCache::instance()->servers().removeServer(hostEdit->text());
|
||||
SettingsCache::instance().servers().removeServer(hostEdit->text());
|
||||
previousHosts->removeItem(previousHosts->currentIndex());
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ void DlgCreateGame::sharedCtor()
|
|||
QRadioButton *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this);
|
||||
gameTypeLayout->addWidget(gameTypeRadioButton);
|
||||
gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton);
|
||||
bool isChecked = SettingsCache::instance()->getGameTypes().contains(gameTypeIterator.value() + ", ");
|
||||
bool isChecked = SettingsCache::instance().getGameTypes().contains(gameTypeIterator.value() + ", ");
|
||||
gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked);
|
||||
}
|
||||
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
||||
|
|
@ -150,23 +150,23 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
|||
{
|
||||
sharedCtor();
|
||||
|
||||
rememberGameSettings->setChecked(SettingsCache::instance()->getRememberGameSettings());
|
||||
descriptionEdit->setText(SettingsCache::instance()->getGameDescription());
|
||||
maxPlayersEdit->setValue(SettingsCache::instance()->getMaxPlayers());
|
||||
rememberGameSettings->setChecked(SettingsCache::instance().getRememberGameSettings());
|
||||
descriptionEdit->setText(SettingsCache::instance().getGameDescription());
|
||||
maxPlayersEdit->setValue(SettingsCache::instance().getMaxPlayers());
|
||||
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) {
|
||||
onlyBuddiesCheckBox->setChecked(SettingsCache::instance()->getOnlyBuddies());
|
||||
onlyRegisteredCheckBox->setChecked(SettingsCache::instance()->getOnlyRegistered());
|
||||
onlyBuddiesCheckBox->setChecked(SettingsCache::instance().getOnlyBuddies());
|
||||
onlyRegisteredCheckBox->setChecked(SettingsCache::instance().getOnlyRegistered());
|
||||
} else {
|
||||
onlyBuddiesCheckBox->setEnabled(false);
|
||||
onlyRegisteredCheckBox->setEnabled(false);
|
||||
}
|
||||
spectatorsAllowedCheckBox->setChecked(SettingsCache::instance()->getSpectatorsAllowed());
|
||||
spectatorsNeedPasswordCheckBox->setChecked(SettingsCache::instance()->getSpectatorsNeedPassword());
|
||||
spectatorsCanTalkCheckBox->setChecked(SettingsCache::instance()->getSpectatorsCanTalk());
|
||||
spectatorsSeeEverythingCheckBox->setChecked(SettingsCache::instance()->getSpectatorsCanSeeEverything());
|
||||
createGameAsSpectatorCheckBox->setChecked(SettingsCache::instance()->getCreateGameAsSpectator());
|
||||
startingLifeTotalEdit->setValue(SettingsCache::instance()->getDefaultStartingLifeTotal());
|
||||
shareDecklistsOnLoadCheckBox->setChecked(SettingsCache::instance()->getShareDecklistsOnLoad());
|
||||
spectatorsAllowedCheckBox->setChecked(SettingsCache::instance().getSpectatorsAllowed());
|
||||
spectatorsNeedPasswordCheckBox->setChecked(SettingsCache::instance().getSpectatorsNeedPassword());
|
||||
spectatorsCanTalkCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanTalk());
|
||||
spectatorsSeeEverythingCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanSeeEverything());
|
||||
createGameAsSpectatorCheckBox->setChecked(SettingsCache::instance().getCreateGameAsSpectator());
|
||||
startingLifeTotalEdit->setValue(SettingsCache::instance().getDefaultStartingLifeTotal());
|
||||
shareDecklistsOnLoadCheckBox->setChecked(SettingsCache::instance().getShareDecklistsOnLoad());
|
||||
|
||||
if (!rememberGameSettings->isChecked()) {
|
||||
actReset();
|
||||
|
|
@ -285,20 +285,20 @@ void DlgCreateGame::actOK()
|
|||
}
|
||||
}
|
||||
|
||||
SettingsCache::instance()->setRememberGameSettings(rememberGameSettings->isChecked());
|
||||
SettingsCache::instance().setRememberGameSettings(rememberGameSettings->isChecked());
|
||||
if (rememberGameSettings->isChecked()) {
|
||||
SettingsCache::instance()->setGameDescription(descriptionEdit->text());
|
||||
SettingsCache::instance()->setMaxPlayers(maxPlayersEdit->value());
|
||||
SettingsCache::instance()->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||
SettingsCache::instance()->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||
SettingsCache::instance()->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||
SettingsCache::instance()->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||
SettingsCache::instance()->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||
SettingsCache::instance()->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||
SettingsCache::instance()->setCreateGameAsSpectator(createGameAsSpectatorCheckBox->isChecked());
|
||||
SettingsCache::instance()->setDefaultStartingLifeTotal(startingLifeTotalEdit->value());
|
||||
SettingsCache::instance()->setShareDecklistsOnLoad(shareDecklistsOnLoadCheckBox->isChecked());
|
||||
SettingsCache::instance()->setGameTypes(_gameTypes);
|
||||
SettingsCache::instance().setGameDescription(descriptionEdit->text());
|
||||
SettingsCache::instance().setMaxPlayers(maxPlayersEdit->value());
|
||||
SettingsCache::instance().setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||
SettingsCache::instance().setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||
SettingsCache::instance().setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||
SettingsCache::instance().setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||
SettingsCache::instance().setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||
SettingsCache::instance().setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||
SettingsCache::instance().setCreateGameAsSpectator(createGameAsSpectatorCheckBox->isChecked());
|
||||
SettingsCache::instance().setDefaultStartingLifeTotal(startingLifeTotalEdit->value());
|
||||
SettingsCache::instance().setShareDecklistsOnLoad(shareDecklistsOnLoadCheckBox->isChecked());
|
||||
SettingsCache::instance().setGameTypes(_gameTypes);
|
||||
}
|
||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||
connect(pend, &PendingCommand::finished, this, &DlgCreateGame::checkResponse);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void DlgDefaultTagsEditor::retranslateUi()
|
|||
void DlgDefaultTagsEditor::loadStringList()
|
||||
{
|
||||
listWidget->clear();
|
||||
QStringList tags = SettingsCache::instance()->getVisualDeckStorageDefaultTagsList();
|
||||
QStringList tags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
||||
for (const QString &tag : tags) {
|
||||
auto *item = new QListWidgetItem(); // Create item but don't insert yet
|
||||
|
||||
|
|
@ -144,6 +144,6 @@ void DlgDefaultTagsEditor::confirmChanges()
|
|||
updatedList.append(lineEdit->text());
|
||||
}
|
||||
}
|
||||
SettingsCache::instance()->setVisualDeckStorageDefaultTagsList(updatedList);
|
||||
SettingsCache::instance().setVisualDeckStorageDefaultTagsList(updatedList);
|
||||
accept(); // Close dialog and confirm changes
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ DlgEditPassword::DlgEditPassword(QWidget *parent) : QDialog(parent)
|
|||
oldPasswordEdit = new QLineEdit();
|
||||
oldPasswordEdit->setMaxLength(MAX_NAME_LENGTH);
|
||||
|
||||
auto &servers = SettingsCache::instance()->servers();
|
||||
auto &servers = SettingsCache::instance().servers();
|
||||
if (servers.getSavePassword()) {
|
||||
oldPasswordEdit->setText(servers.getPassword());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QStrin
|
|||
countryEdit->insertItem(0, tr("Undefined"));
|
||||
countryEdit->setCurrentIndex(0);
|
||||
|
||||
QStringList countries = SettingsCache::instance()->getCountries();
|
||||
QStringList countries = SettingsCache::instance().getCountries();
|
||||
int i = 1;
|
||||
for (const QString &c : countries) {
|
||||
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo
|
|||
QString lastfphost;
|
||||
QString lastfpport;
|
||||
QString lastfpplayername;
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
lastfphost = servers.getHostname();
|
||||
lastfpport = servers.getPort();
|
||||
lastfpplayername = servers.getPlayerName();
|
||||
|
|
@ -98,7 +98,7 @@ void DlgForgotPasswordChallenge::actOk()
|
|||
return;
|
||||
}
|
||||
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
servers.setFPHostName(hostEdit->text());
|
||||
servers.setFPPort(portEdit->text());
|
||||
servers.setFPPlayerName(playernameEdit->text());
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa
|
|||
QString lastfphost;
|
||||
QString lastfpport;
|
||||
QString lastfpplayername;
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
lastfphost = servers.getHostname();
|
||||
lastfpport = servers.getPort();
|
||||
lastfpplayername = servers.getPlayerName();
|
||||
|
|
@ -75,7 +75,7 @@ void DlgForgotPasswordRequest::actOk()
|
|||
return;
|
||||
}
|
||||
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
servers.setFPHostName(hostEdit->text());
|
||||
servers.setFPPort(portEdit->text());
|
||||
servers.setFPPlayerName(playernameEdit->text());
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ DlgForgotPasswordReset::DlgForgotPasswordReset(QWidget *parent) : QDialog(parent
|
|||
QString lastfphost;
|
||||
QString lastfpport;
|
||||
QString lastfpplayername;
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
lastfphost = servers.getHostname();
|
||||
lastfpport = servers.getPort();
|
||||
lastfpplayername = servers.getPlayerName();
|
||||
|
|
@ -132,7 +132,7 @@ void DlgForgotPasswordReset::actOk()
|
|||
return;
|
||||
}
|
||||
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
servers.setFPHostName(hostEdit->text());
|
||||
servers.setFPPort(portEdit->text());
|
||||
servers.setFPPlayerName(playernameEdit->text());
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
||||
{
|
||||
QString startingDir = SettingsCache::instance()->recents().getLatestDeckDirPath();
|
||||
QString startingDir = SettingsCache::instance().recents().getLatestDeckDirPath();
|
||||
if (startingDir.isEmpty()) {
|
||||
startingDir = SettingsCache::instance()->getDeckPath();
|
||||
startingDir = SettingsCache::instance().getDeckPath();
|
||||
}
|
||||
|
||||
setDirectory(startingDir);
|
||||
|
|
@ -19,5 +19,5 @@ DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
|||
|
||||
void DlgLoadDeck::actAccepted()
|
||||
{
|
||||
SettingsCache::instance()->recents().setLatestDeckDirPath(directory().absolutePath());
|
||||
SettingsCache::instance().recents().setLatestDeckDirPath(directory().absolutePath());
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ AbstractDlgDeckTextEdit::AbstractDlgDeckTextEdit(QWidget *parent) : QDialog(pare
|
|||
|
||||
resize(500, 500);
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&AbstractDlgDeckTextEdit::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ AbstractDlgDeckTextEdit::AbstractDlgDeckTextEdit(QWidget *parent) : QDialog(pare
|
|||
void AbstractDlgDeckTextEdit::refreshShortcuts()
|
||||
{
|
||||
refreshButton->setShortcut(
|
||||
SettingsCache::instance()->shortcuts().getSingleShortcut("DlgLoadDeckFromClipboard/refreshButton"));
|
||||
SettingsCache::instance().shortcuts().getSingleShortcut("DlgLoadDeckFromClipboard/refreshButton"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ WndSets::WndSets(QWidget *parent) : QMainWindow(parent)
|
|||
sortWarning->setLayout(sortWarningLayout);
|
||||
sortWarning->setVisible(false);
|
||||
|
||||
includeRebalancedCards = SettingsCache::instance()->getIncludeRebalancedCards();
|
||||
includeRebalancedCards = SettingsCache::instance().getIncludeRebalancedCards();
|
||||
QCheckBox *includeRebalancedCardsCheckBox =
|
||||
new QCheckBox(tr("Include cards rebalanced for Alchemy [requires restart]"));
|
||||
includeRebalancedCardsCheckBox->setChecked(includeRebalancedCards);
|
||||
|
|
@ -192,11 +192,11 @@ WndSets::WndSets(QWidget *parent) : QMainWindow(parent)
|
|||
|
||||
setWindowTitle(tr("Manage sets"));
|
||||
setMinimumSize(800, 500);
|
||||
auto &geometry = SettingsCache::instance()->getSetsDialogGeometry();
|
||||
auto &geometry = SettingsCache::instance().getSetsDialogGeometry();
|
||||
if (!geometry.isEmpty()) {
|
||||
restoreGeometry(geometry);
|
||||
}
|
||||
auto &headerState = SettingsCache::instance()->layouts().getSetsDialogHeaderState();
|
||||
auto &headerState = SettingsCache::instance().layouts().getSetsDialogHeaderState();
|
||||
if (!headerState.isEmpty()) {
|
||||
view->header()->restoreState(headerState);
|
||||
view->header()->setSortIndicator(SORT_RESET, Qt::DescendingOrder);
|
||||
|
|
@ -212,12 +212,12 @@ WndSets::~WndSets()
|
|||
|
||||
void WndSets::closeEvent(QCloseEvent * /*ev*/)
|
||||
{
|
||||
SettingsCache::instance()->setSetsDialogGeometry(saveGeometry());
|
||||
SettingsCache::instance().setSetsDialogGeometry(saveGeometry());
|
||||
}
|
||||
|
||||
void WndSets::saveHeaderState()
|
||||
{
|
||||
SettingsCache::instance()->layouts().setSetsDialogHeaderState(view->header()->saveState());
|
||||
SettingsCache::instance().layouts().setSetsDialogHeaderState(view->header()->saveState());
|
||||
}
|
||||
|
||||
void WndSets::rebuildMainLayout(int actionToTake)
|
||||
|
|
@ -250,7 +250,7 @@ void WndSets::includeRebalancedCardsChanged(bool _includeRebalancedCards)
|
|||
void WndSets::actSave()
|
||||
{
|
||||
model->save(CardDatabaseManager::getInstance());
|
||||
SettingsCache::instance()->setIncludeRebalancedCards(includeRebalancedCards);
|
||||
SettingsCache::instance().setIncludeRebalancedCards(includeRebalancedCards);
|
||||
CardPictureLoader::clearPixmapCache();
|
||||
close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
infoLabel = new QLabel(tr("Enter your information and the information of the server you'd like to register to.\n"
|
||||
"Your email will be used to verify your account."));
|
||||
infoLabel->setWordWrap(true);
|
||||
|
|
@ -312,7 +312,7 @@ DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent)
|
|||
countryEdit->addItem(QPixmap("theme:countries/zm"), "zm");
|
||||
countryEdit->addItem(QPixmap("theme:countries/zw"), "zw");
|
||||
countryEdit->setCurrentIndex(0);
|
||||
QStringList countries = SettingsCache::instance()->getCountries();
|
||||
QStringList countries = SettingsCache::instance().getCountries();
|
||||
for (const QString &c : countries)
|
||||
countryEdit->addItem(QPixmap("theme:countries/" + c.toLower()), c);
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -10,7 +10,7 @@ DlgStartupCardCheck::DlgStartupCardCheck(QWidget *parent) : QDialog(parent)
|
|||
|
||||
layout = new QVBoxLayout(this);
|
||||
|
||||
QDate lastCheckDate = SettingsCache::instance()->getLastCardUpdateCheck();
|
||||
QDate lastCheckDate = SettingsCache::instance().getLastCardUpdateCheck();
|
||||
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
||||
|
||||
instructionLabel = new QLabel(
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
|||
tipNumber = new QLabel();
|
||||
tipNumber->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QList<int> seenTips = SettingsCache::instance()->getSeenTips();
|
||||
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
||||
newTipsAvailable = false;
|
||||
currentTip = 0;
|
||||
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
||||
|
|
@ -74,8 +74,8 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
|||
connect(previousButton, &QPushButton::clicked, this, &DlgTipOfTheDay::previousClicked);
|
||||
|
||||
showTipsOnStartupCheck = new QCheckBox("Show tips on startup");
|
||||
showTipsOnStartupCheck->setChecked(SettingsCache::instance()->getShowTipsOnStartup());
|
||||
connect(showTipsOnStartupCheck, &QCheckBox::clicked, SettingsCache::instance().get(),
|
||||
showTipsOnStartupCheck->setChecked(SettingsCache::instance().getShowTipsOnStartup());
|
||||
connect(showTipsOnStartupCheck, &QCheckBox::clicked, &SettingsCache::instance(),
|
||||
&SettingsCache::setShowTipsOnStartup);
|
||||
buttonBar = new QHBoxLayout();
|
||||
buttonBar->addWidget(showTipsOnStartupCheck);
|
||||
|
|
@ -131,10 +131,10 @@ void DlgTipOfTheDay::updateTip(int tipId)
|
|||
}
|
||||
|
||||
// Store tip id as seen
|
||||
QList<int> seenTips = SettingsCache::instance()->getSeenTips();
|
||||
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
||||
if (!seenTips.contains(tipId)) {
|
||||
seenTips.append(tipId);
|
||||
SettingsCache::instance()->setSeenTips(seenTips);
|
||||
SettingsCache::instance().setSeenTips(seenTips);
|
||||
}
|
||||
|
||||
TipOfTheDay tip = tipDatabase->getTip(tipId);
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
|
|||
statusLabel = new QLabel(this);
|
||||
statusLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
statusLabel->setWordWrap(true);
|
||||
descriptionLabel = new QLabel(
|
||||
tr("Current release channel") +
|
||||
QString(": %1").arg(tr(SettingsCache::instance()->getUpdateReleaseChannel()->getName().toUtf8())),
|
||||
this);
|
||||
descriptionLabel =
|
||||
new QLabel(tr("Current release channel") +
|
||||
QString(": %1").arg(tr(SettingsCache::instance().getUpdateReleaseChannel()->getName().toUtf8())),
|
||||
this);
|
||||
progress = new QProgressBar(this);
|
||||
|
||||
buttonBox = new QDialogButtonBox(this);
|
||||
|
|
@ -84,7 +84,7 @@ void DlgUpdate::closeDialog()
|
|||
|
||||
void DlgUpdate::gotoDownloadPage()
|
||||
{
|
||||
QDesktopServices::openUrl(SettingsCache::instance()->getUpdateReleaseChannel()->getManualDownloadUrl());
|
||||
QDesktopServices::openUrl(SettingsCache::instance().getUpdateReleaseChannel()->getManualDownloadUrl());
|
||||
}
|
||||
|
||||
void DlgUpdate::downloadUpdate(const QString &releaseName)
|
||||
|
|
@ -141,7 +141,7 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Releas
|
|||
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>" +
|
||||
tr("Selected release channel") +
|
||||
QString(":</b> %1").arg(tr(SettingsCache::instance()->getUpdateReleaseChannel()->getName().toUtf8())));
|
||||
QString(":</b> %1").arg(tr(SettingsCache::instance().getUpdateReleaseChannel()->getName().toUtf8())));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
|||
|
||||
coClearLog = new QCheckBox;
|
||||
coClearLog->setText(tr("Clear log when closing"));
|
||||
coClearLog->setChecked(SettingsCache::instance()->servers().getClearDebugLogStatus(false));
|
||||
coClearLog->setChecked(SettingsCache::instance().servers().getClearDebugLogStatus(false));
|
||||
connect(coClearLog, &QCheckBox::toggled, this, &DlgViewLog::actCheckBoxChanged);
|
||||
|
||||
copyToClipboardButton = new QPushButton;
|
||||
|
|
@ -49,7 +49,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
|||
|
||||
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
||||
{
|
||||
SettingsCache::instance()->servers().setClearDebugLogStatus(abNewValue);
|
||||
SettingsCache::instance().servers().setClearDebugLogStatus(abNewValue);
|
||||
}
|
||||
|
||||
void DlgViewLog::actCopyToClipboard()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
backgroundSourceCard = new CardInfoPictureArtCropWidget(this);
|
||||
backgroundSourceDeck = new DeckLoader();
|
||||
|
||||
backgroundSourceDeck->loadFromFile(SettingsCache::instance()->getDeckPath() + "background.cod",
|
||||
backgroundSourceDeck->loadFromFile(SettingsCache::instance().getDeckPath() + "background.cod",
|
||||
DeckLoader::CockatriceFormat, false);
|
||||
|
||||
gradientColors = extractDominantColors(background);
|
||||
|
|
@ -43,9 +43,9 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
updateConnectButton(tabSupervisor->getClient()->getStatus());
|
||||
|
||||
connect(tabSupervisor->getClient(), &RemoteClient::statusChanged, this, &HomeWidget::updateConnectButton);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::homeTabBackgroundSourceChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundSourceChanged, this,
|
||||
&HomeWidget::initializeBackgroundFromSource);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::homeTabBackgroundShuffleFrequencyChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundShuffleFrequencyChanged, this,
|
||||
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ void HomeWidget::initializeBackgroundFromSource()
|
|||
return;
|
||||
}
|
||||
|
||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance()->getHomeTabBackgroundSource());
|
||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance().getHomeTabBackgroundSource());
|
||||
|
||||
cardChangeTimer->stop();
|
||||
|
||||
|
|
@ -68,19 +68,19 @@ void HomeWidget::initializeBackgroundFromSource()
|
|||
update();
|
||||
break;
|
||||
case BackgroundSources::RandomCardArt:
|
||||
cardChangeTimer->start(SettingsCache::instance()->getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
break;
|
||||
case BackgroundSources::DeckFileArt:
|
||||
backgroundSourceDeck->loadFromFile(SettingsCache::instance()->getDeckPath() + "background.cod",
|
||||
backgroundSourceDeck->loadFromFile(SettingsCache::instance().getDeckPath() + "background.cod",
|
||||
DeckLoader::CockatriceFormat, false);
|
||||
cardChangeTimer->start(SettingsCache::instance()->getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HomeWidget::updateRandomCard()
|
||||
{
|
||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance()->getHomeTabBackgroundSource());
|
||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance().getHomeTabBackgroundSource());
|
||||
|
||||
ExactCard newCard;
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ void HomeWidget::updateRandomCard()
|
|||
backgroundSourceCard->setCard(newCard);
|
||||
background = backgroundSourceCard->getProcessedBackground(size());
|
||||
|
||||
if (SettingsCache::instance()->getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
if (SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
cardChangeTimer->stop();
|
||||
}
|
||||
}
|
||||
|
|
@ -129,10 +129,10 @@ void HomeWidget::updateRandomCard()
|
|||
void HomeWidget::onBackgroundShuffleFrequencyChanged()
|
||||
{
|
||||
cardChangeTimer->stop();
|
||||
if (SettingsCache::instance()->getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
if (SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
return;
|
||||
}
|
||||
cardChangeTimer->start(SettingsCache::instance()->getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
}
|
||||
|
||||
void HomeWidget::updateBackgroundProperties()
|
||||
|
|
@ -236,8 +236,8 @@ void HomeWidget::updateConnectButton(const ClientStatus status)
|
|||
|
||||
QPair<QColor, QColor> HomeWidget::extractDominantColors(const QPixmap &pixmap)
|
||||
{
|
||||
if (SettingsCache::instance()->getThemeName() == "Default" &&
|
||||
SettingsCache::instance()->getHomeTabBackgroundSource() == BackgroundSources::toId(BackgroundSources::Theme)) {
|
||||
if (SettingsCache::instance().getThemeName() == "Default" &&
|
||||
SettingsCache::instance().getHomeTabBackgroundSource() == BackgroundSources::toId(BackgroundSources::Theme)) {
|
||||
return QPair<QColor, QColor>(QColor::fromRgb(20, 140, 60), QColor::fromRgb(120, 200, 80));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
|
|||
connect(aLoadDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actLoadDeck);
|
||||
|
||||
loadRecentDeckMenu = new QMenu(this);
|
||||
connect(&SettingsCache::instance().get()->recents(), &RecentsSettings::recentlyOpenedDeckPathsChanged, this,
|
||||
connect(&SettingsCache::instance().recents(), &RecentsSettings::recentlyOpenedDeckPathsChanged, this,
|
||||
&DeckEditorMenu::updateRecentlyOpened);
|
||||
|
||||
aClearRecents = new QAction(QString(), this);
|
||||
|
|
@ -109,7 +109,7 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
|
|||
addAction(aClose);
|
||||
|
||||
retranslateUi();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&DeckEditorMenu::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ void DeckEditorMenu::setSaveStatus(bool newStatus)
|
|||
void DeckEditorMenu::updateRecentlyOpened()
|
||||
{
|
||||
loadRecentDeckMenu->clear();
|
||||
for (const auto &deckPath : SettingsCache::instance()->recents().getRecentlyOpenedDeckPaths()) {
|
||||
for (const auto &deckPath : SettingsCache::instance().recents().getRecentlyOpenedDeckPaths()) {
|
||||
QAction *aRecentlyOpenedDeck = new QAction(deckPath, this);
|
||||
loadRecentDeckMenu->addAction(aRecentlyOpenedDeck);
|
||||
connect(aRecentlyOpenedDeck, &QAction::triggered, deckEditor,
|
||||
|
|
@ -138,12 +138,12 @@ void DeckEditorMenu::updateRecentlyOpened()
|
|||
}
|
||||
loadRecentDeckMenu->addSeparator();
|
||||
loadRecentDeckMenu->addAction(aClearRecents);
|
||||
aClearRecents->setEnabled(SettingsCache::instance()->recents().getRecentlyOpenedDeckPaths().length() > 0);
|
||||
aClearRecents->setEnabled(SettingsCache::instance().recents().getRecentlyOpenedDeckPaths().length() > 0);
|
||||
}
|
||||
|
||||
void DeckEditorMenu::actClearRecents()
|
||||
{
|
||||
SettingsCache::instance()->recents().clearRecentlyOpenedDeckPaths();
|
||||
SettingsCache::instance().recents().clearRecentlyOpenedDeckPaths();
|
||||
}
|
||||
|
||||
void DeckEditorMenu::retranslateUi()
|
||||
|
|
@ -182,7 +182,7 @@ void DeckEditorMenu::retranslateUi()
|
|||
|
||||
void DeckEditorMenu::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aNewDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aNewDeck"));
|
||||
aLoadDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeck"));
|
||||
aSaveDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeck"));
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ class TearOffMenu : public QMenu
|
|||
public:
|
||||
explicit TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
||||
{
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::useTearOffMenusChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
||||
[this](const bool state) { setTearOffEnabled(state); });
|
||||
setTearOffEnabled(SettingsCache::instance()->getUseTearOffMenus());
|
||||
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
||||
}
|
||||
|
||||
explicit TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||
{
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::useTearOffMenusChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
||||
[this](const bool state) { setTearOffEnabled(state); });
|
||||
setTearOffEnabled(SettingsCache::instance()->getUseTearOffMenus());
|
||||
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
||||
}
|
||||
|
||||
TearOffMenu *addTearOffMenu(const QString &title)
|
||||
|
|
|
|||
|
|
@ -45,15 +45,15 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
|||
|
||||
// Create the checkbox for navigation buttons visibility
|
||||
navigationCheckBox = new QCheckBox(this);
|
||||
navigationCheckBox->setChecked(SettingsCache::instance()->getPrintingSelectorNavigationButtonsVisible());
|
||||
navigationCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&PrintingSelector::toggleVisibilityNavigationButtons);
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorNavigationButtonsVisible);
|
||||
|
||||
cardSizeWidget =
|
||||
new CardSizeWidget(displayOptionsWidget, flowWidget, SettingsCache::instance()->getPrintingSelectorCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, SettingsCache::instance().get(),
|
||||
new CardSizeWidget(displayOptionsWidget, flowWidget, SettingsCache::instance().getPrintingSelectorCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorCardSize);
|
||||
|
||||
displayOptionsWidget->addSettingsWidget(sortToolBar);
|
||||
|
|
@ -76,7 +76,7 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
|||
layout->addWidget(flowWidget);
|
||||
|
||||
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this);
|
||||
cardSelectionBar->setVisible(SettingsCache::instance()->getPrintingSelectorNavigationButtonsVisible());
|
||||
cardSelectionBar->setVisible(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
layout->addWidget(cardSelectionBar);
|
||||
|
||||
// Connect deck model data change signal to update display
|
||||
|
|
@ -206,7 +206,7 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
|||
sortToolBar->filterSets(sortedPrintings, searchBar->getSearchText().trimmed().toLower());
|
||||
QList<PrintingInfo> printingsToUse;
|
||||
|
||||
if (SettingsCache::instance()->getBumpSetsWithCardsInDeckToTop()) {
|
||||
if (SettingsCache::instance().getBumpSetsWithCardsInDeckToTop()) {
|
||||
printingsToUse = sortToolBar->prependPrintingsInDeck(filteredPrintings, selectedCard, deckModel);
|
||||
} else {
|
||||
printingsToUse = filteredPrintings;
|
||||
|
|
|
|||
|
|
@ -168,20 +168,20 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
menu.addMenu(preferenceMenu);
|
||||
|
||||
const auto &preferredProviderId =
|
||||
SettingsCache::instance()->cardOverrides().getCardPreferenceOverride(rootCard.getName());
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard.getName());
|
||||
const auto &cardProviderId = rootCard.getPrinting().getUuid();
|
||||
|
||||
if (preferredProviderId.isEmpty() || preferredProviderId != cardProviderId) {
|
||||
auto *pinAction = preferenceMenu->addAction(tr("Pin Printing"));
|
||||
connect(pinAction, &QAction::triggered, this, [this] {
|
||||
SettingsCache::instance()->cardOverrides().setCardPreferenceOverride(
|
||||
SettingsCache::instance().cardOverrides().setCardPreferenceOverride(
|
||||
{rootCard.getName(), rootCard.getPrinting().getUuid()});
|
||||
emit cardPreferenceChanged();
|
||||
});
|
||||
} else {
|
||||
auto *unpinAction = preferenceMenu->addAction(tr("Unpin Printing"));
|
||||
connect(unpinAction, &QAction::triggered, this, [this] {
|
||||
SettingsCache::instance()->cardOverrides().deleteCardPreferenceOverride(rootCard.getName());
|
||||
SettingsCache::instance().cardOverrides().deleteCardPreferenceOverride(rootCard.getName());
|
||||
emit cardPreferenceChanged();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ PrintingSelectorCardSortingWidget::PrintingSelectorCardSortingWidget(PrintingSel
|
|||
sortOptionsSelector = new QComboBox(this);
|
||||
sortOptionsSelector->setFocusPolicy(Qt::StrongFocus);
|
||||
sortOptionsSelector->addItems(SORT_OPTIONS);
|
||||
sortOptionsSelector->setCurrentIndex(SettingsCache::instance()->getPrintingSelectorSortOrder());
|
||||
sortOptionsSelector->setCurrentIndex(SettingsCache::instance().getPrintingSelectorSortOrder());
|
||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, this,
|
||||
&PrintingSelectorCardSortingWidget::updateSortSetting);
|
||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, parent, &PrintingSelector::updateDisplay);
|
||||
|
|
@ -61,7 +61,7 @@ void PrintingSelectorCardSortingWidget::updateSortOrder()
|
|||
*/
|
||||
void PrintingSelectorCardSortingWidget::updateSortSetting()
|
||||
{
|
||||
SettingsCache::instance()->setPrintingSelectorSortOrder(sortOptionsSelector->currentIndex());
|
||||
SettingsCache::instance().setPrintingSelectorSortOrder(sortOptionsSelector->currentIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,7 +89,7 @@ QList<PrintingInfo> PrintingSelectorCardSortingWidget::sortSets(const SetToPrint
|
|||
}
|
||||
|
||||
if (sortedSets.empty()) {
|
||||
sortedSets << CardSet::newInstance(SettingsCache::instance()->cardDatabase(), "", "", "", QDate());
|
||||
sortedSets << CardSet::newInstance(SettingsCache::instance().cardDatabase(), "", "", "", QDate());
|
||||
}
|
||||
|
||||
if (sortOptionsSelector->currentText() == SORT_OPTIONS_PREFERENCE) {
|
||||
|
|
@ -156,7 +156,7 @@ QList<PrintingInfo> PrintingSelectorCardSortingWidget::prependPinnedPrintings(co
|
|||
const QString &cardName)
|
||||
{
|
||||
auto printingsToUse = printings;
|
||||
const auto &cardProviderId = SettingsCache::instance()->cardOverrides().getCardPreferenceOverride(cardName);
|
||||
const auto &cardProviderId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||
if (!cardProviderId.isEmpty()) {
|
||||
for (int i = 0; i < printingsToUse.size(); ++i) {
|
||||
const auto &card = printingsToUse[i];
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ ReplayManager::ReplayManager(TabGame *parent, GameReplay *_replay)
|
|||
|
||||
connect(this, &ReplayManager::requestChatAndPhaseReset, game, &TabGame::resetChatAndPhase);
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&ReplayManager::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ void ReplayManager::replayRewind()
|
|||
|
||||
void ReplayManager::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
if (aReplaySkipForward) {
|
||||
aReplaySkipForward->setShortcuts(shortcuts.getShortcut("Replays/aSkipForward"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void ReplayTimelineWidget::handleBackwardsSkip(bool doRewindBuffering)
|
|||
// The rewind only happens once the timer runs out.
|
||||
// If another backwards skip happens, the timer will just get reset instead of rewinding.
|
||||
rewindBufferingTimer->stop();
|
||||
rewindBufferingTimer->start(SettingsCache::instance()->getRewindBufferingMs());
|
||||
rewindBufferingTimer->start(SettingsCache::instance().getRewindBufferingMs());
|
||||
} else {
|
||||
// otherwise, process the rewind immediately
|
||||
processRewind();
|
||||
|
|
|
|||
|
|
@ -235,11 +235,11 @@ void ChatView::appendMessage(QString message,
|
|||
}
|
||||
cursor.setCharFormat(defaultFormat);
|
||||
|
||||
bool mentionEnabled = SettingsCache::instance()->getChatMention();
|
||||
bool mentionEnabled = SettingsCache::instance().getChatMention();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
highlightedWords = SettingsCache::instance()->getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
||||
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
||||
#else
|
||||
highlightedWords = SettingsCache::instance()->getHighlightWords().split(' ', QString::SkipEmptyParts);
|
||||
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
// parse the message
|
||||
|
|
@ -338,8 +338,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
|
|||
// You have received a valid mention!!
|
||||
soundEngine->playSound("chat_mention");
|
||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||
mentionFormat.setForeground(SettingsCache::instance()->getChatMentionForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
cursor.insertText(mention, mentionFormat);
|
||||
message = message.mid(mention.size());
|
||||
showSystemPopup(userName);
|
||||
|
|
@ -360,8 +360,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
|
|||
// Moderator Sending Global Message
|
||||
soundEngine->playSound("all_mention");
|
||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||
mentionFormat.setForeground(SettingsCache::instance()->getChatMentionForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
|
||||
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
|
||||
showSystemPopup(userName);
|
||||
|
|
@ -408,8 +408,8 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
|
|||
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
|
||||
// You have received a valid mention of custom word!!
|
||||
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
|
||||
highlightFormat.setForeground(SettingsCache::instance()->getChatHighlightForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
highlightFormat.setForeground(SettingsCache::instance().getChatHighlightForeground() ? QBrush(Qt::white)
|
||||
: QBrush(Qt::black));
|
||||
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
|
||||
cursor.insertText(rest, defaultFormat);
|
||||
QApplication::alert(this);
|
||||
|
|
@ -465,7 +465,7 @@ void ChatView::actMessageClicked()
|
|||
void ChatView::showSystemPopup(const QString &userName)
|
||||
{
|
||||
QApplication::alert(this);
|
||||
if (SettingsCache::instance()->getShowMentionPopup()) {
|
||||
if (SettingsCache::instance().getShowMentionPopup()) {
|
||||
emit showMentionPopup(userName);
|
||||
}
|
||||
}
|
||||
|
|
@ -473,10 +473,10 @@ void ChatView::showSystemPopup(const QString &userName)
|
|||
QColor ChatView::getCustomMentionColor()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance()->getChatMentionColor());
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#else
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + SettingsCache::instance()->getChatMentionColor());
|
||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#endif
|
||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||
}
|
||||
|
|
@ -484,10 +484,10 @@ QColor ChatView::getCustomMentionColor()
|
|||
QColor ChatView::getCustomHighlightColor()
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance()->getChatMentionColor());
|
||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#else
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + SettingsCache::instance()->getChatMentionColor());
|
||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
||||
#endif
|
||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ bool GamesProxyModel::areFilterParametersSetToDefaults() const
|
|||
|
||||
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||
{
|
||||
GameFiltersSettings &gameFilters = SettingsCache::instance()->gameFilters();
|
||||
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||
|
||||
QSet<int> newGameTypeFilter;
|
||||
QMapIterator<int, QString> gameTypesIterator(allGameTypes);
|
||||
|
|
@ -387,7 +387,7 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
|||
|
||||
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||
{
|
||||
GameFiltersSettings &gameFilters = SettingsCache::instance()->gameFilters();
|
||||
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
|
||||
gameFilters.setHideBuddiesOnlyGames(hideBuddiesOnlyGames);
|
||||
gameFilters.setHideFullGames(hideFullGames);
|
||||
gameFilters.setHideGamesThatStarted(hideGamesThatStarted);
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ void HandlePublicServers::updateServerINISettings(QMap<QString, QVariant> jsonMa
|
|||
}
|
||||
|
||||
if (serverFound) {
|
||||
SettingsCache::instance()->servers().updateExistingServerWithoutLoss(serverName, serverAddress, serverPort,
|
||||
serverSite);
|
||||
SettingsCache::instance().servers().updateExistingServerWithoutLoss(serverName, serverAddress, serverPort,
|
||||
serverSite);
|
||||
} else {
|
||||
SettingsCache::instance()->servers().addNewServer(serverName, serverAddress, serverPort, "", "", false,
|
||||
serverSite);
|
||||
SettingsCache::instance().servers().addNewServer(serverName, serverAddress, serverPort, "", "", false,
|
||||
serverSite);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ void HandlePublicServers::updateServerINISettings(QMap<QString, QVariant> jsonMa
|
|||
QString serverAddr = pair.first;
|
||||
|
||||
if (publicServersToRemove.indexOf(serverAddr) != -1) {
|
||||
SettingsCache::instance()->servers().removeServer(serverAddr);
|
||||
SettingsCache::instance().servers().removeServer(serverAddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ QMap<QString, std::pair<QString, UserConnection_Information>> UserConnection_Inf
|
|||
{
|
||||
QMap<QString, std::pair<QString, UserConnection_Information>> serverList;
|
||||
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
|
||||
int size = servers.getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ QStringList UserConnection_Information::getServerInfo(const QString &find)
|
|||
{
|
||||
QStringList _server;
|
||||
|
||||
ServersSettings &servers = SettingsCache::instance()->servers();
|
||||
ServersSettings &servers = SettingsCache::instance().servers();
|
||||
|
||||
int size = servers.getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
|
|
|||
|
|
@ -49,11 +49,9 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
|
|||
cardInfoDockWidget = new DeckEditorCardInfoDockWidget(this);
|
||||
filterDockWidget = new DeckEditorFilterDockWidget(this);
|
||||
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
[this] {
|
||||
printingSelectorDockWidget->setHidden(
|
||||
SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference());
|
||||
});
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, [this] {
|
||||
printingSelectorDockWidget->setHidden(SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
});
|
||||
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified);
|
||||
|
|
@ -73,7 +71,7 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
|
|||
connect(filterDockWidget, &DeckEditorFilterDockWidget::clearAllDatabaseFilters, databaseDisplayDockWidget,
|
||||
&DeckEditorDatabaseDisplayWidget::clearAllDatabaseFilters);
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&AbstractTabDeckEditor::refreshShortcuts);
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +153,7 @@ void AbstractTabDeckEditor::openDeck(DeckLoader *deck)
|
|||
setDeck(deck);
|
||||
|
||||
if (!deck->getLastFileName().isEmpty()) {
|
||||
SettingsCache::instance()->recents().updateRecentlyOpenedDeckPaths(deck->getLastFileName());
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(deck->getLastFileName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +227,7 @@ void AbstractTabDeckEditor::cleanDeckAndResetModified()
|
|||
AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const bool openInSameTabIfBlank)
|
||||
{
|
||||
// handle `openDeckInNewTab` setting
|
||||
if (SettingsCache::instance()->getOpenDeckInNewTab()) {
|
||||
if (SettingsCache::instance().getOpenDeckInNewTab()) {
|
||||
if (openInSameTabIfBlank && isBlankNewDeck()) {
|
||||
return SAME_TAB;
|
||||
} else {
|
||||
|
|
@ -368,7 +366,7 @@ bool AbstractTabDeckEditor::actSaveDeck()
|
|||
bool AbstractTabDeckEditor::actSaveDeckAs()
|
||||
{
|
||||
QFileDialog dialog(this, tr("Save deck"));
|
||||
dialog.setDirectory(SettingsCache::instance()->getDeckPath());
|
||||
dialog.setDirectory(SettingsCache::instance().getDeckPath());
|
||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
dialog.setDefaultSuffix("cod");
|
||||
dialog.setNameFilters(DeckLoader::FILE_NAME_FILTERS);
|
||||
|
|
@ -388,7 +386,7 @@ bool AbstractTabDeckEditor::actSaveDeckAs()
|
|||
}
|
||||
setModified(false);
|
||||
|
||||
SettingsCache::instance()->recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -579,7 +577,7 @@ bool AbstractTabDeckEditor::eventFilter(QObject *o, QEvent *e)
|
|||
}
|
||||
}
|
||||
if (o == this && e->type() == QEvent::Hide) {
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
layouts.setDeckEditorLayoutState(saveState());
|
||||
layouts.setDeckEditorGeometry(saveGeometry());
|
||||
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
|
||||
|
|
|
|||
|
|
@ -93,11 +93,11 @@ void TabDeckEditor::createMenus()
|
|||
aPrintingSelectorDockFloating->setCheckable(true);
|
||||
connect(aPrintingSelectorDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
|
||||
|
||||
if (SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
printingSelectorDockMenu->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
|
@ -151,7 +151,7 @@ void TabDeckEditor::retranslateUi()
|
|||
|
||||
void TabDeckEditor::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aResetLayout->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aResetLayout"));
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ void TabDeckEditor::showPrintingSelector()
|
|||
|
||||
void TabDeckEditor::loadLayout()
|
||||
{
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
|
||||
setCentralWidget(databaseDisplayDockWidget);
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ void TabDeckEditor::loadLayout()
|
|||
restoreGeometry(layouts.getDeckEditorGeometry());
|
||||
}
|
||||
|
||||
if (SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!printingSelectorDockWidget->isHidden()) {
|
||||
printingSelectorDockWidget->setHidden(true);
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
|
|
@ -221,7 +221,7 @@ void TabDeckEditor::restartLayout()
|
|||
aCardInfoDockVisible->setChecked(true);
|
||||
aDeckDockVisible->setChecked(true);
|
||||
aFilterDockVisible->setChecked(true);
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference());
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
aCardInfoDockFloating->setChecked(false);
|
||||
aDeckDockFloating->setChecked(false);
|
||||
|
|
@ -242,7 +242,7 @@ void TabDeckEditor::restartLayout()
|
|||
deckDockWidget->setVisible(true);
|
||||
cardInfoDockWidget->setVisible(true);
|
||||
filterDockWidget->setVisible(true);
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference());
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal);
|
||||
splitDockWidget(printingSelectorDockWidget, deckDockWidget, Qt::Horizontal);
|
||||
|
|
@ -362,7 +362,7 @@ bool TabDeckEditor::eventFilter(QObject *o, QEvent *e)
|
|||
}
|
||||
}
|
||||
if (o == this && e->type() == QEvent::Hide) {
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
layouts.setDeckEditorLayoutState(saveState());
|
||||
layouts.setDeckEditorGeometry(saveGeometry());
|
||||
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
|
|||
: Tab(_tabSupervisor), client(_client)
|
||||
{
|
||||
localDirModel = new QFileSystemModel(this);
|
||||
localDirModel->setRootPath(SettingsCache::instance()->getDeckPath());
|
||||
localDirModel->setRootPath(SettingsCache::instance().getDeckPath());
|
||||
localDirModel->sort(0, Qt::AscendingOrder);
|
||||
|
||||
localDirView = new QTreeView;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
connectMessageLogToGameEventHandler();
|
||||
|
||||
retranslateUi();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&TabGame::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
messageLog->logReplayStarted(game->getGameMetaInfo()->gameId());
|
||||
|
|
@ -125,7 +125,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
connectMessageLogToGameEventHandler();
|
||||
|
||||
retranslateUi();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&TabGame::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ void TabGame::resetChatAndPhase()
|
|||
void TabGame::emitUserEvent()
|
||||
{
|
||||
bool globalEvent =
|
||||
!game->getPlayerManager()->isSpectator() || SettingsCache::instance()->getSpectatorNotificationsEnabled();
|
||||
!game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled();
|
||||
emit userEvent(globalEvent);
|
||||
updatePlayerListDockTitle();
|
||||
}
|
||||
|
|
@ -377,7 +377,7 @@ void TabGame::retranslateUi()
|
|||
|
||||
void TabGame::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
for (int i = 0; i < phaseActions.size(); ++i) {
|
||||
QAction *temp = phaseActions.at(i);
|
||||
switch (i) {
|
||||
|
|
@ -625,8 +625,8 @@ void TabGame::actRotateViewCCW()
|
|||
|
||||
void TabGame::actCompleterChanged()
|
||||
{
|
||||
SettingsCache::instance()->getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||
: completer->setCompletionRole(1);
|
||||
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||
: completer->setCompletionRole(1);
|
||||
}
|
||||
|
||||
void TabGame::notifyPlayerJoin(QString playerName)
|
||||
|
|
@ -688,7 +688,7 @@ void TabGame::addLocalPlayer(Player *newPlayer, int playerId)
|
|||
deckViewContainerLayout->addWidget(deckView);
|
||||
|
||||
// auto load deck for player if that debug setting is enabled
|
||||
QString deckPath = SettingsCache::instance()->debug().getDeckPathForPlayer(newPlayer->getPlayerInfo()->getName());
|
||||
QString deckPath = SettingsCache::instance().debug().getDeckPathForPlayer(newPlayer->getPlayerInfo()->getName());
|
||||
if (!deckPath.isEmpty()) {
|
||||
QTimer::singleShot(0, this, [deckView, deckPath] {
|
||||
deckView->playerDeckView->loadDeckFromFile(deckPath);
|
||||
|
|
@ -1089,7 +1089,7 @@ void TabGame::createViewMenuItems()
|
|||
|
||||
void TabGame::loadLayout()
|
||||
{
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
if (replayManager->replay) {
|
||||
restoreGeometry(layouts.getReplayPlayAreaGeometry());
|
||||
restoreState(layouts.getReplayPlayAreaLayoutState());
|
||||
|
|
@ -1323,7 +1323,7 @@ void TabGame::createMessageDock(bool bReplay)
|
|||
if (!bReplay) {
|
||||
connect(messageLog, &MessageLogWidget::openMessageDialog, this, &TabGame::openMessageDialog);
|
||||
connect(messageLog, &MessageLogWidget::addMentionTag, this, &TabGame::addMentionTag);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::chatMentionCompleterChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
|
||||
&TabGame::actCompleterChanged);
|
||||
}
|
||||
|
||||
|
|
@ -1384,7 +1384,7 @@ void TabGame::createMessageDock(bool bReplay)
|
|||
|
||||
void TabGame::hideEvent(QHideEvent *event)
|
||||
{
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
if (replayManager->replay) {
|
||||
layouts.setReplayPlayAreaState(saveState());
|
||||
layouts.setReplayPlayAreaGeometry(saveGeometry());
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
|
|||
chatView->appendMessage(QString::fromStdString(event.message()), {}, *userInfo, true);
|
||||
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this))
|
||||
soundEngine->playSound("private_message");
|
||||
if (SettingsCache::instance()->getShowMessagePopup() && shouldShowSystemPopup(event))
|
||||
if (SettingsCache::instance().getShowMessagePopup() && shouldShowSystemPopup(event))
|
||||
showSystemPopup(event);
|
||||
if (QString::fromStdString(event.sender_name()).toLower().simplified() == "servatrice")
|
||||
sayEdit->setDisabled(true);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
|||
QGroupBox *TabReplays::createLeftLayout()
|
||||
{
|
||||
localDirModel = new QFileSystemModel(this);
|
||||
localDirModel->setRootPath(SettingsCache::instance()->getReplaysPath());
|
||||
localDirModel->setRootPath(SettingsCache::instance().getReplaysPath());
|
||||
localDirModel->sort(0, Qt::AscendingOrder);
|
||||
|
||||
localDirView = new QTreeView;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
|||
connect(chatView, &ChatView::showCardInfoPopup, this, &TabRoom::showCardInfoPopup);
|
||||
connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabRoom::deleteCardInfoPopup);
|
||||
connect(chatView, &ChatView::addMentionTag, this, &TabRoom::addMentionTag);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::chatMentionCompleterChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
|
||||
&TabRoom::actCompleterChanged);
|
||||
sayLabel = new QLabel;
|
||||
sayEdit = new LineEditCompleter;
|
||||
|
|
@ -127,7 +127,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
|||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&TabRoom::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
||||
|
|
@ -229,8 +229,8 @@ void TabRoom::actOpenChatSettings()
|
|||
|
||||
void TabRoom::actCompleterChanged()
|
||||
{
|
||||
SettingsCache::instance()->getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||
: completer->setCompletionRole(1);
|
||||
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||
: completer->setCompletionRole(1);
|
||||
}
|
||||
|
||||
void TabRoom::processRoomEvent(const RoomEvent &event)
|
||||
|
|
@ -291,12 +291,12 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
|||
ServerInfo_User userInfo = {};
|
||||
if (twi) {
|
||||
userInfo = twi->getUserInfo();
|
||||
if (SettingsCache::instance()->getIgnoreUnregisteredUsers() &&
|
||||
if (SettingsCache::instance().getIgnoreUnregisteredUsers() &&
|
||||
!UserLevelFlags(userInfo.user_level()).testFlag(ServerInfo_User::IsRegistered))
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.message_type() == Event_RoomSay::ChatHistory && !SettingsCache::instance()->getRoomHistory())
|
||||
if (event.message_type() == Event_RoomSay::ChatHistory && !SettingsCache::instance().getRoomHistory())
|
||||
return;
|
||||
|
||||
if (event.message_type() == Event_RoomSay::ChatHistory)
|
||||
|
|
@ -318,7 +318,7 @@ void TabRoom::processRemoveMessagesEvent(const Event_RemoveMessages &event)
|
|||
|
||||
void TabRoom::refreshShortcuts()
|
||||
{
|
||||
aClearChat->setShortcuts(SettingsCache::instance()->shortcuts().getShortcut("tab_room/aClearChat"));
|
||||
aClearChat->setShortcuts(SettingsCache::instance().shortcuts().getShortcut("tab_room/aClearChat"));
|
||||
}
|
||||
|
||||
void TabRoom::addMentionTag(QString mentionTag)
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
|
|||
aTabLog->setCheckable(true);
|
||||
connect(aTabLog, &QAction::triggered, this, &TabSupervisor::actTabLog);
|
||||
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&TabSupervisor::refreshShortcuts);
|
||||
refreshShortcuts();
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ void TabSupervisor::retranslateUi()
|
|||
|
||||
void TabSupervisor::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aTabDeckEditor->setShortcuts(shortcuts.getShortcut("Tabs/aTabDeckEditor"));
|
||||
aTabVisualDeckEditor->setShortcuts(shortcuts.getShortcut("Tabs/aTabVisualDeckEditor"));
|
||||
|
||||
|
|
@ -323,13 +323,13 @@ void TabSupervisor::initStartupTabs()
|
|||
openTabHome();
|
||||
setCurrentWidget(tabHome);
|
||||
|
||||
if (SettingsCache::instance()->getTabVisualDeckStorageOpen()) {
|
||||
if (SettingsCache::instance().getTabVisualDeckStorageOpen()) {
|
||||
openTabVisualDeckStorage();
|
||||
}
|
||||
if (SettingsCache::instance()->getTabDeckStorageOpen()) {
|
||||
if (SettingsCache::instance().getTabDeckStorageOpen()) {
|
||||
openTabDeckStorage();
|
||||
}
|
||||
if (SettingsCache::instance()->getTabReplaysOpen()) {
|
||||
if (SettingsCache::instance().getTabReplaysOpen()) {
|
||||
openTabReplays();
|
||||
}
|
||||
}
|
||||
|
|
@ -408,10 +408,10 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
|||
tabsMenu->addAction(aTabServer);
|
||||
tabsMenu->addAction(aTabAccount);
|
||||
|
||||
if (SettingsCache::instance()->getTabServerOpen()) {
|
||||
if (SettingsCache::instance().getTabServerOpen()) {
|
||||
openTabServer();
|
||||
}
|
||||
if (SettingsCache::instance()->getTabAccountOpen()) {
|
||||
if (SettingsCache::instance().getTabAccountOpen()) {
|
||||
openTabAccount();
|
||||
}
|
||||
|
||||
|
|
@ -422,10 +422,10 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
|||
tabsMenu->addAction(aTabAdmin);
|
||||
tabsMenu->addAction(aTabLog);
|
||||
|
||||
if (SettingsCache::instance()->getTabAdminOpen()) {
|
||||
if (SettingsCache::instance().getTabAdminOpen()) {
|
||||
openTabAdmin();
|
||||
}
|
||||
if (SettingsCache::instance()->getTabLogOpen()) {
|
||||
if (SettingsCache::instance().getTabLogOpen()) {
|
||||
openTabLog();
|
||||
}
|
||||
}
|
||||
|
|
@ -528,7 +528,7 @@ void TabSupervisor::openTabHome()
|
|||
|
||||
void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabVisualDeckStorageOpen(checked);
|
||||
SettingsCache::instance().setTabVisualDeckStorageOpen(checked);
|
||||
if (checked && !tabVisualDeckStorage) {
|
||||
openTabVisualDeckStorage();
|
||||
setCurrentWidget(tabVisualDeckStorage);
|
||||
|
|
@ -552,7 +552,7 @@ void TabSupervisor::openTabVisualDeckStorage()
|
|||
|
||||
void TabSupervisor::actTabServer(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabServerOpen(checked);
|
||||
SettingsCache::instance().setTabServerOpen(checked);
|
||||
if (checked && !tabServer) {
|
||||
openTabServer();
|
||||
setCurrentWidget(tabServer);
|
||||
|
|
@ -575,7 +575,7 @@ void TabSupervisor::openTabServer()
|
|||
|
||||
void TabSupervisor::actTabAccount(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabAccountOpen(checked);
|
||||
SettingsCache::instance().setTabAccountOpen(checked);
|
||||
if (checked && !tabAccount) {
|
||||
openTabAccount();
|
||||
setCurrentWidget(tabAccount);
|
||||
|
|
@ -600,7 +600,7 @@ void TabSupervisor::openTabAccount()
|
|||
|
||||
void TabSupervisor::actTabDeckStorage(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabDeckStorageOpen(checked);
|
||||
SettingsCache::instance().setTabDeckStorageOpen(checked);
|
||||
if (checked && !tabDeckStorage) {
|
||||
openTabDeckStorage();
|
||||
setCurrentWidget(tabDeckStorage);
|
||||
|
|
@ -623,7 +623,7 @@ void TabSupervisor::openTabDeckStorage()
|
|||
|
||||
void TabSupervisor::actTabReplays(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabReplaysOpen(checked);
|
||||
SettingsCache::instance().setTabReplaysOpen(checked);
|
||||
if (checked && !tabReplays) {
|
||||
openTabReplays();
|
||||
setCurrentWidget(tabReplays);
|
||||
|
|
@ -648,7 +648,7 @@ void TabSupervisor::openTabReplays()
|
|||
|
||||
void TabSupervisor::actTabAdmin(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabAdminOpen(checked);
|
||||
SettingsCache::instance().setTabAdminOpen(checked);
|
||||
if (checked && !tabAdmin) {
|
||||
openTabAdmin();
|
||||
setCurrentWidget(tabAdmin);
|
||||
|
|
@ -671,7 +671,7 @@ void TabSupervisor::openTabAdmin()
|
|||
|
||||
void TabSupervisor::actTabLog(bool checked)
|
||||
{
|
||||
SettingsCache::instance()->setTabLogOpen(checked);
|
||||
SettingsCache::instance().setTabLogOpen(checked);
|
||||
if (checked && !tabLog) {
|
||||
openTabLog();
|
||||
setCurrentWidget(tabLog);
|
||||
|
|
@ -849,7 +849,7 @@ void TabSupervisor::talkLeft(TabMessage *tab)
|
|||
*/
|
||||
void TabSupervisor::openDeckInNewTab(const DeckLoader *deckToOpen)
|
||||
{
|
||||
int type = SettingsCache::instance()->getDefaultDeckEditorType();
|
||||
int type = SettingsCache::instance().getDefaultDeckEditorType();
|
||||
switch (type) {
|
||||
case ClassicDeckEditor:
|
||||
addDeckEditorTab(deckToOpen);
|
||||
|
|
@ -940,7 +940,7 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
|
|||
tab->setContentsChanged(true);
|
||||
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
||||
}
|
||||
if (globalEvent && SettingsCache::instance()->getNotificationsEnabled())
|
||||
if (globalEvent && SettingsCache::instance().getNotificationsEnabled())
|
||||
QApplication::alert(this);
|
||||
}
|
||||
|
||||
|
|
@ -978,7 +978,7 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
|||
const ServerInfo_User *onlineUserInfo = userListManager->getOnlineUser(senderName);
|
||||
if (onlineUserInfo) {
|
||||
auto userLevel = UserLevelFlags(onlineUserInfo->user_level());
|
||||
if (SettingsCache::instance()->getIgnoreUnregisteredUserMessages() &&
|
||||
if (SettingsCache::instance().getIgnoreUnregisteredUserMessages() &&
|
||||
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
||||
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||
return;
|
||||
|
|
@ -1022,7 +1022,7 @@ void TabSupervisor::processUserJoined(const ServerInfo_User &userInfoJoined)
|
|||
}
|
||||
}
|
||||
|
||||
if (SettingsCache::instance()->getBuddyConnectNotificationsEnabled()) {
|
||||
if (SettingsCache::instance().getBuddyConnectNotificationsEnabled()) {
|
||||
QApplication::alert(this);
|
||||
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ TabDeckEditorVisual::TabDeckEditorVisual(TabSupervisor *_tabSupervisor) : Abstra
|
|||
installEventFilter(this);
|
||||
|
||||
TabDeckEditorVisual::retranslateUi();
|
||||
connect(&SettingsCache::instance().get()->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||
TabDeckEditorVisual::refreshShortcuts();
|
||||
|
||||
TabDeckEditorVisual::loadLayout();
|
||||
|
|
@ -126,11 +126,11 @@ void TabDeckEditorVisual::createMenus()
|
|||
aPrintingSelectorDockFloating->setCheckable(true);
|
||||
connect(aPrintingSelectorDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered()));
|
||||
|
||||
if (SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
printingSelectorDockMenu->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
|
@ -228,13 +228,13 @@ void TabDeckEditorVisual::freeDocksSize()
|
|||
|
||||
void TabDeckEditorVisual::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance()->shortcuts();
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
aResetLayout->setShortcuts(shortcuts.getShortcut("TabDeckEditorVisual/aResetLayout"));
|
||||
}
|
||||
|
||||
void TabDeckEditorVisual::loadLayout()
|
||||
{
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
auto &layoutState = layouts.getDeckEditorLayoutState();
|
||||
if (layoutState.isNull()) {
|
||||
restartLayout();
|
||||
|
|
@ -243,7 +243,7 @@ void TabDeckEditorVisual::loadLayout()
|
|||
restoreGeometry(layouts.getDeckEditorGeometry());
|
||||
}
|
||||
|
||||
if (SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!printingSelectorDockWidget->isHidden()) {
|
||||
printingSelectorDockWidget->setHidden(true);
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
|
|
@ -285,7 +285,7 @@ void TabDeckEditorVisual::restartLayout()
|
|||
aCardInfoDockVisible->setChecked(true);
|
||||
aDeckDockVisible->setChecked(true);
|
||||
aFilterDockVisible->setChecked(false);
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference());
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
aCardInfoDockFloating->setChecked(false);
|
||||
aDeckDockFloating->setChecked(false);
|
||||
|
|
@ -301,7 +301,7 @@ void TabDeckEditorVisual::restartLayout()
|
|||
deckDockWidget->setVisible(true);
|
||||
cardInfoDockWidget->setVisible(true);
|
||||
filterDockWidget->setVisible(false);
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance()->getOverrideAllCardArtWithPersonalPreference());
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
deckDockWidget->setFloating(false);
|
||||
cardInfoDockWidget->setFloating(false);
|
||||
|
|
@ -363,7 +363,7 @@ bool TabDeckEditorVisual::eventFilter(QObject *o, QEvent *e)
|
|||
}
|
||||
}
|
||||
if (o == this && e->type() == QEvent::Hide) {
|
||||
LayoutsSettings &layouts = SettingsCache::instance()->layouts();
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
layouts.setDeckEditorLayoutState(saveState());
|
||||
layouts.setDeckEditorGeometry(saveGeometry());
|
||||
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ bool LineEditUnfocusable::isUnfocusShortcut(QKeyEvent *event)
|
|||
keyNoMod = QKeySequence(event->key()).toString();
|
||||
|
||||
QKeySequence key(modifier + keyNoMod);
|
||||
QList<QKeySequence> unfocusShortcut = SettingsCache::instance()->shortcuts().getShortcut("Player/unfocusTextBox");
|
||||
QList<QKeySequence> unfocusShortcut = SettingsCache::instance().shortcuts().getShortcut("Player/unfocusTextBox");
|
||||
|
||||
for (const auto &unfocusKey : unfocusShortcut) {
|
||||
if (key.matches(unfocusKey) == QKeySequence::ExactMatch)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void SequenceEdit::setShortcutName(const QString &_shortcutName)
|
|||
clearButton->setEnabled(true);
|
||||
defaultButton->setEnabled(true);
|
||||
lineEdit->setEnabled(true);
|
||||
lineEdit->setText(SettingsCache::instance()->shortcuts().getShortcutString(shortcutName));
|
||||
lineEdit->setText(SettingsCache::instance().shortcuts().getShortcutString(shortcutName));
|
||||
// Correct as in-line translation
|
||||
lineEdit->setPlaceholderText(tr("Hit the key/combination of keys you want to set for this action"));
|
||||
}
|
||||
|
|
@ -74,13 +74,13 @@ void SequenceEdit::removeLastShortcut()
|
|||
|
||||
void SequenceEdit::restoreDefault()
|
||||
{
|
||||
lineEdit->setText(SettingsCache::instance()->shortcuts().getDefaultShortcutString(shortcutName));
|
||||
lineEdit->setText(SettingsCache::instance().shortcuts().getDefaultShortcutString(shortcutName));
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void SequenceEdit::refreshShortcut()
|
||||
{
|
||||
lineEdit->setText(SettingsCache::instance()->shortcuts().getShortcutString(shortcutName));
|
||||
lineEdit->setText(SettingsCache::instance().shortcuts().getShortcutString(shortcutName));
|
||||
}
|
||||
|
||||
void SequenceEdit::clear()
|
||||
|
|
@ -169,7 +169,7 @@ bool SequenceEdit::validateShortcut(const QKeySequence &sequence)
|
|||
return true;
|
||||
}
|
||||
|
||||
const auto &shortcutsSettings = SettingsCache::instance()->shortcuts();
|
||||
const auto &shortcutsSettings = SettingsCache::instance().shortcuts();
|
||||
const QString sequenceString = sequence.toString();
|
||||
|
||||
if (!shortcutsSettings.isKeyAllowed(shortcutName, sequenceString)) {
|
||||
|
|
@ -209,7 +209,7 @@ void SequenceEdit::finishShortcut()
|
|||
|
||||
void SequenceEdit::updateSettings()
|
||||
{
|
||||
SettingsCache::instance()->shortcuts().setShortcuts(shortcutName, lineEdit->text());
|
||||
SettingsCache::instance().shortcuts().setShortcuts(shortcutName, lineEdit->text());
|
||||
}
|
||||
|
||||
void SequenceEdit::retranslateUi()
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::saveFilter()
|
|||
if (filename.isEmpty())
|
||||
return;
|
||||
|
||||
QString filePath = SettingsCache::instance()->getFiltersPath() + QDir::separator() + filename + ".json";
|
||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename + ".json";
|
||||
|
||||
// Serialize the filter model to JSON
|
||||
QJsonArray filtersArray;
|
||||
|
|
@ -74,7 +74,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::saveFilter()
|
|||
|
||||
void VisualDatabaseDisplayFilterSaveLoadWidget::loadFilter(const QString &filename)
|
||||
{
|
||||
QString filePath = SettingsCache::instance()->getFiltersPath() + QDir::separator() + filename;
|
||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename;
|
||||
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
|
|
@ -124,7 +124,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::refreshFilterList()
|
|||
fileButtons.clear(); // Clear the list of buttons
|
||||
|
||||
// Refresh the filter file list
|
||||
QDir dir(SettingsCache::instance()->getFiltersPath());
|
||||
QDir dir(SettingsCache::instance().getFiltersPath());
|
||||
QStringList filterFiles = dir.entryList(QStringList() << "*.json", QDir::Files, QDir::Name);
|
||||
|
||||
// Loop through the filter files and create widgets for them
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@ VisualDatabaseDisplayRecentSetFilterSettingsWidget::VisualDatabaseDisplayRecentS
|
|||
|
||||
filterToMostRecentSetsCheckBox = new QCheckBox(this);
|
||||
filterToMostRecentSetsCheckBox->setChecked(
|
||||
SettingsCache::instance()->getVisualDatabaseDisplayFilterToMostRecentSetsEnabled());
|
||||
connect(filterToMostRecentSetsCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled());
|
||||
connect(filterToMostRecentSetsCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDatabaseDisplayFilterToMostRecentSetsEnabled);
|
||||
|
||||
filterToMostRecentSetsAmount = new QSpinBox(this);
|
||||
filterToMostRecentSetsAmount->setMinimum(1);
|
||||
filterToMostRecentSetsAmount->setMaximum(100);
|
||||
filterToMostRecentSetsAmount->setValue(
|
||||
SettingsCache::instance()->getVisualDatabaseDisplayFilterToMostRecentSetsAmount());
|
||||
connect(filterToMostRecentSetsAmount, QOverload<int>::of(&QSpinBox::valueChanged), SettingsCache::instance().get(),
|
||||
SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsAmount());
|
||||
connect(filterToMostRecentSetsAmount, QOverload<int>::of(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDatabaseDisplayFilterToMostRecentSetsAmount);
|
||||
|
||||
layout->addWidget(filterToMostRecentSetsCheckBox);
|
||||
|
|
@ -54,10 +54,10 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
|||
recentSetsSettingsWidget = new VisualDatabaseDisplayRecentSetFilterSettingsWidget(this);
|
||||
layout->addWidget(recentSetsSettingsWidget);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged,
|
||||
this, &VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged,
|
||||
this, &VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged, this,
|
||||
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged, this,
|
||||
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||
|
||||
searchBox = new QLineEdit(this);
|
||||
searchBox->setPlaceholderText(tr("Search sets..."));
|
||||
|
|
@ -115,7 +115,7 @@ void VisualDatabaseDisplaySetFilterWidget::createSetButtons()
|
|||
|
||||
void VisualDatabaseDisplaySetFilterWidget::filterToRecentSets()
|
||||
{
|
||||
if (SettingsCache::instance()->getVisualDatabaseDisplayFilterToMostRecentSetsEnabled()) {
|
||||
if (SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled()) {
|
||||
for (auto set : activeSets.keys()) {
|
||||
activeSets[set] = false;
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ void VisualDatabaseDisplaySetFilterWidget::filterToRecentSets()
|
|||
std::sort(allSets.begin(), allSets.end(),
|
||||
[](const auto &a, const auto &b) { return a->getReleaseDate() > b->getReleaseDate(); });
|
||||
|
||||
int setsToPreactivate = SettingsCache::instance()->getVisualDatabaseDisplayFilterToMostRecentSetsAmount();
|
||||
int setsToPreactivate = SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsAmount();
|
||||
int setsActivated = 0;
|
||||
|
||||
for (const auto &set : allSets) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void FilterDisplayWidget::deleteFilter()
|
|||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
// If confirmed, delete the filter
|
||||
QString filePath = SettingsCache::instance()->getFiltersPath() + QDir::separator() + filterFilename;
|
||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filterFilename;
|
||||
QFile file(filePath);
|
||||
if (file.remove()) {
|
||||
emit filterDeleted(filterFilename); // Emit signal for deletion
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
|||
resetAndHandSizeLayout->addWidget(resetButton);
|
||||
|
||||
handSizeSpinBox = new QSpinBox(this);
|
||||
handSizeSpinBox->setValue(SettingsCache::instance()->getVisualDeckEditorSampleHandSize());
|
||||
handSizeSpinBox->setValue(SettingsCache::instance().getVisualDeckEditorSampleHandSize());
|
||||
handSizeSpinBox->setMinimum(1);
|
||||
connect(handSizeSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), SettingsCache::instance().get(),
|
||||
connect(handSizeSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckEditorSampleHandSize);
|
||||
connect(handSizeSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
&VisualDeckEditorSampleHandWidget::updateDisplay);
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
if (DeckLoader::getFormatFromName(deckPreviewWidget->filePath) != DeckLoader::CockatriceFormat) {
|
||||
canAddTags = false;
|
||||
// Retrieve saved preference if the prompt is disabled
|
||||
if (!SettingsCache::instance()->getVisualDeckStoragePromptForConversion()) {
|
||||
if (SettingsCache::instance()->getVisualDeckStorageAlwaysConvert()) {
|
||||
if (!SettingsCache::instance().getVisualDeckStoragePromptForConversion()) {
|
||||
if (SettingsCache::instance().getVisualDeckStorageAlwaysConvert()) {
|
||||
|
||||
if (!confirmOverwriteIfExists(this, deckPreviewWidget->filePath))
|
||||
return;
|
||||
|
|
@ -130,16 +130,16 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
canAddTags = true;
|
||||
|
||||
if (conversionDialog.dontAskAgain()) {
|
||||
SettingsCache::instance()->setVisualDeckStoragePromptForConversion(false);
|
||||
SettingsCache::instance()->setVisualDeckStorageAlwaysConvert(true);
|
||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(false);
|
||||
SettingsCache::instance().setVisualDeckStorageAlwaysConvert(true);
|
||||
}
|
||||
} else {
|
||||
SettingsCache::instance()->setVisualDeckStorageAlwaysConvert(false);
|
||||
SettingsCache::instance().setVisualDeckStorageAlwaysConvert(false);
|
||||
|
||||
if (conversionDialog.dontAskAgain()) {
|
||||
SettingsCache::instance()->setVisualDeckStoragePromptForConversion(false);
|
||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(false);
|
||||
} else {
|
||||
SettingsCache::instance()->setVisualDeckStoragePromptForConversion(true);
|
||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
if (qobject_cast<AbstractTabDeckEditor *>(currentParent)) {
|
||||
auto *deckEditor = qobject_cast<AbstractTabDeckEditor *>(currentParent);
|
||||
QStringList knownTags;
|
||||
QStringList allFiles = getAllFiles(SettingsCache::instance()->getDeckPath());
|
||||
QStringList allFiles = getAllFiles(SettingsCache::instance().getDeckPath());
|
||||
DeckLoader loader;
|
||||
for (const QString &file : allFiles) {
|
||||
loader.loadFromFile(file, DeckLoader::getFormatFromName(file), false);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DeckPreviewTagDialog::DeckPreviewTagDialog(const QStringList &knownTags,
|
|||
{
|
||||
resize(400, 500);
|
||||
|
||||
QStringList defaultTags = SettingsCache::instance()->getVisualDeckStorageDefaultTagsList();
|
||||
QStringList defaultTags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
||||
|
||||
// Merge knownTags with defaultTags, ensuring no duplicates
|
||||
QStringList combinedTags = defaultTags + knownTags + activeTags;
|
||||
|
|
@ -91,7 +91,7 @@ DeckPreviewTagDialog::DeckPreviewTagDialog(const QStringList &knownTags,
|
|||
connect(okButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::accept);
|
||||
connect(cancelButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::reject);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageDefaultTagsListChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDefaultTagsListChanged, this,
|
||||
&DeckPreviewTagDialog::refreshTagList);
|
||||
|
||||
retranslateUi();
|
||||
|
|
@ -115,7 +115,7 @@ void DeckPreviewTagDialog::refreshTagList()
|
|||
tagListView->clear();
|
||||
|
||||
// Get the updated list of tags from SettingsCache
|
||||
QStringList defaultTags = SettingsCache::instance()->getVisualDeckStorageDefaultTagsList();
|
||||
QStringList defaultTags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
||||
QStringList combinedTags = defaultTags + knownTags_ + activeTags;
|
||||
combinedTags.removeDuplicates();
|
||||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent,
|
|||
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageDoubleClicked, this,
|
||||
&DeckPreviewWidget::imageDoubleClickedEvent);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageShowTagsOnDeckPreviewsChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowTagsOnDeckPreviewsChanged, this,
|
||||
&DeckPreviewWidget::updateTagsVisibility);
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::visualDeckStorageShowBannerCardComboBoxChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowBannerCardComboBoxChanged, this,
|
||||
&DeckPreviewWidget::updateBannerCardComboBoxVisibility);
|
||||
connect(visualDeckStorageWidget->settings(), &VisualDeckStorageQuickSettingsWidget::deckPreviewTooltipChanged, this,
|
||||
&DeckPreviewWidget::refreshBannerCardToolTip);
|
||||
|
|
@ -96,8 +96,8 @@ void DeckPreviewWidget::initializeUi(const bool deckLoadSuccess)
|
|||
&DeckPreviewWidget::setBannerCard);
|
||||
|
||||
updateBannerCardComboBox();
|
||||
updateBannerCardComboBoxVisibility(SettingsCache::instance()->getVisualDeckStorageShowBannerCardComboBox());
|
||||
updateTagsVisibility(SettingsCache::instance()->getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
updateBannerCardComboBoxVisibility(SettingsCache::instance().getVisualDeckStorageShowBannerCardComboBox());
|
||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
|
||||
layout->addWidget(colorIdentityWidget);
|
||||
layout->addWidget(deckTagsDisplayWidget);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
|||
void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
||||
{
|
||||
QString bannerText = tr("Deck Storage");
|
||||
QString deckPath = SettingsCache::instance()->getDeckPath();
|
||||
QString deckPath = SettingsCache::instance().getDeckPath();
|
||||
if (filePath != deckPath) {
|
||||
QString relativePath = filePath;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,43 +12,43 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
|||
{
|
||||
// show folders checkbox
|
||||
showFoldersCheckBox = new QCheckBox(this);
|
||||
showFoldersCheckBox->setChecked(SettingsCache::instance()->getVisualDeckStorageShowFolders());
|
||||
showFoldersCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowFolders());
|
||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::showFoldersChanged);
|
||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowFolders);
|
||||
|
||||
// show tag filter widget checkbox
|
||||
showTagFilterCheckBox = new QCheckBox(this);
|
||||
showTagFilterCheckBox->setChecked(SettingsCache::instance()->getVisualDeckStorageShowTagFilter());
|
||||
showTagFilterCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
||||
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::showTagFilterChanged);
|
||||
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowTagFilter);
|
||||
|
||||
// show tags on DeckPreviewWidget checkbox
|
||||
showTagsOnDeckPreviewsCheckBox = new QCheckBox(this);
|
||||
showTagsOnDeckPreviewsCheckBox->setChecked(SettingsCache::instance()->getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
showTagsOnDeckPreviewsCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::showTagsOnDeckPreviewsChanged);
|
||||
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews);
|
||||
|
||||
// show banner card selector checkbox
|
||||
showBannerCardComboBoxCheckBox = new QCheckBox(this);
|
||||
showBannerCardComboBoxCheckBox->setChecked(SettingsCache::instance()->getVisualDeckStorageShowBannerCardComboBox());
|
||||
showBannerCardComboBoxCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowBannerCardComboBox());
|
||||
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::showBannerCardComboBoxChanged);
|
||||
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowBannerCardComboBox);
|
||||
|
||||
// draw unused color identities checkbox
|
||||
drawUnusedColorIdentitiesCheckBox = new QCheckBox(this);
|
||||
drawUnusedColorIdentitiesCheckBox->setChecked(
|
||||
SettingsCache::instance()->getVisualDeckStorageDrawUnusedColorIdentities());
|
||||
SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities());
|
||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::drawUnusedColorIdentitiesChanged);
|
||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, SettingsCache::instance().get(),
|
||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities);
|
||||
|
||||
// color identity opacity selector
|
||||
|
|
@ -60,11 +60,11 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
|||
unusedColorIdentitiesOpacitySpinBox->setMinimum(0);
|
||||
unusedColorIdentitiesOpacitySpinBox->setMaximum(100);
|
||||
unusedColorIdentitiesOpacitySpinBox->setValue(
|
||||
SettingsCache::instance()->getVisualDeckStorageUnusedColorIdentitiesOpacity());
|
||||
SettingsCache::instance().getVisualDeckStorageUnusedColorIdentitiesOpacity());
|
||||
connect(unusedColorIdentitiesOpacitySpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
&VisualDeckStorageQuickSettingsWidget::unusedColorIdentitiesOpacityChanged);
|
||||
connect(unusedColorIdentitiesOpacitySpinBox, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
SettingsCache::instance().get(), &SettingsCache::setVisualDeckStorageUnusedColorIdentitiesOpacity);
|
||||
&SettingsCache::instance(), &SettingsCache::setVisualDeckStorageUnusedColorIdentitiesOpacity);
|
||||
|
||||
unusedColorIdentitiesOpacityLabel->setBuddy(unusedColorIdentitiesOpacitySpinBox);
|
||||
|
||||
|
|
@ -82,11 +82,11 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
|||
deckPreviewTooltipComboBox->addItem("", TooltipType::None);
|
||||
deckPreviewTooltipComboBox->addItem("", TooltipType::Filepath);
|
||||
|
||||
deckPreviewTooltipComboBox->setCurrentIndex(SettingsCache::instance()->getVisualDeckStorageTooltipType());
|
||||
deckPreviewTooltipComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageTooltipType());
|
||||
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
[this] { emit deckPreviewTooltipChanged(getDeckPreviewTooltip()); });
|
||||
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
SettingsCache::instance().get(), &SettingsCache::setVisualDeckStorageTooltipType);
|
||||
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageTooltipType);
|
||||
|
||||
auto deckPreviewTooltipLayout = new QHBoxLayout(deckPreviewTooltipWidget);
|
||||
deckPreviewTooltipLayout->setContentsMargins(11, 0, 11, 0);
|
||||
|
|
@ -94,10 +94,10 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
|||
deckPreviewTooltipLayout->addWidget(deckPreviewTooltipComboBox);
|
||||
|
||||
// card size slider
|
||||
cardSizeWidget = new CardSizeWidget(this, nullptr, SettingsCache::instance()->getVisualDeckStorageCardSize());
|
||||
cardSizeWidget = new CardSizeWidget(this, nullptr, SettingsCache::instance().getVisualDeckStorageCardSize());
|
||||
connect(cardSizeWidget->getSlider(), &QSlider::valueChanged, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::cardSizeChanged);
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, SettingsCache::instance().get(),
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageCardSize);
|
||||
|
||||
// putting everything together
|
||||
|
|
@ -110,7 +110,7 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
|||
this->addSettingsWidget(deckPreviewTooltipWidget);
|
||||
this->addSettingsWidget(cardSizeWidget);
|
||||
|
||||
connect(SettingsCache::instance().get(), &SettingsCache::langChanged, this,
|
||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::retranslateUi);
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user