Commit 8a885393 authored by Camilo higuita's avatar Camilo higuita

fixes

parent b45ef222
......@@ -72,7 +72,7 @@ class CollectionDB : public QObject
FMH::MODEL_LIST getDBData(const QStringList &urls);
FMH::MODEL_LIST getDBData(const QString &queryTxt);
QVariantList getDBDataQML(const QString &queryTxt);
QStringList dataToList(const FMH::MODEL_LIST &list, const FMH::MODEL_KEY &key);
static QStringList dataToList(const FMH::MODEL_LIST &list, const FMH::MODEL_KEY &key);
FMH::MODEL_LIST getAlbumTracks(const QString &album, const QString &artist, const FMH::MODEL_KEY &orderBy = FMH::MODEL_KEY::TRACK, const BAE::W &order = BAE::W::ASC);
FMH::MODEL_LIST getArtistTracks(const QString &artist, const FMH::MODEL_KEY &orderBy = FMH::MODEL_KEY::ALBUM, const BAE::W &order = BAE::W::ASC);
......
......@@ -84,7 +84,9 @@ int main(int argc, char *argv[])
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, [&]()
{
qDebug()<<"FINISHED LOADING QML APP";
vvave.postActions();
const auto currentSources = vvave.getSourceFolders();
const QStringList sources = currentSources.isEmpty() ? BAE::defaultSources : currentSources;
vvave.scanDir(sources);
// if(!urls.isEmpty())
// bae.openUrls(urls);
});
......
......@@ -172,6 +172,7 @@ Maui.ApplicationWindow
onClicked: currentView = viewsIndex.tracks
text: qsTr("Tracks")
colorScheme.highlightColor: babeColor
spacing: 0
},
......@@ -276,15 +277,15 @@ Maui.ApplicationWindow
Layout.fillHeight: true
Layout.fillWidth: true
// leftContent: Maui.ToolButton
// {
// iconName: "headphones"
// visible: _drawer.modal
// iconColor: _drawer.visible ? babeColor : textColor
// onClicked: _drawer.visible = !_drawer.visible
// colorScheme.highlightColor: babeColor
// // text: qsTr("Now")
// }
leftContent: Maui.ToolButton
{
iconName: "headphones"
visible: _drawer.modal
iconColor: _drawer.visible ? babeColor : textColor
onClicked: _drawer.visible = !_drawer.visible
colorScheme.highlightColor: babeColor
// text: qsTr("Now")
}
middleContent: [
......@@ -608,7 +609,7 @@ Maui.ApplicationWindow
height: root.height - root.headBar.implicitHeight - root.footBar.implicitHeight
modal: !root.isWide
handleVisible: modal
handleVisible: false
closePolicy: Popup.NoAutoClose
contentItem: MainPlaylist
{
......
......@@ -19,10 +19,13 @@ inline uint getTracks(const QStringList& paths)
for(const auto &path : paths)
{
if(!FMH::fileExists(path))
continue;
if (QFileInfo(path).isDir())
{
db->addFolder(path);
QDirIterator it(path, FMH::FILTER_LIST[FMH::FILTER_TYPE::AUDIO], QDir::Files, QDirIterator::Subdirectories);
QDirIterator it(path, QStringList() << FMH::FILTER_LIST[FMH::FILTER_TYPE::AUDIO] << "*.m4a", QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext())
urls << it.next();
......
......@@ -20,8 +20,7 @@ BabeList
property alias list : _tracksList
property alias listModel : _tracksModel
property alias listView : babeTableRoot.listView
property alias removeDialog : _removeDialog
property bool trackNumberVisible
property bool quickPlayVisible : true
......@@ -36,6 +35,7 @@ BabeList
property bool group : false
property alias contextMenu : contextMenu
property alias contextMenuItems : contextMenu.content
property alias playAllBtn : playAllBtn
property alias appendBtn : appendBtn
......@@ -184,6 +184,30 @@ BabeList
}
]
Maui.Dialog
{
id: _removeDialog
property int index
title: qsTr("Remove track")
message: qsTr("You can delete the file from your computer or remove it from your collection")
rejectButton.text: qsTr("Delete")
// rejectButton.icon.name: "archive-remove"
acceptButton.text: qsTr("Remove")
onAccepted:
{
list.remove(listView.currentIndex)
close()
}
onRejected:
{
if(Maui.FM.removeFile(list.get(index).url))
list.remove(listView.currentIndex)
close()
}
}
TableMenu
{
id: contextMenu
......@@ -222,7 +246,8 @@ BabeList
onRemoveClicked:
{
// list.remove(listView.currentIndex)
_removeDialog.index= listView.currentIndex
_removeDialog.open()
}
onRateClicked:
......
......@@ -79,21 +79,13 @@ void vvave::runBrain()
emit this->refreshArtists();
};
BRAIN::synapse(BRAIN::PACKAGES() << albumPackage << artistPackage);
BRAIN::synapse(BRAIN::PACKAGES() << albumPackage /*<< artistPackage*/);
};
QFuture<void> t1 = QtConcurrent::run(func);
watcher->setFuture(t1);
}
void vvave::postActions()
{
this->checkCollection(BAE::defaultSources, [this](uint size)
{
emit this->refreshTables(size);
runBrain();
});
}
void vvave::checkCollection(const QStringList &paths, std::function<void(uint)> cb)
{
......@@ -125,7 +117,7 @@ void vvave::checkCollection(const QStringList &paths, std::function<void(uint)>
//// PUBLIC SLOTS
QVariantList vvave::sourceFolders() const
QVariantList vvave::sourceFolders()
{
const auto sources = this->db->getDBData("select * from sources");
......@@ -142,14 +134,20 @@ QString vvave::moodColor(const int &index)
else return "";
}
void vvave::scanDir(const QString &path)
void vvave::scanDir(const QStringList &paths)
{
this->checkCollection(QStringList() << path);
this->checkCollection(paths, [this](uint size)
{
emit this->refreshTables(size);
runBrain();
});
}
QStringList vvave::getSourceFolders()
{
return this->db->getSourcesFolders();
const auto folders = this->db->getSourcesFolders();
qDebug()<< folders;
return folders;
}
......
......@@ -19,8 +19,6 @@ private:
public:
explicit vvave(QObject *parent = nullptr);
~vvave();
void postActions();
signals:
void refreshTables(uint size);
......@@ -31,9 +29,9 @@ signals:
public slots:
///DB Interfaces
/// useful functions for non modeled views and actions with not direct access to a tracksmodel or its own model
QVariantList sourceFolders() const;
QVariantList sourceFolders();
static QString moodColor(const int &index);
void scanDir(const QString &path);
void scanDir(const QStringList &paths = BAE::defaultSources);
QStringList getSourceFolders();
......
......@@ -114,6 +114,13 @@ Kirigami.PageRow
holder.body: "Your playlist is empty,<br>start adding new music to it"
holder.emojiSize: iconSizes.huge
contextMenuItems:
Maui.MenuItem
{
text: qsTr("Remove from playlist")
}
// headerMenu.menuItem: [
// Maui.MenuItem
// {
......
......@@ -12,10 +12,6 @@ Maui.Dialog
maxHeight: unit * 500
page.margins: 0
defaultButtons: false
function scanDir(folderUrl)
{
vvave.scanDir(folderUrl)
}
Maui.Dialog
{
......@@ -95,11 +91,11 @@ Maui.Dialog
fmDialog.onlyDirs = true
fmDialog.show(function(paths)
{
for(var i in paths)
{
console.log("SCAN DIR <<", paths)
for(var i in paths)
listModel.append({url: paths[i]})
scanDir(paths[i])
}
vvave.scanDir([paths])
close()
})
......@@ -114,6 +110,7 @@ Maui.Dialog
{
sources.model.clear()
var folders = vvave.getSourceFolders()
console.log(folders)
for(var i in folders)
sources.model.append({url : folders[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