From abc0d2c1d6c187ca89e3a747c1471134ee1fd581 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 9 Feb 2020 05:49:25 -0600 Subject: Qt UI: Initial work for backend support of manual net config --- ui/qt5/horizonwizard.cc | 28 +++++++++++++++++++++++++--- ui/qt5/horizonwizard.hh | 17 +++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index fc5f4dc..6128d2b 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -191,6 +191,8 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { binsh = Dash; sbininit = S6; eudev = true; + ipv4.use = false; + ipv6.use = false; /* REQ: UI.Global.Back.Save */ setOption(IndependentPages); @@ -335,8 +337,28 @@ QString HorizonWizard::toHScript() { lines << QString::fromStdString("netaddress " + this->chosen_auto_iface + " dhcp"); } else { - /* XXX TODO no manual page implemented yet */ - Q_ASSERT(false); + Q_ASSERT(this->ipv6.use || this->ipv4.use); + + if(this->ipv6.use) { + QString addrL = QString::fromStdString("netaddress " + + this->chosen_auto_iface); + addrL += " static " + this->ipv6.address + " " + this->ipv6.mask; + if(this->ipv6.gateway.size() > 0) { + addrL += " " + this->ipv6.gateway; + } + lines << addrL; + lines << ("nameserver " + this->ipv6.dns); + } + if(this->ipv4.use) { + QString addrL = QString::fromStdString("netaddress " + + this->chosen_auto_iface); + addrL += " static " + this->ipv4.address + " " + this->ipv4.mask; + if(this->ipv4.gateway.size() > 0) { + addrL += " " + this->ipv4.gateway; + } + lines << addrL; + lines << ("nameserver " + this->ipv4.dns); + } } } else { lines << "network false"; @@ -400,7 +422,7 @@ QString HorizonWizard::toHScript() { switch(this->pkgtype) { case Mobile: - lines << "pkginstall powerdevil upower"; + lines << "pkginstall pm-utils pm-quirks powerdevil upower"; #if __cplusplus >= 201703L [[ fallthrough ]]; #endif diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh index 04facda..6c6d781 100644 --- a/ui/qt5/horizonwizard.hh +++ b/ui/qt5/horizonwizard.hh @@ -78,6 +78,19 @@ public: QString mac; }; + struct NetworkConfig { + /*! Whether to use this configuration or not. */ + bool use; + /*! The IP address. */ + QString address; + /*! The subnet mask (v4) / prefix length (v6). */ + QString mask; + /*! The default gateway to use. */ + QString gateway; + /*! The DNS server to use. */ + QString dns; + }; + enum Arch { aarch64, armv7, @@ -142,6 +155,10 @@ public: bool network; /*! Determines whether to use DHCP. */ bool net_dhcp; + /*! If not DHCP, possibly contains IPv4 info. */ + NetworkConfig ipv4; + /*! If not DHCP, possibly contains IPv6 info. */ + NetworkConfig ipv6; /*! Determines whether to install GRUB. */ bool grub; /*! Determines whether to install eudev. */ -- cgit v1.2.3-60-g2f50