add a bunch of parents to dialogs (#3658)

* add a bunch of parents to dialogs

works on #3651

* use game as parent instead

* add more parents

* fix create token dialog modality

* add parent to game information window

* replace a bunch of nullptrs with the magic of sed

* add parent to tip of the day and counters

* reorder game ptr

* set parent for life counter

* clangify
This commit is contained in:
ebbit1q 2019-03-26 19:54:47 +01:00 committed by Zach H
parent 7072f24103
commit c874f201c3
66 changed files with 144 additions and 111 deletions

View file

@ -49,7 +49,10 @@ public:
{
return Type;
}
AbstractCardItem(const QString &_name = QString(), Player *_owner = 0, int _id = -1, QGraphicsItem *parent = 0);
AbstractCardItem(const QString &_name = QString(),
Player *_owner = nullptr,
int _id = -1,
QGraphicsItem *parent = nullptr);
~AbstractCardItem();
QRectF boundingRect() const;
QSizeF getTranslatedSize(QPainter *painter) const;

View file

@ -95,7 +95,7 @@ protected:
virtual void sendCommandContainer(const CommandContainer &cont) = 0;
public:
AbstractClient(QObject *parent = 0);
AbstractClient(QObject *parent = nullptr);
~AbstractClient();
ClientStatus getStatus() const

View file

@ -19,10 +19,11 @@ AbstractCounter::AbstractCounter(Player *_player,
bool _shownInCounterArea,
int _value,
bool _useNameForShortcut,
QGraphicsItem *parent)
QGraphicsItem *parent,
QWidget *_game)
: QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value),
useNameForShortcut(_useNameForShortcut), hovered(false), aDec(nullptr), aInc(nullptr), dialogSemaphore(false),
deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea)
deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea), game(_game)
{
setAcceptHoverEvents(true);
@ -163,7 +164,7 @@ void AbstractCounter::incrementCounter()
void AbstractCounter::setCounter()
{
dialogSemaphore = true;
AbstractCounterDialog dialog(name, QString::number(value));
AbstractCounterDialog dialog(name, QString::number(value), game);
const int ok = dialog.exec();
if (deleteAfterDialog) {
@ -184,7 +185,8 @@ void AbstractCounter::setCounter()
player->sendGameCommand(cmd);
}
AbstractCounterDialog::AbstractCounterDialog(const QString &name, const QString &value) : QInputDialog(nullptr)
AbstractCounterDialog::AbstractCounterDialog(const QString &name, const QString &value, QWidget *parent)
: QInputDialog(parent)
{
setWindowTitle(tr("Set counter"));
setLabelText(tr("New value for counter '%1':").arg(name));

View file

@ -32,6 +32,7 @@ private:
bool dialogSemaphore, deleteAfterDialog;
bool shownInCounterArea;
bool shortcutActive;
QWidget *game;
private slots:
void refreshShortcuts();
@ -45,7 +46,8 @@ public:
bool _shownInCounterArea,
int _value,
bool _useNameForShortcut = false,
QGraphicsItem *parent = nullptr);
QGraphicsItem *parent = nullptr,
QWidget *game = nullptr);
~AbstractCounter() override;
void retranslateUi();
@ -81,7 +83,7 @@ class AbstractCounterDialog : public QInputDialog
{
Q_OBJECT
public:
AbstractCounterDialog(const QString &name, const QString &value);
AbstractCounterDialog(const QString &name, const QString &value, QWidget *parent = nullptr);
protected:
bool eventFilter(QObject *obj, QEvent *event);

View file

@ -21,7 +21,7 @@ protected:
void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter);
public:
AbstractGraphicsItem(QGraphicsItem *parent = 0) : QObject(), QGraphicsItem(parent)
AbstractGraphicsItem(QGraphicsItem *parent = nullptr) : QObject(), QGraphicsItem(parent)
{
}
};

View file

@ -18,7 +18,7 @@ private:
QList<ArrowItem *> arrowsFrom, arrowsTo;
public:
ArrowTarget(Player *_owner, QGraphicsItem *parent = 0);
ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
~ArrowTarget();
Player *getOwner() const

View file

@ -17,7 +17,7 @@ private:
bool pixmapDirty;
public:
CardInfoPicture(QWidget *parent = 0);
CardInfoPicture(QWidget *parent = nullptr);
protected:
void resizeEvent(QResizeEvent *event);

