mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 19:13:25 -08:00
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / vcpkg baseline (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Fedora 45 release (push) Blocked by required conditions
Build Desktop / Fedora 45 debug (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 sanitize (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 cover (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 27 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / Prune caches (push) Waiting to run
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions
* [Crash] Add lifecycle breadcrumbs for unattributable native crashes Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> * Restore the native split host button on non-macOS styles The merged quick-host control composed a QPushButton and a separate autoRaise arrow QToolButton, which Fusion draws as two adjacent controls. Version one of the quick-host branch used a single QToolButton with MenuButtonPopup, which every style draws as one native split button. Use that split button on every style that can draw one, and keep the plain primary + settings button pair as the native macOS fallback. * Enable hover zoom and the hover panel by default Both hover triggers now default to Hover, with the existing 400 ms zoom delay and 200 ms panel delay. The Off trigger remains available for users who want the old behavior. --------- Co-authored-by: Lukas Brübach <44814898+BruebachL@users.noreply.github.com> Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
323 lines
9.7 KiB
C++
323 lines
9.7 KiB
C++
#include "cards_display_settings.h"
|
|
|
|
#include "libcockatrice/card/card_localization.h"
|
|
#include "libcockatrice/settings/settings_manager.h"
|
|
|
|
#include <QSharedPointer>
|
|
#include <QVariant>
|
|
|
|
class QObject;
|
|
|
|
CardsDisplaySettings::CardsDisplaySettings(const QString &settingPath, QObject *parent)
|
|
: SettingsManager(settingPath + "cards_display.ini", "cards", QString(), parent)
|
|
{
|
|
}
|
|
|
|
bool CardsDisplaySettings::getDisplayCardNames() const
|
|
{
|
|
return getValue("displayCardNames", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getRoundCardCorners() const
|
|
{
|
|
return getValue("roundCardCorners", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getOverrideAllCardArtWithPersonalPreference() const
|
|
{
|
|
return getValue("overrideAllCardArtWithPersonalPreference", QString(), QString(), false).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getBumpSetsWithCardsInDeckToTop() const
|
|
{
|
|
return getValue("bumpSetsWithCardsInDeckToTop", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
int CardsDisplaySettings::getPrintingSelectorSortOrder() const
|
|
{
|
|
return getValue("sortOrder", "cards", "printingSelector", 1).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getPrintingSelectorCardSize() const
|
|
{
|
|
return getValue("printingSelector", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getPrintingSelectorNavigationButtonsVisible() const
|
|
{
|
|
return getValue("navigationButtonsVisible", "cards", "printingSelector", true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getTapAnimation() const
|
|
{
|
|
return getValue("tapAnimation", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getArrowDrawAnimation() const
|
|
{
|
|
return getValue("arrowDrawAnimation", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getAutoRotateSidewaysLayoutCards() const
|
|
{
|
|
return getValue("autoRotateSidewaysLayoutCards", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getScaleCards() const
|
|
{
|
|
return getValue("scaleCards", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
int CardsDisplaySettings::getHoverPanelTrigger() const
|
|
{
|
|
return getValue("hoverPanelTrigger", QString(), QString(), static_cast<int>(HoverPanelTriggerHover)).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getHoverZoomTrigger() const
|
|
{
|
|
// Hover is the default: hovering first zooms the card, then the tab panel shows up.
|
|
// Either trigger can still be changed or turned off in the interface settings.
|
|
return getValue("hoverZoomTrigger", QString(), QString(), static_cast<int>(HoverPanelTriggerHover)).toInt();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getHoverPanelDoubleConfirm() const
|
|
{
|
|
return getValue("hoverPanelDoubleConfirm", QString(), QString(), false).toBool();
|
|
}
|
|
|
|
int CardsDisplaySettings::getHoverZoomDelayMs() const
|
|
{
|
|
return getValue("hoverZoomDelayMs", QString(), QString(), 400).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getHoverPanelDelayMs() const
|
|
{
|
|
return getValue("hoverPanelDelayMs", QString(), QString(), 200).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getStackCardOverlapPercent() const
|
|
{
|
|
return getValue("verticalCardOverlapPercent", QString(), QString(), 33).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getCardInfoViewMode() const
|
|
{
|
|
return getValue("cardInfoViewMode", QString(), QString(), 0).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getVisualDeckStorageCardSize() const
|
|
{
|
|
return getValue("visualDeckStorage", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getVisualDatabaseDisplayCardSize() const
|
|
{
|
|
return getValue("visualDatabaseDisplay", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getVisualDeckEditorCardSize() const
|
|
{
|
|
return getValue("visualDeckEditor", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
bool CardsDisplaySettings::getVisualDeckEditorShowCardCounts() const
|
|
{
|
|
return getValue("visualDeckEditorShowCardCounts", QString(), QString(), true).toBool();
|
|
}
|
|
|
|
int CardsDisplaySettings::getEDHRecCardSize() const
|
|
{
|
|
return getValue("edhrec", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getArchidektPreviewSize() const
|
|
{
|
|
return getValue("archidektPreview", "cards", "cardSize", 100).toInt();
|
|
}
|
|
|
|
int CardsDisplaySettings::getSampleHandSize() const
|
|
{
|
|
return getValue("sampleHandSize", "cards", "cardSize", 7).toInt();
|
|
}
|
|
|
|
QString CardsDisplaySettings::getCardLang() const
|
|
{
|
|
return getValue("cardLang", QString(), QString(), "en").toString();
|
|
}
|
|
|
|
int CardsDisplaySettings::getCardSearchLanguage() const
|
|
{
|
|
return getValue("cardSearchLanguage", QString(), QString(), static_cast<int>(SearchLanguageMode::English)).toInt();
|
|
}
|
|
|
|
void CardsDisplaySettings::setDisplayCardNames(bool _displayCardNames)
|
|
{
|
|
setValue(_displayCardNames, "displayCardNames");
|
|
emit displayCardNamesChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setRoundCardCorners(bool _roundCardCorners)
|
|
{
|
|
if (_roundCardCorners == getRoundCardCorners()) {
|
|
return;
|
|
}
|
|
setValue(_roundCardCorners, "roundCardCorners");
|
|
emit roundCardCornersChanged(_roundCardCorners);
|
|
}
|
|
|
|
void CardsDisplaySettings::setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt)
|
|
{
|
|
setValue(_overrideAllCardArt, "overrideAllCardArtWithPersonalPreference");
|
|
emit overrideAllCardArtWithPersonalPreferenceChanged(_overrideAllCardArt);
|
|
}
|
|
|
|
void CardsDisplaySettings::setBumpSetsWithCardsInDeckToTop(bool _bumpSetsWithCardsInDeckToTop)
|
|
{
|
|
setValue(_bumpSetsWithCardsInDeckToTop, "bumpSetsWithCardsInDeckToTop");
|
|
emit bumpSetsWithCardsInDeckToTopChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setPrintingSelectorSortOrder(int _printingSelectorSortOrder)
|
|
{
|
|
setValue(_printingSelectorSortOrder, "sortOrder", "cards", "printingSelector");
|
|
emit printingSelectorSortOrderChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setPrintingSelectorCardSize(int _printingSelectorCardSize)
|
|
{
|
|
setValue(_printingSelectorCardSize, "printingSelector", "cards", "cardSize");
|
|
emit printingSelectorCardSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setPrintingSelectorNavigationButtonsVisible(bool _navigationButtonsVisible)
|
|
{
|
|
setValue(_navigationButtonsVisible, "navigationButtonsVisible", "cards", "printingSelector");
|
|
emit printingSelectorNavigationButtonsVisibleChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setTapAnimation(bool _tapAnimation)
|
|
{
|
|
setValue(_tapAnimation, "tapAnimation");
|
|
}
|
|
|
|
void CardsDisplaySettings::setArrowDrawAnimation(bool _arrowDrawAnimation)
|
|
{
|
|
setValue(_arrowDrawAnimation, "arrowDrawAnimation");
|
|
}
|
|
|
|
void CardsDisplaySettings::setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards)
|
|
{
|
|
setValue(_autoRotateSidewaysLayoutCards, "autoRotateSidewaysLayoutCards");
|
|
}
|
|
|
|
void CardsDisplaySettings::setCardScaling(bool _scaleCards)
|
|
{
|
|
setValue(_scaleCards, "scaleCards");
|
|
}
|
|
|
|
void CardsDisplaySettings::setHoverPanelTrigger(int _trigger)
|
|
{
|
|
setValue(_trigger, "hoverPanelTrigger");
|
|
emit hoverPanelTriggerChanged(_trigger);
|
|
}
|
|
|
|
void CardsDisplaySettings::setHoverZoomTrigger(int _trigger)
|
|
{
|
|
setValue(_trigger, "hoverZoomTrigger");
|
|
emit hoverZoomTriggerChanged(_trigger);
|
|
}
|
|
|
|
void CardsDisplaySettings::setHoverPanelDoubleConfirm(bool _doubleConfirm)
|
|
{
|
|
setValue(_doubleConfirm, "hoverPanelDoubleConfirm");
|
|
emit hoverPanelDoubleConfirmChanged(_doubleConfirm);
|
|
}
|
|
|
|
void CardsDisplaySettings::setHoverZoomDelayMs(int _ms)
|
|
{
|
|
setValue(_ms, "hoverZoomDelayMs");
|
|
emit hoverZoomDelayMsChanged(_ms);
|
|
}
|
|
|
|
void CardsDisplaySettings::setHoverPanelDelayMs(int _ms)
|
|
{
|
|
setValue(_ms, "hoverPanelDelayMs");
|
|
emit hoverPanelDelayMsChanged(_ms);
|
|
}
|
|
|
|
void CardsDisplaySettings::setStackCardOverlapPercent(int _verticalCardOverlapPercent)
|
|
{
|
|
setValue(_verticalCardOverlapPercent, "verticalCardOverlapPercent");
|
|
}
|
|
|
|
void CardsDisplaySettings::setCardInfoViewMode(int _viewMode)
|
|
{
|
|
setValue(_viewMode, "cardInfoViewMode");
|
|
}
|
|
|
|
void CardsDisplaySettings::setVisualDeckStorageCardSize(int _cardSize)
|
|
{
|
|
setValue(_cardSize, "visualDeckStorage", "cards", "cardSize");
|
|
emit visualDeckStorageCardSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setVisualDatabaseDisplayCardSize(int _cardSize)
|
|
{
|
|
setValue(_cardSize, "visualDatabaseDisplay", "cards", "cardSize");
|
|
emit visualDatabaseDisplayCardSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setVisualDeckEditorCardSize(int _cardSize)
|
|
{
|
|
setValue(_cardSize, "visualDeckEditor", "cards", "cardSize");
|
|
emit visualDeckEditorCardSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setVisualDeckEditorShowCardCounts(bool _showCardCounts)
|
|
{
|
|
if (_showCardCounts == getVisualDeckEditorShowCardCounts()) {
|
|
return;
|
|
}
|
|
setValue(_showCardCounts, "visualDeckEditorShowCardCounts");
|
|
emit visualDeckEditorShowCardCountsChanged(_showCardCounts);
|
|
}
|
|
|
|
void CardsDisplaySettings::setEDHRecCardSize(int _edhrecCardSize)
|
|
{
|
|
setValue(_edhrecCardSize, "edhrec", "cards", "cardSize");
|
|
emit edhRecCardSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setArchidektPreviewCardSize(int _archidektPreviewCardSize)
|
|
{
|
|
setValue(_archidektPreviewCardSize, "archidektPreview", "cards", "cardSize");
|
|
emit archidektPreviewSizeChanged();
|
|
}
|
|
|
|
void CardsDisplaySettings::setSampleHandSize(int _sampleHandSize)
|
|
{
|
|
setValue(_sampleHandSize, "sampleHandSize", "cards", "cardSize");
|
|
emit sampleHandSizeChanged(_sampleHandSize);
|
|
}
|
|
|
|
void CardsDisplaySettings::setCardLang(const QString &_cardLang)
|
|
{
|
|
if (_cardLang == getCardLang()) {
|
|
return;
|
|
}
|
|
setValue(_cardLang, "cardLang");
|
|
// Flush to disk immediately: the Oracle tool is a separate process that
|
|
// reads this value to decide which foreignData to import, so it must not
|
|
// observe a stale (pre-change) value.
|
|
sync();
|
|
emit cardLangChanged(_cardLang);
|
|
}
|
|
|
|
void CardsDisplaySettings::setCardSearchLanguage(int _cardSearchLanguage)
|
|
{
|
|
if (_cardSearchLanguage == getCardSearchLanguage()) {
|
|
return;
|
|
}
|
|
setValue(_cardSearchLanguage, "cardSearchLanguage");
|
|
emit cardSearchLanguageChanged(_cardSearchLanguage);
|
|
}
|