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);
......
......@@ -26,7 +26,7 @@ class Babe : public CollectionDB
{
Q_OBJECT
public:
public:
explicit Babe(QObject *parent = nullptr);
~Babe();
......@@ -102,9 +102,6 @@ class Babe : public CollectionDB
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);
Q_INVOKABLE void notify(const QString &title, const QString &body);
Q_INVOKABLE void notifySong(const QString &url);
......@@ -116,10 +113,10 @@ class Babe : public CollectionDB
Q_INVOKABLE static void androidStatusBarColor(const QString &color, const bool &contrast);
public slots:
public slots:
void debug(const QString &msg);
private:
private:
ConThread *thread;
......@@ -136,7 +133,7 @@ class Babe : public CollectionDB
void fetchTrackLyrics(DB &song);
void linkDecoder(QString json);
signals:
signals:
void refreshTables(int size);
void refreshTracks();
void refreshAlbums();
......
......@@ -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,22 +157,9 @@ Item
}
}
RowLayout
{
anchors.fill: parent
anchors.centerIn: parent
// spacing: 0
// Layout.margins: 0
Item
{
Layout.fillWidth: true
BabeButton
leftContent: Maui.ToolButton
{
id: infoBtn
anchors.centerIn: parent
// iconColor: darkTextColor
iconName: stackView.currentItem === table ? "documentinfo" : "go-previous"
onClicked:
{
......@@ -189,7 +173,7 @@ Item
}
}
}
}
// Item
// {
......@@ -204,42 +188,50 @@ Item
// }
// }
Item
middleContent: Maui.PieButton
{
Layout.fillWidth: true
iconName: "list-add"
BabeButton
model: ListModel
{
anchors.centerIn: parent
// iconColor: darkTextColor
iconName: "videoclip-amarok"
onClicked:
ListElement{iconName: "amarok-video" ; btn: "video"}
ListElement{iconName: "documentinfo" ; btn: "info"}
ListElement{iconName: "artists" ; btn: "similar"}
}
onItemClicked:
{
if(item.btn === "video")
{
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)
}
}
}
}
Item
{
Layout.fillWidth: true
BabeButton
rightContent : Maui.ToolButton
{
id: menuBtn
anchors.centerIn: parent
Layout.fillWidth: true
iconName: "overflow-menu"
onClicked: isMobile ? playlistMenu.open() : playlistMenu.popup()
// iconColor: darkTextColor
}
}
}
}
Item
{
id: mainPlaylistItem
......
......@@ -9,7 +9,7 @@ ItemDelegate
id: delegate
width: parent.width
height: rowHeightAlt
height: rowHeight
clip: true
property string labelColor: ListView.isCurrentItem ? highlightedTextColor : textColor
......
......@@ -35,313 +35,5 @@ Kirigami.GlobalDrawer
// handle.y : coverSize
//handle.parent: ApplicationWindow.overlay
SourcesDialog
{
id: sourcesDialog
}
BabeConsole
{
id: babeConsole
}
bannerImageSource: "qrc:/assets/banner.svg"
actions: [
Kirigami.Action
{
text: "Vvave Stream"
iconName: "love"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.vvave
}
},
Kirigami.Action
{
text: qsTr("Linking")
iconName: isMobile ? "computer-laptop" : "phone"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.linking
if(!isLinked) linkingView.linkingConf.open()
}
},
Kirigami.Action
{
text: qsTr("YouTube")
iconName: "im-youtube"
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.youtube
}
},
Kirigami.Action
{
text: qsTr("Spotify")
onTriggered:
{
pageStack.currentIndex = 1
currentView = viewsIndex.spotify
}
},
Kirigami.Action
{
text: qsTr("Collection")
iconName: "database-index"
Kirigami.Action
{
text: qsTr("Sources...")
onTriggered: sourcesDialog.open()
iconName: "folder-new"
}
Kirigami.Action
{
text: qsTr("Re-Scan")
onTriggered: bae.refreshCollection();
}
Kirigami.Action
{
text: qsTr("Refresh...")
iconName: "view-refresh"
Kirigami.Action
{
text: qsTr("Tracks")
onTriggered: H.refreshTracks();
}
Kirigami.Action
{
text: qsTr("Albums")
onTriggered: H.refreshAlbums();
}
Kirigami.Action
{
text: qsTr("Artists")
onTriggered: H.refreshArtists();
}
Kirigami.Action
{
text: qsTr("All")
onTriggered: H.refreshCollection();
}
}
Kirigami.Action
{
text: qsTr("Clean")
onTriggered: bae.removeMissingTracks();
iconName: "edit-clear"
}
},
Kirigami.Action
{
text: qsTr("Settings...")
iconName: "view-media-config"
Kirigami.Action
{
text: "Brainz"
Kirigami.Action
{
id: brainzToggle
text: checked ? "Turn OFF" : "Turn ON"
checked: activeBrainz
checkable: true
onToggled:
{
bae.saveSetting("BRAINZ", checked === true ? true : false, "BABE")
bae.brainz(checked === true ? true : false)
}
}
}
Kirigami.Action
{
text: "Appearance"
Kirigami.Action
{
text: "Icon size"
Kirigami.Action
{
text: iconSizes.small
onTriggered :
{
bae.saveSetting("ICON_SIZE", text, "BABE")
iconSizeChanged(text)
}
}
Kirigami.Action
{
text: iconSizes.medium
onTriggered :
{
bae.saveSetting("ICON_SIZE", text, "BABE")
iconSizeChanged(text)
}
}
Kirigami.Action
{
text: iconSizes.big
onTriggered :
{
bae.saveSetting("ICON_SIZE", text, "BABE")
iconSizeChanged(text)
}
}
}
// Kirigami.Action
// {
// text: "Theme"
// visible: isMobile
// Kirigami.Action
// {
// text: "Light"
// onTriggered : switchColorScheme("Light")
// }
// Kirigami.Action
// {
// text: "Dark"
// onTriggered : switchColorScheme("Dark")
// }
// Kirigami.Action
// {
// text: "Breeze"
// onTriggered : switchColorScheme("Breeze")
// }
// }
}
Kirigami.Action
{
text: "Player"
Kirigami.Action
{
text: "Info label"