mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 09:15:18 +00:00
Convert tabs to spaces
This commit is contained in:
parent
7bb1fdddba
commit
7eb9dba6d0
|
@ -45,17 +45,17 @@ Page {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ApiClient
|
target: ApiClient
|
||||||
onConnectionSuccess: {
|
onConnectionSuccess: {
|
||||||
console.log("Login success: " + loginMessage);
|
console.log("Login success: " + loginMessage);
|
||||||
pageStack.replace(Qt.resolvedUrl("LoginDialog.qml"), {"loginMessage": loginMessage, "firstPage": firstPage});
|
pageStack.replace(Qt.resolvedUrl("LoginDialog.qml"), {"loginMessage": loginMessage, "firstPage": firstPage});
|
||||||
}
|
}
|
||||||
onConnectionFailed: function(error) {
|
onConnectionFailed: function(error) {
|
||||||
console.log("Connection failed : " + error)
|
console.log("Connection failed : " + error)
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
}
|
}
|
||||||
onNetworkError: {
|
onNetworkError: {
|
||||||
console.log("ConnectingPage: popping page!")
|
console.log("ConnectingPage: popping page!")
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,58 +56,58 @@ Dialog {
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: serverSelect
|
id: serverSelect
|
||||||
label: qsTr("Server")
|
label: qsTr("Server")
|
||||||
description: qsTr("Sailfin will try to search for Jellyfin servers on your local network automatically")
|
description: qsTr("Sailfin will try to search for Jellyfin servers on your local network automatically")
|
||||||
|
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
// Special values are cool, aren't they?
|
// Special values are cool, aren't they?
|
||||||
readonly property string _address: manualAddress.text
|
readonly property string _address: manualAddress.text
|
||||||
readonly property string _name: manualAddress.text
|
readonly property string _name: manualAddress.text
|
||||||
text: qsTr("enter address manually")
|
text: qsTr("enter address manually")
|
||||||
}
|
}
|
||||||
Repeater {
|
Repeater {
|
||||||
model: serverModel
|
model: serverModel
|
||||||
delegate: MenuItem {
|
delegate: MenuItem {
|
||||||
readonly property string _address: address
|
readonly property string _address: address
|
||||||
readonly property string _name: name
|
readonly property string _name: name
|
||||||
text: qsTr("%1 - %2").arg(name).arg(address)
|
text: qsTr("%1 - %2").arg(name).arg(address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: manualAddress
|
id: manualAddress
|
||||||
width: parent.width
|
width: parent.width
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
label: qsTr("Server address")
|
label: qsTr("Server address")
|
||||||
placeholderText: qsTr("e.g. https://demo.jellyfin.org")
|
placeholderText: qsTr("e.g. https://demo.jellyfin.org")
|
||||||
|
|
||||||
enabled: serverSelect.currentIndex == 0
|
enabled: serverSelect.currentIndex == 0
|
||||||
visible: enabled
|
visible: enabled
|
||||||
|
|
||||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
inputMethodHints: Qt.ImhUrlCharactersOnly
|
||||||
validator: RegExpValidator {
|
validator: RegExpValidator {
|
||||||
regExp: /^https?:\/\/[a-zA-Z0-9-._~:/?#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+$/m
|
regExp: /^https?:\/\/[a-zA-Z0-9-._~:/?#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+$/m
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterKey.enabled: addressCorrect
|
EnterKey.enabled: addressCorrect
|
||||||
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
|
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
|
||||||
EnterKey.onClicked: accept()
|
EnterKey.onClicked: accept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: serverModel.refresh()
|
onOpened: serverModel.refresh()
|
||||||
canAccept: addressCorrect
|
canAccept: addressCorrect
|
||||||
|
|
||||||
function tryConnect() {
|
function tryConnect() {
|
||||||
console.log("Hi there!")
|
console.log("Hi there!")
|
||||||
ApiClient.baseUrl = address;
|
ApiClient.baseUrl = address;
|
||||||
//ApiClient.setupConnection()
|
//ApiClient.setupConnection()
|
||||||
//fakeTimer.start()
|
//fakeTimer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
onDone: tryConnect()
|
onDone: tryConnect()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,113 +29,113 @@ import "../../components"
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: loginDialog
|
id: loginDialog
|
||||||
property string loginMessage
|
property string loginMessage
|
||||||
property Page firstPage
|
property Page firstPage
|
||||||
|
|
||||||
property string error
|
property string error
|
||||||
|
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
|
|
||||||
|
|
||||||
acceptDestination: Page {
|
acceptDestination: Page {
|
||||||
BusyLabel {
|
BusyLabel {
|
||||||
text: qsTr("Logging in as %1").arg(username.text)
|
text: qsTr("Logging in as %1").arg(username.text)
|
||||||
running: true
|
running: true
|
||||||
}
|
}
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if(status == PageStatus.Active) {
|
if(status == PageStatus.Active) {
|
||||||
ApiClient.authenticate(username.text, password.text, true)
|
ApiClient.authenticate(username.text, password.text, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ApiClient
|
target: ApiClient
|
||||||
onAuthenticatedChanged: {
|
onAuthenticatedChanged: {
|
||||||
if (ApiClient.authenticated) {
|
if (ApiClient.authenticated) {
|
||||||
console.log("authenticated!")
|
console.log("authenticated!")
|
||||||
pageStack.replaceAbove(null, Qt.resolvedUrl("../MainPage.qml"))
|
pageStack.replaceAbove(null, Qt.resolvedUrl("../MainPage.qml"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onAuthenticationError: {
|
onAuthenticationError: {
|
||||||
loginDialog.error = qsTr("Invalid username or password")
|
loginDialog.error = qsTr("Invalid username or password")
|
||||||
pageStack.completeAnimation()
|
pageStack.completeAnimation()
|
||||||
pageStack.pop()
|
pageStack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicUserModel {
|
PublicUserModel {
|
||||||
id: userModel
|
id: userModel
|
||||||
apiClient: ApiClient
|
apiClient: ApiClient
|
||||||
Component.onCompleted: reload();
|
Component.onCompleted: reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogHeader {
|
DialogHeader {
|
||||||
id: dialogHeader
|
id: dialogHeader
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
//: Dialog action
|
//: Dialog action
|
||||||
acceptText: qsTr("Login");
|
acceptText: qsTr("Login");
|
||||||
}
|
}
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: dialogHeader.bottom
|
anchors.top: dialogHeader.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
contentHeight: column.height
|
contentHeight: column.height
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
VerticalScrollDecorator {}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
Flow {
|
Flow {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Repeater {
|
Repeater {
|
||||||
model: userModel
|
model: userModel
|
||||||
delegate: UserGridDelegate {
|
delegate: UserGridDelegate {
|
||||||
name: model.name
|
name: model.name
|
||||||
image: model.primaryImageTag ? "%1/Users/%2/Images/Primary?tag=%3".arg(ApiClient.baseUrl).arg(model.id).arg(model.primaryImageTag) : ""
|
image: model.primaryImageTag ? "%1/Users/%2/Images/Primary?tag=%3".arg(ApiClient.baseUrl).arg(model.id).arg(model.primaryImageTag) : ""
|
||||||
highlighted: model.name === username.text
|
highlighted: model.name === username.text
|
||||||
onClicked: {
|
onClicked: {
|
||||||
username.text = model.name
|
username.text = model.name
|
||||||
password.focus = true
|
password.focus = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SectionHeader {
|
SectionHeader {
|
||||||
//: Section header for entering username and password
|
//: Section header for entering username and password
|
||||||
text: qsTr("Credentials")
|
text: qsTr("Credentials")
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: username
|
id: username
|
||||||
width: parent.width
|
width: parent.width
|
||||||
//: Label placeholder for username field
|
//: Label placeholder for username field
|
||||||
placeholderText: qsTr("Username")
|
placeholderText: qsTr("Username")
|
||||||
label: placeholderText
|
label: placeholderText
|
||||||
errorHighlight: error
|
errorHighlight: error
|
||||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||||
EnterKey.onClicked: password.focus = true
|
EnterKey.onClicked: password.focus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: password
|
id: password
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
//: Label placeholder for password field
|
//: Label placeholder for password field
|
||||||
placeholderText: qsTr("Password")
|
placeholderText: qsTr("Password")
|
||||||
label: placeholderText
|
label: placeholderText
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
errorHighlight: error
|
errorHighlight: error
|
||||||
|
|
||||||
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
|
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
|
||||||
EnterKey.onClicked: accept()
|
EnterKey.onClicked: accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -149,24 +149,24 @@ Dialog {
|
||||||
visible: error
|
visible: error
|
||||||
}
|
}
|
||||||
|
|
||||||
SectionHeader {
|
SectionHeader {
|
||||||
//: Message shown on login, configured by the server owner. Some form of a MOTD
|
//: Message shown on login, configured by the server owner. Some form of a MOTD
|
||||||
text: qsTr("Login message")
|
text: qsTr("Login message")
|
||||||
visible: loginMessage
|
visible: loginMessage
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
leftMargin: Theme.horizontalPageMargin
|
leftMargin: Theme.horizontalPageMargin
|
||||||
rightMargin: Theme.horizontalPageMargin
|
rightMargin: Theme.horizontalPageMargin
|
||||||
}
|
}
|
||||||
visible: loginMessage
|
visible: loginMessage
|
||||||
text: loginMessage
|
text: loginMessage
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
color: Theme.highlightColor
|
color: Theme.highlightColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
canAccept: username.text
|
canAccept: username.text
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue