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

@ -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));