Commit d5ff8b47 authored by Camilo Higuita's avatar Camilo Higuita

the return of kirigami. now deployed also on android

parent f5a83266
kirigami @ b8ed308c
Subproject commit 0c578797c7274c74cfd19d170cab09d90e71370e
Subproject commit b8ed308c1194be1dc1b52aed28d4efd09bbfa56a
......@@ -15,9 +15,9 @@ include(kde/kde.pri)
CONFIG += c++11
include(android-openssl.pri)
#android: {
# include(3rdparty/kirigami/kirigami.pri)
#}
android: {
include(3rdparty/kirigami/kirigami.pri)
}
DEPENDPATH += taglib
DEPENDPATH += taglib/ape
......@@ -85,7 +85,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp \
db/collectionDB.cpp \
settings/settings.cpp \
services/local/taginfo.cpp \
services/local/player.cpp \
utils/brain.cpp \
......@@ -196,6 +195,7 @@ SOURCES += main.cpp \
taglib/tag.cpp \
taglib/tagunion.cpp \
babe.cpp \
settings/BabeSettings.cpp
......@@ -224,7 +224,6 @@ DISTFILES += \
HEADERS += \
db/collectionDB.h \
utils/bae.h \
settings/settings.h \
settings/fileloader.h \
services/local/taginfo.h \
services/local/player.h \
......@@ -345,4 +344,5 @@ HEADERS += \
taglib/config.h \
taglib/taglib_config.h \
babe.h \
settings/BabeSettings.h
......@@ -5,7 +5,7 @@
#include <QColor>
#include <QIcon>
#include "db/collectionDB.h"
#include "settings/settings.h"
#include "settings/BabeSettings.h"
#include "pulpo/pulpo.h"
#include <QApplication>
#include <QDesktopWidget>
......@@ -22,9 +22,9 @@ Babe::Babe(QObject *parent) : QObject(parent)
qDebug()<<"CONSTRUCTING ABE INTERFACE";
this->con = new CollectionDB(this);
this->set = new settings(this);
this->set = new BabeSettings(this);
connect(set, &settings::refreshTables, [this](QVariantMap tables)
connect(set, &BabeSettings::refreshTables, [this](QVariantMap tables)
{
emit this->refreshTables(tables);
});
......@@ -323,12 +323,12 @@ QString Babe::textColor()
QString Babe::hightlightColor()
{
#if defined(Q_OS_ANDROID)
return "";
return "#58bcff";
#elif defined(Q_OS_LINUX)
QWidget widget;
return widget.palette().color(QPalette::Highlight).name();
#elif defined(Q_OS_WIN32)
return "";
return "#58bcff";
#endif
}
......
......@@ -12,7 +12,7 @@ class Notify;
class CollectionDB;
class Pulpo;
class settings;
class BabeSettings;
using namespace BAE;
......@@ -103,7 +103,7 @@ public:
private:
CollectionDB *con;
settings *set;
BabeSettings *set;
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
Notify *nof;
#endif
......
......@@ -7,9 +7,9 @@
#include "services/local/player.h"
#include <QLibrary>
//#ifdef Q_OS_ANDROID
//#include "./3rdparty/kirigami/src/kirigamiplugin.h"
//#endif
#ifdef Q_OS_ANDROID
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
#endif
int main(int argc, char *argv[])
{
......@@ -23,16 +23,17 @@ int main(int argc, char *argv[])
auto context = engine.rootContext();
#ifdef Q_OS_ANDROID
KirigamiPlugin::getInstance().registerTypes();
#endif
Babe bae;
Player player;
// bae.registerTypes();
context->setContextProperty("bae", &bae);
context->setContextProperty("player", &player);
//#ifdef Q_OS_ANDROID
// KirigamiPlugin::getInstance().registerTypes();
//#endif
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
......
......@@ -2,7 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
//import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.2 as Kirigami
import "db/Queries.js" as Q
import "utils/Player.js" as Player
......@@ -12,8 +12,7 @@ import "widgets/PlaylistsView"
import "widgets/MainPlaylist"
import "view_models"
//Kirigami.ApplicationWindow
ApplicationWindow
Kirigami.ApplicationWindow
{
id: root
visible: true
......@@ -25,15 +24,16 @@ ApplicationWindow
readonly property bool isMobile: bae.isMobile()
property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int columnWidth: Kirigami.Units.gridUnit * 22
property int coverSize: columnWidth*0.6
// property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int currentView : 0
property int toolBarIconSize: isMobile ? 24 : 22
property alias mainPlaylist : mainPlaylist
// minimumWidth: columnWidth
// pageStack.defaultColumnWidth: columnWidth
// pageStack.initialPage: [playlistPage, views]
pageStack.defaultColumnWidth: columnWidth
pageStack.initialPage: [mainPlaylist, views]
// overlay.modal: Rectangle
// {
// color: "transparent"
......@@ -121,11 +121,31 @@ ApplicationWindow
size: toolBarIconSize
currentIndex: currentView
onPlaylistViewClicked: currentView = 0
onTracksViewClicked: currentView = 1
onAlbumsViewClicked: currentView = 2
onArtistsViewClicked: currentView = 3
onPlaylistsViewClicked: currentView = 4
onPlaylistViewClicked:
{
pageStack.currentIndex = 0
}
onTracksViewClicked:
{
pageStack.currentIndex = 1
currentView = 0
}
onAlbumsViewClicked:
{
pageStack.currentIndex = 1
currentView = 1
}
onArtistsViewClicked:
{
pageStack.currentIndex = 1
currentView = 2
}
onPlaylistsViewClicked:
{
pageStack.currentIndex = 1
currentView = 3
}
onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
}
......@@ -201,13 +221,33 @@ ApplicationWindow
z: -999
}
Component.onCompleted:
{
if(!isMobile)
root.width = columnWidth*3
}
SettingsView
{
id: settingsDrawer
onIconSizeChanged: toolBarIconSize = size
onIconSizeChanged: toolBarIconSize = (size === 24 && isMobile) ? 24 : 22
}
MainPlaylist
{
id: mainPlaylist
Connections
{
target: mainPlaylist
onCoverPressed: Player.appendAll(tracks)
onCoverDoubleClicked: Player.playAll(tracks)
}
}
Page
{
id: views
......@@ -215,9 +255,9 @@ ApplicationWindow
height: parent.height
clip: true
transform: Translate {
x: (settingsDrawer.position * views.width * 0.33)*-1
}
// transform: Translate {
// x: (settingsDrawer.position * views.width * 0.33)*-1
// }
Column
{
......@@ -247,19 +287,6 @@ ApplicationWindow
}
MainPlaylist
{
id: mainPlaylist
Connections
{
target: mainPlaylist
onCoverPressed: Player.appendAll(tracks)
onCoverDoubleClicked: Player.playAll(tracks)
}
}
TracksView
{
id: tracksView
......
......@@ -16,14 +16,14 @@
*/
#include "settings.h"
#include "BabeSettings.h"
#include "../db/collectionDB.h"
#include "fileloader.h"
#include "../utils/brain.h"
#include "../services/local/socket.h"
#include "../services/web/youtube.h"
settings::settings(QObject *parent) : QObject(parent)
BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
{
this->connection = new CollectionDB(this);
......@@ -109,20 +109,20 @@ settings::settings(QObject *parent) : QObject(parent)
});
connect(this, &settings::collectionPathChanged, this, &settings::populateDB);
connect(this, &BabeSettings::collectionPathChanged, this, &BabeSettings::populateDB);
this->watcher = new QFileSystemWatcher(this);
connect(this->watcher, &QFileSystemWatcher::directoryChanged, this, &settings::handleDirectoryChanged);
connect(this->watcher, &QFileSystemWatcher::directoryChanged, this, &BabeSettings::handleDirectoryChanged);
}
settings::~settings()
BabeSettings::~BabeSettings()
{
qDebug()<<"DELETING SETTINGS";
delete fileLoader;
delete brainDeamon;
}
void settings::on_remove_clicked()
void BabeSettings::on_remove_clicked()
{
qDebug() << this->pathToRemove;
if (!this->pathToRemove.isEmpty())
......@@ -139,7 +139,7 @@ void settings::on_remove_clicked()
}
}
void settings::refreshCollectionPaths()
void BabeSettings::refreshCollectionPaths()
{
// auto queryTxt = QString("SELECT %1 FROM %2").arg(BAE::KEYMAP[BAE::KEY::URL], BAE::TABLEMAP[BAE::TABLE::SOURCES]);
......@@ -148,14 +148,14 @@ void settings::refreshCollectionPaths()
// }
}
void settings::addToWatcher(QStringList paths)
void BabeSettings::addToWatcher(QStringList paths)
{
qDebug()<<"duplicated paths in watcher removd: "<<paths.removeDuplicates();
if(!paths.isEmpty()) watcher->addPaths(paths);
}
void settings::collectionWatcher()
void BabeSettings::collectionWatcher()
{
auto queryTxt = QString("SELECT %1 FROM %2").arg(BAE::KEYMAP[BAE::KEY::URL], BAE::TABLEMAP[BAE::TABLE::TRACKS]);
......@@ -184,7 +184,7 @@ void settings::collectionWatcher()
this->addToWatcher(this->dirs);
}
void settings::handleDirectoryChanged(const QString &dir)
void BabeSettings::handleDirectoryChanged(const QString &dir)
{
qDebug()<<"directory changed:"<<dir;
......@@ -202,14 +202,14 @@ void settings::handleDirectoryChanged(const QString &dir)
}
void settings::checkCollectionBrainz(const bool &state)
void BabeSettings::checkCollectionBrainz(const bool &state)
{
// this->refreshCollectionPaths();
// this->collectionWatcher();
this->startBrainz(state, 3000);
}
void settings::startBrainz(const bool &on, const uint &speed)
void BabeSettings::startBrainz(const bool &on, const uint &speed)
{
this->brainDeamon->setInterval(speed);
if(on)
......@@ -219,7 +219,7 @@ void settings::startBrainz(const bool &on, const uint &speed)
}
void settings::populateDB(const QStringList &paths)
void BabeSettings::populateDB(const QStringList &paths)
{
qDebug() << "Function Name: " << Q_FUNC_INFO
<< "new path for database action: " << paths;
......
......@@ -24,13 +24,13 @@ class Brain;
using namespace BAE;
class settings : public QObject
class BabeSettings : public QObject
{
Q_OBJECT
public:
explicit settings(QObject *parent = nullptr);
~settings();
explicit BabeSettings(QObject *parent = nullptr);
~BabeSettings();
void checkCollectionBrainz(const bool &state);
void collectionWatcher();
......
......@@ -811,7 +811,7 @@ var Icon = {
"heartBox": "\uf2D2",
"heartBoxOutline": "\uf2D3",
"heartBroken": "\uf2D4",
"heartOutline": "\uf2D5",
"heartOutline": "\uf2D5",
"heartPulse": "\uf5F6",
"help": "\uf2D6",
"helpCircle": "\uf2D7",
......@@ -1655,15 +1655,34 @@ var Icon = {
var Babe = {
"musicnote": Icon.musicNote,
/*toolbar*/
"media-optical-audio": Icon.headphones,
"audio-headphones": Icon.headphones,
"headphones": Icon.headphones,
"filename-filetype-amarok": Icon.musicNote,
"musicnote": Icon.musicNote,
"album" : Icon.album,
"media-album-cover": Icon.album,
"artist": Icon.face,
"view-media-artist": Icon.artist,
"view-media-artist": Icon.face,
"library-music": Icon.libraryMusic,
"application-menu": "\uf493",
"view-media-playlist" : Icon.libraryMusic,
"application-menu": Icon.dotsVertical,
"games-config-options" : Icon.dotsVertical,
/*playback bar*/
"documentinfo" :Icon.informationOutline,
"help-about" : Icon.informationOutline,
"info-help" : Icon.informationOutline,
"media-playback-start" : Icon.play,
"media-playback-pause" : Icon.pause,
"media-skip-backward": "\uf4AE",
......@@ -1672,9 +1691,9 @@ var Babe = {
"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",
......@@ -1689,6 +1708,7 @@ var Babe = {
"amarok_playcount": Icon.trendingUp,
"draw-star": Icon.starCircle,
"filename-year-amarok": Icon.clock,
"internet-services": Icon.youtubePlay,
"internet-amarok": Icon.youtubePlay,
"tag" : Icon.tagMultiple,
"similarartists-amarok": Icon.tagFaces,
......@@ -1701,6 +1721,6 @@ var Babe = {
"window-close" : Icon.close,
"player-time" : Icon.playBoxOutline,
"media-repeat-track-amarok": Icon.playlistPlay,
"archive-insert": Icon.playlistPlay,
"archive-insert": Icon.playlistPlus,
"amarok_clock" : Icon.playlistPlay
}
......@@ -93,7 +93,8 @@ function playAt(index)
function quickPlay(track)
{
root.currentView = 0
root.pageStack.currentIndex = 1
appendTrack(track)
playAt(root.mainPlaylist.list.count-1)
root.mainPlaylist.list.positionViewAtEnd()
......@@ -180,7 +181,7 @@ function cleanPlaylist()
function playAll(tracks)
{
root.mainPlaylist.list.clearTable()
root.currentView = 0
root.pageStack.currentIndex = 1
for(var i = 0; i< tracks.length; i++)
appendTrack(tracks[i])
......
......@@ -6,19 +6,19 @@ ToolButton
{
id: babeButton
property string iconName
property int iconSize : !isMobile ? 24 : 22
property int iconSize : isMobile ? 24 : 22
property string iconColor: bae.foregroundColor()
readonly property string defaultColor : iconColor
readonly property string defaultColor : bae.foregroundColor()
icon.name: !isMobile ? "" : babeButton.iconName
icon.width: !isMobile ? 0 : babeButton.iconSize
icon.name: isMobile ? "" : babeButton.iconName
icon.width: isMobile ? 0 : babeButton.iconSize
// icon.height: isMobile ? 0 : babeButton.iconSize
icon.color: !isMobile ? "transparent" : (iconColor || defaultColor)
icon.color: isMobile ? "transparent" : (iconColor || defaultColor)
BabeIcon
{
id: babeIcon
visible: !isMobile
visible: isMobile
icon: babeButton.iconName
iconColor: babeButton.iconColor || babeButton.defaultColor
iconSize: babeButton.iconSize
......
......@@ -39,8 +39,6 @@ ListView
clip: true
highlight: Rectangle
{
width: list.width
......@@ -120,7 +118,7 @@ ListView
width: parent.height
height: parent.height
iconName: "amarok_clock"///"player-time"
iconName: /*"amarok_clock"*/ "player-time"
onClicked: playAll()
}
......@@ -159,7 +157,7 @@ ListView
width: parent.height
height: parent.height
iconName: "application-menu" //"overflow-menu"
iconName: /*"application-menu"*/ "overflow-menu"
onClicked: {}
}
......
......@@ -7,8 +7,11 @@ ItemDelegate
{
id: delegateRoot
readonly property int rowHeight: isMobile ? 64 : 52
readonly property int rowHeightAlt: isMobile ? 48 : 32
width: parent.width
height: sameAlbum ? 48 : 64
height: sameAlbum ? rowHeightAlt : rowHeight
clip: true
signal play()
signal rightClicked()
......@@ -81,7 +84,7 @@ ItemDelegate
visible: coverArt
Layout.fillHeight: true
width: sameAlbum ? 64 : parent.height
width: sameAlbum ? rowHeight : parent.height
ToolButton
{
......@@ -116,7 +119,7 @@ ItemDelegate
{
visible: quickPlay
Layout.fillHeight: true
width: sameAlbum ? 64 : parent.height
width: sameAlbum ? rowHeight : parent.height
BabeButton
{
......@@ -145,8 +148,6 @@ ItemDelegate
anchors.fill: parent
rows:2
columns:3
// rowSpacing: 0
// columnSpacing: 20
Label
{
......@@ -160,7 +161,7 @@ ItemDelegate
Layout.alignment: Qt.AlignCenter
verticalAlignment: Qt.AlignVCenter
text: track
text: track + ". "
font.bold: true
elide: Text.ElideRight
......@@ -179,7 +180,7 @@ ItemDelegate
Layout.column: 2
verticalAlignment: Qt.AlignVCenter
text: title
font.bold: true
font.bold: !sameAlbum
elide: Text.ElideRight
font.pointSize: 10
......
......@@ -41,14 +41,14 @@ BabeGrid
{
id: drawer
height: parent.height * 0.4
height: parent.height * 0.4
// x: albumsViewGrid.width/2
width: parent.width
edge: Qt.BottomEdge
interactive: false
focus: true
modal: root.isMobile
dragMargin: 0
Component.onCompleted: drawerList.forceActiveFocus()
background: Rectangle
......
......@@ -42,8 +42,8 @@ ToolBar
BabeButton
{
id: playlistView
iconName: "headphones" //"media-optical-audio"
iconColor: currentIndex === 0? accentColor : textColor
iconName: /*"headphones"*/ "media-optical-audio"
iconColor: pageStack.currentItem === mainPlaylist ? accentColor : textColor
iconSize: size
onClicked: playlistViewClicked()
......@@ -63,8 +63,8 @@ ToolBar
BabeButton
{
id: tracksView
iconName: "musicnote" //"filename-filetype-amarok"
iconColor: currentIndex === 1? accentColor : textColor
iconName: /*"musicnote"*/ "filename-filetype-amarok"
iconColor: currentIndex === 0? accentColor : textColor
iconSize: size
onClicked: tracksViewClicked()
......@@ -78,8 +78,8 @@ ToolBar
BabeButton
{
id: albumsView
iconName: "album" //"media-album-cover"
iconColor: currentIndex === 2? accentColor : textColor
iconName: /*"album" */ "media-album-cover"
iconColor: currentIndex === 1? accentColor : textColor
iconSize: size
onClicked: albumsViewClicked()
......@@ -94,8 +94,8 @@ ToolBar
{
id: artistsView
iconName: "artist" //"view-media-artist"
iconColor: currentIndex === 3? accentColor : textColor
iconName: /*"artist" */ "view-media-artist"
iconColor: currentIndex === 2? accentColor : textColor
iconSize: size
onClicked: artistsViewClicked()
......@@ -110,8 +110,8 @@ ToolBar
{
id: playlistsView
iconName: "library-music" //"view-media-playlist"
iconColor: currentIndex === 4? accentColor : textColor
iconName: /*"library-music"*/ "view-media-playlist"
iconColor: currentIndex === 3? accentColor : textColor
iconSize: size
onClicked: playlistsViewClicked()
......@@ -122,8 +122,6 @@ ToolBar
ToolTip.visible: hovered
ToolTip.text: qsTr("Playlists")
}
}
Row
......@@ -134,7 +132,7 @@ ToolBar
{
id: settingsIcon
iconName: "application-menu"//"games-config-options"
iconName: /*"application-menu"*/"games-config-options"
iconColor: settingsDrawer.visible ? accentColor : textColor
iconSize: size
......
......@@ -19,6 +19,7 @@ Item
property var currentTrack
property string currentArtwork
property bool shuffle : false
property int playbackIconSize: isMobile ? 24 : 22
property alias progressBar : progressBar
property alias cover : cover
......@@ -35,9 +36,9 @@ Item
// Component.onCompleted:
// {
// if(list.count>0)
// root.width = columnWidth
// root.width = coverSize
// else
// root.width = columnWidth*3
// root.width = coverSize*3
// }
Rectangle
{
......@@ -60,7 +61,7 @@ Item
Layout.row: 1
Layout.column: 1
Layout.fillWidth: true
Layout.preferredHeight: columnWidth
Layout.preferredHeight: coverSize
Layout.maximumHeight: 300
visible: list.count > 0
......@@ -146,7 +147,7 @@ Item
}
// onYChanged:
// {
// if(playbackControls.y<columnWidth/4)
// if(playbackControls.y<coverSize/4)
// {
// cover.visible = false
// playbackControls.y = 0
......@@ -154,7 +155,7 @@ Item
// }else
// {
// cover.visible = true
// playbackControls.y = columnWidth
// playbackControls.y = coverSize
// }
// }
......@@ -172,7 +173,7 @@ Item
drag.target: playbackControls
drag.axis: Drag.YAxis
drag.minimumY: 0
drag.maximumY: columnWidth
drag.maximumY: coverSize
// onClicked:
// {
// if(!root.isMobile)
......@@ -184,7 +185,7 @@ Item
{
cover.height = playbackControls.y
if(playbackControls.y < columnWidth*0.8)
if(playbackControls.y < coverSize*0.8)
{
cover.visible = false
playbackControls.y = 0
......@@ -192,7 +193,7 @@ Item
}else
{
cover.visible = true
// playbackControls.y = columnWidth
// playbackControls.y = coverSize
}
}
}
......@@ -211,8 +212,8 @@ Item
{