summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/CMakeLists.txt1
-rw-r--r--ui/qt5/netsimplewifipage.cc110
-rw-r--r--ui/qt5/netsimplewifipage.hh30
3 files changed, 72 insertions, 69 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt
index e453a25..7bf3107 100644
--- a/ui/qt5/CMakeLists.txt
+++ b/ui/qt5/CMakeLists.txt
@@ -11,6 +11,7 @@ set(UI_SOURCES
inputpage.cc
networkingpage.cc
networkifacepage.cc
+ netsimplewifipage.cc
horizon.qrc)
add_executable(horizon-qt5 ${UI_SOURCES})
diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc
index 4ce6eb4..2ac1681 100644
--- a/ui/qt5/netsimplewifipage.cc
+++ b/ui/qt5/netsimplewifipage.cc
@@ -1,71 +1,61 @@
+/*
+ * netsimplewifipage.cc - Implementation of the UI.Network.Wireless 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 "netsimplewifipage.hh"
-#include <QHBoxLayout>
#include <QLabel>
+#include <QPushButton>
#include <QVBoxLayout>
-#include <horizon/wirelesscontroller.hh>
-
NetworkSimpleWirelessPage::NetworkSimpleWirelessPage(QWidget *parent)
- : HorizonWizardPage(parent)
-{
- QHBoxLayout *securityLayout;
- QVBoxLayout *layout;
- QLabel *descLabel, *securityTypeLabel, *statusLabel;
-
- loadWatermark("network");
- setTitle(tr("Wireless Networking Setup"));
-
- descLabel = new QLabel(tr(
- "A supported Wi-Fi device has been found in this "
- "computer. If you connect to the Internet using "
- "Wi-Fi, select your Access Point below.\n\n"
-
- "If you don't want to use Wi-Fi, select \"Use Wired "
- "Connection\" to continue using a wired connection."));
- descLabel->setWordWrap(true);
-
- statusLabel = new QLabel(tr("Scanning for networks..."));
-
- ssidListView = new QListView;
-
- ssidName = new QLineEdit(this);
- ssidName->setPlaceholderText(tr("Network Name"));
- ssidName->hide();
-
- securityTypeLabel = new QLabel(tr("Security type"));
-
- securityType = new QComboBox(this);
- securityType->addItems({tr("None"), tr("WPA2 Personal"),
- tr("WPA2 Enterprise"), tr("WPA Personal"),
- tr("WPA Enterprise"), tr("WEP")});
- securityType->setEnabled(false);
- securityType->hide();
-
- passphrase = new QLineEdit(this);
- passphrase->setEchoMode(QLineEdit::Password);
- passphrase->setPlaceholderText(tr("Passphrase"));
- passphrase->hide();
+ : HorizonWizardPage(parent) {
+ QVBoxLayout *layout;
+ QLabel *statusLabel;
+ QPushButton *rescanButton;
+
+ loadWatermark("network");
+ setTitle(tr("Select Your Network"));
+
+ statusLabel = new QLabel(tr("Scanning for networks..."));
+
+ rescanButton = new QPushButton(tr("&Rescan Networks"));
+ rescanButton->setEnabled(false);
+ connect(rescanButton, &QPushButton::clicked, [=](void) { doScan(); });
+
+ ssidListView = new QListWidget;
+
+ passphrase = new QLineEdit(this);
+ passphrase->setEchoMode(QLineEdit::Password);
+ passphrase->setPlaceholderText(tr("Passphrase"));
+ passphrase->hide();
+
+ layout = new QVBoxLayout;
+ layout->addWidget(statusLabel, 0, Qt::AlignCenter);
+ layout->addSpacing(10);
+ layout->addWidget(ssidListView, 0, Qt::AlignCenter);
+ layout->addWidget(rescanButton);
+ layout->addSpacing(10);
+ layout->addWidget(passphrase);
+ setLayout(layout);
+}
- securityLayout = new QHBoxLayout;
- securityLayout->addWidget(securityTypeLabel);
- securityLayout->addWidget(securityType);
+void NetworkSimpleWirelessPage::doScan() {
+ ssidListView->clear();
+}
- layout = new QVBoxLayout;
- layout->addWidget(descLabel);
- layout->addWidget(statusLabel, 0, Qt::AlignCenter);
- layout->addSpacing(10);
- layout->addWidget(ssidListView, 0, Qt::AlignCenter);
- layout->addSpacing(10);
- layout->addWidget(ssidName);
- layout->addSpacing(10);
- layout->addLayout(securityLayout);
- layout->addSpacing(10);
- layout->addWidget(passphrase);
- setLayout(layout);
+void NetworkSimpleWirelessPage::initializePage() {
+ doScan();
}
-void NetworkSimpleWirelessPage::initializePage()
-{
- Horizon::WirelessController::wirelessController()->performScan();
+int NetworkSimpleWirelessPage::nextId() const {
+ return HorizonWizard::Page_Network_DHCP;
}
diff --git a/ui/qt5/netsimplewifipage.hh b/ui/qt5/netsimplewifipage.hh
index 3ba3e6a..8545c94 100644
--- a/ui/qt5/netsimplewifipage.hh
+++ b/ui/qt5/netsimplewifipage.hh
@@ -1,3 +1,15 @@
+/*
+ * netsimplewifipage.hh - Definition of the UI.Network.Wireless 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
+ */
+
#ifndef NETWORKSIMPLEWIRELESSPAGE_HH
#define NETWORKSIMPLEWIRELESSPAGE_HH
@@ -5,18 +17,18 @@
#include <QComboBox>
#include <QLineEdit>
-#include <QListView>
+#include <QListWidget>
-class NetworkSimpleWirelessPage : public HorizonWizardPage
-{
+class NetworkSimpleWirelessPage : public HorizonWizardPage {
public:
- NetworkSimpleWirelessPage(QWidget *parent = 0);
+ NetworkSimpleWirelessPage(QWidget *parent = nullptr);
- void initializePage();
+ void initializePage();
+ void doScan();
+ int nextId() const;
private:
- QComboBox *securityType;
- QLineEdit *ssidName, *passphrase;
- QListView *ssidListView;
+ QListWidget *ssidListView;
+ QLineEdit *passphrase;
};
-#endif // NETWORKSIMPLEWIRELESSPAGE_HH
+#endif /* !NETWORKSIMPLEWIRELESSPAGE_HH */