Commit 19f13ca2 authored by Camilo Higuita's avatar Camilo Higuita

actually make the simultanious insertion on a thread work with a on queue system

parent 969880e0
......@@ -207,12 +207,14 @@ void CollectionDB::openDB(const QString &name)
}
if (!this->m_db.isOpen())
{
{
if(!this->m_db.open())
qDebug()<<"ERROR OPENING DB"<<this->m_db.lastError().text()<<m_db.connectionName();
}else
{
this->execQuery("PRAGMA journal_mode=WAL");
else
{
qDebug()<<"Setting pragma WAL";
this->execQuery("PRAGMA journal_mode=WAL");
}
}
}
......
......@@ -19,24 +19,14 @@ void ConThread::start(QString table, QVariantList wheres)
this->queue.append({{QString ("TABLE"), table}, {QString ("WHERES"), wheres}});
qDebug()<<"NOW ON THREAD<<"<< queue;
if(this->queue.size() > 1) return;
while(!this->queue.isEmpty())
if(this->go)
{
if(this->go)
{
qDebug()<<"RUNNIGN QUERY ON CONTHREAD"<<this->queue.first()["TABLE"].toString();
QMetaObject::invokeMethod(this, "set", Q_ARG(QString, this->queue.first()["TABLE"].toString()), Q_ARG(QVariantList, this->queue.first()["WHERES"].toList()));
qDebug()<<"FINISHED SET ON QUEUE CONTHREAD"<< this->queue.first()["TABLE"].toString();
this->queue.removeFirst();
qDebug()<<this->queue.size();
}else return;
}
qDebug()<<"FINISHED SET ON CONTHREAD TOTALLY";
qDebug()<<"RUNNIGN QUERY ON CONTHREAD"<<this->queue.first()["TABLE"].toString();
QMetaObject::invokeMethod(this, "set", Q_ARG(QString, this->queue.first()["TABLE"].toString()), Q_ARG(QVariantList, this->queue.first()["WHERES"].toList()));
}else return;
}
void ConThread::stop()
......@@ -74,6 +64,15 @@ void ConThread::set(QString tableName, QVariantList wheres)
this->insert(tableName, QVariantMap(variant.toMap()));
this->t.msleep(this->interval);
}
qDebug()<<"FINISHED SET ON QUEUE CONTHREAD"<< this->queue.first()["TABLE"].toString();
this->queue.removeFirst();
qDebug()<<"QUERYS ON QUEUE THREAD"<<this->queue.size();
if(!this->queue.isEmpty())
this->set(this->queue.first()["TABLE"].toString(), this->queue.first()["WHERES"].toList());
else qDebug()<<"FINISHED SET ON CONTHREAD TOTALLY";
}
......@@ -21,7 +21,7 @@ public:
private:
QThread t;
uint interval = 500;
uint interval = 0;
bool go = false;
QList<QMap<QString, QVariant>> queue;
......
......@@ -16,7 +16,7 @@ function playTrack(track)
var artwork = root.currentTrack.artwork
// root.mainPlaylist.list.currentItem.playingIndicator = true
root.currentArtwork = artwork && artwork.length>0 && artwork !== "NONE" ? artwork : bae.loadCover(root.mainPlaylist.currentTrack.url)
root.currentArtwork = artwork && artwork.length>0 && artwork !== "NONE" ? artwork : bae.loadCover(root.currentTrack.url)
if(!root.isMobile)
{
......
......@@ -19,7 +19,6 @@ ItemDelegate
opacity: 0.3
}
ColumnLayout
{
anchors.fill: parent
......
......@@ -2,6 +2,8 @@ import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.2 as Kirigami
import "../../view_models/BabeMenu"
import "../../utils"
import ".."
......@@ -30,7 +32,19 @@ BabeMenu
BabeMenuItem
{
text: "Send list to..."
}
Kirigami.Separator{ width: parent.width; height: 1}
BabeMenuItem
{
text: "Visible info..."
onTriggered: {}
}
Kirigami.Separator{ width: parent.width; height: 1}
}
}
......@@ -30,7 +30,6 @@ BabeGrid
Drawer
{
id: drawer
height:
{
var customHeight = (drawerList.count*rowHeight)+48
......@@ -76,65 +75,60 @@ BabeGrid
}
}
Column
BabeTable
{
id: drawerList
anchors.fill: parent
trackNumberVisible: true
headerBar: true
headerClose: true
coverArtVisible: true
quickPlayVisible: true
BabeTable
onRowClicked:
{
id: drawerList
width: parent.width
height: parent.height
trackNumberVisible: true
headerBar: true
headerClose: true
coverArtVisible: true
quickPlayVisible: true
onRowClicked:
{
drawer.close()
albumsViewGrid.rowClicked(model.get(index))
}
onQuickPlayTrack:
{
drawer.close()
albumsViewGrid.playTrack(model.get(index))
}
drawer.close()
albumsViewGrid.rowClicked(model.get(index))
}
onQueueTrack:
{
albumsViewGrid.queueTrack(model.get(index))
drawer.close()
}
onQuickPlayTrack:
{
drawer.close()
albumsViewGrid.playTrack(model.get(index))
}
onPlayAll:
{
drawer.close()
onQueueTrack:
{
albumsViewGrid.queueTrack(model.get(index))
drawer.close()
}
var data = albumsViewGrid.gridModel.get(albumsViewGrid.grid.currentIndex)
var query = Q.GET.albumTracks_.arg(data.album)
query = query.arg(data.artist)
var tracks = bae.get(query)
onPlayAll:
{
drawer.close()
albumsViewGrid.playAlbum(tracks)
}
var data = albumsViewGrid.gridModel.get(albumsViewGrid.grid.currentIndex)
var query = Q.GET.albumTracks_.arg(data.album)
query = query.arg(data.artist)
var tracks = bae.get(query)
onAppendAll:
{
var data = albumsView.gridModel.get(albumsViewGrid.grid.currentIndex)
var query = Q.GET.albumTracks_.arg(data.album)
query = query.arg(data.artist)
var tracks = bae.get(query)
albumsViewGrid.appendAlbum(tracks)
drawer.close()
}
albumsViewGrid.playAlbum(tracks)
}
onHeaderClosed: drawer.close()
onAppendAll:
{
var data = albumsView.gridModel.get(albumsViewGrid.grid.currentIndex)
var query = Q.GET.albumTracks_.arg(data.album)
query = query.arg(data.artist)
var tracks = bae.get(query)
albumsViewGrid.appendAlbum(tracks)
drawer.close()
}
onHeaderClosed: drawer.close()
}
}
onAlbumCoverClicked:
......
......@@ -77,59 +77,55 @@ BabeGrid
}
}
Column
BabeTable
{
id: drawerList
anchors.fill: parent
BabeTable
trackNumberVisible: true
headerBar: true
headerClose: true
coverArtVisible: true
onRowClicked:
{
id: drawerList
width: parent.width
height: parent.height
trackNumberVisible: true
headerBar: true
headerClose: true
coverArtVisible: true
onRowClicked:
{
drawer.close()
artistsViewGrid.rowClicked(model.get(index))
}
onQuickPlayTrack:
{
drawer.close()
artistsViewGrid.playTrack(model.get(index))
}
drawer.close()
artistsViewGrid.rowClicked(model.get(index))
}
onQueueTrack:
{
drawer.close()
artistsViewGrid.queueTrack(model.get(index))
}
onQuickPlayTrack:
{
drawer.close()
artistsViewGrid.playTrack(model.get(index))
}
onPlayAll:
{
drawer.close()
var data = artistsViewGrid.gridModel.get(artistsViewGrid.grid.currentIndex)
onQueueTrack:
{
drawer.close()
artistsViewGrid.queueTrack(model.get(index))
}
var query = Q.GET.artistTracks_.arg(data.artist)
var tracks = bae.get(query)
artistsViewGrid.playAlbum(tracks)
}
onPlayAll:
{
drawer.close()
var data = artistsViewGrid.gridModel.get(artistsViewGrid.grid.currentIndex)
onAppendAll:
{
var data = artistsViewGrid.gridModel.get(artistsViewGrid.grid.currentIndex)
var query = Q.GET.artistTracks_.arg(data.artist)
var tracks = bae.get(query)
artistsViewGrid.appendAlbum(tracks)
drawer.close()
}
var query = Q.GET.artistTracks_.arg(data.artist)
var tracks = bae.get(query)
artistsViewGrid.playAlbum(tracks)
}
onHeaderClosed: drawer.close()
onAppendAll:
{
var data = artistsViewGrid.gridModel.get(artistsViewGrid.grid.currentIndex)
var query = Q.GET.artistTracks_.arg(data.artist)
var tracks = bae.get(query)
artistsViewGrid.appendAlbum(tracks)
drawer.close()
}
onHeaderClosed: drawer.close()
}
}
onAlbumCoverClicked:
......
......@@ -72,9 +72,9 @@ Item
Layout.maximumHeight: 300
visible: list.count > 0
Rectangle
{
visible: cover.visible
anchors.fill: parent
color: midColor
z: -999
......@@ -82,12 +82,12 @@ Item
FastBlur
{
visible: cover.visible
width: mainPlaylistRoot.width
height: mainPlaylistItem.y
source: artwork
radius: 100
transparentBorder: false
// opacity: 0.8
cached: true
}
......@@ -106,23 +106,6 @@ Item
anchors.fill: parent
onDoubleClicked: gomini()
// drag.target: artwork
// drag.axis: Drag.YAxis
// drag.minimumY: 0
// drag.maximumY: coverSize
// onMouseYChanged:
// {
// cover.height = mouseY < 0 ? 0 : mouseY
//// if(mouseY < coverSize*0.8)
//// {
//// cover.visible = false
//// }else cover.visible = true
// }
onPressAndHold:
{
var query = Q.GET.albumTracks_.arg(currentTrack.album)
......@@ -130,22 +113,8 @@ Item
var tracks = bae.get(query)
coverPressed(tracks)
}
// onClicked:
// {
// if(stackView.currentItem !== list)
// stackView.pop(list)
// else
// {
// stackView.push(infoView)
// infoView.currentView = 1
// }
// }
}
}
}
Item
......@@ -158,7 +127,7 @@ Item
Layout.fillWidth: true
Layout.preferredHeight: visible ? toolBarHeight : 0
// anchors.top: cover.bottom
visible: list.count > 0
visible: cover.visible
Rectangle
{
......@@ -183,9 +152,6 @@ Item
}
}
}
MouseArea
{
anchors.fill: parent
......@@ -319,7 +285,6 @@ Item
initialItem: BabeTable
{
id: list
// anchors.fill: parent
quickPlayVisible: false
coverArtVisible: true
trackRating: true
......
......@@ -60,11 +60,14 @@ Kirigami.PageRow
onPlaySync: syncAndPlay(index)
}
Kirigami.Separator{ Layout.fillWidth: true; width: parent.width; height: 1}
ColorTagsBar
{
Layout.fillWidth: true
height: rowHeightAlt
recSize: toolBarIconSize
recSize: isMobile ? toolBarIconSize : 16
Rectangle
{
anchors.fill: parent
......@@ -98,8 +101,7 @@ Kirigami.PageRow
BabeTable
{
id: filterList
width: parent.width
height: parent.height
anchors.fill: parent
quickPlayVisible: true
coverArtVisible: true
trackRating: true
......
......@@ -92,7 +92,14 @@ Item
RowLayout
{
anchors.fill: parent
anchors.fill: parent
BabeButton
{
visible: true
iconName: "edit-find"
onClicked: {}
}
TextInput
{
id: searchInput
......@@ -110,8 +117,7 @@ Item
BabeButton
{
Layout.fillHeight: true
visible: searchInput.activeFocus
visible: searchInput.text.length > 0
iconName: "edit-clear"
onClicked: clearSearch()
}
......
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