Commit 2f111637 authored by camilo higuita's avatar camilo higuita

more plasmo fixes

parent cae22da8
......@@ -46,6 +46,8 @@ add_executable(vvave
models/tracks/tracksmodel.cpp
models/basemodel.cpp
models/baselist.cpp
models/playlists/playlistsmodel.cpp
models/albums/albumsmodel.cpp
)
if (ANDROID)
......@@ -79,7 +81,7 @@ if (TARGET create-apk-vvave)
endif()
target_include_directories(vvave PRIVATE ${TAGLIB_INCLUDE_DIRS})
target_link_libraries(vvave Qt5::Network Qt5::Sql Qt5::WebSockets Qt5::Qml Qt5::Xml Qt5::Multimedia Qt5::Widgets ${TAGLIB_LIBRARIES})
target_link_libraries(vvave Qt5::Network Qt5::Sql Qt5::WebSockets Qt5::Qml Qt5::Xml Qt5::Multimedia Qt5::Widgets Qt5::QuickControls2 ${TAGLIB_LIBRARIES})
install(TARGETS vvave ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES org.kde.vvave.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
......
......@@ -5,6 +5,7 @@
#include <QIcon>
#include <QLibrary>
#include <QStyleHints>
#include <QQuickStyle>
#include <QCommandLineParser>
#include "babe.h"
#include "services/local/player.h"
......
......@@ -30,6 +30,8 @@ import org.kde.kirigami 2.2 as Kirigami
import org.kde.mauikit 1.0 as Maui
import FMList 1.0
import Player 1.0
import AlbumsList 1.0
import TracksList 1.0
Maui.ApplicationWindow
{
......@@ -42,8 +44,8 @@ Maui.ApplicationWindow
/***************************************************/
/******************** ALIASES ********************/
/*************************************************/
property alias playIcon: playIcon
property alias babeBtnIcon: babeBtnIcon
// property alias playIcon: playIcon
// property alias babeBtnIcon: babeBtnIcon
property alias progressBar: mainPlaylist.progressBar
property alias animFooter: mainPlaylist.animFooter
property alias mainPlaylist: mainPlaylist
......@@ -205,6 +207,23 @@ Maui.ApplicationWindow
headBar.middleContent : [
// Row
// {
// Image
// {
// height: iconSizes.medium
// width: height
// source: "file://" + encodeURIComponent(
// currentArtwork)
// }
// Label
// {
// text: "Now"
// }
// },
Maui.ToolButton
{
iconName: "headphones"
......@@ -542,85 +561,6 @@ Maui.ApplicationWindow
onCoverDoubleClicked: Player.playAll(tracks)
}
floatingBar: true
footBarOverlap: true
altToolBars: true
footBar.visible: !mainlistEmpty
headBar.visible: !mainlistEmpty
footBar.leftContent: Label
{
visible: !mainlistEmpty && infoLabels
text: progressTimeLabel
color: darkTextColor
clip: true
}
footBar.rightContent: Label
{
visible: !mainlistEmpty && infoLabels
text: durationTimeLabel
color: darkTextColor
clip: true
}
footBar.middleContent: [
Maui.ToolButton
{
id: babeBtnIcon
iconName: "love"
iconColor: currentBabe ? babeColor : darkTextColor
onClicked: if (!mainlistEmpty)
{
var value = H.faveIt([mainPlaylist.list.model.get(currentTrackIndex).url])
currentBabe = value
mainPlaylist.list.model.get(currentTrackIndex).babe = value ? "1" : "0"
}
},
Maui.ToolButton
{
iconName: "media-skip-backward"
iconColor: darkTextColor
onClicked: Player.previousTrack()
onPressAndHold: Player.playAt(prevTrackIndex)
},
Maui.ToolButton
{
id: playIcon
iconColor: darkTextColor
iconName: isPlaying ? "media-playback-pause" : "media-playback-start"
onClicked:
{
player.playing = !player.playing
}
},
Maui.ToolButton
{
id: nextBtn
iconColor: darkTextColor
iconName: "media-skip-forward"
onClicked: Player.nextTrack()
onPressAndHold: Player.playAt(Player.shuffle())
},
Maui.ToolButton
{
id: shuffleBtn
iconColor: darkTextColor
iconName: isShuffle ? "media-playlist-shuffle" : "media-playlist-repeat"
onClicked:
{
isShuffle = !isShuffle
bae.saveSetting("SHUFFLE",isShuffle, "PLAYBACK")
}
}
]
}
Maui.Page
......@@ -682,7 +622,12 @@ Maui.ApplicationWindow
onRowClicked: Player.addTrack(tracksView.list.get(index))
onQuickPlayTrack: Player.quickPlay(tracksView.list.get(index))
onPlayAll: Player.playAll(bae.get(Q.GET.allTracks))
onAppendAll: Player.appendAll(bae.get(Q.GET.allTracks))
onAppendAll:
{
mainPlaylist.list.append(Q.GET.allTracks)
mainPlaylist.listView.positionViewAtEnd()
}
onQueueTrack: Player.queueTracks([tracksView.list.get(index)], index)
}
}
......@@ -698,6 +643,7 @@ Maui.ApplicationWindow
holder.emojiSize: iconSizes.huge
headBarTitle: count + qsTr(" albums")
list.query: Q.GET.allAlbumsAsc
list.sortBy: Albums.ALBUM
Connections
{
......@@ -712,8 +658,9 @@ Maui.ApplicationWindow
var query = Q.GET.albumTracks_.arg(album)
query = query.arg(artist)
var map = bae.get(query)
Player.playAll(map)
mainPlaylist.list.clear()
mainPlaylist.list.query = query
Player.playAll()
}
onPlayAll:
......@@ -723,15 +670,19 @@ Maui.ApplicationWindow
query = query.arg(data.artist)
var tracks = bae.get(query)
Player.playAll(tracks)
mainPlaylist.list.clear()
mainPlaylist.list.query = query
Player.playAll()
}
onAppendAll:
{
var query = Q.GET.albumTracks_.arg(album)
query = query.arg(artist)
var tracks = bae.get(query)
Player.appendAll(tracks)
mainPlaylist.list.appendQuery(query)
mainPlaylist.listView.positionViewAtEnd()
}
}
}
......@@ -747,6 +698,8 @@ Maui.ApplicationWindow
holder.emojiSize: iconSizes.huge
headBarTitle: count + qsTr(" artists")
list.query: Q.GET.allArtistsAsc
list.sortBy: Albums.ARTIST
table.list.sortBy: Tracks.NONE
Connections
{
......@@ -774,8 +727,8 @@ Maui.ApplicationWindow
onAppendAll:
{
var query = Q.GET.artistTracks_.arg(artist)
var tracks = bae.get(query)
Player.appendAll(tracks)
mainPlaylist.list.appendQuery(query)
mainPlaylist.listView.positionViewAtEnd()
}
}
}
......@@ -939,7 +892,7 @@ Maui.ApplicationWindow
{
target: bae
onRefreshTables: H.refreshCollection(size)
onRefreshTables: H.refreshCollection(size)
// onRefreshTracks: H.refreshTracks()
// onRefreshAlbums: H.refreshAlbums()
// onRefreshArtists: H.refreshArtists()
......
......@@ -49,6 +49,9 @@ TracksModel::SORTBY TracksModel::getSortBy() const
void TracksModel::sortList()
{
if(this->sort == TracksModel::SORTBY::NONE)
return;
const auto key = static_cast<FMH::MODEL_KEY>(this->sort);
qDebug()<< "SORTING LIST BY"<< this->sort;
qSort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
......@@ -144,8 +147,11 @@ void TracksModel::append(const QVariantMap &item)
for(auto key : item.keys())
model.insert(FMH::MODEL_NAME_KEY[key], item[key].toString());
qDebug() << "Appending item to list" << item;
this->list << model;
qDebug()<< this->list;
emit this->postItemAppended();
}
......@@ -170,6 +176,27 @@ void TracksModel::append(const QVariantMap &item, const int &at)
emit this->postItemAppended();
}
void TracksModel::appendQuery(const QString &query)
{
if(this->query.isEmpty())
return;
emit this->preListChanged();
this->list << this->db->getDBData(query);
emit this->postListChanged();
}
void TracksModel::clear()
{
emit this->preListChanged();
this->list.clear();
emit this->postListChanged();
}
bool TracksModel::color(const int &index, const QString &color)
{
if(index >= this->list.size() || index < 0)
......
......@@ -23,7 +23,8 @@ public:
ALBUM = FMH::MODEL_KEY::ALBUM,
RATE = FMH::MODEL_KEY::RATE,
FAV = FMH::MODEL_KEY::FAV,
TRACK = FMH::MODEL_KEY::TRACK
TRACK = FMH::MODEL_KEY::TRACK,
NONE
}; Q_ENUM(SORTBY)
......@@ -54,7 +55,8 @@ public slots:
QVariantMap get(const int &index) const override;
void append(const QVariantMap &item);
void append(const QVariantMap &item, const int &at);
void appendQuery(const QString &query);
void clear();
bool color(const int &index, const QString &color);
bool fav(const int &index, const bool &value);
};
......
......@@ -31,8 +31,8 @@ function playTrack(index)
bae.notifySong(currentTrack.url)
}
// if(currentTrack.lyrics.length < 1)
// bae.trackLyrics(currentTrack.url)
// if(currentTrack.lyrics.length < 1)
// bae.trackLyrics(currentTrack.url)
// root.mainPlaylist.infoView.wikiAlbum = bae.albumWiki(root.mainPlaylist.currentTrack.album,root.mainPlaylist.currentTrack.artist)
// root.mainPlaylist.infoView.wikiArtist = bae.artistWiki(root.mainPlaylist.currentTrack.artist)
......@@ -207,7 +207,7 @@ function savePlaylist()
function clearOutPlaylist()
{
mainPlaylist.table.clearTable()
mainPlaylist.list.clear()
stop()
}
......@@ -233,7 +233,7 @@ function playAll(tracks)
syncPlaylist = ""
infoMsg = ""
mainPlaylist.table.clearTable()
mainPlaylist.list.clear()
pageStack.currentIndex = 0
for(var i in tracks)
......@@ -247,6 +247,17 @@ function playAll(tracks)
}
}
function playAll()
{
sync = false
syncPlaylist = ""
infoMsg = ""
pageStack.currentIndex = 0
mainPlaylist.listView.positionViewAtBeginning()
playAt(0)
}
function babeTrack(url, value)
{
bae.babeTrack(url, value)
......
......@@ -14,7 +14,7 @@ ListView
currentIndex: currentTrackIndex
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
snapMode: ListView.SnapOneItem
snapMode:ListView.SnapToOneItem
model: mainPlaylist.listModel
onMovementEnded:
......@@ -22,17 +22,19 @@ ListView
var index = indexAt(contentX, contentY)
if(index !== currentTrackIndex)
Player.playAt(index)
// positionViewAtIndex(index, ListView.Center)
}
delegate: BabeAlbum
{
id: delegate
itemHeight: coverSize
itemHeight: albumsRollRoot.height
itemWidth: albumsRollRoot.width
albumSize : coverSize
albumRadius : 0
albumSize : itemHeight *0.8
albumRadius : radiusV
showLabels: false
showIndicator: true
showIndicator: false
hideRepeated: false
anchors.verticalCenter: parent.verticalCenter
// increaseCurrentItem : true
......
This diff is collapsed.
......@@ -23,7 +23,9 @@ Maui.Menu
Maui.MenuItem
{
text: cover.visible ? qsTr("Hide cover...") : qsTr("Show cover...")
text: qsTr("Cover list...")
checkable: true
checked: cover.visible
onTriggered: hideCover()
}
......@@ -46,4 +48,12 @@ Maui.Menu
onTriggered: sync = !sync
}
// Maui.MenuItem
// {
// text: qsTr("Playlist list...")
// checkable: true
// checked: mainPlaylistItem.visible
// onTriggered: mainPlaylistItem.visible = !mainPlaylistItem.visible
// }
}
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