Make default main view and menu links configurable

This commit is contained in:
Michael Zanetti 2022-01-12 12:03:25 +01:00
parent 8db2d40ae6
commit bc36a31589
4 changed files with 52 additions and 54 deletions

View File

@ -8,8 +8,6 @@ ConfigurationBase {
connectionWizard: "/ui/connection/NewConnectionWizard.qml"
showCommunityLinks: true
magicEnabled: true
networkSettingsEnabled: true
apiSettingsEnabled: true
@ -18,4 +16,38 @@ ConfigurationBase {
zigbeeSettingsEnabled: true
modbusSettingsEnabled: true
pluginSettingsEnabled: true
mainMenuLinks: ListModel {
ListElement {
text: qsTr("Help")
iconName: "../images/help.svg"
url: "https://nymea.io/documentation/users/usage/first-steps"
}
ListElement {
text: qsTr("Forum")
iconName: "../images/discourse.svg"
url: "https://forum.nymea.io"
}
ListElement {
text: qsTr("Telegram")
iconName: "../images/telegram.svg"
url: "https://t.me/nymeacommunity"
}
ListElement {
text: qsTr("Discord")
iconName: "../images/discord.svg"
url: "https://discord.gg/tX9YCpD"
}
ListElement {
text: qsTr("Twitter")
iconName: "../images/twitter.svg"
url: "https://twitter.com/nymea_io"
}
ListElement {
text: qsTr("Facebook")
iconName: "../images/facebook.svg"
url: "https://m.facebook.com/groups/nymea"
}
}
}

View File

@ -7,8 +7,6 @@ Item {
property string connectionWizard: ""
property bool showCommunityLinks: false
// Enable/disable certain features
property bool magicEnabled: false
property bool networkSettingsEnabled: false
@ -18,4 +16,8 @@ Item {
property bool zigbeeSettingsEnabled: false
property bool modbusSettingsEnabled: false
property bool pluginSettingsEnabled: false
property string defaultMainView: "things"
property ListModel mainMenuLinks: null
}

View File

@ -193,57 +193,21 @@ Drawer {
root.openSystemSettings();
root.close();
}
Layout.bottomMargin: app.margins
}
NymeaItemDelegate {
Layout.fillWidth: true
Layout.topMargin: app.margins
text: qsTr("Help")
iconName: "../images/help.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://nymea.io/documentation/users/usage/first-steps")
visible: Configuration.showCommunityLinks
}
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Forum")
iconName: "../images/discourse.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://forum.nymea.io")
visible: Configuration.showCommunityLinks
}
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Telegram")
iconName: "../images/telegram.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://t.me/nymeacommunity")
visible: Configuration.showCommunityLinks
}
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Discord")
iconName: "../images/discord.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://discord.gg/tX9YCpD")
visible: Configuration.showCommunityLinks
}
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Twitter")
iconName: "../images/twitter.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://twitter.com/nymea_io")
visible: Configuration.showCommunityLinks
}
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Facebook")
iconName: "../images/facebook.svg"
progressive: false
onClicked: Qt.openUrlExternally("https://m.facebook.com/groups/nymea")
visible: Configuration.showCommunityLinks
Repeater {
model: Configuration.mainMenuLinks
delegate: NymeaItemDelegate {
Layout.fillWidth: true
text: model.text
iconName: model.iconName
progressive: false
onClicked: Qt.openUrlExternally(model.url)
}
}
}
}

View File

@ -151,7 +151,7 @@ Page {
Configuration.mainViewsFilter
: defaultMainViewFilter.length > 0 ?
defaultMainViewFilter.split(',')
: ["things"]
: [Configuration.defaultMainView]
property int currentIndex: 0
}
@ -505,7 +505,7 @@ Page {
}
}
if (newList.length === 0) {
newList.push("things")
newList.push(Configuration.defaultMainView)
}
mainViewSettings.filterList = newList