15 * along with this program; if not, write to the Free Software |
15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 */ |
17 */ |
18 |
18 |
19 #include <QGridLayout> |
19 #include <QGridLayout> |
|
20 #include <QHBoxLayout> |
20 #include <QPushButton> |
21 #include <QPushButton> |
21 #include <QLabel> |
22 #include <QLabel> |
22 #include <QTime> |
23 #include <QTime> |
23 |
24 |
24 #include "pagemain.h" |
25 #include "pagemain.h" |
25 #include "hwconsts.h" |
26 #include "hwconsts.h" |
26 #include "hwform.h" |
27 #include "hwform.h" |
27 |
28 |
28 PageMain::PageMain(QWidget* parent) : |
29 QLayout * PageMain::bodyLayoutDefinition() |
29 AbstractPage(parent) |
|
30 { |
30 { |
31 if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); |
31 QGridLayout * pageLayout = new QGridLayout(); |
32 QGridLayout * pageLayout = new QGridLayout(this); |
|
33 //pageLayout->setColumnStretch(0, 1); |
32 //pageLayout->setColumnStretch(0, 1); |
34 //pageLayout->setColumnStretch(1, 2); |
33 //pageLayout->setColumnStretch(1, 2); |
35 //pageLayout->setColumnStretch(2, 1); |
34 //pageLayout->setColumnStretch(2, 1); |
36 |
35 |
37 //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
36 //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
39 pageLayout->setRowStretch(0, 1); |
38 pageLayout->setRowStretch(0, 1); |
40 pageLayout->setRowStretch(1, 1); |
39 pageLayout->setRowStretch(1, 1); |
41 pageLayout->setRowStretch(2, 0); |
40 pageLayout->setRowStretch(2, 0); |
42 pageLayout->setRowStretch(3, 1); |
41 pageLayout->setRowStretch(3, 1); |
43 pageLayout->setRowStretch(4, 1); |
42 pageLayout->setRowStretch(4, 1); |
44 pageLayout->setRowStretch(5, 1); |
43 |
|
44 //BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
|
45 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
46 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
|
47 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
45 |
48 |
46 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
49 BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
47 BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
50 BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
48 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
51 pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
49 |
52 |
52 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
55 pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
53 |
56 |
54 BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 4, 0, 1, 4, false); |
57 BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 4, 0, 1, 4, false); |
55 pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); |
58 pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); |
56 |
59 |
|
60 return pageLayout; |
|
61 } |
|
62 |
|
63 QLayout * PageMain::footerLayoutDefinition() |
|
64 { |
|
65 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
|
66 |
57 mainNote = new QLabel(this); |
67 mainNote = new QLabel(this); |
58 mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
68 mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
59 mainNote->setWordWrap(true); |
69 mainNote->setWordWrap(true); |
|
70 |
|
71 bottomLayout->addWidget(mainNote, 0); |
|
72 bottomLayout->setStretch(0,1); |
|
73 |
|
74 BtnSetup = addButton(":/res/Settings.png", bottomLayout, 1, true); |
|
75 bottomLayout->setStretch(1,0); |
|
76 |
|
77 return bottomLayout; |
|
78 } |
|
79 |
|
80 void PageMain::connectSignals() |
|
81 { |
|
82 //TODO |
|
83 } |
|
84 |
|
85 PageMain::PageMain(QWidget* parent) : AbstractPage(parent) |
|
86 { |
|
87 initPage(); |
|
88 |
|
89 if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); |
60 mainNote->setOpenExternalLinks(true); |
90 mainNote->setOpenExternalLinks(true); |
61 |
91 |
62 if(!isDevBuild) |
92 if(!isDevBuild) |
63 { |
93 { |
64 QStringList Tips; |
94 mainNote->setText(QLabel::tr("Tip: ") + randomTip()); |
|
95 } |
|
96 else |
|
97 mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!")); |
|
98 |
|
99 } |
|
100 |
|
101 QString PageMain::randomTip() const |
|
102 { |
|
103 QStringList Tips; |
65 Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips"); |
104 Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips"); |
66 Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips"); |
105 Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips"); |
67 Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips"); |
106 Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips"); |
68 Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips"); |
107 Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips"); |
69 Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips"); |
108 Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips"); |
113 Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips"); |
152 Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips"); |
114 #ifdef _WIN32 |
153 #ifdef _WIN32 |
115 Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
154 Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
116 #elif defined __APPLE__ |
155 #elif defined __APPLE__ |
117 Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
156 Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
118 #else |
157 #else |
119 Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
158 Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); |
120 #endif |
159 #endif |
121 mainNote->setText(QLabel::tr("Tip: ") + Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]); |
|
122 } |
|
123 else |
|
124 mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!")); |
|
125 |
160 |
126 pageLayout->addWidget(mainNote, 5, 1, 1, 2); |
161 return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]; |
127 |
|
128 BtnSetup = addButton(":/res/Settings.png", pageLayout, 5, 3, true); |
|
129 |
|
130 //BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
|
131 BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
132 BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
|
133 pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
|
134 //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
|
135 |
|
136 BtnExit = addButton(":/res/Exit.png", pageLayout, 5, 0, 1, 1, true); |
|
137 BtnExit->setFixedHeight(BtnSetup->height()); |
|
138 BtnExit->setStyleSheet("QPushButton{margin-top: 2px;}"); |
|
139 } |
162 } |