mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 08:24:39 -07:00
* [Game] Playmats Took 19 seconds Took 1 minute * [Playmats] Add fixed override and configurable fallbacks to settings. Took 29 minutes Took 43 seconds * Add main to test. Took 1 minute Took 29 seconds * Move settings to own group Took 11 minutes * Some attempts to refresh macOS compositor Took 2 minutes * Try something else Took 17 minutes * Don't manipulate live list Took 11 minutes * Change things about resolution, address comments. Took 45 minutes Took 12 minutes * Comments. Took 14 minutes Took 8 seconds * Re-order settings menu location Took 2 minutes * Rename PlaymatResolution to Info and add enums Took 8 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
102 lines
2.7 KiB
C++
102 lines
2.7 KiB
C++
/**
|
|
* @file deck_view_container.h
|
|
* @ingroup Lobby
|
|
*/
|
|
//! \todo Document this file.
|
|
|
|
#ifndef DECK_VIEW_CONTAINER_H
|
|
#define DECK_VIEW_CONTAINER_H
|
|
|
|
#include "../../interface/deck_loader/deck_loader.h"
|
|
|
|
#include <QPushButton>
|
|
|
|
class QVBoxLayout;
|
|
class AbstractCardItem;
|
|
class VisualDeckStorageWidget;
|
|
class DeckPreviewWidget;
|
|
class Response;
|
|
class TabGame;
|
|
class DeckView;
|
|
|
|
/**
|
|
* Custom QButton implementation in order to have the red/green toggling square around the button
|
|
*/
|
|
class ToggleButton : public QPushButton
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
bool state;
|
|
signals:
|
|
void stateChanged();
|
|
|
|
public:
|
|
explicit ToggleButton(QWidget *parent = nullptr);
|
|
[[nodiscard]] bool getState() const
|
|
{
|
|
return state;
|
|
}
|
|
void setState(bool _state);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
};
|
|
|
|
/**
|
|
* This widget contains the deck selection view that is used before a game begins.
|
|
*/
|
|
class DeckViewContainer : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QVBoxLayout *deckViewLayout;
|
|
QPushButton *loadLocalButton, *loadRemoteButton, *loadFromClipboardButton, *loadFromWebsiteButton;
|
|
QPushButton *unloadDeckButton, *forceStartGameButton;
|
|
ToggleButton *readyStartButton, *sideboardLockButton;
|
|
DeckView *deckView;
|
|
VisualDeckStorageWidget *visualDeckStorageWidget;
|
|
TabGame *parentGame;
|
|
int playerId;
|
|
int playmatRotationIndex = 0; ///< Per-match cursor for round-robin playmat mode.
|
|
DeckList currentDeck; ///< Cached deck for live settings re-resolution.
|
|
PlaymatInfo lastResolvedPlaymat; ///< Tracks last sent playmat to avoid repeats in random mode.
|
|
|
|
void tryCreateVisualDeckStorageWidget();
|
|
void sendReadyStartCommand(bool ready);
|
|
private slots:
|
|
void switchToDeckSelectView();
|
|
void switchToDeckLoadedView();
|
|
void loadLocalDeck();
|
|
void loadRemoteDeck();
|
|
void loadFromClipboard();
|
|
void loadFromWebsite();
|
|
void unloadDeck();
|
|
void readyStart();
|
|
void forceStart();
|
|
void deckSelectFinished(const Response &r);
|
|
void sideboardPlanChanged();
|
|
void sideboardLockButtonClicked();
|
|
void updateSideboardLockButtonText();
|
|
void refreshShortcuts();
|
|
void onPlaymatSettingsChanged();
|
|
signals:
|
|
void newCardAdded(AbstractCardItem *card);
|
|
void notIdle();
|
|
|
|
public:
|
|
DeckViewContainer(int _playerId, TabGame *parent);
|
|
void retranslateUi();
|
|
void setReadyStart(bool ready);
|
|
void readyAndUpdate();
|
|
void setSideboardLocked(bool locked);
|
|
void setDeck(const DeckList &deck);
|
|
void setVisualDeckStorageExists(bool exists);
|
|
void advancePlaymatRotation();
|
|
void resolveAndSendPlaymat();
|
|
|
|
public slots:
|
|
void loadDeckFromFile(const QString &filePath);
|
|
void loadDeckFromDeckList(const DeckList &deck);
|
|
};
|
|
|
|
#endif // DECK_VIEW_CONTAINER_H
|