Commit 52bdc6d3 authored by camilo higuita's avatar camilo higuita

now start working on the plasmo efforts

parent 2ea2c8bd
......@@ -385,7 +385,7 @@ Maui.ApplicationWindow
// }
// },
Maui.MenuItem
MenuItem
{
text: qsTr("Folders")
icon.name: "folder"
......@@ -404,7 +404,7 @@ Maui.ApplicationWindow
// }
// },
Maui.MenuItem
MenuItem
{
text: qsTr("YouTube")
icon.name: "internet-services"
......@@ -437,14 +437,14 @@ Maui.ApplicationWindow
MenuSeparator{},
Maui.MenuItem
MenuItem
{
text: qsTr("Sources...")
icon.name: "folder-add"
onTriggered: sourcesDialog.open()
},
Maui.MenuItem
MenuItem
{
text: qsTr("Open...")
icon.name: "folder-add"
......@@ -457,31 +457,31 @@ Maui.ApplicationWindow
vvave.openUrls(paths)
})
}
}
}/*,
// Maui.Menu
// {
// title: qsTr("Collection")
// // icon.name: "settings-configure"
Menu
{
title: qsTr("Collection")
// icon.name: "settings-configure"
// Maui.MenuItem
// {
// text: qsTr("Re-Scan")
// onTriggered: bae.refreshCollection();
// }
MenuItem
{
text: qsTr("Re-Scan")
onTriggered: bae.refreshCollection();
}
// Maui.MenuItem
// {
// text: qsTr("Refresh...")
// onTriggered: H.refreshCollection();
// }
MenuItem
{
text: qsTr("Refresh...")
onTriggered: H.refreshCollection();
}
// Maui.MenuItem
// {
// text: qsTr("Clean")
// onTriggered: bae.removeMissingTracks();
// }
// },
MenuItem
{
text: qsTr("Clean")
onTriggered: bae.removeMissingTracks();
}
}*/
// Maui.Menu
// {
......
......@@ -124,7 +124,7 @@ void AlbumsModel::fetchInformation()
QObject::connect(watcher, &QFutureWatcher<void>::finished,
watcher, &QFutureWatcher<void>::deleteLater);
auto func = [=]()
auto func = [&]()
{
QList<PULPO::REQUEST> requests;
int index = -1;
......@@ -136,7 +136,7 @@ void AlbumsModel::fetchInformation()
if(BAE::artworkCache(album, FMH::MODEL_KEY::ALBUM))
{
db->insertArtwork(album);
this->db->insertArtwork(album);
emit this->updateModel(index, {FMH::MODEL_KEY::ARTWORK});
continue;
}
......@@ -182,26 +182,25 @@ void AlbumsModel::fetchInformation()
Pulpo pulpo;
QEventLoop loop;
QObject::connect(&pulpo, &Pulpo::finished, &loop, &QEventLoop::quit);
// bool stop = false;
bool stop = false;
// QObject::connect(this, &AlbumsModel::destroyed, [&]()
// {
// qDebug()<< stop << &stop;
// stop = true;
// qDebug()<< stop << &stop;
QObject::connect(this, &AlbumsModel::destroyed, [&stop]()
{
qDebug()<< stop << &stop;
stop = true;
qDebug()<< stop << &stop;
// });
});
for(const auto &req : requests)
{
pulpo.request(req);
loop.exec();
// if(stop)
// {
// loop.quit();
// return;
// }
if(stop)
{
loop.quit();
return;
}
}
};
......
......@@ -62,7 +62,7 @@ void Pulpo::start()
case SERVICES::LastFm:
{
auto lastfm = new class lastfm();
connect(lastfm, &lastfm::responseReady,[=](PULPO::REQUEST request, PULPO::RESPONSES responses)
connect(lastfm, &lastfm::responseReady,[&, lastfm = std::move(lastfm)](PULPO::REQUEST request, PULPO::RESPONSES responses)
{
this->passSignal(request, responses);
lastfm->deleteLater();
......@@ -76,13 +76,11 @@ void Pulpo::start()
}
}
void Pulpo::passSignal(REQUEST request, RESPONSES responses)
void Pulpo::passSignal(const REQUEST &request, const RESPONSES &responses)
{
if(request.callback)
request.callback(request, responses);
else
emit this->infoReady(request, responses);
emit this->finished();
}
......@@ -31,7 +31,7 @@ private:
PULPO::REQUEST req;
void passSignal(PULPO::REQUEST request, PULPO::RESPONSES responses);
void passSignal(const REQUEST &request, const RESPONSES &responses);
signals:
void infoReady(PULPO::REQUEST request, PULPO::RESPONSES responses);
......
......@@ -32,7 +32,7 @@ void Service::retrieve(const QString &url, const QMap<QString, QString> &headers
if(!url.isEmpty())
{
auto downloader = new FMH::Downloader;
connect(downloader, &FMH::Downloader::dataReady, [=](QByteArray array)
connect(downloader, &FMH::Downloader::dataReady, [&, downloader = std::move(downloader)](QByteArray array)
{
// qDebug()<< "DATA READY << " << array;
emit this->arrayReady(array);
......
......@@ -110,16 +110,14 @@ void lastfm::parseArtist(const QByteArray &array)
if (n.isElement())
{
//Here retrieve the artist image
if(n.nodeName() == "image" && n.hasAttributes())
{
if(this->request.info.contains(INFO::ARTWORK))
{
auto imgSize = n.attributes().namedItem("size").nodeValue();
const auto imgSize = n.attributes().namedItem("size").nodeValue();
if (imgSize == "large" && n.isElement())
{
auto artistArt_url = n.toElement().text();
const auto artistArt_url = n.toElement().text();
this->responses << PULPO::RESPONSE {CONTEXT::IMAGE, artistArt_url};
if(this->request.info.size() == 1) break;
......@@ -262,11 +260,11 @@ void lastfm::parseAlbum(const QByteArray &array)
{
if(this->request.info.contains(INFO::ARTWORK))
{
auto imgSize = n.attributes().namedItem("size").nodeValue();
const auto imgSize = n.attributes().namedItem("size").nodeValue();
if (imgSize == "large" && n.isElement())
{
auto albumArt_url = n.toElement().text();
const auto albumArt_url = n.toElement().text();
this->responses << PULPO::RESPONSE {CONTEXT::IMAGE, albumArt_url};
if(this->request.info.size() == 1) break;
......@@ -281,7 +279,7 @@ void lastfm::parseAlbum(const QByteArray &array)
{
if(this->request.info.contains(INFO::WIKI))
{
auto albumWiki = n.childNodes().item(1).toElement().text();
const auto albumWiki = n.childNodes().item(1).toElement().text();
//qDebug()<<"Fetching AlbumWiki LastFm[]";
this->responses << PULPO::RESPONSE {CONTEXT::WIKI, albumWiki};
......
......@@ -101,7 +101,7 @@ QString Linking::getDeviceName()
void Linking::ask(int code, QString msg)
{
bDebug::Instance()->msg("Sending msg to server: "+QString::number(code)+" :: "+ msg);
// bDebug::Instance()->msg("Sending msg to server: "+QString::number(code)+" :: "+ msg);
client.sendTextMessage(stringify(packResponse(static_cast<LINK::CODE>(code), msg)));
}
......
......@@ -19,7 +19,7 @@
#include "youtubedl.h"
#include "../../pulpo/pulpo.h"
#include "../../db/collectionDB.h"
#include "../../utils/babeconsole.h"
//#include "../../utils/babeconsole.h"
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
#include "kde/notify.h"
......@@ -54,7 +54,7 @@ void youtubedl::fetch(const QString &json)
auto playlist = data.value("playlist").toString().trimmed();
auto page = data.value("page").toString().replace('"',"").trimmed();
bDebug::Instance()->msg("Fetching from Youtube: "+id+" "+title+" "+artist);
// bDebug::Instance()->msg("Fetching from Youtube: "+id+" "+title+" "+artist);
FMH::MODEL infoMap;
infoMap.insert(FMH::MODEL_KEY::TITLE, title);
......@@ -86,7 +86,7 @@ void youtubedl::fetch(const QString &json)
auto command = ydl;
command = command.replace("$$$",infoMap[FMH::MODEL_KEY::ID])+" "+infoMap[FMH::MODEL_KEY::ID];
bDebug::Instance()->msg(command);
// bDebug::Instance()->msg(command);
process->start(command);
}
}
......
......@@ -57,9 +57,6 @@ SOURCES += main.cpp \
services/local/socket.cpp \
services/web/youtube.cpp \
vvave.cpp \
db/conthread.cpp \
services/web/babeit.cpp \
utils/babeconsole.cpp \
services/local/youtubedl.cpp \
services/local/linking.cpp \
services/web/Spotify/spotify.cpp \
......@@ -90,10 +87,6 @@ HEADERS += \
services/local/socket.h \
services/web/youtube.h \
vvave.h \
db/conthread.h \
services/web/babeit.h \
utils/babeconsole.h \
utils/singleton.h \
services/local/youtubedl.h \
services/local/linking.h \
services/web/Spotify/spotify.h \
......
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