View file

@ -52,7 +52,7 @@ public:
const QString &_name = QString(),
int _cardid = -1,
bool revealedCard = false,
QGraphicsItem *parent = 0);
QGraphicsItem *parent = nullptr);
~CardItem();
void retranslateUi();
CardZone *getZone() const

View file

@ -52,7 +52,7 @@ public:
bool _hasCardAttr,
bool _isShufflable,
bool _contentsKnown,
QGraphicsItem *parent = 0,
QGraphicsItem *parent = nullptr,
bool _isView = false);
~CardZone();
void retranslateUi();

View file

@ -73,7 +73,7 @@ public:
const UserlistProxy *_userlistProxy,
TabGame *_game,
bool _showTimestamps,
QWidget *parent = 0);
QWidget *parent = nullptr);
void retranslateUi();
void appendHtml(const QString &html);
void virtual appendHtmlServerMessage(const QString &html,

View file

@ -10,8 +10,10 @@ GeneralCounter::GeneralCounter(Player *_player,
int _radius,
int _value,
bool useNameForShortcut,
QGraphicsItem *parent)
: AbstractCounter(_player, _id, _name, true, _value, useNameForShortcut, parent), color(_color), radius(_radius)
QGraphicsItem *parent,
QWidget *game)
: AbstractCounter(_player, _id, _name, true, _value, useNameForShortcut, parent, game), color(_color),
radius(_radius)
{
setCacheMode(DeviceCoordinateCache);
}

View file

@ -18,7 +18,8 @@ public:
int _radius,
int _value,
bool useNameForShortcut = false,
QGraphicsItem *parent = 0);
QGraphicsItem *parent = nullptr,
QWidget *game = nullptr);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
};

View file

@ -30,7 +30,7 @@ private slots:
void getAnalyzeRequestData(DeckList *deck, QByteArray *data);
public:
DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = 0);
DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
void analyzeDeck(DeckList *deck);
};

View file

@ -24,7 +24,9 @@ private:
DeckViewCardDragItem *dragItem;
public:
DeckViewCard(const QString &_name = QString(), const QString &_originZone = QString(), QGraphicsItem *parent = 0);
DeckViewCard(const QString &_name = QString(),
const QString &_originZone = QString(),
QGraphicsItem *parent = nullptr);
~DeckViewCard();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
const QString &getOriginZone() const
@ -110,7 +112,7 @@ private:
void rebuildTree();
public:
DeckViewScene(QObject *parent = 0);
DeckViewScene(QObject *parent = nullptr);
~DeckViewScene();
void setLocked(bool _locked)
{
@ -147,7 +149,7 @@ signals:
void sideboardPlanChanged();
public:
DeckView(QWidget *parent = 0);
DeckView(QWidget *parent = nullptr);
void setDeck(const DeckList &_deck);
void setLocked(bool _locked)
{

View file

@ -21,7 +21,7 @@ class DlgCreateToken : public QDialog
{
Q_OBJECT
public:
DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = 0);
DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr);
QString getName() const;
QString getColor() const;
QString getPT() const;

View file

@ -20,8 +20,8 @@ class DlgCreateGame : public QDialog
{
Q_OBJECT
public:
DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameTypes, QWidget *parent = 0);
DlgCreateGame(const ServerInfo_Game &game, const QMap<int, QString> &_gameTypes, QWidget *parent = 0);
DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameTypes, QWidget *parent = nullptr);
DlgCreateGame(const ServerInfo_Game &game, const QMap<int, QString> &_gameTypes, QWidget *parent = nullptr);
private slots:
void actOK();
void actReset();

View file

@ -13,7 +13,7 @@ class DlgEditAvatar : public QDialog
{
Q_OBJECT
public:
DlgEditAvatar(QWidget *parent = 0);
DlgEditAvatar(QWidget *parent = nullptr);
QByteArray getImage();
private slots:
void actOk();

View file

@ -13,7 +13,7 @@ class DlgEditPassword : public QDialog
{
Q_OBJECT
public:
DlgEditPassword(QWidget *parent = 0);
DlgEditPassword(QWidget *parent = nullptr);
QString getOldPassword() const
{
return oldPasswordEdit->text();

View file

@ -13,7 +13,7 @@ class DlgEditUser : public QDialog
{
Q_OBJECT
public:
DlgEditUser(QWidget *parent = 0,
DlgEditUser(QWidget *parent = nullptr,
QString email = QString(),
QString country = QString(),
QString realName = QString());

View file

@ -35,7 +35,7 @@ private slots:
public:
DlgFilterGames(const QMap<int, QString> &_allGameTypes,
const GamesProxyModel *_gamesProxyModel,
QWidget *parent = 0);
QWidget *parent = nullptr);
bool getUnavailableGamesVisible() const;
void setUnavailableGamesVisible(bool _unavailableGamesVisible);

View file

@ -13,7 +13,7 @@ class DlgForgotPasswordChallenge : public QDialog
{
Q_OBJECT
public:
DlgForgotPasswordChallenge(QWidget *parent = 0);
DlgForgotPasswordChallenge(QWidget *parent = nullptr);
QString getHost() const
{
return hostEdit->text();

View file

@ -13,7 +13,7 @@ class DlgForgotPasswordRequest : public QDialog
{
Q_OBJECT
public:
DlgForgotPasswordRequest(QWidget *parent = 0);
DlgForgotPasswordRequest(QWidget *parent = nullptr);
QString getHost() const
{
return hostEdit->text();

View file

@ -13,7 +13,7 @@ class DlgForgotPasswordReset : public QDialog
{
Q_OBJECT
public:
DlgForgotPasswordReset(QWidget *parent = 0);
DlgForgotPasswordReset(QWidget *parent = nullptr);
QString getHost() const
{
return hostEdit->text();

View file

@ -20,7 +20,7 @@ private slots:
void currentItemChanged(const QModelIndex &current, const QModelIndex &previous);
public:
DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent = 0);
DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent = nullptr);
int getDeckId() const;
};

View file

@ -13,7 +13,7 @@ class DlgRegister : public QDialog
{
Q_OBJECT
public:
DlgRegister(QWidget *parent = 0);
DlgRegister(QWidget *parent = nullptr);
QString getHost() const
{
return hostEdit->text();

View file

@ -21,7 +21,7 @@ private:
void destroyFilter();
public:
FilterBuilder(QWidget *parent = 0);
FilterBuilder(QWidget *parent = nullptr);
~FilterBuilder();
signals:

View file

@ -27,7 +27,7 @@ private:
QModelIndex nodeIndex(const FilterTreeNode *node, int row, int column) const;
public:
FilterTreeModel(QObject *parent = 0);
FilterTreeModel(QObject *parent = nullptr);
~FilterTreeModel();
FilterTree *filterTree() const
{

View file

@ -33,7 +33,7 @@ private:
void updateHover(const QPointF &scenePos);
public:
GameScene(PhasesToolbar *_phasesToolbar, QObject *parent = 0);
GameScene(PhasesToolbar *_phasesToolbar, QObject *parent = nullptr);
~GameScene();
void retranslateUi();
void processViewSizeChange(const QSize &newSize);

View file

@ -47,7 +47,7 @@ public:
const QMap<int, GameTypeMap> &_gameTypes,
const bool restoresettings,
const bool showfilters,
QWidget *parent = 0);
QWidget *parent = nullptr);
void retranslateUi();
void processGameInfo(const ServerInfo_Game &info);
};

View file

@ -24,7 +24,7 @@ private:
public:
static const int SORT_ROLE = Qt::UserRole + 1;
GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = 0);
GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const
{
return parent.isValid() ? 0 : gameList.size();
@ -75,7 +75,7 @@ private:
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
public:
GamesProxyModel(QObject *parent = 0, bool _ownUserIsRegistered = false);
GamesProxyModel(QObject *parent = nullptr, bool _ownUserIsRegistered = false);
bool getShowBuddiesOnlyGames() const
{

View file

@ -24,7 +24,7 @@ public slots:
void updateSceneRect(const QRectF &rect);
public:
GameView(QGraphicsScene *scene, QWidget *parent = 0);
GameView(QGraphicsScene *scene, QWidget *parent = nullptr);
};
#endif

View file

@ -29,7 +29,7 @@ public:
{
return Type;
}
HandCounter(QGraphicsItem *parent = 0);
HandCounter(QGraphicsItem *parent = nullptr);
~HandCounter();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

@ -14,7 +14,7 @@ public slots:
void updateOrientation();
public:
HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = 0);
HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = nullptr);
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

@ -20,7 +20,7 @@ protected:
void focusOutEvent(QFocusEvent *e);
public:
explicit LineEditCompleter(QWidget *parent = 0);
explicit LineEditCompleter(QWidget *parent = nullptr);
void setCompleter(QCompleter *);
void setCompletionList(QStringList);
};

View file

@ -12,7 +12,10 @@ private:
LocalServerInterface *lsi;
public:
LocalClient(LocalServerInterface *_lsi, const QString &_playerName, const QString &_clientId, QObject *parent = 0);
LocalClient(LocalServerInterface *_lsi,
const QString &_playerName,
const QString &_clientId,
QObject *parent = nullptr);
~LocalClient();
void sendCommandContainer(const CommandContainer &cont);

View file

@ -10,7 +10,7 @@ class LocalServer : public Server
{
Q_OBJECT
public:
LocalServer(QObject *parent = 0);
LocalServer(QObject *parent = nullptr);
~LocalServer();
LocalServerInterface *newConnection();

View file

@ -13,7 +13,11 @@ private slots:
}
public:
PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent = 0);
PileZone(Player *_p,
const QString &_name,
bool _isShufflable,
bool _contentsKnown,
QGraphicsItem *parent = nullptr);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void reorganizeCards();

View file

@ -106,7 +106,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
playerArea = new PlayerArea(this);
playerTarget = new PlayerTarget(this, playerArea);
playerTarget = new PlayerTarget(this, playerArea, game);
qreal avatarMargin = (counterAreaWidth + CARD_HEIGHT + 15 - playerTarget->boundingRect().width()) / 2.0;
playerTarget->setPos(QPointF(avatarMargin, avatarMargin));
@ -553,7 +553,7 @@ void Player::playerListActionTriggered()
} else if (menu == mRevealTopCard) {
int decksize = zones.value("deck")->getCards().size();
bool ok;
int number = QInputDialog::getInt(nullptr, tr("Reveal top cards of library"),
int number = QInputDialog::getInt(game, tr("Reveal top cards of library"),
tr("Number of cards: (max. %1)").arg(decksize), defaultNumberTopCards, 1,
decksize, 1, &ok);
if (ok) {
@ -706,8 +706,9 @@ void Player::retranslateUi()
createPredefinedTokenMenu->setTitle(tr("Cr&eate predefined token"));
QMapIterator<int, AbstractCounter *> counterIterator(counters);
while (counterIterator.hasNext())
while (counterIterator.hasNext()) {
counterIterator.next().value()->retranslateUi();
}
aCardMenu->setText(tr("C&ard"));
@ -932,7 +933,7 @@ void Player::actViewLibrary()
void Player::actViewTopCards()
{
bool ok;
int number = QInputDialog::getInt(nullptr, tr("View top cards of library"), tr("Number of cards:"),
int number = QInputDialog::getInt(game, tr("View top cards of library"), tr("Number of cards:"),
defaultNumberTopCards, 1, 2000000000, 1, &ok);
if (ok) {
defaultNumberTopCards = number;
@ -1001,7 +1002,7 @@ void Player::actMulligan()
void Player::actDrawCards()
{
int number = QInputDialog::getInt(nullptr, tr("Draw cards"), tr("Number:"));
int number = QInputDialog::getInt(game, tr("Draw cards"), tr("Number:"));
if (number) {
Command_DrawCards cmd;
cmd.set_number(static_cast<google::protobuf::uint32>(number));
@ -1050,7 +1051,7 @@ void Player::actMoveTopCardToExile()
void Player::actMoveTopCardsToGrave()
{
int number = QInputDialog::getInt(nullptr, tr("Move top cards to grave"), tr("Number:"));
int number = QInputDialog::getInt(game, tr("Move top cards to grave"), tr("Number:"));
if (!number) {
return;
}
@ -1076,7 +1077,7 @@ void Player::actMoveTopCardsToGrave()
void Player::actMoveTopCardsToExile()
{
int number = QInputDialog::getInt(nullptr, tr("Move top cards to exile"), tr("Number:"));
int number = QInputDialog::getInt(game, tr("Move top cards to exile"), tr("Number:"));
if (!number) {
return;
}
@ -1155,8 +1156,7 @@ void Player::actUntapAll()
void Player::actRollDie()
{
bool ok;
int sides = QInputDialog::getInt(static_cast<QWidget *>(parent()), tr("Roll die"), tr("Number of sides:"), 20, 2,
1000, 1, &ok);
int sides = QInputDialog::getInt(game, tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
if (ok) {
Command_RollDie cmd;
cmd.set_sides(static_cast<google::protobuf::uint32>(sides));
@ -1166,7 +1166,7 @@ void Player::actRollDie()
void Player::actCreateToken()
{
DlgCreateToken dlg(predefinedTokens);
DlgCreateToken dlg(predefinedTokens, game);
if (!dlg.exec()) {
return;
}
@ -1329,8 +1329,8 @@ bool Player::createRelatedFromRelation(const CardItem *sourceCard, const CardRel
if (cardRelation->getIsVariable()) {
bool ok;
dialogSemaphore = true;
int count = QInputDialog::getInt(nullptr, tr("Create tokens"), tr("Number:"), cardRelation->getDefaultCount(),
1, MAX_TOKENS_PER_DIALOG, 1, &ok);
int count = QInputDialog::getInt(game, tr("Create tokens"), tr("Number:"), cardRelation->getDefaultCount(), 1,
MAX_TOKENS_PER_DIALOG, 1, &ok);
dialogSemaphore = false;
if (!ok) {
return false;
@ -1586,8 +1586,9 @@ void Player::eventCreateCounter(const Event_CreateCounter &event)
void Player::eventSetCounter(const Event_SetCounter &event)
{
AbstractCounter *ctr = counters.value(event.counter_id(), 0);
if (!ctr)
if (!ctr) {
return;
}
int oldValue = ctr->getValue();
ctr->setValue(event.value());
emit logSetCounter(this, ctr->getName(), event.value(), oldValue);
@ -2146,7 +2147,7 @@ AbstractCounter *Player::addCounter(int counterId, const QString &name, QColor c
if (name == "life") {
ctr = playerTarget->addCounter(counterId, name, value);
} else {
ctr = new GeneralCounter(this, counterId, name, color, radius, value, true, this);
ctr = new GeneralCounter(this, counterId, name, color, radius, value, true, this, game);
}
counters.insert(counterId, ctr);
if (countersMenu && ctr->getMenu()) {
@ -2346,7 +2347,7 @@ bool Player::clearCardsToDelete()
void Player::actMoveCardXCardsFromTop()
{
bool ok;
int number = QInputDialog::getInt(nullptr, tr("Place card X cards from top of library"),
int number = QInputDialog::getInt(game, tr("Place card X cards from top of library"),
tr("How many cards from the top of the deck should this card be placed:"),
defaultNumberTopCardsToPlaceBelow, 1, 2000000000, 1, &ok);
number--;
@ -2861,7 +2862,7 @@ void Player::actCardCounterTrigger()
auto *card = static_cast<CardItem *>(scene()->selectedItems().first());
oldValue = card->getCounters().value(counterId, 0);
}
int number = QInputDialog::getInt(nullptr, tr("Set counters"), tr("Number:"), oldValue, 0,
int number = QInputDialog::getInt(game, tr("Set counters"), tr("Number:"), oldValue, 0,
MAX_COUNTERS_ON_CARD, 1, &ok);
dialogSemaphore = false;
if (clearCardsToDelete() || !ok) {

View file

@ -69,8 +69,9 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor,
userContextMenu = new UserContextMenu(tabSupervisor, this, game);
connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this,
SIGNAL(openMessageDialog(QString, bool)));
} else
userContextMenu = 0;
} else {
userContextMenu = nullptr;
}
setMinimumHeight(40);
setIconSize(QSize(20, 15));

View file

@ -43,7 +43,7 @@ signals:
void openMessageDialog(const QString &userName, bool focus);
public:
PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, TabGame *_game, QWidget *parent = 0);
PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, TabGame *_game, QWidget *parent = nullptr);
void retranslateUi();
void addPlayer(const ServerInfo_PlayerProperties &player);
void removePlayer(int playerId);

View file

@ -10,8 +10,13 @@
#include "round.h"
#endif /* _WIN32 */
PlayerCounter::PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent)
: AbstractCounter(_player, _id, _name, false, _value, false, parent)
PlayerCounter::PlayerCounter(Player *_player,
int _id,
const QString &_name,
int _value,
QGraphicsItem *parent,
QWidget *game)
: AbstractCounter(_player, _id, _name, false, _value, false, parent, game)
{
}
@ -48,8 +53,8 @@ void PlayerCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*
painter->drawText(translatedRect, Qt::AlignCenter, QString::number(value));
}
PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem)
: ArrowTarget(_owner, parentItem), playerCounter(0)
PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem, QWidget *_game)
: ArrowTarget(_owner, parentItem), playerCounter(0), game(_game)
{
setCacheMode(DeviceCoordinateCache);
@ -150,7 +155,7 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name,
playerCounter->delCounter();
}
playerCounter = new PlayerCounter(owner, _counterId, _name, _value, this);
playerCounter = new PlayerCounter(owner, _counterId, _name, _value, this, game);
playerCounter->setPos(boundingRect().width() - playerCounter->boundingRect().width(),
boundingRect().height() - playerCounter->boundingRect().height());
connect(playerCounter, SIGNAL(destroyed()), this, SLOT(counterDeleted()));

View file

@ -12,7 +12,12 @@ class PlayerCounter : public AbstractCounter
{
Q_OBJECT
public:
PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent = 0);
PlayerCounter(Player *_player,
int _id,
const QString &_name,
int _value,
QGraphicsItem *parent = nullptr,
QWidget *game = nullptr);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
};
@ -23,6 +28,7 @@ class PlayerTarget : public ArrowTarget
private:
QPixmap fullPixmap;
PlayerCounter *playerCounter;
QWidget *game;
public slots:
void counterDeleted();
@ -36,7 +42,7 @@ public:
return Type;
}
PlayerTarget(Player *_player = 0, QGraphicsItem *parentItem = 0);
PlayerTarget(Player *_player = nullptr, QGraphicsItem *parentItem = nullptr, QWidget *_game = nullptr);
~PlayerTarget();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

@ -23,7 +23,7 @@ public:
QString name;
public:
Node(const QString &_name, DirectoryNode *_parent = 0) : parent(_parent), name(_name)
Node(const QString &_name, DirectoryNode *_parent = nullptr) : parent(_parent), name(_name)
{
}
virtual ~Node(){};
@ -39,7 +39,7 @@ public:
class DirectoryNode : public Node, public QList<Node *>
{
public:
DirectoryNode(const QString &_name = QString(), DirectoryNode *_parent = 0);
DirectoryNode(const QString &_name = QString(), DirectoryNode *_parent = nullptr);
~DirectoryNode();
void clearTree();
QString getPath() const;
@ -53,7 +53,7 @@ public:
QDateTime uploadTime;
public:
FileNode(const QString &_name, int _id, const QDateTime &_uploadTime, DirectoryNode *_parent = 0)
FileNode(const QString &_name, int _id, const QDateTime &_uploadTime, DirectoryNode *_parent = nullptr)
: Node(_name, _parent), id(_id), uploadTime(_uploadTime)
{
}
@ -87,7 +87,7 @@ private slots:
void deckListFinished(const Response &r);
public:
RemoteDeckList_TreeModel(AbstractClient *_client, QObject *parent = 0);
RemoteDeckList_TreeModel(AbstractClient *_client, QObject *parent = nullptr);
~RemoteDeckList_TreeModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const;
@ -115,7 +115,7 @@ private:
QSortFilterProxyModel *proxyModel;
public:
RemoteDeckList_TreeWidget(AbstractClient *_client, QWidget *parent = 0);
RemoteDeckList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr);
RemoteDeckList_TreeModel::Node *getNode(const QModelIndex &ind) const;
RemoteDeckList_TreeModel::Node *getCurrentItem() const;
RemoteDeckList_TreeModel::DirectoryNode *getNodeByPath(const QString &path) const;

View file

@ -81,7 +81,7 @@ private slots:
void replayListFinished(const Response &r);
public:
RemoteReplayList_TreeModel(AbstractClient *_client, QObject *parent = 0);
RemoteReplayList_TreeModel(AbstractClient *_client, QObject *parent = nullptr);
~RemoteReplayList_TreeModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const
@ -109,7 +109,7 @@ private:
ServerInfo_Replay const *getNode(const QModelIndex &ind) const;
public:
RemoteReplayList_TreeWidget(AbstractClient *_client, QWidget *parent = 0);
RemoteReplayList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr);
ServerInfo_Replay const *getCurrentReplay() const;
ServerInfo_ReplayMatch const *getCurrentReplayMatch() const;
void refreshTree();

View file

@ -20,7 +20,7 @@ public:
bool _hasCardAttr,
bool _isShufflable,
bool _contentsKnown,
QGraphicsItem *parent = 0,
QGraphicsItem *parent = nullptr,
bool isView = false);
};

View file

@ -55,7 +55,7 @@ public:
SortRole = Qt::UserRole
};
SetsModel(CardDatabase *_db, QObject *parent = 0);
SetsModel(CardDatabase *_db, QObject *parent = nullptr);
~SetsModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const

View file

@ -15,7 +15,7 @@ class SoundEngine : public QObject
{
Q_OBJECT
public:
SoundEngine(QObject *parent = 0);
SoundEngine(QObject *parent = nullptr);
~SoundEngine();
void playSound(QString fileName);
QStringMap &getAvailableThemes();

View file

@ -12,7 +12,7 @@ private slots:
void updateBg();
public:
StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = 0);
StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = nullptr);
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

@ -31,7 +31,7 @@ private:
QList<QMenu *> tabMenus;
public:
Tab(TabSupervisor *_tabSupervisor, QWidget *parent = 0);
Tab(TabSupervisor *_tabSupervisor, QWidget *parent = nullptr);
const QList<QMenu *> &getTabMenus() const
{
return tabMenus;

View file

@ -19,7 +19,7 @@ private:
QSpinBox *minutesEdit;
public:
ShutdownDialog(QWidget *parent = 0);
ShutdownDialog(QWidget *parent = nullptr);
QString getReason() const;
int getMinutes() const;
};
@ -45,7 +45,7 @@ private slots:
void actLock();
public:
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin, QWidget *parent = 0);
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin, QWidget *parent = nullptr);
void retranslateUi();
QString getTabText() const
{

View file

@ -836,7 +836,7 @@ void TabDeckEditor::actLoadDeckFromClipboard()
if (!confirmClose())
return;
DlgLoadDeckFromClipboard dlg;
DlgLoadDeckFromClipboard dlg(this);
if (!dlg.exec())
return;

View file

@ -264,7 +264,7 @@ void DeckViewContainer::loadLocalDeck()
void DeckViewContainer::loadRemoteDeck()
{
DlgLoadRemoteDeck dlg(parentGame->getClientForPlayer(playerId));
DlgLoadRemoteDeck dlg(parentGame->getClientForPlayer(playerId), this);
if (dlg.exec()) {
Command_DeckSelect cmd;
cmd.set_deck_id(dlg.getDeckId());
@ -621,7 +621,7 @@ bool TabGame::isSpectator()
void TabGame::actGameInfo()
{
DlgCreateGame dlg(gameInfo, roomGameTypes);
DlgCreateGame dlg(gameInfo, roomGameTypes, this);
dlg.exec();
}

View file

@ -69,7 +69,7 @@ signals:
void stateChanged();
public:
ToggleButton(QWidget *parent = 0);
ToggleButton(QWidget *parent = nullptr);
bool getState() const
{
return state;

View file

@ -52,7 +52,7 @@ private slots:
void restartLayout();
public:
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0);
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = nullptr);
~TabLog();
void retranslateUi();
QString getTabText() const

View file

@ -33,7 +33,7 @@ signals:
void joinRoomRequest(int, bool setCurrent);
public:
RoomSelector(AbstractClient *_client, QWidget *parent = 0);
RoomSelector(AbstractClient *_client, QWidget *parent = nullptr);
void retranslateUi();
};
@ -54,7 +54,7 @@ private:
bool shouldEmitUpdate = false;
public:
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0);
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = nullptr);
void retranslateUi();
QString getTabText() const
{

View file

@ -43,7 +43,7 @@ class CloseButton : public QAbstractButton
{
Q_OBJECT
public:
CloseButton(QWidget *parent = 0);
CloseButton(QWidget *parent = nullptr);
QSize sizeHint() const;
inline QSize minimumSizeHint() const
{
@ -81,7 +81,7 @@ private:
bool isLocalGame;
public:
TabSupervisor(AbstractClient *_client, QWidget *parent = 0);
TabSupervisor(AbstractClient *_client, QWidget *parent = nullptr);
~TabSupervisor();
void retranslateUi();
void start(const ServerInfo_User &userInfo);

View file

@ -49,7 +49,7 @@ public:
TabUserLists(TabSupervisor *_tabSupervisor,
AbstractClient *_client,
const ServerInfo_User &userInfo,
QWidget *parent = 0);
QWidget *parent = nullptr);
void retranslateUi();
QString getTabText() const
{

View file

@ -98,7 +98,7 @@ public:
@param _p the Player
@param parent defaults to null
*/
TableZone(Player *_p, QGraphicsItem *parent = 0);
TableZone(Player *_p, QGraphicsItem *parent = nullptr);
/**
@return a QRectF of the TableZone bounding box.

View file

@ -29,7 +29,7 @@ private slots:
void getAnalyzeRequestData(DeckList *deck, QByteArray *data);
public:
TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = 0);
TappedOutInterface(CardDatabase &_cardDatabase, QObject *parent = nullptr);
void analyzeDeck(DeckList *deck);
};

View file

@ -16,7 +16,7 @@ class ThemeManager : public QObject
{
Q_OBJECT
public:
ThemeManager(QObject *parent = 0);
ThemeManager(QObject *parent = nullptr);
private:
QBrush handBgBrush, stackBgBrush, tableBgBrush, playerBgBrush;

View file

@ -90,10 +90,12 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon
gameTypeMap.insert(roomInfo.room_id(), tempMap);
}
GameSelector *selector = new GameSelector(client, tabSupervisor, 0, roomMap, gameTypeMap, false, false);
GameSelector *selector = new GameSelector(client, tabSupervisor, nullptr, roomMap, gameTypeMap, false, false);
selector->setParent(static_cast<QWidget *>(parent()), Qt::Window);
const int gameListSize = response.game_list_size();
for (int i = 0; i < gameListSize; ++i)
for (int i = 0; i < gameListSize; ++i) {
selector->processGameInfo(response.game_list(i));
}
selector->setWindowTitle(tr("%1's games").arg(QString::fromStdString(cmd.user_name())));
selector->setMinimumWidth(800);

View file

@ -20,7 +20,7 @@ private:
QPushButton editButton, passwordButton, avatarButton;
public:
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = 0, Qt::WindowFlags flags = 0);
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
void retranslateUi();
private slots:
void processResponse(const Response &r);

View file

@ -37,7 +37,7 @@ private slots:
void enableTemporaryEdits(bool enabled);
public:
BanDialog(const ServerInfo_User &info, QWidget *parent = 0);
BanDialog(const ServerInfo_User &info, QWidget *parent = nullptr);
QString getBanName() const;
QString getBanIP() const;
QString getBanId() const;
@ -58,7 +58,7 @@ private slots:
void okClicked();
public:
WarningDialog(const QString userName, const QString clientID, QWidget *parent = 0);
WarningDialog(const QString userName, const QString clientID, QWidget *parent = nullptr);
QString getName() const;
QString getWarnID() const;
QString getReason() const;
@ -122,7 +122,7 @@ signals:
void removeIgnore(const QString &userName);
public:
UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserListType _type, QWidget *parent = 0);
UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserListType _type, QWidget *parent = nullptr);
void retranslateUi();
void processUserInfo(const ServerInfo_User &user, bool online);
bool deleteUser(const QString &userName);

View file

@ -322,7 +322,7 @@ void MainWindow::actTips()
delete tip;
tip = nullptr;
}
tip = new DlgTipOfTheDay();
tip = new DlgTipOfTheDay(this);
if (tip->successfulInit) {
tip->show();
}
@ -1268,14 +1268,13 @@ int MainWindow::getNextCustomSetPrefix(QDir dataDir)
void MainWindow::actManageSets()
{
wndSets = new WndSets;
wndSets->setWindowModality(Qt::WindowModal);
wndSets = new WndSets(this);
wndSets->show();
}
void MainWindow::actEditTokens()
{
DlgEditTokens dlg;
DlgEditTokens dlg(this);
dlg.exec();
db->saveCustomTokensToFile();
}

View file

@ -49,7 +49,7 @@ private:
};
public:
WndSets(QWidget *parent = 0);
WndSets(QWidget *parent = nullptr);
~WndSets();
protected:

View file

@ -28,7 +28,7 @@ public:
int _numberCards = -1,
bool _revealZone = false,
bool _writeableRevealZone = false,
QGraphicsItem *parent = 0);
QGraphicsItem *parent = nullptr);
~ZoneViewZone();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);