Commit d9d4bb6b authored by Camilo Higuita's avatar Camilo Higuita

initial move to mauikit, use a single model for mainplaylist releated...

initial move to mauikit, use a single model for mainplaylist releated delegates and babetable swipe fixes
parent ed2e334c
<?xml version="1.0"?>
<manifest package="org.kde.vvave" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
android:name="com.example.android.tools.NotificationClient"
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="vvave" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="vvave" android:screenOrientation="unspecified" android:launchMode="singleTop">
android:name=&quot;com.example.android.tools.NotificationClient&quot;
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
......
......@@ -20,7 +20,6 @@
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
#include <QWidget>
#include "kde/notify.h"
#include "kde/kdeconnect.h"
#endif
#if defined(Q_OS_ANDROID)
......@@ -291,11 +290,11 @@ void Babe::linkDecoder(QString json)
}
case LINK::CODE::COLLECT :
{
auto devices = getDevices();
qDebug()<<"DEVICES:"<< devices;
if(!devices.isEmpty())
sendToDevice(devices.first().toMap().value("name").toString(),
devices.first().toMap().value("id").toString(), msg);
// auto devices = getDevices();
// qDebug()<<"DEVICES:"<< devices;
// if(!devices.isEmpty())
// sendToDevice(devices.first().toMap().value("name").toString(),
// devices.first().toMap().value("id").toString(), msg);
break;
}
......@@ -733,24 +732,6 @@ QVariantList Babe::searchFor(const QStringList &queries)
return mapList;
}
QVariantList Babe::getDevices()
{
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
return KdeConnect::getDevices();
#else
return {};
#endif
}
bool Babe::sendToDevice(const QString &name, const QString &id, const QString &url)
{
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
return KdeConnect::sendToDevice(name, id, url) ? true : false;
#else
return {};
#endif
}
void Babe::debug(const QString &msg)
{
emit this->message(msg);
......
......@@ -24,127 +24,124 @@ using namespace BAE;
class Babe : public CollectionDB
{
Q_OBJECT
Q_OBJECT
public:
explicit Babe(QObject *parent = nullptr);
~Babe();
public:
explicit Babe(QObject *parent = nullptr);
~Babe();
BabeSettings *settings;
Linking link;
Player player;
BabeSettings *settings;
Linking link;
Player player;
// Q_INVOKABLE void runPy();
// Q_INVOKABLE void runPy();
/* DATABASE INTERFACES */
/* DATABASE INTERFACES */
Q_INVOKABLE QVariantList get(const QString &queryTxt);
Q_INVOKABLE QVariantList getList(const QStringList &urls);
Q_INVOKABLE QVariantList get(const QString &queryTxt);
Q_INVOKABLE QVariantList getList(const QStringList &urls);
Q_INVOKABLE void set(const QString &table, const QVariantList &wheres);
Q_INVOKABLE void set(const QString &table, const QVariantList &wheres);
Q_INVOKABLE void trackPlaylist(const QStringList &urls, const QString &playlist);
Q_INVOKABLE void trackLyrics(const QString &url);
Q_INVOKABLE bool trackBabe(const QString &path);
Q_INVOKABLE QString artistArt(const QString &artist);
Q_INVOKABLE QString albumArt(const QString &album, const QString &artist);
Q_INVOKABLE QString artistWiki(const QString &artist);
Q_INVOKABLE QString albumWiki(const QString &album, const QString &artist);
Q_INVOKABLE void trackPlaylist(const QStringList &urls, const QString &playlist);
Q_INVOKABLE void trackLyrics(const QString &url);
Q_INVOKABLE bool trackBabe(const QString &path);
Q_INVOKABLE QString artistArt(const QString &artist);
Q_INVOKABLE QString albumArt(const QString &album, const QString &artist);
Q_INVOKABLE QString artistWiki(const QString &artist);
Q_INVOKABLE QString albumWiki(const QString &album, const QString &artist);
Q_INVOKABLE bool babeTrack(const QString &path, const bool &value);
Q_INVOKABLE bool babeTrack(const QString &path, const bool &value);
/* SETTINGS */
/* SETTINGS */
Q_INVOKABLE void scanDir(const QString &url);
Q_INVOKABLE void brainz(const bool &on);
Q_INVOKABLE bool brainzState();
Q_INVOKABLE void refreshCollection();
Q_INVOKABLE void getYoutubeTrack(const QString &message);
Q_INVOKABLE void scanDir(const QString &url);
Q_INVOKABLE void brainz(const bool &on);
Q_INVOKABLE bool brainzState();
Q_INVOKABLE void refreshCollection();
Q_INVOKABLE void getYoutubeTrack(const QString &message);
/* STATIC METHODS */
/* STATIC METHODS */
Q_INVOKABLE static void saveSetting(const QString &key, const QVariant &value, const QString &group);
Q_INVOKABLE static QVariant loadSetting(const QString &key, const QString &group, const QVariant &defaultValue);
Q_INVOKABLE static void saveSetting(const QString &key, const QVariant &value, const QString &group);
Q_INVOKABLE static QVariant loadSetting(const QString &key, const QString &group, const QVariant &defaultValue);
Q_INVOKABLE static void savePlaylist(const QStringList &list);
Q_INVOKABLE static QStringList lastPlaylist();
Q_INVOKABLE static void savePlaylist(const QStringList &list);
Q_INVOKABLE static QStringList lastPlaylist();
Q_INVOKABLE static void savePlaylistPos(const int &pos);
Q_INVOKABLE static int lastPlaylistPos();
Q_INVOKABLE static void savePlaylistPos(const int &pos);
Q_INVOKABLE static int lastPlaylistPos();
Q_INVOKABLE static bool fileExists(const QString &url);
Q_INVOKABLE static void showFolder(const QString &url);
Q_INVOKABLE static bool fileExists(const QString &url);
Q_INVOKABLE static void showFolder(const QString &url);
/*COLORS*/
Q_INVOKABLE static QString babeColor();
/*COLORS*/
Q_INVOKABLE static QString babeColor();
/*UTILS*/
Q_INVOKABLE static bool isMobile();
Q_INVOKABLE static bool isAndroid();
/*UTILS*/
Q_INVOKABLE static bool isMobile();
Q_INVOKABLE static bool isAndroid();
Q_INVOKABLE static QString moodColor(const int &pos);
Q_INVOKABLE static QString moodColor(const int &pos);
Q_INVOKABLE static QString homeDir();
Q_INVOKABLE static QString musicDir();
Q_INVOKABLE static QString sdDir();
Q_INVOKABLE static QString homeDir();
Q_INVOKABLE static QString musicDir();
Q_INVOKABLE static QString sdDir();
Q_INVOKABLE static QVariantList getDirs(const QString &pathUrl);
Q_INVOKABLE static QVariantMap getParentDir(const QString &path);
Q_INVOKABLE static QVariantList getDirs(const QString &pathUrl);
Q_INVOKABLE static QVariantMap getParentDir(const QString &path);
Q_INVOKABLE static QStringList defaultSources();
Q_INVOKABLE static QStringList defaultSources();
static void registerTypes();
static void registerTypes();
/*USEFUL*/
Q_INVOKABLE QString loadCover(const QString &url);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries);
/*USEFUL*/
Q_INVOKABLE QString loadCover(const QString &url);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries);
/*KDE*/
Q_INVOKABLE static QVariantList getDevices();
Q_INVOKABLE static bool sendToDevice(const QString &name, const QString &id, const QString &url);
/*KDE*/
Q_INVOKABLE void notify(const QString &title, const QString &body);
Q_INVOKABLE void notifySong(const QString &url);
Q_INVOKABLE void notify(const QString &title, const QString &body);
Q_INVOKABLE void notifySong(const QString &url);
/*ANDROID*/
Q_INVOKABLE static void sendText(const QString &text);
Q_INVOKABLE static void sendTrack(const QString &url);
Q_INVOKABLE static void openFile(const QString &url);
Q_INVOKABLE void fileChooser();
Q_INVOKABLE static void androidStatusBarColor(const QString &color, const bool &contrast);
/*ANDROID*/
Q_INVOKABLE static void sendText(const QString &text);
Q_INVOKABLE static void sendTrack(const QString &url);
Q_INVOKABLE static void openFile(const QString &url);
Q_INVOKABLE void fileChooser();
Q_INVOKABLE static void androidStatusBarColor(const QString &color, const bool &contrast);
public slots:
void debug(const QString &msg);
public slots:
void debug(const QString &msg);
private:
private:
ConThread *thread;
ConThread *thread;
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
Notify *nof;
Notify *nof;
#elif defined (Q_OS_ANDROID)
NotificationClient *nof;
Android *android;
NotificationClient *nof;
Android *android;
#endif
QString fetchCoverArt(DB &song);
static QVariantList transformData(const DB_LIST &dbList);
void fetchTrackLyrics(DB &song);
void linkDecoder(QString json);
signals:
void refreshTables(int size);
void refreshTracks();
void refreshAlbums();
void refreshArtists();
void trackLyricsReady(QString lyrics, QString url);
void skipTrack();
void babeIt();
void message(QString msg);
QString fetchCoverArt(DB &song);
static QVariantList transformData(const DB_LIST &dbList);
void fetchTrackLyrics(DB &song);
void linkDecoder(QString json);
signals:
void refreshTables(int size);
void refreshTracks();
void refreshAlbums();
void refreshArtists();
void trackLyricsReady(QString lyrics, QString url);
void skipTrack();
void babeIt();
void message(QString msg);
};
......
......@@ -7,12 +7,10 @@ QT += webengine
HEADERS += \
$$PWD/notify.h \
$$PWD/mpris2.h \
$$PWD/kdeconnect.h
SOURCES += \
$$PWD/notify.cpp \
$$PWD/mpris2.cpp \
$$PWD/kdeconnect.cpp
LIBS += -ltag
......
......@@ -10,7 +10,6 @@
#include <QStyleHints>
#include <QCommandLineParser>
#include "services/local/linking.h"
#ifdef STATIC_KIRIGAMI
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
......@@ -28,6 +27,8 @@
#include "utils/bae.h"
#include "services/web/youtube.h"
#include "services/web/Spotify/spotify.h"
#include "services/local/linking.h"
#include "mauikit/src/mauikit.h"
#ifdef Q_OS_ANDROID
Q_DECL_EXPORT
......@@ -100,6 +101,7 @@ int main(int argc, char *argv[])
"LINK", // name in QML (does not have to match C++ name)
"Error: only enums" // error in case someone tries to create a MyNamespace object
);
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
#endif
......@@ -115,6 +117,10 @@ int main(int argc, char *argv[])
QtWebEngine::initialize();
#endif
#ifdef MAUI_APP
MauiKit::getInstance().registerTypes();
#endif
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
......
This diff is collapsed.
/home/camilo/Coding/qml/buho/mauikit
\ No newline at end of file
......@@ -29,7 +29,7 @@ function playTrack(track)
bae.notifySong(currentTrack.url)
}
// bae.trackLyrics(currentTrack.url)
// 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)
......@@ -139,10 +139,7 @@ function appendTracksAt(tracks, at)
{
if(tracks)
for(var i in tracks)
{
mainPlaylist.albumsRoll.model.insert(parseInt(at)+parseInt(i), tracks[i])
mainPlaylist.list.model.insert(parseInt(at)+parseInt(i), tracks[i])
}
}
function appendTrack(track)
......@@ -150,7 +147,6 @@ function appendTrack(track)
if(track)
{
mainPlaylist.list.model.append(track)
mainPlaylist.albumsRoll.append(track)
animFooter.running = true
if(sync === true)
{
......@@ -235,7 +231,6 @@ function playAll(tracks)
infoMsg = ""
mainPlaylist.table.clearTable()
mainPlaylist.albumsRoll.model.clear()
pageStack.currentIndex = 0
for(var i in tracks)
......
......@@ -9,13 +9,12 @@ ToolButton
id: babeButton
property string iconName
property int iconSize : toolBarIconSize
property int iconSize : 22
property color iconColor: textColor
readonly property string defaultColor : textColor
property bool anim : false
spacing: space.small
display: pageStack.wideMode ? AbstractButton.TextBesideIcon : AbstractButton.IconOnly
icon.name: babeButton.iconName
icon.width: babeButton.iconSize
......
......@@ -4,6 +4,7 @@ import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.2 as Kirigami
import org.kde.maui 1.0 as Maui
import "../../view_models"
import "../../utils/Help.js" as H
......@@ -41,7 +42,7 @@ SwipeDelegate
property bool remoteArtwork: false
width: parent.width
height: sameAlbum ? rowHeight * 0.7 : altHeight
height: sameAlbum ? rowHeight : altHeight
padding: 0
clip: true
autoExclusive: true
......@@ -73,18 +74,18 @@ SwipeDelegate
anchors.right: parent.right
spacing: space.big
BabeButton
Maui.ToolButton
{
iconName: "documentinfo"
onClicked:
{
swipe.close()
}
anchors.verticalCenter: parent.verticalCenter
onClicked: swipe.close()
}
BabeButton
Maui.ToolButton
{
iconName: "love"
anchors.verticalCenter: parent.verticalCenter
iconColor: babe === "1" ? babeColor : textColor
onClicked:
{
......@@ -95,9 +96,11 @@ SwipeDelegate
}
}
BabeButton
Maui.ToolButton
{
iconName: "view-media-recent"
anchors.verticalCenter: parent.verticalCenter
onClicked:
{
swipe.close()
......@@ -105,9 +108,11 @@ SwipeDelegate
}
}
BabeButton
Maui.ToolButton
{
iconName: "media-playback-start"
anchors.verticalCenter: parent.verticalCenter
onClicked:
{
swipe.close()
......
......@@ -32,7 +32,7 @@ linux:unix:!android {
message("Unknown configuration")
}
include(mauikit/mauikit.pri)
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
......
......@@ -14,7 +14,6 @@ ToolBar
property alias babeBar : babeBar
property string accentColor : babeColor
property int currentIndex : 0
property bool accent : pageStack.wideMode || (!pageStack.wideMode && pageStack.currentIndex === 1)
signal tracksViewClicked()
signal albumsViewClicked()
......@@ -91,21 +90,7 @@ ToolBar
Layout.maximumWidth: tracksView.implicitWidth * 1.3
Layout.maximumHeight: toolBarIconSize
BabeButton
{
id: tracksView
anchors.centerIn: parent
iconName: "view-media-track"
iconColor: accent && currentIndex === viewsIndex.tracks ? accentColor : textColor
onClicked: tracksViewClicked()
text: qsTr("Tracks")
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Tracks")
}
}
Item
......@@ -119,10 +104,6 @@ ToolBar
{
id: albumsView
anchors.centerIn: parent
text: qsTr("Albums")
iconName: /*"album"*/ "view-media-album-cover"
iconColor: accent && currentIndex === viewsIndex.albums ? accentColor : textColor
onClicked: albumsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
......@@ -143,9 +124,6 @@ ToolBar
{
id: artistsView
anchors.centerIn: parent
text: qsTr("Artists")
iconName: "view-media-artist"
iconColor: accent && currentIndex === viewsIndex.artists ? accentColor : textColor
onClicked: artistsViewClicked()
hoverEnabled: true
......
......@@ -9,9 +9,7 @@ Item
width: height
x: contentMargins
y: parent.height - (playbackControls.height*0.5)
z: progressBar.z + 1
y: parent.height - (root.footBar.height*0.5)
property bool isHovered : false
......@@ -90,7 +88,8 @@ Item
{
width: miniArtwork.width
height: miniArtwork.height
Rectangle {
Rectangle
{
anchors.centerIn: parent
width: miniArtwork.adapt ? miniArtwork.width : Math.min(
miniArtwork.width,
......@@ -100,6 +99,8 @@ Item
}
}
}
}
MouseArea
......@@ -108,10 +109,10 @@ Item
drag.target: parent
drag.axis: Drag.XAndYAxis
drag.minimumX: 0
drag.maximumX: playbackControls.width - parent.width
drag.maximumX: root.footBar.width - parent.width
drag.minimumY: 0
drag.maximumY: playbackControls.y
drag.maximumY: pageStack.height
onClicked:
{
if (!isMobile && pageStack.wideMode)
......
......@@ -15,7 +15,7 @@ ListView
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
snapMode: ListView.SnapOneItem
model : ListModel{}
model: mainPlaylist.list.model
onMovementEnded:
{
......@@ -48,11 +48,6 @@ ListView
}
}
function append(album)
{
model.insert(count, album)
}
function positionAlbum(index)
{
albumsRollRoot.currentIndex = index
......
......@@ -3,6 +3,7 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.2 as Kirigami
import org.kde.maui 1.0 as Maui
import "../InfoView"
......@@ -114,7 +115,7 @@ Item
}
}
ToolBar
Maui.ToolBar
{
id: mainlistContext
width: parent.width
......@@ -125,10 +126,6 @@ Item
Layout.fillWidth: true
height: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing*2
// anchors.top: cover.bottom
leftPadding: 0
rightPadding: 0
// Rectangle
// {
// anchors.fill: parent
......@@ -144,7 +141,7 @@ Item
drag.axis: Drag.YAxis
drag.minimumY: 0
drag.maximumY:stackView.currentItem === table ? coverSize : 0
z: -1
onMouseYChanged:
{
if(stackView.currentItem === table )
......@@ -160,86 +157,81 @@ Item
}
}
RowLayout
leftContent: Maui.ToolButton
{
anchors.fill: parent
anchors.centerIn: parent
// spacing: 0
// Layout.margins: 0
Item
id: infoBtn
iconName: stackView.currentItem === table ? "documentinfo" : "go-previous"
onClicked:
{
Layout.fillWidth: true
BabeButton
if( stackView.currentItem !== table)
{
id: infoBtn
anchors.centerIn: parent
// iconColor: darkTextColor
iconName: stackView.currentItem === table ? "documentinfo" : "go-previous"
onClicked:
{
if( stackView.currentItem !== table)
{
cover.visible = true
stackView.pop(table) }
else {
cover.visible = false
stackView.push(infoView)
}
}
cover.visible = true
stackView.pop(table) }
else {
cover.visible = false
stackView.push(infoView)
}
}
}
// Item
// {
// Layout.fillWidth: true
// BabeButton
// {
// anchors.centerIn: parent
//// iconColor: darkTextColor
// iconName: "headphones"
// onClicked: goFocusMode()
// }
// }
// Item
// {
// Layout.fillWidth: true
Item
{
Layout.fillWidth: true
// BabeButton
// {
// anchors.centerIn: parent
//// iconColor: darkTextColor
// iconName: "headphones"
// onClicked: goFocusMode()
// }
// }
BabeButton
{
anchors.centerIn: parent
// iconColor: darkTextColor
iconName: "videoclip-amarok"
onClicked:
{
youtubeView.openVideo = 1
youtube.getQuery(currentTrack.title+" "+currentTrack.artist)
pageStack.currentIndex = 1
currentView = viewsIndex.youtube
}
}
middleContent: Maui.PieButton
{
iconName: "list-add"
model: ListModel
{
ListElement{iconName: "amarok-video" ; btn: "video"}
ListElement{iconName: "documentinfo" ; btn: "info"}
ListElement{iconName: "artists" ; btn: "similar"}
}
Item
onItemClicked:
{
Layout.fillWidth: true
BabeButton
if(item.btn === "video")
{
id: menuBtn
anchors.centerIn: parent
Layout.fillWidth: true
iconName: "overflow-menu"
onClicked: isMobile ? playlistMenu.open() : playlistMenu.popup()
// iconColor: darkTextColor
youtubeView.openVideo = 1
youtube.getQuery(currentTrack.title+" "+currentTrack.artist)
pageStack.currentIndex = 1
currentView = viewsIndex.youtube
}
if(item.btn === "info")
{
if( stackView.currentItem !== table)
{
cover.visible = true
stackView.pop(table) }
else {
cover.visible = false
stackView.push(infoView)
}
}
}
}
rightContent : Maui.ToolButton
{
id: menuBtn
iconName: "overflow-menu"
onClicked: isMobile ? playlistMenu.open() : playlistMenu.popup()
}
}
Item
{