mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core,tests: change qml register function
In order to address the C++ object directy in qml, a different registration is needed. qmlRegisterType, registers the C++ class, allowing qml code to inherit from it and make qml objects. This is needed for graphical elemnets like profile and map setContentProperty, registers the C++ object, thus allowing signals to be catched. Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
a71afd31ee
commit
d0edc29636
9 changed files with 62 additions and 59 deletions
|
|
@ -144,7 +144,7 @@ Item {
|
|||
text: qsTr("No cloud mode")
|
||||
onClicked: {
|
||||
manager.syncToCloud = false
|
||||
prefs.credentialStatus = SsrfPrefs.CS_NOCLOUD
|
||||
prefs.credentialStatus = CloudStatus.CS_NOCLOUD
|
||||
manager.saveCloudCredentials()
|
||||
manager.openNoCloudRepo()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Kirigami.ScrollablePage {
|
|||
supportsRefreshing: true
|
||||
onRefreshingChanged: {
|
||||
if (refreshing) {
|
||||
if (prefs.credentialStatus === SsrfPrefs.CS_VERIFIED) {
|
||||
if (prefs.credentialStatus === CloudStatus.CS_VERIFIED) {
|
||||
console.log("User pulled down dive list - syncing with cloud storage")
|
||||
detailsWindow.endEditMode()
|
||||
manager.saveChangesCloud(true)
|
||||
|
|
@ -339,8 +339,8 @@ Kirigami.ScrollablePage {
|
|||
StartPage {
|
||||
id: startPage
|
||||
anchors.fill: parent
|
||||
opacity: credentialStatus === SsrfPrefs.CS_NOCLOUD ||
|
||||
(credentialStatus === SsrfPrefs.CS_VERIFIED) ? 0 : 1
|
||||
opacity: credentialStatus === CloudStatus.CS_NOCLOUD ||
|
||||
(credentialStatus === CloudStatus.CS_VERIFIED) ? 0 : 1
|
||||
visible: opacity > 0
|
||||
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
||||
function setupActions() {
|
||||
|
|
@ -348,8 +348,8 @@ Kirigami.ScrollablePage {
|
|||
page.actions.main = null
|
||||
page.actions.right = null
|
||||
page.title = qsTr("Cloud credentials")
|
||||
} else if (prefs.credentialStatus === SsrfPrefs.CS_VERIFIED ||
|
||||
prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD) {
|
||||
} else if (prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
||||
prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
|
||||
page.actions.main = page.downloadFromDCAction
|
||||
page.actions.right = page.addDiveAction
|
||||
page.title = qsTr("Dive list")
|
||||
|
|
@ -440,7 +440,7 @@ Kirigami.ScrollablePage {
|
|||
|
||||
onBackRequested: {
|
||||
if (startPage.visible && diveListView.count > 0 &&
|
||||
prefs.credentialStatus !== SsrfPrefs.CS_INCORRECT_USER_PASSWD) {
|
||||
prefs.credentialStatus !== CloudStatus.CS_INCORRECT_USER_PASSWD) {
|
||||
prefs.credentialStatus = oldStatus
|
||||
event.accepted = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Kirigami.ScrollablePage {
|
|||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
}
|
||||
Controls.Label {
|
||||
text: prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD ? qsTr("Not applicable") : prefs.cloudUserName
|
||||
text: prefs.credentialStatus === CloudStatus.CS_NOCLOUD ? qsTr("Not applicable") : prefs.cloudUserName
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.preferredWidth: gridWidth * 0.60
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
|
|
@ -333,7 +333,7 @@ Kirigami.ScrollablePage {
|
|||
inputMethodHints: Qt.ImhNoPredictiveText
|
||||
Layout.fillWidth: true
|
||||
onActivated: {
|
||||
general.set_default_cylinder(defaultCylinderBox.currentText)
|
||||
PrefGeneral.set_default_cylinder(defaultCylinderBox.currentText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ Kirigami.ApplicationWindow {
|
|||
detailsWindow.cylinderModel2 = manager.cylinderInit
|
||||
detailsWindow.cylinderModel3 = manager.cylinderInit
|
||||
detailsWindow.cylinderModel4 = manager.cylinderInit
|
||||
detailsWindow.cylinderIndex0 = general.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(general.default_cylinder)
|
||||
detailsWindow.cylinderIndex0 = PrefGeneral.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(PrefGeneral.default_cylinder)
|
||||
detailsWindow.usedCyl = ["",]
|
||||
detailsWindow.weight = ""
|
||||
detailsWindow.usedGas = []
|
||||
|
|
@ -192,10 +192,10 @@ Kirigami.ApplicationWindow {
|
|||
text: qsTr("Dive list")
|
||||
onTriggered: {
|
||||
manager.appendTextToLog("requested dive list with credential status " + prefs.credentialStatus)
|
||||
if (prefs.credentialStatus == SsrfPrefs.CS_UNKNOWN) {
|
||||
if (prefs.credentialStatus == CloudStatus.CS_UNKNOWN) {
|
||||
// the user has asked to change credentials - if the credentials before that
|
||||
// were valid, go back to dive list
|
||||
if (oldStatus == SsrfPrefs.CS_VERIFIED) {
|
||||
if (oldStatus == CloudStatus.CS_VERIFIED) {
|
||||
prefs.credentialStatus = oldStatus
|
||||
}
|
||||
}
|
||||
|
|
@ -222,8 +222,8 @@ Kirigami.ApplicationWindow {
|
|||
name: ":/icons/ic_add.svg"
|
||||
}
|
||||
text: qsTr("Add dive manually")
|
||||
enabled: prefs.credentialStatus === SsrfPrefs.CS_VERIFIED ||
|
||||
prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD
|
||||
enabled: prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
||||
prefs.credentialStatus === CloudStatus.CS_NOCLOUD
|
||||
onTriggered: {
|
||||
globalDrawer.close()
|
||||
returnTopPage() // otherwise odd things happen with the page stack
|
||||
|
|
@ -257,14 +257,14 @@ Kirigami.ApplicationWindow {
|
|||
name: ":/icons/cloud_sync.svg"
|
||||
}
|
||||
text: qsTr("Manual sync with cloud")
|
||||
enabled: prefs.credentialStatus === SsrfPrefs.CS_VERIFIED ||
|
||||
prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD
|
||||
enabled: prefs.credentialStatus === CloudStatus.CS_VERIFIED ||
|
||||
prefs.credentialStatus === CloudStatus.CS_NOCLOUD
|
||||
onTriggered: {
|
||||
if (prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD) {
|
||||
if (prefs.credentialStatus === CloudStatus.CS_NOCLOUD) {
|
||||
returnTopPage()
|
||||
oldStatus = prefs.credentialStatus
|
||||
manager.startPageText = "Enter valid cloud storage credentials"
|
||||
prefs.credentialStatus = SsrfPrefs.CS_UNKNOWN
|
||||
prefs.credentialStatus = CloudStatus.CS_UNKNOWN
|
||||
globalDrawer.close()
|
||||
} else {
|
||||
globalDrawer.close()
|
||||
|
|
@ -279,7 +279,7 @@ Kirigami.ApplicationWindow {
|
|||
name: syncToCloud ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
|
||||
}
|
||||
text: syncToCloud ? qsTr("Disable auto cloud sync") : qsTr("Enable auto cloud sync")
|
||||
enabled: prefs.credentialStatus !== SsrfPrefs.CS_NOCLOUD
|
||||
enabled: prefs.credentialStatus !== CloudStatus.CS_NOCLOUD
|
||||
onTriggered: {
|
||||
syncToCloud = !syncToCloud
|
||||
if (!syncToCloud) {
|
||||
|
|
@ -351,7 +351,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
|||
onTriggered: {
|
||||
globalDrawer.close()
|
||||
settingsWindow.defaultCylinderModel = manager.cylinderInit
|
||||
general.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(general.default_cylinder)
|
||||
PrefGeneral.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(PrefGeneral.default_cylinder)
|
||||
stackView.push(settingsWindow)
|
||||
detailsWindow.endEditMode()
|
||||
}
|
||||
|
|
@ -600,10 +600,6 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
|||
visible: false
|
||||
}
|
||||
|
||||
SsrfGeneralPrefs {
|
||||
id: general
|
||||
}
|
||||
|
||||
onPluggedInDeviceNameChanged: {
|
||||
if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
|
||||
/* we're in the middle of editing / adding a dive */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue