diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-10 01:56:18 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-10 01:56:18 -0600 |
commit | a960999ec41917860c72591de8c072c060f71e0a (patch) | |
tree | 1ab8112bf3b77a804acbc66977080948d9ea0044 /ui/qt5/networkifacepage.cc | |
parent | 3b4ce3c25eac554499564b1946bc732a7c0bb69c (diff) | |
download | horizon-a960999ec41917860c72591de8c072c060f71e0a.tar.gz horizon-a960999ec41917860c72591de8c072c060f71e0a.tar.bz2 horizon-a960999ec41917860c72591de8c072c060f71e0a.tar.xz horizon-a960999ec41917860c72591de8c072c060f71e0a.zip |
Qt UI: Add draft for UI.Network.ChooseIface
Diffstat (limited to 'ui/qt5/networkifacepage.cc')
-rw-r--r-- | ui/qt5/networkifacepage.cc | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/ui/qt5/networkifacepage.cc b/ui/qt5/networkifacepage.cc new file mode 100644 index 0000000..6823333 --- /dev/null +++ b/ui/qt5/networkifacepage.cc @@ -0,0 +1,70 @@ +/* + * networkifacepage.cc - Implementation of the UI.Network.ChooseIface page + * horizon-qt5, the Qt 5 user interface for + * Project Horizon + * + * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#include "networkifacepage.hh" +#include "horizonwizard.hh" + +#include <QLabel> +#include <QListView> +#include <QListWidget> +#include <QVBoxLayout> + +NetworkIfacePage::NetworkIfacePage(QWidget *parent) : + HorizonWizardPage(parent) { + loadWatermark("network"); + setTitle(tr("Multiple Network Interfaces Detected")); +} + +void NetworkIfacePage::initializePage() { + QLabel *descLabel; + QListWidget *ifaceList; + QVBoxLayout *layout; + + descLabel = new QLabel(tr( + "Your computer has more than one network interface device. Select the one you wish to use during installation.")); + descLabel->setWordWrap(true); + + ifaceList = new QListWidget(this); + for(auto &iface : horizonWizard()->interfaces) { + QIcon ifaceIcon; + QString ifaceDevName = QString::fromStdString(iface.first); + QString ifaceName; + + switch(iface.second) { + case HorizonWizard::Wireless: + ifaceIcon = QIcon::fromTheme("network-wireless"); + ifaceName = tr("Wi-Fi (%1)").arg(ifaceDevName); + break; + case HorizonWizard::Ethernet: + ifaceIcon = QIcon::fromTheme("network-wired"); + ifaceName = tr("Ethernet (%1)").arg(ifaceDevName); + break; + case HorizonWizard::Bonded: + ifaceIcon = QIcon::fromTheme("network-card"); + ifaceName = tr("Bonded Interface (%1)").arg(ifaceDevName); + break; + case HorizonWizard::Unknown: + ifaceIcon = QIcon::fromTheme("network-card"); + ifaceName = tr("Unknown Interface (%1)").arg(ifaceDevName); + break; + } + + new QListWidgetItem(ifaceIcon, ifaceName, ifaceList); + } + + ifaceList->setViewMode(QListView::IconMode); + + layout = new QVBoxLayout; + layout->addWidget(descLabel); + layout->addWidget(ifaceList); + setLayout(layout); +} |