author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 01 Apr 2019 17:33:43 +0200 | |
changeset 14751 | 5631c81217dc |
parent 13676 | 05fde8e30041 |
permissions | -rw-r--r-- |
8377 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
8377 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8377 | 17 |
*/ |
18 |
||
19 |
#include <QDialog> |
|
20 |
#include <QVBoxLayout> |
|
21 |
#include <QHBoxLayout> |
|
22 |
#include <QPushButton> |
|
23 |
#include <QLineEdit> |
|
24 |
#include <QLabel> |
|
25 |
#include <QDebug> |
|
26 |
||
27 |
#include "seedprompt.h" |
|
28 |
||
29 |
SeedPrompt::SeedPrompt(QWidget* parent, const QString & seed, bool editable) : QDialog(parent) |
|
30 |
{ |
|
8434 | 31 |
setModal(true); |
32 |
setWindowFlags(Qt::Sheet); |
|
33 |
setWindowModality(Qt::WindowModal); |
|
13676
05fde8e30041
Add a few translator comments for frontend strings
Wuzzy <Wuzzy2@mail.ru>
parents:
11490
diff
changeset
|
34 |
//: Refers to the "random seed"; the source of randomness in the game |
11490
fb7817a5c2b1
Add window titles for title-less windows
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
35 |
setWindowTitle(tr("Seed")); |
8434 | 36 |
setMinimumSize(360, 160); |
37 |
resize(360, 160); |
|
38 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
|
8377 | 39 |
|
8434 | 40 |
// Layout |
41 |
QVBoxLayout * dialogLayout = new QVBoxLayout(this); |
|
8377 | 42 |
|
8434 | 43 |
// Label |
44 |
QLabel * label = new QLabel(tr("The map seed is the basis for all random values generated by the game.")); |
|
45 |
label->setWordWrap(true); |
|
46 |
dialogLayout->addWidget(label, 0); |
|
8377 | 47 |
|
8434 | 48 |
// Input box |
49 |
editBox = new QLineEdit(); |
|
50 |
editBox->setText(seed); |
|
51 |
editBox->setReadOnly(!editable); |
|
52 |
editBox->setStyleSheet("QLineEdit { padding: 3px; }"); |
|
53 |
dialogLayout->addWidget(editBox, 1); |
|
8377 | 54 |
|
8434 | 55 |
dialogLayout->addStretch(1); |
8377 | 56 |
|
8434 | 57 |
// Buttons |
58 |
QHBoxLayout * buttonLayout = new QHBoxLayout(); |
|
59 |
buttonLayout->addStretch(1); |
|
60 |
dialogLayout->addLayout(buttonLayout); |
|
61 |
if (editable) |
|
62 |
{ |
|
63 |
QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
|
64 |
QPushButton * btnOkay = new QPushButton(tr("Set seed")); |
|
65 |
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
|
66 |
connect(btnOkay, SIGNAL(clicked()), this, SLOT(accept())); |
|
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9080
diff
changeset
|
67 |
#ifdef Q_OS_MAC |
8434 | 68 |
buttonLayout->addWidget(btnCancel); |
69 |
buttonLayout->addWidget(btnOkay); |
|
8622
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8434
diff
changeset
|
70 |
#else |
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8434
diff
changeset
|
71 |
buttonLayout->addWidget(btnOkay); |
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8434
diff
changeset
|
72 |
buttonLayout->addWidget(btnCancel); |
2045bdf1b11b
Resolves issue 528. Fixed platform-specific order of buttons on seed prompt and new room prompt. Fixed height of back button on all pages -- now aligns to bottom. On pagemain, feedback and dlc buttons no longer fixed size.
dag10
parents:
8434
diff
changeset
|
73 |
#endif |
8434 | 74 |
btnOkay->setDefault(true); |
75 |
} |
|
76 |
else |
|
77 |
{ |
|
78 |
QPushButton * btnClose = new QPushButton(tr("Close")); |
|
79 |
connect(btnClose, SIGNAL(clicked()), this, SLOT(reject())); |
|
80 |
buttonLayout->addWidget(btnClose); |
|
81 |
btnClose->setDefault(true); |
|
82 |
} |
|
8377 | 83 |
|
8434 | 84 |
setStyleSheet("QPushButton { padding: 5px; }"); |
8377 | 85 |
|
8434 | 86 |
connect(this, SIGNAL(accepted()), this, SLOT(setSeed())); |
8377 | 87 |
} |
88 |
||
89 |
void SeedPrompt::setSeed() |
|
90 |
{ |
|
8434 | 91 |
emit seedSelected(editBox->text()); |
8386 | 92 |
} |