Freeciv21
Develop your civilization from humble roots to a global empire
page_main.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 1996-2022 Freeciv21 and Freeciv contributors. This file is
3  part of Freeciv21. Freeciv21 is free software: you can redistribute it
4  and/or modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation, either version 3 of the
6  License, or (at your option) any later version. You should have received
7  a copy of the GNU General Public License along with Freeciv21. If not,
8  see https://www.gnu.org/licenses/.
9  */
10 
11 #include "page_main.h"
12 // utility
13 #include "fcintl.h"
14 // common
15 #include "version.h"
16 // client
17 #include "fc_client.h"
18 
19 page_main::page_main(QWidget *parent, fc_client *gui) : QWidget(parent)
20 {
21  ui.setupUi(this);
22  ui.btut->setText(_("Tutorial"));
23  ui.bstart->setText(_("Start new game"));
24  ui.bscenario->setText(_("Start scenario game"));
25  ui.boptions->setText(_("Options"));
26  ui.bload->setText(_("Load saved game"));
27  ui.bconnect->setText(_("Connect to network game"));
28  ui.bquit->setText(_("Quit"));
29  ui.bmods->setText(_("Mods"));
30 
31  connect(ui.btut, &QAbstractButton::clicked, gui,
33  connect(ui.bstart, &QAbstractButton::clicked, gui,
35  connect(ui.bmods, &QAbstractButton::clicked, gui,
37  connect(ui.bscenario, &QPushButton::clicked,
38  [gui]() { gui->switch_page(PAGE_SCENARIO); });
39  connect(ui.boptions, &QAbstractButton::clicked,
40  [=]() { popup_client_options(); });
41  connect(ui.bquit, &QAbstractButton::clicked, qApp, &QApplication::quit);
42  connect(ui.bconnect, &QPushButton::clicked,
43  [gui]() { gui->switch_page(PAGE_NETWORK); });
44  connect(ui.bload, &QPushButton::clicked,
45  [gui]() { gui->switch_page(PAGE_LOAD); });
46 
47  // TRANS: "Version 2.6.0"
48  ui.lversion->setText(QString(_("Version %1")).arg(freeciv21_version()));
49  setLayout(ui.gridLayout);
50 }
51 
52 page_main::~page_main() = default;
void load_modpack()
Load the modpack-installer from the start menu.
Definition: fc_client.cpp:695
void start_tutorial()
start tutorial
Definition: fc_client.cpp:649
void start_new_game()
spawn a server, if there isn't one, using the default settings.
Definition: fc_client.cpp:685
Ui::Form ui
Definition: page_main.h:24
page_main(QWidget *, fc_client *)
Definition: page_main.cpp:19
~page_main() override
#define _(String)
Definition: fcintl.h:50
static mpgui * gui
Definition: mpgui_qt.cpp:47
const char * freeciv21_version()
Returns the raw version string.
Definition: version.cpp:29