From a724bc15414f0fc1eaf66b82199e0aac3d18705a Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 1 Dec 2019 17:48:27 -0600 Subject: Qt UI: Drastically simplify Runtime Env NIC selection, keep DHCP setting --- ui/qt5/horizonwizard.cc | 3 --- ui/qt5/horizonwizard.hh | 4 +--- ui/qt5/networkifacepage.cc | 39 ++++++++++++++++++++++++++++++++++++--- ui/qt5/networkifacepage.hh | 8 ++++++++ ui/qt5/networkingpage.cc | 14 +++++++++++--- 5 files changed, 56 insertions(+), 12 deletions(-) (limited to 'ui/qt5') diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index 19b4083..bde4232 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -52,9 +52,6 @@ static std::map help_id_map = { #ifdef NON_LIBRE_FIRMWARE {HorizonWizard::Page_Firmware, "firmware"}, #endif /* NON_LIBRE_FIRMWARE */ -#ifndef HAS_INSTALL_ENV - {HorizonWizard::Page_Network_Define, "network-define"}, -#endif /* !HAS_INSTALL_ENV */ {HorizonWizard::Page_Network, "network-start"}, {HorizonWizard::Page_Network_Iface, "network-iface"}, {HorizonWizard::Page_Network_Wireless, "network-wifi"}, diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh index 6fe71f2..929c598 100644 --- a/ui/qt5/horizonwizard.hh +++ b/ui/qt5/horizonwizard.hh @@ -40,9 +40,6 @@ public: #ifdef NON_LIBRE_FIRMWARE Page_Firmware, /* firmware */ #endif /* NON_LIBRE_FIRMWARE */ -#ifndef HAS_INSTALL_ENV - Page_Network_Define, /* define network interfaces for target */ -#endif /* !HAS_INSTALL_ENV */ Page_Network, /* network type selection (DHCP/static) */ Page_Network_Iface, /* network interface selection */ Page_Network_Wireless, /* wireless */ @@ -95,6 +92,7 @@ public: #endif /* NON_LIBRE_FIRMWARE */ std::map interfaces; bool network; + bool net_dhcp; std::string chosen_auto_iface; PackageType pkgtype; bool grub; diff --git a/ui/qt5/networkifacepage.cc b/ui/qt5/networkifacepage.cc index 3fbd6e5..9eecefd 100644 --- a/ui/qt5/networkifacepage.cc +++ b/ui/qt5/networkifacepage.cc @@ -23,7 +23,8 @@ NetworkIfacePage::NetworkIfacePage(QWidget *parent) : HorizonWizardPage(parent) { loadWatermark("network"); - setTitle(tr("Multiple Network Interfaces Detected")); +#ifdef HAS_INSTALL_ENV + setTitle(tr("Multiple Network Devices Detected")); ifaceList = new QListWidget(this); connect(ifaceList, &QListWidget::currentRowChanged, [=](int row) { @@ -37,15 +38,27 @@ NetworkIfacePage::NetworkIfacePage(QWidget *parent) : ifaceList->setGridSize(QSize(160, 128)); ifaceList->setIconSize(QSize(96, 96)); ifaceList->setViewMode(QListView::IconMode); - ifaceList->setWhatsThis(tr("A list of network interfaces present in your computer. Select the interface you wish to use for installation.")); + ifaceList->setWhatsThis(tr("This is a list of network devices available in your computer. Select the network device you wish to use for installation.")); +#else + setTitle(tr("Enter Network Device Name")); + + ifaceName = new QLineEdit(this); + ifaceName->setPlaceholderText(tr("Network Device Name (i.e. eth0)")); + ifaceName->setWhatsThis(tr("Enter the name of the computer's network device. For example, eth0.")); + connect(ifaceName, &QLineEdit::textEdited, [=]{ + emit completeChanged(); + horizonWizard()->chosen_auto_iface = ifaceName->text().toStdString(); + }); +#endif } void NetworkIfacePage::initializePage() { QLabel *descLabel; QVBoxLayout *layout; +#ifdef HAS_INSTALL_ENV descLabel = new QLabel(tr( - "Your computer has more than one network interface device. Select the one you wish to use during installation.")); + "Your computer has more than one network device. Select the one you wish to use during installation.")); descLabel->setWordWrap(true); for(auto &iface : horizonWizard()->interfaces) { @@ -76,18 +89,33 @@ void NetworkIfacePage::initializePage() { ifaceList); item->setToolTip(iface.second.mac); } +#else + descLabel = new QLabel(tr("Enter the name of the network device you will use on this computer.")); + descLabel->setWordWrap(true); +#endif /* HAS_INSTALL_ENV */ layout = new QVBoxLayout; layout->addWidget(descLabel); +#ifdef HAS_INSTALL_ENV layout->addWidget(ifaceList); +#else + layout->addStretch(); + layout->addWidget(ifaceName); + layout->addStretch(); +#endif /* HAS_INSTALL_ENV */ setLayout(layout); } bool NetworkIfacePage::isComplete() const { +#ifdef HAS_INSTALL_ENV return ifaceList->currentRow() != -1; +#else + return ifaceName->text().size() > 0; +#endif /* HAS_INSTALL_ENV */ } int NetworkIfacePage::nextId() const { +#ifdef HAS_INSTALL_ENV if(ifaceList->currentRow() < 0) return HorizonWizard::Page_Network_Iface; auto iterator = horizonWizard()->interfaces.begin(); @@ -99,14 +127,19 @@ int NetworkIfacePage::nextId() const { default: return HorizonWizard::Page_Network_DHCP; } +#else + return HorizonWizard::Page_DateTime; +#endif /* HAS_INSTALL_ENV */ } bool NetworkIfacePage::validatePage() { +#ifdef HAS_INSTALL_ENV /* What a hack! * * Independent Pages means the DHCP page is never cleaned, even when Back * is chosen. So, we have to do it from here. */ horizonWizard()->removePage(HorizonWizard::Page_Network_DHCP); horizonWizard()->setPage(HorizonWizard::Page_Network_DHCP, new NetDHCPPage); +#endif /* HAS_INSTALL_ENV */ return true; } diff --git a/ui/qt5/networkifacepage.hh b/ui/qt5/networkifacepage.hh index d9141e9..148c25c 100644 --- a/ui/qt5/networkifacepage.hh +++ b/ui/qt5/networkifacepage.hh @@ -13,7 +13,11 @@ #ifndef NETWORKIFACEPAGE_HH #define NETWORKIFACEPAGE_HH +#ifdef HAS_INSTALL_ENV #include +#else +#include +#endif /* HAS_INSTALL_ENV */ #include "horizonwizardpage.hh" @@ -25,7 +29,11 @@ public: int nextId() const override; bool validatePage() override; private: +#ifdef HAS_INSTALL_ENV QListWidget *ifaceList; +#else + QLineEdit *ifaceName; +#endif /* HAS_INSTALL_ENV */ }; #endif /* !NETWORKIFACEPAGE_HH */ diff --git a/ui/qt5/networkingpage.cc b/ui/qt5/networkingpage.cc index 15fea56..aac4b70 100644 --- a/ui/qt5/networkingpage.cc +++ b/ui/qt5/networkingpage.cc @@ -55,8 +55,16 @@ void NetworkingPage::initializePage() { QObject::connect(radioGroup, static_cast(&QButtonGroup::buttonClicked), [=](QAbstractButton *button) { - if(button == skip) horizonWizard()->network = false; - else horizonWizard()->network = true; + if(button == skip) { + horizonWizard()->network = false; + } else { + horizonWizard()->network = true; + if(button == simple) { + horizonWizard()->net_dhcp = true; + } else { + horizonWizard()->net_dhcp = false; + } + } emit completeChanged(); }); @@ -78,7 +86,7 @@ bool NetworkingPage::isComplete() const { int NetworkingPage::nextId() const { if(radioGroup->checkedButton() == simple) { - if(horizonWizard()->interfaces.size() > 1) { + if(horizonWizard()->interfaces.size() != 1) { return HorizonWizard::Page_Network_Iface; } else { horizonWizard()->chosen_auto_iface = -- cgit v1.2.3-60-g2f50