summaryrefslogblamecommitdiff
path: root/networkingpage.cc
blob: c7860ffee2f563043267a2613333298ef7dc39d9 (plain) (tree)
1
2
3
4
5
6
7
8
9
                            
                           
 
                  
                 

                      
                                                                           
 
                          






















                                                                           
                                                                             

























                                                                                                              
 















                                                               
#include "networkingpage.hh"
#include "horizonwizard.hh"

#include <cstdint>
#include <QLabel>
#include <QVBoxLayout>

NetworkingPage::NetworkingPage(QWidget *parent) : HorizonWizardPage(parent)
{
        QLabel *descLabel;
        QVBoxLayout *layout;

        loadWatermark("network");
        setTitle(tr("Networking Setup"));

        descLabel = new QLabel(tr(
                    "If you have a normal network connection where your "
                    "computer is directly connected to the Internet via "
                    "Ethernet or Wi-Fi using a modem or router, choose "
                    "Simple.  If you have a more complicated network "
                    "configuration, you need to set a static IP address, "
                    "or you use a VPN, choose Advanced.\n\n"

                    "If you don't want to configure networking or you "
                    "don't want to use this computer on the Internet, "
                    "choose Skip."));
        descLabel->setWordWrap(true);

        simple = new QRadioButton(tr(
                 "&Simple - my computer connects to the Internet directly "
                 "or via a modem/router"));
        advanced = new QRadioButton(tr(
                   "&Advanced - my computer connects to an enterprise "
                   "network or I use a\nstatic IP address, VPN, or 802.1X"));
        skip = new QRadioButton(tr(
                   "S&kip - I don't want to connect to a network or the "
                   "Internet right now"));

        radioGroup = new QButtonGroup(this);
        radioGroup->addButton(simple);
        radioGroup->addButton(advanced);
        radioGroup->addButton(skip);

        QObject::connect(radioGroup, (void (QButtonGroup:: *)(QAbstractButton *))&QButtonGroup::buttonClicked,
                         [=](QAbstractButton *button) {
                emit completeChanged();
        });

        layout = new QVBoxLayout;
        layout->addWidget(descLabel);
        layout->addSpacing(50);
        layout->addWidget(simple);
        layout->addWidget(advanced);
        layout->addWidget(skip);
        setLayout(layout);
}

bool NetworkingPage::isComplete() const
{
        return (radioGroup->checkedButton() != nullptr);
}

int NetworkingPage::nextId() const
{
        if(radioGroup->checkedButton() == simple)
        {
                return HorizonWizard::Page_Network_SimpleWired;
        }
        else if(radioGroup->checkedButton() == advanced)
        {
                return HorizonWizard::Page_Network_Advanced;
        }
        else
        {
                return HorizonWizard::Page_Software;
        }
}