Skip to content

Commit

Permalink
Redesign of Database settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dekker committed Apr 22, 2020
1 parent 71d3ca5 commit 2f06ddc
Show file tree
Hide file tree
Showing 7 changed files with 484 additions and 339 deletions.
253 changes: 187 additions & 66 deletions qml/pages/settings/DatabaseSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,128 @@ Page {
contentHeight: mainColumn.height
clip: true

VerticalScrollDecorator {
}


Column {
id: mainColumn
anchors {
right: parent.right
left: parent.left
leftMargin: listPadding
rightMargin: listPadding
}

Label {
text: qsTr("Albums: %1").arg(dbStatistic.getAlbumCount())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Albums")
width: mainColumn.width - albumCount.width - Theme.paddingLarge * 2
}
Label {
id: albumCount
text: dbStatistic.getAlbumCount()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Blacklisted albums: %1").arg(dbStatistic.getAlbumBlacklistCount())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Blacklisted albums")
width: mainColumn.width - blacklistCount.width - Theme.paddingLarge * 2
}
Label {
id: blacklistCount
text: dbStatistic.getAlbumBlacklistCount()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Artists: %1").arg(dbStatistic.getArtistCount())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Artists")
width: mainColumn.width - artistsCount.width - Theme.paddingLarge * 2
}
Label {
id: artistsCount
text: dbStatistic.getArtistCount()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Images: %1").arg(dbStatistic.getImageCount())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Images")
width: mainColumn.width - imagesCount.width - Theme.paddingLarge * 2
}
Label {
id: imagesCount
text: dbStatistic.getImageCount()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Filesize: %1 MB").arg(dbStatistic.getDatabaseSize() / 1048576)
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Filesize")
width: mainColumn.width - fileSizeMB.width - Theme.paddingLarge * 2
}
Label {
id: fileSizeMB
text: Math.round((dbStatistic.getDatabaseSize() / 1048576) * 100) / 100 + qsTr(" MB")
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Artist downloads remaining: %1").arg(dbStatistic.getArtistQueueSize())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Artist downloads remaining")
width: mainColumn.width - artistsRemaining.width - Theme.paddingLarge * 2
}
Label {
id: artistsRemaining
text: dbStatistic.getArtistQueueSize()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
Label {
text: qsTr("Album downloads remaining: %1").arg(dbStatistic.getAlbumQueueSize())
Row {
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width
Label {
text: qsTr("Album downloads remaining")
width: mainColumn.width - albumRemaining.width - Theme.paddingLarge * 2
}
Label {
id: albumRemaining
text: dbStatistic.getAlbumQueueSize()
horizontalAlignment: Text.AlignRight
width: parent.width - (Theme.paddingLarge * 2)
color: Theme.secondaryColor
}
}
TextSwitch {
id: lastfmEnabledSwitch
Expand All @@ -71,19 +164,19 @@ Page {
currentIndex: downloadSize
menu: ContextMenu {
MenuItem {
text: qsTr("small")
text: qsTr("Small")
}
MenuItem {
text: qsTr("medium")
text: qsTr("Medium")
}
MenuItem {
text: qsTr("large")
text: qsTr("Large")
}
MenuItem {
text: qsTr("extra-large")
text: qsTr("Extra large")
}
MenuItem {
text: qsTr("mega")
text: qsTr("Mega")
}
}

Expand All @@ -93,52 +186,75 @@ Page {
}
Label {
id: warningLabel
width: parent.width
x: Theme.paddingLarge
y: Theme.paddingLarge
width: parent.width - (Theme.paddingLarge * 2)
color: "red"
text: qsTr("Although the setting \"mega\" will look the best, it will require huge amount of local data cached.")
wrapMode: "WordWrap"
}

Button {
id: downloadArtistImagesBtn
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Download artist images")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 4})
enabled: dbStatistic.getArtistQueueSize() === 0 && lastfmEnabled
}
Button {
id: downloadAlbumImagesBtn
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Download album images")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 5})
enabled: dbStatistic.getAlbumQueueSize() === 0 && lastfmEnabled
}
Button {
id: clearBlacklistBtn
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Clear blacklisted albums")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 0})
enabled: dbStatistic.getArtistQueueSize() === 0 && dbStatistic.getAlbumQueueSize() === 0
}
Button {
id: clearArtistBtn
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Clear artist images")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 1})
enabled: dbStatistic.getArtistQueueSize() === 0 && dbStatistic.getAlbumQueueSize() === 0
}
Button {
id: clearAlbumBtn
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Clear album images")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 2})
}
Button {
id: clearDBBtn
Column {
spacing: Theme.paddingSmall
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Clear complete database")
onClicked: pageStack.push(dialogComponent, {"confirmationRole": 3})
enabled: dbStatistic.getArtistQueueSize() === 0 && dbStatistic.getAlbumQueueSize() === 0
Button {
id: downloadArtistImagesBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Download artist images")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 4
})
enabled: dbStatistic.getArtistQueueSize() === 0
&& lastfmEnabled
}
Button {
id: downloadAlbumImagesBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Download album images")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 5
})
enabled: dbStatistic.getAlbumQueueSize() === 0
&& lastfmEnabled
}
Button {
id: clearBlacklistBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Clear blacklisted albums")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 0
})
enabled: dbStatistic.getArtistQueueSize() === 0
&& dbStatistic.getAlbumQueueSize() === 0
}
Button {
id: clearArtistBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Clear artist images")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 1
})
enabled: dbStatistic.getArtistQueueSize() === 0
&& dbStatistic.getAlbumQueueSize() === 0
}
Button {
id: clearAlbumBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Clear album images")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 2
})
}
Button {
id: clearDBBtn
width: isPortrait ? mainColumn.width - Theme.paddingLarge * 2 : (mainColumn.width / 2) * 0.95
text: qsTr("Clear complete database")
onClicked: pageStack.push(dialogComponent, {
"confirmationRole": 3
})
enabled: dbStatistic.getArtistQueueSize() === 0
&& dbStatistic.getAlbumQueueSize() === 0
}
}
}
}
Expand Down Expand Up @@ -174,27 +290,32 @@ Page {
switch (confirmationRole) {
// Clear blacklisted albums
case 0:
confirmationDialog.headerText = qsTr("Clear blacklist albums")
confirmationDialog.headerText = qsTr(
"Clear blacklist albums")
confirmationDialog.acceptText = confirmationDialog.headerText
confirmationDialog.questionText = qsTr("Do you really want to delete all albums which are blacklisted from local database cache? There is no turning back!")
confirmationDialog.questionText = qsTr(
"Do you really want to delete all albums which are blacklisted from local database cache? There is no turning back!")
break
// Clear artists
case 1:
confirmationDialog.headerText = qsTr("Clear artists")
confirmationDialog.acceptText = confirmationDialog.headerText
confirmationDialog.questionText = qsTr("Do you really want to delete all artists from local database cache? There is no turning back!")
confirmationDialog.questionText = qsTr(
"Do you really want to delete all artists from local database cache? There is no turning back!")
break
// Clear albums
case 2:
confirmationDialog.headerText = qsTr("Clear albums")
confirmationDialog.acceptText = confirmationDialog.headerText
confirmationDialog.questionText = qsTr("Do you really want to delete all albums from local database cache? There is no turning back!")
confirmationDialog.questionText = qsTr(
"Do you really want to delete all albums from local database cache? There is no turning back!")
break
// Clear all
case 3:
confirmationDialog.headerText = qsTr("Clear database")
confirmationDialog.acceptText = confirmationDialog.headerText
confirmationDialog.questionText = qsTr("Do you really want to delete the complete local database cache? There is no turning back!")
confirmationDialog.questionText = qsTr(
"Do you really want to delete the complete local database cache? There is no turning back!")
break
case 4:
confirmationDialog.headerText = qsTr("Download artists")
Expand Down
4 changes: 4 additions & 0 deletions rpm/harbour-smpc.changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# * date Author's Name <author's email> version-release
# - Summary of changes

* Wed Apr 22 2020 Arno Dekker <jack.tar@example.com> 1.3.9-1
- Rewrite of c++ code listing albums (thanks Fuchsmich)
- Redesign of Database settings page
- More parts that have Spanish translation
* Sun Apr 19 2020 Arno Dekker <jack.tar@example.com> 1.3.8-2
- German translation updated (thanks Inta)
- Translated Spanish part extended (thanks GNUuser)
Expand Down
4 changes: 2 additions & 2 deletions rpm/harbour-smpc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Name: harbour-smpc
# << macros

Summary: SailfishOS Port of qmobilempd client
Version: 1.3.8
Release: 2
Version: 1.3.9
Release: 1
Group: Qt/Qt
License: GPLv3
URL: https://github.com/a-dekker/smpc
Expand Down
Loading

0 comments on commit 2f06ddc

Please sign in to comment.