mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-04 01:42:44 +00:00
QuickConnect: init
This adds a page in the settings page that allows the user to enter a quick connect code to allow another device to log in.
This commit is contained in:
parent
13786f01c9
commit
a66434afa8
10 changed files with 242 additions and 3 deletions
|
@ -25,7 +25,7 @@ set(sailfin_QML_SOURCES
|
|||
qml/components/music/SongDelegate.qml
|
||||
qml/components/videoplayer/VideoError.qml
|
||||
qml/components/videoplayer/VideoHud.qml
|
||||
qml/components/ContributorsSection.qml
|
||||
qml/components/ContributorsSection.qml
|
||||
qml/components/IconListItem.qml
|
||||
qml/components/ItemChildrenShowcase.qml
|
||||
qml/components/JItem.qml
|
||||
|
@ -49,6 +49,7 @@ set(sailfin_QML_SOURCES
|
|||
qml/harbour-sailfin.qml
|
||||
qml/pages/ConnectingPage.qml
|
||||
qml/pages/ControllableDevicesPage.qml
|
||||
qml/pages/QuickConnectDialog.qml
|
||||
qml/pages/SettingsPage.qml
|
||||
qml/pages/VideoPage.qml
|
||||
qml/pages/itemdetails/BaseDetailPage.qml
|
||||
|
|
86
sailfish/qml/pages/QuickConnectDialog.qml
Normal file
86
sailfish/qml/pages/QuickConnectDialog.qml
Normal file
|
@ -0,0 +1,86 @@
|
|||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Dialog {
|
||||
id: qqDialog
|
||||
canAccept: qqCode.length > 0
|
||||
acceptDestination: ConnectingPage {
|
||||
id: loadingPage
|
||||
onStatusChanged: {
|
||||
if (status == PageStatus.Active) {
|
||||
submit()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: apiClient
|
||||
onQuickConnectAccepted: pageStack.pop(pageStack.previousPage(qqDialog))
|
||||
onQuickConnectRejected: {
|
||||
qqCode.errorHighlight = true
|
||||
pageStack.pop(qqDialog)
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
console.log("Accepted QuickConnect with code", qqCode.text)
|
||||
apiClient.submitQuickConnectCode(qqCode.text)
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
DialogHeader {
|
||||
//: Dialog title
|
||||
title: "Quick Connect"
|
||||
//: Accept button on dialog for submitting a Quick Connect code
|
||||
defaultAcceptText: qsTr("Allow login")
|
||||
}
|
||||
|
||||
|
||||
Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: Theme.horizontalPageMargin
|
||||
rightMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
color: Theme.highlightColor
|
||||
wrapMode: Text.WordWrap
|
||||
//: Instructions on page that tells the user a bit about how Quick Connect works
|
||||
text: qsTr("To log a device in with Quick Connect, select the Quick Connect button and enter the displayed code in the field below.")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: qqCode
|
||||
//: Label for textfield for entering the Quick Connect codeyy
|
||||
label: qsTr("Quick Connect code")
|
||||
focus: true
|
||||
//: Placeholder text for textfield for entering the Quick Connect codeyy
|
||||
placeholderText: qsTr("Quick Connect code")
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
|
||||
EnterKey.onClicked: accept()
|
||||
onTextChanged: {
|
||||
if (errorHighlight) {
|
||||
errorHighlight = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: errorText
|
||||
visible: qqCode.errorHighlight
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: Theme.horizontalPageMargin
|
||||
rightMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
color: Theme.errorColor
|
||||
//: Error message shown below the textfield when it is not connected
|
||||
text: qsTr("The Quick Connect code was not accepted")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -106,6 +106,11 @@ Page {
|
|||
Item { width: 1; height: Theme.paddingLarge; }
|
||||
|
||||
ButtonLayout {
|
||||
Button {
|
||||
//: This is a name used by Jellyfin and seems to be untranslated in other languages
|
||||
text: qsTr("Quick Connect")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("QuickConnectDialog.qml"))
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Log out")
|
||||
onClicked: remorse.execute(qsTr("Logging out"), apiClient.deleteSession)
|
||||
|
|
|
@ -441,6 +441,31 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QuickConnectDialog</name>
|
||||
<message>
|
||||
<source>Quick Connect code</source>
|
||||
<extracomment>Label for textfield for entering the Quick Connect codeyy
|
||||
----------
|
||||
Placeholder text for textfield for entering the Quick Connect codeyy</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow login</source>
|
||||
<extracomment>Accept button on dialog for submitting a Quick Connect code</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To log a device in with Quick Connect, select the Quick Connect button and enter the displayed code in the field below.</source>
|
||||
<extracomment>Instructions on page that tells the user a bit about how Quick Connect works</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The Quick Connect code was not accepted</source>
|
||||
<extracomment>Error message shown below the textfield when it is not connected</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SeasonPage</name>
|
||||
<message>
|
||||
|
@ -507,6 +532,11 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<extracomment>About Sailfin settings menu itemy</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quick Connect</source>
|
||||
<extracomment>This is a name used by Jellyfin and seems to be untranslated in other languages</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SongDelegate</name>
|
||||
|
|
|
@ -433,6 +433,31 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QuickConnectDialog</name>
|
||||
<message>
|
||||
<source>Quick Connect code</source>
|
||||
<extracomment>Label for textfield for entering the Quick Connect codeyy
|
||||
----------
|
||||
Placeholder text for textfield for entering the Quick Connect codeyy</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow login</source>
|
||||
<extracomment>Accept button on dialog for submitting a Quick Connect code</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To log a device in with Quick Connect, select the Quick Connect button and enter the displayed code in the field below.</source>
|
||||
<extracomment>Instructions on page that tells the user a bit about how Quick Connect works</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The Quick Connect code was not accepted</source>
|
||||
<extracomment>Error message shown below the textfield when it is not connected</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SeasonPage</name>
|
||||
<message>
|
||||
|
@ -488,6 +513,11 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<extracomment>Settings list item for settings related to streaming</extracomment>
|
||||
<translation>Настройки стриминга</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quick Connect</source>
|
||||
<extracomment>This is a name used by Jellyfin and seems to be untranslated in other languages</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SongDelegate</name>
|
||||
|
|
|
@ -16,7 +16,12 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><p><b>Sailfin version %1</b><br/>Copyright © Chris Josten 2020–%2</p><p>Sailfin is Free Software licensed under the <a href='lgpl'>LGPL-v2.1</a> or later, at your choice. Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p></source>
|
||||
<source><p><b>Sailfin version %1</b><br/>Copyright © Chris Josten 2020–%2</p><p>Sailfin is Free Software licensed under the <a href='lgpl'>LGPL-v2.1</a> or later, at your choice. You can <a href="github">view its source code on GitHub</a>. Parts of the code of Sailfin are from other libraries. <a href='3rdparty'>View their licenses here</a>.</p></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Contributors</source>
|
||||
<extracomment>SectionHeader</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -414,6 +419,31 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QuickConnectDialog</name>
|
||||
<message>
|
||||
<source>Quick Connect code</source>
|
||||
<extracomment>Label for textfield for entering the Quick Connect codeyy
|
||||
----------
|
||||
Placeholder text for textfield for entering the Quick Connect codeyy</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow login</source>
|
||||
<extracomment>Accept button on dialog for submitting a Quick Connect code</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To log a device in with Quick Connect, select the Quick Connect button and enter the displayed code in the field below.</source>
|
||||
<extracomment>Instructions on page that tells the user a bit about how Quick Connect works</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The Quick Connect code was not accepted</source>
|
||||
<extracomment>Error message shown below the textfield when it is not connected</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SeasonPage</name>
|
||||
<message>
|
||||
|
@ -445,7 +475,7 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<message>
|
||||
<source>About Sailfin</source>
|
||||
<extracomment>About Sailfin settings menu itemy</extracomment>
|
||||
<translation type="unfinished">About Sailfin1</translation>
|
||||
<translation type="unfinished">About Sailfin</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Session</source>
|
||||
|
@ -469,6 +499,11 @@ Page title for the list of all artists within the music library</extracomment>
|
|||
<extracomment>Debug information settings menu itemy</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quick Connect</source>
|
||||
<extracomment>This is a name used by Jellyfin and seems to be untranslated in other languages</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SongDelegate</name>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue