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; 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(); ~AbstractCardItem();
QRectF boundingRect() const; QRectF boundingRect() const;
QSizeF getTranslatedSize(QPainter *painter) const; QSizeF getTranslatedSize(QPainter *painter) const;

View file

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

View file

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

View file

@ -32,6 +32,7 @@ private:
bool dialogSemaphore, deleteAfterDialog; bool dialogSemaphore, deleteAfterDialog;
bool shownInCounterArea; bool shownInCounterArea;
bool shortcutActive; bool shortcutActive;
QWidget *game;
private slots: private slots:
void refreshShortcuts(); void refreshShortcuts();
@ -45,7 +46,8 @@ public:
bool _shownInCounterArea, bool _shownInCounterArea,
int _value, int _value,
bool _useNameForShortcut = false, bool _useNameForShortcut = false,
QGraphicsItem *parent = nullptr); QGraphicsItem *parent = nullptr,
QWidget *game = nullptr);
~AbstractCounter() override; ~AbstractCounter() override;
void retranslateUi(); void retranslateUi();
@ -81,7 +83,7 @@ class AbstractCounterDialog : public QInputDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
AbstractCounterDialog(const QString &name, const QString &value); AbstractCounterDialog(const QString &name, const QString &value, QWidget *parent = nullptr);
protected: protected:
bool eventFilter(QObject *obj, QEvent *event); 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); void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter);
public: 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; QList<ArrowItem *> arrowsFrom, arrowsTo;
public: public:
ArrowTarget(Player *_owner, QGraphicsItem *parent = 0); ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
~ArrowTarget(); ~ArrowTarget();
Player *getOwner() const Player *getOwner() const

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ public slots:
void updateOrientation(); void updateOrientation();
public: 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); void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
QRectF boundingRect() const; QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

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

View file

@ -12,7 +12,10 @@ private:
LocalServerInterface *lsi; LocalServerInterface *lsi;
public: 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(); ~LocalClient();
void sendCommandContainer(const CommandContainer &cont); void sendCommandContainer(const CommandContainer &cont);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ private slots:
void updateBg(); void updateBg();
public: 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); void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
QRectF boundingRect() const; QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -98,7 +98,7 @@ public:
@param _p the Player @param _p the Player
@param parent defaults to null @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. @return a QRectF of the TableZone bounding box.

View file

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

View file

@ -16,7 +16,7 @@ class ThemeManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
ThemeManager(QObject *parent = 0); ThemeManager(QObject *parent = nullptr);
private: private:
QBrush handBgBrush, stackBgBrush, tableBgBrush, playerBgBrush; 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); 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(); 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->processGameInfo(response.game_list(i));
}
selector->setWindowTitle(tr("%1's games").arg(QString::fromStdString(cmd.user_name()))); selector->setWindowTitle(tr("%1's games").arg(QString::fromStdString(cmd.user_name())));
selector->setMinimumWidth(800); selector->setMinimumWidth(800);

View file

@ -20,7 +20,7 @@ private:
QPushButton editButton, passwordButton, avatarButton; QPushButton editButton, passwordButton, avatarButton;
public: 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(); void retranslateUi();
private slots: private slots:
void processResponse(const Response &r); void processResponse(const Response &r);

View file

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

View file

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

View file

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

View file

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