Commit 717e7977 authored by Camilo Higuita's avatar Camilo Higuita

experimental dark playback bar and mainlist and initial layout for the babeitintegration platform

parent 7f0411a2
......@@ -26,6 +26,7 @@ android:
include(3rdparty/kirigami/kirigami.pri)
}
DEPENDPATH += taglib
DEPENDPATH += taglib/ape
DEPENDPATH += taglib/asf
......@@ -204,7 +205,8 @@ SOURCES += main.cpp \
babe.cpp \
settings/BabeSettings.cpp \
java/notificationclient.cpp \
db/conthread.cpp
db/conthread.cpp \
services/web/babeit.cpp
......@@ -363,6 +365,31 @@ HEADERS += \
babe.h \
settings/BabeSettings.h \
java/notificationclient.h \
db/conthread.h
db/conthread.h \
services/web/babeit.h
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
#INCLUDEPATH += /usr/include/python3.6m
#LIBS += -lpython3.6m
#defineReplace(copyToDir) {
# files = $$1
# DIR = $$2
# LINK =
# for(FILE, files) {
# LINK += $$QMAKE_COPY $$shell_path($$FILE) $$shell_path($$DIR) $$escape_expand(\\n\\t)
# }
# return($$LINK)
#}
#defineReplace(copyToBuilddir) {
# return($$copyToDir($$1, $$OUT_PWD))
#}
## Copy the binary files dependent on the system architecture
#unix:!macx {
# message("Linux")
# QMAKE_POST_LINK += $$copyToBuilddir($$PWD/library/cat)
#}
<RCC>
<qresource prefix="/">
<file>qtquickcontrols2.conf</file>
<file>library/cat</file>
</qresource>
</RCC>
......@@ -19,6 +19,8 @@
#include <QtAndroid>
#endif
//#include "Python.h"
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
#include "kde/notify.h"
#endif
......@@ -57,6 +59,25 @@ Babe::~Babe()
delete this->thread;
}
//void Babe::runPy()
//{
// QFile cat (BAE::CollectionDBPath+"cat");
// qDebug()<<cat.exists()<<cat.permissions();
// if(!cat.setPermissions(QFile::ExeGroup | QFile::ExeOther | QFile::ExeOther | QFile::ExeUser))
// qDebug()<<"Faile dot give cat permissionsa";
// qDebug()<<cat.exists()<<cat.permissions();
// QProcess process;
// process.setWorkingDirectory(BAE::CollectionDBPath);
// process.start("./cat", QStringList());
// bool finished = process.waitForFinished(-1);
// QString p_stdout = process.readAll();
// qDebug()<<p_stdout<<finished<<process.workingDirectory()<<process.errorString();
//}
QVariantList Babe::get(const QString &queryTxt)
{
return getDBDataQML(queryTxt);
......@@ -96,6 +117,9 @@ void Babe::trackLyrics(const QString &url)
if(track.isEmpty()) return;
if(!track.first()[KEY::LYRICS].isEmpty() && track.first()[KEY::LYRICS] != SLANG[W::NONE])
emit this->trackLyricsReady(track.first()[KEY::LYRICS], url);
else
this->fetchTrackLyrics(track.first());
}
......
......@@ -31,6 +31,8 @@ public:
};
Q_ENUM(HINT)
// Q_INVOKABLE void runPy();
/* DATABASE INTERFACES */
Q_INVOKABLE QVariantList get(const QString &queryTxt);
......
......@@ -333,6 +333,7 @@ bool CollectionDB::colorTagTrack(const QString &path, const QString &value)
bool CollectionDB::lyricsTrack(const DB &track, const QString &value)
{
if(update(TABLEMAP[TABLE::TRACKS],
KEYMAP[KEY::LYRICS],
value,
......
File added
This diff is collapsed.
print("Hello World!")
......@@ -13,6 +13,9 @@
//#include "java/notificationclient.h"
#endif
#include "utils/bae.h"
#include <QCommandLineParser>
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
......@@ -21,6 +24,24 @@ int main(int argc, char *argv[])
app.setApplicationName(BAE::App);
app.setApplicationVersion(BAE::Version);
app.setWindowIcon(QIcon("qrc:/assets/babe.png"));
app.setDesktopFileName(BAE::App);
QCommandLineParser parser;
parser.setApplicationDescription("Babe music player");
const QCommandLineOption versionOption = parser.addVersionOption();
parser.process(app);
const QStringList args = parser.positionalArguments();
bool version = parser.isSet(versionOption);
if(version)
{
printf("%s %s\n", qPrintable(QCoreApplication::applicationName()),
qPrintable(QCoreApplication::applicationVersion()));
return 0;
}
QFontDatabase::addApplicationFont(":/utils/materialdesignicons-webfont.ttf");
// QQuickStyle::setStyle("org.kde.desktop");
......@@ -29,8 +50,8 @@ int main(int argc, char *argv[])
auto context = engine.rootContext();
#ifdef Q_OS_ANDROID
// NotificationClient *notificationClient = new NotificationClient(&engine);
// context->setContextProperty(QLatin1String("notificationClient"), notificationClient);
// NotificationClient *notificationClient = new NotificationClient(&engine);
// context->setContextProperty(QLatin1String("notificationClient"), notificationClient);
KirigamiPlugin::getInstance().registerTypes();
#endif
......
......@@ -139,7 +139,10 @@ Kirigami.ApplicationWindow
overlay.modal: Rectangle
{
color: isMobile ? "#8f28282a" : "transparent"
color: isMobile ? darkColor : "transparent"
opacity: 0.5
height: root.height - playbackControls.height - toolbar.height
y: toolbar.height
}
overlay.modeless: Rectangle
......@@ -228,8 +231,9 @@ Kirigami.ApplicationWindow
onTrackLyricsReady:
{
if(url === currentTrack.url)
root.mainPlaylist.infoView.lyrics = lyrics
console.log("TRACKS READY SIGNAL2")
// if(url === currentTrack.url)
Player.setLyrics(lyrics)
}
onSkipTrack: Player.nextTrack()
......@@ -240,6 +244,7 @@ Kirigami.ApplicationWindow
/* UI */
header: BabeBar
{
id: toolbar
height: toolBarHeight
visible: true
currentIndex: currentView
......@@ -307,7 +312,7 @@ Kirigami.ApplicationWindow
{
id: footerBg
anchors.fill: parent
color: midLightColor
color: darkDarkColor
opacity: opacityLevel
z: -999
......@@ -319,8 +324,8 @@ Kirigami.ApplicationWindow
target: footerBg
property: "color"
easing.type: Easing.InOutQuad
from: darkColor
to: midLightColor
from: darkMidColor
to: darkDarkColor
duration: 500
}
}
......@@ -459,6 +464,7 @@ Kirigami.ApplicationWindow
Layout.row: 2
Layout.column: 2
Layout.maximumHeight: playbackInfo.visible ? playbackInfo.font.pointSize*2 : 0
Label
{
id: playbackInfo
......@@ -471,7 +477,7 @@ Kirigami.ApplicationWindow
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
text: progressTimeLabel + " / " + (currentTrack ? (currentTrack.title ? currentTrack.title + " - " + currentTrack.artist : "--- - "+currentTrack.artist) : "") + " / " + durationTimeLabel
color: foregroundColor
color: darkForegroundColor
font.pointSize: fontSizes.tiny
elide: Text.ElideRight
}
......@@ -488,21 +494,22 @@ Kirigami.ApplicationWindow
BabeButton
{
id: babeBtnIcon
iconName: "love"
iconColor: currentBabe ? babeColor : defaultColor
iconColor: currentBabe ? babeColor : darkForegroundColor
onClicked:
{
var value = mainPlaylist.contextMenu.babeIt(currentTrackIndex)
currentTrack.babe = value ? "1" : "0"
currentBabe = value
// bae.runPy();
}
}
BabeButton
{
id: previousBtn
iconColor: darkForegroundColor
iconName: "media-skip-backward"
onClicked: Player.previousTrack()
onPressAndHold: Player.playAt(prevTrackIndex)
......@@ -511,6 +518,7 @@ Kirigami.ApplicationWindow
BabeButton
{
id: playIcon
iconColor: darkForegroundColor
iconName: isPlaying ? "media-playback-pause" : "media-playback-start"
onClicked:
......@@ -523,6 +531,7 @@ Kirigami.ApplicationWindow
BabeButton
{
id: nextBtn
iconColor: darkForegroundColor
iconName: "media-skip-forward"
onClicked: Player.nextTrack()
......@@ -532,6 +541,8 @@ Kirigami.ApplicationWindow
BabeButton
{
id: shuffleBtn
iconColor: darkForegroundColor
iconName: shuffle ? "media-playlist-shuffle" : "media-playlist-repeat"
onClicked: shuffle = !shuffle
}
......@@ -640,6 +651,9 @@ Kirigami.ApplicationWindow
id: mainPlaylist
anchors.fill: parent
clip: true
Connections
{
target: mainPlaylist
......@@ -653,6 +667,8 @@ Kirigami.ApplicationWindow
id: views
anchors.fill: parent
clip: true
// focusPolicy: Qt.WheelFocus
// visualFocus: true
Column
{
......@@ -677,11 +693,13 @@ Kirigami.ApplicationWindow
else if(currentView === viewsIndex.tracks) tracksView.forceActiveFocus()
else if(currentView === viewsIndex.search) searchView.forceActiveFocus()
if(!babeitView.isConnected && currentIndex === viewsIndex.babeit)
babeitView.logginDialog.open()
}
LogginForm
BabeitView
{
id: babeView
id: babeitView
}
TracksView
......
......@@ -67,5 +67,7 @@
<file>view_models/BabeList.qml</file>
<file>view_models/BabeTable/HeaderMenu.qml</file>
<file>view_models/BabeNotify.qml</file>
<file>widgets/MyBeatView/BabeitView.qml</file>
<file>widgets/PlaybackBar.qml</file>
</qresource>
</RCC>
#include "babeit.h"
BabeIt::BabeIt(QObject *parent) : QObject(parent)
{
}
#ifndef BABEIT_H
#define BABEIT_H
#include <QObject>
class BabeIt : public QObject
{
Q_OBJECT
public:
explicit BabeIt(QObject *parent = nullptr);
signals:
public slots:
};
#endif // BABEIT_H
\ No newline at end of file
......@@ -37,7 +37,7 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
qDebug() << "Getting settings info from: " << BAE::SettingPath;
qDebug() << "Getting artwork files from: " << BAE::CachePath;
#if defined(Q_OS_LINUX)
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
const auto notifyDir = BAE::NotifyDir;
if(!BAE::fileExists(notifyDir+"/Babe.notifyrc"))
......
......@@ -7,61 +7,60 @@ function playTrack(track)
{
root.currentTrack = track
if(bae.fileExists(root.currentTrack.url))
if(bae.fileExists(currentTrack.url))
{
player.source(root.currentTrack.url);
player.source(currentTrack.url);
player.play()
// root.playIcon.iconName = "media-playback-pause"
// root.playIcon.iconName = "media-playback-pause"
var artwork = root.currentTrack.artwork
var artwork = currentTrack.artwork
// root.mainPlaylist.list.currentItem.playingIndicator = true
root.currentArtwork = artwork && artwork.length>0 && artwork !== "NONE" ? artwork : bae.loadCover(root.currentTrack.url)
root.currentArtwork = artwork && artwork.length>0 && artwork !== "NONE" ? artwork : bae.loadCover(currentTrack.url)
root.currentBabe = bae.trackBabe(currentTrack.url)
root.progressBar.enabled = true
root.currentBabe = bae.trackBabe(root.currentTrack.url)
if(!root.isMobile)
{
root.title = root.currentTrack.title + " - " +root.currentTrack.artist
root.title = currentTrack.title + " - " +currentTrack.artist
if(!root.active)
bae.notifySong(root.currentTrack.url)
bae.notifySong(currentTrack.url)
}
var lyrics = root.currentTrack.lyrics
// if(!lyrics || lyrics.length === 0 || lyrics === "NONE" )
// bae.trackLyrics(root.mainPlaylist.currentTrack.url)
// else
root.mainPlaylist.infoView.lyrics = lyrics
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)
// // root.mainPlaylist.infoView.artistHead = bae.artistArt(root.mainPlaylist.currentTrack.artist)
}else root.missingAlert(root.currentTrack)
}else root.missingAlert(currentTrack)
}
}
function setLyrics(lyrics)
{
currentTrack.lyrics = lyrics
root.mainPlaylist.infoView.lyricsText.text = lyrics
}
function stop()
{
player.stop()
root.progressBar.value = 0
root.mainlistEmpty = true
root.progressBar.enabled = false
root.title = "Babe..."
// root.playIcon.iconName = "media-playback-start"
}
function pauseTrack()
{
player.pause()
// root.playIcon.iconName = "media-playback-start"
}
function resumeTrack()
{
player.play()
// root.playIcon.iconName = "media-playback-pause"
}
function nextTrack()
......@@ -228,9 +227,9 @@ function playAll(tracks)
}
function babeTrack()
function babeTrack(url, value)
{
bae.babeTrack(url, value)
}
function addToPlaylist(urls, playlist)
......@@ -238,8 +237,8 @@ function addToPlaylist(urls, playlist)
if(urls.length > 0)
{
bae.trackPlaylist(urls, playlist)
// for(var i in urls)
// bae.trackPlaylist(urls[i], playlist)
// for(var i in urls)
// bae.trackPlaylist(urls[i], playlist)
if(!isMobile)
......
......@@ -17,6 +17,15 @@
#include <cmath>
#define BABE_MAJOR_VERSION 0
#define BABE_MINOR_VERSION 1
#define BABE_PATCH_VERSION 0
#define BABE_VERSION_STR "@BABE_MAJOR_VERSION@.@BABE_MINOR_VERSION@.@BABE_PATCH_VERSION@"
#define BABE_VERSION KDE_MAKE_VERSION(@BABE_MAJOR_VERSION@,@BABE_MINOR_VERSION@,@BABE_PATCH_VERSION@)
using namespace std;
namespace BAE
......@@ -258,7 +267,7 @@ const QStringList DownloadsPaths = QStandardPaths::standardLocations(QStandardPa
const QString NotifyDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
const QString BabePort = "8483";
const QString App = "Babe";
const QString Version = "1.0";
const QString Version = BABE_VERSION_STR;
const QString DBName = "collection.db";
const QStringList MoodColors = {"#F0FF01","#01FF5B","#3DAEFD","#B401FF","#E91E63"};
......
......@@ -8,6 +8,7 @@ Item
property string emoji
property string message
clip: true
property color color : foregroundColor
anchors.fill: parent
......@@ -61,7 +62,7 @@ Item
textFormat: Text.RichText
horizontalAlignment: Qt.AlignHCenter
elide: Text.ElideRight
color: foregroundColor
color: textColor
}
}
}
......
......@@ -5,6 +5,7 @@ import org.kde.kirigami 2.2 as Kirigami
Item
{
id: babeListRoot
property alias list : babeList
property alias model : babeList.model
property alias delegate : babeList.delegate
......@@ -20,13 +21,17 @@ Item
property string headerBarTitle
property bool headerBarExit : true
property string headerBarExitIcon : "window-close"
property color headerBarColor : "transparent"
property color textColor : foregroundColor
property bool wasPulled : false
signal pulled()
signal exit()
focus: true
ColumnLayout
{
......@@ -76,6 +81,7 @@ Item
anim : true
iconName : headerBarExitIcon //"dialog-close"
onClicked : exit()
iconColor: textColor
}
Row
......@@ -83,7 +89,6 @@ Item
id: headerBarActionsLeft
Layout.alignment : Qt.AlignLeft
Layout.leftMargin: headerBarExit ? 0 : contentMargins
}
Label
......@@ -95,7 +100,7 @@ Item
elide : Text.ElideRight
font.bold : false
color : foregroundColor
color : textColor
font.pointSize: fontSizes.big
horizontalAlignment : Text.AlignHCenter
verticalAlignment : Text.AlignVCenter
......@@ -166,6 +171,7 @@ Item
{
id: holder
visible: babeList.count === 0
color : textColor
}
Rectangle
......@@ -175,7 +181,6 @@ Item
z: -999
}
ScrollBar.vertical:BabeScrollBar { }
......
......@@ -5,10 +5,22 @@ import QtQuick.Controls.Material 2.1
Popup
{
width: parent.width * 0.8
height: parent.height *0.8
property int maxWidth : ApplicationWindow.overlay.width
property int maxHeight : ApplicationWindow.overlay.height
width: parent === ApplicationWindow.overlay ? (root.pageStack.wideMode ? parent.width * 0.4 :
(isMobile ? parent.width * 0.8 :
parent.width * 0.7)) :
parent.width * 0.7 > maxWidth ? maxWidth :
parent.width * 0.7
height: parent === ApplicationWindow.overlay ? (root.pageStack.wideMode ? parent.height * 0.5 :
(isMobile ? parent.height * 0.8 :
parent.height * 0.7)) :
parent.height * 0.7 > maxHeight ? maxHeight :
parent.height * 0.7
padding: 0
margins: 0
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
......@@ -20,10 +32,16 @@ Popup
focus: true
clip: true
enter: Transition {
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Material.accent: babeColor
Material.background: backgroundColor
Material.primary: backgroundColor
......
......@@ -7,10 +7,12 @@ import ".."
BabeList
{
// id: list
id: babeTableRoot
holder.message: "<h2>This list is empty</h2><p>You can sdd new music sources from the settings</p>"
// cacheBuffer : 300
headerBarColor: midLightColor
textColor: foregroundColor
property bool trackNumberVisible
property bool quickPlayVisible : true
property bool coverArtVisible : false
......@@ -42,6 +44,7 @@ BabeList
}
headerBarRight: [
BabeButton
{
id: appendBtn
......@@ -49,6 +52,7 @@ BabeList
anim : true
iconName : "archive-insert"//"media-repeat-track-amarok"
onClicked: appendAll()
iconColor: textColor
},
BabeButton
......@@ -56,6 +60,7 @@ BabeList
id: menuBtn
iconName: /*"application-menu"*/ "overflow-menu"
onClicked: headerMenu.popup()
iconColor: textColor
}
]
......@@ -91,7 +96,8 @@ BabeList
trackDurationVisible : trackDuration
trackRatingVisible : trackRating
menuItem: menuItemVisible
color: babeTableRoot.textColor
bgColor: headerBarColor
Connections
{
......
......@@ -114,7 +114,7 @@ BabeDialog
{
playlistsList.model.insert(0, {playlist: title})
playlistsView.playlistViewModel.model.insert(9, {playlist: title})
playlistsList.positionViewAtBeginning()
playlistsList.list.positionViewAtBeginning()
}
newPlaylistField.clear()
......
......@@ -30,7 +30,10 @@ ItemDelegate
}else false
}
property string textColor: ListView.isCurrentItem ? highlightTextColor : foregroundColor
property color bgColor : midColor
property color color : foregroundColor
property color highlightColor : highlightTextColor
property string textColor: ListView.isCurrentItem ? highlightColor : color
property bool number : false
property bool quickPlay : true
property bool coverArt : false
......@@ -41,6 +44,7 @@ ItemDelegate
property string trackMood : art
property alias trackRating : trackRating
// NumberAnimation on x
// {
// running: ListView.isCurrentItem
......@@ -55,8 +59,9 @@ ItemDelegate
if(trackMood.length > 0)
Qt.lighter(trackMood)
else
index % 2 === 0 ? midColor : "transparent"
index % 2 === 0 ? bgColor : "transparent"
}
opacity: 0.3
}
......
......@@ -42,6 +42,7 @@ BabeMenu
function babeIt(index)
{
console.log(index);
var url = listModel.get(index).url
var value = listModel.get(index).babe == "1" ? false : true
......@@ -55,10 +56,10 @@ BabeMenu
{
id: titleLabel
visible: root.isMobile
padding: root.isMobile ? 10 : 0
padding: root.isMobile ? contentMargins : 0
font.bold: true
width: parent.width
height: root.isMobile ? rowHeightAlt : 0
height: root.isMobile ? iconSizes.medium : 0
horizontalAlignment: Qt.AlignHCenter
elide: Text.ElideRight
text: list.currentIndex >= 0 ? list.model.get(list.currentIndex).title : ""
......
......@@ -13,13 +13,7 @@ BabePopup
property string currentUrl
property string currentName
background: Rectangle
{
anchors.fill: parent
color: altColor
z: -999
radius: 3
}
BabeList
{
......
......@@ -43,7 +43,7 @@ BabeGrid
var customHeight = (drawerList.count*rowHeight)+toolBarHeight
if(customHeight > parent.height)
parent.height - root.header.height - root.footer.height
(parent.height*0.9) - root.header.height - root.footer.height
else
{
if(customHeight < parent.height*0.4)
......
......@@ -44,7 +44,7 @@ BabeGrid
var customHeight = (drawerList.count*rowHeight)+toolBarHeight