Add WiFi networks list filter option
parent
be79826d68
commit
316bce2a4e
|
|
@ -49,13 +49,57 @@ void WirelessAccessPointsProxy::setAccessPoints(WirelessAccessPoints *accessPoin
|
|||
{
|
||||
m_accessPoints = accessPoints;
|
||||
emit accessPointsChanged();
|
||||
|
||||
setSourceModel(m_accessPoints);
|
||||
connect(accessPoints, &WirelessAccessPoints::countChanged, this, &WirelessAccessPointsProxy::countChanged);
|
||||
connect(accessPoints, &WirelessAccessPoints::countChanged, this, [this](){
|
||||
sort(0, Qt::DescendingOrder);
|
||||
invalidateFilter();
|
||||
emit countChanged();
|
||||
});
|
||||
|
||||
setSortRole(WirelessAccessPoints::WirelessAccesspointRoleSignalStrength);
|
||||
sort(0, Qt::DescendingOrder);
|
||||
|
||||
invalidateFilter();
|
||||
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
WirelessAccessPoint *WirelessAccessPointsProxy::get(int index) const
|
||||
{
|
||||
return m_accessPoints->get(mapToSource(this->index(index, 0)).row());
|
||||
}
|
||||
|
||||
bool WirelessAccessPointsProxy::showDuplicates() const
|
||||
{
|
||||
return m_showDuplicates;
|
||||
}
|
||||
|
||||
void WirelessAccessPointsProxy::setShowDuplicates(bool showDuplicates)
|
||||
{
|
||||
m_showDuplicates = showDuplicates;
|
||||
emit showDuplicatesChanged();
|
||||
|
||||
sort(0, Qt::DescendingOrder);
|
||||
invalidateFilter();
|
||||
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
bool WirelessAccessPointsProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
Q_UNUSED(source_parent)
|
||||
|
||||
if (m_showDuplicates)
|
||||
return true;
|
||||
|
||||
WirelessAccessPoint *accessPoint = m_accessPoints->get(source_row);
|
||||
// Check if this is the best signal strenght, otherwise filter out...
|
||||
foreach (WirelessAccessPoint *ap, m_accessPoints->wirelessAccessPoints()) {
|
||||
if (ap->ssid() == accessPoint->ssid() && ap->signalStrength() > accessPoint->signalStrength()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ class WirelessAccessPointsProxy : public QSortFilterProxyModel
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||
Q_PROPERTY(WirelessAccessPoints* accessPoints READ accessPoints WRITE setAccessPoints)
|
||||
Q_PROPERTY(bool showDuplicates READ showDuplicates WRITE setShowDuplicates NOTIFY showDuplicatesChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit WirelessAccessPointsProxy(QObject *parent = nullptr);
|
||||
|
||||
|
|
@ -50,12 +52,20 @@ public:
|
|||
|
||||
Q_INVOKABLE WirelessAccessPoint* get(int index) const;
|
||||
|
||||
bool showDuplicates() const;
|
||||
void setShowDuplicates(bool showDuplicates);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
void accessPointsChanged();
|
||||
void showDuplicatesChanged();
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
private:
|
||||
WirelessAccessPoints *m_accessPoints = nullptr;
|
||||
bool m_showDuplicates = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -319,5 +319,6 @@
|
|||
<file>ui/devicepages/ThingStatusPage.qml</file>
|
||||
<file>ui/customviews/MultiStateChart.qml</file>
|
||||
<file>ui/devicepages/DeviceDetailsPage.qml</file>
|
||||
<file>ui/system/WirelessNetworksFilterSettingsPage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -7524,6 +7524,21 @@ Toto prosím používejte pouze v případě, že jste si jisti tím co děláte
|
|||
<translation>Přidat</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -4499,7 +4499,7 @@ Bitte versuche es erneut.</translation>
|
|||
Maybe the hardware is already in use.</source>
|
||||
<translation>Verbindung zum Modbus RTU Master kann nicht hergestellt werden.
|
||||
|
||||
Wird das Gerät bereits benutzt?</translation>
|
||||
Eventuell wird das Gerät bereits benutzt.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Are you sure you want to remove this Modbus RTU master?</source>
|
||||
|
|
@ -7504,6 +7504,21 @@ Bitte benutze diese Funktion nur wenn Du sicher bist, dass es das ist was Du mö
|
|||
<translation>Hinzufügen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation>WiFi Listen Optionen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation>Zeige alle Netzwerke</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation>Mehrere Netzwerke mit gleichem Namen werden gefiltert</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7488,6 +7488,21 @@ Please only use this if you are sure you want this and consider reporting the is
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7488,6 +7488,21 @@ Please only use this if you are sure you want this and consider reporting the is
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7488,6 +7488,21 @@ Please only use this if you are sure you want this and consider reporting the is
|
|||
<translation>Aggiungi</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7474,6 +7474,21 @@ Please only use this if you are sure you want this and consider reporting the is
|
|||
<translation>추가</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7510,6 +7510,21 @@ Als je fouten in de niet-officiële software vindt, geef deze dan door aan de on
|
|||
<translation>Toevoegen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7475,6 +7475,21 @@ Lütfen bunu istediğinizden eminseniz kullanın ve yayınlanmamış kanalları
|
|||
<translation>Ekle</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -7469,6 +7469,21 @@ Please only use this if you are sure you want this and consider reporting the is
|
|||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WirelessNetworksFilterSettingsPage</name>
|
||||
<message>
|
||||
<source>WiFi list options</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all networks</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Multiple networks with the same name get filterd out</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WizardPageBase</name>
|
||||
<message>
|
||||
|
|
|
|||
|
|
@ -197,7 +197,6 @@ SettingsPageBase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: styleChangedDialog
|
||||
Dialog {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ Page {
|
|||
|
||||
readonly property int visibleContentHeight: contentFlickable.height - contentContainer.y
|
||||
|
||||
property var headerButtons: []
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: Style.margins
|
||||
|
|
@ -46,6 +48,22 @@ Page {
|
|||
Layout.preferredHeight: Style.iconSize + Style.smallMargins * 2
|
||||
Layout.preferredWidth: Style.iconSize + Style.smallMargins * 2
|
||||
}
|
||||
|
||||
Row {
|
||||
id: additionalIcons
|
||||
anchors { right: parent.right; top: parent.top }
|
||||
visible: !d.configOverlay
|
||||
width: visible ? implicitWidth : 0
|
||||
Repeater {
|
||||
model: headerButtons
|
||||
delegate: HeaderButton {
|
||||
imageSource: root.headerButtons[index].iconSource
|
||||
onClicked: root.headerButtons[index].trigger()
|
||||
visible: root.headerButtons[index].visible
|
||||
color: root.headerButtons[index].color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.2
|
||||
import Qt.labs.settings 1.1
|
||||
|
||||
import "../components"
|
||||
import Nymea 1.0
|
||||
|
||||
|
|
@ -503,6 +505,29 @@ WizardPageBase {
|
|||
showNextButton: false
|
||||
onBack: pageStack.pop()
|
||||
|
||||
headerButtons: [
|
||||
{
|
||||
iconSource: "/ui/images/filters.svg",
|
||||
color: Style.iconColor,
|
||||
trigger: function() {
|
||||
pageStack.push(Qt.createComponent("/ui/system/WirelessNetworksFilterSettingsPage.qml"),
|
||||
{ wirelessAccessPointsProxy: wirelessAccessPointsModel });
|
||||
},
|
||||
visible: true
|
||||
}
|
||||
]
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
property bool wirelessShowDuplicates: false
|
||||
}
|
||||
|
||||
WirelessAccessPointsProxy {
|
||||
id: wirelessAccessPointsModel
|
||||
showDuplicates: settings.wirelessShowDuplicates
|
||||
accessPoints: wifiSetup.accessPoints
|
||||
}
|
||||
|
||||
property var wifiSetup: null
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
@ -519,15 +544,14 @@ WizardPageBase {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
model: wifiSetup.accessPoints
|
||||
model: wirelessAccessPointsModel
|
||||
clip: true
|
||||
|
||||
delegate: NymeaItemDelegate {
|
||||
width: parent.width
|
||||
|
||||
text: model.ssid !== "" ? model.ssid : qsTr("Hidden Network")
|
||||
subText: model.hostAddress
|
||||
|
||||
subText: model.macAddress + (model.hostAddress === "" ? "" : (" (" + model.hostAddress + ")"))
|
||||
prominentSubText: false
|
||||
iconColor: model.selectedNetwork ? Style.accentColor : "#808080"
|
||||
iconName: {
|
||||
if (model.protected) {
|
||||
|
|
@ -577,7 +601,6 @@ WizardPageBase {
|
|||
visible: wifiSetup.wirelessServiceVersion >= 2
|
||||
onClicked: {
|
||||
pageStack.push(hiddenWifiComponent, {wifiSetup: wifiSetup})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,10 @@ import QtQuick 2.9
|
|||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import Qt.labs.settings 1.1
|
||||
|
||||
import Nymea 1.0
|
||||
import "../components"
|
||||
import "qrc:/ui/components"
|
||||
|
||||
SettingsPageBase {
|
||||
id: root
|
||||
|
|
@ -398,11 +400,6 @@ SettingsPageBase {
|
|||
|
||||
property WirelessNetworkDevice wirelessNetworkDevice: null
|
||||
|
||||
WirelessAccessPointsProxy {
|
||||
id: apProxy
|
||||
accessPoints: wirelessAccessPointsPage.wirelessNetworkDevice.accessPoints
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Access Point")
|
||||
}
|
||||
|
|
@ -442,8 +439,31 @@ SettingsPageBase {
|
|||
}
|
||||
}
|
||||
|
||||
SettingsPageSectionHeader {
|
||||
text: qsTr("Connect to wireless network")
|
||||
Settings {
|
||||
id: settings
|
||||
property bool wirelessShowDuplicates: false
|
||||
}
|
||||
|
||||
WirelessAccessPointsProxy {
|
||||
id: apProxy
|
||||
accessPoints: wirelessAccessPointsPage.wirelessNetworkDevice ? wirelessAccessPointsPage.wirelessNetworkDevice.accessPoints : null
|
||||
showDuplicates: settings.wirelessShowDuplicates
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
SettingsPageSectionHeader {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Connect to wireless network")
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
id: filterButton
|
||||
imageSource: "/ui/images/filters.svg"
|
||||
color: Style.iconColor
|
||||
onClicked: pageStack.push(Qt.createComponent("/ui/system/WirelessNetworksFilterSettingsPage.qml"),
|
||||
{ wirelessAccessPointsProxy: apProxy });
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
|
|
@ -544,7 +564,7 @@ SettingsPageBase {
|
|||
horizontalAlignment: Text.AlignRight
|
||||
validator: RegExpValidator {
|
||||
regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
@ -571,7 +591,7 @@ SettingsPageBase {
|
|||
Layout.fillWidth: true
|
||||
validator: RegExpValidator {
|
||||
regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
@ -584,7 +604,7 @@ SettingsPageBase {
|
|||
Layout.fillWidth: true
|
||||
validator: RegExpValidator {
|
||||
regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.9
|
||||
import QtQuick.Layouts 1.2
|
||||
import Qt.labs.settings 1.1
|
||||
|
||||
import "qrc:/ui/components"
|
||||
import Nymea 1.0
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
title: qsTr("WiFi list options")
|
||||
|
||||
property WirelessAccessPointsProxy wirelessAccessPointsProxy: null
|
||||
|
||||
header: Item {
|
||||
|
||||
height: 28 + 2 * Style.margins
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: app.margins
|
||||
|
||||
HeaderButton {
|
||||
id: backButton
|
||||
objectName: "backButton"
|
||||
imageSource: "../images/back.svg"
|
||||
onClicked: pageStack.pop();
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
id: titleLabel
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: root.title
|
||||
font.pixelSize: app.largeFont
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
property bool wirelessShowDuplicates: false
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: app.margins
|
||||
|
||||
|
||||
NymeaItemDelegate {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Show all networks")
|
||||
subText: qsTr("Multiple networks with the same name get filterd out")
|
||||
prominentSubText: false
|
||||
progressive: false
|
||||
additionalItem: Switch {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: settings.wirelessShowDuplicates
|
||||
onCheckedChanged: {
|
||||
settings.wirelessShowDuplicates = checked
|
||||
wirelessAccessPointsProxy.showDuplicates = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue