Skip to content

Commit

Permalink
add: yandex.music login via token
Browse files Browse the repository at this point in the history
  • Loading branch information
levovix0 committed Feb 17, 2023
1 parent 232645c commit 35f0bfc
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 180 deletions.
2 changes: 2 additions & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
<!-- resources/settings -->
<file>resources/settings/selected.svg</file>
<file>resources/settings/GitHub.svg</file>
<file>resources/settings/ok.svg</file>
<file>resources/settings/question.svg</file>

<!-- resources/covers -->
<file>resources/covers/favorite.svg</file>
Expand Down
12 changes: 6 additions & 6 deletions qml/DownloadPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ FloatingPanel {
Icon {
id: _icon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
width: 20
height: 20
anchors.horizontalCenter: parent.left
anchors.horizontalCenterOffset: 18

color: _mouse.containsMouse? Style.panel.text.sellectedColor : Style.panel.text.unsellectedColor
src: icon
Expand All @@ -80,17 +78,19 @@ FloatingPanel {
DText {
anchors.verticalCenter: parent.verticalCenter
anchors.left: _icon.right
anchors.leftMargin: 10
anchors.leftMargin: 13

font.pointSize: 10
color: _mouse.containsMouse? Style.panel.text.sellectedColor : Style.panel.text.unsellectedColor
text: title
}

DText {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 10
anchors.rightMargin: 13

font.pointSize: 10
color: Style.panel.text.darkColor
text: shortcut
}
Expand Down
2 changes: 2 additions & 0 deletions qml/StyleSingleton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ QtObject {
property QtObject normal: QtObject {
property color color: darkTheme? "#C1C1C1" : c40
property color hoverColor: darkTheme? white : "#808080"
property color pressedColor: darkTheme? Qt.darker(color, 1.25) : Qt.lighter(color, 1.25)
property color unavailableColor: darkTheme? "#808080" : "#C1C1C1"
}
property QtObject accent: QtObject {
property color color: window.accent
Expand Down
6 changes: 5 additions & 1 deletion qml/components/DTextBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Rectangle {

property bool clearButton: false

property real textRightPadding: 0

property QtObject style: Style.panel.textBox

MouseArea {
Expand All @@ -31,7 +33,7 @@ Rectangle {
TextInput {
id: _input
anchors.fill: parent
anchors.rightMargin: (clearButton && contentWidth > parent.width - _clear.width * 2)? _clear.width : 0
anchors.rightMargin: ((clearButton && contentWidth > parent.width - _clear.width * 2)? _clear.width : 0) + root.textRightPadding
verticalAlignment: Text.AlignVCenter
horizontalAlignment: root.style.text.hAlign
clip: true
Expand All @@ -47,6 +49,7 @@ Rectangle {
anchors.fill: _input
verticalAlignment: Text.AlignVCenter
horizontalAlignment: root.style.text.hAlign
anchors.rightMargin: root.textRightPadding

visible: _input.text == ""

Expand All @@ -59,6 +62,7 @@ Rectangle {
MouseArea {
id: _clear
anchors.right: parent.right
anchors.rightMargin: root.textRightPadding
visible: clearButton && root.text !== ""
height: parent.height
width: height
Expand Down
7 changes: 5 additions & 2 deletions qml/components/FloatingPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ Item {
property color color: Style.panel.background
property var triangleCenter: root.horizontalCenter
property var triangleTop: root.bottom
property var triangleBottom: root.top
property real triangleOffset: 0
property real triangleRotation: 0
property bool triangleOnTop: false

opacity: 0

Expand All @@ -32,9 +34,10 @@ Item {
Triangle {
id: _triangle
anchors.horizontalCenter: root.triangleCenter
anchors.top: root.triangleTop
anchors.top: triangleOnTop? undefined : root.triangleTop
anchors.bottom: triangleOnTop? root.triangleBottom : undefined
anchors.horizontalCenterOffset: root.triangleOffset
rotation: root.triangleRotation
rotation: root.triangleRotation + (triangleOnTop? 180 : 0)

color: root.color
}
Expand Down
4 changes: 2 additions & 2 deletions qml/pages/SettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DPage {
Layout.maximumWidth: 250
spacing: 20

AccountsSettingsBlock {}
AccountsSettingsBlock { rootComponent: _scroll }
ColorSettingsBlock {}
}

Expand Down Expand Up @@ -117,7 +117,7 @@ DPage {
Layout.preferredWidth: 215
spacing: 20

AccountsSettingsBlock {}
AccountsSettingsBlock { rootComponent: _scroll }
ColorSettingsBlock {}
}
}
Expand Down
49 changes: 44 additions & 5 deletions qml/pages/settings/AccountsSettingsBlock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import ".."
import "../../components"

SettingsBlock {
id: root
title: qsTr("Accounts")
Layout.fillWidth: true

property var rootComponent

ColumnLayout {
spacing: 10
Layout.maximumWidth: 250
Expand Down Expand Up @@ -57,6 +60,7 @@ SettingsBlock {
id: _YandexMusic_login

Item {
id: _YandexMusic_login_root
width: _text1.width + _text2.width
height: Math.max(_text1.height, _text2.height)

Expand Down Expand Up @@ -98,16 +102,51 @@ SettingsBlock {

FloatingPanel {
id: _ymLoginPanel
width: 220
width: 250
height: 30
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.bottom
anchors.topMargin: 10 - _ppc.shift
parent: root.rootComponent
x: _YandexMusic_login_root.mapToItem(root.rootComponent, _YandexMusic_login_root.width / 2 - width / 2, 0).x
y: _YandexMusic_login_root.mapToItem(root.rootComponent, 0, _YandexMusic_login_root.height).y + 10 - _ppc.shift
triangleOnTop: true

Item {
anchors.fill: parent


DTextBox {
id: _token
anchors.fill: parent
anchors.margins: 5
anchors.rightMargin: 30
textRightPadding: 20

hint: qsTr("Token")

IconButton {
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right

style: Style.window.icon.normal
src: "qrc:resources/settings/question.svg"
onClicked: Qt.openUrlExternally("https://github.com/MarshalX/yandex-music-api/discussions/513")
}
}

IconButton {
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.left: _token.right
anchors.leftMargin: 5

style: Style.window.icon.normal
src: "qrc:resources/settings/ok.svg"
onClicked: {
Config.ym_token = _token.text
_ppc.opened = false
}
}
}
}
}
Expand Down
54 changes: 2 additions & 52 deletions resources/player/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 2 additions & 41 deletions resources/player/open-file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 2 additions & 51 deletions resources/player/open-folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/settings/ok.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 35f0bfc

Please sign in to comment.