Make default main view and menu links configurable
This commit is contained in:
parent
8db2d40ae6
commit
bc36a31589
@ -8,8 +8,6 @@ ConfigurationBase {
|
|||||||
|
|
||||||
connectionWizard: "/ui/connection/NewConnectionWizard.qml"
|
connectionWizard: "/ui/connection/NewConnectionWizard.qml"
|
||||||
|
|
||||||
showCommunityLinks: true
|
|
||||||
|
|
||||||
magicEnabled: true
|
magicEnabled: true
|
||||||
networkSettingsEnabled: true
|
networkSettingsEnabled: true
|
||||||
apiSettingsEnabled: true
|
apiSettingsEnabled: true
|
||||||
@ -18,4 +16,38 @@ ConfigurationBase {
|
|||||||
zigbeeSettingsEnabled: true
|
zigbeeSettingsEnabled: true
|
||||||
modbusSettingsEnabled: true
|
modbusSettingsEnabled: true
|
||||||
pluginSettingsEnabled: 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,6 @@ Item {
|
|||||||
|
|
||||||
property string connectionWizard: ""
|
property string connectionWizard: ""
|
||||||
|
|
||||||
property bool showCommunityLinks: false
|
|
||||||
|
|
||||||
// Enable/disable certain features
|
// Enable/disable certain features
|
||||||
property bool magicEnabled: false
|
property bool magicEnabled: false
|
||||||
property bool networkSettingsEnabled: false
|
property bool networkSettingsEnabled: false
|
||||||
@ -18,4 +16,8 @@ Item {
|
|||||||
property bool zigbeeSettingsEnabled: false
|
property bool zigbeeSettingsEnabled: false
|
||||||
property bool modbusSettingsEnabled: false
|
property bool modbusSettingsEnabled: false
|
||||||
property bool pluginSettingsEnabled: false
|
property bool pluginSettingsEnabled: false
|
||||||
|
|
||||||
|
property string defaultMainView: "things"
|
||||||
|
|
||||||
|
property ListModel mainMenuLinks: null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,57 +193,21 @@ Drawer {
|
|||||||
root.openSystemSettings();
|
root.openSystemSettings();
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Layout.bottomMargin: app.margins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NymeaItemDelegate {
|
Repeater {
|
||||||
Layout.fillWidth: true
|
model: Configuration.mainMenuLinks
|
||||||
Layout.topMargin: app.margins
|
delegate: NymeaItemDelegate {
|
||||||
text: qsTr("Help")
|
Layout.fillWidth: true
|
||||||
iconName: "../images/help.svg"
|
text: model.text
|
||||||
progressive: false
|
iconName: model.iconName
|
||||||
onClicked: Qt.openUrlExternally("https://nymea.io/documentation/users/usage/first-steps")
|
progressive: false
|
||||||
visible: Configuration.showCommunityLinks
|
onClicked: Qt.openUrlExternally(model.url)
|
||||||
}
|
}
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ Page {
|
|||||||
Configuration.mainViewsFilter
|
Configuration.mainViewsFilter
|
||||||
: defaultMainViewFilter.length > 0 ?
|
: defaultMainViewFilter.length > 0 ?
|
||||||
defaultMainViewFilter.split(',')
|
defaultMainViewFilter.split(',')
|
||||||
: ["things"]
|
: [Configuration.defaultMainView]
|
||||||
property int currentIndex: 0
|
property int currentIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newList.length === 0) {
|
if (newList.length === 0) {
|
||||||
newList.push("things")
|
newList.push(Configuration.defaultMainView)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainViewSettings.filterList = newList
|
mainViewSettings.filterList = newList
|
||||||
|
|||||||
Reference in New Issue
Block a user