mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	QML-UI: Split cloud credentials and other preferences
This makes the cloud credential entry page much simpler, separate page. It also removes the two colums and uses the label of the check box instead of having a separate label item. The preferences page of course also gets simpler by doing this. Here I kept the two columns, though. Finally the code for the old context menu was removed - not sure why this was still here. Next I need to fix the savePreferences() call to do the right thing in each case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									9ef475844d
								
							
						
					
					
						commit
						7a94360a6d
					
				
					 5 changed files with 102 additions and 142 deletions
				
			
		
							
								
								
									
										85
									
								
								qt-mobile/qml/CloudCredentials.qml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								qt-mobile/qml/CloudCredentials.qml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,85 @@
 | 
			
		|||
import QtQuick 2.3
 | 
			
		||||
import QtQuick.Controls 1.2
 | 
			
		||||
import QtQuick.Window 2.2
 | 
			
		||||
import QtQuick.Dialogs 1.2
 | 
			
		||||
import QtQuick.Layouts 1.1
 | 
			
		||||
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
 | 
			
		||||
import org.subsurfacedivelog.mobile 1.0
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
	id: loginWindow
 | 
			
		||||
 | 
			
		||||
	signal accept
 | 
			
		||||
 | 
			
		||||
	property string username: login.text;
 | 
			
		||||
	property string password: password.text;
 | 
			
		||||
	property bool issave: savePassword.checked;
 | 
			
		||||
 | 
			
		||||
	ColumnLayout {
 | 
			
		||||
		anchors.fill: parent
 | 
			
		||||
		anchors.margins: MobileComponents.Units.gridUnit
 | 
			
		||||
 | 
			
		||||
		MobileComponents.Heading {
 | 
			
		||||
			text: "Cloud credentials"
 | 
			
		||||
			Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Email"
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		TextField {
 | 
			
		||||
			id: login
 | 
			
		||||
			text: manager.cloudUserName
 | 
			
		||||
			Layout.fillWidth: true
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Password"
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		TextField {
 | 
			
		||||
			id: password
 | 
			
		||||
			text: manager.cloudPassword
 | 
			
		||||
			echoMode: TextInput.Password
 | 
			
		||||
			Layout.fillWidth: true
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		CheckBox {
 | 
			
		||||
			text: "Show password"
 | 
			
		||||
			checked: false
 | 
			
		||||
			id: showPassword
 | 
			
		||||
			onCheckedChanged: {
 | 
			
		||||
				password.echoMode = checked ? TextInput.Normal : TextInput.Password
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		CheckBox {
 | 
			
		||||
			text: "Remember"
 | 
			
		||||
			checked: manager.saveCloudPassword
 | 
			
		||||
			id: savePassword
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Item { width: MobileComponents.Units.gridUnit; height: width }
 | 
			
		||||
		Item {
 | 
			
		||||
			height: saveButton.height
 | 
			
		||||
			width: saveButton.width
 | 
			
		||||
			Button {
 | 
			
		||||
				id: saveButton
 | 
			
		||||
				text: "Save"
 | 
			
		||||
				anchors.centerIn: parent
 | 
			
		||||
				onClicked: {
 | 
			
		||||
					manager.cloudUserName = login.text
 | 
			
		||||
					manager.cloudPassword = password.text
 | 
			
		||||
					manager.saveCloudPassword = savePassword.checked
 | 
			
		||||
					manager.savePreferences()
 | 
			
		||||
					stackView.pop()
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Item {
 | 
			
		||||
			Layout.fillHeight: true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -7,71 +7,21 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
 | 
			
		|||
import org.subsurfacedivelog.mobile 1.0
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
	id: loginWindow
 | 
			
		||||
	id: preferencesWindow
 | 
			
		||||
 | 
			
		||||
	signal accept
 | 
			
		||||
 | 
			
		||||
	property string username: login.text;
 | 
			
		||||
	property string password: password.text;
 | 
			
		||||
	property bool issave: savePassword.checked;
 | 
			
		||||
 | 
			
		||||
	GridLayout {
 | 
			
		||||
		columns: 2
 | 
			
		||||
		anchors.fill: parent
 | 
			
		||||
		anchors.margins: MobileComponents.Units.gridUnit
 | 
			
		||||
 | 
			
		||||
		MobileComponents.Heading {
 | 
			
		||||
			text: "Cloud credentials"
 | 
			
		||||
			text: "Preferences"
 | 
			
		||||
			Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2
 | 
			
		||||
			Layout.columnSpan: 2
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Email"
 | 
			
		||||
			Layout.alignment: Qt.AlignRight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		TextField {
 | 
			
		||||
			id: login
 | 
			
		||||
			text: manager.cloudUserName
 | 
			
		||||
			Layout.fillWidth: true
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Password"
 | 
			
		||||
			Layout.alignment: Qt.AlignRight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		TextField {
 | 
			
		||||
			id: password
 | 
			
		||||
			text: manager.cloudPassword
 | 
			
		||||
			echoMode: TextInput.Password
 | 
			
		||||
			Layout.fillWidth: true
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Show password"
 | 
			
		||||
			Layout.alignment: Qt.AlignRight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		CheckBox {
 | 
			
		||||
			checked: false
 | 
			
		||||
			id: showPassword
 | 
			
		||||
			onCheckedChanged: {
 | 
			
		||||
				password.echoMode = checked ? TextInput.Normal : TextInput.Password
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Label {
 | 
			
		||||
			text: "Remember"
 | 
			
		||||
			Layout.alignment: Qt.AlignRight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		CheckBox {
 | 
			
		||||
			checked: manager.saveCloudPassword
 | 
			
		||||
			id: savePassword
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MobileComponents.Heading {
 | 
			
		||||
			text: "Subsurface GPS data webservice"
 | 
			
		||||
			Layout.topMargin: MobileComponents.Units.largeSpacing
 | 
			
		||||
| 
						 | 
				
			
			@ -110,9 +60,6 @@ Item {
 | 
			
		|||
				text: "Save"
 | 
			
		||||
				anchors.centerIn: parent
 | 
			
		||||
				onClicked: {
 | 
			
		||||
					manager.cloudUserName = login.text
 | 
			
		||||
					manager.cloudPassword = password.text
 | 
			
		||||
					manager.saveCloudPassword = savePassword.checked
 | 
			
		||||
					manager.distanceThreshold = distanceThreshold.text
 | 
			
		||||
					manager.timeThreshold = timeThreshold.text
 | 
			
		||||
					manager.savePreferences()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ Item {
 | 
			
		|||
			Layout.preferredWidth: startpage.buttonWidth
 | 
			
		||||
			text: "Connect to CloudStorage..."
 | 
			
		||||
			onClicked: {
 | 
			
		||||
				stackView.push(prefsWindow)
 | 
			
		||||
				stackView.push(cloudCredWindow)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		Button {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,13 @@ MobileComponents.ApplicationWindow {
 | 
			
		|||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		Action {
 | 
			
		||||
			text: "Cloud login credentials"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				stackView.push(cloudCredWindow)
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		Action {
 | 
			
		||||
			text: "Load Dives"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
| 
						 | 
				
			
			@ -145,91 +152,6 @@ MobileComponents.ApplicationWindow {
 | 
			
		|||
		property color accentTextColor: "#ececec"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Menu {
 | 
			
		||||
		id: prefsMenu
 | 
			
		||||
		title: "Menu"
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Preferences"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				stackView.push(prefsWindow)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Load Dives"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.loadDives();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Download Dives"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				stackView.push(downloadDivesWindow)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Add Dive"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.addDive();
 | 
			
		||||
				stackView.push(detailsWindow)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Save Changes"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.saveChanges();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Run location service"
 | 
			
		||||
			checkable: true
 | 
			
		||||
			checked: manager.locationServiceEnabled
 | 
			
		||||
			onToggled: {
 | 
			
		||||
				manager.locationServiceEnabled = checked;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Apply GPS data to dives"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.applyGpsData();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Send GPS data to server"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.sendGpsData();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Clear stored GPS data"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				manager.clearGpsData();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "View Log"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				stackView.push(logWindow)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		MenuItem {
 | 
			
		||||
			text: "Theme Information"
 | 
			
		||||
			onTriggered: {
 | 
			
		||||
				stackView.push(themetest)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	toolBar: TopBar {
 | 
			
		||||
		width: parent.width
 | 
			
		||||
		height: Layout.minimumHeight
 | 
			
		||||
| 
						 | 
				
			
			@ -250,6 +172,11 @@ MobileComponents.ApplicationWindow {
 | 
			
		|||
		visible: false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	CloudCredentials {
 | 
			
		||||
		id: cloudCredWindow
 | 
			
		||||
		visible: false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	DiveDetails {
 | 
			
		||||
		id: detailsWindow
 | 
			
		||||
		visible: false
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
		<file>main.qml</file>
 | 
			
		||||
		<file>TextButton.qml</file>
 | 
			
		||||
		<file>Preferences.qml</file>
 | 
			
		||||
		<file>CloudCredentials.qml</file>
 | 
			
		||||
		<file>DiveList.qml</file>
 | 
			
		||||
		<file>DiveDetails.qml</file>
 | 
			
		||||
		<file>DownloadFromDiveComputer.qml</file>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue