mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Implement a little "raise on enter" animation for deck preview widgets. (#5844)
* Implement a little "raise on enter" animation for deck preview widgets. * Why does the linter need to be run twice? * Fix build. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
2dc1b875d2
commit
8af1f2b6d9
15 changed files with 127 additions and 9 deletions
|
|
@ -30,8 +30,9 @@
|
||||||
*
|
*
|
||||||
* Initializes the widget with a minimum height and sets the pixmap to a dirty state for initial loading.
|
* Initializes the widget with a minimum height and sets the pixmap to a dirty state for initial loading.
|
||||||
*/
|
*/
|
||||||
CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool hoverToZoomEnabled)
|
CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverToZoomEnabled, const bool _raiseOnEnter)
|
||||||
: QWidget(parent), info(nullptr), pixmapDirty(true), hoverToZoomEnabled(hoverToZoomEnabled)
|
: QWidget(parent), info(nullptr), pixmapDirty(true), hoverToZoomEnabled(_hoverToZoomEnabled),
|
||||||
|
raiseOnEnter(_raiseOnEnter)
|
||||||
{
|
{
|
||||||
setMinimumHeight(baseHeight);
|
setMinimumHeight(baseHeight);
|
||||||
if (hoverToZoomEnabled) {
|
if (hoverToZoomEnabled) {
|
||||||
|
|
@ -45,6 +46,17 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool hoverTo
|
||||||
hoverTimer->setSingleShot(true);
|
hoverTimer->setSingleShot(true);
|
||||||
connect(hoverTimer, &QTimer::timeout, this, &CardInfoPictureWidget::showEnlargedPixmap);
|
connect(hoverTimer, &QTimer::timeout, this, &CardInfoPictureWidget::showEnlargedPixmap);
|
||||||
|
|
||||||
|
// Store the widget's original position
|
||||||
|
originalPos = this->pos();
|
||||||
|
|
||||||
|
// Create the animation
|
||||||
|
animation = new QPropertyAnimation(this, "pos");
|
||||||
|
animation->setDuration(200); // 200ms animation duration
|
||||||
|
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||||
|
|
||||||
|
animation->setStartValue(originalPos);
|
||||||
|
animation->setEndValue(originalPos - QPoint(0, animationOffset));
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
connect(&SettingsCache::instance(), &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCorners) {
|
||||||
Q_UNUSED(_roundCardCorners);
|
Q_UNUSED(_roundCardCorners);
|
||||||
|
|
||||||
|
|
@ -84,6 +96,11 @@ void CardInfoPictureWidget::setHoverToZoomEnabled(const bool enabled)
|
||||||
setMouseTracking(enabled);
|
setMouseTracking(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CardInfoPictureWidget::setRaiseOnEnterEnabled(const bool enabled)
|
||||||
|
{
|
||||||
|
raiseOnEnter = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles widget resizing by updating the pixmap size.
|
* @brief Handles widget resizing by updating the pixmap size.
|
||||||
* @param event The resize event (unused).
|
* @param event The resize event (unused).
|
||||||
|
|
@ -93,6 +110,7 @@ void CardInfoPictureWidget::setHoverToZoomEnabled(const bool enabled)
|
||||||
void CardInfoPictureWidget::resizeEvent(QResizeEvent *event)
|
void CardInfoPictureWidget::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
originalPos = pos(); // Update the baseline position
|
||||||
updatePixmap();
|
updatePixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,6 +252,18 @@ void CardInfoPictureWidget::enterEvent(QEvent *event)
|
||||||
|
|
||||||
// Emit signal indicating a card is being hovered on
|
// Emit signal indicating a card is being hovered on
|
||||||
emit hoveredOnCard(info);
|
emit hoveredOnCard(info);
|
||||||
|
|
||||||
|
if (raiseOnEnter) {
|
||||||
|
if (animation->state() == QAbstractAnimation::Running) {
|
||||||
|
animation->pause(); // Pause current animation
|
||||||
|
} else {
|
||||||
|
originalPos = this->pos(); // Update the baseline position
|
||||||
|
animation->setStartValue(originalPos);
|
||||||
|
animation->setEndValue(originalPos - QPoint(0, animationOffset));
|
||||||
|
}
|
||||||
|
animation->setDirection(QAbstractAnimation::Forward);
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -243,10 +273,32 @@ void CardInfoPictureWidget::enterEvent(QEvent *event)
|
||||||
void CardInfoPictureWidget::leaveEvent(QEvent *event)
|
void CardInfoPictureWidget::leaveEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::leaveEvent(event);
|
QWidget::leaveEvent(event);
|
||||||
|
|
||||||
if (hoverToZoomEnabled) {
|
if (hoverToZoomEnabled) {
|
||||||
hoverTimer->stop();
|
hoverTimer->stop();
|
||||||
enlargedPixmapWidget->hide();
|
enlargedPixmapWidget->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (raiseOnEnter) {
|
||||||
|
if (animation->state() == QAbstractAnimation::Running) {
|
||||||
|
animation->pause(); // Pause current animation
|
||||||
|
}
|
||||||
|
animation->setDirection(QAbstractAnimation::Backward);
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CardInfoPictureWidget::moveEvent(QMoveEvent *event)
|
||||||
|
{
|
||||||
|
QWidget::moveEvent(event);
|
||||||
|
|
||||||
|
hoverTimer->stop();
|
||||||
|
enlargedPixmapWidget->hide();
|
||||||
|
|
||||||
|
if (animation->state() == QAbstractAnimation::Running) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
originalPos = this->pos(); // Update the baseline position
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../../../../game/cards/card_info.h"
|
#include "../../../../game/cards/card_info.h"
|
||||||
#include "card_info_picture_enlarged_widget.h"
|
#include "card_info_picture_enlarged_widget.h"
|
||||||
|
|
||||||
|
#include <QPropertyAnimation>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
@ -17,17 +18,20 @@ class CardInfoPictureWidget : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CardInfoPictureWidget(QWidget *parent = nullptr, bool hoverToZoomEnabled = false);
|
explicit CardInfoPictureWidget(QWidget *parent = nullptr,
|
||||||
|
bool hoverToZoomEnabled = false,
|
||||||
|
bool raiseOnEnter = false);
|
||||||
CardInfoPtr getInfo()
|
CardInfoPtr getInfo()
|
||||||
{
|
{
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
[[nodiscard]] QSize sizeHint() const override;
|
[[nodiscard]] QSize sizeHint() const override;
|
||||||
void setHoverToZoomEnabled(bool enabled);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCard(CardInfoPtr card);
|
void setCard(CardInfoPtr card);
|
||||||
void setScaleFactor(int scale); // New slot for scaling
|
void setScaleFactor(int scale); // New slot for scaling
|
||||||
|
void setHoverToZoomEnabled(bool enabled);
|
||||||
|
void setRaiseOnEnterEnabled(bool enabled);
|
||||||
void updatePixmap();
|
void updatePixmap();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
@ -45,6 +49,7 @@ protected:
|
||||||
void enterEvent(QEvent *event) override; // Qt5 signature
|
void enterEvent(QEvent *event) override; // Qt5 signature
|
||||||
#endif
|
#endif
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
|
void moveEvent(QMoveEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void loadPixmap();
|
void loadPixmap();
|
||||||
|
|
@ -65,10 +70,14 @@ private:
|
||||||
QPixmap resizedPixmap;
|
QPixmap resizedPixmap;
|
||||||
bool pixmapDirty;
|
bool pixmapDirty;
|
||||||
bool hoverToZoomEnabled;
|
bool hoverToZoomEnabled;
|
||||||
|
bool raiseOnEnter;
|
||||||
int hoverActivateThresholdInMs = 500;
|
int hoverActivateThresholdInMs = 500;
|
||||||
CardInfoPictureEnlargedWidget *enlargedPixmapWidget;
|
CardInfoPictureEnlargedWidget *enlargedPixmapWidget;
|
||||||
int enlargedPixmapOffset = 10;
|
int enlargedPixmapOffset = 10;
|
||||||
QTimer *hoverTimer;
|
QTimer *hoverTimer;
|
||||||
|
QPropertyAnimation *animation;
|
||||||
|
QPoint originalPos; // Store the original position
|
||||||
|
const int animationOffset = 10; // Adjust this for how much the widget moves up
|
||||||
|
|
||||||
QMenu *createRightClickMenu();
|
QMenu *createRightClickMenu();
|
||||||
QMenu *createViewRelatedCardsMenu();
|
QMenu *createViewRelatedCardsMenu();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
* @brief Constructs a CardPictureWithTextOverlay widget.
|
* @brief Constructs a CardPictureWithTextOverlay widget.
|
||||||
* @param parent The parent widget.
|
* @param parent The parent widget.
|
||||||
* @param hoverToZoomEnabled If this widget will spawn a larger widget when hovered over.
|
* @param hoverToZoomEnabled If this widget will spawn a larger widget when hovered over.
|
||||||
|
* @param raiseOnEnter If this widget will raise slightly when entered.
|
||||||
* @param textColor The color of the overlay text.
|
* @param textColor The color of the overlay text.
|
||||||
* @param outlineColor The color of the outline around the text.
|
* @param outlineColor The color of the outline around the text.
|
||||||
* @param fontSize The font size of the overlay text.
|
* @param fontSize The font size of the overlay text.
|
||||||
|
|
@ -18,11 +19,12 @@
|
||||||
*/
|
*/
|
||||||
CardInfoPictureWithTextOverlayWidget::CardInfoPictureWithTextOverlayWidget(QWidget *parent,
|
CardInfoPictureWithTextOverlayWidget::CardInfoPictureWithTextOverlayWidget(QWidget *parent,
|
||||||
const bool hoverToZoomEnabled,
|
const bool hoverToZoomEnabled,
|
||||||
|
const bool raiseOnEnter,
|
||||||
const QColor &textColor,
|
const QColor &textColor,
|
||||||
const QColor &outlineColor,
|
const QColor &outlineColor,
|
||||||
const int fontSize,
|
const int fontSize,
|
||||||
const Qt::Alignment alignment)
|
const Qt::Alignment alignment)
|
||||||
: CardInfoPictureWidget(parent, hoverToZoomEnabled), textColor(textColor), outlineColor(outlineColor),
|
: CardInfoPictureWidget(parent, hoverToZoomEnabled, raiseOnEnter), textColor(textColor), outlineColor(outlineColor),
|
||||||
fontSize(fontSize), textAlignment(alignment)
|
fontSize(fontSize), textAlignment(alignment)
|
||||||
{
|
{
|
||||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class CardInfoPictureWithTextOverlayWidget : public CardInfoPictureWidget
|
||||||
public:
|
public:
|
||||||
explicit CardInfoPictureWithTextOverlayWidget(QWidget *parent = nullptr,
|
explicit CardInfoPictureWithTextOverlayWidget(QWidget *parent = nullptr,
|
||||||
bool hoverToZoomEnabled = false,
|
bool hoverToZoomEnabled = false,
|
||||||
|
bool raiseOnEnter = false,
|
||||||
const QColor &textColor = Qt::white,
|
const QColor &textColor = Qt::white,
|
||||||
const QColor &outlineColor = Qt::black,
|
const QColor &outlineColor = Qt::black,
|
||||||
int fontSize = 12,
|
int fontSize = 12,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "deck_preview_card_picture_widget.h"
|
#include "deck_preview_card_picture_widget.h"
|
||||||
|
|
||||||
|
#include "../../../../settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
@ -22,15 +24,24 @@
|
||||||
*/
|
*/
|
||||||
DeckPreviewCardPictureWidget::DeckPreviewCardPictureWidget(QWidget *parent,
|
DeckPreviewCardPictureWidget::DeckPreviewCardPictureWidget(QWidget *parent,
|
||||||
const bool hoverToZoomEnabled,
|
const bool hoverToZoomEnabled,
|
||||||
|
const bool raiseOnEnter,
|
||||||
const QColor &textColor,
|
const QColor &textColor,
|
||||||
const QColor &outlineColor,
|
const QColor &outlineColor,
|
||||||
const int fontSize,
|
const int fontSize,
|
||||||
const Qt::Alignment alignment)
|
const Qt::Alignment alignment)
|
||||||
: CardInfoPictureWithTextOverlayWidget(parent, hoverToZoomEnabled, textColor, outlineColor, fontSize, alignment)
|
: CardInfoPictureWithTextOverlayWidget(parent,
|
||||||
|
hoverToZoomEnabled,
|
||||||
|
raiseOnEnter,
|
||||||
|
textColor,
|
||||||
|
outlineColor,
|
||||||
|
fontSize,
|
||||||
|
alignment)
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
&CardInfoPictureWidget::setRaiseOnEnterEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckPreviewCardPictureWidget::mousePressEvent(QMouseEvent *event)
|
void DeckPreviewCardPictureWidget::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class DeckPreviewCardPictureWidget final : public CardInfoPictureWithTextOverlay
|
||||||
public:
|
public:
|
||||||
explicit DeckPreviewCardPictureWidget(QWidget *parent,
|
explicit DeckPreviewCardPictureWidget(QWidget *parent,
|
||||||
bool hoverToZoomEnabled = false,
|
bool hoverToZoomEnabled = false,
|
||||||
|
bool raiseOnEnter = false,
|
||||||
const QColor &textColor = Qt::white,
|
const QColor &textColor = Qt::white,
|
||||||
const QColor &outlineColor = Qt::black,
|
const QColor &outlineColor = Qt::black,
|
||||||
int fontSize = 12,
|
int fontSize = 12,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent,
|
||||||
&VisualDeckStorageTagFilterWidget::refreshTags);
|
&VisualDeckStorageTagFilterWidget::refreshTags);
|
||||||
deckLoader->loadFromFileAsync(filePath, DeckLoader::getFormatFromName(filePath), false);
|
deckLoader->loadFromFileAsync(filePath, DeckLoader::getFormatFromName(filePath), false);
|
||||||
|
|
||||||
bannerCardDisplayWidget = new DeckPreviewCardPictureWidget(this);
|
bannerCardDisplayWidget =
|
||||||
|
new DeckPreviewCardPictureWidget(this, false, visualDeckStorageWidget->deckPreviewSelectionAnimationEnabled);
|
||||||
|
|
||||||
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageClicked, this,
|
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageClicked, this,
|
||||||
&DeckPreviewWidget::imageClickedEvent);
|
&DeckPreviewWidget::imageClickedEvent);
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,10 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
||||||
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
||||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
||||||
|
|
||||||
|
deckPreviewSelectionAnimationEnabled = SettingsCache::instance().getVisualDeckStorageSelectionAnimation();
|
||||||
|
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageSelectionAnimationChanged, this,
|
||||||
|
&VisualDeckStorageWidget::updateSelectionAnimationEnabled);
|
||||||
|
|
||||||
// deck area
|
// deck area
|
||||||
scrollArea = new QScrollArea(this);
|
scrollArea = new QScrollArea(this);
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
|
@ -270,4 +274,9 @@ void VisualDeckStorageWidget::updateTagsVisibility(const bool visible)
|
||||||
} else {
|
} else {
|
||||||
tagFilterWidget->setHidden(true);
|
tagFilterWidget->setHidden(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VisualDeckStorageWidget::updateSelectionAnimationEnabled(const bool enabled)
|
||||||
|
{
|
||||||
|
deckPreviewSelectionAnimationEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
@ -31,6 +31,7 @@ public:
|
||||||
|
|
||||||
CardSizeWidget *cardSizeWidget;
|
CardSizeWidget *cardSizeWidget;
|
||||||
VisualDeckStorageTagFilterWidget *tagFilterWidget;
|
VisualDeckStorageTagFilterWidget *tagFilterWidget;
|
||||||
|
bool deckPreviewSelectionAnimationEnabled;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createRootFolderWidget(); // Refresh the display of cards based on the current sorting option
|
void createRootFolderWidget(); // Refresh the display of cards based on the current sorting option
|
||||||
|
|
@ -39,6 +40,7 @@ public slots:
|
||||||
void updateColorFilter();
|
void updateColorFilter();
|
||||||
void updateSearchFilter();
|
void updateSearchFilter();
|
||||||
void updateTagsVisibility(bool visible);
|
void updateTagsVisibility(bool visible);
|
||||||
|
void updateSelectionAnimationEnabled(bool enabled);
|
||||||
void updateSortOrder();
|
void updateSortOrder();
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
|
||||||
|
|
@ -676,6 +676,11 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
connect(&visualDeckStorageInGameCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
connect(&visualDeckStorageInGameCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||||
&SettingsCache::setVisualDeckStorageInGame);
|
&SettingsCache::setVisualDeckStorageInGame);
|
||||||
|
|
||||||
|
visualDeckStorageSelectionAnimationCheckBox.setChecked(
|
||||||
|
SettingsCache::instance().getVisualDeckStorageSelectionAnimation());
|
||||||
|
connect(&visualDeckStorageSelectionAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||||
|
&SettingsCache::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("");
|
||||||
|
|
@ -697,8 +702,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
auto *deckEditorGrid = new QGridLayout;
|
auto *deckEditorGrid = new QGridLayout;
|
||||||
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
|
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
|
||||||
deckEditorGrid->addWidget(&visualDeckStorageInGameCheckBox, 1, 0);
|
deckEditorGrid->addWidget(&visualDeckStorageInGameCheckBox, 1, 0);
|
||||||
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionLabel, 2, 0);
|
deckEditorGrid->addWidget(&visualDeckStorageSelectionAnimationCheckBox, 2, 0);
|
||||||
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionSelector, 2, 1);
|
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionLabel, 3, 0);
|
||||||
|
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionSelector, 3, 1);
|
||||||
|
|
||||||
deckEditorGroupBox = new QGroupBox;
|
deckEditorGroupBox = new QGroupBox;
|
||||||
deckEditorGroupBox->setLayout(deckEditorGrid);
|
deckEditorGroupBox->setLayout(deckEditorGrid);
|
||||||
|
|
@ -759,6 +765,7 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
|
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
|
||||||
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
|
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
|
||||||
visualDeckStorageInGameCheckBox.setText(tr("Use visual deck storage in game lobby"));
|
visualDeckStorageInGameCheckBox.setText(tr("Use visual deck storage in game lobby"));
|
||||||
|
visualDeckStorageSelectionAnimationCheckBox.setText(tr("Use selection animation for Visual Deck Storage"));
|
||||||
visualDeckStoragePromptForConversionLabel.setText(
|
visualDeckStoragePromptForConversionLabel.setText(
|
||||||
tr("When adding a tag in the visual deck storage to a .txt deck:"));
|
tr("When adding a tag in the visual deck storage to a .txt deck:"));
|
||||||
visualDeckStoragePromptForConversionSelector.setItemText(visualDeckStoragePromptForConversionIndexNone,
|
visualDeckStoragePromptForConversionSelector.setItemText(visualDeckStoragePromptForConversionIndexNone,
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ private:
|
||||||
QLabel visualDeckStoragePromptForConversionLabel;
|
QLabel visualDeckStoragePromptForConversionLabel;
|
||||||
QComboBox visualDeckStoragePromptForConversionSelector;
|
QComboBox visualDeckStoragePromptForConversionSelector;
|
||||||
QCheckBox visualDeckStorageInGameCheckBox;
|
QCheckBox visualDeckStorageInGameCheckBox;
|
||||||
|
QCheckBox visualDeckStorageSelectionAnimationCheckBox;
|
||||||
QLabel rewindBufferingMsLabel;
|
QLabel rewindBufferingMsLabel;
|
||||||
QSpinBox rewindBufferingMsBox;
|
QSpinBox rewindBufferingMsBox;
|
||||||
QGroupBox *generalGroupBox;
|
QGroupBox *generalGroupBox;
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,8 @@ SettingsCache::SettingsCache()
|
||||||
settings->value("interface/visualdeckstoragepromptforconversion", true).toBool();
|
settings->value("interface/visualdeckstoragepromptforconversion", true).toBool();
|
||||||
visualDeckStorageAlwaysConvert = settings->value("interface/visualdeckstoragealwaysconvert", false).toBool();
|
visualDeckStorageAlwaysConvert = settings->value("interface/visualdeckstoragealwaysconvert", false).toBool();
|
||||||
visualDeckStorageInGame = settings->value("interface/visualdeckstorageingame", true).toBool();
|
visualDeckStorageInGame = settings->value("interface/visualdeckstorageingame", true).toBool();
|
||||||
|
visualDeckStorageSelectionAnimation =
|
||||||
|
settings->value("interface/visualdeckstorageselectionanimation", true).toBool();
|
||||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
||||||
|
|
@ -761,6 +763,13 @@ void SettingsCache::setVisualDeckStorageInGame(QT_STATE_CHANGED_T value)
|
||||||
emit visualDeckStorageInGameChanged(visualDeckStorageInGame);
|
emit visualDeckStorageInGameChanged(visualDeckStorageInGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T value)
|
||||||
|
{
|
||||||
|
visualDeckStorageSelectionAnimation = value;
|
||||||
|
settings->setValue("interface/visualdeckstorageselectionanimation", visualDeckStorageSelectionAnimation);
|
||||||
|
emit visualDeckStorageSelectionAnimationChanged(visualDeckStorageSelectionAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
||||||
{
|
{
|
||||||
horizontalHand = static_cast<bool>(_horizontalHand);
|
horizontalHand = static_cast<bool>(_horizontalHand);
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ signals:
|
||||||
void visualDeckStorageDrawUnusedColorIdentitiesChanged(bool _visible);
|
void visualDeckStorageDrawUnusedColorIdentitiesChanged(bool _visible);
|
||||||
void visualDeckStorageUnusedColorIdentitiesOpacityChanged(bool value);
|
void visualDeckStorageUnusedColorIdentitiesOpacityChanged(bool value);
|
||||||
void visualDeckStorageInGameChanged(bool enabled);
|
void visualDeckStorageInGameChanged(bool enabled);
|
||||||
|
void visualDeckStorageSelectionAnimationChanged(bool enabled);
|
||||||
void horizontalHandChanged();
|
void horizontalHandChanged();
|
||||||
void handJustificationChanged();
|
void handJustificationChanged();
|
||||||
void invertVerticalCoordinateChanged();
|
void invertVerticalCoordinateChanged();
|
||||||
|
|
@ -145,6 +146,7 @@ private:
|
||||||
bool visualDeckStoragePromptForConversion;
|
bool visualDeckStoragePromptForConversion;
|
||||||
bool visualDeckStorageAlwaysConvert;
|
bool visualDeckStorageAlwaysConvert;
|
||||||
bool visualDeckStorageInGame;
|
bool visualDeckStorageInGame;
|
||||||
|
bool visualDeckStorageSelectionAnimation;
|
||||||
bool horizontalHand;
|
bool horizontalHand;
|
||||||
bool invertVerticalCoordinate;
|
bool invertVerticalCoordinate;
|
||||||
int minPlayersForMultiColumnLayout;
|
int minPlayersForMultiColumnLayout;
|
||||||
|
|
@ -466,6 +468,10 @@ public:
|
||||||
{
|
{
|
||||||
return visualDeckStorageInGame;
|
return visualDeckStorageInGame;
|
||||||
}
|
}
|
||||||
|
bool getVisualDeckStorageSelectionAnimation() const
|
||||||
|
{
|
||||||
|
return visualDeckStorageSelectionAnimation;
|
||||||
|
}
|
||||||
bool getHorizontalHand() const
|
bool getHorizontalHand() const
|
||||||
{
|
{
|
||||||
return horizontalHand;
|
return horizontalHand;
|
||||||
|
|
@ -806,6 +812,7 @@ public slots:
|
||||||
void setVisualDeckStoragePromptForConversion(bool _visualDeckStoragePromptForConversion);
|
void setVisualDeckStoragePromptForConversion(bool _visualDeckStoragePromptForConversion);
|
||||||
void setVisualDeckStorageAlwaysConvert(bool _visualDeckStorageAlwaysConvert);
|
void setVisualDeckStorageAlwaysConvert(bool _visualDeckStorageAlwaysConvert);
|
||||||
void setVisualDeckStorageInGame(QT_STATE_CHANGED_T value);
|
void setVisualDeckStorageInGame(QT_STATE_CHANGED_T value);
|
||||||
|
void setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T value);
|
||||||
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
||||||
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
||||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,9 @@ void SettingsCache::setVisualDeckStorageAlwaysConvert(bool /* _visualDeckStorage
|
||||||
void SettingsCache::setVisualDeckStorageInGame(QT_STATE_CHANGED_T /* value */)
|
void SettingsCache::setVisualDeckStorageInGame(QT_STATE_CHANGED_T /* value */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */)
|
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,9 @@ void SettingsCache::setVisualDeckStorageAlwaysConvert(bool /* _visualDeckStorage
|
||||||
void SettingsCache::setVisualDeckStorageInGame(QT_STATE_CHANGED_T /* value */)
|
void SettingsCache::setVisualDeckStorageInGame(QT_STATE_CHANGED_T /* value */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */)
|
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue