* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
#ifndef COUNTER_H
|
|
#define COUNTER_H
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
class Player;
|
|
class QMenu;
|
|
class QAction;
|
|
|
|
class AbstractCounter : public QObject, public QGraphicsItem
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(QGraphicsItem)
|
|
protected:
|
|
Player *player;
|
|
int id;
|
|
QString name;
|
|
int value;
|
|
bool useNameForShortcut, hovered;
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
private:
|
|
QAction *aSet, *aDec, *aInc;
|
|
QMenu *menu;
|
|
bool dialogSemaphore, deleteAfterDialog;
|
|
bool shownInCounterArea;
|
|
private slots:
|
|
void refreshShortcuts();
|
|
void incrementCounter();
|
|
void setCounter();
|
|
|
|
public:
|
|
AbstractCounter(Player *_player,
|
|
int _id,
|
|
const QString &_name,
|
|
bool _shownInCounterArea,
|
|
int _value,
|
|
bool _useNameForShortcut = false,
|
|
QGraphicsItem *parent = 0);
|
|
~AbstractCounter();
|
|
|
|
QMenu *getMenu() const
|
|
{
|
|
return menu;
|
|
}
|
|
void retranslateUi();
|
|
|
|
int getId() const
|
|
{
|
|
return id;
|
|
}
|
|
QString getName() const
|
|
{
|
|
return name;
|
|
}
|
|
bool getShownInCounterArea() const
|
|
{
|
|
return shownInCounterArea;
|
|
}
|
|
int getValue() const
|
|
{
|
|
return value;
|
|
}
|
|
void setValue(int _value);
|
|
void delCounter();
|
|
|
|
void setShortcutsActive();
|
|
void setShortcutsInactive();
|
|
bool shortcutActive;
|
|
};
|
|
|
|
#endif
|