Commit f5a83266 authored by Camilo Higuita's avatar Camilo Higuita

use system icon theme on gnu linux desktop enviroments

parent 7b2f4c0d
......@@ -185,6 +185,17 @@ bool Babe::moodTrack(const QString &path, const QString &color)
return this->con->artTrack(path, color);
}
bool Babe::addPlaylist(const QString &playlist)
{
qDebug()<<playlist;
return this->con->addPlaylist(playlist);
}
QStringList Babe::getPlaylists()
{
return this->con->getPlaylists();
}
void Babe::notify(const QString &title, const QString &body)
{
......
......@@ -46,6 +46,8 @@ public:
Q_INVOKABLE bool rateTrack(const QString &path, const int &value);
Q_INVOKABLE int trackRate(const QString &path);
Q_INVOKABLE bool moodTrack(const QString &path, const QString &color);
Q_INVOKABLE bool addPlaylist(const QString &playlist);
Q_INVOKABLE QStringList getPlaylists();
......
......@@ -12,4 +12,9 @@ var Query = {
artistTracksSimple_ : "select * from tracks where artist = \"%1\"",
tracksWhere_ : "select t.*, al.artwork from tracks t inner join albums al on al.album = t.album and al.artist = t.artist where %1",
mostPlayedTracks : "select t.*, al.artwork from tracks t inner join albums al on t.album = al.album and t.artist = al.artist WHERE al.played > 0 ORDER BY played desc LIMIT 100",
favoriteTracks : "select t.*, al.artwork from tracks t inner join albums al on t.album = al.album and t.artist = al.artist where stars > 0 order by stars desc limit 100",
recentTracks: "select t.* , al.artwork from tracks t inner join albums al on t.album = al.album and t.artist = al.artist order by strftime(\"%s\", addDate) desc LIMIT 100",
babedTracks: "select t.* , al.artwork from tracks t inner join albums al on t.album = al.album and t.artist = al.artist where t.babe = 1"
}
......@@ -8,6 +8,9 @@ import "db/Queries.js" as Q
import "utils/Player.js" as Player
import "utils"
import "widgets"
import "widgets/PlaylistsView"
import "widgets/MainPlaylist"
import "view_models"
//Kirigami.ApplicationWindow
ApplicationWindow
......@@ -18,10 +21,6 @@ ApplicationWindow
height: 500
title: qsTr("Babe")
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
// property int columnWidth: Kirigami.Units.gridUnit * 13
readonly property bool isMobile: bae.isMobile()
......@@ -29,7 +28,7 @@ ApplicationWindow
property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int currentView : 0
property int iconSize
property int toolBarIconSize: isMobile ? 24 : 22
property alias mainPlaylist : mainPlaylist
// minimumWidth: columnWidth
......@@ -119,7 +118,7 @@ ApplicationWindow
{
id: mainToolbar
visible: true
size: iconSize
size: toolBarIconSize
currentIndex: currentView
onPlaylistViewClicked: currentView = 0
......@@ -160,25 +159,20 @@ ApplicationWindow
// color: bae.foregroundColor()
// }
BabeIcon
BabeButton
{
anchors.centerIn: parent
visible: !(searchInput.focus || searchInput.text)
id: searchBtn
icon: "magnify"
color: bae.foregroundColor()
iconName: "edit-find" //"search"
}
ToolButton
BabeButton
{
anchors.right: parent.right
BabeIcon
{
visible: searchInput.text
icon: "eraser"
color: bae.foregroundColor()
}
visible: searchInput.text
iconName: "edit-clear"
onClicked: clearSearch()
}
......@@ -210,7 +204,7 @@ ApplicationWindow
SettingsView
{
id: settingsDrawer
onIconSizeChanged: iconSize = size
onIconSizeChanged: toolBarIconSize = size
}
......@@ -308,7 +302,18 @@ ApplicationWindow
}
}
PlaylistsView {}
PlaylistsView
{
id: playlistsView
Connections
{
target: playlistsView
onRowClicked: Player.addTrack(track)
onQuickPlayTrack: Player.quickPlay(track)
// onPlayAll: Player.playAll(bae.get(Q.Query.allTracks))
// onAppendAll: Player.appendAll(bae.get(Q.Query.allTracks))
}
}
SearchTable
......
......@@ -6,13 +6,10 @@
<file>utils/Icons.js</file>
<file>utils/materialdesignicons-webfont.ttf</file>
<file>widgets/TracksView.qml</file>
<file>widgets/PlaylistsView.qml</file>
<file>widgets/InfoView.qml</file>
<file>widgets/ArtistsView.qml</file>
<file>widgets/AlbumsView.qml</file>
<file>assets/cover.png</file>
<file>data_models/db_model.qml</file>
<file>widgets/MainPlaylist.qml</file>
<file>assets/test.jpg</file>
<file>db/script.sql</file>
<file>widgets/SettingsView.qml</file>
......@@ -20,13 +17,10 @@
<file>assets/face.png</file>
<file>view_models/BabeHolder.qml</file>
<file>view_models/BabeDialog.qml</file>
<file>widgets/PlaylistMenu.qml</file>
<file>widgets/LyricsView.qml</file>
<file>db/Queries.js</file>
<file>widgets/SearchTable.qml</file>
<file>utils/Help.js</file>
<file>assets/Babe.notifyrc</file>
<file>widgets/FolderPicker.qml</file>
<file>utils/BabeIcon.qml</file>
<file>view_models/BabeScrollBar.qml</file>
<file>assets/bars.gif</file>
......@@ -38,7 +32,17 @@
<file>view_models/BabeTable/BabeTable.qml</file>
<file>view_models/BabeTable/TableMenu.qml</file>
<file>view_models/BabeTable/TableMenuItem.qml</file>
<file>widgets/PlaylistViewDelegate.qml</file>
<file>view_models/ColorTagsBar.qml</file>
<file>view_models/FolderPicker/FolderPicker.qml</file>
<file>widgets/MainPlaylist/MainPlaylist.qml</file>
<file>widgets/MainPlaylist/PlaylistMenu.qml</file>
<file>widgets/PlaylistsView/PlaylistsView.qml</file>
<file>widgets/PlaylistsView/PlaylistViewDelegate.qml</file>
<file>widgets/InfoView/InfoView.qml</file>
<file>widgets/InfoView/LyricsView.qml</file>
<file>widgets/PlaylistsView/PlaylistsViewModel.qml</file>
<file>widgets/PlaylistsView/AddPlaylistDialog.qml</file>
<file>view_models/Props.qml</file>
<file>view_models/BabeButton.qml</file>
</qresource>
</RCC>
......@@ -3,17 +3,18 @@ import "../utils/Icons.js" as MdiFont
Text
{
id: babeIcon
property string iconColor: bae.foregroundColor()
property int iconSize
readonly property string defaultColor : iconColor
property string icon
readonly property string defaultColor : iconColor
text: MdiFont.Icon[icon]
text: MdiFont.Babe[babeIcon.icon] || MdiFont.Icon[babeIcon.icon]
font.family: "Material Design Icons"
font.pixelSize: iconSize || 24
font.pixelSize: babeIcon.iconSize
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: iconColor || defaultColor
color: babeIcon.iconColor
}
var Icon = {
"accessPoint": "\uf002",
"accessPointNetwork": "\uf003",
......@@ -809,7 +811,7 @@ var Icon = {
"heartBox": "\uf2D2",
"heartBoxOutline": "\uf2D3",
"heartBroken": "\uf2D4",
"heartOutline": "\uf2D5",
"heartOutline": "\uf2D5",
"heartPulse": "\uf5F6",
"help": "\uf2D6",
"helpCircle": "\uf2D7",
......@@ -1650,3 +1652,55 @@ var Icon = {
"youtubePlay": "\uf5C3",
"zipBox": "\uf5C4"
}
var Babe = {
"musicnote": Icon.musicNote,
"audio-headphones": Icon.headphones,
"headphones": Icon.headphones,
"album" : Icon.album,
"media-album-cover": Icon.album,
"artist": Icon.face,
"view-media-artist": Icon.artist,
"library-music": Icon.libraryMusic,
"application-menu": "\uf493",
"media-playback-start" : Icon.play,
"media-playback-pause" : Icon.pause,
"media-skip-backward": "\uf4AE",
"media-skip-forward": "\uf4AD",
"love-amarok": Icon.heartOutline,
"love": Icon.heartOutline,
"media-playlist-shuffle": "\uf49D",
"media-playlist-repeat": "\uf49E",
"help-about" : Icon.informationOutline,
"info-help" : Icon.informationOutline,
"arrow-left":"\uf04D",
"overflow-menu": Icon.dotsVertical,
"application-menu" : Icon.dotsVertical,
"player-time": "\uf40C",
"search" : Icon.magnify,
"edit-find" : Icon.magnify,
"edit-clear" : Icon.eraser,
/*playlists icons*/
"list-add": Icon.playlistPlus,
"list-remove": Icon.minus,
"entry-delete":Icon.playlistRemove,
"amarok_playcount": Icon.trendingUp,
"draw-star": Icon.starCircle,
"filename-year-amarok": Icon.clock,
"internet-amarok": Icon.youtubePlay,
"tag" : Icon.tagMultiple,
"similarartists-amarok": Icon.tagFaces,
"office-chart-line" : Icon.fire,
"filename-track-amarok" : Icon.attachment,
/*headers*/
"dialog-close" : Icon.close,
"window-close" : Icon.close,
"player-time" : Icon.playBoxOutline,
"media-repeat-track-amarok": Icon.playlistPlay,
"archive-insert": Icon.playlistPlay,
"amarok_clock" : Icon.playlistPlay
}
......@@ -14,12 +14,12 @@ function playTrack(track)
if(!root.active)
bae.notifySong(root.mainPlaylist.currentTrack.url)
root.mainPlaylist.playIcon.text = Icon.pause
root.mainPlaylist.playIcon.iconName = "media-playback-pause"
if(bae.trackBabe(root.mainPlaylist.currentTrack.url))
root.mainPlaylist.babeBtnIcon.color = bae.babeColor()
root.mainPlaylist.babeBtnIcon.iconColor = bae.babeColor()
else
root.mainPlaylist.babeBtnIcon.color = root.mainPlaylist.babeBtnIcon.defaultColor
root.mainPlaylist.babeBtnIcon.iconColor = root.mainPlaylist.babeBtnIcon.defaultColor
var lyrics = root.mainPlaylist.currentTrack.lyrics
......@@ -41,19 +41,19 @@ function stop()
root.mainPlaylist.progressBar.value = 0
root.mainPlaylist.cover.visible = false
root.title = "Babe..."
root.mainPlaylist.playIcon.text = Icon.play
root.mainPlaylist.playIcon.iconName = "media-playback-start"
}
function pauseTrack()
{
player.pause()
root.mainPlaylist.playIcon.text = Icon.play
root.mainPlaylist.playIcon.iconName = "media-playback-start"
}
function resumeTrack()
{
player.play()
root.mainPlaylist.playIcon.text = Icon.pause
root.mainPlaylist.playIcon.iconName = "media-playback-pause"
}
function nextTrack()
......@@ -197,14 +197,12 @@ function babeTrack()
if(bae.trackBabe(root.mainPlaylist.currentTrack.url))
{
bae.babeTrack(root.mainPlaylist.currentTrack.url, false)
root.mainPlaylist.babeBtnIcon.text = Icon.heartOutline
root.mainPlaylist.babeBtnIcon.color = root.mainPlaylist.babeBtnIcon.defaultColor
root.mainPlaylist.babeBtnIcon.iconColor = root.mainPlaylist.babeBtnIcon.defaultColor
}else
{
bae.babeTrack(root.mainPlaylist.currentTrack.url, true)
root.mainPlaylist.babeBtnIcon.text = Icon.heartOutline
root.mainPlaylist.babeBtnIcon.color = bae.babeColor()
root.mainPlaylist.babeBtnIcon.iconColor = bae.babeColor()
bae.notify("Track Babe'd",root.mainPlaylist.currentTrack.title +" by "+ root.mainPlaylist.currentTrack.artist )
}
......
import QtQuick 2.0
import QtQuick.Controls 2.2
import "../utils"
ToolButton
{
id: babeButton
property string iconName
property int iconSize : !isMobile ? 24 : 22
property string iconColor: bae.foregroundColor()
readonly property string defaultColor : iconColor
icon.name: !isMobile ? "" : babeButton.iconName
icon.width: !isMobile ? 0 : babeButton.iconSize
// icon.height: isMobile ? 0 : babeButton.iconSize
icon.color: !isMobile ? "transparent" : (iconColor || defaultColor)
BabeIcon
{
id: babeIcon
visible: !isMobile
icon: babeButton.iconName
iconColor: babeButton.iconColor || babeButton.defaultColor
iconSize: babeButton.iconSize
}
}
......@@ -74,7 +74,6 @@ Pane
// maximumFlickVelocity: albumSize*8
model: gridModel
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
// highlight: Rectangle
......
......@@ -20,6 +20,6 @@ ScrollBar
implicitWidth: 6
implicitHeight: 100
radius: width / 2
color: scrollBar.pressed ? bae.hightlightColor() : bae.darkColor()
color: scrollBar.pressed ? bae.hightlightColor(): bae.darkColor()
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../view_models/FolderPicker"
import "../../utils"
import ".."
ListView
{
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
id: list
// cacheBuffer : 300
......@@ -45,7 +45,7 @@ ListView
{
width: list.width
height: list.currentItem.height
color: bae.hightlightColor() || myPalette.highlight
color: bae.hightlightColor()
y: list.currentItem.y
}
......@@ -103,24 +103,24 @@ ListView
anchors.fill: parent
ToolButton
BabeButton
{
id: closeBtn
visible: headerClose
width: parent.height
height: parent.height
BabeIcon { icon: "close" }
iconName: "window-close" //"dialog-close"
onClicked: headerClosed()
}
ToolButton
BabeButton
{
id: playAllBtn
Layout.fillHeight: true
width: parent.height
height: parent.height
BabeIcon {icon: "playBoxOutline"}
iconName: "amarok_clock"///"player-time"
onClicked: playAll()
}
......@@ -140,26 +140,26 @@ ListView
verticalAlignment: Text.AlignVCenter
}
ToolButton
BabeButton
{
id: appendBtn
Layout.fillHeight: true
width: parent.height
height: parent.height
BabeIcon {icon: "playlistPlus"}
iconName : "archive-insert"//"media-repeat-track-amarok"
onClicked: appendAll()
}
ToolButton
BabeButton
{
id: menuBtn
Layout.fillHeight: true
width: parent.height
height: parent.height
BabeIcon {icon: "dotsVertical"}
iconName: "application-menu" //"overflow-menu"
onClicked: {}
}
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import "../../utils"
import "../../view_models"
ItemDelegate
{
......@@ -40,11 +40,11 @@ ItemDelegate
property string trackMood : art
property alias trackRating : trackRating
// NumberAnimation on x
// {
// running: ListView.isCurrentItem
// from: 0; to: 100
// }
// NumberAnimation on x
// {
// running: ListView.isCurrentItem
// from: 0; to: 100
// }
Rectangle
{
......@@ -118,13 +118,14 @@ ItemDelegate
Layout.fillHeight: true
width: sameAlbum ? 64 : parent.height
ToolButton
BabeButton
{
id: playBtn
anchors.centerIn: parent
BabeIcon { icon: "playCircle"; color: textColor }
iconName: "media-playback-start"
iconColor: textColor
onClicked: play()
iconSize: isMobile ? 24 : 22
}
}
......
......@@ -18,7 +18,7 @@ Menu
property int rate : 0
property string starColor : "#FFC107"
property string starReg : bae.foregroundColor()
property string starIcon: "star"
property string starIcon: "draw-star"
property int assetsize : menuItemHeight/2
property int menuItemHeight : root.isMobile ? 48 : 32;
......@@ -76,7 +76,7 @@ Menu
// horizontalAlignment: Qt.AlignHCenter
// elide: Text.ElideRight
// text: list.currentIndex >= 0 ? list.model.get(list.currentIndex).title : ""
// color: bae.foregroundColor()
// color: root.palette["foreground"]
// }
TableMenuItem
......@@ -131,75 +131,60 @@ Menu
RowLayout
{
anchors.fill: parent
ToolButton
BabeButton
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
BabeIcon
{
icon: starIcon
color: rate >= 1 ? starColor :starReg
iconSize: assetsize
}
iconName: starIcon
iconColor: rate >= 1 ? starColor :starReg
iconSize: assetsize
onClicked: rateIt(1)
}
ToolButton
BabeButton
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
BabeIcon
{
icon: starIcon
color: rate >= 2 ? starColor :starReg
iconSize: assetsize
}
iconName: starIcon
iconColor: rate >= 2 ? starColor :starReg
iconSize: assetsize
onClicked: rateIt(2)
}
ToolButton
BabeButton
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
BabeIcon
{
icon: starIcon
color: rate >= 3 ? starColor :starReg
iconSize: assetsize
}
iconName: starIcon
iconColor: rate >= 3 ? starColor :starReg
iconSize: assetsize
onClicked: rateIt(3)
}
ToolButton
BabeButton
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
BabeIcon
{
icon: starIcon
color: rate >= 4 ? starColor :starReg
iconSize: assetsize
}
iconName: starIcon
iconColor: rate >= 4 ? starColor :starReg
iconSize: assetsize
onClicked: rateIt(4)
}
ToolButton
BabeButton
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
BabeIcon
{
icon: starIcon
color: rate >= 5 ? starColor :starReg
iconSize: assetsize
}
iconName: starIcon
iconColor: rate >= 5 ? starColor :starReg
iconSize: assetsize
onClicked: rateIt(5)
}
......
......@@ -11,7 +11,7 @@ MenuItem
// background: Rectangle
// {
// color: tableMenuItemRoot.hovered ? bae.hightlightColor() : bae.backgroundColor()
// color: tableMenuItemRoot.hovered ? palette.highlight : palette.background
// }
hoverEnabled: true
......
......@@ -6,11 +6,12 @@ Item
{
property int recSize : 16
signal colorClicked(string color)
RowLayout
{
anchors.fill: parent
anchors.centerIn: parent
ToolButton
{
Layout.fillHeight: true
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../view_models/FolderPicker"
import "../utils"
import "../../view_models"
Popup
{
// width: parent.width *0.7
......@@ -38,15 +38,11 @@ Popup
{
width:parent.width
ToolButton
BabeButton
{
Layout.alignment: Qt.AlignLeft
id: goBackBtn
BabeIcon
{
icon: "arrowLeft"
}
iconName: "arrow-left"
onClicked:
{
var dir = bae.getParentDir(dirList.currentUrl)
......
......@@ -5,7 +5,6 @@ import ".."
ListView
{
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
id: list
property int currentRow : -1
......@@ -56,7 +55,7 @@ ListView
width: list.width
height: list.currentItem.height
color: bae.hightlightColor() || myPalette.highlight
color: bae.hightlightColor()
opacity: 0.2
y: list.currentItem.y
}
......
import QtQuick 2.0
Item {
}
......@@ -129,16 +129,19 @@ BabeGrid
var map = bae.get(query)
for(var i in map)
drawerList.model.append(map[i])
if(map.length > 0)
for(var i in map)
drawerList.model.append(map[i])
}
function populate()
{
var map = bae.get(Q.Query.allAlbumsAsc)
for(var i in map)
gridModel.append(map[i])
if(map.length > 0)
for(var i in map)
gridModel.append(map[i])
}
function filter(tracks)
......
......@@ -119,16 +119,19 @@ BabeGrid
var query = Q.Query.artistTracks_.arg(artist)
var map = bae.get(query)
for(var i in map)
drawerList.model.append(map[i])
if(map.length > 0)
for(var i in map)
drawerList.model.append(map[i])
}