Cockatrice/cockatrice/src/interface/widgets/general/home_widget.h
Lukas Brübach 0909d356e0 Various fixes
Took 14 minutes
2026-11-02 21:52:40 +01:00

79 lines
2.2 KiB
C++

/**
* @file home_widget.h
* @ingroup Core
* @ingroup Widgets
*/
//! \todo Document this file.
#ifndef HOME_WIDGET_H
#define HOME_WIDGET_H
#include "libcockatrice/deck_list/deck_list.h"
#include <QColor>
#include <QPair>
#include <QPixmap>
#include <QWidget>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <qtmetamacros.h>
class QGridLayout;
class QLabel;
class CardInfoPictureArtCropWidget;
class ExactCard;
class HomeStyledButton;
class QGroupBox;
class QTimer;
class TabSupervisor;
class TutorialController;
class TutorialController;
class HomeWidget : public QWidget
{
Q_OBJECT
public:
HomeWidget(QWidget *parent, TabSupervisor *tabSupervisor);
void updateRandomCard();
void retranslateUi();
static QPair<QColor, QColor> extractDominantColors(const QPixmap &pixmap);
public slots:
void paintEvent(QPaintEvent *event) override;
void showEvent(QShowEvent *event) override;
void initializeBackgroundFromSource();
void onBackgroundShuffleFrequencyChanged();
void updateBackgroundProperties();
void updateButtonsToBackgroundColor();
QGroupBox *createButtons();
void updateConnectButton(const ClientStatus status);
private:
QGridLayout *layout;
QTimer *cardChangeTimer;
TabSupervisor *tabSupervisor;
QPixmap background;
TutorialController *tutorialController;
bool tutorialStarted = false;
CardInfoPictureArtCropWidget *backgroundSourceCard = nullptr;
DeckList backgroundSourceDeck;
QLabel *logoLabel = nullptr;
QPair<QColor, QColor> gradientColors;
HomeStyledButton *connectButton = nullptr;
HomeStyledButton *visualDeckEditorButton = nullptr;
HomeStyledButton *visualDeckStorageButton = nullptr;
HomeStyledButton *visualDatabaseDisplayButton = nullptr;
HomeStyledButton *edhrecButton = nullptr;
HomeStyledButton *archidektButton = nullptr;
HomeStyledButton *replayButton = nullptr;
HomeStyledButton *exitButton = nullptr;
ClientStatus connectionStatus = StatusDisconnected;
void setRandomCard(ExactCard &newCard);
void loadBackgroundSourceDeck();
QPair<QColor, QColor> determineButtonColor() const;
void updateLogoOverlay();
};
#endif // HOME_WIDGET_H