summaryrefslogtreecommitdiff
path: root/horizonwizard.cc
blob: 7ab4899292a845ca60bc90dcd4cad44da9c99fdc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "horizonwizard.hh"
#include "horizonhelpwindow.hh"

#include <QFile>
#include <map>
#include <string>

#include "welcomepage.hh"
#ifndef NOT_NATIVE
#       include <horizon/networkinterface.hh>
using Horizon::NetworkInterface;
#endif
#include "networkingpage.hh"
#include "softwarepage.hh"

using std::map;
using std::string;

map<int, string> help_id_map = {
        {HorizonWizard::Page_Welcome, "welcome"},
        {HorizonWizard::Page_Networking, "network-start"},
        {HorizonWizard::Page_Network_SimpleWireless, "network-wifi"},
        {HorizonWizard::Page_Network_SimpleWired, "network-wired"},
        {HorizonWizard::Page_Network_Advanced, "network-advanced"},
        {HorizonWizard::Page_Software, "software"},
        {HorizonWizard::Page_AdvancedSoftware, "software-advanced"},
        {HorizonWizard::Page_Startup, "startup"},
        {HorizonWizard::Page_Commit, "commit"},
        {HorizonWizard::Page_Save, "save"},
        {HorizonWizard::Page_Finished, "finished"}
};

HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent)
{
        setWindowTitle(tr("Adélie Linux System Installation"));

        setFixedSize(QSize(700, 450));

        setOption(DisabledBackButtonOnLastPage);
        setOption(HaveHelpButton);
        setOption(NoCancelButtonOnLastPage);

        setSizeGripEnabled(false);

        setPage(Page_Welcome, new WelcomePage);
        setPage(Page_Networking, new NetworkingPage);
        setPage(Page_Software, new SoftwarePage);

        QObject::connect(this, (void (QWizard:: *)(void))&QWizard::helpRequested,
                         [=](void) {
                string helppath = ":/wizard_help/resources/" +
                                  help_id_map.at(currentId()) + "-help.txt";
                QFile helpfile(helppath.c_str());
                helpfile.open(QFile::ReadOnly);
                HorizonHelpWindow help(&helpfile, this);
                help.exec();
        });

        this->selected.insert("adelie-base");
#ifndef NOT_NATIVE
        this->interfaces = NetworkInterface::list_available_ifs();
#endif
}