mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 09:22:18 -07:00
[Settings] Split cache_settings into multiple files
Took 9 minutes Took 4 minutes
This commit is contained in:
parent
3f9dbdb33b
commit
4d550507f0
136 changed files with 5124 additions and 2993 deletions
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
||||||
{
|
{
|
||||||
isSpoilerDownloadEnabled = SettingsCache::instance().getDownloadSpoilersStatus();
|
isSpoilerDownloadEnabled = SettingsCache::instance().personal().getDownloadSpoilersStatus();
|
||||||
if (isSpoilerDownloadEnabled) {
|
if (isSpoilerDownloadEnabled) {
|
||||||
// Start the process of checking if we're in spoiler season
|
// Start the process of checking if we're in spoiler season
|
||||||
// File exists means we're in spoiler season
|
// File exists means we're in spoiler season
|
||||||
|
|
@ -75,7 +75,7 @@ void SpoilerBackgroundUpdater::actDownloadFinishedSpoilersFile()
|
||||||
|
|
||||||
bool SpoilerBackgroundUpdater::deleteSpoilerFile()
|
bool SpoilerBackgroundUpdater::deleteSpoilerFile()
|
||||||
{
|
{
|
||||||
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
QString fileName = SettingsCache::instance().paths().getSpoilerCardDatabasePath();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QDir fileDir(fi.path());
|
QDir fileDir(fi.path());
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
|
@ -126,7 +126,7 @@ void SpoilerBackgroundUpdater::actCheckIfSpoilerSeasonEnabled()
|
||||||
|
|
||||||
bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
|
bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
|
||||||
{
|
{
|
||||||
QString fileName = SettingsCache::instance().getSpoilerCardDatabasePath();
|
QString fileName = SettingsCache::instance().paths().getSpoilerCardDatabasePath();
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
QDir fileDir(fi.path());
|
QDir fileDir(fi.path());
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -15,8 +15,10 @@
|
||||||
SoundEngine::SoundEngine(QObject *parent) : QObject(parent), audioOutput(nullptr), player(nullptr)
|
SoundEngine::SoundEngine(QObject *parent) : QObject(parent), audioOutput(nullptr), player(nullptr)
|
||||||
{
|
{
|
||||||
ensureThemeDirectoryExists();
|
ensureThemeDirectoryExists();
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::soundThemeChanged, this, &SoundEngine::themeChangedSlot);
|
connect(&SettingsCache::instance().sound(), &SoundSettings::soundThemeChanged, this,
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::soundEnabledChanged, this, &SoundEngine::soundEnabledChanged);
|
&SoundEngine::themeChangedSlot);
|
||||||
|
connect(&SettingsCache::instance().sound(), &SoundSettings::soundEnabledChanged, this,
|
||||||
|
&SoundEngine::soundEnabledChanged);
|
||||||
|
|
||||||
soundEnabledChanged();
|
soundEnabledChanged();
|
||||||
themeChangedSlot();
|
themeChangedSlot();
|
||||||
|
|
@ -36,7 +38,7 @@ SoundEngine::~SoundEngine()
|
||||||
|
|
||||||
void SoundEngine::soundEnabledChanged()
|
void SoundEngine::soundEnabledChanged()
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getSoundEnabled()) {
|
if (SettingsCache::instance().sound().getSoundEnabled()) {
|
||||||
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
|
||||||
if (!player) {
|
if (!player) {
|
||||||
player = new QMediaPlayer;
|
player = new QMediaPlayer;
|
||||||
|
|
@ -70,7 +72,7 @@ void SoundEngine::playSound(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
player->stop();
|
player->stop();
|
||||||
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
|
int volumeSliderValue = SettingsCache::instance().sound().getMasterVolume();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
|
||||||
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
|
||||||
|
|
@ -88,10 +90,10 @@ void SoundEngine::testSound()
|
||||||
|
|
||||||
void SoundEngine::ensureThemeDirectoryExists()
|
void SoundEngine::ensureThemeDirectoryExists()
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getSoundThemeName().isEmpty() ||
|
if (SettingsCache::instance().sound().getSoundThemeName().isEmpty() ||
|
||||||
!getAvailableThemes().contains(SettingsCache::instance().getSoundThemeName())) {
|
!getAvailableThemes().contains(SettingsCache::instance().sound().getSoundThemeName())) {
|
||||||
qCInfo(SoundEngineLog) << "Sounds theme name not set, setting default value";
|
qCInfo(SoundEngineLog) << "Sounds theme name not set, setting default value";
|
||||||
SettingsCache::instance().setSoundThemeName(DEFAULT_THEME_NAME);
|
SettingsCache::instance().sound().setSoundThemeName(DEFAULT_THEME_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,7 +134,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
||||||
|
|
||||||
void SoundEngine::themeChangedSlot()
|
void SoundEngine::themeChangedSlot()
|
||||||
{
|
{
|
||||||
QString themeName = SettingsCache::instance().getSoundThemeName();
|
QString themeName = SettingsCache::instance().sound().getSoundThemeName();
|
||||||
qCInfo(SoundEngineLog) << "Sound theme changed:" << themeName;
|
qCInfo(SoundEngineLog) << "Sound theme changed:" << themeName;
|
||||||
|
|
||||||
QDir dir = getAvailableThemes().value(themeName);
|
QDir dir = getAvailableThemes().value(themeName);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef SETTINGS_CARD_DATABASE_PATH_PROVIDER_H
|
||||||
|
#define SETTINGS_CARD_DATABASE_PATH_PROVIDER_H
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
|
||||||
|
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||||
|
|
||||||
|
class SettingsCardDatabasePathProvider : public ICardDatabasePathProvider
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SettingsCardDatabasePathProvider(QObject *parent = nullptr) : ICardDatabasePathProvider(parent)
|
||||||
|
{
|
||||||
|
connect(&SettingsCache::instance().paths(), &PathsSettings::cardDatabasePathChanged, this,
|
||||||
|
&ICardDatabasePathProvider::cardDatabasePathChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QString getCardDatabasePath() const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().paths().getCardDatabasePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QString getCustomCardDatabasePath() const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().paths().getCustomCardDatabasePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QString getTokenDatabasePath() const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().paths().getTokenDatabasePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] virtual QString getSpoilerCardDatabasePath() const override
|
||||||
|
{
|
||||||
|
return SettingsCache::instance().paths().getSpoilerCardDatabasePath();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SETTINGS_CARD_DATABASE_PATH_PROVIDER_H
|
||||||
|
|
@ -14,7 +14,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] bool getIncludeRebalancedCards() const override
|
[[nodiscard]] bool getIncludeRebalancedCards() const override
|
||||||
{
|
{
|
||||||
return SettingsCache::instance().getIncludeRebalancedCards();
|
return SettingsCache::instance().cardsDisplay().getIncludeRebalancedCards();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
|
||||||
const CardInfo &info = exactCard.getInfo();
|
const CardInfo &info = exactCard.getInfo();
|
||||||
|
|
||||||
int tableRow = info.getUiAttributes().tableRow;
|
int tableRow = info.getUiAttributes().tableRow;
|
||||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
bool playToStack = SettingsCache::instance().interface().getPlayToStack();
|
||||||
QString currentZone = card->getZone()->getName();
|
QString currentZone = card->getZone()->getName();
|
||||||
if (!faceDown && currentZone == ZoneNames::STACK && tableRow == 3) {
|
if (!faceDown && currentZone == ZoneNames::STACK && tableRow == 3) {
|
||||||
cmd.set_target_zone(ZoneNames::GRAVE);
|
cmd.set_target_zone(ZoneNames::GRAVE);
|
||||||
|
|
@ -310,7 +310,7 @@ void PlayerActions::actDrawCard()
|
||||||
|
|
||||||
void PlayerActions::actRequestMulliganDialog()
|
void PlayerActions::actRequestMulliganDialog()
|
||||||
{
|
{
|
||||||
int startSize = SettingsCache::instance().getStartingHandSize();
|
int startSize = SettingsCache::instance().interface().getStartingHandSize();
|
||||||
int handSize = player->getHandZone()->getCards().size();
|
int handSize = player->getHandZone()->getCards().size();
|
||||||
int deckSize = player->getDeckZone()->getCards().size() + handSize;
|
int deckSize = player->getDeckZone()->getCards().size() + handSize;
|
||||||
|
|
||||||
|
|
@ -326,7 +326,7 @@ void PlayerActions::actMulligan(int number)
|
||||||
}
|
}
|
||||||
|
|
||||||
doMulligan(number);
|
doMulligan(number);
|
||||||
SettingsCache::instance().setStartingHandSize(number);
|
SettingsCache::instance().interface().setStartingHandSize(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerActions::actMulliganSameSize()
|
void PlayerActions::actMulliganSameSize()
|
||||||
|
|
@ -933,7 +933,7 @@ void PlayerActions::setLastTokenInfo(CardInfoPtr cardInfo)
|
||||||
lastTokenInfo = {.name = cardInfo->getName(),
|
lastTokenInfo = {.name = cardInfo->getName(),
|
||||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||||
.pt = cardInfo->getPowTough(),
|
.pt = cardInfo->getPowTough(),
|
||||||
.annotation = SettingsCache::instance().getAnnotateTokens() ? cardInfo->getText() : "",
|
.annotation = SettingsCache::instance().interface().getAnnotateTokens() ? cardInfo->getText() : "",
|
||||||
.destroy = true,
|
.destroy = true,
|
||||||
.providerId =
|
.providerId =
|
||||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||||
|
|
@ -1169,7 +1169,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||||
if (SettingsCache::instance().getAnnotateTokens()) {
|
if (SettingsCache::instance().interface().getAnnotateTokens()) {
|
||||||
cmd.set_annotation(cardInfo->getText().toStdString());
|
cmd.set_annotation(cardInfo->getText().toStdString());
|
||||||
} else {
|
} else {
|
||||||
cmd.set_annotation("");
|
cmd.set_annotation("");
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ bool ZoneViewZoneLogic::prepareAddCard(int x)
|
||||||
|
|
||||||
// autoclose check is done both here and in removeCard
|
// autoclose check is done both here and in removeCard
|
||||||
|
|
||||||
if (cards.isEmpty() && !doInsert && SettingsCache::instance().getCloseEmptyCardView()) {
|
if (cards.isEmpty() && !doInsert && SettingsCache::instance().interface().getCloseEmptyCardView()) {
|
||||||
emit closeView();
|
emit closeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ void ZoneViewZoneLogic::removeCard(int position, bool toNewZone)
|
||||||
// card gets dragged within the view.
|
// 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
|
// 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.
|
// unrevealed portion of the same zone.
|
||||||
if (cards.isEmpty() && SettingsCache::instance().getCloseEmptyCardView() && toNewZone) {
|
if (cards.isEmpty() && SettingsCache::instance().interface().getCloseEmptyCardView() && toNewZone) {
|
||||||
emit closeView();
|
emit closeView();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,13 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
||||||
|
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(item, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
|
connect(item, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +48,8 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
|
||||||
QPainterPath AbstractCardDragItem::shape() const
|
QPainterPath AbstractCardDragItem::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
qreal cardCornerRadius =
|
||||||
|
SettingsCache::instance().cardsDisplay().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
||||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,17 @@ AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef
|
||||||
setFlag(ItemIsSelectable);
|
setFlag(ItemIsSelectable);
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::displayCardNamesChanged, this, [this] { update(); });
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::displayCardNamesChanged, this,
|
||||||
|
[this] { update(); });
|
||||||
refreshCardInfo();
|
refreshCardInfo();
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractCardItem::~AbstractCardItem()
|
AbstractCardItem::~AbstractCardItem()
|
||||||
|
|
@ -45,7 +47,8 @@ QRectF AbstractCardItem::boundingRect() const
|
||||||
QPainterPath AbstractCardItem::shape() const
|
QPainterPath AbstractCardItem::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
qreal cardCornerRadius =
|
||||||
|
SettingsCache::instance().cardsDisplay().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
||||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +104,7 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
||||||
|
|
||||||
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
||||||
{
|
{
|
||||||
const int MAX_FONT_SIZE = SettingsCache::instance().getMaxFontSize();
|
const int MAX_FONT_SIZE = SettingsCache::instance().personal().getMaxFontSize();
|
||||||
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
||||||
|
|
||||||
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
||||||
|
|
@ -151,7 +154,7 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
||||||
painter->drawPath(shape());
|
painter->drawPath(shape());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (translatedPixmap.isNull() || SettingsCache::instance().getDisplayCardNames() || facedown) {
|
if (translatedPixmap.isNull() || SettingsCache::instance().cardsDisplay().getDisplayCardNames() || facedown) {
|
||||||
painter->save();
|
painter->save();
|
||||||
transformPainter(painter, translatedSize, angle);
|
transformPainter(painter, translatedSize, angle);
|
||||||
painter->setPen(Qt::white);
|
painter->setPen(Qt::white);
|
||||||
|
|
@ -234,7 +237,7 @@ void AbstractCardItem::setHovered(bool _hovered)
|
||||||
|
|
||||||
isHovered = _hovered;
|
isHovered = _hovered;
|
||||||
setZValue(_hovered ? ZValues::HOVERED_CARD : realZValue);
|
setZValue(_hovered ? ZValues::HOVERED_CARD : realZValue);
|
||||||
setScale(_hovered && SettingsCache::instance().getScaleCards() ? 1.1 : 1);
|
setScale(_hovered && SettingsCache::instance().cardsDisplay().getScaleCards() ? 1.1 : 1);
|
||||||
setTransformOriginPoint(_hovered ? CardDimensions::WIDTH_HALF_F : 0, _hovered ? CardDimensions::HEIGHT_HALF_F : 0);
|
setTransformOriginPoint(_hovered ? CardDimensions::WIDTH_HALF_F : 0, _hovered ? CardDimensions::HEIGHT_HALF_F : 0);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +290,7 @@ void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
|
||||||
}
|
}
|
||||||
|
|
||||||
tapped = _tapped;
|
tapped = _tapped;
|
||||||
if (SettingsCache::instance().getTapAnimation() && canAnimate) {
|
if (SettingsCache::instance().cardsDisplay().getTapAnimation() && canAnimate) {
|
||||||
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
static_cast<GameScene *>(scene())->registerAnimationItem(this);
|
||||||
} else {
|
} else {
|
||||||
tapAngle = tapped ? 90 : 0;
|
tapAngle = tapped ? 90 : 0;
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
if (startZone->getName() == ZoneNames::HAND) {
|
if (startZone->getName() == ZoneNames::HAND) {
|
||||||
startCard->playCard(false);
|
startCard->playCard(false);
|
||||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
bool playToStack = SettingsCache::instance().interface().getPlayToStack();
|
||||||
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
||||||
(playToStack && ci->getUiAttributes().tableRow != 0 &&
|
(playToStack && ci->getUiAttributes().tableRow != 0 &&
|
||||||
startCard->getZone()->getName() != ZoneNames::STACK))) {
|
startCard->getZone()->getName() != ZoneNames::STACK))) {
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
auto *game = owner->getGame();
|
auto *game = owner->getGame();
|
||||||
PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
||||||
int phase = 0; // 0 means to not set the phase
|
int phase = 0; // 0 means to not set the phase
|
||||||
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
|
if (SettingsCache::instance().interface().getDoNotDeleteArrowsInSubPhases()) {
|
||||||
int currentPhase = game->getGameState()->getCurrentPhase();
|
int currentPhase = game->getGameState()->getCurrentPhase();
|
||||||
phase = Phases::getLastSubphase(currentPhase) + 1;
|
phase = Phases::getLastSubphase(currentPhase) + 1;
|
||||||
}
|
}
|
||||||
|
|
@ -398,7 +398,7 @@ void CardItem::playCard(bool faceDown)
|
||||||
if (tz) {
|
if (tz) {
|
||||||
emit tz->toggleTapped();
|
emit tz->toggleTapped();
|
||||||
} else {
|
} else {
|
||||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
if (SettingsCache::instance().interface().getClickPlaysAllSelected()) {
|
||||||
if (faceDown) {
|
if (faceDown) {
|
||||||
emit playSelectedFaceDown(this);
|
emit playSelectedFaceDown(this);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -462,7 +462,7 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
|
||||||
void CardItem::handleClickedToPlay(bool shiftHeld)
|
void CardItem::handleClickedToPlay(bool shiftHeld)
|
||||||
{
|
{
|
||||||
if (isUnwritableRevealZone(state->getZone())) {
|
if (isUnwritableRevealZone(state->getZone())) {
|
||||||
if (SettingsCache::instance().getClickPlaysAllSelected()) {
|
if (SettingsCache::instance().interface().getClickPlaysAllSelected()) {
|
||||||
emit hideSelected(this);
|
emit hideSelected(this);
|
||||||
} else {
|
} else {
|
||||||
state->getZone()->removeCard(this);
|
state->getZone()->removeCard(this);
|
||||||
|
|
@ -479,7 +479,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
||||||
(!SettingsCache::instance().getDoubleClickToPlay())) {
|
(!SettingsCache::instance().interface().getDoubleClickToPlay())) {
|
||||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||||
}
|
}
|
||||||
if (owner != nullptr) {
|
if (owner != nullptr) {
|
||||||
|
|
@ -491,7 +491,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((event->modifiers() != Qt::AltModifier) && (event->buttons() == Qt::LeftButton) &&
|
if ((event->modifiers() != Qt::AltModifier) && (event->buttons() == Qt::LeftButton) &&
|
||||||
(SettingsCache::instance().getDoubleClickToPlay())) {
|
(SettingsCache::instance().interface().getDoubleClickToPlay())) {
|
||||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,12 @@ DeckViewCard::DeckViewCard(QGraphicsItem *parent, const CardRef &cardRef, const
|
||||||
{
|
{
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckViewCard::~DeckViewCard()
|
DeckViewCard::~DeckViewCard()
|
||||||
|
|
@ -99,7 +100,8 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||||
pen.setJoinStyle(Qt::MiterJoin);
|
pen.setJoinStyle(Qt::MiterJoin);
|
||||||
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
||||||
painter->setPen(pen);
|
painter->setPen(pen);
|
||||||
qreal cardRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * (CardDimensions::WIDTH_F - 3) : 0.0;
|
qreal cardRadius =
|
||||||
|
SettingsCache::instance().cardsDisplay().getRoundCardCorners() ? 0.05 * (CardDimensions::WIDTH_F - 3) : 0.0;
|
||||||
painter->drawRoundedRect(QRectF(1.5, 1.5, CardDimensions::WIDTH_F - 3, CardDimensions::HEIGHT_F - 3), cardRadius,
|
painter->drawRoundedRect(QRectF(1.5, 1.5, CardDimensions::WIDTH_F - 3, CardDimensions::HEIGHT_F - 3), cardRadius,
|
||||||
cardRadius);
|
cardRadius);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
&DeckViewContainer::refreshShortcuts);
|
&DeckViewContainer::refreshShortcuts);
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(), &VisualDeckStorageSettings::visualDeckStorageInGameChanged,
|
||||||
&DeckViewContainer::setVisualDeckStorageExists);
|
this, &DeckViewContainer::setVisualDeckStorageExists);
|
||||||
|
|
||||||
switchToDeckSelectView();
|
switchToDeckSelectView();
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ static void setVisibility(QPushButton *button, bool visible)
|
||||||
|
|
||||||
void DeckViewContainer::switchToDeckSelectView()
|
void DeckViewContainer::switchToDeckSelectView()
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getVisualDeckStorageInGame()) {
|
if (SettingsCache::instance().visualDeckStorage().getVisualDeckStorageInGame()) {
|
||||||
deckView->setHidden(true);
|
deckView->setHidden(true);
|
||||||
|
|
||||||
tryCreateVisualDeckStorageWidget();
|
tryCreateVisualDeckStorageWidget();
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
||||||
const QChar cardColor = cardInfo->getColorChar();
|
const QChar cardColor = cardInfo->getColorChar();
|
||||||
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||||
ptEdit->setText(cardInfo->getPowTough());
|
ptEdit->setText(cardInfo->getPowTough());
|
||||||
if (SettingsCache::instance().getAnnotateTokens()) {
|
if (SettingsCache::instance().interface().getAnnotateTokens()) {
|
||||||
annotationEdit->setText(cardInfo->getText());
|
annotationEdit->setText(cardInfo->getText());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent)
|
||||||
{
|
{
|
||||||
animationTimer = new QBasicTimer;
|
animationTimer = new QBasicTimer;
|
||||||
addItem(phasesToolbar);
|
addItem(phasesToolbar);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::minPlayersForMultiColumnLayoutChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::minPlayersForMultiColumnLayoutChanged, this,
|
||||||
&GameScene::rearrange);
|
&GameScene::rearrange);
|
||||||
|
|
||||||
rearrange();
|
rearrange();
|
||||||
|
|
@ -324,7 +324,7 @@ QList<PlayerLogic *> GameScene::rotatePlayers(const QList<PlayerLogic *> &active
|
||||||
|
|
||||||
int GameScene::determineColumnCount(int playerCount)
|
int GameScene::determineColumnCount(int playerCount)
|
||||||
{
|
{
|
||||||
return playerCount < SettingsCache::instance().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
return playerCount < SettingsCache::instance().interface().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,12 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
||||||
connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand);
|
connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand);
|
||||||
connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand);
|
connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand);
|
||||||
connect(scene, &QGraphicsScene::selectionChanged, this, [this]() { updateTotalSelectionCount(); });
|
connect(scene, &QGraphicsScene::selectionChanged, this, [this]() { updateTotalSelectionCount(); });
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::tallyTypeChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::tallyTypeChanged, this,
|
||||||
[this] { updateTotalSelectionCount(); });
|
[this] { updateTotalSelectionCount(); });
|
||||||
|
|
||||||
setFocusDisabled(SettingsCache::instance().getKeepGameChatFocus());
|
setFocusDisabled(SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::keepGameChatFocusChanged, this, &GameView::setFocusDisabled);
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::keepGameChatFocusChanged, this,
|
||||||
|
&GameView::setFocusDisabled);
|
||||||
|
|
||||||
aCloseMostRecentZoneView = new QAction(this);
|
aCloseMostRecentZoneView = new QAction(this);
|
||||||
|
|
||||||
|
|
@ -127,7 +128,7 @@ void GameView::resizeRubberBand(const QPointF &cursorPoint, int selectedCount)
|
||||||
QRect rect = QRect(mapFromScene(selectionOrigin), cursor).normalized();
|
QRect rect = QRect(mapFromScene(selectionOrigin), cursor).normalized();
|
||||||
rubberBand->setGeometry(rect);
|
rubberBand->setGeometry(rect);
|
||||||
|
|
||||||
if (!SettingsCache::instance().getShowDragSelectionCount()) {
|
if (!SettingsCache::instance().interface().getShowDragSelectionCount()) {
|
||||||
dragCountLabel->hide();
|
dragCountLabel->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +237,7 @@ void GameView::updateTotalSelectionCount(const QSize &viewSize)
|
||||||
|
|
||||||
int count = scene()->selectedItems().count();
|
int count = scene()->selectedItems().count();
|
||||||
|
|
||||||
if (!SettingsCache::instance().getShowTotalSelectionCount() || count <= 1) {
|
if (!SettingsCache::instance().interface().getShowTotalSelectionCount() || count <= 1) {
|
||||||
totalCountLabel->hide();
|
totalCountLabel->hide();
|
||||||
} else {
|
} else {
|
||||||
totalCountLabel->setText(QString::number(count));
|
totalCountLabel->setText(QString::number(count));
|
||||||
|
|
@ -248,7 +249,7 @@ void GameView::updateTotalSelectionCount(const QSize &viewSize)
|
||||||
totalCountLabel->show();
|
totalCountLabel->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
TallyType tallyType = Tally::intToType(SettingsCache::instance().getTallyType());
|
TallyType tallyType = Tally::intToType(SettingsCache::instance().interface().getTallyType());
|
||||||
|
|
||||||
GameScene *gameScene = static_cast<GameScene *>(scene());
|
GameScene *gameScene = static_cast<GameScene *>(scene());
|
||||||
QList<TallyRow> entries = Tally::compute(gameScene->selectedCards(), tallyType);
|
QList<TallyRow> entries = Tally::compute(gameScene->selectedCards(), tallyType);
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,14 @@ TallyMenu::TallyMenu()
|
||||||
|
|
||||||
QAction *TallyMenu::createTallyAction(TallyType tallyType)
|
QAction *TallyMenu::createTallyAction(TallyType tallyType)
|
||||||
{
|
{
|
||||||
TallyType currentType = Tally::intToType(SettingsCache::instance().getTallyType());
|
TallyType currentType = Tally::intToType(SettingsCache::instance().interface().getTallyType());
|
||||||
|
|
||||||
QAction *action = new QAction(this);
|
QAction *action = new QAction(this);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(tallyType == currentType);
|
action->setChecked(tallyType == currentType);
|
||||||
|
|
||||||
connect(action, &QAction::triggered, &SettingsCache::instance(),
|
connect(action, &QAction::triggered, &SettingsCache::instance().interface(),
|
||||||
[tallyType] { SettingsCache::instance().setTallyType(static_cast<int>(tallyType)); });
|
[tallyType] { SettingsCache::instance().interface().setTallyType(static_cast<int>(tallyType)); });
|
||||||
|
|
||||||
actionGroup->addAction(action);
|
actionGroup->addAction(action);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
|
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
|
||||||
{
|
{
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::horizontalHandChanged, this,
|
||||||
&PlayerGraphicsItem::rearrangeZones);
|
&PlayerGraphicsItem::rearrangeZones);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::handJustificationChanged, this,
|
||||||
&PlayerGraphicsItem::rearrangeZones);
|
&PlayerGraphicsItem::rearrangeZones);
|
||||||
connect(player, &PlayerLogic::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
|
connect(player, &PlayerLogic::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
|
||||||
connect(player, &PlayerLogic::activeChanged, this, &PlayerGraphicsItem::onPlayerActiveChanged);
|
connect(player, &PlayerLogic::activeChanged, this, &PlayerGraphicsItem::onPlayerActiveChanged);
|
||||||
|
|
@ -148,7 +148,7 @@ qreal PlayerGraphicsItem::getMinimumWidth() const
|
||||||
{
|
{
|
||||||
qreal result = tableZoneGraphicsItem->getMinimumWidth() + CardDimensions::HEIGHT_F + 15 + counterAreaWidth +
|
qreal result = tableZoneGraphicsItem->getMinimumWidth() + CardDimensions::HEIGHT_F + 15 + counterAreaWidth +
|
||||||
stackZoneGraphicsItem->boundingRect().width();
|
stackZoneGraphicsItem->boundingRect().width();
|
||||||
if (!SettingsCache::instance().getHorizontalHand()) {
|
if (!SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
result += handZoneGraphicsItem->boundingRect().width();
|
result += handZoneGraphicsItem->boundingRect().width();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -165,7 +165,7 @@ void PlayerGraphicsItem::processSceneSizeChange(int newPlayerWidth)
|
||||||
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
||||||
qreal tableWidth = newPlayerWidth - CardDimensions::HEIGHT_F - 15 - counterAreaWidth -
|
qreal tableWidth = newPlayerWidth - CardDimensions::HEIGHT_F - 15 - counterAreaWidth -
|
||||||
stackZoneGraphicsItem->boundingRect().width();
|
stackZoneGraphicsItem->boundingRect().width();
|
||||||
if (!SettingsCache::instance().getHorizontalHand()) {
|
if (!SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
tableWidth -= handZoneGraphicsItem->boundingRect().width();
|
tableWidth -= handZoneGraphicsItem->boundingRect().width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,7 +233,7 @@ void PlayerGraphicsItem::rearrangeCounters()
|
||||||
void PlayerGraphicsItem::rearrangeZones()
|
void PlayerGraphicsItem::rearrangeZones()
|
||||||
{
|
{
|
||||||
auto base = QPointF(CardDimensions::HEIGHT_F + counterAreaWidth + 15, 0);
|
auto base = QPointF(CardDimensions::HEIGHT_F + counterAreaWidth + 15, 0);
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
if (mirrored) {
|
if (mirrored) {
|
||||||
if (player->getHandZone()->contentsKnown()) {
|
if (player->getHandZone()->contentsKnown()) {
|
||||||
handVisible = true;
|
handVisible = true;
|
||||||
|
|
@ -284,7 +284,7 @@ void PlayerGraphicsItem::updateBoundingRect()
|
||||||
{
|
{
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
qreal width = CardDimensions::HEIGHT_F + 15 + counterAreaWidth + stackZoneGraphicsItem->boundingRect().width();
|
qreal width = CardDimensions::HEIGHT_F + 15 + counterAreaWidth + stackZoneGraphicsItem->boundingRect().width();
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
qreal handHeight = handVisible ? handZoneGraphicsItem->boundingRect().height() : 0;
|
qreal handHeight = handVisible ? handZoneGraphicsItem->boundingRect().height() : 0;
|
||||||
bRect = QRectF(0, 0, width + tableZoneGraphicsItem->boundingRect().width(),
|
bRect = QRectF(0, 0, width + tableZoneGraphicsItem->boundingRect().width(),
|
||||||
tableZoneGraphicsItem->boundingRect().height() + handHeight);
|
tableZoneGraphicsItem->boundingRect().height() + handHeight);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||||
|
|
||||||
QPoint point = dropPoint + scenePos().toPoint();
|
QPoint point = dropPoint + scenePos().toPoint();
|
||||||
int x = -1;
|
int x = -1;
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
for (x = 0; x < getLogic()->getCards().size(); x++) {
|
for (x = 0; x < getLogic()->getCards().size(); x++) {
|
||||||
if (point.x() < static_cast<CardItem *>(getLogic()->getCards().at(x))->scenePos().x()) {
|
if (point.x() < static_cast<CardItem *>(getLogic()->getCards().at(x))->scenePos().x()) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -60,7 +60,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||||
|
|
||||||
QRectF HandZone::boundingRect() const
|
QRectF HandZone::boundingRect() const
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
return QRectF(0, 0, width, CardDimensions::HEIGHT_F + 10);
|
return QRectF(0, 0, width, CardDimensions::HEIGHT_F + 10);
|
||||||
} else {
|
} else {
|
||||||
return QRectF(0, 0, CardDimensions::WIDTH_F * 1.5, zoneHeight);
|
return QRectF(0, 0, CardDimensions::WIDTH_F * 1.5, zoneHeight);
|
||||||
|
|
@ -77,8 +77,8 @@ void HandZone::reorganizeCards()
|
||||||
{
|
{
|
||||||
if (!getLogic()->getCards().isEmpty()) {
|
if (!getLogic()->getCards().isEmpty()) {
|
||||||
const int cardCount = getLogic()->getCards().size();
|
const int cardCount = getLogic()->getCards().size();
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
bool leftJustified = SettingsCache::instance().getLeftJustified();
|
bool leftJustified = SettingsCache::instance().interface().getLeftJustified();
|
||||||
qreal cardWidth = getLogic()->getCards().at(0)->boundingRect().width();
|
qreal cardWidth = getLogic()->getCards().at(0)->boundingRect().width();
|
||||||
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
||||||
qreal totalWidth =
|
qreal totalWidth =
|
||||||
|
|
@ -126,7 +126,7 @@ void HandZone::sortHand(const QList<CardList::SortOption> &options)
|
||||||
|
|
||||||
void HandZone::setWidth(qreal _width)
|
void HandZone::setWidth(qreal _width)
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getHorizontalHand()) {
|
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
width = _width;
|
width = _width;
|
||||||
reorganizeCards();
|
reorganizeCards();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "pile_zone.h"
|
#include "pile_zone.h"
|
||||||
|
|
||||||
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../game/player/player_actions.h"
|
#include "../../game/player/player_actions.h"
|
||||||
#include "../../game/player/player_logic.h"
|
#include "../../game/player/player_logic.h"
|
||||||
#include "../../game/zones/pile_zone_logic.h"
|
#include "../../game/zones/pile_zone_logic.h"
|
||||||
|
|
@ -23,12 +24,13 @@ PileZone::PileZone(PileZoneLogic *_logic, QGraphicsItem *parent) : CardZone(_log
|
||||||
.rotate(90)
|
.rotate(90)
|
||||||
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
|
.translate(-CardDimensions::WIDTH_HALF_F, -CardDimensions::HEIGHT_HALF_F));
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PileZone::boundingRect() const
|
QRectF PileZone::boundingRect() const
|
||||||
|
|
@ -39,7 +41,8 @@ QRectF PileZone::boundingRect() const
|
||||||
QPainterPath PileZone::shape() const
|
QPainterPath PileZone::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
qreal cardCornerRadius =
|
||||||
|
SettingsCache::instance().cardsDisplay().getRoundCardCorners() ? 0.05 * CardDimensions::WIDTH_F : 0.0;
|
||||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
static qreal stackingOffset(qreal cardHeight)
|
static qreal stackingOffset(qreal cardHeight)
|
||||||
{
|
{
|
||||||
const qreal overlapPercent = SettingsCache::instance().getStackCardOverlapPercent();
|
const qreal overlapPercent = SettingsCache::instance().cardsDisplay().getStackCardOverlapPercent();
|
||||||
return cardHeight * (100.0 - overlapPercent) / 100.0;
|
return cardHeight * (100.0 - overlapPercent) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ TableZone::TableZone(TableZoneLogic *_logic, bool _mirrored, QGraphicsItem *pare
|
||||||
connect(_logic, &TableZoneLogic::contentSizeChanged, this, &TableZone::resizeToContents);
|
connect(_logic, &TableZoneLogic::contentSizeChanged, this, &TableZone::resizeToContents);
|
||||||
connect(_logic, &TableZoneLogic::toggleTapped, this, &TableZone::toggleTapped);
|
connect(_logic, &TableZoneLogic::toggleTapped, this, &TableZone::toggleTapped);
|
||||||
connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg);
|
connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::invertVerticalCoordinateChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::invertVerticalCoordinateChanged, this,
|
||||||
&TableZone::reorganizeCards);
|
&TableZone::reorganizeCards);
|
||||||
|
|
||||||
updateBg();
|
updateBg();
|
||||||
|
|
@ -59,8 +59,8 @@ void TableZone::setMirrored(bool isMirrored)
|
||||||
|
|
||||||
bool TableZone::isInverted() const
|
bool TableZone::isInverted() const
|
||||||
{
|
{
|
||||||
return ((mirrored && !SettingsCache::instance().getInvertVerticalCoordinate()) ||
|
return ((mirrored && !SettingsCache::instance().interface().getInvertVerticalCoordinate()) ||
|
||||||
(!mirrored && SettingsCache::instance().getInvertVerticalCoordinate()));
|
(!mirrored && SettingsCache::instance().interface().getInvertVerticalCoordinate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||||
|
|
||||||
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
|
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
|
||||||
|
|
||||||
if (SettingsCache::instance().getFocusCardViewSearchBar()) {
|
if (SettingsCache::instance().interface().getFocusCardViewSearchBar()) {
|
||||||
this->setActive(true);
|
this->setActive(true);
|
||||||
searchEdit.setFocus();
|
searchEdit.setFocus();
|
||||||
}
|
}
|
||||||
|
|
@ -76,8 +76,8 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||||
vbox->addItem(searchEditProxy);
|
vbox->addItem(searchEditProxy);
|
||||||
|
|
||||||
// hide search bar if chat autofocus setting is enabled, since typing into it will no longer work anyway
|
// hide search bar if chat autofocus setting is enabled, since typing into it will no longer work anyway
|
||||||
searchEditProxy->setVisible(!SettingsCache::instance().getKeepGameChatFocus());
|
searchEditProxy->setVisible(!SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::keepGameChatFocusChanged, searchEditProxy,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::keepGameChatFocusChanged, searchEditProxy,
|
||||||
[searchEditProxy](bool keepFocus) { searchEditProxy->setVisible(!keepFocus); });
|
[searchEditProxy](bool keepFocus) { searchEditProxy->setVisible(!keepFocus); });
|
||||||
|
|
||||||
// top row
|
// top row
|
||||||
|
|
@ -158,9 +158,9 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||||
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
&ZoneViewWidget::processSortBy);
|
&ZoneViewWidget::processSortBy);
|
||||||
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
||||||
groupBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewGroupByIndex());
|
groupBySelector.setCurrentIndex(SettingsCache::instance().interface().getZoneViewGroupByIndex());
|
||||||
sortBySelector.setCurrentIndex(SettingsCache::instance().getZoneViewSortByIndex());
|
sortBySelector.setCurrentIndex(SettingsCache::instance().interface().getZoneViewSortByIndex());
|
||||||
pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView());
|
pileViewCheckBox.setChecked(SettingsCache::instance().interface().getZoneViewPileView());
|
||||||
|
|
||||||
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
||||||
pileViewCheckBox.setEnabled(false);
|
pileViewCheckBox.setEnabled(false);
|
||||||
|
|
@ -190,7 +190,7 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||||
void ZoneViewWidget::processGroupBy(int index)
|
void ZoneViewWidget::processGroupBy(int index)
|
||||||
{
|
{
|
||||||
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
||||||
SettingsCache::instance().setZoneViewGroupByIndex(index);
|
SettingsCache::instance().interface().setZoneViewGroupByIndex(index);
|
||||||
zone->setGroupBy(option);
|
zone->setGroupBy(option);
|
||||||
|
|
||||||
// disable pile view checkbox if we're not grouping by anything
|
// disable pile view checkbox if we're not grouping by anything
|
||||||
|
|
@ -214,13 +214,13 @@ void ZoneViewWidget::processSortBy(int index)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache::instance().setZoneViewSortByIndex(index);
|
SettingsCache::instance().interface().setZoneViewSortByIndex(index);
|
||||||
zone->setSortBy(option);
|
zone->setSortBy(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::processSetPileView(QT_STATE_CHANGED_T value)
|
void ZoneViewWidget::processSetPileView(QT_STATE_CHANGED_T value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setZoneViewPileView(value);
|
SettingsCache::instance().interface().setZoneViewPileView(value);
|
||||||
zone->setPileView(value);
|
zone->setPileView(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -477,7 +477,7 @@ static qreal rowsToHeight(int rows)
|
||||||
**/
|
**/
|
||||||
static qreal calcMaxInitialHeight()
|
static qreal calcMaxInitialHeight()
|
||||||
{
|
{
|
||||||
return rowsToHeight(SettingsCache::instance().getCardViewInitialRowsMax());
|
return rowsToHeight(SettingsCache::instance().interface().getCardViewInitialRowsMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -559,7 +559,7 @@ void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
||||||
void ZoneViewWidget::expandWindow()
|
void ZoneViewWidget::expandWindow()
|
||||||
{
|
{
|
||||||
qreal maxInitialHeight = calcMaxInitialHeight();
|
qreal maxInitialHeight = calcMaxInitialHeight();
|
||||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().getCardViewExpandedRowsMax());
|
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().interface().getCardViewExpandedRowsMax());
|
||||||
qreal height = rect().height() - extraHeight - 10;
|
qreal height = rect().height() - extraHeight - 10;
|
||||||
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include "card_picture_loader.h"
|
#include "card_picture_loader.h"
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
#include "card_picture_loader_cache_method.h"
|
||||||
|
#include "card_picture_loader_local_schemes.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
@ -24,8 +26,9 @@
|
||||||
CardPictureLoader::CardPictureLoader() : QObject(nullptr)
|
CardPictureLoader::CardPictureLoader() : QObject(nullptr)
|
||||||
{
|
{
|
||||||
worker = new CardPictureLoaderWorker;
|
worker = new CardPictureLoaderWorker;
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this, &CardPictureLoader::picsPathChanged);
|
connect(&SettingsCache::instance().paths(), &PathsSettings::picsPathChanged, this,
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::picDownloadChanged, this,
|
&CardPictureLoader::picsPathChanged);
|
||||||
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::picDownloadChanged, this,
|
||||||
&CardPictureLoader::picDownloadChanged);
|
&CardPictureLoader::picDownloadChanged);
|
||||||
|
|
||||||
qRegisterMetaType<ExactCard>();
|
qRegisterMetaType<ExactCard>();
|
||||||
|
|
@ -169,7 +172,8 @@ void CardPictureLoader::imageLoaded(const ExactCard &card, const QImage &image)
|
||||||
|
|
||||||
QPixmapCache::insert(card.getPixmapCacheKey(), finalPixmap);
|
QPixmapCache::insert(card.getPixmapCacheKey(), finalPixmap);
|
||||||
|
|
||||||
if (SettingsCache::instance().getCardPictureLoaderCacheMethod() ==
|
if (static_cast<CardPictureLoaderCacheMethod::CacheMethod>(
|
||||||
|
SettingsCache::instance().cacheStorage().getCardPictureLoaderCacheMethod()) ==
|
||||||
CardPictureLoaderCacheMethod::CacheMethod::FILESYSTEM_CACHE) {
|
CardPictureLoaderCacheMethod::CacheMethod::FILESYSTEM_CACHE) {
|
||||||
saveCardImageToLocalStorage(card, finalPixmap);
|
saveCardImageToLocalStorage(card, finalPixmap);
|
||||||
}
|
}
|
||||||
|
|
@ -189,9 +193,9 @@ void CardPictureLoader::saveCardImageToLocalStorage(const ExactCard &card, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString picsRoot = SettingsCache::instance().getPicsPath();
|
const QString picsRoot = SettingsCache::instance().paths().getPicsPath();
|
||||||
CardPictureLoaderLocalSchemes::NamingScheme scheme =
|
CardPictureLoaderLocalSchemes::NamingScheme scheme = static_cast<CardPictureLoaderLocalSchemes::NamingScheme>(
|
||||||
SettingsCache::instance().getLocalCardImageStorageNamingScheme();
|
SettingsCache::instance().cacheStorage().getLocalCardImageStorageNamingScheme());
|
||||||
|
|
||||||
QString pattern;
|
QString pattern;
|
||||||
|
|
||||||
|
|
@ -306,7 +310,7 @@ void CardPictureLoader::picsPathChanged()
|
||||||
|
|
||||||
bool CardPictureLoader::hasCustomArt()
|
bool CardPictureLoader::hasCustomArt()
|
||||||
{
|
{
|
||||||
auto picsPath = SettingsCache::instance().getPicsPath();
|
auto picsPath = SettingsCache::instance().paths().getPicsPath();
|
||||||
QDirIterator it(picsPath, QDir::Dirs | QDir::NoDotAndDotDot);
|
QDirIterator it(picsPath, QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
|
||||||
// Check if there is at least one non-directory file in the pics path, other
|
// Check if there is at least one non-directory file in the pics path, other
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@
|
||||||
static constexpr int REFRESH_INTERVAL_MS = 10 * 1000;
|
static constexpr int REFRESH_INTERVAL_MS = 10 * 1000;
|
||||||
|
|
||||||
CardPictureLoaderLocal::CardPictureLoaderLocal(QObject *parent)
|
CardPictureLoaderLocal::CardPictureLoaderLocal(QObject *parent)
|
||||||
: QObject(parent), picsPath(SettingsCache::instance().getPicsPath()),
|
: QObject(parent), picsPath(SettingsCache::instance().paths().getPicsPath()),
|
||||||
customPicsPath(SettingsCache::instance().getCustomPicsPath())
|
customPicsPath(SettingsCache::instance().paths().getCustomPicsPath())
|
||||||
{
|
{
|
||||||
// Hook up signals to settings
|
// Hook up signals to settings
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::picsPathChanged, this,
|
connect(&SettingsCache::instance().paths(), &PathsSettings::picsPathChanged, this,
|
||||||
&CardPictureLoaderLocal::picsPathChanged);
|
&CardPictureLoaderLocal::picsPathChanged);
|
||||||
|
|
||||||
refreshIndex();
|
refreshIndex();
|
||||||
|
|
@ -127,6 +127,6 @@ QImage CardPictureLoaderLocal::tryLoadCardImageFromDisk(const QString &setName,
|
||||||
|
|
||||||
void CardPictureLoaderLocal::picsPathChanged()
|
void CardPictureLoaderLocal::picsPathChanged()
|
||||||
{
|
{
|
||||||
picsPath = SettingsCache::instance().getPicsPath();
|
picsPath = SettingsCache::instance().paths().getPicsPath();
|
||||||
customPicsPath = SettingsCache::instance().getCustomPicsPath();
|
customPicsPath = SettingsCache::instance().paths().getCustomPicsPath();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "card_picture_loader_worker.h"
|
#include "card_picture_loader_worker.h"
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
|
#include "card_picture_loader_cache_method.h"
|
||||||
#include "card_picture_loader_local.h"
|
#include "card_picture_loader_local.h"
|
||||||
#include "card_picture_loader_worker_work.h"
|
#include "card_picture_loader_worker_work.h"
|
||||||
|
|
||||||
|
|
@ -15,7 +16,8 @@
|
||||||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||||
|
|
||||||
CardPictureLoaderWorker::CardPictureLoaderWorker()
|
CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||||
: QObject(nullptr), picDownload(SettingsCache::instance().getPicDownload()), requestQuota(MAX_REQUESTS_PER_SEC)
|
: QObject(nullptr), picDownload(SettingsCache::instance().personal().getPicDownload()),
|
||||||
|
requestQuota(MAX_REQUESTS_PER_SEC)
|
||||||
{
|
{
|
||||||
networkManager = new QNetworkAccessManager(this);
|
networkManager = new QNetworkAccessManager(this);
|
||||||
// We need a timeout to ensure requests don't hang indefinitely in case of
|
// We need a timeout to ensure requests don't hang indefinitely in case of
|
||||||
|
|
@ -25,13 +27,14 @@ CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||||
cache = new QNetworkDiskCache(this);
|
cache = new QNetworkDiskCache(this);
|
||||||
cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath());
|
cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath());
|
||||||
cache->setMaximumCacheSize(1024L * 1024L *
|
cache->setMaximumCacheSize(1024L * 1024L *
|
||||||
static_cast<qint64>(SettingsCache::instance().getNetworkCacheSizeInMB()));
|
static_cast<qint64>(SettingsCache::instance().cacheStorage().getNetworkCacheSizeInMB()));
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::networkCacheSizeChanged, cache, [this](int newSizeInMB) {
|
connect(&SettingsCache::instance().cacheStorage(), &CacheStorageSettings::networkCacheSizeChanged, cache,
|
||||||
if (cache) {
|
[this](int newSizeInMB) {
|
||||||
cache->setMaximumCacheSize(1024L * 1024L * static_cast<qint64>(newSizeInMB));
|
if (cache) {
|
||||||
}
|
cache->setMaximumCacheSize(1024L * 1024L * static_cast<qint64>(newSizeInMB));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
networkManager->setCache(cache);
|
networkManager->setCache(cache);
|
||||||
|
|
||||||
|
|
@ -39,7 +42,7 @@ CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||||
// We can't use NoLessSafeRedirectPolicy because it is not applied with AlwaysCache
|
// We can't use NoLessSafeRedirectPolicy because it is not applied with AlwaysCache
|
||||||
networkManager->setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
|
networkManager->setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
|
||||||
|
|
||||||
cacheFilePath = SettingsCache::instance().getRedirectCachePath() + REDIRECT_CACHE_FILENAME;
|
cacheFilePath = SettingsCache::instance().paths().getRedirectCachePath() + REDIRECT_CACHE_FILENAME;
|
||||||
loadRedirectCache();
|
loadRedirectCache();
|
||||||
cleanStaleEntries();
|
cleanStaleEntries();
|
||||||
|
|
||||||
|
|
@ -72,7 +75,8 @@ void CardPictureLoaderWorker::queueRequest(const QUrl &url, CardPictureLoaderWor
|
||||||
queueRequest(cachedRedirect, worker);
|
queueRequest(cachedRedirect, worker);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getCardPictureLoaderCacheMethod() ==
|
if (static_cast<CardPictureLoaderCacheMethod::CacheMethod>(
|
||||||
|
SettingsCache::instance().cacheStorage().getCardPictureLoaderCacheMethod()) ==
|
||||||
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE &&
|
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE &&
|
||||||
cache->metaData(url).isValid()) {
|
cache->metaData(url).isValid()) {
|
||||||
// If we hit a cached url, we get to make the request for free, since it won't contribute towards the
|
// If we hit a cached url, we get to make the request for free, since it won't contribute towards the
|
||||||
|
|
@ -98,8 +102,10 @@ QNetworkReply *CardPictureLoaderWorker::makeRequest(const QUrl &url, CardPicture
|
||||||
req.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
req.setHeader(QNetworkRequest::UserAgentHeader, QString("Cockatrice %1").arg(VERSION_STRING));
|
||||||
req.setRawHeader("Accept", "image/avif,image/webp,image/apng,image/,/*;q=0.8");
|
req.setRawHeader("Accept", "image/avif,image/webp,image/apng,image/,/*;q=0.8");
|
||||||
|
|
||||||
bool useNetworkCache = !picDownload && SettingsCache::instance().getCardPictureLoaderCacheMethod() ==
|
bool useNetworkCache =
|
||||||
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE;
|
!picDownload && static_cast<CardPictureLoaderCacheMethod::CacheMethod>(
|
||||||
|
SettingsCache::instance().cacheStorage().getCardPictureLoaderCacheMethod()) ==
|
||||||
|
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE;
|
||||||
|
|
||||||
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
|
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
|
||||||
useNetworkCache ? QNetworkRequest::AlwaysCache : QNetworkRequest::AlwaysNetwork);
|
useNetworkCache ? QNetworkRequest::AlwaysCache : QNetworkRequest::AlwaysNetwork);
|
||||||
|
|
@ -229,7 +235,7 @@ void CardPictureLoaderWorker::cleanStaleEntries()
|
||||||
|
|
||||||
auto it = redirectCache.begin();
|
auto it = redirectCache.begin();
|
||||||
while (it != redirectCache.end()) {
|
while (it != redirectCache.end()) {
|
||||||
if (it.value().second.addDays(SettingsCache::instance().getRedirectCacheTtl()) < now) {
|
if (it.value().second.addDays(SettingsCache::instance().cacheStorage().getRedirectCacheTtl()) < now) {
|
||||||
it = redirectCache.erase(it); // Remove stale entry
|
it = redirectCache.erase(it); // Remove stale entry
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ static const QStringList MD5_BLACKLIST = {
|
||||||
|
|
||||||
CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
|
CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
|
||||||
: QObject(nullptr), cardToDownload(CardPictureToLoad(toLoad)),
|
: QObject(nullptr), cardToDownload(CardPictureToLoad(toLoad)),
|
||||||
picDownload(SettingsCache::instance().getPicDownload())
|
picDownload(SettingsCache::instance().personal().getPicDownload())
|
||||||
{
|
{
|
||||||
// Hook up signals to the orchestrator
|
// Hook up signals to the orchestrator
|
||||||
connect(this, &CardPictureLoaderWorkerWork::requestImageDownload, worker, &CardPictureLoaderWorker::queueRequest);
|
connect(this, &CardPictureLoaderWorkerWork::requestImageDownload, worker, &CardPictureLoaderWorker::queueRequest);
|
||||||
|
|
@ -31,7 +31,7 @@ CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoader
|
||||||
&CardPictureLoaderWorker::imageRequestSucceeded);
|
&CardPictureLoaderWorker::imageRequestSucceeded);
|
||||||
|
|
||||||
// Hook up signals to settings
|
// Hook up signals to settings
|
||||||
connect(&SettingsCache::instance(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
connect(&SettingsCache::instance().personal(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||||
|
|
||||||
startNextPicDownload();
|
startNextPicDownload();
|
||||||
}
|
}
|
||||||
|
|
@ -210,5 +210,5 @@ void CardPictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
|
||||||
|
|
||||||
void CardPictureLoaderWorkerWork::picDownloadChanged()
|
void CardPictureLoaderWorkerWork::picDownloadChanged()
|
||||||
{
|
{
|
||||||
picDownload = SettingsCache::instance().getPicDownload();
|
picDownload = SettingsCache::instance().personal().getPicDownload();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ QList<CardSetPtr> CardPictureToLoad::extractSetsSorted(const ExactCard &card)
|
||||||
std::sort(sortedSets.begin(), sortedSets.end(), SetPriorityComparator());
|
std::sort(sortedSets.begin(), sortedSets.end(), SetPriorityComparator());
|
||||||
|
|
||||||
// If the user hasn't disabled arts other than their personal preference...
|
// If the user hasn't disabled arts other than their personal preference...
|
||||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
if (!SettingsCache::instance().cardsDisplay().getOverrideAllCardArtWithPersonalPreference()) {
|
||||||
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
||||||
qsizetype setIndex = sortedSets.indexOf(card.getPrinting().getSet());
|
qsizetype setIndex = sortedSets.indexOf(card.getPrinting().getSet());
|
||||||
if (setIndex > 0) { // we don't need to move the set if it's already first
|
if (setIndex > 0) { // we don't need to move the set if it's already first
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ QStringMap &ThemeManager::getAvailableThemes()
|
||||||
availableThemes.clear();
|
availableThemes.clear();
|
||||||
|
|
||||||
// load themes from user profile dir
|
// load themes from user profile dir
|
||||||
dir.setPath(SettingsCache::instance().getThemesPath());
|
dir.setPath(SettingsCache::instance().paths().getThemesPath());
|
||||||
|
|
||||||
// add default value
|
// add default value
|
||||||
availableThemes.insert(NONE_THEME_NAME, dir.absoluteFilePath("Default"));
|
availableThemes.insert(NONE_THEME_NAME, dir.absoluteFilePath("Default"));
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ ColorIdentityWidget::ColorIdentityWidget(QWidget *parent, const QString &_colorI
|
||||||
|
|
||||||
populateManaSymbolWidgets();
|
populateManaSymbolWidgets();
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||||
&ColorIdentityWidget::toggleUnusedVisibility);
|
&ColorIdentityWidget::toggleUnusedVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +41,7 @@ void ColorIdentityWidget::populateManaSymbolWidgets()
|
||||||
QtUtils::clearLayoutRec(layout);
|
QtUtils::clearLayoutRec(layout);
|
||||||
|
|
||||||
// populate mana symbols
|
// populate mana symbols
|
||||||
if (SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities()) {
|
if (SettingsCache::instance().visualDeckStorage().getVisualDeckStorageDrawUnusedColorIdentities()) {
|
||||||
for (const QString symbol : fullColorIdentity) {
|
for (const QString symbol : fullColorIdentity) {
|
||||||
auto *manaSymbol = new ManaSymbolWidget(this, symbol, symbols.contains(symbol));
|
auto *manaSymbol = new ManaSymbolWidget(this, symbol, symbols.contains(symbol));
|
||||||
layout->addWidget(manaSymbol);
|
layout->addWidget(manaSymbol);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ ManaSymbolWidget::ManaSymbolWidget(QWidget *parent, QString _symbol, bool _isAct
|
||||||
setGraphicsEffect(opacityEffect);
|
setGraphicsEffect(opacityEffect);
|
||||||
updateOpacity();
|
updateOpacity();
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageUnusedColorIdentitiesOpacityChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageUnusedColorIdentitiesOpacityChanged, this,
|
||||||
&ManaSymbolWidget::updateOpacity);
|
&ManaSymbolWidget::updateOpacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +43,11 @@ void ManaSymbolWidget::updateOpacity()
|
||||||
opacity = isActive ? 1.0 : 0.5;
|
opacity = isActive ? 1.0 : 0.5;
|
||||||
} else {
|
} else {
|
||||||
// It's just for display, they can do whatever they want.
|
// 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().visualDeckStorage().getVisualDeckStorageUnusedColorIdentitiesOpacity() /
|
||||||
|
100.0;
|
||||||
}
|
}
|
||||||
opacityEffect->setOpacity(opacity);
|
opacityEffect->setOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
||||||
tab3Layout->addWidget(splitter);
|
tab3Layout->addWidget(splitter);
|
||||||
tab3->setLayout(tab3Layout);
|
tab3->setLayout(tab3Layout);
|
||||||
|
|
||||||
setViewMode(SettingsCache::instance().getCardInfoViewMode());
|
setViewMode(SettingsCache::instance().cardsDisplay().getCardInfoViewMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardInfoFrameWidget::retranslateUi()
|
void CardInfoFrameWidget::retranslateUi()
|
||||||
|
|
@ -127,7 +127,7 @@ void CardInfoFrameWidget::setViewMode(int mode)
|
||||||
|
|
||||||
refreshLayout();
|
refreshLayout();
|
||||||
|
|
||||||
SettingsCache::instance().setCardInfoViewMode(mode);
|
SettingsCache::instance().cardsDisplay().setCardInfoViewMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasTransformation(const CardInfo &info)
|
static bool hasTransformation(const CardInfo &info)
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,12 @@ CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent) :
|
||||||
setWindowFlags(Qt::ToolTip); // Keeps this widget on top of everything
|
setWindowFlags(Qt::ToolTip); // Keeps this widget on top of everything
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -99,7 +100,8 @@ void CardInfoPictureEnlargedWidget::paintEvent(QPaintEvent *event)
|
||||||
QPoint topLeft{(width() - scaledLogicalSize.width()) / 2, (height() - scaledLogicalSize.height()) / 2};
|
QPoint topLeft{(width() - scaledLogicalSize.width()) / 2, (height() - scaledLogicalSize.height()) / 2};
|
||||||
|
|
||||||
// Rounded corner radius based on logical width
|
// Rounded corner radius based on logical width
|
||||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * scaledLogicalSize.width() : 0.0;
|
qreal radius =
|
||||||
|
SettingsCache::instance().cardsDisplay().getRoundCardCorners() ? 0.05 * scaledLogicalSize.width() : 0.0;
|
||||||
|
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,12 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT
|
||||||
animation->setStartValue(originalPos);
|
animation->setStartValue(originalPos);
|
||||||
animation->setEndValue(originalPos - QPoint(0, ANIMATION_OFFSET));
|
animation->setEndValue(originalPos - QPoint(0, ANIMATION_OFFSET));
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::roundCardCornersChanged, this,
|
||||||
Q_UNUSED(_roundCardCorners);
|
[this](bool _roundCardCorners) {
|
||||||
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -190,7 +191,7 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
|
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
|
||||||
if (SettingsCache::instance().getAutoRotateSidewaysLayoutCards()) {
|
if (SettingsCache::instance().cardsDisplay().getAutoRotateSidewaysLayoutCards()) {
|
||||||
if (exactCard.getInfo().getUiAttributes().landscapeOrientation) {
|
if (exactCard.getInfo().getUiAttributes().landscapeOrientation) {
|
||||||
// Rotate pixmap 90 degrees to the left
|
// Rotate pixmap 90 degrees to the left
|
||||||
QTransform transform;
|
QTransform transform;
|
||||||
|
|
@ -220,7 +221,9 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
// Compute rounded corner radius
|
// Compute rounded corner radius
|
||||||
// Ensure consistent rounding
|
// Ensure consistent rounding
|
||||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * static_cast<qreal>(targetRect.width()) : 0.;
|
qreal radius = SettingsCache::instance().cardsDisplay().getRoundCardCorners()
|
||||||
|
? 0.05 * static_cast<qreal>(targetRect.width())
|
||||||
|
: 0.;
|
||||||
|
|
||||||
// Draw the pixmap with rounded corners
|
// Draw the pixmap with rounded corners
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ DeckPreviewCardPictureWidget::DeckPreviewCardPictureWidget(QWidget *parent,
|
||||||
singleClickTimer = new QTimer(this);
|
singleClickTimer = new QTimer(this);
|
||||||
singleClickTimer->setSingleShot(true);
|
singleClickTimer->setSingleShot(true);
|
||||||
connect(singleClickTimer, &QTimer::timeout, this, [this]() { emit imageClicked(lastMouseEvent, this); });
|
connect(singleClickTimer, &QTimer::timeout, this, [this]() { emit imageClicked(lastMouseEvent, this); });
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageSelectionAnimationChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageSelectionAnimationChanged, this,
|
||||||
&CardInfoPictureWidget::setRaiseOnEnterEnabled);
|
&CardInfoPictureWidget::setRaiseOnEnterEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,18 +108,20 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
|
|
||||||
showBannerCardCheckBox = new QCheckBox();
|
showBannerCardCheckBox = new QCheckBox();
|
||||||
showBannerCardCheckBox->setObjectName("showBannerCardCheckBox");
|
showBannerCardCheckBox->setObjectName("showBannerCardCheckBox");
|
||||||
showBannerCardCheckBox->setChecked(SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
showBannerCardCheckBox->setChecked(
|
||||||
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||||
&SettingsCache::setDeckEditorBannerCardComboBoxVisible);
|
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::deckEditorBannerCardComboBoxVisibleChanged, this,
|
&CardsDisplaySettings::setDeckEditorBannerCardComboBoxVisible);
|
||||||
|
connect(&SettingsCache::instance().cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::deckEditorBannerCardComboBoxVisibleChanged, this,
|
||||||
&DeckEditorDeckDockWidget::updateShowBannerCardComboBox);
|
&DeckEditorDeckDockWidget::updateShowBannerCardComboBox);
|
||||||
|
|
||||||
showTagsWidgetCheckBox = new QCheckBox();
|
showTagsWidgetCheckBox = new QCheckBox();
|
||||||
showTagsWidgetCheckBox->setObjectName("showTagsWidgetCheckBox");
|
showTagsWidgetCheckBox->setObjectName("showTagsWidgetCheckBox");
|
||||||
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().cardsDisplay().getDeckEditorTagsWidgetVisible());
|
||||||
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||||
&SettingsCache::setDeckEditorTagsWidgetVisible);
|
&CardsDisplaySettings::setDeckEditorTagsWidgetVisible);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::deckEditorTagsWidgetVisibleChanged, this,
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::deckEditorTagsWidgetVisibleChanged, this,
|
||||||
&DeckEditorDeckDockWidget::updateShowTagsWidget);
|
&DeckEditorDeckDockWidget::updateShowTagsWidget);
|
||||||
|
|
||||||
quickSettingsWidget->addSettingsWidget(showBannerCardCheckBox);
|
quickSettingsWidget->addSettingsWidget(showBannerCardCheckBox);
|
||||||
|
|
@ -151,7 +153,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
bannerCardLabel = new QLabel();
|
bannerCardLabel = new QLabel();
|
||||||
bannerCardLabel->setObjectName("bannerCardLabel");
|
bannerCardLabel->setObjectName("bannerCardLabel");
|
||||||
bannerCardLabel->setText(tr("Banner Card"));
|
bannerCardLabel->setText(tr("Banner Card"));
|
||||||
bannerCardLabel->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
bannerCardLabel->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||||
bannerCardComboBox = new QComboBox(this);
|
bannerCardComboBox = new QComboBox(this);
|
||||||
connect(getModel(), &DeckListModel::cardNodesChanged, this, [this]() {
|
connect(getModel(), &DeckListModel::cardNodesChanged, this, [this]() {
|
||||||
// Delay the update to avoid race conditions
|
// Delay the update to avoid race conditions
|
||||||
|
|
@ -162,10 +164,10 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
|
|
||||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&DeckEditorDeckDockWidget::writeBannerCard);
|
&DeckEditorDeckDockWidget::writeBannerCard);
|
||||||
bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
bannerCardComboBox->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||||
|
|
||||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, {});
|
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, {});
|
||||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorTagsWidgetVisible());
|
||||||
connect(deckTagsDisplayWidget, &DeckPreviewDeckTagsDisplayWidget::tagsChanged, deckStateManager,
|
connect(deckTagsDisplayWidget, &DeckPreviewDeckTagsDisplayWidget::tagsChanged, deckStateManager,
|
||||||
&DeckStateManager::setTags);
|
&DeckStateManager::setTags);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ DeckEditorPrintingSelectorDockWidget::DeckEditorPrintingSelectorDockWidget(Abstr
|
||||||
createPrintingSelectorDock();
|
createPrintingSelectorDock();
|
||||||
printingDisabledInfoWidget = new PrintingDisabledInfoWidget(this);
|
printingDisabledInfoWidget = new PrintingDisabledInfoWidget(this);
|
||||||
|
|
||||||
setVisibleWidget(SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
setVisibleWidget(SettingsCache::instance().cardsDisplay().getOverrideAllCardArtWithPersonalPreference());
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
connect(&SettingsCache::instance().cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||||
&DeckEditorPrintingSelectorDockWidget::setVisibleWidget);
|
&DeckEditorPrintingSelectorDockWidget::setVisibleWidget);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ void DlgCreateGame::sharedCtor()
|
||||||
auto *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this);
|
auto *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this);
|
||||||
gameTypeLayout->addWidget(gameTypeRadioButton);
|
gameTypeLayout->addWidget(gameTypeRadioButton);
|
||||||
gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton);
|
gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton);
|
||||||
bool isChecked = SettingsCache::instance().getGameTypes().contains(gameTypeIterator.value() + ", ");
|
bool isChecked = SettingsCache::instance().game().getGameTypes().contains(gameTypeIterator.value() + ", ");
|
||||||
gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked);
|
gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked);
|
||||||
}
|
}
|
||||||
auto *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
auto *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
||||||
|
|
@ -154,23 +154,23 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
rememberGameSettings->setChecked(SettingsCache::instance().getRememberGameSettings());
|
rememberGameSettings->setChecked(SettingsCache::instance().game().getRememberGameSettings());
|
||||||
descriptionEdit->setText(SettingsCache::instance().getGameDescription());
|
descriptionEdit->setText(SettingsCache::instance().game().getGameDescription());
|
||||||
maxPlayersEdit->setValue(SettingsCache::instance().getMaxPlayers());
|
maxPlayersEdit->setValue(SettingsCache::instance().game().getMaxPlayers());
|
||||||
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) {
|
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered) {
|
||||||
onlyBuddiesCheckBox->setChecked(SettingsCache::instance().getOnlyBuddies());
|
onlyBuddiesCheckBox->setChecked(SettingsCache::instance().game().getOnlyBuddies());
|
||||||
onlyRegisteredCheckBox->setChecked(SettingsCache::instance().getOnlyRegistered());
|
onlyRegisteredCheckBox->setChecked(SettingsCache::instance().game().getOnlyRegistered());
|
||||||
} else {
|
} else {
|
||||||
onlyBuddiesCheckBox->setEnabled(false);
|
onlyBuddiesCheckBox->setEnabled(false);
|
||||||
onlyRegisteredCheckBox->setEnabled(false);
|
onlyRegisteredCheckBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
spectatorsAllowedCheckBox->setChecked(SettingsCache::instance().getSpectatorsAllowed());
|
spectatorsAllowedCheckBox->setChecked(SettingsCache::instance().game().getSpectatorsAllowed());
|
||||||
spectatorsNeedPasswordCheckBox->setChecked(SettingsCache::instance().getSpectatorsNeedPassword());
|
spectatorsNeedPasswordCheckBox->setChecked(SettingsCache::instance().game().getSpectatorsNeedPassword());
|
||||||
spectatorsCanTalkCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanTalk());
|
spectatorsCanTalkCheckBox->setChecked(SettingsCache::instance().game().getSpectatorsCanTalk());
|
||||||
spectatorsSeeEverythingCheckBox->setChecked(SettingsCache::instance().getSpectatorsCanSeeEverything());
|
spectatorsSeeEverythingCheckBox->setChecked(SettingsCache::instance().game().getSpectatorsCanSeeEverything());
|
||||||
createGameAsSpectatorCheckBox->setChecked(SettingsCache::instance().getCreateGameAsSpectator());
|
createGameAsSpectatorCheckBox->setChecked(SettingsCache::instance().game().getCreateGameAsSpectator());
|
||||||
startingLifeTotalEdit->setValue(SettingsCache::instance().getDefaultStartingLifeTotal());
|
startingLifeTotalEdit->setValue(SettingsCache::instance().game().getDefaultStartingLifeTotal());
|
||||||
shareDecklistsOnLoadCheckBox->setChecked(SettingsCache::instance().getShareDecklistsOnLoad());
|
shareDecklistsOnLoadCheckBox->setChecked(SettingsCache::instance().game().getShareDecklistsOnLoad());
|
||||||
|
|
||||||
if (!rememberGameSettings->isChecked()) {
|
if (!rememberGameSettings->isChecked()) {
|
||||||
actReset();
|
actReset();
|
||||||
|
|
@ -291,20 +291,20 @@ void DlgCreateGame::actOK()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache::instance().setRememberGameSettings(rememberGameSettings->isChecked());
|
SettingsCache::instance().game().setRememberGameSettings(rememberGameSettings->isChecked());
|
||||||
if (rememberGameSettings->isChecked()) {
|
if (rememberGameSettings->isChecked()) {
|
||||||
SettingsCache::instance().setGameDescription(descriptionEdit->text());
|
SettingsCache::instance().game().setGameDescription(descriptionEdit->text());
|
||||||
SettingsCache::instance().setMaxPlayers(maxPlayersEdit->value());
|
SettingsCache::instance().game().setMaxPlayers(maxPlayersEdit->value());
|
||||||
SettingsCache::instance().setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
SettingsCache::instance().game().setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||||
SettingsCache::instance().setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
SettingsCache::instance().game().setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||||
SettingsCache::instance().setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
SettingsCache::instance().game().setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||||
SettingsCache::instance().setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
SettingsCache::instance().game().setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||||
SettingsCache::instance().setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
SettingsCache::instance().game().setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||||
SettingsCache::instance().setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
SettingsCache::instance().game().setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||||
SettingsCache::instance().setCreateGameAsSpectator(createGameAsSpectatorCheckBox->isChecked());
|
SettingsCache::instance().game().setCreateGameAsSpectator(createGameAsSpectatorCheckBox->isChecked());
|
||||||
SettingsCache::instance().setDefaultStartingLifeTotal(startingLifeTotalEdit->value());
|
SettingsCache::instance().game().setDefaultStartingLifeTotal(startingLifeTotalEdit->value());
|
||||||
SettingsCache::instance().setShareDecklistsOnLoad(shareDecklistsOnLoadCheckBox->isChecked());
|
SettingsCache::instance().game().setShareDecklistsOnLoad(shareDecklistsOnLoadCheckBox->isChecked());
|
||||||
SettingsCache::instance().setGameTypes(_gameTypes);
|
SettingsCache::instance().game().setGameTypes(_gameTypes);
|
||||||
}
|
}
|
||||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||||
connect(pend, &PendingCommand::finished, this, &DlgCreateGame::checkResponse);
|
connect(pend, &PendingCommand::finished, this, &DlgCreateGame::checkResponse);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ void DlgDefaultTagsEditor::retranslateUi()
|
||||||
void DlgDefaultTagsEditor::loadStringList()
|
void DlgDefaultTagsEditor::loadStringList()
|
||||||
{
|
{
|
||||||
listWidget->clear();
|
listWidget->clear();
|
||||||
QStringList tags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
QStringList tags = SettingsCache::instance().visualDeckStorage().getVisualDeckStorageDefaultTagsList();
|
||||||
for (const QString &tag : tags) {
|
for (const QString &tag : tags) {
|
||||||
auto *item = new QListWidgetItem(); // Create item but don't insert yet
|
auto *item = new QListWidgetItem(); // Create item but don't insert yet
|
||||||
|
|
||||||
|
|
@ -147,6 +147,6 @@ void DlgDefaultTagsEditor::confirmChanges()
|
||||||
updatedList.append(lineEdit->text());
|
updatedList.append(lineEdit->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SettingsCache::instance().setVisualDeckStorageDefaultTagsList(updatedList);
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStorageDefaultTagsList(updatedList);
|
||||||
accept(); // Close dialog and confirm changes
|
accept(); // Close dialog and confirm changes
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
||||||
{
|
{
|
||||||
QString startingDir = SettingsCache::instance().recents().getLatestDeckDirPath();
|
QString startingDir = SettingsCache::instance().recents().getLatestDeckDirPath();
|
||||||
if (startingDir.isEmpty()) {
|
if (startingDir.isEmpty()) {
|
||||||
startingDir = SettingsCache::instance().getDeckPath();
|
startingDir = SettingsCache::instance().paths().getDeckPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
setDirectory(startingDir);
|
setDirectory(startingDir);
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
|
||||||
mainLayout->addWidget(buttonBox);
|
mainLayout->addWidget(buttonBox);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
rememberSettingsCheckBox->setChecked(SettingsCache::instance().getLocalGameRememberSettings());
|
rememberSettingsCheckBox->setChecked(SettingsCache::instance().game().getLocalGameRememberSettings());
|
||||||
if (rememberSettingsCheckBox->isChecked()) {
|
if (rememberSettingsCheckBox->isChecked()) {
|
||||||
numberPlayersEdit->setValue(SettingsCache::instance().getLocalGameMaxPlayers());
|
numberPlayersEdit->setValue(SettingsCache::instance().game().getLocalGameMaxPlayers());
|
||||||
startingLifeTotalEdit->setValue(SettingsCache::instance().getLocalGameStartingLifeTotal());
|
startingLifeTotalEdit->setValue(SettingsCache::instance().game().getLocalGameStartingLifeTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
setWindowTitle(tr("Local game options"));
|
setWindowTitle(tr("Local game options"));
|
||||||
|
|
@ -67,10 +67,10 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
|
||||||
|
|
||||||
void DlgLocalGameOptions::actOK()
|
void DlgLocalGameOptions::actOK()
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setLocalGameRememberSettings(rememberSettingsCheckBox->isChecked());
|
SettingsCache::instance().game().setLocalGameRememberSettings(rememberSettingsCheckBox->isChecked());
|
||||||
if (rememberSettingsCheckBox->isChecked()) {
|
if (rememberSettingsCheckBox->isChecked()) {
|
||||||
SettingsCache::instance().setLocalGameMaxPlayers(numberPlayersEdit->value());
|
SettingsCache::instance().game().setLocalGameMaxPlayers(numberPlayersEdit->value());
|
||||||
SettingsCache::instance().setLocalGameStartingLifeTotal(startingLifeTotalEdit->value());
|
SettingsCache::instance().game().setLocalGameStartingLifeTotal(startingLifeTotalEdit->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ WndSets::WndSets(QWidget *parent) : QMainWindow(parent)
|
||||||
sortWarning->setLayout(sortWarningLayout);
|
sortWarning->setLayout(sortWarningLayout);
|
||||||
sortWarning->setVisible(false);
|
sortWarning->setVisible(false);
|
||||||
|
|
||||||
includeRebalancedCards = SettingsCache::instance().getIncludeRebalancedCards();
|
includeRebalancedCards = SettingsCache::instance().cardsDisplay().getIncludeRebalancedCards();
|
||||||
QCheckBox *includeRebalancedCardsCheckBox =
|
QCheckBox *includeRebalancedCardsCheckBox =
|
||||||
new QCheckBox(tr("Include cards rebalanced for Alchemy [requires restart]"));
|
new QCheckBox(tr("Include cards rebalanced for Alchemy [requires restart]"));
|
||||||
includeRebalancedCardsCheckBox->setChecked(includeRebalancedCards);
|
includeRebalancedCardsCheckBox->setChecked(includeRebalancedCards);
|
||||||
|
|
@ -253,7 +253,7 @@ void WndSets::includeRebalancedCardsChanged(bool _includeRebalancedCards)
|
||||||
void WndSets::actSave()
|
void WndSets::actSave()
|
||||||
{
|
{
|
||||||
model->save(CardDatabaseManager::getInstance());
|
model->save(CardDatabaseManager::getInstance());
|
||||||
SettingsCache::instance().setIncludeRebalancedCards(includeRebalancedCards);
|
SettingsCache::instance().cardsDisplay().setIncludeRebalancedCards(includeRebalancedCards);
|
||||||
CardPictureLoader::clearPixmapCache();
|
CardPictureLoader::clearPixmapCache();
|
||||||
const auto reloadOk1 = QtConcurrent::run([] {
|
const auto reloadOk1 = QtConcurrent::run([] {
|
||||||
CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify();
|
CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ DlgSettings::DlgSettings(QWidget *parent) : QDialog(parent)
|
||||||
auto rec = QGuiApplication::primaryScreen()->availableGeometry();
|
auto rec = QGuiApplication::primaryScreen()->availableGeometry();
|
||||||
this->setMinimumSize(qMin(700, rec.width()), qMin(700, rec.height()));
|
this->setMinimumSize(qMin(700, rec.width()), qMin(700, rec.height()));
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &DlgSettings::updateLanguage);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this, &DlgSettings::updateLanguage);
|
||||||
|
|
||||||
contentsWidget = new QListWidget;
|
contentsWidget = new QListWidget;
|
||||||
contentsWidget->setViewMode(QListView::IconMode);
|
contentsWidget->setViewMode(QListView::IconMode);
|
||||||
|
|
@ -79,7 +79,7 @@ DlgSettings::DlgSettings(QWidget *parent) : QDialog(parent)
|
||||||
mainLayout->addWidget(buttonBox);
|
mainLayout->addWidget(buttonBox);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &DlgSettings::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this, &DlgSettings::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
@ -205,7 +205,8 @@ void DlgSettings::closeEvent(QCloseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QDir(SettingsCache::instance().getDeckPath()).exists() || SettingsCache::instance().getDeckPath().isEmpty()) {
|
if (!QDir(SettingsCache::instance().paths().getDeckPath()).exists() ||
|
||||||
|
SettingsCache::instance().paths().getDeckPath().isEmpty()) {
|
||||||
//! \todo Prompt to create the deck directory.
|
//! \todo Prompt to create the deck directory.
|
||||||
if (QMessageBox::critical(
|
if (QMessageBox::critical(
|
||||||
this, tr("Error"),
|
this, tr("Error"),
|
||||||
|
|
@ -216,7 +217,8 @@ void DlgSettings::closeEvent(QCloseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QDir(SettingsCache::instance().getPicsPath()).exists() || SettingsCache::instance().getPicsPath().isEmpty()) {
|
if (!QDir(SettingsCache::instance().paths().getPicsPath()).exists() ||
|
||||||
|
SettingsCache::instance().paths().getPicsPath().isEmpty()) {
|
||||||
//! \todo Prompt to create the pictures directory.
|
//! \todo Prompt to create the pictures directory.
|
||||||
if (QMessageBox::critical(this, tr("Error"),
|
if (QMessageBox::critical(this, tr("Error"),
|
||||||
tr("The path to your card pictures directory is invalid. Would you like to go back "
|
tr("The path to your card pictures directory is invalid. Would you like to go back "
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ DlgStartupCardCheck::DlgStartupCardCheck(QWidget *parent) : QDialog(parent)
|
||||||
|
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QDate lastCheckDate = SettingsCache::instance().getLastCardUpdateCheck();
|
QDate lastCheckDate = SettingsCache::instance().updates().getLastCardUpdateCheck();
|
||||||
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
||||||
|
|
||||||
instructionLabel = new QLabel(
|
instructionLabel = new QLabel(
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
||||||
tipNumber = new QLabel();
|
tipNumber = new QLabel();
|
||||||
tipNumber->setAlignment(Qt::AlignCenter);
|
tipNumber->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
QList<int> seenTips = SettingsCache::instance().personal().getSeenTips();
|
||||||
newTipsAvailable = false;
|
newTipsAvailable = false;
|
||||||
currentTip = 0;
|
currentTip = 0;
|
||||||
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
||||||
|
|
@ -73,9 +73,9 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
||||||
connect(previousButton, &QPushButton::clicked, this, &DlgTipOfTheDay::previousClicked);
|
connect(previousButton, &QPushButton::clicked, this, &DlgTipOfTheDay::previousClicked);
|
||||||
|
|
||||||
showTipsOnStartupCheck = new QCheckBox("Show tips on startup");
|
showTipsOnStartupCheck = new QCheckBox("Show tips on startup");
|
||||||
showTipsOnStartupCheck->setChecked(SettingsCache::instance().getShowTipsOnStartup());
|
showTipsOnStartupCheck->setChecked(SettingsCache::instance().personal().getShowTipsOnStartup());
|
||||||
connect(showTipsOnStartupCheck, &QCheckBox::clicked, &SettingsCache::instance(),
|
connect(showTipsOnStartupCheck, &QCheckBox::clicked, &SettingsCache::instance().personal(),
|
||||||
&SettingsCache::setShowTipsOnStartup);
|
&PersonalSettings::setShowTipsOnStartup);
|
||||||
buttonBar = new QHBoxLayout();
|
buttonBar = new QHBoxLayout();
|
||||||
buttonBar->addWidget(showTipsOnStartupCheck);
|
buttonBar->addWidget(showTipsOnStartupCheck);
|
||||||
buttonBar->addWidget(tipNumber);
|
buttonBar->addWidget(tipNumber);
|
||||||
|
|
@ -130,10 +130,10 @@ void DlgTipOfTheDay::updateTip(int tipId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store tip id as seen
|
// Store tip id as seen
|
||||||
QList<int> seenTips = SettingsCache::instance().getSeenTips();
|
QList<int> seenTips = SettingsCache::instance().personal().getSeenTips();
|
||||||
if (!seenTips.contains(tipId)) {
|
if (!seenTips.contains(tipId)) {
|
||||||
seenTips.append(tipId);
|
seenTips.append(tipId);
|
||||||
SettingsCache::instance().setSeenTips(seenTips);
|
SettingsCache::instance().personal().setSeenTips(seenTips);
|
||||||
}
|
}
|
||||||
|
|
||||||
TipOfTheDay tip = tipDatabase->getTip(tipId);
|
TipOfTheDay tip = tipDatabase->getTip(tipId);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ bool OverridePrintingWarning::execMessageBox(QWidget *parent, bool enable)
|
||||||
QMessageBox::question(parent, QObject::tr("Confirm Change"), message, QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::question(parent, QObject::tr("Confirm Change"), message, QMessageBox::Yes | QMessageBox::No);
|
||||||
|
|
||||||
if (result == QMessageBox::Yes) {
|
if (result == QMessageBox::Yes) {
|
||||||
SettingsCache::instance().setOverrideAllCardArtWithPersonalPreference(static_cast<Qt::CheckState>(enable));
|
SettingsCache::instance().cardsDisplay().setOverrideAllCardArtWithPersonalPreference(enable);
|
||||||
// Caches are now invalid.
|
// Caches are now invalid.
|
||||||
CardPictureLoader::clearPixmapCache();
|
CardPictureLoader::clearPixmapCache();
|
||||||
CardPictureLoader::clearNetworkCache();
|
CardPictureLoader::clearNetworkCache();
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,13 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
||||||
updateConnectButton(tabSupervisor->getClient()->getStatus());
|
updateConnectButton(tabSupervisor->getClient()->getStatus());
|
||||||
|
|
||||||
connect(tabSupervisor->getClient(), &RemoteClient::statusChanged, this, &HomeWidget::updateConnectButton);
|
connect(tabSupervisor->getClient(), &RemoteClient::statusChanged, this, &HomeWidget::updateConnectButton);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundSourceChanged, this,
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabBackgroundSourceChanged, this,
|
||||||
&HomeWidget::initializeBackgroundFromSource);
|
&HomeWidget::initializeBackgroundFromSource);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundShuffleFrequencyChanged, this,
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabBackgroundShuffleFrequencyChanged, this,
|
||||||
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||||
// Lambda is cleaner to read than overloading this
|
// Lambda is cleaner to read than overloading this
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabDisplayCardNameChanged, this, [this] { repaint(); });
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabDisplayCardNameChanged, this,
|
||||||
|
[this] { repaint(); });
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||||
&HomeWidget::initializeBackgroundFromSource);
|
&HomeWidget::initializeBackgroundFromSource);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||||
|
|
@ -61,7 +62,8 @@ void HomeWidget::initializeBackgroundFromSource()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance().getHomeTabBackgroundSource());
|
auto backgroundSourceType =
|
||||||
|
BackgroundSources::fromId(SettingsCache::instance().personal().getHomeTabBackgroundSource());
|
||||||
|
|
||||||
switch (backgroundSourceType) {
|
switch (backgroundSourceType) {
|
||||||
case BackgroundSources::Theme:
|
case BackgroundSources::Theme:
|
||||||
|
|
@ -88,7 +90,7 @@ void HomeWidget::initializeBackgroundFromSource()
|
||||||
void HomeWidget::loadBackgroundSourceDeck()
|
void HomeWidget::loadBackgroundSourceDeck()
|
||||||
{
|
{
|
||||||
std::optional<LoadedDeck> deckOpt = DeckLoader::loadFromFile(
|
std::optional<LoadedDeck> deckOpt = DeckLoader::loadFromFile(
|
||||||
SettingsCache::instance().getDeckPath() + "background.cod", DeckFileFormat::Cockatrice, false);
|
SettingsCache::instance().paths().getDeckPath() + "background.cod", DeckFileFormat::Cockatrice, false);
|
||||||
backgroundSourceDeck = deckOpt.has_value() ? deckOpt.value().deckList : DeckList();
|
backgroundSourceDeck = deckOpt.has_value() ? deckOpt.value().deckList : DeckList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +110,8 @@ void HomeWidget::setRandomCard(ExactCard &newCard)
|
||||||
|
|
||||||
void HomeWidget::updateRandomCard()
|
void HomeWidget::updateRandomCard()
|
||||||
{
|
{
|
||||||
auto backgroundSourceType = BackgroundSources::fromId(SettingsCache::instance().getHomeTabBackgroundSource());
|
auto backgroundSourceType =
|
||||||
|
BackgroundSources::fromId(SettingsCache::instance().personal().getHomeTabBackgroundSource());
|
||||||
|
|
||||||
ExactCard newCard;
|
ExactCard newCard;
|
||||||
|
|
||||||
|
|
@ -151,8 +154,8 @@ void HomeWidget::updateRandomCard()
|
||||||
void HomeWidget::onBackgroundShuffleFrequencyChanged()
|
void HomeWidget::onBackgroundShuffleFrequencyChanged()
|
||||||
{
|
{
|
||||||
cardChangeTimer->stop();
|
cardChangeTimer->stop();
|
||||||
if (SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() > 0) {
|
if (SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency() > 0) {
|
||||||
cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
cardChangeTimer->start(SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,8 +263,8 @@ void HomeWidget::updateConnectButton(const ClientStatus status)
|
||||||
|
|
||||||
QPair<QColor, QColor> HomeWidget::extractDominantColors(const QPixmap &pixmap)
|
QPair<QColor, QColor> HomeWidget::extractDominantColors(const QPixmap &pixmap)
|
||||||
{
|
{
|
||||||
if (themeManager->isBuiltInTheme() &&
|
if (themeManager->isBuiltInTheme() && SettingsCache::instance().personal().getHomeTabBackgroundSource() ==
|
||||||
SettingsCache::instance().getHomeTabBackgroundSource() == BackgroundSources::toId(BackgroundSources::Theme)) {
|
BackgroundSources::toId(BackgroundSources::Theme)) {
|
||||||
return QPair<QColor, QColor>(QColor::fromRgb(20, 140, 60), QColor::fromRgb(120, 200, 80));
|
return QPair<QColor, QColor>(QColor::fromRgb(20, 140, 60), QColor::fromRgb(120, 200, 80));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,7 +350,7 @@ void HomeWidget::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cardName.isEmpty() && SettingsCache::instance().getHomeTabDisplayCardName()) {
|
if (!cardName.isEmpty() && SettingsCache::instance().personal().getHomeTabDisplayCardName()) {
|
||||||
QFont font = painter.font();
|
QFont font = painter.font();
|
||||||
font.setPointSize(14);
|
font.setPointSize(14);
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,16 @@ class TearOffMenu : public QMenu
|
||||||
public:
|
public:
|
||||||
explicit TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
explicit TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
||||||
{
|
{
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||||
[this](const bool state) { setTearOffEnabled(state); });
|
[this](const bool state) { setTearOffEnabled(state); });
|
||||||
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
setTearOffEnabled(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
explicit TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||||
{
|
{
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::useTearOffMenusChanged, this,
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||||
[this](const bool state) { setTearOffEnabled(state); });
|
[this](const bool state) { setTearOffEnabled(state); });
|
||||||
setTearOffEnabled(SettingsCache::instance().getUseTearOffMenus());
|
setTearOffEnabled(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||||
}
|
}
|
||||||
|
|
||||||
TearOffMenu *addTearOffMenu(const QString &title)
|
TearOffMenu *addTearOffMenu(const QString &title)
|
||||||
|
|
|
||||||
|
|
@ -45,16 +45,17 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
||||||
|
|
||||||
// Create the checkbox for navigation buttons visibility
|
// Create the checkbox for navigation buttons visibility
|
||||||
navigationCheckBox = new QCheckBox(this);
|
navigationCheckBox = new QCheckBox(this);
|
||||||
navigationCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
navigationCheckBox->setChecked(
|
||||||
|
SettingsCache::instance().cardsDisplay().getPrintingSelectorNavigationButtonsVisible());
|
||||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&PrintingSelector::toggleVisibilityNavigationButtons);
|
&PrintingSelector::toggleVisibilityNavigationButtons);
|
||||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||||
&SettingsCache::setPrintingSelectorNavigationButtonsVisible);
|
&CardsDisplaySettings::setPrintingSelectorNavigationButtonsVisible);
|
||||||
|
|
||||||
cardSizeWidget =
|
cardSizeWidget = new CardSizeWidget(displayOptionsWidget, flowWidget,
|
||||||
new CardSizeWidget(displayOptionsWidget, flowWidget, SettingsCache::instance().getPrintingSelectorCardSize());
|
SettingsCache::instance().cardsDisplay().getPrintingSelectorCardSize());
|
||||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||||
&SettingsCache::setPrintingSelectorCardSize);
|
&CardsDisplaySettings::setPrintingSelectorCardSize);
|
||||||
|
|
||||||
displayOptionsWidget->addSettingsWidget(sortToolBar);
|
displayOptionsWidget->addSettingsWidget(sortToolBar);
|
||||||
displayOptionsWidget->addSettingsWidget(navigationCheckBox);
|
displayOptionsWidget->addSettingsWidget(navigationCheckBox);
|
||||||
|
|
@ -81,7 +82,8 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
||||||
flowWidget->setVisible(false);
|
flowWidget->setVisible(false);
|
||||||
|
|
||||||
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this, deckStateManager);
|
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this, deckStateManager);
|
||||||
cardSelectionBar->setVisible(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
cardSelectionBar->setVisible(
|
||||||
|
SettingsCache::instance().cardsDisplay().getPrintingSelectorNavigationButtonsVisible());
|
||||||
layout->addWidget(cardSelectionBar);
|
layout->addWidget(cardSelectionBar);
|
||||||
|
|
||||||
// Connect deck model data change signal to update display
|
// Connect deck model data change signal to update display
|
||||||
|
|
@ -98,7 +100,7 @@ void PrintingSelector::retranslateUi()
|
||||||
|
|
||||||
void PrintingSelector::printingsInDeckChanged()
|
void PrintingSelector::printingsInDeckChanged()
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getBumpSetsWithCardsInDeckToTop()) {
|
if (SettingsCache::instance().cardsDisplay().getBumpSetsWithCardsInDeckToTop()) {
|
||||||
// Delay the update to avoid race conditions
|
// Delay the update to avoid race conditions
|
||||||
QTimer::singleShot(100, this, &PrintingSelector::updateDisplay);
|
QTimer::singleShot(100, this, &PrintingSelector::updateDisplay);
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +213,7 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
||||||
sortToolBar->filterSets(sortedPrintings, searchBar->getSearchText().trimmed().toLower());
|
sortToolBar->filterSets(sortedPrintings, searchBar->getSearchText().trimmed().toLower());
|
||||||
QList<PrintingInfo> printingsToUse;
|
QList<PrintingInfo> printingsToUse;
|
||||||
|
|
||||||
if (SettingsCache::instance().getBumpSetsWithCardsInDeckToTop()) {
|
if (SettingsCache::instance().cardsDisplay().getBumpSetsWithCardsInDeckToTop()) {
|
||||||
printingsToUse =
|
printingsToUse =
|
||||||
sortToolBar->prependPrintingsInDeck(filteredPrintings, selectedCard, deckStateManager->getModel());
|
sortToolBar->prependPrintingsInDeck(filteredPrintings, selectedCard, deckStateManager->getModel());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ PrintingSelectorCardSortingWidget::PrintingSelectorCardSortingWidget(PrintingSel
|
||||||
sortOptionsSelector = new QComboBox(this);
|
sortOptionsSelector = new QComboBox(this);
|
||||||
sortOptionsSelector->setFocusPolicy(Qt::StrongFocus);
|
sortOptionsSelector->setFocusPolicy(Qt::StrongFocus);
|
||||||
sortOptionsSelector->addItems(SORT_OPTIONS);
|
sortOptionsSelector->addItems(SORT_OPTIONS);
|
||||||
sortOptionsSelector->setCurrentIndex(SettingsCache::instance().getPrintingSelectorSortOrder());
|
sortOptionsSelector->setCurrentIndex(SettingsCache::instance().cardsDisplay().getPrintingSelectorSortOrder());
|
||||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, this,
|
connect(sortOptionsSelector, &QComboBox::currentTextChanged, this,
|
||||||
&PrintingSelectorCardSortingWidget::updateSortSetting);
|
&PrintingSelectorCardSortingWidget::updateSortSetting);
|
||||||
connect(sortOptionsSelector, &QComboBox::currentTextChanged, parent, &PrintingSelector::updateDisplay);
|
connect(sortOptionsSelector, &QComboBox::currentTextChanged, parent, &PrintingSelector::updateDisplay);
|
||||||
|
|
@ -62,7 +62,7 @@ void PrintingSelectorCardSortingWidget::updateSortOrder()
|
||||||
*/
|
*/
|
||||||
void PrintingSelectorCardSortingWidget::updateSortSetting()
|
void PrintingSelectorCardSortingWidget::updateSortSetting()
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setPrintingSelectorSortOrder(sortOptionsSelector->currentIndex());
|
SettingsCache::instance().cardsDisplay().setPrintingSelectorSortOrder(sortOptionsSelector->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,7 +90,7 @@ QList<PrintingInfo> PrintingSelectorCardSortingWidget::sortSets(const SetToPrint
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortedSets.empty()) {
|
if (sortedSets.empty()) {
|
||||||
sortedSets << CardSet::newInstance(SettingsCache::instance().cardDatabase(), "", "", "", QDate());
|
sortedSets << CardSet::newInstance(&SettingsCache::instance().cardDatabase(), "", "", "", QDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortOptionsSelector->currentText() == SORT_OPTIONS_PREFERENCE) {
|
if (sortOptionsSelector->currentText() == SORT_OPTIONS_PREFERENCE) {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ void ReplayTimelineWidget::handleBackwardsSkip(bool doRewindBuffering)
|
||||||
// The rewind only happens once the timer runs out.
|
// The rewind only happens once the timer runs out.
|
||||||
// If another backwards skip happens, the timer will just get reset instead of rewinding.
|
// If another backwards skip happens, the timer will just get reset instead of rewinding.
|
||||||
rewindBufferingTimer->stop();
|
rewindBufferingTimer->stop();
|
||||||
rewindBufferingTimer->start(SettingsCache::instance().getRewindBufferingMs());
|
rewindBufferingTimer->start(SettingsCache::instance().interface().getRewindBufferingMs());
|
||||||
} else {
|
} else {
|
||||||
// otherwise, process the rewind immediately
|
// otherwise, process the rewind immediately
|
||||||
processRewind();
|
processRewind();
|
||||||
|
|
|
||||||
|
|
@ -292,8 +292,8 @@ void ChatView::appendMessage(QString message,
|
||||||
}
|
}
|
||||||
cursor.setCharFormat(defaultFormat);
|
cursor.setCharFormat(defaultFormat);
|
||||||
|
|
||||||
bool mentionEnabled = SettingsCache::instance().getChatMention();
|
bool mentionEnabled = SettingsCache::instance().chat().getChatMention();
|
||||||
highlightedWords = SettingsCache::instance().getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
highlightedWords = SettingsCache::instance().chat().getHighlightWords().split(' ', Qt::SkipEmptyParts);
|
||||||
|
|
||||||
// parse the message
|
// parse the message
|
||||||
while (message.size()) {
|
while (message.size()) {
|
||||||
|
|
@ -395,8 +395,9 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
|
||||||
// You have received a valid mention!!
|
// You have received a valid mention!!
|
||||||
soundEngine->playSound("chat_mention");
|
soundEngine->playSound("chat_mention");
|
||||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||||
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
mentionFormat.setForeground(SettingsCache::instance().chat().getChatMentionForeground()
|
||||||
: QBrush(Qt::black));
|
? QBrush(Qt::white)
|
||||||
|
: QBrush(Qt::black));
|
||||||
cursor.insertText(mention, mentionFormat);
|
cursor.insertText(mention, mentionFormat);
|
||||||
message = message.mid(mention.size());
|
message = message.mid(mention.size());
|
||||||
showSystemPopup(userName);
|
showSystemPopup(userName);
|
||||||
|
|
@ -417,8 +418,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
|
||||||
// Moderator Sending Global Message
|
// Moderator Sending Global Message
|
||||||
soundEngine->playSound("all_mention");
|
soundEngine->playSound("all_mention");
|
||||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||||
mentionFormat.setForeground(SettingsCache::instance().getChatMentionForeground() ? QBrush(Qt::white)
|
mentionFormat.setForeground(
|
||||||
: QBrush(Qt::black));
|
SettingsCache::instance().chat().getChatMentionForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
|
||||||
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
|
cursor.insertText("@" + fullMentionUpToSpaceOrEnd, mentionFormat);
|
||||||
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
|
message = message.mid(fullMentionUpToSpaceOrEnd.size() + 1);
|
||||||
showSystemPopup(userName);
|
showSystemPopup(userName);
|
||||||
|
|
@ -465,8 +466,8 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
|
||||||
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
|
if (fullWordUpToSpaceOrEnd.compare(word, Qt::CaseInsensitive) == 0) {
|
||||||
// You have received a valid mention of custom word!!
|
// You have received a valid mention of custom word!!
|
||||||
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
|
highlightFormat.setBackground(QBrush(getCustomHighlightColor()));
|
||||||
highlightFormat.setForeground(SettingsCache::instance().getChatHighlightForeground() ? QBrush(Qt::white)
|
highlightFormat.setForeground(
|
||||||
: QBrush(Qt::black));
|
SettingsCache::instance().chat().getChatHighlightForeground() ? QBrush(Qt::white) : QBrush(Qt::black));
|
||||||
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
|
cursor.insertText(fullWordUpToSpaceOrEnd, highlightFormat);
|
||||||
cursor.insertText(rest, defaultFormat);
|
cursor.insertText(rest, defaultFormat);
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
|
|
@ -522,7 +523,7 @@ void ChatView::actMessageClicked()
|
||||||
void ChatView::showSystemPopup(const QString &userName)
|
void ChatView::showSystemPopup(const QString &userName)
|
||||||
{
|
{
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
if (SettingsCache::instance().getShowMentionPopup()) {
|
if (SettingsCache::instance().chat().getShowMentionPopup()) {
|
||||||
emit showMentionPopup(userName);
|
emit showMentionPopup(userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -530,10 +531,10 @@ void ChatView::showSystemPopup(const QString &userName)
|
||||||
QColor ChatView::getCustomMentionColor()
|
QColor ChatView::getCustomMentionColor()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
QColor customColor = QColor::fromString("#" + SettingsCache::instance().chat().getChatMentionColor());
|
||||||
#else
|
#else
|
||||||
QColor customColor;
|
QColor customColor;
|
||||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
customColor.setNamedColor("#" + SettingsCache::instance().chat().getChatMentionColor());
|
||||||
#endif
|
#endif
|
||||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||||
}
|
}
|
||||||
|
|
@ -541,10 +542,10 @@ QColor ChatView::getCustomMentionColor()
|
||||||
QColor ChatView::getCustomHighlightColor()
|
QColor ChatView::getCustomHighlightColor()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||||
QColor customColor = QColor::fromString("#" + SettingsCache::instance().getChatMentionColor());
|
QColor customColor = QColor::fromString("#" + SettingsCache::instance().chat().getChatMentionColor());
|
||||||
#else
|
#else
|
||||||
QColor customColor;
|
QColor customColor;
|
||||||
customColor.setNamedColor("#" + SettingsCache::instance().getChatMentionColor());
|
customColor.setNamedColor("#" + SettingsCache::instance().chat().getChatMentionColor());
|
||||||
#endif
|
#endif
|
||||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,13 @@ GameSelector::GameSelector(AbstractClient *_client,
|
||||||
if (showFilters && restoresettings) {
|
if (showFilters && restoresettings) {
|
||||||
quickFilterToolBar = new GameSelectorQuickFilterToolBar(this, tabSupervisor, gameListProxyModel, gameTypeMap);
|
quickFilterToolBar = new GameSelectorQuickFilterToolBar(this, tabSupervisor, gameListProxyModel, gameTypeMap);
|
||||||
quickFilterToolBar->setVisible(showFilters && restoresettings &&
|
quickFilterToolBar->setVisible(showFilters && restoresettings &&
|
||||||
SettingsCache::instance().getShowGameSelectorFilterToolbar());
|
SettingsCache::instance().cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::showGameSelectorFilterToolbarChanged, this, [this] {
|
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::showGameSelectorFilterToolbarChanged,
|
||||||
quickFilterToolBar->setVisible(SettingsCache::instance().getShowGameSelectorFilterToolbar());
|
this, [this] {
|
||||||
});
|
quickFilterToolBar->setVisible(
|
||||||
|
SettingsCache::instance().cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
quickFilterToolBar = nullptr;
|
quickFilterToolBar = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ bool UserListItemDelegate::editorEvent(QEvent *event,
|
||||||
|
|
||||||
QSize UserListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize UserListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!SettingsCache::instance().getStyleUserList()) {
|
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||||
return QStyledItemDelegate::sizeHint(option, index);
|
return QStyledItemDelegate::sizeHint(option, index);
|
||||||
}
|
}
|
||||||
return UserListPainter::sizeHint();
|
return UserListPainter::sizeHint();
|
||||||
|
|
@ -360,7 +360,7 @@ QSize UserListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const Q
|
||||||
|
|
||||||
void UserListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void UserListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!SettingsCache::instance().getStyleUserList()) {
|
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||||
QStyledItemDelegate::paint(painter, option, index);
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -524,7 +524,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
||||||
|
|
||||||
// Pin on item click
|
// Pin on item click
|
||||||
connect(userTree, &QTreeWidget::itemClicked, this, [this](QTreeWidgetItem *item, int) {
|
connect(userTree, &QTreeWidget::itemClicked, this, [this](QTreeWidgetItem *item, int) {
|
||||||
if (!SettingsCache::instance().getStyleUserList()) {
|
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QString name = static_cast<UserListTWI *>(item)->getUserInfo().name().c_str();
|
const QString name = static_cast<UserListTWI *>(item)->getUserInfo().name().c_str();
|
||||||
|
|
@ -556,7 +556,8 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
||||||
connect(cardArtProvider, &UserCardArtProvider::cardArtUpdated, this,
|
connect(cardArtProvider, &UserCardArtProvider::cardArtUpdated, this,
|
||||||
[this](const QString &) { userTree->viewport()->update(); });
|
[this](const QString &) { userTree->viewport()->update(); });
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::styleUserListChanged, this, &UserListWidget::applyDisplayMode);
|
connect(&SettingsCache::instance().interface(), &InterfaceSettings::styleUserListChanged, this,
|
||||||
|
&UserListWidget::applyDisplayMode);
|
||||||
applyDisplayMode();
|
applyDisplayMode();
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
QVBoxLayout *vbox = new QVBoxLayout;
|
||||||
|
|
@ -661,7 +662,7 @@ void UserListWidget::hideEvent(QHideEvent *e)
|
||||||
|
|
||||||
void UserListWidget::applyDisplayMode()
|
void UserListWidget::applyDisplayMode()
|
||||||
{
|
{
|
||||||
const bool styled = SettingsCache::instance().getStyleUserList();
|
const bool styled = SettingsCache::instance().interface().getStyleUserList();
|
||||||
|
|
||||||
if (styled) {
|
if (styled) {
|
||||||
userTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
userTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||||
|
|
@ -720,7 +721,7 @@ bool UserListWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (obj == userTree->viewport()) {
|
if (obj == userTree->viewport()) {
|
||||||
if (event->type() == QEvent::MouseMove) {
|
if (event->type() == QEvent::MouseMove) {
|
||||||
if (!SettingsCache::instance().getStyleUserList()) {
|
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||||
return QGroupBox::eventFilter(obj, event);
|
return QGroupBox::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
auto *me = static_cast<QMouseEvent *>(event);
|
auto *me = static_cast<QMouseEvent *>(event);
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
homeTabBackgroundSourceBox.addItem(QObject::tr(entry.trKey), QVariant::fromValue(entry.type));
|
homeTabBackgroundSourceBox.addItem(QObject::tr(entry.trKey), QVariant::fromValue(entry.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString homeTabBackgroundSource = SettingsCache::instance().getHomeTabBackgroundSource();
|
QString homeTabBackgroundSource = SettingsCache::instance().personal().getHomeTabBackgroundSource();
|
||||||
int homeTabBackgroundSourceId =
|
int homeTabBackgroundSourceId =
|
||||||
homeTabBackgroundSourceBox.findData(BackgroundSources::fromId(homeTabBackgroundSource));
|
homeTabBackgroundSourceBox.findData(BackgroundSources::fromId(homeTabBackgroundSource));
|
||||||
if (homeTabBackgroundSourceId != -1) {
|
if (homeTabBackgroundSourceId != -1) {
|
||||||
|
|
@ -85,19 +85,20 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
|
|
||||||
connect(&homeTabBackgroundSourceBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() {
|
connect(&homeTabBackgroundSourceBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() {
|
||||||
auto type = homeTabBackgroundSourceBox.currentData().value<BackgroundSources::Type>();
|
auto type = homeTabBackgroundSourceBox.currentData().value<BackgroundSources::Type>();
|
||||||
SettingsCache::instance().setHomeTabBackgroundSource(BackgroundSources::toId(type));
|
SettingsCache::instance().personal().setHomeTabBackgroundSource(BackgroundSources::toId(type));
|
||||||
updateHomeTabSettingsVisibility();
|
updateHomeTabSettingsVisibility();
|
||||||
});
|
});
|
||||||
|
|
||||||
homeTabBackgroundShuffleFrequencySpinBox.setRange(0, 3600);
|
homeTabBackgroundShuffleFrequencySpinBox.setRange(0, 3600);
|
||||||
homeTabBackgroundShuffleFrequencySpinBox.setSuffix(tr(" seconds"));
|
homeTabBackgroundShuffleFrequencySpinBox.setSuffix(tr(" seconds"));
|
||||||
homeTabBackgroundShuffleFrequencySpinBox.setValue(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency());
|
homeTabBackgroundShuffleFrequencySpinBox.setValue(
|
||||||
connect(&homeTabBackgroundShuffleFrequencySpinBox, qOverload<int>(&QSpinBox::valueChanged),
|
SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency());
|
||||||
&SettingsCache::instance(), &SettingsCache::setHomeTabBackgroundShuffleFrequency);
|
connect(&homeTabBackgroundShuffleFrequencySpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings.personal(),
|
||||||
|
&PersonalSettings::setHomeTabBackgroundShuffleFrequency);
|
||||||
|
|
||||||
homeTabDisplayCardNameCheckBox.setChecked(settings.getHomeTabDisplayCardName());
|
homeTabDisplayCardNameCheckBox.setChecked(settings.personal().getHomeTabDisplayCardName());
|
||||||
connect(&homeTabDisplayCardNameCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&homeTabDisplayCardNameCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.personal(),
|
||||||
&SettingsCache::setHomeTabDisplayCardName);
|
&PersonalSettings::setHomeTabDisplayCardName);
|
||||||
|
|
||||||
updateHomeTabSettingsVisibility();
|
updateHomeTabSettingsVisibility();
|
||||||
|
|
||||||
|
|
@ -111,8 +112,9 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
homeTabGroupBox = new QGroupBox;
|
homeTabGroupBox = new QGroupBox;
|
||||||
homeTabGroupBox->setLayout(homeTabGrid);
|
homeTabGroupBox->setLayout(homeTabGrid);
|
||||||
|
|
||||||
styleUserListCheckBox.setChecked(settings.getStyleUserList());
|
styleUserListCheckBox.setChecked(settings.interface().getStyleUserList());
|
||||||
connect(&styleUserListCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setStyleUserList);
|
connect(&styleUserListCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||||
|
&InterfaceSettings::setStyleUserList);
|
||||||
|
|
||||||
auto stylingTabGrid = new QGridLayout;
|
auto stylingTabGrid = new QGridLayout;
|
||||||
stylingTabGrid->addWidget(&styleUserListCheckBox, 0, 0, 1, 2);
|
stylingTabGrid->addWidget(&styleUserListCheckBox, 0, 0, 1, 2);
|
||||||
|
|
@ -121,12 +123,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
stylingGroupBox->setLayout(stylingTabGrid);
|
stylingGroupBox->setLayout(stylingTabGrid);
|
||||||
|
|
||||||
// Menu settings
|
// Menu settings
|
||||||
showShortcutsCheckBox.setChecked(settings.getShowShortcuts());
|
showShortcutsCheckBox.setChecked(settings.cardsDisplay().getShowShortcuts());
|
||||||
connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged);
|
connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged);
|
||||||
|
|
||||||
showGameSelectorFilterToolbarCheckBox.setChecked(settings.getShowGameSelectorFilterToolbar());
|
showGameSelectorFilterToolbarCheckBox.setChecked(settings.cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||||
connect(&showGameSelectorFilterToolbarCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&showGameSelectorFilterToolbarCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||||
&SettingsCache::setShowGameSelectorFilterToolbar);
|
&CardsDisplaySettings::setShowGameSelectorFilterToolbar);
|
||||||
|
|
||||||
auto *menuGrid = new QGridLayout;
|
auto *menuGrid = new QGridLayout;
|
||||||
menuGrid->addWidget(&showShortcutsCheckBox, 0, 0);
|
menuGrid->addWidget(&showShortcutsCheckBox, 0, 0);
|
||||||
|
|
@ -136,13 +138,14 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
menuGroupBox->setLayout(menuGrid);
|
menuGroupBox->setLayout(menuGrid);
|
||||||
|
|
||||||
// Printings settings
|
// Printings settings
|
||||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
|
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(
|
||||||
|
settings.cardsDisplay().getOverrideAllCardArtWithPersonalPreference());
|
||||||
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled);
|
&AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled);
|
||||||
|
|
||||||
bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.getBumpSetsWithCardsInDeckToTop());
|
bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.cardsDisplay().getBumpSetsWithCardsInDeckToTop());
|
||||||
connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||||
&SettingsCache::setBumpSetsWithCardsInDeckToTop);
|
&CardsDisplaySettings::setBumpSetsWithCardsInDeckToTop);
|
||||||
|
|
||||||
auto *printingsGrid = new QGridLayout;
|
auto *printingsGrid = new QGridLayout;
|
||||||
printingsGrid->addWidget(&overrideAllCardArtWithPersonalPreferenceCheckBox, 0, 0, 1, 2);
|
printingsGrid->addWidget(&overrideAllCardArtWithPersonalPreferenceCheckBox, 0, 0, 1, 2);
|
||||||
|
|
@ -152,22 +155,25 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
printingsGroupBox->setLayout(printingsGrid);
|
printingsGroupBox->setLayout(printingsGrid);
|
||||||
|
|
||||||
// Card rendering
|
// Card rendering
|
||||||
displayCardNamesCheckBox.setChecked(settings.getDisplayCardNames());
|
displayCardNamesCheckBox.setChecked(settings.cardsDisplay().getDisplayCardNames());
|
||||||
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setDisplayCardNames);
|
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::setDisplayCardNames);
|
||||||
|
|
||||||
autoRotateSidewaysLayoutCardsCheckBox.setChecked(settings.getAutoRotateSidewaysLayoutCards());
|
autoRotateSidewaysLayoutCardsCheckBox.setChecked(settings.cardsDisplay().getAutoRotateSidewaysLayoutCards());
|
||||||
connect(&autoRotateSidewaysLayoutCardsCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&autoRotateSidewaysLayoutCardsCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||||
&SettingsCache::setAutoRotateSidewaysLayoutCards);
|
&CardsDisplaySettings::setAutoRotateSidewaysLayoutCards);
|
||||||
|
|
||||||
cardScalingCheckBox.setChecked(settings.getScaleCards());
|
cardScalingCheckBox.setChecked(settings.cardsDisplay().getScaleCards());
|
||||||
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::setCardScaling);
|
||||||
|
|
||||||
roundCardCornersCheckBox.setChecked(settings.getRoundCardCorners());
|
roundCardCornersCheckBox.setChecked(settings.cardsDisplay().getRoundCardCorners());
|
||||||
connect(&roundCardCornersCheckBox, &QAbstractButton::toggled, &settings, &SettingsCache::setRoundCardCorners);
|
connect(&roundCardCornersCheckBox, &QAbstractButton::toggled, &settings.cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::setRoundCardCorners);
|
||||||
|
|
||||||
connect(&maxFontSizeForCardsEdit, qOverload<int>(&QSpinBox::valueChanged), &settings,
|
connect(&maxFontSizeForCardsEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.personal(),
|
||||||
&SettingsCache::setMaxFontSize);
|
&PersonalSettings::setMaxFontSize);
|
||||||
maxFontSizeForCardsEdit.setValue(settings.getMaxFontSize());
|
maxFontSizeForCardsEdit.setValue(settings.personal().getMaxFontSize());
|
||||||
maxFontSizeForCardsLabel.setBuddy(&maxFontSizeForCardsEdit);
|
maxFontSizeForCardsLabel.setBuddy(&maxFontSizeForCardsEdit);
|
||||||
maxFontSizeForCardsEdit.setMinimum(9);
|
maxFontSizeForCardsEdit.setMinimum(9);
|
||||||
maxFontSizeForCardsEdit.setMaximum(100);
|
maxFontSizeForCardsEdit.setMaximum(100);
|
||||||
|
|
@ -184,18 +190,18 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
cardsGroupBox->setLayout(cardsGrid);
|
cardsGroupBox->setLayout(cardsGrid);
|
||||||
|
|
||||||
// Card layout
|
// Card layout
|
||||||
verticalCardOverlapPercentBox.setValue(settings.getStackCardOverlapPercent());
|
verticalCardOverlapPercentBox.setValue(settings.cardsDisplay().getStackCardOverlapPercent());
|
||||||
verticalCardOverlapPercentBox.setRange(0, 80);
|
verticalCardOverlapPercentBox.setRange(0, 80);
|
||||||
connect(&verticalCardOverlapPercentBox, qOverload<int>(&QSpinBox::valueChanged), &settings,
|
connect(&verticalCardOverlapPercentBox, qOverload<int>(&QSpinBox::valueChanged), &settings.cardsDisplay(),
|
||||||
&SettingsCache::setStackCardOverlapPercent);
|
&CardsDisplaySettings::setStackCardOverlapPercent);
|
||||||
|
|
||||||
cardViewInitialRowsMaxBox.setRange(1, 999);
|
cardViewInitialRowsMaxBox.setRange(1, 999);
|
||||||
cardViewInitialRowsMaxBox.setValue(SettingsCache::instance().getCardViewInitialRowsMax());
|
cardViewInitialRowsMaxBox.setValue(SettingsCache::instance().interface().getCardViewInitialRowsMax());
|
||||||
connect(&cardViewInitialRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(&cardViewInitialRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&AppearanceSettingsPage::cardViewInitialRowsMaxChanged);
|
&AppearanceSettingsPage::cardViewInitialRowsMaxChanged);
|
||||||
|
|
||||||
cardViewExpandedRowsMaxBox.setRange(1, 999);
|
cardViewExpandedRowsMaxBox.setRange(1, 999);
|
||||||
cardViewExpandedRowsMaxBox.setValue(SettingsCache::instance().getCardViewExpandedRowsMax());
|
cardViewExpandedRowsMaxBox.setValue(SettingsCache::instance().interface().getCardViewExpandedRowsMax());
|
||||||
connect(&cardViewExpandedRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(&cardViewExpandedRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&AppearanceSettingsPage::cardViewExpandedRowsMaxChanged);
|
&AppearanceSettingsPage::cardViewExpandedRowsMaxChanged);
|
||||||
|
|
||||||
|
|
@ -257,11 +263,13 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
cardCountersGroupBox->setLayout(cardCountersLayout);
|
cardCountersGroupBox->setLayout(cardCountersLayout);
|
||||||
|
|
||||||
// Hand layout
|
// Hand layout
|
||||||
horizontalHandCheckBox.setChecked(settings.getHorizontalHand());
|
horizontalHandCheckBox.setChecked(settings.interface().getHorizontalHand());
|
||||||
connect(&horizontalHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setHorizontalHand);
|
connect(&horizontalHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||||
|
&InterfaceSettings::setHorizontalHand);
|
||||||
|
|
||||||
leftJustifiedHandCheckBox.setChecked(settings.getLeftJustified());
|
leftJustifiedHandCheckBox.setChecked(settings.interface().getLeftJustified());
|
||||||
connect(&leftJustifiedHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setLeftJustified);
|
connect(&leftJustifiedHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||||
|
&InterfaceSettings::setLeftJustified);
|
||||||
|
|
||||||
auto *handGrid = new QGridLayout;
|
auto *handGrid = new QGridLayout;
|
||||||
handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
|
handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
|
||||||
|
|
@ -271,14 +279,14 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
handGroupBox->setLayout(handGrid);
|
handGroupBox->setLayout(handGrid);
|
||||||
|
|
||||||
// table grid layout
|
// table grid layout
|
||||||
invertVerticalCoordinateCheckBox.setChecked(settings.getInvertVerticalCoordinate());
|
invertVerticalCoordinateCheckBox.setChecked(settings.interface().getInvertVerticalCoordinate());
|
||||||
connect(&invertVerticalCoordinateCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&invertVerticalCoordinateCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||||
&SettingsCache::setInvertVerticalCoordinate);
|
&InterfaceSettings::setInvertVerticalCoordinate);
|
||||||
|
|
||||||
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
|
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
|
||||||
minPlayersForMultiColumnLayoutEdit.setValue(settings.getMinPlayersForMultiColumnLayout());
|
minPlayersForMultiColumnLayoutEdit.setValue(settings.interface().getMinPlayersForMultiColumnLayout());
|
||||||
connect(&minPlayersForMultiColumnLayoutEdit, qOverload<int>(&QSpinBox::valueChanged), &settings,
|
connect(&minPlayersForMultiColumnLayoutEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.interface(),
|
||||||
&SettingsCache::setMinPlayersForMultiColumnLayout);
|
&InterfaceSettings::setMinPlayersForMultiColumnLayout);
|
||||||
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
|
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
|
||||||
|
|
||||||
auto *tableGrid = new QGridLayout;
|
auto *tableGrid = new QGridLayout;
|
||||||
|
|
@ -305,7 +313,8 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &AppearanceSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&AppearanceSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -319,7 +328,7 @@ void AppearanceSettingsPage::themeBoxChanged(int index)
|
||||||
|
|
||||||
void AppearanceSettingsPage::openThemeLocation()
|
void AppearanceSettingsPage::openThemeLocation()
|
||||||
{
|
{
|
||||||
QString dir = SettingsCache::instance().getThemesPath();
|
QString dir = SettingsCache::instance().paths().getThemesPath();
|
||||||
QDir dirDir = dir;
|
QDir dirDir = dir;
|
||||||
dirDir.cdUp();
|
dirDir.cdUp();
|
||||||
// open if dir exists, create if parent dir does exist
|
// open if dir exists, create if parent dir does exist
|
||||||
|
|
@ -338,8 +347,8 @@ void AppearanceSettingsPage::editPalette()
|
||||||
|
|
||||||
void AppearanceSettingsPage::updateHomeTabSettingsVisibility()
|
void AppearanceSettingsPage::updateHomeTabSettingsVisibility()
|
||||||
{
|
{
|
||||||
bool visible =
|
bool visible = SettingsCache::instance().personal().getHomeTabBackgroundSource() !=
|
||||||
SettingsCache::instance().getHomeTabBackgroundSource() != BackgroundSources::toId(BackgroundSources::Theme);
|
BackgroundSources::toId(BackgroundSources::Theme);
|
||||||
|
|
||||||
homeTabBackgroundShuffleFrequencyLabel.setVisible(visible);
|
homeTabBackgroundShuffleFrequencyLabel.setVisible(visible);
|
||||||
homeTabBackgroundShuffleFrequencySpinBox.setVisible(visible);
|
homeTabBackgroundShuffleFrequencySpinBox.setVisible(visible);
|
||||||
|
|
@ -348,7 +357,7 @@ void AppearanceSettingsPage::updateHomeTabSettingsVisibility()
|
||||||
|
|
||||||
void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
|
void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setShowShortcuts(value);
|
SettingsCache::instance().cardsDisplay().setShowShortcuts(value);
|
||||||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
|
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,7 +384,7 @@ void AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled(QT_
|
||||||
*/
|
*/
|
||||||
void AppearanceSettingsPage::cardViewInitialRowsMaxChanged(int value)
|
void AppearanceSettingsPage::cardViewInitialRowsMaxChanged(int value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setCardViewInitialRowsMax(value);
|
SettingsCache::instance().interface().setCardViewInitialRowsMax(value);
|
||||||
if (cardViewExpandedRowsMaxBox.value() < value) {
|
if (cardViewExpandedRowsMaxBox.value() < value) {
|
||||||
cardViewExpandedRowsMaxBox.setValue(value);
|
cardViewExpandedRowsMaxBox.setValue(value);
|
||||||
}
|
}
|
||||||
|
|
@ -388,7 +397,7 @@ void AppearanceSettingsPage::cardViewInitialRowsMaxChanged(int value)
|
||||||
*/
|
*/
|
||||||
void AppearanceSettingsPage::cardViewExpandedRowsMaxChanged(int value)
|
void AppearanceSettingsPage::cardViewExpandedRowsMaxChanged(int value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setCardViewExpandedRowsMax(value);
|
SettingsCache::instance().interface().setCardViewExpandedRowsMax(value);
|
||||||
if (cardViewInitialRowsMaxBox.value() > value) {
|
if (cardViewInitialRowsMaxBox.value() > value) {
|
||||||
cardViewInitialRowsMaxBox.setValue(value);
|
cardViewInitialRowsMaxBox.setValue(value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
{
|
{
|
||||||
picDownloadCheckBox.setChecked(SettingsCache::instance().getPicDownload());
|
picDownloadCheckBox.setChecked(SettingsCache::instance().personal().getPicDownload());
|
||||||
connect(&picDownloadCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&picDownloadCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().personal(),
|
||||||
&SettingsCache::setPicDownload);
|
&PersonalSettings::setPicDownload);
|
||||||
|
|
||||||
urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||||
urlLinkLabel.setOpenExternalLinks(true);
|
urlLinkLabel.setOpenExternalLinks(true);
|
||||||
|
|
@ -25,7 +25,7 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
auto *lpGeneralGrid = new QGridLayout;
|
auto *lpGeneralGrid = new QGridLayout;
|
||||||
auto *lpSpoilerGrid = new QGridLayout;
|
auto *lpSpoilerGrid = new QGridLayout;
|
||||||
|
|
||||||
mcDownloadSpoilersCheckBox.setChecked(SettingsCache::instance().getDownloadSpoilersStatus());
|
mcDownloadSpoilersCheckBox.setChecked(SettingsCache::instance().personal().getDownloadSpoilersStatus());
|
||||||
|
|
||||||
mpSpoilerSavePathLineEdit = new QLineEdit(SettingsCache::instance().getSpoilerCardDatabasePath());
|
mpSpoilerSavePathLineEdit = new QLineEdit(SettingsCache::instance().getSpoilerCardDatabasePath());
|
||||||
mpSpoilerSavePathLineEdit->setReadOnly(true);
|
mpSpoilerSavePathLineEdit->setReadOnly(true);
|
||||||
|
|
@ -87,8 +87,8 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
lpSpoilerGrid->addWidget(&infoOnSpoilersLabel, 3, 0, 1, 3, Qt::AlignTop);
|
lpSpoilerGrid->addWidget(&infoOnSpoilersLabel, 3, 0, 1, 3, Qt::AlignTop);
|
||||||
|
|
||||||
// On a change to the checkbox, hide/un-hide the other fields
|
// On a change to the checkbox, hide/un-hide the other fields
|
||||||
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, &SettingsCache::instance(),
|
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, &SettingsCache::instance().personal(),
|
||||||
&SettingsCache::setDownloadSpoilerStatus);
|
&PersonalSettings::setDownloadSpoilerStatus);
|
||||||
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, this, &DeckEditorSettingsPage::setSpoilersEnabled);
|
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, this, &DeckEditorSettingsPage::setSpoilersEnabled);
|
||||||
|
|
||||||
mpGeneralGroupBox = new QGroupBox;
|
mpGeneralGroupBox = new QGroupBox;
|
||||||
|
|
@ -103,7 +103,8 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||||
|
|
||||||
setLayout(lpMainLayout);
|
setLayout(lpMainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &DeckEditorSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&DeckEditorSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +204,7 @@ void DeckEditorSettingsPage::spoilerPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
mpSpoilerSavePathLineEdit->setText(lsPath + "/spoiler.xml");
|
mpSpoilerSavePathLineEdit->setText(lsPath + "/spoiler.xml");
|
||||||
SettingsCache::instance().setSpoilerDatabasePath(lsPath + "/spoiler.xml");
|
SettingsCache::instance().paths().setSpoilerDatabasePath(lsPath + "/spoiler.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorSettingsPage::setSpoilersEnabled(bool anInput)
|
void DeckEditorSettingsPage::setSpoilersEnabled(bool anInput)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <libcockatrice/settings/paths_settings.h>
|
||||||
|
#include <libcockatrice/settings/personal_settings.h>
|
||||||
|
#include <libcockatrice/settings/updates_settings.h>
|
||||||
|
|
||||||
enum startupCardUpdateCheckBehaviorIndex
|
enum startupCardUpdateCheckBehaviorIndex
|
||||||
{
|
{
|
||||||
|
|
@ -50,17 +53,18 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
|
|
||||||
// version settings
|
// version settings
|
||||||
SettingsCache &settings = SettingsCache::instance();
|
SettingsCache &settings = SettingsCache::instance();
|
||||||
startupUpdateCheckCheckBox.setChecked(settings.getCheckUpdatesOnStartup());
|
startupUpdateCheckCheckBox.setChecked(settings.updates().getCheckUpdatesOnStartup());
|
||||||
|
|
||||||
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.updates(),
|
||||||
&SettingsCache::setCheckUpdatesOnStartup);
|
&UpdatesSettings::setCheckUpdatesOnStartup);
|
||||||
|
|
||||||
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
|
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
|
||||||
|
|
||||||
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
|
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.updates(),
|
||||||
|
&UpdatesSettings::setNotifyAboutUpdates);
|
||||||
|
|
||||||
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.updates(),
|
||||||
&SettingsCache::setNotifyAboutNewVersion);
|
&UpdatesSettings::setNotifyAboutNewVersion);
|
||||||
|
|
||||||
auto *versionGrid = new QGridLayout;
|
auto *versionGrid = new QGridLayout;
|
||||||
versionGrid->addWidget(&updateReleaseChannelLabel, 0, 0);
|
versionGrid->addWidget(&updateReleaseChannelLabel, 0, 0);
|
||||||
|
|
@ -76,9 +80,9 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
startupCardUpdateCheckBehaviorSelector.addItem(""); // these will be set in retranslateUI
|
startupCardUpdateCheckBehaviorSelector.addItem(""); // these will be set in retranslateUI
|
||||||
startupCardUpdateCheckBehaviorSelector.addItem("");
|
startupCardUpdateCheckBehaviorSelector.addItem("");
|
||||||
startupCardUpdateCheckBehaviorSelector.addItem("");
|
startupCardUpdateCheckBehaviorSelector.addItem("");
|
||||||
if (SettingsCache::instance().getStartupCardUpdateCheckPromptForUpdate()) {
|
if (SettingsCache::instance().updates().getStartupCardUpdateCheckPromptForUpdate()) {
|
||||||
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexPrompt);
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexPrompt);
|
||||||
} else if (SettingsCache::instance().getStartupCardUpdateCheckAlwaysUpdate()) {
|
} else if (SettingsCache::instance().updates().getStartupCardUpdateCheckAlwaysUpdate()) {
|
||||||
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexAlways);
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexAlways);
|
||||||
} else {
|
} else {
|
||||||
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexNone);
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexNone);
|
||||||
|
|
@ -86,20 +90,20 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
|
|
||||||
connect(&startupCardUpdateCheckBehaviorSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(&startupCardUpdateCheckBehaviorSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
[](int index) {
|
[](int index) {
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(
|
SettingsCache::instance().updates().setStartupCardUpdateCheckPromptForUpdate(
|
||||||
index == startupCardUpdateCheckBehaviorIndexPrompt);
|
index == startupCardUpdateCheckBehaviorIndexPrompt);
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(
|
SettingsCache::instance().updates().setStartupCardUpdateCheckAlwaysUpdate(
|
||||||
index == startupCardUpdateCheckBehaviorIndexAlways);
|
index == startupCardUpdateCheckBehaviorIndexAlways);
|
||||||
});
|
});
|
||||||
|
|
||||||
cardUpdateCheckIntervalSpinBox.setMinimum(1);
|
cardUpdateCheckIntervalSpinBox.setMinimum(1);
|
||||||
cardUpdateCheckIntervalSpinBox.setMaximum(30);
|
cardUpdateCheckIntervalSpinBox.setMaximum(30);
|
||||||
cardUpdateCheckIntervalSpinBox.setValue(settings.getCardUpdateCheckInterval());
|
cardUpdateCheckIntervalSpinBox.setValue(settings.updates().getCardUpdateCheckInterval());
|
||||||
|
|
||||||
connect(&cardUpdateCheckIntervalSpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings,
|
connect(&cardUpdateCheckIntervalSpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings.updates(),
|
||||||
&SettingsCache::setCardUpdateCheckInterval);
|
&UpdatesSettings::setCardUpdateCheckInterval);
|
||||||
|
|
||||||
newVersionOracleCheckBox.setChecked(settings.getNotifyAboutNewVersion());
|
newVersionOracleCheckBox.setChecked(settings.updates().getNotifyAboutNewVersion());
|
||||||
|
|
||||||
auto *cardDatabaseGrid = new QGridLayout;
|
auto *cardDatabaseGrid = new QGridLayout;
|
||||||
cardDatabaseGrid->addWidget(&startupCardUpdateCheckBehaviorLabel, 0, 0);
|
cardDatabaseGrid->addWidget(&startupCardUpdateCheckBehaviorLabel, 0, 0);
|
||||||
|
|
@ -112,9 +116,9 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
cardDatabaseGroupBox->setLayout(cardDatabaseGrid);
|
cardDatabaseGroupBox->setLayout(cardDatabaseGrid);
|
||||||
|
|
||||||
// startup settings
|
// startup settings
|
||||||
showTipsOnStartup.setChecked(settings.getShowTipsOnStartup());
|
showTipsOnStartup.setChecked(settings.personal().getShowTipsOnStartup());
|
||||||
|
|
||||||
connect(&showTipsOnStartup, &QCheckBox::clicked, &settings, &SettingsCache::setShowTipsOnStartup);
|
connect(&showTipsOnStartup, &QCheckBox::clicked, &settings.personal(), &PersonalSettings::setShowTipsOnStartup);
|
||||||
|
|
||||||
auto *startupGrid = new QGridLayout;
|
auto *startupGrid = new QGridLayout;
|
||||||
startupGrid->addWidget(&showTipsOnStartup, 0, 0, 1, 2);
|
startupGrid->addWidget(&showTipsOnStartup, 0, 0, 1, 2);
|
||||||
|
|
@ -123,22 +127,22 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
startupGroupBox->setLayout(startupGrid);
|
startupGroupBox->setLayout(startupGrid);
|
||||||
|
|
||||||
// paths settings
|
// paths settings
|
||||||
deckPathEdit = new QLineEdit(settings.getDeckPath());
|
deckPathEdit = new QLineEdit(settings.paths().getDeckPath());
|
||||||
deckPathEdit->setReadOnly(true);
|
deckPathEdit->setReadOnly(true);
|
||||||
auto *deckPathButton = new QPushButton("...");
|
auto *deckPathButton = new QPushButton("...");
|
||||||
connect(deckPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::deckPathButtonClicked);
|
connect(deckPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::deckPathButtonClicked);
|
||||||
|
|
||||||
filtersPathEdit = new QLineEdit(settings.getFiltersPath());
|
filtersPathEdit = new QLineEdit(settings.paths().getFiltersPath());
|
||||||
filtersPathEdit->setReadOnly(true);
|
filtersPathEdit->setReadOnly(true);
|
||||||
auto *filtersPathButton = new QPushButton("...");
|
auto *filtersPathButton = new QPushButton("...");
|
||||||
connect(filtersPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::filtersPathButtonClicked);
|
connect(filtersPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::filtersPathButtonClicked);
|
||||||
|
|
||||||
replaysPathEdit = new QLineEdit(settings.getReplaysPath());
|
replaysPathEdit = new QLineEdit(settings.paths().getReplaysPath());
|
||||||
replaysPathEdit->setReadOnly(true);
|
replaysPathEdit->setReadOnly(true);
|
||||||
auto *replaysPathButton = new QPushButton("...");
|
auto *replaysPathButton = new QPushButton("...");
|
||||||
connect(replaysPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::replaysPathButtonClicked);
|
connect(replaysPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::replaysPathButtonClicked);
|
||||||
|
|
||||||
picsPathEdit = new QLineEdit(settings.getPicsPath());
|
picsPathEdit = new QLineEdit(settings.paths().getPicsPath());
|
||||||
picsPathEdit->setReadOnly(true);
|
picsPathEdit->setReadOnly(true);
|
||||||
auto *picsPathButton = new QPushButton("...");
|
auto *picsPathButton = new QPushButton("...");
|
||||||
connect(picsPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::picsPathButtonClicked);
|
connect(picsPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::picsPathButtonClicked);
|
||||||
|
|
@ -224,13 +228,14 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
GeneralSettingsPage::retranslateUi();
|
GeneralSettingsPage::retranslateUi();
|
||||||
|
|
||||||
// connect the ReleaseChannel combo box only after the entries are inserted in retranslateUi
|
// connect the ReleaseChannel combo box only after the entries are inserted in retranslateUi
|
||||||
connect(&updateReleaseChannelBox, qOverload<int>(&QComboBox::currentIndexChanged), &settings,
|
connect(&updateReleaseChannelBox, qOverload<int>(&QComboBox::currentIndexChanged), &settings.updates(),
|
||||||
&SettingsCache::setUpdateReleaseChannelIndex);
|
&UpdatesSettings::setUpdateReleaseChannelIndex);
|
||||||
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannelIndex());
|
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannelIndex());
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &GeneralSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&GeneralSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +269,7 @@ void GeneralSettingsPage::deckPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
deckPathEdit->setText(path);
|
deckPathEdit->setText(path);
|
||||||
SettingsCache::instance().setDeckPath(path);
|
SettingsCache::instance().paths().setDeckPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::filtersPathButtonClicked()
|
void GeneralSettingsPage::filtersPathButtonClicked()
|
||||||
|
|
@ -275,7 +280,7 @@ void GeneralSettingsPage::filtersPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
filtersPathEdit->setText(path);
|
filtersPathEdit->setText(path);
|
||||||
SettingsCache::instance().setFiltersPath(path);
|
SettingsCache::instance().paths().setFiltersPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::replaysPathButtonClicked()
|
void GeneralSettingsPage::replaysPathButtonClicked()
|
||||||
|
|
@ -286,7 +291,7 @@ void GeneralSettingsPage::replaysPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
replaysPathEdit->setText(path);
|
replaysPathEdit->setText(path);
|
||||||
SettingsCache::instance().setReplaysPath(path);
|
SettingsCache::instance().paths().setReplaysPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::picsPathButtonClicked()
|
void GeneralSettingsPage::picsPathButtonClicked()
|
||||||
|
|
@ -297,7 +302,7 @@ void GeneralSettingsPage::picsPathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
picsPathEdit->setText(path);
|
picsPathEdit->setText(path);
|
||||||
SettingsCache::instance().setPicsPath(path);
|
SettingsCache::instance().paths().setPicsPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
||||||
|
|
@ -308,7 +313,7 @@ void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
cardDatabasePathEdit->setText(path);
|
cardDatabasePathEdit->setText(path);
|
||||||
SettingsCache::instance().setCardDatabasePath(path);
|
SettingsCache::instance().paths().setCardDatabasePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::customCardDatabaseButtonClicked()
|
void GeneralSettingsPage::customCardDatabaseButtonClicked()
|
||||||
|
|
@ -319,7 +324,7 @@ void GeneralSettingsPage::customCardDatabaseButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
customCardDatabasePathEdit->setText(path);
|
customCardDatabasePathEdit->setText(path);
|
||||||
SettingsCache::instance().setCustomCardDatabasePath(path);
|
SettingsCache::instance().paths().setCustomCardDatabasePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
||||||
|
|
@ -330,16 +335,16 @@ void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenDatabasePathEdit->setText(path);
|
tokenDatabasePathEdit->setText(path);
|
||||||
SettingsCache::instance().setTokenDatabasePath(path);
|
SettingsCache::instance().paths().setTokenDatabasePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::resetAllPathsClicked()
|
void GeneralSettingsPage::resetAllPathsClicked()
|
||||||
{
|
{
|
||||||
SettingsCache &settings = SettingsCache::instance();
|
SettingsCache &settings = SettingsCache::instance();
|
||||||
settings.resetPaths();
|
settings.resetPaths();
|
||||||
deckPathEdit->setText(settings.getDeckPath());
|
deckPathEdit->setText(settings.paths().getDeckPath());
|
||||||
replaysPathEdit->setText(settings.getReplaysPath());
|
replaysPathEdit->setText(settings.paths().getReplaysPath());
|
||||||
picsPathEdit->setText(settings.getPicsPath());
|
picsPathEdit->setText(settings.paths().getPicsPath());
|
||||||
cardDatabasePathEdit->setText(settings.getCardDatabasePath());
|
cardDatabasePathEdit->setText(settings.getCardDatabasePath());
|
||||||
customCardDatabasePathEdit->setText(settings.getCustomCardDatabasePath());
|
customCardDatabasePathEdit->setText(settings.getCustomCardDatabasePath());
|
||||||
tokenDatabasePathEdit->setText(settings.getTokenDatabasePath());
|
tokenDatabasePathEdit->setText(settings.getTokenDatabasePath());
|
||||||
|
|
@ -348,7 +353,7 @@ void GeneralSettingsPage::resetAllPathsClicked()
|
||||||
|
|
||||||
void GeneralSettingsPage::languageBoxChanged(int index)
|
void GeneralSettingsPage::languageBoxChanged(int index)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setLang(languageBox.itemData(index).toString());
|
SettingsCache::instance().personal().setLang(languageBox.itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::retranslateUi()
|
void GeneralSettingsPage::retranslateUi()
|
||||||
|
|
@ -391,7 +396,7 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
|
|
||||||
const auto &settings = SettingsCache::instance();
|
const auto &settings = SettingsCache::instance();
|
||||||
|
|
||||||
QDate lastCheckDate = settings.getLastCardUpdateCheck();
|
QDate lastCheckDate = settings.updates().getLastCardUpdateCheck();
|
||||||
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
||||||
|
|
||||||
lastCardUpdateCheckDateLabel.setText(
|
lastCardUpdateCheckDateLabel.setText(
|
||||||
|
|
|
||||||
|
|
@ -10,54 +10,56 @@
|
||||||
|
|
||||||
MessagesSettingsPage::MessagesSettingsPage()
|
MessagesSettingsPage::MessagesSettingsPage()
|
||||||
{
|
{
|
||||||
chatMentionCheckBox.setChecked(SettingsCache::instance().getChatMention());
|
chatMentionCheckBox.setChecked(SettingsCache::instance().chat().getChatMention());
|
||||||
connect(&chatMentionCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&chatMentionCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setChatMention);
|
&ChatSettings::setChatMention);
|
||||||
|
|
||||||
chatMentionCompleterCheckbox.setChecked(SettingsCache::instance().getChatMentionCompleter());
|
chatMentionCompleterCheckbox.setChecked(SettingsCache::instance().chat().getChatMentionCompleter());
|
||||||
connect(&chatMentionCompleterCheckbox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&chatMentionCompleterCheckbox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setChatMentionCompleter);
|
&ChatSettings::setChatMentionCompleter);
|
||||||
|
|
||||||
explainMessagesLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
explainMessagesLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||||
explainMessagesLabel.setOpenExternalLinks(true);
|
explainMessagesLabel.setOpenExternalLinks(true);
|
||||||
|
|
||||||
ignoreUnregUsersMainChat.setChecked(SettingsCache::instance().getIgnoreUnregisteredUsers());
|
ignoreUnregUsersMainChat.setChecked(SettingsCache::instance().chat().getIgnoreUnregisteredUsers());
|
||||||
ignoreUnregUserMessages.setChecked(SettingsCache::instance().getIgnoreUnregisteredUserMessages());
|
ignoreUnregUserMessages.setChecked(SettingsCache::instance().chat().getIgnoreUnregisteredUserMessages());
|
||||||
ignoreNonBuddyUserMessages.setChecked(SettingsCache::instance().getIgnoreNonBuddyUserMessages());
|
ignoreNonBuddyUserMessages.setChecked(SettingsCache::instance().chat().getIgnoreNonBuddyUserMessages());
|
||||||
|
|
||||||
connect(&ignoreUnregUsersMainChat, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&ignoreUnregUsersMainChat, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setIgnoreUnregisteredUsers);
|
&ChatSettings::setIgnoreUnregisteredUsers);
|
||||||
connect(&ignoreUnregUserMessages, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&ignoreUnregUserMessages, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setIgnoreUnregisteredUserMessages);
|
&ChatSettings::setIgnoreUnregisteredUserMessages);
|
||||||
connect(&ignoreNonBuddyUserMessages, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&ignoreNonBuddyUserMessages, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setIgnoreNonBuddyUserMessages);
|
&ChatSettings::setIgnoreNonBuddyUserMessages);
|
||||||
|
|
||||||
invertMentionForeground.setChecked(SettingsCache::instance().getChatMentionForeground());
|
invertMentionForeground.setChecked(SettingsCache::instance().chat().getChatMentionForeground());
|
||||||
connect(&invertMentionForeground, &QCheckBox::QT_STATE_CHANGED, this, &MessagesSettingsPage::updateTextColor);
|
connect(&invertMentionForeground, &QCheckBox::QT_STATE_CHANGED, this, &MessagesSettingsPage::updateTextColor);
|
||||||
|
|
||||||
invertHighlightForeground.setChecked(SettingsCache::instance().getChatHighlightForeground());
|
invertHighlightForeground.setChecked(SettingsCache::instance().chat().getChatHighlightForeground());
|
||||||
connect(&invertHighlightForeground, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(&invertHighlightForeground, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&MessagesSettingsPage::updateTextHighlightColor);
|
&MessagesSettingsPage::updateTextHighlightColor);
|
||||||
|
|
||||||
mentionColor = new QLineEdit();
|
mentionColor = new QLineEdit();
|
||||||
mentionColor->setText(SettingsCache::instance().getChatMentionColor());
|
mentionColor->setText(SettingsCache::instance().chat().getChatMentionColor());
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
connect(mentionColor, &QLineEdit::textChanged, this, &MessagesSettingsPage::updateColor);
|
connect(mentionColor, &QLineEdit::textChanged, this, &MessagesSettingsPage::updateColor);
|
||||||
|
|
||||||
messagePopups.setChecked(SettingsCache::instance().getShowMessagePopup());
|
messagePopups.setChecked(SettingsCache::instance().chat().getShowMessagePopup());
|
||||||
connect(&messagePopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&messagePopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setShowMessagePopups);
|
&ChatSettings::setShowMessagePopups);
|
||||||
|
|
||||||
mentionPopups.setChecked(SettingsCache::instance().getShowMentionPopup());
|
mentionPopups.setChecked(SettingsCache::instance().chat().getShowMentionPopup());
|
||||||
connect(&mentionPopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&mentionPopups, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
&SettingsCache::setShowMentionPopups);
|
&ChatSettings::setShowMentionPopups);
|
||||||
|
|
||||||
roomHistory.setChecked(SettingsCache::instance().getRoomHistory());
|
roomHistory.setChecked(SettingsCache::instance().chat().getRoomHistory());
|
||||||
connect(&roomHistory, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(), &SettingsCache::setRoomHistory);
|
connect(&roomHistory, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().chat(),
|
||||||
|
&ChatSettings::setRoomHistory);
|
||||||
|
|
||||||
customAlertString = new QLineEdit();
|
customAlertString = new QLineEdit();
|
||||||
customAlertString->setText(SettingsCache::instance().getHighlightWords());
|
customAlertString->setText(SettingsCache::instance().chat().getHighlightWords());
|
||||||
connect(customAlertString, &QLineEdit::textChanged, &SettingsCache::instance(), &SettingsCache::setHighlightWords);
|
connect(customAlertString, &QLineEdit::textChanged, &SettingsCache::instance().chat(),
|
||||||
|
&ChatSettings::setHighlightWords);
|
||||||
|
|
||||||
auto *chatGrid = new QGridLayout;
|
auto *chatGrid = new QGridLayout;
|
||||||
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
||||||
|
|
@ -75,7 +77,7 @@ MessagesSettingsPage::MessagesSettingsPage()
|
||||||
chatGroupBox->setLayout(chatGrid);
|
chatGroupBox->setLayout(chatGrid);
|
||||||
|
|
||||||
highlightColor = new QLineEdit();
|
highlightColor = new QLineEdit();
|
||||||
highlightColor->setText(SettingsCache::instance().getChatHighlightColor());
|
highlightColor->setText(SettingsCache::instance().chat().getChatHighlightColor());
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
connect(highlightColor, &QLineEdit::textChanged, this, &MessagesSettingsPage::updateHighlightColor);
|
connect(highlightColor, &QLineEdit::textChanged, this, &MessagesSettingsPage::updateHighlightColor);
|
||||||
|
|
||||||
|
|
@ -132,7 +134,8 @@ MessagesSettingsPage::MessagesSettingsPage()
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &MessagesSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&MessagesSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,7 +148,7 @@ void MessagesSettingsPage::updateColor(const QString &value)
|
||||||
colorToSet.setNamedColor("#" + value);
|
colorToSet.setNamedColor("#" + value);
|
||||||
#endif
|
#endif
|
||||||
if (colorToSet.isValid()) {
|
if (colorToSet.isValid()) {
|
||||||
SettingsCache::instance().setChatMentionColor(value);
|
SettingsCache::instance().chat().setChatMentionColor(value);
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,35 +162,35 @@ void MessagesSettingsPage::updateHighlightColor(const QString &value)
|
||||||
colorToSet.setNamedColor("#" + value);
|
colorToSet.setNamedColor("#" + value);
|
||||||
#endif
|
#endif
|
||||||
if (colorToSet.isValid()) {
|
if (colorToSet.isValid()) {
|
||||||
SettingsCache::instance().setChatHighlightColor(value);
|
SettingsCache::instance().chat().setChatHighlightColor(value);
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateTextColor(QT_STATE_CHANGED_T value)
|
void MessagesSettingsPage::updateTextColor(QT_STATE_CHANGED_T value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setChatMentionForeground(value);
|
SettingsCache::instance().chat().setChatMentionForeground(value);
|
||||||
updateMentionPreview();
|
updateMentionPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateTextHighlightColor(QT_STATE_CHANGED_T value)
|
void MessagesSettingsPage::updateTextHighlightColor(QT_STATE_CHANGED_T value)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setChatHighlightForeground(value);
|
SettingsCache::instance().chat().setChatHighlightForeground(value);
|
||||||
updateHighlightPreview();
|
updateHighlightPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateMentionPreview()
|
void MessagesSettingsPage::updateMentionPreview()
|
||||||
{
|
{
|
||||||
mentionColor->setStyleSheet(
|
mentionColor->setStyleSheet(
|
||||||
"QLineEdit{background:#" + SettingsCache::instance().getChatMentionColor() +
|
"QLineEdit{background:#" + SettingsCache::instance().chat().getChatMentionColor() +
|
||||||
";color: " + (SettingsCache::instance().getChatMentionForeground() ? "white" : "black") + ";}");
|
";color: " + (SettingsCache::instance().chat().getChatMentionForeground() ? "white" : "black") + ";}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::updateHighlightPreview()
|
void MessagesSettingsPage::updateHighlightPreview()
|
||||||
{
|
{
|
||||||
highlightColor->setStyleSheet(
|
highlightColor->setStyleSheet(
|
||||||
"QLineEdit{background:#" + SettingsCache::instance().getChatHighlightColor() +
|
"QLineEdit{background:#" + SettingsCache::instance().chat().getChatHighlightColor() +
|
||||||
";color: " + (SettingsCache::instance().getChatHighlightForeground() ? "white" : "black") + ";}");
|
";color: " + (SettingsCache::instance().chat().getChatHighlightForeground() ? "white" : "black") + ";}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesSettingsPage::storeSettings()
|
void MessagesSettingsPage::storeSettings()
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ ShortcutSettingsPage::ShortcutSettingsPage()
|
||||||
|
|
||||||
connect(shortcutsTable, &ShortcutTreeView::currentItemChanged, this, &ShortcutSettingsPage::currentItemChanged);
|
connect(shortcutsTable, &ShortcutTreeView::currentItemChanged, this, &ShortcutSettingsPage::currentItemChanged);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &ShortcutSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&ShortcutSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
SoundSettingsPage::SoundSettingsPage()
|
SoundSettingsPage::SoundSettingsPage()
|
||||||
{
|
{
|
||||||
soundEnabledCheckBox.setChecked(SettingsCache::instance().getSoundEnabled());
|
soundEnabledCheckBox.setChecked(SettingsCache::instance().sound().getSoundEnabled());
|
||||||
connect(&soundEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&soundEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().sound(),
|
||||||
&SettingsCache::setSoundEnabled);
|
&SoundSettings::setSoundEnabled);
|
||||||
|
|
||||||
QString themeName = SettingsCache::instance().getSoundThemeName();
|
QString themeName = SettingsCache::instance().sound().getSoundThemeName();
|
||||||
|
|
||||||
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
||||||
for (int i = 0; i < themeDirs.size(); i++) {
|
for (int i = 0; i < themeDirs.size(); i++) {
|
||||||
|
|
@ -27,17 +27,18 @@ SoundSettingsPage::SoundSettingsPage()
|
||||||
masterVolumeSlider = new QSlider(Qt::Horizontal);
|
masterVolumeSlider = new QSlider(Qt::Horizontal);
|
||||||
masterVolumeSlider->setMinimum(0);
|
masterVolumeSlider->setMinimum(0);
|
||||||
masterVolumeSlider->setMaximum(100);
|
masterVolumeSlider->setMaximum(100);
|
||||||
masterVolumeSlider->setValue(SettingsCache::instance().getMasterVolume());
|
masterVolumeSlider->setValue(SettingsCache::instance().sound().getMasterVolume());
|
||||||
masterVolumeSlider->setToolTip(QString::number(SettingsCache::instance().getMasterVolume()));
|
masterVolumeSlider->setToolTip(QString::number(SettingsCache::instance().sound().getMasterVolume()));
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::masterVolumeChanged, this,
|
connect(&SettingsCache::instance().sound(), &SoundSettings::masterVolumeChanged, this,
|
||||||
&SoundSettingsPage::masterVolumeChanged);
|
&SoundSettingsPage::masterVolumeChanged);
|
||||||
connect(masterVolumeSlider, &QSlider::sliderReleased, soundEngine, &SoundEngine::testSound);
|
connect(masterVolumeSlider, &QSlider::sliderReleased, soundEngine, &SoundEngine::testSound);
|
||||||
connect(masterVolumeSlider, &QSlider::valueChanged, &SettingsCache::instance(), &SettingsCache::setMasterVolume);
|
connect(masterVolumeSlider, &QSlider::valueChanged, &SettingsCache::instance().sound(),
|
||||||
|
&SoundSettings::setMasterVolume);
|
||||||
|
|
||||||
masterVolumeSpinBox = new QSpinBox();
|
masterVolumeSpinBox = new QSpinBox();
|
||||||
masterVolumeSpinBox->setMinimum(0);
|
masterVolumeSpinBox->setMinimum(0);
|
||||||
masterVolumeSpinBox->setMaximum(100);
|
masterVolumeSpinBox->setMaximum(100);
|
||||||
masterVolumeSpinBox->setValue(SettingsCache::instance().getMasterVolume());
|
masterVolumeSpinBox->setValue(SettingsCache::instance().sound().getMasterVolume());
|
||||||
connect(masterVolumeSlider, &QSlider::valueChanged, masterVolumeSpinBox, &QSpinBox::setValue);
|
connect(masterVolumeSlider, &QSlider::valueChanged, masterVolumeSpinBox, &QSpinBox::setValue);
|
||||||
connect(masterVolumeSpinBox, qOverload<int>(&QSpinBox::valueChanged), masterVolumeSlider, &QSlider::setValue);
|
connect(masterVolumeSpinBox, qOverload<int>(&QSpinBox::valueChanged), masterVolumeSlider, &QSlider::setValue);
|
||||||
|
|
||||||
|
|
@ -59,7 +60,8 @@ SoundSettingsPage::SoundSettingsPage()
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &SoundSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&SoundSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +69,7 @@ void SoundSettingsPage::themeBoxChanged(int index)
|
||||||
{
|
{
|
||||||
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
QStringList themeDirs = soundEngine->getAvailableThemes().keys();
|
||||||
if (index >= 0 && index < themeDirs.count()) {
|
if (index >= 0 && index < themeDirs.count()) {
|
||||||
SettingsCache::instance().setSoundThemeName(themeDirs.at(index));
|
SettingsCache::instance().sound().setSoundThemeName(themeDirs.at(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include "storage_settings_page.h"
|
#include "storage_settings_page.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../card_picture_loader/card_picture_loader_cache_method.h"
|
||||||
|
#include "../../card_picture_loader/card_picture_loader_local_schemes.h"
|
||||||
#include "../interface/card_picture_loader/card_picture_loader.h"
|
#include "../interface/card_picture_loader/card_picture_loader.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
@ -27,7 +29,7 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
|
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
|
||||||
pixmapCacheEdit.setMaximum(PIXMAPCACHE_SIZE_MAX);
|
pixmapCacheEdit.setMaximum(PIXMAPCACHE_SIZE_MAX);
|
||||||
pixmapCacheEdit.setSingleStep(64);
|
pixmapCacheEdit.setSingleStep(64);
|
||||||
pixmapCacheEdit.setValue(SettingsCache::instance().getPixmapCacheSize());
|
pixmapCacheEdit.setValue(SettingsCache::instance().cacheStorage().getPixmapCacheSize());
|
||||||
pixmapCacheEdit.setSuffix(" MB");
|
pixmapCacheEdit.setSuffix(" MB");
|
||||||
|
|
||||||
// Caching method
|
// Caching method
|
||||||
|
|
@ -37,7 +39,8 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
cardPictureLoaderCacheMethodComboBox->addItem(method.displayName, static_cast<int>(method.id));
|
cardPictureLoaderCacheMethodComboBox->addItem(method.displayName, static_cast<int>(method.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentCacheMethod = static_cast<int>(SettingsCache::instance().getCardPictureLoaderCacheMethod());
|
int currentCacheMethod =
|
||||||
|
static_cast<int>(SettingsCache::instance().cacheStorage().getCardPictureLoaderCacheMethod());
|
||||||
|
|
||||||
int currentIndex = cardPictureLoaderCacheMethodComboBox->findData(currentCacheMethod);
|
int currentIndex = cardPictureLoaderCacheMethodComboBox->findData(currentCacheMethod);
|
||||||
if (currentIndex >= 0) {
|
if (currentIndex >= 0) {
|
||||||
|
|
@ -60,7 +63,7 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
mpNetworkCacheGroupBox->setEnabled(useNetworkCache);
|
mpNetworkCacheGroupBox->setEnabled(useNetworkCache);
|
||||||
mpImageBackupGroupBox->setEnabled(!useNetworkCache);
|
mpImageBackupGroupBox->setEnabled(!useNetworkCache);
|
||||||
|
|
||||||
SettingsCache::instance().setCardImageCacheMethod(cacheMethod);
|
SettingsCache::instance().cacheStorage().setCardImageCacheMethod(static_cast<int>(cacheMethod));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Network Cache
|
// Network Cache
|
||||||
|
|
@ -68,13 +71,13 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
networkCacheEdit.setMinimum(NETWORK_CACHE_SIZE_MIN);
|
networkCacheEdit.setMinimum(NETWORK_CACHE_SIZE_MIN);
|
||||||
networkCacheEdit.setMaximum(NETWORK_CACHE_SIZE_MAX);
|
networkCacheEdit.setMaximum(NETWORK_CACHE_SIZE_MAX);
|
||||||
networkCacheEdit.setSingleStep(1);
|
networkCacheEdit.setSingleStep(1);
|
||||||
networkCacheEdit.setValue(SettingsCache::instance().getNetworkCacheSizeInMB());
|
networkCacheEdit.setValue(SettingsCache::instance().cacheStorage().getNetworkCacheSizeInMB());
|
||||||
networkCacheEdit.setSuffix(" MB");
|
networkCacheEdit.setSuffix(" MB");
|
||||||
|
|
||||||
networkRedirectCacheTtlEdit.setMinimum(NETWORK_REDIRECT_CACHE_TTL_MIN);
|
networkRedirectCacheTtlEdit.setMinimum(NETWORK_REDIRECT_CACHE_TTL_MIN);
|
||||||
networkRedirectCacheTtlEdit.setMaximum(NETWORK_REDIRECT_CACHE_TTL_MAX);
|
networkRedirectCacheTtlEdit.setMaximum(NETWORK_REDIRECT_CACHE_TTL_MAX);
|
||||||
networkRedirectCacheTtlEdit.setSingleStep(1);
|
networkRedirectCacheTtlEdit.setSingleStep(1);
|
||||||
networkRedirectCacheTtlEdit.setValue(SettingsCache::instance().getRedirectCacheTtl());
|
networkRedirectCacheTtlEdit.setValue(SettingsCache::instance().cacheStorage().getRedirectCacheTtl());
|
||||||
|
|
||||||
// Image Backup
|
// Image Backup
|
||||||
localCardImageStorageNamingSchemeComboBox = new QComboBox;
|
localCardImageStorageNamingSchemeComboBox = new QComboBox;
|
||||||
|
|
@ -82,7 +85,7 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
localCardImageStorageNamingSchemeComboBox->addItem(scheme.displayName, static_cast<int>(scheme.id));
|
localCardImageStorageNamingSchemeComboBox->addItem(scheme.displayName, static_cast<int>(scheme.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
int current = static_cast<int>(SettingsCache::instance().getLocalCardImageStorageNamingScheme());
|
int current = static_cast<int>(SettingsCache::instance().cacheStorage().getLocalCardImageStorageNamingScheme());
|
||||||
|
|
||||||
int index = localCardImageStorageNamingSchemeComboBox->findData(current);
|
int index = localCardImageStorageNamingSchemeComboBox->findData(current);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
|
@ -93,7 +96,7 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
auto scheme = static_cast<CardPictureLoaderLocalSchemes::NamingScheme>(
|
auto scheme = static_cast<CardPictureLoaderLocalSchemes::NamingScheme>(
|
||||||
localCardImageStorageNamingSchemeComboBox->itemData(index).toInt());
|
localCardImageStorageNamingSchemeComboBox->itemData(index).toInt());
|
||||||
SettingsCache::instance().setLocalCardImageStorageNamingScheme(scheme);
|
SettingsCache::instance().cacheStorage().setLocalCardImageStorageNamingScheme(static_cast<int>(scheme));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&clearBackupsButton, &QPushButton::clicked, this, &StorageSettingsPage::clearImageBackupsButtonClicked);
|
connect(&clearBackupsButton, &QPushButton::clicked, this, &StorageSettingsPage::clearImageBackupsButtonClicked);
|
||||||
|
|
@ -132,12 +135,12 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
lpPixmapCacheGrid->addWidget(&pixmapCacheExplainerLabel, 0, 0);
|
lpPixmapCacheGrid->addWidget(&pixmapCacheExplainerLabel, 0, 0);
|
||||||
lpPixmapCacheGrid->addLayout(pixmapCacheLayout, 1, 0);
|
lpPixmapCacheGrid->addLayout(pixmapCacheLayout, 1, 0);
|
||||||
|
|
||||||
connect(&pixmapCacheEdit, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(&pixmapCacheEdit, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().cacheStorage(),
|
||||||
&SettingsCache::setPixmapCacheSize);
|
&CacheStorageSettings::setPixmapCacheSize);
|
||||||
connect(&networkCacheEdit, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(&networkCacheEdit, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().cacheStorage(),
|
||||||
&SettingsCache::setNetworkCacheSizeInMB);
|
&CacheStorageSettings::setNetworkCacheSizeInMB);
|
||||||
connect(&networkRedirectCacheTtlEdit, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(&networkRedirectCacheTtlEdit, qOverload<int>(&QSpinBox::valueChanged),
|
||||||
&SettingsCache::setNetworkRedirectCacheTtl);
|
&SettingsCache::instance().cacheStorage(), &CacheStorageSettings::setNetworkRedirectCacheTtl);
|
||||||
|
|
||||||
mpCacheMethodGroupBox = new QGroupBox;
|
mpCacheMethodGroupBox = new QGroupBox;
|
||||||
mpCacheMethodGroupBox->setLayout(cacheMethodLayout);
|
mpCacheMethodGroupBox->setLayout(cacheMethodLayout);
|
||||||
|
|
@ -161,13 +164,15 @@ StorageSettingsPage::StorageSettingsPage()
|
||||||
|
|
||||||
setLayout(lpMainLayout);
|
setLayout(lpMainLayout);
|
||||||
|
|
||||||
bool useNetworkCache = SettingsCache::instance().getCardPictureLoaderCacheMethod() ==
|
bool useNetworkCache = static_cast<CardPictureLoaderCacheMethod::CacheMethod>(
|
||||||
|
SettingsCache::instance().cacheStorage().getCardPictureLoaderCacheMethod()) ==
|
||||||
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE;
|
CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE;
|
||||||
|
|
||||||
mpNetworkCacheGroupBox->setEnabled(useNetworkCache);
|
mpNetworkCacheGroupBox->setEnabled(useNetworkCache);
|
||||||
mpImageBackupGroupBox->setEnabled(!useNetworkCache);
|
mpImageBackupGroupBox->setEnabled(!useNetworkCache);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &StorageSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&StorageSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +185,7 @@ void StorageSettingsPage::clearDownloadedPicsButtonClicked()
|
||||||
|
|
||||||
void StorageSettingsPage::clearImageBackupsButtonClicked()
|
void StorageSettingsPage::clearImageBackupsButtonClicked()
|
||||||
{
|
{
|
||||||
QString picsPath = SettingsCache::instance().getPicsPath() + "/downloadedPics";
|
QString picsPath = SettingsCache::instance().paths().getPicsPath() + "/downloadedPics";
|
||||||
|
|
||||||
QDir dir(picsPath);
|
QDir dir(picsPath);
|
||||||
bool success = dir.removeRecursively();
|
bool success = dir.removeRecursively();
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../interface/widgets/tabs/tab_supervisor.h"
|
#include "../interface/widgets/tabs/tab_supervisor.h"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||||
|
|
||||||
enum visualDeckStoragePromptForConversionIndex
|
enum visualDeckStoragePromptForConversionIndex
|
||||||
{
|
{
|
||||||
|
|
@ -15,66 +16,71 @@ enum visualDeckStoragePromptForConversionIndex
|
||||||
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
{
|
{
|
||||||
// general settings and notification settings
|
// general settings and notification settings
|
||||||
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().getNotificationsEnabled());
|
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().interface().getNotificationsEnabled());
|
||||||
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setNotificationsEnabled);
|
&InterfaceSettings::setNotificationsEnabled);
|
||||||
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&UserInterfaceSettingsPage::setNotificationEnabled);
|
&UserInterfaceSettingsPage::setNotificationEnabled);
|
||||||
|
|
||||||
specNotificationsEnabledCheckBox.setChecked(SettingsCache::instance().getSpectatorNotificationsEnabled());
|
specNotificationsEnabledCheckBox.setChecked(
|
||||||
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled());
|
SettingsCache::instance().interface().getSpectatorNotificationsEnabled());
|
||||||
connect(&specNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().interface().getNotificationsEnabled());
|
||||||
&SettingsCache::setSpectatorNotificationsEnabled);
|
connect(&specNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
|
&InterfaceSettings::setSpectatorNotificationsEnabled);
|
||||||
|
|
||||||
buddyConnectNotificationsEnabledCheckBox.setChecked(
|
buddyConnectNotificationsEnabledCheckBox.setChecked(
|
||||||
SettingsCache::instance().getBuddyConnectNotificationsEnabled());
|
SettingsCache::instance().interface().getBuddyConnectNotificationsEnabled());
|
||||||
buddyConnectNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled());
|
buddyConnectNotificationsEnabledCheckBox.setEnabled(
|
||||||
connect(&buddyConnectNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
SettingsCache::instance().interface().getNotificationsEnabled());
|
||||||
&SettingsCache::setBuddyConnectNotificationsEnabled);
|
connect(&buddyConnectNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
|
&SettingsCache::instance().interface(), &InterfaceSettings::setBuddyConnectNotificationsEnabled);
|
||||||
|
|
||||||
doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().getDoubleClickToPlay());
|
doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().interface().getDoubleClickToPlay());
|
||||||
connect(&doubleClickToPlayCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&doubleClickToPlayCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setDoubleClickToPlay);
|
&InterfaceSettings::setDoubleClickToPlay);
|
||||||
|
|
||||||
clickPlaysAllSelectedCheckBox.setChecked(SettingsCache::instance().getClickPlaysAllSelected());
|
clickPlaysAllSelectedCheckBox.setChecked(SettingsCache::instance().interface().getClickPlaysAllSelected());
|
||||||
connect(&clickPlaysAllSelectedCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&clickPlaysAllSelectedCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setClickPlaysAllSelected);
|
&InterfaceSettings::setClickPlaysAllSelected);
|
||||||
|
|
||||||
playToStackCheckBox.setChecked(SettingsCache::instance().getPlayToStack());
|
playToStackCheckBox.setChecked(SettingsCache::instance().interface().getPlayToStack());
|
||||||
connect(&playToStackCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&playToStackCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setPlayToStack);
|
&InterfaceSettings::setPlayToStack);
|
||||||
|
|
||||||
doNotDeleteArrowsInSubPhasesCheckBox.setChecked(SettingsCache::instance().getDoNotDeleteArrowsInSubPhases());
|
doNotDeleteArrowsInSubPhasesCheckBox.setChecked(
|
||||||
connect(&doNotDeleteArrowsInSubPhasesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
SettingsCache::instance().interface().getDoNotDeleteArrowsInSubPhases());
|
||||||
&SettingsCache::setDoNotDeleteArrowsInSubPhases);
|
connect(&doNotDeleteArrowsInSubPhasesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
|
&InterfaceSettings::setDoNotDeleteArrowsInSubPhases);
|
||||||
|
|
||||||
closeEmptyCardViewCheckBox.setChecked(SettingsCache::instance().getCloseEmptyCardView());
|
closeEmptyCardViewCheckBox.setChecked(SettingsCache::instance().interface().getCloseEmptyCardView());
|
||||||
connect(&closeEmptyCardViewCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&closeEmptyCardViewCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setCloseEmptyCardView);
|
&InterfaceSettings::setCloseEmptyCardView);
|
||||||
|
|
||||||
focusCardViewSearchBarCheckBox.setChecked(SettingsCache::instance().getFocusCardViewSearchBar());
|
focusCardViewSearchBarCheckBox.setChecked(SettingsCache::instance().interface().getFocusCardViewSearchBar());
|
||||||
connect(&focusCardViewSearchBarCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&focusCardViewSearchBarCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setFocusCardViewSearchBar);
|
&InterfaceSettings::setFocusCardViewSearchBar);
|
||||||
|
|
||||||
annotateTokensCheckBox.setChecked(SettingsCache::instance().getAnnotateTokens());
|
annotateTokensCheckBox.setChecked(SettingsCache::instance().interface().getAnnotateTokens());
|
||||||
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setAnnotateTokens);
|
&InterfaceSettings::setAnnotateTokens);
|
||||||
|
|
||||||
showDragSelectionCountCheckBox.setChecked(SettingsCache::instance().getShowDragSelectionCount());
|
showDragSelectionCountCheckBox.setChecked(SettingsCache::instance().interface().getShowDragSelectionCount());
|
||||||
connect(&showDragSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&showDragSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setShowDragSelectionCount);
|
&InterfaceSettings::setShowDragSelectionCount);
|
||||||
|
|
||||||
showTotalSelectionCountCheckBox.setChecked(SettingsCache::instance().getShowTotalSelectionCount());
|
showTotalSelectionCountCheckBox.setChecked(SettingsCache::instance().interface().getShowTotalSelectionCount());
|
||||||
connect(&showTotalSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&showTotalSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setShowTotalSelectionCount);
|
&InterfaceSettings::setShowTotalSelectionCount);
|
||||||
|
|
||||||
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().getUseTearOffMenus());
|
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||||
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
[](const QT_STATE_CHANGED_T state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); });
|
[](const QT_STATE_CHANGED_T state) {
|
||||||
|
SettingsCache::instance().interface().setUseTearOffMenus(state == Qt::Checked);
|
||||||
|
});
|
||||||
|
|
||||||
keepGameChatFocusCheckBox.setChecked(SettingsCache::instance().getKeepGameChatFocus());
|
keepGameChatFocusCheckBox.setChecked(SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||||
connect(&keepGameChatFocusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&keepGameChatFocusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setKeepGameChatFocus);
|
&InterfaceSettings::setKeepGameChatFocus);
|
||||||
|
|
||||||
auto *generalGrid = new QGridLayout;
|
auto *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0);
|
||||||
|
|
@ -101,9 +107,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
notificationsGroupBox->setLayout(notificationsGrid);
|
notificationsGroupBox->setLayout(notificationsGrid);
|
||||||
|
|
||||||
// animation settings
|
// animation settings
|
||||||
tapAnimationCheckBox.setChecked(SettingsCache::instance().getTapAnimation());
|
tapAnimationCheckBox.setChecked(SettingsCache::instance().cardsDisplay().getTapAnimation());
|
||||||
connect(&tapAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&tapAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||||
&SettingsCache::setTapAnimation);
|
&CardsDisplaySettings::setTapAnimation);
|
||||||
|
|
||||||
auto *animationGrid = new QGridLayout;
|
auto *animationGrid = new QGridLayout;
|
||||||
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
||||||
|
|
@ -112,42 +118,45 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
animationGroupBox->setLayout(animationGrid);
|
animationGroupBox->setLayout(animationGrid);
|
||||||
|
|
||||||
// deck editor settings
|
// deck editor settings
|
||||||
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().getOpenDeckInNewTab());
|
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().interface().getOpenDeckInNewTab());
|
||||||
connect(&openDeckInNewTabCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&openDeckInNewTabCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setOpenDeckInNewTab);
|
&InterfaceSettings::setOpenDeckInNewTab);
|
||||||
|
|
||||||
visualDeckStorageInGameCheckBox.setChecked(SettingsCache::instance().getVisualDeckStorageInGame());
|
visualDeckStorageInGameCheckBox.setChecked(
|
||||||
connect(&visualDeckStorageInGameCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageInGame());
|
||||||
&SettingsCache::setVisualDeckStorageInGame);
|
connect(&visualDeckStorageInGameCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
|
&SettingsCache::instance().visualDeckStorage(), &VisualDeckStorageSettings::setVisualDeckStorageInGame);
|
||||||
|
|
||||||
visualDeckStorageSelectionAnimationCheckBox.setChecked(
|
visualDeckStorageSelectionAnimationCheckBox.setChecked(
|
||||||
SettingsCache::instance().getVisualDeckStorageSelectionAnimation());
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageSelectionAnimation());
|
||||||
connect(&visualDeckStorageSelectionAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&visualDeckStorageSelectionAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
&SettingsCache::setVisualDeckStorageSelectionAnimation);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageSelectionAnimation);
|
||||||
|
|
||||||
visualDeckStoragePromptForConversionSelector.addItem(""); // these will be set in retranslateUI
|
visualDeckStoragePromptForConversionSelector.addItem(""); // these will be set in retranslateUI
|
||||||
visualDeckStoragePromptForConversionSelector.addItem("");
|
visualDeckStoragePromptForConversionSelector.addItem("");
|
||||||
visualDeckStoragePromptForConversionSelector.addItem("");
|
visualDeckStoragePromptForConversionSelector.addItem("");
|
||||||
if (SettingsCache::instance().getVisualDeckStoragePromptForConversion()) {
|
if (SettingsCache::instance().visualDeckStorage().getVisualDeckStoragePromptForConversion()) {
|
||||||
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexPrompt);
|
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexPrompt);
|
||||||
} else if (SettingsCache::instance().getVisualDeckStorageAlwaysConvert()) {
|
} else if (SettingsCache::instance().visualDeckStorage().getVisualDeckStorageAlwaysConvert()) {
|
||||||
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexAlways);
|
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexAlways);
|
||||||
} else {
|
} else {
|
||||||
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexNone);
|
visualDeckStoragePromptForConversionSelector.setCurrentIndex(visualDeckStoragePromptForConversionIndexNone);
|
||||||
}
|
}
|
||||||
connect(&visualDeckStoragePromptForConversionSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(&visualDeckStoragePromptForConversionSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
[](int index) {
|
[](int index) {
|
||||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStoragePromptForConversion(
|
||||||
index == visualDeckStoragePromptForConversionIndexPrompt);
|
index == visualDeckStoragePromptForConversionIndexPrompt);
|
||||||
SettingsCache::instance().setVisualDeckStorageAlwaysConvert(
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStorageAlwaysConvert(
|
||||||
index == visualDeckStoragePromptForConversionIndexAlways);
|
index == visualDeckStoragePromptForConversionIndexAlways);
|
||||||
});
|
});
|
||||||
|
|
||||||
defaultDeckEditorTypeSelector.addItem(""); // these will be set in retranslateUI
|
defaultDeckEditorTypeSelector.addItem(""); // these will be set in retranslateUI
|
||||||
defaultDeckEditorTypeSelector.addItem("");
|
defaultDeckEditorTypeSelector.addItem("");
|
||||||
defaultDeckEditorTypeSelector.setCurrentIndex(SettingsCache::instance().getDefaultDeckEditorType());
|
defaultDeckEditorTypeSelector.setCurrentIndex(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getDefaultDeckEditorType());
|
||||||
connect(&defaultDeckEditorTypeSelector, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(&defaultDeckEditorTypeSelector, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
&SettingsCache::instance(), &SettingsCache::setDefaultDeckEditorType);
|
&SettingsCache::instance().visualDeckStorage(), &VisualDeckStorageSettings::setDefaultDeckEditorType);
|
||||||
|
|
||||||
auto *deckEditorGrid = new QGridLayout;
|
auto *deckEditorGrid = new QGridLayout;
|
||||||
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
|
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
|
||||||
|
|
@ -163,9 +172,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
|
|
||||||
// replay settings
|
// replay settings
|
||||||
rewindBufferingMsBox.setRange(0, 9999);
|
rewindBufferingMsBox.setRange(0, 9999);
|
||||||
rewindBufferingMsBox.setValue(SettingsCache::instance().getRewindBufferingMs());
|
rewindBufferingMsBox.setValue(SettingsCache::instance().interface().getRewindBufferingMs());
|
||||||
connect(&rewindBufferingMsBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(&rewindBufferingMsBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().interface(),
|
||||||
&SettingsCache::setRewindBufferingMs);
|
&InterfaceSettings::setRewindBufferingMs);
|
||||||
|
|
||||||
auto *replayGrid = new QGridLayout;
|
auto *replayGrid = new QGridLayout;
|
||||||
replayGrid->addWidget(&rewindBufferingMsLabel, 0, 0, 1, 1);
|
replayGrid->addWidget(&rewindBufferingMsLabel, 0, 0, 1, 1);
|
||||||
|
|
@ -185,7 +194,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this, &UserInterfaceSettingsPage::retranslateUi);
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
|
&UserInterfaceSettingsPage::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ void AbstractTabDeckEditor::cleanDeckAndResetModified()
|
||||||
*/
|
*/
|
||||||
AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const bool openInSameTabIfBlank)
|
AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const bool openInSameTabIfBlank)
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getOpenDeckInNewTab()) {
|
if (SettingsCache::instance().interface().getOpenDeckInNewTab()) {
|
||||||
if (openInSameTabIfBlank && deckStateManager->isBlankNewDeck()) {
|
if (openInSameTabIfBlank && deckStateManager->isBlankNewDeck()) {
|
||||||
return SAME_TAB;
|
return SAME_TAB;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -350,7 +350,7 @@ bool AbstractTabDeckEditor::actSaveDeckAs()
|
||||||
DeckList deckList = deckStateManager->getDeckList();
|
DeckList deckList = deckStateManager->getDeckList();
|
||||||
|
|
||||||
QFileDialog dialog(this, tr("Save deck"));
|
QFileDialog dialog(this, tr("Save deck"));
|
||||||
dialog.setDirectory(SettingsCache::instance().getDeckPath());
|
dialog.setDirectory(SettingsCache::instance().paths().getDeckPath());
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
dialog.setDefaultSuffix("cod");
|
dialog.setDefaultSuffix("cod");
|
||||||
dialog.setNameFilters(DeckLoader::FILE_NAME_FILTERS);
|
dialog.setNameFilters(DeckLoader::FILE_NAME_FILTERS);
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,8 @@ void TabArchidekt::initializeUi()
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
settingsButton = new SettingsButtonWidget(primaryToolbar);
|
settingsButton = new SettingsButtonWidget(primaryToolbar);
|
||||||
cardSizeSlider = new CardSizeWidget(primaryToolbar, nullptr, SettingsCache::instance().getArchidektPreviewSize());
|
cardSizeSlider = new CardSizeWidget(primaryToolbar, nullptr,
|
||||||
|
SettingsCache::instance().visualDeckStorage().getArchidektPreviewSize());
|
||||||
settingsButton->addSettingsWidget(cardSizeSlider);
|
settingsButton->addSettingsWidget(cardSizeSlider);
|
||||||
|
|
||||||
// Assemble primary toolbar
|
// Assemble primary toolbar
|
||||||
|
|
@ -337,8 +338,8 @@ void TabArchidekt::connectSignals()
|
||||||
doSearch();
|
doSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setArchidektPreviewCardSize);
|
&VisualDeckStorageSettings::setArchidektPreviewCardSize);
|
||||||
|
|
||||||
// Search button triggers immediate search
|
// Search button triggers immediate search
|
||||||
connect(searchButton, &QPushButton::clicked, this, &TabArchidekt::doSearchImmediate);
|
connect(searchButton, &QPushButton::clicked, this, &TabArchidekt::doSearchImmediate);
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,10 @@ TabEdhRecMain::TabEdhRecMain(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor
|
||||||
|
|
||||||
settingsButton = new SettingsButtonWidget(this);
|
settingsButton = new SettingsButtonWidget(this);
|
||||||
|
|
||||||
cardSizeSlider = new CardSizeWidget(this, nullptr, SettingsCache::instance().getEDHRecCardSize());
|
cardSizeSlider =
|
||||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getEDHRecCardSize());
|
||||||
&SettingsCache::setEDHRecCardSize);
|
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setEDHRecCardSize);
|
||||||
|
|
||||||
settingsButton->addSettingsWidget(cardSizeSlider);
|
settingsButton->addSettingsWidget(cardSizeSlider);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ void TabDeckEditor::createMenus()
|
||||||
registerDockWidget(viewMenu, filterDockWidget, {250, 250});
|
registerDockWidget(viewMenu, filterDockWidget, {250, 250});
|
||||||
registerDockWidget(viewMenu, printingSelectorDockWidget, {525, 250});
|
registerDockWidget(viewMenu, printingSelectorDockWidget, {525, 250});
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
connect(&SettingsCache::instance().cardsDisplay(),
|
||||||
|
&CardsDisplaySettings::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||||
[this](bool enabled) { dockToActions[printingSelectorDockWidget].menu->setEnabled(!enabled); });
|
[this](bool enabled) { dockToActions[printingSelectorDockWidget].menu->setEnabled(!enabled); });
|
||||||
|
|
||||||
viewMenu->addSeparator();
|
viewMenu->addSeparator();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
|
||||||
: Tab(_tabSupervisor), client(_client)
|
: Tab(_tabSupervisor), client(_client)
|
||||||
{
|
{
|
||||||
localDirModel = new QFileSystemModel(this);
|
localDirModel = new QFileSystemModel(this);
|
||||||
localDirModel->setRootPath(SettingsCache::instance().getDeckPath());
|
localDirModel->setRootPath(SettingsCache::instance().paths().getDeckPath());
|
||||||
localDirModel->sort(0, Qt::AscendingOrder);
|
localDirModel->sort(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
localDirView = new QTreeView;
|
localDirView = new QTreeView;
|
||||||
|
|
|
||||||
|
|
@ -252,8 +252,8 @@ void TabGame::resetChatAndPhase()
|
||||||
|
|
||||||
void TabGame::emitUserEvent()
|
void TabGame::emitUserEvent()
|
||||||
{
|
{
|
||||||
bool globalEvent =
|
bool globalEvent = !game->getPlayerManager()->isSpectator() ||
|
||||||
!game->getPlayerManager()->isSpectator() || SettingsCache::instance().getSpectatorNotificationsEnabled();
|
SettingsCache::instance().interface().getSpectatorNotificationsEnabled();
|
||||||
emit userEvent(globalEvent);
|
emit userEvent(globalEvent);
|
||||||
updatePlayerListDockTitle();
|
updatePlayerListDockTitle();
|
||||||
}
|
}
|
||||||
|
|
@ -626,8 +626,8 @@ void TabGame::actRotateViewCCW()
|
||||||
|
|
||||||
void TabGame::actCompleterChanged()
|
void TabGame::actCompleterChanged()
|
||||||
{
|
{
|
||||||
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
SettingsCache::instance().chat().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||||
: completer->setCompletionRole(1);
|
: completer->setCompletionRole(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::notifyPlayerJoin(QString playerName)
|
void TabGame::notifyPlayerJoin(QString playerName)
|
||||||
|
|
@ -1265,7 +1265,7 @@ void TabGame::createMessageDock(bool bReplay)
|
||||||
if (!bReplay) {
|
if (!bReplay) {
|
||||||
connect(messageLog, &MessageLogWidget::openMessageDialog, this, &TabGame::openMessageDialog);
|
connect(messageLog, &MessageLogWidget::openMessageDialog, this, &TabGame::openMessageDialog);
|
||||||
connect(messageLog, &MessageLogWidget::addMentionTag, this, &TabGame::addMentionTag);
|
connect(messageLog, &MessageLogWidget::addMentionTag, this, &TabGame::addMentionTag);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
|
connect(&SettingsCache::instance().chat(), &ChatSettings::chatMentionCompleterChanged, this,
|
||||||
&TabGame::actCompleterChanged);
|
&TabGame::actCompleterChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)) {
|
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)) {
|
||||||
soundEngine->playSound("private_message");
|
soundEngine->playSound("private_message");
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getShowMessagePopup() && shouldShowSystemPopup(event)) {
|
if (SettingsCache::instance().chat().getShowMessagePopup() && shouldShowSystemPopup(event)) {
|
||||||
showSystemPopup(event);
|
showSystemPopup(event);
|
||||||
}
|
}
|
||||||
if (QString::fromStdString(event.sender_name()).toLower().simplified() == "servatrice") {
|
if (QString::fromStdString(event.sender_name()).toLower().simplified() == "servatrice") {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
||||||
QGroupBox *TabReplays::createLeftLayout()
|
QGroupBox *TabReplays::createLeftLayout()
|
||||||
{
|
{
|
||||||
localDirModel = new QFileSystemModel(this);
|
localDirModel = new QFileSystemModel(this);
|
||||||
localDirModel->setRootPath(SettingsCache::instance().getReplaysPath());
|
localDirModel->setRootPath(SettingsCache::instance().paths().getReplaysPath());
|
||||||
localDirModel->sort(0, Qt::AscendingOrder);
|
localDirModel->sort(0, Qt::AscendingOrder);
|
||||||
|
|
||||||
localDirView = new QTreeView;
|
localDirView = new QTreeView;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
||||||
connect(chatView, &ChatView::showCardInfoPopup, this, &TabRoom::showCardInfoPopup);
|
connect(chatView, &ChatView::showCardInfoPopup, this, &TabRoom::showCardInfoPopup);
|
||||||
connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabRoom::deleteCardInfoPopup);
|
connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabRoom::deleteCardInfoPopup);
|
||||||
connect(chatView, &ChatView::addMentionTag, this, &TabRoom::addMentionTag);
|
connect(chatView, &ChatView::addMentionTag, this, &TabRoom::addMentionTag);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::chatMentionCompleterChanged, this,
|
connect(&SettingsCache::instance().chat(), &ChatSettings::chatMentionCompleterChanged, this,
|
||||||
&TabRoom::actCompleterChanged);
|
&TabRoom::actCompleterChanged);
|
||||||
sayLabel = new QLabel;
|
sayLabel = new QLabel;
|
||||||
sayEdit = new LineEditCompleter;
|
sayEdit = new LineEditCompleter;
|
||||||
|
|
@ -246,8 +246,8 @@ void TabRoom::actOpenChatSettings()
|
||||||
|
|
||||||
void TabRoom::actCompleterChanged()
|
void TabRoom::actCompleterChanged()
|
||||||
{
|
{
|
||||||
SettingsCache::instance().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
SettingsCache::instance().chat().getChatMentionCompleter() ? completer->setCompletionRole(2)
|
||||||
: completer->setCompletionRole(1);
|
: completer->setCompletionRole(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabRoom::processRoomEvent(const RoomEvent &event)
|
void TabRoom::processRoomEvent(const RoomEvent &event)
|
||||||
|
|
@ -307,13 +307,13 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
|
||||||
ServerInfo_User userInfo = {};
|
ServerInfo_User userInfo = {};
|
||||||
if (twi) {
|
if (twi) {
|
||||||
userInfo = twi->getUserInfo();
|
userInfo = twi->getUserInfo();
|
||||||
if (SettingsCache::instance().getIgnoreUnregisteredUsers() &&
|
if (SettingsCache::instance().chat().getIgnoreUnregisteredUsers() &&
|
||||||
!UserLevelFlags(userInfo.user_level()).testFlag(ServerInfo_User::IsRegistered)) {
|
!UserLevelFlags(userInfo.user_level()).testFlag(ServerInfo_User::IsRegistered)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.message_type() == Event_RoomSay::ChatHistory && !SettingsCache::instance().getRoomHistory()) {
|
if (event.message_type() == Event_RoomSay::ChatHistory && !SettingsCache::instance().chat().getRoomHistory()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,13 +341,13 @@ void TabSupervisor::initStartupTabs()
|
||||||
openTabHome();
|
openTabHome();
|
||||||
setCurrentWidget(tabHome);
|
setCurrentWidget(tabHome);
|
||||||
|
|
||||||
if (SettingsCache::instance().getTabVisualDeckStorageOpen()) {
|
if (SettingsCache::instance().tabs().getTabVisualDeckStorageOpen()) {
|
||||||
openTabVisualDeckStorage();
|
openTabVisualDeckStorage();
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getTabDeckStorageOpen()) {
|
if (SettingsCache::instance().tabs().getTabDeckStorageOpen()) {
|
||||||
openTabDeckStorage();
|
openTabDeckStorage();
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getTabReplaysOpen()) {
|
if (SettingsCache::instance().tabs().getTabReplaysOpen()) {
|
||||||
openTabReplays();
|
openTabReplays();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -427,10 +427,10 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
||||||
tabsMenu->addAction(aTabServer);
|
tabsMenu->addAction(aTabServer);
|
||||||
tabsMenu->addAction(aTabAccount);
|
tabsMenu->addAction(aTabAccount);
|
||||||
|
|
||||||
if (SettingsCache::instance().getTabServerOpen()) {
|
if (SettingsCache::instance().tabs().getTabServerOpen()) {
|
||||||
openTabServer();
|
openTabServer();
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getTabAccountOpen()) {
|
if (SettingsCache::instance().tabs().getTabAccountOpen()) {
|
||||||
openTabAccount();
|
openTabAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -442,10 +442,10 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
||||||
tabsMenu->addAction(aTabLog);
|
tabsMenu->addAction(aTabLog);
|
||||||
tabsMenu->addAction(aTabCardArtRules);
|
tabsMenu->addAction(aTabCardArtRules);
|
||||||
|
|
||||||
if (SettingsCache::instance().getTabAdminOpen()) {
|
if (SettingsCache::instance().tabs().getTabAdminOpen()) {
|
||||||
openTabAdmin();
|
openTabAdmin();
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getTabLogOpen()) {
|
if (SettingsCache::instance().tabs().getTabLogOpen()) {
|
||||||
openTabLog();
|
openTabLog();
|
||||||
}
|
}
|
||||||
openTabCardArtRules();
|
openTabCardArtRules();
|
||||||
|
|
@ -547,7 +547,7 @@ void TabSupervisor::openTabHome()
|
||||||
|
|
||||||
void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabVisualDeckStorageOpen(checked);
|
SettingsCache::instance().tabs().setTabVisualDeckStorageOpen(checked);
|
||||||
if (checked && !tabVisualDeckStorage) {
|
if (checked && !tabVisualDeckStorage) {
|
||||||
openTabVisualDeckStorage();
|
openTabVisualDeckStorage();
|
||||||
setCurrentWidget(tabVisualDeckStorage);
|
setCurrentWidget(tabVisualDeckStorage);
|
||||||
|
|
@ -571,7 +571,7 @@ void TabSupervisor::openTabVisualDeckStorage()
|
||||||
|
|
||||||
void TabSupervisor::actTabServer(bool checked)
|
void TabSupervisor::actTabServer(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabServerOpen(checked);
|
SettingsCache::instance().tabs().setTabServerOpen(checked);
|
||||||
if (checked && !tabServer) {
|
if (checked && !tabServer) {
|
||||||
openTabServer();
|
openTabServer();
|
||||||
setCurrentWidget(tabServer);
|
setCurrentWidget(tabServer);
|
||||||
|
|
@ -594,7 +594,7 @@ void TabSupervisor::openTabServer()
|
||||||
|
|
||||||
void TabSupervisor::actTabAccount(bool checked)
|
void TabSupervisor::actTabAccount(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabAccountOpen(checked);
|
SettingsCache::instance().tabs().setTabAccountOpen(checked);
|
||||||
if (checked && !tabAccount) {
|
if (checked && !tabAccount) {
|
||||||
openTabAccount();
|
openTabAccount();
|
||||||
setCurrentWidget(tabAccount);
|
setCurrentWidget(tabAccount);
|
||||||
|
|
@ -619,7 +619,7 @@ void TabSupervisor::openTabAccount()
|
||||||
|
|
||||||
void TabSupervisor::actTabDeckStorage(bool checked)
|
void TabSupervisor::actTabDeckStorage(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabDeckStorageOpen(checked);
|
SettingsCache::instance().tabs().setTabDeckStorageOpen(checked);
|
||||||
if (checked && !tabDeckStorage) {
|
if (checked && !tabDeckStorage) {
|
||||||
openTabDeckStorage();
|
openTabDeckStorage();
|
||||||
setCurrentWidget(tabDeckStorage);
|
setCurrentWidget(tabDeckStorage);
|
||||||
|
|
@ -642,7 +642,7 @@ void TabSupervisor::openTabDeckStorage()
|
||||||
|
|
||||||
void TabSupervisor::actTabReplays(bool checked)
|
void TabSupervisor::actTabReplays(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabReplaysOpen(checked);
|
SettingsCache::instance().tabs().setTabReplaysOpen(checked);
|
||||||
if (checked && !tabReplays) {
|
if (checked && !tabReplays) {
|
||||||
openTabReplays();
|
openTabReplays();
|
||||||
setCurrentWidget(tabReplays);
|
setCurrentWidget(tabReplays);
|
||||||
|
|
@ -667,7 +667,7 @@ void TabSupervisor::openTabReplays()
|
||||||
|
|
||||||
void TabSupervisor::actTabAdmin(bool checked)
|
void TabSupervisor::actTabAdmin(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabAdminOpen(checked);
|
SettingsCache::instance().tabs().setTabAdminOpen(checked);
|
||||||
if (checked && !tabAdmin) {
|
if (checked && !tabAdmin) {
|
||||||
openTabAdmin();
|
openTabAdmin();
|
||||||
setCurrentWidget(tabAdmin);
|
setCurrentWidget(tabAdmin);
|
||||||
|
|
@ -714,7 +714,7 @@ void TabSupervisor::openTabCardArtRules()
|
||||||
|
|
||||||
void TabSupervisor::actTabLog(bool checked)
|
void TabSupervisor::actTabLog(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabLogOpen(checked);
|
SettingsCache::instance().tabs().setTabLogOpen(checked);
|
||||||
if (checked && !tabLog) {
|
if (checked && !tabLog) {
|
||||||
openTabLog();
|
openTabLog();
|
||||||
setCurrentWidget(tabLog);
|
setCurrentWidget(tabLog);
|
||||||
|
|
@ -905,7 +905,7 @@ void TabSupervisor::talkLeft(TabMessage *tab)
|
||||||
*/
|
*/
|
||||||
void TabSupervisor::openDeckInNewTab(const LoadedDeck &deckToOpen)
|
void TabSupervisor::openDeckInNewTab(const LoadedDeck &deckToOpen)
|
||||||
{
|
{
|
||||||
int type = SettingsCache::instance().getDefaultDeckEditorType();
|
int type = SettingsCache::instance().visualDeckStorage().getDefaultDeckEditorType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ClassicDeckEditor:
|
case ClassicDeckEditor:
|
||||||
addDeckEditorTab(deckToOpen);
|
addDeckEditorTab(deckToOpen);
|
||||||
|
|
@ -1004,7 +1004,7 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
|
||||||
tab->setContentsChanged(true);
|
tab->setContentsChanged(true);
|
||||||
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
||||||
}
|
}
|
||||||
if (globalEvent && SettingsCache::instance().getNotificationsEnabled()) {
|
if (globalEvent && SettingsCache::instance().interface().getNotificationsEnabled()) {
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1046,11 +1046,11 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
const ServerInfo_User *onlineUserInfo = userListManager->getOnlineUser(senderName);
|
const ServerInfo_User *onlineUserInfo = userListManager->getOnlineUser(senderName);
|
||||||
if (onlineUserInfo) {
|
if (onlineUserInfo) {
|
||||||
auto userLevel = UserLevelFlags(onlineUserInfo->user_level());
|
auto userLevel = UserLevelFlags(onlineUserInfo->user_level());
|
||||||
if (SettingsCache::instance().getIgnoreUnregisteredUserMessages() &&
|
if (SettingsCache::instance().chat().getIgnoreUnregisteredUserMessages() &&
|
||||||
!userLevel.testFlag(ServerInfo_User::IsRegistered)) {
|
!userLevel.testFlag(ServerInfo_User::IsRegistered)) {
|
||||||
// Flags are additive, so reg/mod/admin are all IsRegistered
|
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||||
return;
|
return;
|
||||||
} else if (SettingsCache::instance().getIgnoreNonBuddyUserMessages() &&
|
} else if (SettingsCache::instance().chat().getIgnoreNonBuddyUserMessages() &&
|
||||||
!userListManager->isUserBuddy(senderName) && !userLevel.testFlag(ServerInfo_User::IsModerator) &&
|
!userListManager->isUserBuddy(senderName) && !userLevel.testFlag(ServerInfo_User::IsModerator) &&
|
||||||
!userLevel.testFlag(ServerInfo_User::IsAdmin)) {
|
!userLevel.testFlag(ServerInfo_User::IsAdmin)) {
|
||||||
// Ignore private messages from non-buddies
|
// Ignore private messages from non-buddies
|
||||||
|
|
@ -1099,7 +1099,7 @@ void TabSupervisor::processUserJoined(const ServerInfo_User &userInfoJoined)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SettingsCache::instance().getBuddyConnectNotificationsEnabled()) {
|
if (SettingsCache::instance().interface().getBuddyConnectNotificationsEnabled()) {
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::saveFilter()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename + ".json";
|
QString filePath = SettingsCache::instance().paths().getFiltersPath() + QDir::separator() + filename + ".json";
|
||||||
|
|
||||||
// Serialize the filter model to JSON
|
// Serialize the filter model to JSON
|
||||||
QJsonArray filtersArray;
|
QJsonArray filtersArray;
|
||||||
|
|
@ -86,7 +86,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::saveFilter()
|
||||||
|
|
||||||
void VisualDatabaseDisplayFilterSaveLoadWidget::loadFilter(const QString &filename)
|
void VisualDatabaseDisplayFilterSaveLoadWidget::loadFilter(const QString &filename)
|
||||||
{
|
{
|
||||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filename;
|
QString filePath = SettingsCache::instance().paths().getFiltersPath() + QDir::separator() + filename;
|
||||||
|
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
|
@ -156,7 +156,7 @@ void VisualDatabaseDisplayFilterSaveLoadWidget::refreshFilterList()
|
||||||
fileListWidget->clearLayout();
|
fileListWidget->clearLayout();
|
||||||
fileButtons.clear();
|
fileButtons.clear();
|
||||||
|
|
||||||
QDir dir(SettingsCache::instance().getFiltersPath());
|
QDir dir(SettingsCache::instance().paths().getFiltersPath());
|
||||||
allFilterFiles = dir.entryList({"*.json"}, QDir::Files, QDir::Name);
|
allFilterFiles = dir.entryList({"*.json"}, QDir::Files, QDir::Name);
|
||||||
|
|
||||||
applySearchFilter(searchInput->text());
|
applySearchFilter(searchInput->text());
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,19 @@ VisualDatabaseDisplayRecentSetFilterSettingsWidget::VisualDatabaseDisplayRecentS
|
||||||
|
|
||||||
filterToMostRecentSetsCheckBox = new QCheckBox(this);
|
filterToMostRecentSetsCheckBox = new QCheckBox(this);
|
||||||
filterToMostRecentSetsCheckBox->setChecked(
|
filterToMostRecentSetsCheckBox->setChecked(
|
||||||
SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled());
|
SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled());
|
||||||
connect(filterToMostRecentSetsCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(filterToMostRecentSetsCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
&SettingsCache::setVisualDatabaseDisplayFilterToMostRecentSetsEnabled);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDatabaseDisplayFilterToMostRecentSetsEnabled);
|
||||||
|
|
||||||
filterToMostRecentSetsAmount = new QSpinBox(this);
|
filterToMostRecentSetsAmount = new QSpinBox(this);
|
||||||
filterToMostRecentSetsAmount->setMinimum(1);
|
filterToMostRecentSetsAmount->setMinimum(1);
|
||||||
filterToMostRecentSetsAmount->setMaximum(100);
|
filterToMostRecentSetsAmount->setMaximum(100);
|
||||||
filterToMostRecentSetsAmount->setValue(
|
filterToMostRecentSetsAmount->setValue(
|
||||||
SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsAmount());
|
SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayFilterToMostRecentSetsAmount());
|
||||||
connect(filterToMostRecentSetsAmount, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(filterToMostRecentSetsAmount, qOverload<int>(&QSpinBox::valueChanged),
|
||||||
&SettingsCache::setVisualDatabaseDisplayFilterToMostRecentSetsAmount);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDatabaseDisplayFilterToMostRecentSetsAmount);
|
||||||
|
|
||||||
layout->addWidget(filterToMostRecentSetsCheckBox);
|
layout->addWidget(filterToMostRecentSetsCheckBox);
|
||||||
layout->addWidget(filterToMostRecentSetsAmount);
|
layout->addWidget(filterToMostRecentSetsAmount);
|
||||||
|
|
@ -66,9 +68,11 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
||||||
recentSetsSettingsWidget = new VisualDatabaseDisplayRecentSetFilterSettingsWidget(this);
|
recentSetsSettingsWidget = new VisualDatabaseDisplayRecentSetFilterSettingsWidget(this);
|
||||||
layout->addWidget(recentSetsSettingsWidget);
|
layout->addWidget(recentSetsSettingsWidget);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged, this,
|
||||||
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged, this,
|
||||||
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
|
||||||
|
|
||||||
// Create the toggle button for Exact Match/Includes mode
|
// Create the toggle button for Exact Match/Includes mode
|
||||||
|
|
@ -118,7 +122,7 @@ void VisualDatabaseDisplaySetFilterWidget::createSetButtons()
|
||||||
|
|
||||||
void VisualDatabaseDisplaySetFilterWidget::filterToRecentSets()
|
void VisualDatabaseDisplaySetFilterWidget::filterToRecentSets()
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled()) {
|
if (SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayFilterToMostRecentSetsEnabled()) {
|
||||||
for (auto set : activeSets.keys()) {
|
for (auto set : activeSets.keys()) {
|
||||||
activeSets[set] = false;
|
activeSets[set] = false;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +133,8 @@ void VisualDatabaseDisplaySetFilterWidget::filterToRecentSets()
|
||||||
std::sort(allSets.begin(), allSets.end(),
|
std::sort(allSets.begin(), allSets.end(),
|
||||||
[](const auto &a, const auto &b) { return a->getReleaseDate() > b->getReleaseDate(); });
|
[](const auto &a, const auto &b) { return a->getReleaseDate() > b->getReleaseDate(); });
|
||||||
|
|
||||||
int setsToPreactivate = SettingsCache::instance().getVisualDatabaseDisplayFilterToMostRecentSetsAmount();
|
int setsToPreactivate =
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayFilterToMostRecentSetsAmount();
|
||||||
int setsActivated = 0;
|
int setsActivated = 0;
|
||||||
|
|
||||||
for (const auto &set : allSets) {
|
for (const auto &set : allSets) {
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,10 @@ VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarPolicy::ScrollBarAsNeeded);
|
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarPolicy::ScrollBarAsNeeded);
|
||||||
cardSizeWidget = new CardSizeWidget(this, flowWidget, SettingsCache::instance().getVisualDatabaseDisplayCardSize());
|
cardSizeWidget = new CardSizeWidget(
|
||||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
this, flowWidget, SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayCardSize());
|
||||||
&SettingsCache::setVisualDatabaseDisplayCardSize);
|
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDatabaseDisplayCardSize);
|
||||||
|
|
||||||
searchContainer = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
searchContainer = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ void FilterDisplayWidget::deleteFilter()
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
if (reply == QMessageBox::Yes) {
|
if (reply == QMessageBox::Yes) {
|
||||||
// If confirmed, delete the filter
|
// If confirmed, delete the filter
|
||||||
QString filePath = SettingsCache::instance().getFiltersPath() + QDir::separator() + filterFilename;
|
QString filePath = SettingsCache::instance().paths().getFiltersPath() + QDir::separator() + filterFilename;
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
if (file.remove()) {
|
if (file.remove()) {
|
||||||
emit filterDeleted(filterFilename); // Emit signal for deletion
|
emit filterDeleted(filterFilename); // Emit signal for deletion
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
||||||
resetAndHandSizeLayout->addWidget(resetButton);
|
resetAndHandSizeLayout->addWidget(resetButton);
|
||||||
|
|
||||||
handSizeSpinBox = new QSpinBox(this);
|
handSizeSpinBox = new QSpinBox(this);
|
||||||
handSizeSpinBox->setValue(SettingsCache::instance().getVisualDeckEditorSampleHandSize());
|
handSizeSpinBox->setValue(SettingsCache::instance().visualDeckStorage().getVisualDeckEditorSampleHandSize());
|
||||||
handSizeSpinBox->setMinimum(1);
|
handSizeSpinBox->setMinimum(1);
|
||||||
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setVisualDeckEditorSampleHandSize);
|
&VisualDeckStorageSettings::setVisualDeckEditorSampleHandSize);
|
||||||
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&VisualDeckEditorSampleHandWidget::updateDisplay);
|
&VisualDeckEditorSampleHandWidget::updateDisplay);
|
||||||
resetAndHandSizeLayout->addWidget(handSizeSpinBox);
|
resetAndHandSizeLayout->addWidget(handSizeSpinBox);
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,10 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
|
||||||
|
|
||||||
initializeScrollAreaAndZoneContainer();
|
initializeScrollAreaAndZoneContainer();
|
||||||
|
|
||||||
cardSizeWidget = new CardSizeWidget(this, nullptr, SettingsCache::instance().getVisualDeckEditorCardSize());
|
cardSizeWidget =
|
||||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getVisualDeckEditorCardSize());
|
||||||
&SettingsCache::setVisualDeckEditorCardSize);
|
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckEditorCardSize);
|
||||||
|
|
||||||
mainLayout->addWidget(displayOptionsAndSearch);
|
mainLayout->addWidget(displayOptionsAndSearch);
|
||||||
mainLayout->addWidget(scrollArea);
|
mainLayout->addWidget(scrollArea);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static QStringList getAllFiles(const QString &filePath)
|
||||||
*/
|
*/
|
||||||
static QStringList findAllKnownTags()
|
static QStringList findAllKnownTags()
|
||||||
{
|
{
|
||||||
QStringList allFiles = getAllFiles(SettingsCache::instance().getDeckPath());
|
QStringList allFiles = getAllFiles(SettingsCache::instance().paths().getDeckPath());
|
||||||
|
|
||||||
QStringList knownTags;
|
QStringList knownTags;
|
||||||
for (const QString &file : allFiles) {
|
for (const QString &file : allFiles) {
|
||||||
|
|
@ -141,8 +141,8 @@ bool DeckPreviewDeckTagsDisplayWidget::promptFileConversionIfRequired(DeckPrevie
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve saved preference if the prompt is disabled
|
// Retrieve saved preference if the prompt is disabled
|
||||||
if (!SettingsCache::instance().getVisualDeckStoragePromptForConversion()) {
|
if (!SettingsCache::instance().visualDeckStorage().getVisualDeckStoragePromptForConversion()) {
|
||||||
if (!SettingsCache::instance().getVisualDeckStorageAlwaysConvert()) {
|
if (!SettingsCache::instance().visualDeckStorage().getVisualDeckStorageAlwaysConvert()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,8 +157,9 @@ bool DeckPreviewDeckTagsDisplayWidget::promptFileConversionIfRequired(DeckPrevie
|
||||||
// Show the dialog to the user
|
// Show the dialog to the user
|
||||||
DialogConvertDeckToCodFormat conversionDialog(parentWidget());
|
DialogConvertDeckToCodFormat conversionDialog(parentWidget());
|
||||||
if (conversionDialog.exec() != QDialog::Accepted) {
|
if (conversionDialog.exec() != QDialog::Accepted) {
|
||||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(!conversionDialog.dontAskAgain());
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStoragePromptForConversion(
|
||||||
SettingsCache::instance().setVisualDeckStorageAlwaysConvert(false);
|
!conversionDialog.dontAskAgain());
|
||||||
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStorageAlwaysConvert(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -171,8 +172,8 @@ bool DeckPreviewDeckTagsDisplayWidget::promptFileConversionIfRequired(DeckPrevie
|
||||||
convertFileToCockatriceFormat(deckPreviewWidget);
|
convertFileToCockatriceFormat(deckPreviewWidget);
|
||||||
|
|
||||||
if (conversionDialog.dontAskAgain()) {
|
if (conversionDialog.dontAskAgain()) {
|
||||||
SettingsCache::instance().setVisualDeckStoragePromptForConversion(false);
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStoragePromptForConversion(false);
|
||||||
SettingsCache::instance().setVisualDeckStorageAlwaysConvert(true);
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStorageAlwaysConvert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ DeckPreviewTagDialog::DeckPreviewTagDialog(const QStringList &knownTags,
|
||||||
{
|
{
|
||||||
resize(400, 500);
|
resize(400, 500);
|
||||||
|
|
||||||
QStringList defaultTags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
QStringList defaultTags = SettingsCache::instance().visualDeckStorage().getVisualDeckStorageDefaultTagsList();
|
||||||
|
|
||||||
// Merge knownTags with defaultTags, ensuring no duplicates
|
// Merge knownTags with defaultTags, ensuring no duplicates
|
||||||
QStringList combinedTags = defaultTags + knownTags + activeTags;
|
QStringList combinedTags = defaultTags + knownTags + activeTags;
|
||||||
|
|
@ -90,7 +90,8 @@ DeckPreviewTagDialog::DeckPreviewTagDialog(const QStringList &knownTags,
|
||||||
connect(okButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::accept);
|
connect(okButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::accept);
|
||||||
connect(cancelButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::reject);
|
connect(cancelButton, &QPushButton::clicked, this, &DeckPreviewTagDialog::reject);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDefaultTagsListChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageDefaultTagsListChanged, this,
|
||||||
&DeckPreviewTagDialog::refreshTagList);
|
&DeckPreviewTagDialog::refreshTagList);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
@ -114,7 +115,7 @@ void DeckPreviewTagDialog::refreshTagList()
|
||||||
tagListView->clear();
|
tagListView->clear();
|
||||||
|
|
||||||
// Get the updated list of tags from SettingsCache
|
// Get the updated list of tags from SettingsCache
|
||||||
QStringList defaultTags = SettingsCache::instance().getVisualDeckStorageDefaultTagsList();
|
QStringList defaultTags = SettingsCache::instance().visualDeckStorage().getVisualDeckStorageDefaultTagsList();
|
||||||
QStringList combinedTags = defaultTags + knownTags_ + activeTags;
|
QStringList combinedTags = defaultTags + knownTags_ + activeTags;
|
||||||
combinedTags.removeDuplicates();
|
combinedTags.removeDuplicates();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,14 @@ DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent,
|
||||||
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageDoubleClicked, this,
|
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageDoubleClicked, this,
|
||||||
&DeckPreviewWidget::imageDoubleClickedEvent);
|
&DeckPreviewWidget::imageDoubleClickedEvent);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowColorIdentityChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageShowColorIdentityChanged, this,
|
||||||
&DeckPreviewWidget::updateColorIdentityVisibility);
|
&DeckPreviewWidget::updateColorIdentityVisibility);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowTagsOnDeckPreviewsChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageShowTagsOnDeckPreviewsChanged, this,
|
||||||
&DeckPreviewWidget::updateTagsVisibility);
|
&DeckPreviewWidget::updateTagsVisibility);
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowBannerCardComboBoxChanged, this,
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageShowBannerCardComboBoxChanged, this,
|
||||||
&DeckPreviewWidget::updateBannerCardComboBoxVisibility);
|
&DeckPreviewWidget::updateBannerCardComboBoxVisibility);
|
||||||
connect(visualDeckStorageWidget->settings(), &VisualDeckStorageQuickSettingsWidget::deckPreviewTooltipChanged, this,
|
connect(visualDeckStorageWidget->settings(), &VisualDeckStorageQuickSettingsWidget::deckPreviewTooltipChanged, this,
|
||||||
&DeckPreviewWidget::refreshBannerCardToolTip);
|
&DeckPreviewWidget::refreshBannerCardToolTip);
|
||||||
|
|
@ -128,9 +131,11 @@ void DeckPreviewWidget::initializeUi(const bool deckLoadSuccess)
|
||||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&DeckPreviewWidget::setBannerCard);
|
&DeckPreviewWidget::setBannerCard);
|
||||||
|
|
||||||
updateColorIdentityVisibility(SettingsCache::instance().getVisualDeckStorageShowColorIdentity());
|
updateColorIdentityVisibility(
|
||||||
updateBannerCardComboBoxVisibility(SettingsCache::instance().getVisualDeckStorageShowBannerCardComboBox());
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowColorIdentity());
|
||||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
updateBannerCardComboBoxVisibility(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowBannerCardComboBox());
|
||||||
|
updateTagsVisibility(SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||||
|
|
||||||
layout->addWidget(colorIdentityWidget);
|
layout->addWidget(colorIdentityWidget);
|
||||||
layout->addWidget(deckTagsDisplayWidget);
|
layout->addWidget(deckTagsDisplayWidget);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
||||||
void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
||||||
{
|
{
|
||||||
QString bannerText = tr("Deck Storage");
|
QString bannerText = tr("Deck Storage");
|
||||||
QString deckPath = SettingsCache::instance().getDeckPath();
|
QString deckPath = SettingsCache::instance().paths().getDeckPath();
|
||||||
if (filePath != deckPath) {
|
if (filePath != deckPath) {
|
||||||
QString relativePath = filePath;
|
QString relativePath = filePath;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,52 +12,59 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||||
{
|
{
|
||||||
// show folders checkbox
|
// show folders checkbox
|
||||||
showFoldersCheckBox = new QCheckBox(this);
|
showFoldersCheckBox = new QCheckBox(this);
|
||||||
showFoldersCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowFolders());
|
showFoldersCheckBox->setChecked(SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowFolders());
|
||||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::showFoldersChanged);
|
&VisualDeckStorageQuickSettingsWidget::showFoldersChanged);
|
||||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setVisualDeckStorageShowFolders);
|
&VisualDeckStorageSettings::setVisualDeckStorageShowFolders);
|
||||||
|
|
||||||
// show tag filter widget checkbox
|
// show tag filter widget checkbox
|
||||||
showTagFilterCheckBox = new QCheckBox(this);
|
showTagFilterCheckBox = new QCheckBox(this);
|
||||||
showTagFilterCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
showTagFilterCheckBox->setChecked(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowTagFilter());
|
||||||
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::showTagFilterChanged);
|
&VisualDeckStorageQuickSettingsWidget::showTagFilterChanged);
|
||||||
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showTagFilterCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setVisualDeckStorageShowTagFilter);
|
&VisualDeckStorageSettings::setVisualDeckStorageShowTagFilter);
|
||||||
|
|
||||||
// show color identity on DeckPreviewWidget checkbox
|
// show color identity on DeckPreviewWidget checkbox
|
||||||
showColorIdentityCheckBox = new QCheckBox(this);
|
showColorIdentityCheckBox = new QCheckBox(this);
|
||||||
showColorIdentityCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowColorIdentity());
|
showColorIdentityCheckBox->setChecked(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowColorIdentity());
|
||||||
connect(showColorIdentityCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(showColorIdentityCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::showColorIdentityChanged);
|
&VisualDeckStorageQuickSettingsWidget::showColorIdentityChanged);
|
||||||
connect(showColorIdentityCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showColorIdentityCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setVisualDeckStorageShowColorIdentity);
|
&VisualDeckStorageSettings::setVisualDeckStorageShowColorIdentity);
|
||||||
|
|
||||||
// show tags on DeckPreviewWidget checkbox
|
// show tags on DeckPreviewWidget checkbox
|
||||||
showTagsOnDeckPreviewsCheckBox = new QCheckBox(this);
|
showTagsOnDeckPreviewsCheckBox = new QCheckBox(this);
|
||||||
showTagsOnDeckPreviewsCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
showTagsOnDeckPreviewsCheckBox->setChecked(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||||
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::showTagsOnDeckPreviewsChanged);
|
&VisualDeckStorageQuickSettingsWidget::showTagsOnDeckPreviewsChanged);
|
||||||
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showTagsOnDeckPreviewsCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
&SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageShowTagsOnDeckPreviews);
|
||||||
|
|
||||||
// show banner card selector checkbox
|
// show banner card selector checkbox
|
||||||
showBannerCardComboBoxCheckBox = new QCheckBox(this);
|
showBannerCardComboBoxCheckBox = new QCheckBox(this);
|
||||||
showBannerCardComboBoxCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowBannerCardComboBox());
|
showBannerCardComboBoxCheckBox->setChecked(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowBannerCardComboBox());
|
||||||
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::showBannerCardComboBoxChanged);
|
&VisualDeckStorageQuickSettingsWidget::showBannerCardComboBoxChanged);
|
||||||
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(showBannerCardComboBoxCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
&SettingsCache::setVisualDeckStorageShowBannerCardComboBox);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageShowBannerCardComboBox);
|
||||||
|
|
||||||
// draw unused color identities checkbox
|
// draw unused color identities checkbox
|
||||||
drawUnusedColorIdentitiesCheckBox = new QCheckBox(this);
|
drawUnusedColorIdentitiesCheckBox = new QCheckBox(this);
|
||||||
drawUnusedColorIdentitiesCheckBox->setChecked(
|
drawUnusedColorIdentitiesCheckBox->setChecked(
|
||||||
SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities());
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageDrawUnusedColorIdentities());
|
||||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::drawUnusedColorIdentitiesChanged);
|
&VisualDeckStorageQuickSettingsWidget::drawUnusedColorIdentitiesChanged);
|
||||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||||
&SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageDrawUnusedColorIdentities);
|
||||||
|
|
||||||
// color identity opacity selector
|
// color identity opacity selector
|
||||||
auto unusedColorIdentityOpacityWidget = new QWidget(this);
|
auto unusedColorIdentityOpacityWidget = new QWidget(this);
|
||||||
|
|
@ -68,11 +75,12 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||||
unusedColorIdentitiesOpacitySpinBox->setMinimum(0);
|
unusedColorIdentitiesOpacitySpinBox->setMinimum(0);
|
||||||
unusedColorIdentitiesOpacitySpinBox->setMaximum(100);
|
unusedColorIdentitiesOpacitySpinBox->setMaximum(100);
|
||||||
unusedColorIdentitiesOpacitySpinBox->setValue(
|
unusedColorIdentitiesOpacitySpinBox->setValue(
|
||||||
SettingsCache::instance().getVisualDeckStorageUnusedColorIdentitiesOpacity());
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageUnusedColorIdentitiesOpacity());
|
||||||
connect(unusedColorIdentitiesOpacitySpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(unusedColorIdentitiesOpacitySpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::unusedColorIdentitiesOpacityChanged);
|
&VisualDeckStorageQuickSettingsWidget::unusedColorIdentitiesOpacityChanged);
|
||||||
connect(unusedColorIdentitiesOpacitySpinBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance(),
|
connect(unusedColorIdentitiesOpacitySpinBox, qOverload<int>(&QSpinBox::valueChanged),
|
||||||
&SettingsCache::setVisualDeckStorageUnusedColorIdentitiesOpacity);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageUnusedColorIdentitiesOpacity);
|
||||||
|
|
||||||
unusedColorIdentitiesOpacityLabel->setBuddy(unusedColorIdentitiesOpacitySpinBox);
|
unusedColorIdentitiesOpacityLabel->setBuddy(unusedColorIdentitiesOpacitySpinBox);
|
||||||
|
|
||||||
|
|
@ -90,11 +98,13 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||||
deckPreviewTooltipComboBox->addItem("", TooltipType::None);
|
deckPreviewTooltipComboBox->addItem("", TooltipType::None);
|
||||||
deckPreviewTooltipComboBox->addItem("", TooltipType::Filepath);
|
deckPreviewTooltipComboBox->addItem("", TooltipType::Filepath);
|
||||||
|
|
||||||
deckPreviewTooltipComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageTooltipType());
|
deckPreviewTooltipComboBox->setCurrentIndex(
|
||||||
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageTooltipType());
|
||||||
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
[this] { emit deckPreviewTooltipChanged(getDeckPreviewTooltip()); });
|
[this] { emit deckPreviewTooltipChanged(getDeckPreviewTooltip()); });
|
||||||
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), &SettingsCache::instance(),
|
connect(deckPreviewTooltipComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
&SettingsCache::setVisualDeckStorageTooltipType);
|
&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::setVisualDeckStorageTooltipType);
|
||||||
|
|
||||||
auto deckPreviewTooltipLayout = new QHBoxLayout(deckPreviewTooltipWidget);
|
auto deckPreviewTooltipLayout = new QHBoxLayout(deckPreviewTooltipWidget);
|
||||||
deckPreviewTooltipLayout->setContentsMargins(11, 0, 11, 0);
|
deckPreviewTooltipLayout->setContentsMargins(11, 0, 11, 0);
|
||||||
|
|
@ -102,11 +112,12 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||||
deckPreviewTooltipLayout->addWidget(deckPreviewTooltipComboBox);
|
deckPreviewTooltipLayout->addWidget(deckPreviewTooltipComboBox);
|
||||||
|
|
||||||
// card size slider
|
// card size slider
|
||||||
cardSizeWidget = new CardSizeWidget(this, nullptr, SettingsCache::instance().getVisualDeckStorageCardSize());
|
cardSizeWidget =
|
||||||
|
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getVisualDeckStorageCardSize());
|
||||||
connect(cardSizeWidget->getSlider(), &QSlider::valueChanged, this,
|
connect(cardSizeWidget->getSlider(), &QSlider::valueChanged, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::cardSizeChanged);
|
&VisualDeckStorageQuickSettingsWidget::cardSizeChanged);
|
||||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance(),
|
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||||
&SettingsCache::setVisualDeckStorageCardSize);
|
&VisualDeckStorageSettings::setVisualDeckStorageCardSize);
|
||||||
|
|
||||||
// putting everything together
|
// putting everything together
|
||||||
this->addSettingsWidget(showFoldersCheckBox);
|
this->addSettingsWidget(showFoldersCheckBox);
|
||||||
|
|
@ -119,7 +130,7 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||||
this->addSettingsWidget(deckPreviewTooltipWidget);
|
this->addSettingsWidget(deckPreviewTooltipWidget);
|
||||||
this->addSettingsWidget(cardSizeWidget);
|
this->addSettingsWidget(cardSizeWidget);
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::langChanged, this,
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::langChanged, this,
|
||||||
&VisualDeckStorageQuickSettingsWidget::retranslateUi);
|
&VisualDeckStorageQuickSettingsWidget::retranslateUi);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ QString VisualDeckStorageSearchWidget::getSearchText()
|
||||||
*/
|
*/
|
||||||
static QString toRelativeFilepath(const QString &filePath)
|
static QString toRelativeFilepath(const QString &filePath)
|
||||||
{
|
{
|
||||||
QString deckPath = SettingsCache::instance().getDeckPath();
|
QString deckPath = SettingsCache::instance().paths().getDeckPath();
|
||||||
if (filePath.startsWith(deckPath)) {
|
if (filePath.startsWith(deckPath)) {
|
||||||
return filePath.mid(deckPath.length());
|
return filePath.mid(deckPath.length());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
// Set the current sort order
|
// Set the current sort order
|
||||||
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
sortComboBox->setCurrentIndex(SettingsCache::instance().visualDeckStorage().getVisualDeckStorageSortingOrder());
|
||||||
sortOrder = static_cast<SortOrder>(sortComboBox->currentIndex());
|
sortOrder = static_cast<SortOrder>(sortComboBox->currentIndex());
|
||||||
|
|
||||||
// Connect sorting change signal to refresh the file list
|
// Connect sorting change signal to refresh the file list
|
||||||
|
|
@ -61,7 +61,7 @@ void VisualDeckStorageSortWidget::retranslateUi()
|
||||||
void VisualDeckStorageSortWidget::updateSortOrder()
|
void VisualDeckStorageSortWidget::updateSortOrder()
|
||||||
{
|
{
|
||||||
sortOrder = static_cast<SortOrder>(sortComboBox->currentIndex());
|
sortOrder = static_cast<SortOrder>(sortComboBox->currentIndex());
|
||||||
SettingsCache::instance().setVisualDeckStorageSortingOrder(sortComboBox->currentIndex());
|
SettingsCache::instance().visualDeckStorage().setVisualDeckStorageSortingOrder(sortComboBox->currentIndex());
|
||||||
emit sortOrderChanged();
|
emit sortOrderChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
|
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||||
|
|
||||||
VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(parent), folderWidget(nullptr)
|
VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(parent), folderWidget(nullptr)
|
||||||
{
|
{
|
||||||
|
|
@ -54,10 +55,12 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
||||||
|
|
||||||
// tag filter box
|
// tag filter box
|
||||||
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
||||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
updateTagsVisibility(SettingsCache::instance().visualDeckStorage().getVisualDeckStorageShowTagFilter());
|
||||||
|
|
||||||
deckPreviewSelectionAnimationEnabled = SettingsCache::instance().getVisualDeckStorageSelectionAnimation();
|
deckPreviewSelectionAnimationEnabled =
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageSelectionAnimationChanged, this,
|
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageSelectionAnimation();
|
||||||
|
connect(&SettingsCache::instance().visualDeckStorage(),
|
||||||
|
&VisualDeckStorageSettings::visualDeckStorageSelectionAnimationChanged, this,
|
||||||
&VisualDeckStorageWidget::updateSelectionAnimationEnabled);
|
&VisualDeckStorageWidget::updateSelectionAnimationEnabled);
|
||||||
|
|
||||||
// deck area
|
// deck area
|
||||||
|
|
@ -142,8 +145,8 @@ void VisualDeckStorageWidget::reapplySortAndFilters()
|
||||||
|
|
||||||
void VisualDeckStorageWidget::createRootFolderWidget()
|
void VisualDeckStorageWidget::createRootFolderWidget()
|
||||||
{
|
{
|
||||||
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().getDeckPath(), false,
|
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().paths().getDeckPath(),
|
||||||
quickSettingsWidget->getShowFolders());
|
false, quickSettingsWidget->getShowFolders());
|
||||||
|
|
||||||
scrollArea->setWidget(folderWidget); // this automatically destroys the old folderWidget
|
scrollArea->setWidget(folderWidget); // this automatically destroys the old folderWidget
|
||||||
scrollArea->widget()->setMaximumWidth(scrollArea->viewport()->width());
|
scrollArea->widget()->setMaximumWidth(scrollArea->viewport()->width());
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ void MainWindow::startLocalGame(const LocalGameOptions &options)
|
||||||
void MainWindow::actWatchReplay()
|
void MainWindow::actWatchReplay()
|
||||||
{
|
{
|
||||||
QFileDialog dlg(this, tr("Load replay"));
|
QFileDialog dlg(this, tr("Load replay"));
|
||||||
dlg.setDirectory(SettingsCache::instance().getReplaysPath());
|
dlg.setDirectory(SettingsCache::instance().paths().getReplaysPath());
|
||||||
dlg.setNameFilters(QStringList() << QObject::tr("Cockatrice replays (*.cor)"));
|
dlg.setNameFilters(QStringList() << QObject::tr("Cockatrice replays (*.cor)"));
|
||||||
if (!dlg.exec()) {
|
if (!dlg.exec()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -382,8 +382,9 @@ void MainWindow::createActions()
|
||||||
connect(aCheckCardUpdatesBackground, &QAction::triggered, this, &MainWindow::actCheckCardUpdatesBackground);
|
connect(aCheckCardUpdatesBackground, &QAction::triggered, this, &MainWindow::actCheckCardUpdatesBackground);
|
||||||
aStatusBar = new QAction(this);
|
aStatusBar = new QAction(this);
|
||||||
aStatusBar->setCheckable(true);
|
aStatusBar->setCheckable(true);
|
||||||
aStatusBar->setChecked(SettingsCache::instance().getShowStatusBar());
|
aStatusBar->setChecked(SettingsCache::instance().personal().getShowStatusBar());
|
||||||
connect(aStatusBar, &QAction::triggered, &SettingsCache::instance(), &SettingsCache::setShowStatusBar);
|
connect(aStatusBar, &QAction::triggered, &SettingsCache::instance().personal(),
|
||||||
|
&PersonalSettings::setShowStatusBar);
|
||||||
aViewLog = new QAction(this);
|
aViewLog = new QAction(this);
|
||||||
connect(aViewLog, &QAction::triggered, this, &MainWindow::actViewLog);
|
connect(aViewLog, &QAction::triggered, this, &MainWindow::actViewLog);
|
||||||
aOpenSettingsFolder = new QAction(this);
|
aOpenSettingsFolder = new QAction(this);
|
||||||
|
|
@ -472,9 +473,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), askedForDbUpdater(false),
|
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), askedForDbUpdater(false),
|
||||||
cardUpdateProcess(nullptr), logviewDialog(nullptr)
|
cardUpdateProcess(nullptr), logviewDialog(nullptr)
|
||||||
{
|
{
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::pixmapCacheSizeChanged, this,
|
connect(&SettingsCache::instance().cacheStorage(), &CacheStorageSettings::pixmapCacheSizeChanged, this,
|
||||||
&MainWindow::pixmapCacheSizeChanged);
|
&MainWindow::pixmapCacheSizeChanged);
|
||||||
pixmapCacheSizeChanged(SettingsCache::instance().getPixmapCacheSize());
|
pixmapCacheSizeChanged(SettingsCache::instance().cacheStorage().getPixmapCacheSize());
|
||||||
|
|
||||||
connectionController = new ConnectionController(this, this);
|
connectionController = new ConnectionController(this, this);
|
||||||
|
|
||||||
|
|
@ -508,9 +509,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// status bar
|
// status bar
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::showStatusBarChanged, this,
|
connect(&SettingsCache::instance().personal(), &PersonalSettings::showStatusBarChanged, this,
|
||||||
[this](bool show) { statusBar()->setVisible(show); });
|
[this](bool show) { statusBar()->setVisible(show); });
|
||||||
statusBar()->setVisible(SettingsCache::instance().getShowStatusBar());
|
statusBar()->setVisible(SettingsCache::instance().personal().getShowStatusBar());
|
||||||
|
|
||||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||||
&MainWindow::refreshShortcuts);
|
&MainWindow::refreshShortcuts);
|
||||||
|
|
@ -537,23 +538,29 @@ void MainWindow::startupConfigCheck()
|
||||||
startLocalGame(options);
|
startLocalGame(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SettingsCache::instance().getCheckUpdatesOnStartup()) {
|
if (SettingsCache::instance().updates().getCheckUpdatesOnStartup()) {
|
||||||
actCheckClientUpdates();
|
actCheckClientUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SettingsCache::instance().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
if (SettingsCache::instance().personal().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||||
// no config found, 99% new clean install
|
// no config found, 99% new clean install
|
||||||
qCInfo(WindowMainStartupVersionLog)
|
qCInfo(WindowMainStartupVersionLog)
|
||||||
<< "Startup: old client version empty, assuming first start after clean install";
|
<< "Startup: old client version empty, assuming first start after clean install";
|
||||||
alertForcedOracleRun(VERSION_STRING, false);
|
alertForcedOracleRun(VERSION_STRING, false);
|
||||||
SettingsCache::instance().downloads().resetToDefaultURLs(); // populate the download urls
|
SettingsCache::instance().downloads().resetToDefaultURLs(); // populate the download urls
|
||||||
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
SettingsCache::instance().personal().setClientVersion(VERSION_STRING);
|
||||||
} else if (SettingsCache::instance().getClientVersion() != VERSION_STRING) {
|
|
||||||
|
if (QString(VERSION_STRING).contains("custom", Qt::CaseInsensitive)) {
|
||||||
|
SettingsCache::instance().updates().setCheckUpdatesOnStartup(false);
|
||||||
|
} else if (QString(VERSION_STRING).contains("beta", Qt::CaseInsensitive)) {
|
||||||
|
SettingsCache::instance().updates().setUpdateReleaseChannelIndex(1);
|
||||||
|
}
|
||||||
|
} else if (SettingsCache::instance().personal().getClientVersion() != VERSION_STRING) {
|
||||||
// config found, from another (presumably older) version
|
// config found, from another (presumably older) version
|
||||||
qCInfo(WindowMainStartupVersionLog)
|
qCInfo(WindowMainStartupVersionLog)
|
||||||
<< "Startup: old client version" << SettingsCache::instance().getClientVersion()
|
<< "Startup: old client version" << SettingsCache::instance().personal().getClientVersion()
|
||||||
<< "differs, assuming first start after update";
|
<< "differs, assuming first start after update";
|
||||||
if (SettingsCache::instance().getNotifyAboutNewVersion()) {
|
if (SettingsCache::instance().updates().getNotifyAboutNewVersion()) {
|
||||||
alertForcedOracleRun(VERSION_STRING, true);
|
alertForcedOracleRun(VERSION_STRING, true);
|
||||||
} else {
|
} else {
|
||||||
const auto reloadOk0 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
const auto reloadOk0 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
||||||
|
|
@ -562,10 +569,10 @@ void MainWindow::startupConfigCheck()
|
||||||
qCInfo(WindowMainStartupShortcutsLog) << "Migrating shortcuts after update detected.";
|
qCInfo(WindowMainStartupShortcutsLog) << "Migrating shortcuts after update detected.";
|
||||||
SettingsCache::instance().shortcuts().migrateShortcuts();
|
SettingsCache::instance().shortcuts().migrateShortcuts();
|
||||||
|
|
||||||
if (SettingsCache::instance().getCheckUpdatesOnStartup()) {
|
if (SettingsCache::instance().updates().getCheckUpdatesOnStartup()) {
|
||||||
if (QString(VERSION_STRING).contains("custom", Qt::CaseInsensitive)) {
|
if (QString(VERSION_STRING).contains("custom", Qt::CaseInsensitive)) {
|
||||||
qCInfo(WindowMainStartupShortcutsLog) << "Update has changed to custom version, disabling auto update";
|
qCInfo(WindowMainStartupShortcutsLog) << "Update has changed to custom version, disabling auto update";
|
||||||
SettingsCache::instance().setCheckUpdatesOnStartup(Qt::Unchecked);
|
SettingsCache::instance().updates().setCheckUpdatesOnStartup(false);
|
||||||
} else {
|
} else {
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
if (QString(VERSION_STRING).contains("beta", Qt::CaseInsensitive)) {
|
if (QString(VERSION_STRING).contains("beta", Qt::CaseInsensitive)) {
|
||||||
|
|
@ -573,18 +580,18 @@ void MainWindow::startupConfigCheck()
|
||||||
}
|
}
|
||||||
if (SettingsCache::instance().getUpdateReleaseChannelIndex() != channel) {
|
if (SettingsCache::instance().getUpdateReleaseChannelIndex() != channel) {
|
||||||
qCInfo(WindowMainStartupShortcutsLog) << "Update has changed beta state, updating release channel.";
|
qCInfo(WindowMainStartupShortcutsLog) << "Update has changed beta state, updating release channel.";
|
||||||
SettingsCache::instance().setUpdateReleaseChannelIndex(channel);
|
SettingsCache::instance().updates().setUpdateReleaseChannelIndex(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
SettingsCache::instance().personal().setClientVersion(VERSION_STRING);
|
||||||
} else {
|
} else {
|
||||||
// previous config from this version found
|
// previous config from this version found
|
||||||
qCInfo(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
qCInfo(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
||||||
|
|
||||||
if (SettingsCache::instance().getCardUpdateCheckRequired()) {
|
if (SettingsCache::instance().updates().getCardUpdateCheckRequired()) {
|
||||||
if (SettingsCache::instance().getStartupCardUpdateCheckPromptForUpdate()) {
|
if (SettingsCache::instance().updates().getStartupCardUpdateCheckPromptForUpdate()) {
|
||||||
auto startupCardCheckDialog = new DlgStartupCardCheck(this);
|
auto startupCardCheckDialog = new DlgStartupCardCheck(this);
|
||||||
|
|
||||||
if (startupCardCheckDialog->exec() == QDialog::Accepted) {
|
if (startupCardCheckDialog->exec() == QDialog::Accepted) {
|
||||||
|
|
@ -596,19 +603,19 @@ void MainWindow::startupConfigCheck()
|
||||||
actCheckCardUpdatesBackground();
|
actCheckCardUpdatesBackground();
|
||||||
break;
|
break;
|
||||||
case 2: // background + always
|
case 2: // background + always
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(false);
|
SettingsCache::instance().updates().setStartupCardUpdateCheckPromptForUpdate(false);
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(true);
|
SettingsCache::instance().updates().setStartupCardUpdateCheckAlwaysUpdate(true);
|
||||||
actCheckCardUpdatesBackground();
|
actCheckCardUpdatesBackground();
|
||||||
break;
|
break;
|
||||||
case 3: // don't prompt again + don't run
|
case 3: // don't prompt again + don't run
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(false);
|
SettingsCache::instance().updates().setStartupCardUpdateCheckPromptForUpdate(false);
|
||||||
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(false);
|
SettingsCache::instance().updates().setStartupCardUpdateCheckAlwaysUpdate(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (SettingsCache::instance().getStartupCardUpdateCheckAlwaysUpdate()) {
|
} else if (SettingsCache::instance().updates().getStartupCardUpdateCheckAlwaysUpdate()) {
|
||||||
actCheckCardUpdatesBackground();
|
actCheckCardUpdatesBackground();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -617,7 +624,8 @@ void MainWindow::startupConfigCheck()
|
||||||
|
|
||||||
// Run the tips dialog only on subsequent startups.
|
// Run the tips dialog only on subsequent startups.
|
||||||
// On the first run after an install/update the startup is already crowded enough
|
// On the first run after an install/update the startup is already crowded enough
|
||||||
if (tip->successfulInit && SettingsCache::instance().getShowTipsOnStartup() && tip->newTipsAvailable) {
|
if (tip->successfulInit && SettingsCache::instance().personal().getShowTipsOnStartup() &&
|
||||||
|
tip->newTipsAvailable) {
|
||||||
tip->raise();
|
tip->raise();
|
||||||
tip->show();
|
tip->show();
|
||||||
}
|
}
|
||||||
|
|
@ -780,7 +788,7 @@ void MainWindow::cardDatabaseLoadingFailed()
|
||||||
|
|
||||||
void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknownSetsNames)
|
void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknownSetsNames)
|
||||||
{
|
{
|
||||||
if (SettingsCache::instance().getAlwaysEnableNewSets()) {
|
if (SettingsCache::instance().updates().getAlwaysEnableNewSets()) {
|
||||||
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
||||||
const auto reloadOk1 =
|
const auto reloadOk1 =
|
||||||
QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); });
|
QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); });
|
||||||
|
|
@ -812,7 +820,7 @@ void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknow
|
||||||
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
||||||
const auto reloadOk1 =
|
const auto reloadOk1 =
|
||||||
QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); });
|
QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); });
|
||||||
SettingsCache::instance().setAlwaysEnableNewSets(true);
|
SettingsCache::instance().updates().setAlwaysEnableNewSets(true);
|
||||||
} else if (msgBox.clickedButton() == noButton) {
|
} else if (msgBox.clickedButton() == noButton) {
|
||||||
CardDatabaseManager::getInstance()->markAllSetsAsKnown();
|
CardDatabaseManager::getInstance()->markAllSetsAsKnown();
|
||||||
} else if (msgBox.clickedButton() == settingsButton) {
|
} else if (msgBox.clickedButton() == settingsButton) {
|
||||||
|
|
@ -957,7 +965,7 @@ void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
||||||
void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus exitStatus)
|
void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus exitStatus)
|
||||||
{
|
{
|
||||||
if (exitStatus == QProcess::NormalExit) {
|
if (exitStatus == QProcess::NormalExit) {
|
||||||
SettingsCache::instance().setLastCardUpdateCheck(QDateTime::currentDateTime().date());
|
SettingsCache::instance().updates().setLastCardUpdateCheck(QDateTime::currentDateTime().date());
|
||||||
}
|
}
|
||||||
exitCardDatabaseUpdate();
|
exitCardDatabaseUpdate();
|
||||||
}
|
}
|
||||||
|
|
@ -1004,7 +1012,7 @@ void MainWindow::refreshShortcuts()
|
||||||
|
|
||||||
void MainWindow::actOpenCustomFolder()
|
void MainWindow::actOpenCustomFolder()
|
||||||
{
|
{
|
||||||
QString dir = SettingsCache::instance().getCustomPicsPath();
|
QString dir = SettingsCache::instance().paths().getCustomPicsPath();
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ LONG WINAPI CockatriceUnhandledExceptionFilter(EXCEPTION_POINTERS *exceptionPoin
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
QString lang = SettingsCache::instance().getLang();
|
QString lang = SettingsCache::instance().personal().getLang();
|
||||||
|
|
||||||
QString qtNameHint = "qt_" + lang;
|
QString qtNameHint = "qt_" + lang;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
|
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
||||||
// Dependency Injections
|
// Dependency Injections
|
||||||
CardDatabaseManager::setCardPreferenceProvider(new SettingsCardPreferenceProvider());
|
CardDatabaseManager::setCardPreferenceProvider(new SettingsCardPreferenceProvider());
|
||||||
CardDatabaseManager::setCardDatabasePathProvider(&SettingsCache::instance());
|
CardDatabaseManager::setCardDatabasePathProvider(&SettingsCache::instance());
|
||||||
CardDatabaseManager::setCardSetPriorityController(SettingsCache::instance().cardDatabase());
|
CardDatabaseManager::setCardSetPriorityController(&SettingsCache::instance().cardDatabase());
|
||||||
|
|
||||||
qCInfo(MainLog) << "Starting main program";
|
qCInfo(MainLog) << "Starting main program";
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ int main(int argc, char *argv[])
|
||||||
// set name of the app desktop file; used by wayland to load the window icon
|
// set name of the app desktop file; used by wayland to load the window icon
|
||||||
QGuiApplication::setDesktopFileName("cockatrice");
|
QGuiApplication::setDesktopFileName("cockatrice");
|
||||||
|
|
||||||
SettingsCache::instance().setClientID(generateClientID());
|
SettingsCache::instance().personal().setClientID(generateClientID());
|
||||||
|
|
||||||
// If spoiler mode is enabled, we will download the spoilers
|
// If spoiler mode is enabled, we will download the spoilers
|
||||||
// then reload the DB. otherwise just reload the DB
|
// then reload the DB. otherwise just reload the DB
|
||||||
|
|
@ -275,7 +275,8 @@ int main(int argc, char *argv[])
|
||||||
qCInfo(MainLog) << "ui.show() finished";
|
qCInfo(MainLog) << "ui.show() finished";
|
||||||
|
|
||||||
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
||||||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, !SettingsCache::instance().getShowShortcuts());
|
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus,
|
||||||
|
!SettingsCache::instance().cardsDisplay().getShowShortcuts());
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,21 @@ set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
libcockatrice/interfaces/interface_cache_storage_settings_provider.h
|
||||||
libcockatrice/interfaces/interface_card_database_path_provider.h
|
libcockatrice/interfaces/interface_card_database_path_provider.h
|
||||||
libcockatrice/interfaces/interface_card_preference_provider.h
|
libcockatrice/interfaces/interface_card_preference_provider.h
|
||||||
libcockatrice/interfaces/interface_card_set_priority_controller.h
|
libcockatrice/interfaces/interface_card_set_priority_controller.h
|
||||||
|
libcockatrice/interfaces/interface_cards_display_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_chat_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_game_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_interface_settings_provider.h
|
||||||
libcockatrice/interfaces/interface_network_settings_provider.h
|
libcockatrice/interfaces/interface_network_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_paths_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_personal_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_sound_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_tabs_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_updates_settings_provider.h
|
||||||
|
libcockatrice/interfaces/interface_visual_deck_storage_settings_provider.h
|
||||||
libcockatrice/interfaces/noop_card_database_path_provider.h
|
libcockatrice/interfaces/noop_card_database_path_provider.h
|
||||||
libcockatrice/interfaces/noop_card_preference_provider.h
|
libcockatrice/interfaces/noop_card_preference_provider.h
|
||||||
libcockatrice/interfaces/noop_card_set_priority_controller.h
|
libcockatrice/interfaces/noop_card_set_priority_controller.h
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_CACHE_STORAGE_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_CACHE_STORAGE_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
class ICacheStorageSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ICacheStorageSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual int getPixmapCacheSize() const = 0;
|
||||||
|
[[nodiscard]] virtual int getNetworkCacheSizeInMB() const = 0;
|
||||||
|
[[nodiscard]] virtual int getRedirectCacheTtl() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_CACHE_STORAGE_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_CARDS_DISPLAY_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_CARDS_DISPLAY_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
class ICardsDisplaySettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ICardsDisplaySettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getDisplayCardNames() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getRoundCardCorners() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getOverrideAllCardArtWithPersonalPreference() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getBumpSetsWithCardsInDeckToTop() const = 0;
|
||||||
|
[[nodiscard]] virtual int getPrintingSelectorSortOrder() const = 0;
|
||||||
|
[[nodiscard]] virtual int getPrintingSelectorCardSize() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getIncludeRebalancedCards() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getPrintingSelectorNavigationButtonsVisible() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getDeckEditorBannerCardComboBoxVisible() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getDeckEditorTagsWidgetVisible() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTapAnimation() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getAutoRotateSidewaysLayoutCards() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getScaleCards() const = 0;
|
||||||
|
[[nodiscard]] virtual int getStackCardOverlapPercent() const = 0;
|
||||||
|
[[nodiscard]] virtual int getCardInfoViewMode() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_CARDS_DISPLAY_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_CHAT_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_CHAT_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class IChatSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IChatSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getChatMention() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getChatMentionCompleter() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getChatMentionColor() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getChatHighlightColor() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getChatMentionForeground() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getChatHighlightForeground() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getIgnoreUnregisteredUsers() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getIgnoreUnregisteredUserMessages() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getIgnoreNonBuddyUserMessages() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowMessagePopup() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowMentionPopup() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getRoomHistory() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getHighlightWords() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_CHAT_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_GAME_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_GAME_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class IGameSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IGameSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual QString getGameDescription() const = 0;
|
||||||
|
[[nodiscard]] virtual int getMaxPlayers() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getGameTypes() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getOnlyBuddies() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getOnlyRegistered() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getSpectatorsAllowed() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getSpectatorsNeedPassword() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getSpectatorsCanTalk() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getSpectatorsCanSeeEverything() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getCreateGameAsSpectator() const = 0;
|
||||||
|
[[nodiscard]] virtual int getDefaultStartingLifeTotal() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShareDecklistsOnLoad() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getRememberGameSettings() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getLocalGameRememberSettings() const = 0;
|
||||||
|
[[nodiscard]] virtual int getLocalGameMaxPlayers() const = 0;
|
||||||
|
[[nodiscard]] virtual int getLocalGameStartingLifeTotal() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_GAME_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class IInterfaceSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IInterfaceSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getUseTearOffMenus() const = 0;
|
||||||
|
[[nodiscard]] virtual int getCardViewInitialRowsMax() const = 0;
|
||||||
|
[[nodiscard]] virtual int getCardViewExpandedRowsMax() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getCloseEmptyCardView() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getFocusCardViewSearchBar() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getKeepGameChatFocus() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getNotificationsEnabled() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getSpectatorNotificationsEnabled() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getBuddyConnectNotificationsEnabled() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getDoubleClickToPlay() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getClickPlaysAllSelected() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getPlayToStack() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getDoNotDeleteArrowsInSubPhases() const = 0;
|
||||||
|
[[nodiscard]] virtual int getStartingHandSize() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getAnnotateTokens() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowDragSelectionCount() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowTotalSelectionCount() const = 0;
|
||||||
|
[[nodiscard]] virtual int getTallyType() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getHorizontalHand() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getInvertVerticalCoordinate() const = 0;
|
||||||
|
[[nodiscard]] virtual int getMinPlayersForMultiColumnLayout() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getOpenDeckInNewTab() const = 0;
|
||||||
|
[[nodiscard]] virtual int getRewindBufferingMs() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getStyleUserList() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getLeftJustified() const = 0;
|
||||||
|
[[nodiscard]] virtual int getZoneViewGroupByIndex() const = 0;
|
||||||
|
[[nodiscard]] virtual int getZoneViewSortByIndex() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getZoneViewPileView() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getKnownMissingFeatures() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_PATHS_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_PATHS_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class IPathsSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IPathsSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual QString getDeckPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getFiltersPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getReplaysPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getPicsPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getCustomPicsPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getThemesPath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getCardDatabasePath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getCustomCardDatabasePath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getTokenDatabasePath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getSpoilerCardDatabasePath() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getRedirectCachePath() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_PATHS_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_PERSONAL_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_PERSONAL_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
#include <QList>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class IPersonalSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IPersonalSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual QString getLang() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getClientID() = 0;
|
||||||
|
[[nodiscard]] virtual QString getClientVersion() = 0;
|
||||||
|
[[nodiscard]] virtual int getKeepAlive() const = 0;
|
||||||
|
[[nodiscard]] virtual int getTimeOut() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getPicDownload() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
||||||
|
[[nodiscard]] virtual int getMaxFontSize() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getHighlightWords() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getHomeTabBackgroundSource() const = 0;
|
||||||
|
[[nodiscard]] virtual int getHomeTabBackgroundShuffleFrequency() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getHomeTabDisplayCardName() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getShowTipsOnStartup() const = 0;
|
||||||
|
[[nodiscard]] virtual QList<int> getSeenTips() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getDownloadSpoilersStatus() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_PERSONAL_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_SOUND_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_SOUND_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class ISoundSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ISoundSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getSoundEnabled() const = 0;
|
||||||
|
[[nodiscard]] virtual QString getSoundThemeName() const = 0;
|
||||||
|
[[nodiscard]] virtual int getMasterVolume() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_SOUND_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_TABS_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_TABS_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
class ITabsSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ITabsSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getTabVisualDeckStorageOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabServerOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabAccountOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabDeckStorageOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabReplaysOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabAdminOpen() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getTabLogOpen() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_TABS_SETTINGS_PROVIDER_H
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef COCKATRICE_INTERFACE_UPDATES_SETTINGS_PROVIDER_H
|
||||||
|
#define COCKATRICE_INTERFACE_UPDATES_SETTINGS_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
|
class IUpdatesSettingsProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IUpdatesSettingsProvider() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool getCheckUpdatesOnStartup() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getStartupCardUpdateCheckPromptForUpdate() = 0;
|
||||||
|
[[nodiscard]] virtual bool getStartupCardUpdateCheckAlwaysUpdate() = 0;
|
||||||
|
[[nodiscard]] virtual int getCardUpdateCheckInterval() const = 0;
|
||||||
|
[[nodiscard]] virtual QDate getLastCardUpdateCheck() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getCardUpdateCheckRequired() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getAlwaysEnableNewSets() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getNotifyAboutUpdates() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getNotifyAboutNewVersion() const = 0;
|
||||||
|
[[nodiscard]] virtual int getUpdateReleaseChannelIndex() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_INTERFACE_UPDATES_SETTINGS_PROVIDER_H
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue