1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 18:04:05 +02:00

some look and feel improvements

This commit is contained in:
Michael Zanetti
2012-12-20 00:02:11 +01:00
parent bf2ac533e0
commit dde7501162
6 changed files with 67 additions and 12 deletions

View File

@@ -84,21 +84,14 @@ Rectangle {
} }
} }
Image { BusyIndicator {
id: busyIndicator id: busyIndicator
source: "../images/loading-animation.svg"
anchors.centerIn: parent anchors.centerIn: parent
height: defaultFontHeight * 4 height: defaultFontHeight * 4
width: height width: height
visible: mainView.loading visible: mainView.loading
RotationAnimation { running: mainView.loading
target: busyIndicator
from: 0
to: 360
duration: 1500
running: true
loops: Animation.Infinite
}
} }
} }

View File

@@ -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
}
}

View File

@@ -27,7 +27,7 @@ Item {
width: delegateText.width * 1.1 width: delegateText.width * 1.1
height: delegateText.height height: delegateText.height
property double itemScale: Math.random() + .3 property double itemScale: Math.random() + .3
scale: 1//itemScale scale: itemScale
Text { Text {
id: delegateText id: delegateText
color: "gray" color: "gray"

View File

@@ -150,6 +150,7 @@
<file>data/qml/tomahawkimports/RoundedButton.qml</file> <file>data/qml/tomahawkimports/RoundedButton.qml</file>
<file>data/qml/tomahawkimports/PushButton.qml</file> <file>data/qml/tomahawkimports/PushButton.qml</file>
<file>data/qml/tomahawkimports/CoverFlip.qml</file> <file>data/qml/tomahawkimports/CoverFlip.qml</file>
<file>data/qml/tomahawkimports/BusyIndicator.qml</file>
<file>data/qml/StationView.qml</file> <file>data/qml/StationView.qml</file>
<file>data/qml/stations/StationCreatorPage1.qml</file> <file>data/qml/stations/StationCreatorPage1.qml</file>
<file>data/qml/stations/StationCreatorPage2.qml</file> <file>data/qml/stations/StationCreatorPage2.qml</file>

View File

@@ -28,6 +28,7 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
, m_playlist( playlist ) , m_playlist( playlist )
, m_runningOnDemand( false ) , m_runningOnDemand( false )
, m_activePlaylist( false ) , m_activePlaylist( false )
, m_playNextResolved( false )
{ {
m_model = new DynamicModel( this ); m_model = new DynamicModel( this );
@@ -112,7 +113,9 @@ playlist_ptr DynamicQmlWidget::playlist() const
bool DynamicQmlWidget::loading() 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() bool DynamicQmlWidget::configured()
@@ -134,7 +137,9 @@ void DynamicQmlWidget::pause()
void DynamicQmlWidget::startStationFromArtist(const QString &artist) void DynamicQmlWidget::startStationFromArtist(const QString &artist)
{ {
m_model->clear(); m_model->clear();
m_playNextResolved = true;
m_playlist->generator()->startFromArtist(Artist::get(artist)); m_playlist->generator()->startFromArtist(Artist::get(artist));
emit loadingChanged();
emit configuredChanged(); emit configuredChanged();
} }
@@ -142,7 +147,9 @@ void DynamicQmlWidget::startStationFromGenre(const QString &genre)
{ {
tDebug() << "should start startion from genre" << genre; tDebug() << "should start startion from genre" << genre;
m_model->clear(); m_model->clear();
m_playNextResolved = true;
m_playlist->generator()->startFromGenre( genre ); m_playlist->generator()->startFromGenre( genre );
emit loadingChanged();
emit configuredChanged(); emit configuredChanged();
} }
@@ -189,6 +196,11 @@ void DynamicQmlWidget::resolvingFinished(bool hasResults)
qDebug() << "fetching next one"; qDebug() << "fetching next one";
m_playlist->generator()->fetchNext(); m_playlist->generator()->fetchNext();
} }
if( m_playNextResolved && m_proxyModel->rowCount() > 0 ) {
playItem( 0 );
m_playNextResolved = false;
}
} }
void DynamicQmlWidget::trackStarted() void DynamicQmlWidget::trackStarted()

View File

@@ -101,6 +101,7 @@ private:
bool m_runningOnDemand; bool m_runningOnDemand;
bool m_activePlaylist; bool m_activePlaylist;
bool m_playNextResolved;
}; };
} }