Commit 11ccf8c9 authored by Camilo Higuita's avatar Camilo Higuita

small animation on miniartwork to indicate playing state

parent c821476a
......@@ -422,6 +422,25 @@ Kirigami.ApplicationWindow
Layout.rowSpan: 2
Layout.column: 1
Rectangle
{
visible: miniArtwork.visible
anchors.centerIn: parent
height: 44
width: 44
color: darkForegroundColor
z: -999
radius: Math.min(width, height)
}
RotationAnimator on rotation
{
from: 0;
to: 360;
duration: 5000
loops: Animation.Infinite
running: isPlaying
}
// height: headerHeight
// width: miniArtwork.visible ? headerHeight : 0
......@@ -430,10 +449,10 @@ Kirigami.ApplicationWindow
id: miniArtwork
visible: ((!pageStack.wideMode && pageStack.currentIndex !== 0) || !mainPlaylist.cover.visible) && !mainlistEmpty
height: headerHeight
width: headerHeight
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
height: 40
width: 40
// anchors.left: parent.left
anchors.centerIn: parent
source:
{
if(currentArtwork)
......@@ -454,6 +473,26 @@ Kirigami.ApplicationWindow
pageStack.currentIndex = 0
}
}
layer.enabled: true
layer.effect: OpacityMask
{
maskSource: Item
{
width: miniArtwork.width
height: miniArtwork.height
Rectangle
{
anchors.centerIn: parent
width: miniArtwork.adapt ? miniArtwork.width : Math.min(miniArtwork.width, miniArtwork.height)
height: miniArtwork.adapt ? miniArtwork.height : width
radius: Math.min(width, height)
}
}
}
}
}
......@@ -502,7 +541,6 @@ Kirigami.ApplicationWindow
var value = mainPlaylist.contextMenu.babeIt(currentTrackIndex)
currentTrack.babe = value ? "1" : "0"
currentBabe = value
// bae.runPy();
}
}
......@@ -521,11 +559,11 @@ Kirigami.ApplicationWindow
id: playIcon
iconColor: darkForegroundColor
iconName: isPlaying ? "media-playback-pause" : "media-playback-start"
iconName: isPlaying ? "media-playback-pause" : "media-playback-start"
onClicked:
{
if(player.isPaused()) Player.resumeTrack()
else Player.pauseTrack()
if(isPlaying) Player.pauseTrack()
else Player.resumeTrack()
}
}
......
......@@ -9,7 +9,6 @@ Player::Player(QObject *parent) : QObject(parent)
emit this->durationChanged(BAE::transformTime(dur/1000));
});
this->player->setVolume(100);
this->updater = new QTimer(this);
......@@ -22,15 +21,18 @@ void Player::source(const QString &url)
this->player->setMedia(QUrl::fromLocalFile(this->sourceurl));
}
void Player::play()
bool Player::play()
{
if(sourceurl.isEmpty()) return;
if(sourceurl.isEmpty()) return false;
if(!updater->isActive())
this->updater->start(250);
if(this->player->isAvailable())
this->player->play();
else return false;
return true;
}
void Player::pause()
......
......@@ -12,7 +12,7 @@ public:
explicit Player(QObject *parent = nullptr);
Q_INVOKABLE void source(const QString &url);
Q_INVOKABLE void play();
Q_INVOKABLE bool play();
Q_INVOKABLE void pause();
Q_INVOKABLE void stop();
Q_INVOKABLE void seek(const int &pos);
......
......@@ -11,6 +11,7 @@ function playTrack(track)
{
player.source(currentTrack.url);
player.play()
// root.playIcon.iconName = "media-playback-pause"
var artwork = currentTrack.artwork
......@@ -58,8 +59,10 @@ function pauseTrack()
}
function resumeTrack()
{
player.play()
{
if(!player.play() && !mainlistEmpty)
playAt(0)
}
function nextTrack()
......@@ -97,8 +100,9 @@ function playAt(index)
{
if(index < root.mainPlaylist.list.count)
{
root.mainPlaylist.list.currentIndex = index
playTrack(root.mainPlaylist.list.model.get(index))
currentTrackIndex = index
mainPlaylist.list.currentIndex = index
playTrack(mainPlaylist.list.model.get(index))
}
}
......
......@@ -2,6 +2,7 @@ import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import "../../view_models"
import QtGraphicalEffects 1.0
ItemDelegate
{
......@@ -44,13 +45,13 @@ ItemDelegate
property string trackMood : art
property alias trackRating : trackRating
// NumberAnimation on x
// {
// running: ListView.isCurrentItem
// from: 0; to: 100
// }
Rectangle
{
anchors.fill: parent
......@@ -113,7 +114,7 @@ ItemDelegate
fillMode: Image.PreserveAspectFit
cache: false
antialiasing: false
smooth: true
smooth: true
}
onDoubleClicked: artworkCoverDoubleClicked()
......
......@@ -16,6 +16,7 @@ BabeGrid
// albumCoverRadius: Math.min(albumCoverSize, albumCoverSize)
property alias list : drawerList.list
property alias table : drawerList
property int customHeight : (drawerList.count*rowHeight)+toolBarHeight
signal rowClicked(var track)
signal playAlbum(var tracks)
......@@ -41,8 +42,6 @@ BabeGrid
height:
{
var customHeight = (drawerList.count*rowHeight)+toolBarHeight
if(customHeight > parent.height)
(parent.height*0.9) - root.header.height - root.footer.height
else
......
......@@ -315,7 +315,6 @@ Item
onRowClicked:
{
prevTrackIndex = currentTrackIndex
currentTrackIndex = currentIndex
Player.playAt(index)
}
......
......@@ -52,9 +52,9 @@ BabePopup
{
// var similar = bae.get('select distinct * from tracks where title LIKE "%'+searchInput.text+'%" or artist LIKE "%'+searchInput.text+'%" or album LIKE "%'+searchInput.text+'%" limit 5')
var similarArtist = bae.get('select distinct * from tracks where artist LIKE "%'+searchInput.text+'%" limit 3')
var similarAlbum= bae.get('select distinct * from tracks where album LIKE "%'+searchInput.text+'%" limit 3')
var similarTracks = bae.get('select distinct * from tracks where title LIKE "%'+searchInput.text+'%" limit 3')
var similarArtist = bae.get('select distinct * from tracks where artist LIKE "%'+searchInput.text+'%" limit 5')
var similarAlbum= bae.get('select distinct * from tracks where album LIKE "%'+searchInput.text+'%" limit 5')
var similarTracks = bae.get('select distinct * from tracks where title LIKE "%'+searchInput.text+'%" limit 5')
var checkList = []
......
......@@ -15,6 +15,8 @@ Item
property var searchRes : []
property var savedQueries : []
property bool autoSuggestions : true
function runSearch(searchTxt)
{
if(searchTxt)
......@@ -65,7 +67,7 @@ Item
}
Rectangle
{
{
visible: suggestionsPopup.visible
width: parent.width
height: parent.height-searchBox.height
......@@ -85,6 +87,9 @@ Item
ColumnLayout
{
anchors.fill: parent
width: parent.width
height: parent.height
BabeTable
{
id: searchTable
......@@ -133,7 +138,13 @@ Item
Layout.leftMargin: contentMargins
visible: true
iconName: "view-filter"
onClicked: suggestionsPopup.visible ? suggestionsPopup.close() : suggestionsPopup.open()
iconColor: autoSuggestions ? babeColor : foregroundColor
onClicked:
{
autoSuggestions = !autoSuggestions
if(!autoSuggestions)
suggestionsPopup.close()
}
}
TextInput
......@@ -152,7 +163,7 @@ Item
wrapMode: TextEdit.Wrap
//activeFocusOnPress: true
onAccepted: runSearch(searchInput.text)
// onActiveFocusChanged: activeFocus ? suggestionsPopup.open() : suggestionsPopup.close()
onActiveFocusChanged: if(activeFocus && autoSuggestions) suggestionsPopup.open()
onTextEdited: if(suggestionsPopup.visible) suggestionsPopup.updateSuggestions()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment