mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-24 15:43:54 -07:00
* [Counters] Split counters into graphics and logic states Took 22 minutes * Don't have widget hold pointer to state -> Copy what we need and subscribe to changes. Took 12 minutes Took 5 seconds * Sync value too. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
51 lines
987 B
C++
51 lines
987 B
C++
#ifndef COCKATRICE_COUNTER_STATE_H
|
|
#define COCKATRICE_COUNTER_STATE_H
|
|
|
|
#include <QColor>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <libcockatrice/protocol/pb/serverinfo_counter.pb.h>
|
|
|
|
class CounterState : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent = nullptr);
|
|
|
|
static CounterState *fromProto(const ServerInfo_Counter &counter, QObject *parent = nullptr);
|
|
|
|
int getId() const
|
|
{
|
|
return id;
|
|
}
|
|
QString getName() const
|
|
{
|
|
return name;
|
|
}
|
|
QColor getColor() const
|
|
{
|
|
return color;
|
|
}
|
|
int getRadius() const
|
|
{
|
|
return radius;
|
|
}
|
|
int getValue() const
|
|
{
|
|
return value;
|
|
}
|
|
|
|
void setValue(int newValue);
|
|
|
|
signals:
|
|
void valueChanged(int oldValue, int newValue);
|
|
|
|
private:
|
|
int id;
|
|
QString name;
|
|
QColor color;
|
|
int radius;
|
|
int value;
|
|
};
|
|
|
|
#endif // COCKATRICE_COUNTER_STATE_H
|