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) ...@@ -15,9 +15,9 @@ include(kde/kde.pri)
CONFIG += c++11 CONFIG += c++11
include(android-openssl.pri) include(android-openssl.pri)
#android: { android: {
# include(3rdparty/kirigami/kirigami.pri) include(3rdparty/kirigami/kirigami.pri)
#} }
DEPENDPATH += taglib DEPENDPATH += taglib
DEPENDPATH += taglib/ape DEPENDPATH += taglib/ape
...@@ -85,7 +85,6 @@ DEFINES += QT_DEPRECATED_WARNINGS ...@@ -85,7 +85,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp \ SOURCES += main.cpp \
db/collectionDB.cpp \ db/collectionDB.cpp \
settings/settings.cpp \
services/local/taginfo.cpp \ services/local/taginfo.cpp \
services/local/player.cpp \ services/local/player.cpp \
utils/brain.cpp \ utils/brain.cpp \
...@@ -196,6 +195,7 @@ SOURCES += main.cpp \ ...@@ -196,6 +195,7 @@ SOURCES += main.cpp \
taglib/tag.cpp \ taglib/tag.cpp \
taglib/tagunion.cpp \ taglib/tagunion.cpp \
babe.cpp \ babe.cpp \
settings/BabeSettings.cpp
...@@ -224,7 +224,6 @@ DISTFILES += \ ...@@ -224,7 +224,6 @@ DISTFILES += \
HEADERS += \ HEADERS += \
db/collectionDB.h \ db/collectionDB.h \
utils/bae.h \ utils/bae.h \
settings/settings.h \
settings/fileloader.h \ settings/fileloader.h \
services/local/taginfo.h \ services/local/taginfo.h \
services/local/player.h \ services/local/player.h \
...@@ -345,4 +344,5 @@ HEADERS += \ ...@@ -345,4 +344,5 @@ HEADERS += \
taglib/config.h \ taglib/config.h \
taglib/taglib_config.h \ taglib/taglib_config.h \
babe.h \ babe.h \
settings/BabeSettings.h
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <QColor> #include <QColor>
#include <QIcon> #include <QIcon>
#include "db/collectionDB.h" #include "db/collectionDB.h"
#include "settings/settings.h" #include "settings/BabeSettings.h"
#include "pulpo/pulpo.h" #include "pulpo/pulpo.h"
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
...@@ -22,9 +22,9 @@ Babe::Babe(QObject *parent) : QObject(parent) ...@@ -22,9 +22,9 @@ Babe::Babe(QObject *parent) : QObject(parent)
qDebug()<<"CONSTRUCTING ABE INTERFACE"; qDebug()<<"CONSTRUCTING ABE INTERFACE";
this->con = new CollectionDB(this); 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); emit this->refreshTables(tables);
}); });
...@@ -323,12 +323,12 @@ QString Babe::textColor() ...@@ -323,12 +323,12 @@ QString Babe::textColor()
QString Babe::hightlightColor() QString Babe::hightlightColor()
{ {
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
return ""; return "#58bcff";
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
QWidget widget; QWidget widget;
return widget.palette().color(QPalette::Highlight).name(); return widget.palette().color(QPalette::Highlight).name();
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
return ""; return "#58bcff";
#endif #endif
} }
......
...@@ -12,7 +12,7 @@ class Notify; ...@@ -12,7 +12,7 @@ class Notify;
class CollectionDB; class CollectionDB;
class Pulpo; class Pulpo;
class settings; class BabeSettings;
using namespace BAE; using namespace BAE;
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
private: private:
CollectionDB *con; CollectionDB *con;
settings *set; BabeSettings *set;
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID)) #if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
Notify *nof; Notify *nof;
#endif #endif
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include "services/local/player.h" #include "services/local/player.h"
#include <QLibrary> #include <QLibrary>
//#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
//#include "./3rdparty/kirigami/src/kirigamiplugin.h" #include "./3rdparty/kirigami/src/kirigamiplugin.h"
//#endif #endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
...@@ -23,16 +23,17 @@ int main(int argc, char *argv[]) ...@@ -23,16 +23,17 @@ int main(int argc, char *argv[])
auto context = engine.rootContext(); auto context = engine.rootContext();
#ifdef Q_OS_ANDROID
KirigamiPlugin::getInstance().registerTypes();
#endif
Babe bae; Babe bae;
Player player; Player player;
// bae.registerTypes();
context->setContextProperty("bae", &bae); context->setContextProperty("bae", &bae);
context->setContextProperty("player", &player); context->setContextProperty("player", &player);
//#ifdef Q_OS_ANDROID
// KirigamiPlugin::getInstance().registerTypes();
//#endif
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty()) if (engine.rootObjects().isEmpty())
......
...@@ -2,7 +2,7 @@ import QtQuick 2.9 ...@@ -2,7 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0 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 "db/Queries.js" as Q
import "utils/Player.js" as Player import "utils/Player.js" as Player
...@@ -12,8 +12,7 @@ import "widgets/PlaylistsView" ...@@ -12,8 +12,7 @@ import "widgets/PlaylistsView"
import "widgets/MainPlaylist" import "widgets/MainPlaylist"
import "view_models" import "view_models"
//Kirigami.ApplicationWindow Kirigami.ApplicationWindow
ApplicationWindow
{ {
id: root id: root
visible: true visible: true
...@@ -25,15 +24,16 @@ ApplicationWindow ...@@ -25,15 +24,16 @@ ApplicationWindow
readonly property bool isMobile: bae.isMobile() readonly property bool isMobile: bae.isMobile()
property int columnWidth: Kirigami.Units.gridUnit * 22
property int columnWidth: Math.sqrt(root.width*root.height)*0.4 property int coverSize: columnWidth*0.6
// property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int currentView : 0 property int currentView : 0
property int toolBarIconSize: isMobile ? 24 : 22 property int toolBarIconSize: isMobile ? 24 : 22
property alias mainPlaylist : mainPlaylist property alias mainPlaylist : mainPlaylist
// minimumWidth: columnWidth // minimumWidth: columnWidth
// pageStack.defaultColumnWidth: columnWidth pageStack.defaultColumnWidth: columnWidth
// pageStack.initialPage: [playlistPage, views] pageStack.initialPage: [mainPlaylist, views]
// overlay.modal: Rectangle // overlay.modal: Rectangle
// { // {
// color: "transparent" // color: "transparent"
...@@ -121,11 +121,31 @@ ApplicationWindow ...@@ -121,11 +121,31 @@ ApplicationWindow
size: toolBarIconSize size: toolBarIconSize
currentIndex: currentView currentIndex: currentView
onPlaylistViewClicked: currentView = 0 onPlaylistViewClicked:
onTracksViewClicked: currentView = 1 {
onAlbumsViewClicked: currentView = 2 pageStack.currentIndex = 0
onArtistsViewClicked: currentView = 3
onPlaylistsViewClicked: currentView = 4 }
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() onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
} }
...@@ -201,13 +221,33 @@ ApplicationWindow ...@@ -201,13 +221,33 @@ ApplicationWindow
z: -999 z: -999
} }
Component.onCompleted:
{
if(!isMobile)
root.width = columnWidth*3
}
SettingsView SettingsView
{ {
id: settingsDrawer 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 Page
{ {
id: views id: views
...@@ -215,9 +255,9 @@ ApplicationWindow ...@@ -215,9 +255,9 @@ ApplicationWindow
height: parent.height height: parent.height
clip: true clip: true
transform: Translate { // transform: Translate {
x: (settingsDrawer.position * views.width * 0.33)*-1 // x: (settingsDrawer.position * views.width * 0.33)*-1
} // }
Column Column
{ {
...@@ -247,19 +287,6 @@ ApplicationWindow ...@@ -247,19 +287,6 @@ ApplicationWindow
} }
MainPlaylist
{
id: mainPlaylist
Connections
{
target: mainPlaylist
onCoverPressed: Player.appendAll(tracks)
onCoverDoubleClicked: Player.playAll(tracks)
}
}
TracksView TracksView
{ {
id: tracksView id: tracksView
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
*/ */
#include "settings.h" #include "BabeSettings.h"
#include "../db/collectionDB.h" #include "../db/collectionDB.h"
#include "fileloader.h" #include "fileloader.h"
#include "../utils/brain.h" #include "../utils/brain.h"
#include "../services/local/socket.h" #include "../services/local/socket.h"
#include "../services/web/youtube.h" #include "../services/web/youtube.h"
settings::settings(QObject *parent) : QObject(parent) BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
{ {
this->connection = new CollectionDB(this); this->connection = new CollectionDB(this);
...@@ -109,20 +109,20 @@ settings::settings(QObject *parent) : QObject(parent) ...@@ -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); 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"; qDebug()<<"DELETING SETTINGS";
delete fileLoader; delete fileLoader;
delete brainDeamon; delete brainDeamon;
} }
void settings::on_remove_clicked() void BabeSettings::on_remove_clicked()
{ {
qDebug() << this->pathToRemove; qDebug() << this->pathToRemove;
if (!this->pathToRemove.isEmpty()) if (!this->pathToRemove.isEmpty())
...@@ -139,7 +139,7 @@ void settings::on_remove_clicked() ...@@ -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]); // 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() ...@@ -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(); qDebug()<<"duplicated paths in watcher removd: "<<paths.removeDuplicates();
if(!paths.isEmpty()) watcher->addPaths(paths); 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]); 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() ...@@ -184,7 +184,7 @@ void settings::collectionWatcher()
this->addToWatcher(this->dirs); this->addToWatcher(this->dirs);
} }
void settings::handleDirectoryChanged(const QString &dir) void BabeSettings::handleDirectoryChanged(const QString &dir)
{ {
qDebug()<<"directory changed:"<<dir; qDebug()<<"directory changed:"<<dir;
...@@ -202,14 +202,14 @@ void settings::handleDirectoryChanged(const QString &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->refreshCollectionPaths();
// this->collectionWatcher(); // this->collectionWatcher();
this->startBrainz(state, 3000); 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); this->brainDeamon->setInterval(speed);
if(on) if(on)
...@@ -219,7 +219,7 @@ void settings::startBrainz(const bool &on, const uint &speed) ...@@ -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 qDebug() << "Function Name: " << Q_FUNC_INFO
<< "new path for database action: " << paths; << "new path for database action: " << paths;
......
...@@ -24,13 +24,13 @@ class Brain; ...@@ -24,13 +24,13 @@ class Brain;
using namespace BAE; using namespace BAE;
class settings : public QObject class BabeSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit settings(QObject *parent = nullptr); explicit BabeSettings(QObject *parent = nullptr);
~settings(); ~BabeSettings();
void checkCollectionBrainz(const bool &state); void checkCollectionBrainz(const bool &state);
void collectionWatcher(); void collectionWatcher();
......
...@@ -811,7 +811,7 @@ var Icon = { ...@@ -811,7 +811,7 @@ var Icon = {
"heartBox": "\uf2D2", "heartBox": "\uf2D2",
"heartBoxOutline": "\uf2D3", "heartBoxOutline": "\uf2D3",
"heartBroken": "\uf2D4", "heartBroken": "\uf2D4",
"heartOutline": "\uf2D5", "heartOutline": "\uf2D5",
"heartPulse": "\uf5F6", "heartPulse": "\uf5F6",
"help": "\uf2D6", "help": "\uf2D6",
"helpCircle": "\uf2D7", "helpCircle": "\uf2D7",
...@@ -1655,15 +1655,34 @@ var Icon = { ...@@ -1655,15 +1655,34 @@ var Icon = {
var Babe = { var Babe = {
"musicnote": Icon.musicNote,
/*toolbar*/
"media-optical-audio": Icon.headphones,
"audio-headphones": Icon.headphones, "audio-headphones": Icon.headphones,
"headphones": Icon.headphones, "headphones": Icon.headphones,
"filename-filetype-amarok": Icon.musicNote,
"musicnote": Icon.musicNote,
"album" : Icon.album, "album" : Icon.album,
"media-album-cover": Icon.album, "media-album-cover": Icon.album,
"artist": Icon.face, "artist": Icon.face,
"view-media-artist": Icon.artist, "view-media-artist": Icon.face,
"library-music": Icon.libraryMusic, "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-start" : Icon.play,
"media-playback-pause" : Icon.pause, "media-playback-pause" : Icon.pause,
"media-skip-backward": "\uf4AE", "media-skip-backward": "\uf4AE",
...@@ -1672,9 +1691,9 @@ var Babe = { ...@@ -1672,9 +1691,9 @@ var Babe = {
"love": Icon.heartOutline, "love": Icon.heartOutline,
"media-playlist-shuffle": "\uf49D", "media-playlist-shuffle": "\uf49D",
"media-playlist-repeat": "\uf49E", "media-playlist-repeat": "\uf49E",
"help-about" : Icon.informationOutline,
"info-help" : Icon.informationOutline,
"arrow-left":"\uf04D", "arrow-left":"\uf04D",
"overflow-menu": Icon.dotsVertical, "overflow-menu": Icon.dotsVertical,
"application-menu" : Icon.dotsVertical, "application-menu" : Icon.dotsVertical,
"player-time": "\uf40C", "player-time": "\uf40C",
...@@ -1689,6 +1708,7 @@ var Babe = { ...@@ -1689,6 +1708,7 @@ var Babe = {
"amarok_playcount": Icon.trendingUp, "amarok_playcount": Icon.trendingUp,
"draw-star": Icon.starCircle, "draw-star": Icon.starCircle,
"filename-year-amarok": Icon.clock, "filename-year-amarok": Icon.clock,
"internet-services": Icon.youtubePlay,
"internet-amarok": Icon.youtubePlay, "internet-amarok": Icon.youtubePlay,
"tag" : Icon.tagMultiple, "tag" : Icon.tagMultiple,
"similarartists-amarok": Icon.tagFaces, "similarartists-amarok": Icon.tagFaces,
...@@ -1701,6 +1721,6 @@ var Babe = { ...@@ -1701,6 +1721,6 @@ var Babe = {
"window-close" : Icon.close, "window-close" : Icon.close,
"player-time" : Icon.playBoxOutline, "player-time" : Icon.playBoxOutline,
"media-repeat-track-amarok": Icon.playlistPlay, "media-repeat-track-amarok": Icon.playlistPlay,
"archive-insert": Icon.playlistPlay, "archive-insert": Icon.playlistPlus,
"amarok_clock" : Icon.playlistPlay "amarok_clock" : Icon.playlistPlay