Commit 72f660ab authored by Camilo Higuita's avatar Camilo Higuita

fixes

parent 105501ee
......@@ -511,6 +511,17 @@ bool CollectionDB::trackPlaylist(const QString &url, const QString &playlist)
return false;
}
bool CollectionDB::addFolder(const QString &url)
{
QVariantMap map {{KEYMAP[KEY::URL],url},
{KEYMAP[KEY::ADD_DATE],QDate::currentDate()}};
if(insert(TABLEMAP[TABLE::FOLDERS],map))
return true;
return false;
}
DB_LIST CollectionDB::getDBData(const QStringList &urls)
{
......
......@@ -66,6 +66,8 @@ public:
bool addPlaylist(const QString &title);
bool trackPlaylist(const QString &url, const QString &playlist);
bool addFolder(const QString &url);
BAE::DB_LIST getDBData(const QStringList &urls);
BAE::DB_LIST getDBData(const QString &queryTxt);
QVariantList getDBDataQML(const QString &queryTxt);
......
......@@ -44,7 +44,8 @@ name TEXT NOT NULL
CREATE TABLE FOLDERS
(
url TEXT PRIMARY KEY
url TEXT PRIMARY KEY,
addDate DATE NOT NULL
) ;
CREATE TABLE SOURCES
......
......@@ -55,7 +55,7 @@ ApplicationWindow
searchView.populate(res)
// albumsView.filter(res)
currentView = 6
currentView = 5
}
}
......@@ -103,21 +103,7 @@ ApplicationWindow
onAlbumsViewClicked: currentView = 2
onArtistsViewClicked: currentView = 3
onPlaylistsViewClicked: currentView = 4
onSettingsViewClicked:
{
if(settingsDrawer.visible )
{
settingsDrawer.close()
settingsIcon.color = textColor
}
else
{
settingsDrawer.open()
settingsIcon.color = accentColor
}
}
onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
}
footer: Rectangle
......@@ -179,13 +165,11 @@ ApplicationWindow
z: -999
}
SettingsView
{
id: settingsDrawer
onIconSizeChanged: iconSize = size
}
SettingsView
{
id: settingsDrawer
onIconSizeChanged: iconSize = size
}
Page
......@@ -196,8 +180,8 @@ ApplicationWindow
clip: true
transform: Translate {
x: (settingsDrawer.position * views.width * 0.33)*-1
}
x: (settingsDrawer.position * views.width * 0.33)*-1
}
Column
{
......
......@@ -60,6 +60,7 @@ public slots:
{
if (QFileInfo(path).isDir())
{
this->con->addFolder(path);
QDirIterator it(path, BAE::formats, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) urls<<it.next();
......
......@@ -99,13 +99,13 @@ settings::settings(QObject *parent) : QObject(parent)
{BAE::TABLEMAP[TABLE::PLAYLISTS], true}});
this->startBrainz(1000);
this->startBrainz(1500);
}else
{
this->dirs.clear();
this->collectionWatcher();
this->watcher->removePaths(watcher->directories());
this->startBrainz(2000);
this->startBrainz(3000);
}
......@@ -192,7 +192,7 @@ void settings::handleDirectoryChanged(const QString &dir)
auto wait = new QTimer(this);
wait->setSingleShot(true);
wait->setInterval(1000);
wait->setInterval(1500);
connect(wait, &QTimer::timeout,[=]()
{
......@@ -209,10 +209,10 @@ void settings::checkCollection()
// this->refreshCollectionPaths();
// this->collectionWatcher();
this->brainzOn = true;
this->startBrainz(2000);
this->startBrainz(3000);
}
void settings::startBrainz(const int &speed)
void settings::startBrainz(const uint &speed)
{
if(this->brainzOn)
{
......
......@@ -39,7 +39,7 @@ private slots:
void on_remove_clicked();
public slots:
void startBrainz(const int &speed);
void startBrainz(const uint &speed);
void populateDB(const QStringList &paths);
private:
......
......@@ -75,6 +75,7 @@ namespace BAE
ARTISTS_TAGS,
TRACKS_TAGS,
LOGS,
FOLDERS,
ALL,
NONE
};
......@@ -94,7 +95,8 @@ namespace BAE
{TABLE::ALBUMS_TAGS,"albums_tags"},
{TABLE::ARTISTS_TAGS,"artists_tags"},
{TABLE::TRACKS_TAGS,"tracks_tags"},
{TABLE::LOGS,"logs"}
{TABLE::LOGS,"logs"},
{TABLE::FOLDERS,"folders"}
};
......
......@@ -57,11 +57,13 @@ void Brain::setInfo(DB_LIST dataList, ONTOLOGY ontology, QList<SERVICES> service
for(auto data : dataList)
{
if(!go) return;
if (cb != nullptr) cb(data);
this->pulpo.feed(data, recursive);
this->t.msleep(this->interval);
if(!go) return;
}
}
......@@ -81,6 +83,7 @@ void Brain::synapse()
void Brain::connectionParser(DB track, RESPONSE response)
{
for(auto res : response.keys())
{
switch(res)
{
case ONTOLOGY::ALBUM: this->parseAlbumInfo(track, response[res]); break;
......@@ -88,6 +91,8 @@ void Brain::connectionParser(DB track, RESPONSE response)
case ONTOLOGY::TRACK: this->parseTrackInfo(track, response[res]); break;
default: return;
}
this->t.msleep(this->interval);
}
}
void Brain::parseAlbumInfo(DB &track, const INFO_K &response)
......
......@@ -43,7 +43,7 @@ private:
QThread t;
CollectionDB *con;
Pulpo pulpo;
uint interval = 500;
uint interval = 1500;
bool go = false;
signals:
......
......@@ -17,7 +17,6 @@ Pane
height: 400
background: Rectangle
{
anchors.fill: parent
......
......@@ -3,14 +3,13 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
Rectangle
Item
{
property string emoji
property string message
clip: true
anchors.fill: parent
color: "transparent"
GridLayout
{
......@@ -27,7 +26,7 @@ Rectangle
width:parent.width
height: parent.height
Layout.row: 1
color: bae.backgroundColor()
color: "transparent"
Image
{
......
......@@ -11,7 +11,7 @@ BabeGrid
{
id: albumsViewGrid
visible: true
albumSize:Math.sqrt(root.width*root.height)*0.25
albumSize: Math.sqrt(root.width*root.height)*0.25
borderRadius: 20
signal rowClicked(var track)
......@@ -20,6 +20,10 @@ BabeGrid
signal queueTrack(var track)
signal appendAlbum(var tracks)
transform: Translate
{
y: (drawer.position * albumsViewGrid.height * 0.33)*-1
}
Drawer
{
......
......@@ -20,6 +20,11 @@ BabeGrid
signal queueTrack(var track)
signal appendAlbum(var tracks)
transform: Translate
{
y: (drawer.position * artistsViewGrid.height * 0.33)*-1
}
Drawer
{
id: drawer
......
......@@ -29,7 +29,7 @@ ToolBar
Rectangle
{
anchors.fill: parent
color: backgroundColor
color: backgroundColor
}
RowLayout
......@@ -163,7 +163,7 @@ ToolBar
{
id: settingsIcon
text: MdiFont.Icon.settings
color: textColor
color: settingsDrawer.visible ? accentColor : textColor
iconSize: size
}
......
......@@ -14,6 +14,7 @@ import "../widgets"
Item
{
id: mainPlaylistRoot
property var currentTrack
property string currentArtwork
property bool shuffle : false
......@@ -40,33 +41,45 @@ Item
z: -999
}
ColumnLayout
GridLayout
{
id: playlistLayout
anchors.fill: parent
rowSpacing: 0
rows: 4
columns: 1
Rectangle
Item
{
id: cover
Layout.preferredHeight: columnWidth
Layout.minimumHeight: columnWidth
Layout.maximumHeight: columnWidth
Layout.row: 1
Layout.column: 1
Layout.fillWidth: true
color: bae.altColor()
Layout.preferredHeight: columnWidth
Layout.maximumHeight: 250
visible: list.count>0
Rectangle
{
anchors.fill: parent
color: bae.midColor()
z: -999
}
FastBlur
{
anchors.fill: cover
width: mainPlaylistRoot.width
height: mainPlaylist.y
source: artwork
radius: 100
transparentBorder: true
cached: true
}
Image
{
id: artwork
width: parent.width < columnWidth ? parent.width : columnWidth
width: parent.height < 250 ? parent.height : 250
height: parent.height
anchors.centerIn: parent
source: currentArtwork ? "file://"+encodeURIComponent(currentArtwork) : "qrc:/assets/cover.png"
......@@ -109,30 +122,36 @@ Item
}
Rectangle
Item
{
id: playbackControls
Layout.row: 2
Layout.column: 1
Layout.fillWidth: true
Layout.preferredHeight: 48
Layout.minimumHeight: 48
Layout.maximumHeight: 48
height: 48
visible: list.count>0
color: bae.midColor()
onYChanged:
Rectangle
{
if(playbackControls.y<columnWidth/4)
{
cover.visible = false
playbackControls.y = 0
}else
{
cover.visible = true
playbackControls.y = columnWidth
}
anchors.fill: parent
color: bae.midColor()
opacity: 0.8
z: -999
}
// onYChanged:
// {
// if(playbackControls.y<columnWidth/4)
// {
// cover.visible = false
// playbackControls.y = 0
// }else
// {
// cover.visible = true
// playbackControls.y = columnWidth
// }
// }
PlaylistMenu
{
......@@ -255,17 +274,25 @@ Item
}
}
Rectangle
Item
{
id: slideBar
Layout.row: 3
Layout.column: 1
Layout.fillWidth: true
Layout.preferredHeight: 22
Layout.minimumHeight: 22
Layout.maximumHeight: 22
color: "transparent"
height: 48
Rectangle
{
anchors.fill: parent
color: bae.midColor()
opacity: 0.8
z: -999
}
Slider
{
id: progressBar
anchors.fill: parent
width: parent.width
height: parent.height
from: 0
to: 1000
value: 0
......@@ -307,12 +334,13 @@ Item
}
Rectangle
Item
{
id: mainPlaylist
Layout.row: 4
Layout.column: 1
Layout.fillWidth: true
Layout.fillHeight: true
color: bae.altColor()
StackView
{
......
......@@ -11,7 +11,7 @@ Drawer
id: settingsView
y: header.height
height: parent.height - header.height
width: parent.width* 0.5
width: bae.isMobile() ? parent.width* 0.7 : parent.width* 0.5
edge: Qt.RightEdge
interactive: true
focus: true
......@@ -48,8 +48,10 @@ Drawer
folder: bae.homeDir()
onAccepted:
{
listModel.append({url: folder.toString()})
scanDir(folder.toString())
var path = folder.toString().replace("file://","")
listModel.append({url: path})
scanDir(path)
}
}
FolderPicker
......@@ -59,10 +61,8 @@ Drawer
Connections
{
target: folderPicker
onPathClicked:
{
load(path)
}
onPathClicked: load(path)
onAccepted:
{
listModel.append({url: path})
......@@ -129,11 +129,10 @@ Drawer
Component.onCompleted:
{
var map = bae.get("select url from sources")
var map = bae.get("select url from folders order by addDate desc")
for(var i in map)
{
model.append(map[i])
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment