From e1dc77db8d340d86f279b32c3d126c29f4286263 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 1 Dec 2019 18:03:17 -0600 Subject: Qt UI: Implement UI.Network.AddressType.MaybeNotDisable --- ui/qt5/networkingpage.cc | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'ui/qt5/networkingpage.cc') diff --git a/ui/qt5/networkingpage.cc b/ui/qt5/networkingpage.cc index aac4b70..54fe9f3 100644 --- a/ui/qt5/networkingpage.cc +++ b/ui/qt5/networkingpage.cc @@ -13,6 +13,9 @@ #include "networkingpage.hh" #include "horizonwizard.hh" +#ifdef HAS_INSTALL_ENV +# include +#endif /* HAS_INSTALL_ENV */ #include #include @@ -38,7 +41,11 @@ void NetworkingPage::initializePage() { } descLabel->setWordWrap(true); - if(!horizonWizard()->interfaces.empty()) { +#ifdef HAS_INSTALL_ENV + /* The interface list will be empty if we're in a Runtime Environment. */ + if(!horizonWizard()->interfaces.empty()) +#endif /* HAS_INSTALL_ENV */ + { simple = new QRadioButton(tr("&Automatic - my computer connects to the Internet directly\n" "or via a modem/router.")); advanced = new QRadioButton(tr("&Manual - my computer connects to an enterprise network,\n" @@ -77,6 +84,38 @@ void NetworkingPage::initializePage() { layout->addWidget(advanced); } layout->addWidget(skip); + +#ifdef HAS_INSTALL_ENV + /* REQ: UI.Network.AddressType.MaybeNotDisable + * + * If we are running in an Installation Environment, we know we require + * networking if /packages doesn't exist, because this is a live-only + * media. If we are running in a Runtime Environment, we always require + * networking because we set the mirror as distfiles.adelielinux.org. + * + * This may change in the future, when we have mirror selection + * implemented; we may have a way to do "local" mirrors. + */ + if(!QDir("/packages").exists()) +#endif /* HAS_INSTALL_ENV */ + { + QLabel *warnIcon = new QLabel; + warnIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(16, 16))); + warnIcon->setMaximumSize(QSize(16, 16)); + + QLabel *warnLabel = new QLabel(tr("Networking cannot be skipped because a network connection is required to install packages.")); + warnLabel->setWordWrap(true); + + QHBoxLayout *warnLayout = new QHBoxLayout; + warnLayout->addSpacing(32); + warnLayout->addWidget(warnIcon); + warnLayout->addWidget(warnLabel); + + layout->addLayout(warnLayout); + + skip->setEnabled(false); + } + setLayout(layout); } -- cgit v1.2.3-60-g2f50