Commit 7f0411a2 authored by Camilo Higuita's avatar Camilo Higuita

better albums view drawer and initial work on brainz

parent ec23afde
...@@ -72,7 +72,7 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent) ...@@ -72,7 +72,7 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
connect(this->ytFetch, &YouTube::done, [this]() connect(this->ytFetch, &YouTube::done, [this]()
{ {
this->populateDB({BAE::YoutubeCachePath}); this->startBrainz(true, BAE::SEG::THREE);
}); });
connect(this->babeSocket, &Socket::message, this->ytFetch, &YouTube::fetch); connect(this->babeSocket, &Socket::message, this->ytFetch, &YouTube::fetch);
...@@ -109,18 +109,16 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent) ...@@ -109,18 +109,16 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
{BAE::TABLEMAP[TABLE::PLAYLISTS], true}}); {BAE::TABLEMAP[TABLE::PLAYLISTS], true}});
// this->startBrainz(true, 1500); // this->startBrainz(true, BAE::SEG::ONEHALF);
qDebug()<<"Finished inserting into DB"; qDebug()<<"Finished inserting into DB";
}/*else }else
{ {
this->dirs.clear(); this->dirs.clear();
this->collectionWatcher(); this->collectionWatcher();
this->watcher->removePaths(watcher->directories()); this->watcher->removePaths(watcher->directories());
this->startBrainz(BAE::loadSettings("BRAINZ", "BABE", false).toBool(), 3000); this->startBrainz(BAE::loadSettings("BRAINZ", "BABE", false).toBool(), BAE::SEG::THREE);
}*/ }
}); });
connect(this, &BabeSettings::collectionPathChanged, this, &BabeSettings::populateDB); connect(this, &BabeSettings::collectionPathChanged, this, &BabeSettings::populateDB);
...@@ -219,7 +217,7 @@ void BabeSettings::handleDirectoryChanged(const QString &dir) ...@@ -219,7 +217,7 @@ void BabeSettings::handleDirectoryChanged(const QString &dir)
void BabeSettings::checkCollectionBrainz(const bool &state) void BabeSettings::checkCollectionBrainz(const bool &state)
{ {
qDebug()<<"BRAINZ STATE<<"<<state; qDebug()<<"BRAINZ STATE<<"<<state;
this->startBrainz(state, 3000); this->startBrainz(state, BAE::SEG::THREE);
} }
void BabeSettings::startBrainz(const bool &on, const uint &speed) void BabeSettings::startBrainz(const bool &on, const uint &speed)
......
...@@ -39,7 +39,7 @@ private slots: ...@@ -39,7 +39,7 @@ private slots:
void on_remove_clicked(); void on_remove_clicked();
public slots: public slots:
void startBrainz(const bool &on, const uint &speed); void startBrainz(const bool &on, const uint &speed = BAE::SEG::THREE);
void populateDB(const QStringList &paths); void populateDB(const QStringList &paths);
private: private:
......
This diff is collapsed.
...@@ -23,10 +23,9 @@ Brain::~Brain() ...@@ -23,10 +23,9 @@ Brain::~Brain()
void Brain::start() void Brain::start()
{ {
if(this->isRunning()) this->go = false; if(!this->isRunning())
this->go = true; this->go = true;
QMetaObject::invokeMethod(this, "synapse"); QMetaObject::invokeMethod(this, "synapse");
} }
void Brain::stop() void Brain::stop()
...@@ -69,7 +68,7 @@ void Brain::setInfo(DB_LIST dataList, ONTOLOGY ontology, QList<SERVICES> service ...@@ -69,7 +68,7 @@ void Brain::setInfo(DB_LIST dataList, ONTOLOGY ontology, QList<SERVICES> service
if (cb != nullptr) cb(data); if (cb != nullptr) cb(data);
this->pulpo.feed(data, recursive); this->pulpo.feed(data, recursive);
this->t.msleep(this->interval); this->t.msleep(this->interval);
} }else return;
} }
} }
......
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
BabeDialog BabeDialog
{ {
property string message property string message
property string messageBody property string messageBody
standardButtons: Dialog.Yes | Dialog.No standardButtons: Dialog.Yes | Dialog.No
Column ColumnLayout
{ {
spacing: 20
anchors.fill: parent anchors.fill: parent
Label Label
{ {
Layout.margins: contentMargins
text: message ? message : "" text: message ? message : ""
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
...@@ -21,6 +21,7 @@ BabeDialog ...@@ -21,6 +21,7 @@ BabeDialog
Label Label
{ {
Layout.margins: contentMargins
text: messageBody ? messageBody : "" text: messageBody ? messageBody : ""
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
......
...@@ -8,6 +8,7 @@ ColumnLayout ...@@ -8,6 +8,7 @@ ColumnLayout
{ {
id: babeAlbumRoot id: babeAlbumRoot
signal albumClicked(int index) signal albumClicked(int index)
signal albumPressed(int index) signal albumPressed(int index)
property int albumSize : 150 property int albumSize : 150
...@@ -97,7 +98,6 @@ ColumnLayout ...@@ -97,7 +98,6 @@ ColumnLayout
Layout.margins: contentMargins Layout.margins: contentMargins
spacing: 5 spacing: 5
Label Label
{ {
width: parent.width width: parent.width
......
...@@ -33,50 +33,51 @@ BabeGrid ...@@ -33,50 +33,51 @@ BabeGrid
Drawer Drawer
{ {
id: drawer id: drawer
y: parent.height-height-root.footer.height
width: pageStack.wideMode ? albumsViewGrid.width-1 : albumsViewGrid.width
height: height:
{ {
var customHeight = (drawerList.count*rowHeight)+48 var customHeight = (drawerList.count*rowHeight)+toolBarHeight
if(customHeight > parent.height) if(customHeight > parent.height)
parent.height-root.header.height parent.height - root.header.height - root.footer.height
else else
{ {
if(customHeight < parent.height*0.4) if(customHeight < parent.height*0.4)
parent.height*0.4 (parent.height*0.4) - root.footer.height
else else
customHeight customHeight - root.footer.height
} }
} }
x: pageStack.wideMode ? columnWidth+1 : 0 edge: Qt.RightEdge
width: pageStack.wideMode ? albumsViewGrid.width-1 : albumsViewGrid.width
edge: Qt.BottomEdge
interactive: false interactive: false
focus: true focus: true
modal: root.isMobile modal: root.isMobile
dragMargin: 0 dragMargin: 0
Component.onCompleted: drawerList.forceActiveFocus() margins: 0
spacing: 0
onOpened: drawerList.forceActiveFocus()
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
background: Rectangle background: Rectangle
{ {
anchors.fill: parent anchors.fill: parent
z: -999 z: -999
color: altColor color: altColor
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
} }
BabeTable BabeTable
...@@ -88,6 +89,7 @@ BabeGrid ...@@ -88,6 +89,7 @@ BabeGrid
headerBarExit: true headerBarExit: true
coverArtVisible: true coverArtVisible: true
quickPlayVisible: true quickPlayVisible: true
focus: true
onRowClicked: onRowClicked:
{ {
...@@ -130,6 +132,22 @@ BabeGrid ...@@ -130,6 +132,22 @@ BabeGrid
} }
onExit: drawer.close() onExit: drawer.close()
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
} }
} }
...@@ -196,4 +214,5 @@ BabeGrid ...@@ -196,4 +214,5 @@ BabeGrid
} }
Component.onCompleted: populate() Component.onCompleted: populate()
} }
...@@ -34,52 +34,54 @@ BabeGrid ...@@ -34,52 +34,54 @@ BabeGrid
Drawer Drawer
{ {
id: drawer id: drawer
y: parent.height-height-root.footer.height
width: pageStack.wideMode ? artistsViewGrid.width-1 : artistsViewGrid.width
height: height:
{ {
var customHeight = (drawerList.count*rowHeight)+48 var customHeight = (drawerList.count*rowHeight)+toolBarHeight
if(customHeight > parent.height) if(customHeight > parent.height)
parent.height-root.header.height parent.height - root.header.height - root.footer.height
else else
{ {
if(customHeight < parent.height*0.4) if(customHeight < parent.height*0.4)
parent.height*0.4 (parent.height*0.4) - root.footer.height
else else
customHeight customHeight - root.footer.height
} }
} }
x: pageStack.wideMode ? columnWidth+1 : 0
width: pageStack.wideMode ? artistsViewGrid.width-1 : artistsViewGrid.width edge: Qt.RightEdge
edge: Qt.BottomEdge
interactive: false interactive: false
focus: true focus: true
modal: root.isMobile modal: root.isMobile
dragMargin: 0 dragMargin: 0
clip: true margins: 0
spacing: 0
onOpened: drawerList.forceActiveFocus()
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
background: Rectangle background: Rectangle
{ {
anchors.fill: parent anchors.fill: parent
z: -999 z: -999
color: altColor color: altColor
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
} }
BabeTable BabeTable
{ {
id: drawerList id: drawerList
...@@ -126,6 +128,22 @@ BabeGrid ...@@ -126,6 +128,22 @@ BabeGrid
} }
onExit: drawer.close() onExit: drawer.close()
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
} }
} }
...@@ -160,6 +178,8 @@ BabeGrid ...@@ -160,6 +178,8 @@ BabeGrid
gridModel.append(map[i]) gridModel.append(map[i])
} }
Component.onCompleted: populate() Component.onCompleted: populate()
} }
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