From eba517afc4091adc3a3a411be3e50c61f0fa7411 Mon Sep 17 00:00:00 2001 From: Bramastyo Harimukti Santoso Date: Tue, 12 Feb 2019 12:06:07 +0100 Subject: [music] hide busy indicator and show warning when no media is available - busy indicator consumes quite a lot of CPU to render its animation Task-number: AUTOSUITE-770 Change-Id: Ie7ae053f8fc40cbcc76c137c611afe0ea0919963 Reviewed-by: Egor Nemtsev --- apps/com.pelagicore.music/panels/AlbumArtPanel.qml | 43 +++++++++++++++++----- .../views/WidgetContentView.qml | 2 +- imports_shared/assets/translations/ar-MA.ts | 7 ++++ imports_shared/assets/translations/cs_CZ.ts | 7 ++++ imports_shared/assets/translations/de_DE.ts | 7 ++++ imports_shared/assets/translations/en_GB.ts | 7 ++++ imports_shared/assets/translations/en_US.ts | 7 ++++ imports_shared/assets/translations/ja_JP.ts | 7 ++++ imports_shared/assets/translations/ko_KR.ts | 7 ++++ imports_shared/assets/translations/zh_CN.ts | 7 ++++ 10 files changed, 90 insertions(+), 11 deletions(-) diff --git a/apps/com.pelagicore.music/panels/AlbumArtPanel.qml b/apps/com.pelagicore.music/panels/AlbumArtPanel.qml index 1dafb162..c5679f18 100644 --- a/apps/com.pelagicore.music/panels/AlbumArtPanel.qml +++ b/apps/com.pelagicore.music/panels/AlbumArtPanel.qml @@ -160,21 +160,44 @@ Item { } } - Item { + Loader { id: searchingMedia width: Sizes.dp(180) height: width - opacity: root.mediaReady ? 0.0 : 1.0 - Behavior on opacity { DefaultNumberAnimation {} } - visible: opacity > 0 anchors.centerIn: coverslide + active: !root.mediaReady + sourceComponent: Item { + BusyIndicator { + id: busyIndicator + anchors.centerIn: parent + Behavior on opacity { DefaultNumberAnimation {} } + visible: opacity > 0.0 + running: visible + width: Sizes.dp(60) + height: Sizes.dp(60) + } - BusyIndicator { - anchors.centerIn: parent - visible: parent.visible - running: visible - width: Sizes.dp(60) - height: Sizes.dp(60) + Label { + id: warningLabel + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: root.parentStateMaximized === "Maximized"? Sizes.dp(300) : 0 + Behavior on anchors.leftMargin { DefaultNumberAnimation {} } + opacity: 0.0 + text: qsTr("There are no music available") + Behavior on opacity { DefaultNumberAnimation {} } + } + + Timer { + running: busyIndicator.running + interval: 5000 + onTriggered: { + if (!root.mediaReady) { + busyIndicator.opacity = 0.0; + warningLabel.opacity = 1.0; + } + } + } } } diff --git a/apps/com.pelagicore.music/views/WidgetContentView.qml b/apps/com.pelagicore.music/views/WidgetContentView.qml index f7f2f57b..4ddb2d7e 100644 --- a/apps/com.pelagicore.music/views/WidgetContentView.qml +++ b/apps/com.pelagicore.music/views/WidgetContentView.qml @@ -133,7 +133,7 @@ Item { currentIndex: store.musicPlaylist.currentIndex currentSongTitle: store.currentEntry ? root.store.currentEntry.title : "" currentArtisName: store.currentEntry ? root.store.currentEntry.artist : "" - parentStateMaximized: state === "Maximized" + parentStateMaximized: root.state === "Maximized" mediaReady: store.searchAndBrowseModel.count > 0 musicPlaying: store.playing onPlayClicked: store.playSong() diff --git a/imports_shared/assets/translations/ar-MA.ts b/imports_shared/assets/translations/ar-MA.ts index 6808a66d..1b94f65f 100644 --- a/imports_shared/assets/translations/ar-MA.ts +++ b/imports_shared/assets/translations/ar-MA.ts @@ -81,6 +81,13 @@ لا يوجد المزيد من الواجهات + + AlbumArtPanel + + There are no music available + + + CalendarToolsColumn diff --git a/imports_shared/assets/translations/cs_CZ.ts b/imports_shared/assets/translations/cs_CZ.ts index a36d3401..7b2e3ab9 100644 --- a/imports_shared/assets/translations/cs_CZ.ts +++ b/imports_shared/assets/translations/cs_CZ.ts @@ -121,6 +121,13 @@ UX na cestu Žádné další widgety k dispozici. + + AlbumArtPanel + + There are no music available + + + AppStoreServer diff --git a/imports_shared/assets/translations/de_DE.ts b/imports_shared/assets/translations/de_DE.ts index 593c6907..a5fdd24e 100644 --- a/imports_shared/assets/translations/de_DE.ts +++ b/imports_shared/assets/translations/de_DE.ts @@ -100,6 +100,13 @@ + + AlbumArtPanel + + There are no music available + + + ApplicationStoreContent diff --git a/imports_shared/assets/translations/en_GB.ts b/imports_shared/assets/translations/en_GB.ts index 45dd6615..2398ac10 100644 --- a/imports_shared/assets/translations/en_GB.ts +++ b/imports_shared/assets/translations/en_GB.ts @@ -81,6 +81,13 @@ + + AlbumArtPanel + + There are no music available + + + CalendarToolsColumn diff --git a/imports_shared/assets/translations/en_US.ts b/imports_shared/assets/translations/en_US.ts index 80266381..2eba2cf4 100644 --- a/imports_shared/assets/translations/en_US.ts +++ b/imports_shared/assets/translations/en_US.ts @@ -81,6 +81,13 @@ + + AlbumArtPanel + + There are no music available + + + CalendarToolsColumn diff --git a/imports_shared/assets/translations/ja_JP.ts b/imports_shared/assets/translations/ja_JP.ts index d29fed84..c3060da3 100644 --- a/imports_shared/assets/translations/ja_JP.ts +++ b/imports_shared/assets/translations/ja_JP.ts @@ -100,6 +100,13 @@ + + AlbumArtPanel + + There are no music available + + + ApplicationStoreContent diff --git a/imports_shared/assets/translations/ko_KR.ts b/imports_shared/assets/translations/ko_KR.ts index c9a81206..8c72deec 100644 --- a/imports_shared/assets/translations/ko_KR.ts +++ b/imports_shared/assets/translations/ko_KR.ts @@ -107,6 +107,13 @@ + + AlbumArtPanel + + There are no music available + + + ApplicationStoreContent diff --git a/imports_shared/assets/translations/zh_CN.ts b/imports_shared/assets/translations/zh_CN.ts index aa2d714a..68249220 100644 --- a/imports_shared/assets/translations/zh_CN.ts +++ b/imports_shared/assets/translations/zh_CN.ts @@ -107,6 +107,13 @@ + + AlbumArtPanel + + There are no music available + + + ApplicationStoreContent -- cgit v1.2.3