2024-05-31 12:10:00 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QQuickView>
|
|
|
|
#include <QtGui/qwindow.h>
|
|
|
|
#include <qobject.h>
|
2024-06-01 07:11:29 +01:00
|
|
|
#include <qqmlintegration.h>
|
2024-05-31 12:10:00 +01:00
|
|
|
#include <qtmetamacros.h>
|
|
|
|
|
2024-06-01 07:11:29 +01:00
|
|
|
|
2024-05-31 12:10:00 +01:00
|
|
|
class PlayerAreaModel : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2024-06-01 07:11:29 +01:00
|
|
|
QML_NAMED_ELEMENT(PlayerAreaModel)
|
|
|
|
QML_SINGLETON
|
2024-05-31 12:10:00 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
Q_PROPERTY(uint focusedPlayer READ focusedPlayer WRITE setFocusedPlayer NOTIFY focusedPlayerChanged)
|
|
|
|
|
2024-05-31 12:10:00 +01:00
|
|
|
public:
|
|
|
|
explicit PlayerAreaModel(QObject *parent = nullptr);
|
2024-06-01 13:19:32 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
uint focusedPlayer();
|
|
|
|
void setFocusedPlayer(int n);
|
|
|
|
|
2024-06-01 07:11:29 +01:00
|
|
|
enum BetType {
|
2024-06-02 21:13:43 +01:00
|
|
|
NONE,
|
2024-06-01 07:11:29 +01:00
|
|
|
RED,
|
|
|
|
BLACK,
|
|
|
|
ODD,
|
|
|
|
EVEN,
|
|
|
|
LOW,
|
|
|
|
HIGH,
|
|
|
|
DOZEN,
|
|
|
|
STREET,
|
|
|
|
SINGLE,
|
2024-06-04 21:10:39 +01:00
|
|
|
COLUMN,
|
2024-06-01 07:11:29 +01:00
|
|
|
SPLIT
|
|
|
|
};
|
|
|
|
Q_ENUM(BetType)
|
2024-05-31 12:10:00 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
signals:
|
|
|
|
void focusedPlayerChanged(BetType b1, uint n1, BetType b2, uint n2);
|
2024-06-06 21:54:59 +01:00
|
|
|
void betChanged(BetType b, int n, int bet);
|
|
|
|
void betRemoved(BetType b, int n);
|
2024-06-04 21:10:39 +01:00
|
|
|
void betCanceled(BetType b, uint n);
|
2024-06-02 21:13:43 +01:00
|
|
|
|
2024-05-31 12:34:47 +01:00
|
|
|
public slots:
|
|
|
|
void setPlayerName(QString s, int n);
|
2024-06-02 09:34:59 +01:00
|
|
|
void bet(BetType b, int n, int bet);
|
2024-06-02 21:13:43 +01:00
|
|
|
void removeBet(BetType b, int n);
|
2024-06-01 13:19:32 +01:00
|
|
|
QString getPlayerName(int n);
|
2024-06-04 21:10:39 +01:00
|
|
|
void cancelBet(BetType b, int n);
|
2024-06-01 13:19:32 +01:00
|
|
|
|
2024-05-31 12:34:47 +01:00
|
|
|
|
2024-05-31 12:10:00 +01:00
|
|
|
private:
|
2024-06-01 13:19:32 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
struct Bet {
|
|
|
|
uint betValue = 0;
|
|
|
|
BetType betType = NONE;
|
|
|
|
uint betSpot = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Player {
|
|
|
|
QString playerName = "";
|
|
|
|
Bet bet1;
|
|
|
|
Bet bet2;
|
|
|
|
};
|
|
|
|
|
|
|
|
QList<Player> players;
|
|
|
|
|
|
|
|
int focusedPlayer_;
|
2024-05-31 12:10:00 +01:00
|
|
|
};
|