Cockatrice/libcockatrice_settings/libcockatrice/settings/visual_deck_storage_settings.h
Lukas Brübach bb23bc0aa3 [DeckShare] Browse and open public decks with loading, error and accessibility states
Add a public-decks tab that lists decks published by other users using the
server's deck visibility feature, previewing each deck's banner card, color
identity, tags and upload time without downloading the deck list until the
user opens it.

- Add a public-decks tab with a shared-settings widget and a remote model
  that fetches the target user's decks and refreshes both automatically and
  on user request, with a loading indicator and a server-error message
  instead of a blank tab when the fetch fails or the connection drops
- Render each deck as a focusable preview tile whose banner, color identity,
  tags and upload time follow the existing Preview settings, with the deck
  name announced as the tile's accessible name and Space/Enter opening the
  deck, mirroring the shared-deck preview tile
- Show a message box when opening a public deck fails or arrives corrupted
- Publish and unpublish decks from the server storage toolbar and context
  menu, toggling the deck's own visibility bit (what the server persists)
  rather than the inherited effective state, and batch the visibility
  refresh until the last in-flight change is acknowledged
- Add the Show Upload Time setting so the tile's upload stamp can be hidden
  like the other preview details
- Update the retranslateUi wiring for the new public-decks tab and rename
  the share action tooltip from "Deck share" to "Share link"
2026-09-19 08:24:01 +02:00

74 lines
4 KiB
C++

#ifndef VISUAL_DECK_STORAGE_SETTINGS_H
#define VISUAL_DECK_STORAGE_SETTINGS_H
#include "settings_manager.h"
#include <QStringList>
#include <libcockatrice/interfaces/interface_visual_deck_storage_settings_provider.h>
class VisualDeckStorageSettings : public SettingsManager, public IVisualDeckStorageSettingsProvider
{
Q_OBJECT
friend class SettingsCache;
public:
[[nodiscard]] int getVisualDeckStorageSortingOrder() const override;
[[nodiscard]] bool getVisualDeckStorageShowFolders() const override;
[[nodiscard]] bool getVisualDeckStorageShowTagFilter() const override;
[[nodiscard]] QStringList getVisualDeckStorageDefaultTagsList() const override;
[[nodiscard]] bool getVisualDeckStorageSearchFolderNames() const override;
[[nodiscard]] bool getVisualDeckStorageShowColorIdentity() const override;
[[nodiscard]] bool getVisualDeckStorageShowBannerCardComboBox() const override;
[[nodiscard]] bool getVisualDeckStorageShowTagsOnDeckPreviews() const override;
[[nodiscard]] bool getVisualDeckStorageShowUploadTime() const;
[[nodiscard]] bool getVisualDeckStorageDrawUnusedColorIdentities() const override;
[[nodiscard]] int getVisualDeckStorageUnusedColorIdentitiesOpacity() const override;
[[nodiscard]] int getVisualDeckStorageTooltipType() const override;
[[nodiscard]] bool getVisualDeckStoragePromptForConversion() const override;
[[nodiscard]] bool getVisualDeckStorageAlwaysConvert() const override;
[[nodiscard]] bool getVisualDeckStorageInGame() const override;
[[nodiscard]] bool getVisualDeckStorageSelectionAnimation() const override;
[[nodiscard]] bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const override;
[[nodiscard]] int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const override;
void setVisualDeckStorageSortingOrder(int _sortingOrder);
void setVisualDeckStorageShowFolders(bool value);
void setVisualDeckStorageShowTagFilter(bool _showTags);
void setVisualDeckStorageDefaultTagsList(QStringList _defaultTagsList);
void setVisualDeckStorageSearchFolderNames(bool value);
void setVisualDeckStorageShowColorIdentity(bool value);
void setVisualDeckStorageShowBannerCardComboBox(bool _showBannerCardComboBox);
void setVisualDeckStorageShowTagsOnDeckPreviews(bool _showTags);
void setVisualDeckStorageShowUploadTime(bool value);
void setVisualDeckStorageDrawUnusedColorIdentities(bool _draw);
void setVisualDeckStorageUnusedColorIdentitiesOpacity(int _opacity);
void setVisualDeckStorageTooltipType(int value);
void setVisualDeckStoragePromptForConversion(bool _prompt);
void setVisualDeckStorageAlwaysConvert(bool _always);
void setVisualDeckStorageInGame(bool enabled);
void setVisualDeckStorageSelectionAnimation(bool enabled);
void setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(bool _enabled);
void setVisualDatabaseDisplayFilterToMostRecentSetsAmount(int _amount);
signals:
void visualDeckStorageShowTagFilterChanged(bool _visible);
void visualDeckStorageDefaultTagsListChanged();
void visualDeckStorageShowColorIdentityChanged(bool _visible);
void visualDeckStorageShowBannerCardComboBoxChanged(bool _visible);
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
void visualDeckStorageShowUploadTimeChanged(bool _visible);
void visualDeckStorageDrawUnusedColorIdentitiesChanged(bool _visible);
void visualDeckStorageUnusedColorIdentitiesOpacityChanged(bool value);
void visualDeckStorageInGameChanged(bool enabled);
void visualDeckStorageSelectionAnimationChanged(bool enabled);
void visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged(bool enabled);
void visualDatabaseDisplayFilterToMostRecentSetsAmountChanged(int amount);
public:
explicit VisualDeckStorageSettings(const QString &settingPath, QObject *parent = nullptr);
private:
VisualDeckStorageSettings(const VisualDeckStorageSettings & /*other*/);
};
#endif // VISUAL_DECK_STORAGE_SETTINGS_H