diff --git a/data/qml/StationView.qml b/data/qml/StationView.qml
index f624c9d90..7cb70b3d7 100644
--- a/data/qml/StationView.qml
+++ b/data/qml/StationView.qml
@@ -84,21 +84,14 @@ Rectangle {
}
}
- Image {
+ BusyIndicator {
id: busyIndicator
- source: "../images/loading-animation.svg"
anchors.centerIn: parent
height: defaultFontHeight * 4
width: height
+
visible: mainView.loading
- RotationAnimation {
- target: busyIndicator
- from: 0
- to: 360
- duration: 1500
- running: true
- loops: Animation.Infinite
- }
+ running: mainView.loading
}
}
diff --git a/data/qml/tomahawkimports/BusyIndicator.qml b/data/qml/tomahawkimports/BusyIndicator.qml
new file mode 100644
index 000000000..d69da6e55
--- /dev/null
+++ b/data/qml/tomahawkimports/BusyIndicator.qml
@@ -0,0 +1,48 @@
+import QtQuick 1.1
+
+Item {
+ id: busyIndicator
+ width: 100
+ height: width
+ property int barWidth: width / 10
+ property int barHeight: height / 4
+ property int count: 12
+ property color color: "white"
+ property int currentHighlight: 0
+ property bool running: true
+ property int interval: 200
+
+ Repeater {
+ model: busyIndicator.count
+
+
+ Item {
+ height: parent.height
+ width: busyIndicator.barWidth
+ anchors.centerIn: parent
+ Rectangle {
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ }
+ height: busyIndicator.barHeight
+ radius: width / 2
+
+ color: busyIndicator.color
+ }
+ rotation: 360 / busyIndicator.count * index
+ opacity: 1 - ((index > busyIndicator.currentHighlight ? busyIndicator.currentHighlight + busyIndicator.count : busyIndicator.currentHighlight) - index) / busyIndicator.count
+ Behavior on opacity {
+ NumberAnimation { duration: busyIndicator.interval }
+ }
+ }
+ }
+
+ Timer {
+ interval: busyIndicator.interval
+ running: busyIndicator.running
+ repeat: true
+ onTriggered: parent.currentHighlight = (parent.currentHighlight + 1) % busyIndicator.count
+ }
+}
diff --git a/data/qml/tomahawkimports/TagCloud.qml b/data/qml/tomahawkimports/TagCloud.qml
index 419e533fb..ba3de03aa 100644
--- a/data/qml/tomahawkimports/TagCloud.qml
+++ b/data/qml/tomahawkimports/TagCloud.qml
@@ -27,7 +27,7 @@ Item {
width: delegateText.width * 1.1
height: delegateText.height
property double itemScale: Math.random() + .3
- scale: 1//itemScale
+ scale: itemScale
Text {
id: delegateText
color: "gray"
diff --git a/resources.qrc b/resources.qrc
index 765bfc2d6..6681623a1 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -150,6 +150,7 @@
data/qml/tomahawkimports/RoundedButton.qml
data/qml/tomahawkimports/PushButton.qml
data/qml/tomahawkimports/CoverFlip.qml
+ data/qml/tomahawkimports/BusyIndicator.qml
data/qml/StationView.qml
data/qml/stations/StationCreatorPage1.qml
data/qml/stations/StationCreatorPage2.qml
diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
index da67ac77e..a1d7d369a 100644
--- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
+++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
@@ -28,6 +28,7 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
, m_playlist( playlist )
, m_runningOnDemand( false )
, m_activePlaylist( false )
+ , m_playNextResolved( false )
{
m_model = new DynamicModel( this );
@@ -112,7 +113,9 @@ playlist_ptr DynamicQmlWidget::playlist() const
bool DynamicQmlWidget::loading()
{
- return m_model->isLoading();
+ // Why does isLoading() not reset to true when cleared and station started again?
+// return m_model->isLoading();
+ return m_playNextResolved && m_proxyModel->rowCount() == 0;
}
bool DynamicQmlWidget::configured()
@@ -134,7 +137,9 @@ void DynamicQmlWidget::pause()
void DynamicQmlWidget::startStationFromArtist(const QString &artist)
{
m_model->clear();
+ m_playNextResolved = true;
m_playlist->generator()->startFromArtist(Artist::get(artist));
+ emit loadingChanged();
emit configuredChanged();
}
@@ -142,7 +147,9 @@ void DynamicQmlWidget::startStationFromGenre(const QString &genre)
{
tDebug() << "should start startion from genre" << genre;
m_model->clear();
+ m_playNextResolved = true;
m_playlist->generator()->startFromGenre( genre );
+ emit loadingChanged();
emit configuredChanged();
}
@@ -189,6 +196,11 @@ void DynamicQmlWidget::resolvingFinished(bool hasResults)
qDebug() << "fetching next one";
m_playlist->generator()->fetchNext();
}
+
+ if( m_playNextResolved && m_proxyModel->rowCount() > 0 ) {
+ playItem( 0 );
+ m_playNextResolved = false;
+ }
}
void DynamicQmlWidget::trackStarted()
diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
index 956ae026c..6453f9e4c 100644
--- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
+++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
@@ -101,6 +101,7 @@ private:
bool m_runningOnDemand;
bool m_activePlaylist;
+ bool m_playNextResolved;
};
}