Commit feb13216 authored by Camilo Higuita's avatar Camilo Higuita

fixes on babe dialogs and popups and intorduction to a console for developers...meaning me(for now)

parent 717e7977
......@@ -206,7 +206,8 @@ SOURCES += main.cpp \
settings/BabeSettings.cpp \
java/notificationclient.cpp \
db/conthread.cpp \
services/web/babeit.cpp
services/web/babeit.cpp \
utils/babeconsole.cpp
......@@ -366,7 +367,8 @@ HEADERS += \
settings/BabeSettings.h \
java/notificationclient.h \
db/conthread.h \
services/web/babeit.h
services/web/babeit.h \
utils/babeconsole.h
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
......
#include "babe.h"
#include <QPalette>
#include <QWidget>
#include <QColor>
#include <QIcon>
#include "db/collectionDB.h"
#include "db/conthread.h"
#include "settings/BabeSettings.h"
#include "pulpo/pulpo.h"
#include <QPalette>
#include <QWidget>
#include <QColor>
#include <QIcon>
#include <QApplication>
#include <QDesktopWidget>
#include <QDirIterator>
......@@ -29,7 +30,7 @@ using namespace BAE;
Babe::Babe(QObject *parent) : CollectionDB(parent)
{
qDebug()<<"CONSTRUCTING ABE INTERFACE";
Babe::debug("CONSTRUCTING ABE INTERFACE");
this->settings = new BabeSettings(this);
this->thread = new ConThread;
......@@ -106,7 +107,7 @@ void Babe::trackPlaylist(const QStringList &urls, const QString &playlist)
data << map;
}
qDebug()<<"now to send data to thread";
debug("Adding "+QString::number(urls.size())+" tracks to playlist : "+playlist);
this->thread->start(BAE::TABLEMAP[TABLE::TRACKS_PLAYLISTS], data);
}
......@@ -187,16 +188,14 @@ void Babe::fetchTrackLyrics(DB &song)
if(!res[PULPO::ONTOLOGY::TRACK][PULPO::INFO::LYRICS].isEmpty())
{
auto lyrics = res[PULPO::ONTOLOGY::TRACK][PULPO::INFO::LYRICS][PULPO::CONTEXT::LYRIC].toString();
lyricsTrack(track, lyrics);
song.insert(KEY::LYRICS, lyrics);
qDebug()<<"GOT LYRICS"<<lyrics;
emit this->trackLyricsReady(song[KEY::LYRICS], song[KEY::URL]);
debug("Downloaded the lyrics for "+song[KEY::TITLE]+" "+song[KEY::ARTIST]);
emit this->trackLyricsReady(lyrics, song[KEY::URL]);
}
});
pulpo.feed(song, PULPO::RECURSIVE::OFF);
}
QString Babe::albumWiki(const QString &album, const QString &artist)
......@@ -500,7 +499,7 @@ QString Babe::homeDir()
#if defined(Q_OS_ANDROID)
QAndroidJniObject mediaDir = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
QAndroidJniObject mediaPath = mediaDir.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" );
qDebug()<<"HOMEDIR FROM ADNROID"<< mediaPath.toString();
// debug("HOMEDIR FROM ADNROID"+ mediaPath.toString());
if(BAE::fileExists("/mnt/extSdCard"))
......@@ -551,7 +550,8 @@ QVariantList Babe::getDirs(const QString &pathUrl)
auto path = pathUrl;
if(path.startsWith("file://"))
path.replace("file://", "");
qDebug()<<"DIRECTRORY"<<path;
//debug("Get directories for path: "+path);
QVariantList paths;
if (QFileInfo(path).isDir())
......@@ -561,7 +561,6 @@ QVariantList Babe::getDirs(const QString &pathUrl)
{
auto url = it.next();
auto name = QDir(url).dirName();
qDebug()<<name<<url;
QVariantMap map = { {"url", url }, {"name", name} };
paths << map;
}
......@@ -686,6 +685,13 @@ QVariantList Babe::searchFor(const QStringList &queries)
return mapList;
}
void Babe::debug(const QString &msg)
{
emit this->message(msg);
qDebug()<<msg;
}
QString Babe::fetchCoverArt(DB &song)
{
if(BAE::artworkCache(song, KEY::ALBUM)) return song[KEY::ARTWORK];
......
......@@ -10,6 +10,7 @@
class Notify;
#endif
class BabeConsole;
class CollectionDB;
class Pulpo;
class BabeSettings;
......@@ -109,6 +110,8 @@ public:
Q_INVOKABLE QString loadCover(const QString &url);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries);
void debug(const QString &msg);
private:
BabeSettings *settings;
ConThread *thread;
......@@ -127,9 +130,7 @@ signals:
void trackLyricsReady(QString lyrics, QString url);
void skipTrack();
void babeIt();
friend class CollectionDB;
void message(QString msg);
};
#endif // BABE_H
......@@ -76,17 +76,17 @@ Kirigami.ApplicationWindow
readonly property string lightAltColor : "#eeeeee"
readonly property string lightShadowColor : "#868686"
readonly property string darkBackgroundColor : "#333"
readonly property string darkBackgroundColor : "#303030"
readonly property string darkForegroundColor : "#FAFAFA"
readonly property string darkTextColor : darkForegroundColor
readonly property string darkBabeHighlightColor : "#29B6F6"
readonly property string darkHighlightTextColor : darkForegroundColor
readonly property string darkMidColor : "#424242"
readonly property string darkMidLightColor : "#616161"
readonly property string darkDarkColor : "#212121"
readonly property string darkMidColor : "#1d1d1d"
readonly property string darkMidLightColor : "#282828"
readonly property string darkDarkColor : "#191919"
readonly property string darkBaseColor : "#212121"
readonly property string darkAltColor : "#424242"
readonly property string darkShadowColor : "#424242"
readonly property string darkAltColor : darkDarkColor
readonly property string darkShadowColor : darkAltColor
Material.theme: Material.Light
Material.accent: babeColor
......@@ -571,7 +571,7 @@ Kirigami.ApplicationWindow
Item
{
id: message
visible: infoMsg.length > 0
visible: infoMsg.length > 0 && sync
anchors.bottom: parent.bottom
width: pageStack.wideMode ? columnWidth : parent.width
height: toolBarIconSize
......@@ -652,8 +652,6 @@ Kirigami.ApplicationWindow
anchors.fill: parent
clip: true
Connections
{
target: mainPlaylist
......
......@@ -69,5 +69,7 @@
<file>view_models/BabeNotify.qml</file>
<file>widgets/MyBeatView/BabeitView.qml</file>
<file>widgets/PlaybackBar.qml</file>
<file>assets/banner-yellow.png</file>
<file>widgets/SettingsView/BabeConsole.qml</file>
</qresource>
</RCC>
......@@ -29,18 +29,26 @@ void Player::play()
if(!updater->isActive())
this->updater->start(250);
this->player->play();
if(this->player->isAvailable())
this->player->play();
}
void Player::pause()
{
this->player->pause();
if(this->player->isAvailable())
this->player->pause();
}
void Player::stop()
{
this->player->stop();
this->updater->stop();
if(this->player->isAvailable())
{
this->player->stop();
this->sourceurl = QString();
this->player->setMedia(QMediaContent());
}
// this->updater->stop();
}
void Player::seek(const int &pos)
......@@ -66,12 +74,14 @@ QString Player::transformTime(const int &pos)
return time;
}
void Player::update()
{
emit this->pos(static_cast<int>(static_cast<double>(this->player->position())/this->player->duration()*1000));
emit this->timing(BAE::transformTime(player->position()/1000));
if(this->player->isAvailable())
{
emit this->pos(static_cast<int>(static_cast<double>(this->player->position())/this->player->duration()*1000));
emit this->timing(BAE::transformTime(player->position()/1000));
}
emit this->isPlaying(this->player->state() == QMediaPlayer::PlayingState ? true : false);
if(this->player->state() == QMediaPlayer::StoppedState)
emit this->finished();
......
#include "babeconsole.h"
#include <QDebug>
BabeConsole::BabeConsole(QObject *parent) : QObject(parent)
{
}
void BabeConsole::msg(const QString &msg)
{
emit debug(msg);
qDebug()<<msg;
}
#ifndef BABECONSOLE_H
#define BABECONSOLE_H
#include <QObject>
#include <iostream>
using namespace std;
class BabeConsole : public QObject
{
Q_OBJECT
public:
explicit BabeConsole(QObject *parent = nullptr);
void msg(const QString &msg);
signals:
void debug(QString msg);
public slots:
};
#endif // BABECONSOLE_H
......@@ -22,7 +22,7 @@
#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_STR "0.1.0"
#define BABE_VERSION KDE_MAKE_VERSION(@BABE_MAJOR_VERSION@,@BABE_MINOR_VERSION@,@BABE_PATCH_VERSION@)
......
......@@ -8,7 +8,7 @@ Pane
padding: 20
// readonly property int screenSize : bae.screenGeometry("width")*bae.screenGeometry("height");
property int hintSize : Math.sqrt(root.width*root.height)*0.25
property int hintSize : Math.sqrt(root.width*root.height)*0.3
property int albumCoverSize: hintSize > 150 ? 150 : hintSize
// property int albumSize:
......
......@@ -145,7 +145,6 @@ BabeGrid
}
}
}
}
onAlbumCoverClicked:
......
......@@ -52,124 +52,189 @@ ToolBar
RowLayout
{
anchors.fill: parent
BabeButton
Item
{
id: settingsView
Layout.leftMargin: isMobile ? 0 : contentMargins
Layout.alignment: Qt.AlignLeft
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
iconName: "application-menu"
iconColor: settingsDrawer.visible ? babeColor : textColor/*(pageStack.wideMode || pageStack.currentIndex === 0 ) && !isMobile ? accentColor : textColor*/
onClicked: settingsViewClicked()
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Settings")
BabeButton
{
id: settingsView
anchors.centerIn: parent
anchors.left: parent.left
iconName: "application-menu"
iconColor: settingsDrawer.visible ? babeColor : textColor/*(pageStack.wideMode || pageStack.currentIndex === 0 ) && !isMobile ? accentColor : textColor*/
onClicked: settingsViewClicked()
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Settings")
}
}
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
}
BabeButton
Item
{
iconName: "love"
iconColor: accent && currentIndex === viewsIndex.babeit ? accentColor : textColor
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
onClicked: babeViewClicked()
BabeButton
{
anchors.centerIn: parent
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Babe")
}
iconName: "love"
iconColor: accent && currentIndex === viewsIndex.babeit ? accentColor : textColor
onClicked: babeViewClicked()
BabeButton
{
id: tracksView
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Babe")
}
}
iconName: /*"musicnote"*/ "filename-filetype-amarok"
iconColor: accent && currentIndex === viewsIndex.tracks ? accentColor : textColor
onClicked: tracksViewClicked()
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Tracks")
BabeButton
{
id: tracksView
anchors.centerIn: parent
iconName: /*"musicnote"*/ "filename-filetype-amarok"
iconColor: accent && currentIndex === viewsIndex.tracks ? accentColor : textColor
onClicked: tracksViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Tracks")
}
}
BabeButton
Item
{
id: albumsView
iconName: /*"album" */ "media-album-cover"
iconColor: accent && currentIndex === viewsIndex.albums ? accentColor : textColor
onClicked: albumsViewClicked()
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Albums")
BabeButton
{
id: albumsView
anchors.centerIn: parent
iconName: /*"album" */ "media-album-cover"
iconColor: accent && currentIndex === viewsIndex.albums ? accentColor : textColor
onClicked: albumsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Albums")
}
}
BabeButton
Item
{
id: artistsView
iconName: /*"artist" */ "view-media-artist"
iconColor: accent && currentIndex === viewsIndex.artists ? accentColor : textColor
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
onClicked: artistsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Artists")
BabeButton
{
id: artistsView
anchors.centerIn: parent
iconName: /*"artist" */ "view-media-artist"
iconColor: accent && currentIndex === viewsIndex.artists ? accentColor : textColor
onClicked: artistsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Artists")
}
}
BabeButton
Item
{
id: playlistsView
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
BabeButton
{
id: playlistsView
anchors.centerIn: parent
iconName: /*"library-music"*/ "view-media-playlist"
iconColor: accent && currentIndex === viewsIndex.playlists ? accentColor : textColor
iconName: /*"library-music"*/ "view-media-playlist"
iconColor: accent && currentIndex === viewsIndex.playlists ? accentColor : textColor
onClicked: playlistsViewClicked()
onClicked: playlistsViewClicked()
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Playlists")
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Playlists")
}
}
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
}
BabeButton
Item
{
id: searchView
Layout.rightMargin: isMobile ? 0 : contentMargins
Layout.alignment: Qt.AlignRight
// visible: !(searchInput.focus || searchInput.text)
iconColor: accent && currentIndex === viewsIndex.search ? accentColor : textColor
iconName: "edit-find" //"search"
onClicked: searchViewClicked()
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Search")
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: toolBarIconSize*2
Layout.maximumHeight: toolBarIconSize
BabeButton
{
id: searchView
anchors.centerIn: parent
// visible: !(searchInput.focus || searchInput.text)
iconColor: accent && currentIndex === viewsIndex.search ? accentColor : textColor
iconName: "edit-find" //"search"
onClicked: searchViewClicked()
hoverEnabled: !isMobile
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered && !isMobile
ToolTip.text: qsTr("Search")
}
}
}
......
......@@ -66,7 +66,8 @@ Item
Layout.fillWidth: true
Layout.preferredHeight: visible ? coverSize : 0
Layout.maximumHeight: 300
visible: !root.mainlistEmpty
visible: !mainlistEmpty
Rectangle
{
visible: cover.visible
......@@ -381,7 +382,6 @@ Item
root.maximumHeight = mainPlaylistItem.y + footer.height
root.minimumHeight = mainPlaylistItem.y + footer.height
root.header.visible = false
infoBtn.visible = false
// root.footer.visible = false
// mainlistContext.visible = false
......@@ -396,7 +396,6 @@ Item
root.width = columnWidth
root.height = 700
root.header.visible = true
infoBtn.visible = true
// root.footer.visible = true
// mainlistContext.visible = true
}
......
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
Page
{
......@@ -24,4 +26,36 @@ Page
y: toolbar.height
}
ColumnLayout
{
anchors.fill: parent
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
Layout.margins: contentMargins*2
width: parent.width
Image
{
width: 120
anchors.centerIn: parent
id: beatsImg
fillMode: Image.PreserveAspectFit
source: "qrc:/assets/banner-yellow.png"
horizontalAlignment: Qt.AlignHCenter
}
// ColorOverlay
// {
// anchors.fill: beatsImg
// source: beatsImg
// color: foregroundColor
// }
}
}
}
......@@ -9,7 +9,7 @@ import "../../view_models"
BabePopup
{
id: loginPopup
padding: contentMargins
padding: contentMargins*3
maxHeight: loginLayout.implicitHeight+64
maxWidth: loginLayout.implicitWidth+64
// closePolicy: Popup.NoAutoClose
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.1
import org.kde.kirigami 2.2 as Kirigami
import "../../view_models"
BabePopup
{
closePolicy: Popup.NoAutoClose
modal: false
Connections
{
target: bae
onMessage: consoletext.append(">> "+msg+"\n");
}
ColumnLayout
{
anchors.fill: parent
spacing: 0
BabeButton
{
Layout.alignment: Qt.AlignLeft
Layout.margins: contentMargins
anim : true
iconName : "dialog-close"
onClicked : close()
}
TextArea
{
id: consoletext
Layout.fillHeight: true
Layout.fillWidth: true
readOnly: true
font.pointSize: fontSizes.small
background: Rectangle
{
color: darkDarkColor
implicitWidth: 200
implicitHeight: 40
}
color: darkForegroundColor
}
}
}
......@@ -41,6 +41,11 @@ Kirigami.GlobalDrawer
id: sourcesDialog
}
BabeConsole
{
id: babeConsole
}
bannerImageSource: "qrc:/assets/banner.svg"
actions: [
......@@ -58,7 +63,7 @@ Kirigami.GlobalDrawer
Kirigami.Action
{
id: brainzToggle
text: checked ? "ON" : "OFF"
text: checked ? "Turn OFF" : "Turn ON"
checked: activeBrainz
checkable: true
onToggled:
......@@ -154,6 +159,22 @@ Kirigami.GlobalDrawer
}
},
Kirigami.Action
{
text: "Developer"
Kirigami.Action
{