Commit 6bf950ca authored by camilo higuita's avatar camilo higuita

testing on plasmo fixes

parent bdd4d7f3
......@@ -623,7 +623,7 @@ Maui.ApplicationWindow
width: Kirigami.Units.gridUnit * 15
height: root.height - root.headBar.implicitHeight - root.footBar.implicitHeight
modal: root.width < _drawer.width*1.5
modal: !isWide
handleVisible: false
closePolicy: Popup.NoAutoClose
contentItem: MainPlaylist
......
......@@ -121,16 +121,14 @@ void AlbumsModel::fetchInformation()
{
qDebug() << "RNUNGING BRAIN EFFORRTS";
QFutureWatcher<void> *watcher = new QFutureWatcher<void>;
QObject::connect(watcher, &QFutureWatcher<void>::finished, [=]()
{
watcher->deleteLater();
});
QObject::connect(watcher, &QFutureWatcher<void>::finished,
watcher, &QFutureWatcher<void>::deleteLater);
auto func = [=]()
{
QList<PULPO::REQUEST> requests;
int index = -1;
for(auto &album : this->list)
for(auto album : this->list)
{
index++;
if(!album[FMH::MODEL_KEY::ARTWORK].isEmpty())
......@@ -138,7 +136,6 @@ void AlbumsModel::fetchInformation()
if(BAE::artworkCache(album, FMH::MODEL_KEY::ALBUM))
{
qDebug()<< "cache artwork done" << album;
db->insertArtwork(album);
emit this->updateModel(index, {FMH::MODEL_KEY::ARTWORK});
continue;
......
......@@ -19,8 +19,6 @@ void TracksModel::setQuery(const QString &query)
return;
this->query = query;
qDebug()<< "setting query"<< this->query;
emit this->queryChanged();
}
......@@ -36,9 +34,9 @@ void TracksModel::setSortBy(const SORTBY &sort)
this->sort = sort;
this->preListChanged();
emit this->preListChanged();
this->sortList();
this->postListChanged();
emit this->postListChanged();
emit this->sortByChanged();
}
......@@ -53,26 +51,23 @@ void TracksModel::sortList()
return;
const auto key = static_cast<FMH::MODEL_KEY>(this->sort);
qDebug()<< "SORTING LIST BY"<< this->sort;
qSort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
{
auto role = key;
switch(role)
switch(key)
{
case FMH::MODEL_KEY::RELEASEDATE:
case FMH::MODEL_KEY::RATE:
case FMH::MODEL_KEY::FAV:
case FMH::MODEL_KEY::COUNT:
{
if(e1[role].toInt() > e2[role].toInt())
if(e1[key].toInt() > e2[key].toInt())
return true;
break;
}
case FMH::MODEL_KEY::TRACK:
{
if(e1[role].toInt() < e2[role].toInt())
if(e1[key].toInt() < e2[key].toInt())
return true;
break;
}
......@@ -81,8 +76,8 @@ void TracksModel::sortList()
{
auto currentTime = QDateTime::currentDateTime();
auto date1 = QDateTime::fromString(e1[role], Qt::TextDate);
auto date2 = QDateTime::fromString(e2[role], Qt::TextDate);
auto date1 = QDateTime::fromString(e1[key], Qt::TextDate);
auto date2 = QDateTime::fromString(e2[key], Qt::TextDate);
if(date1.secsTo(currentTime) < date2.secsTo(currentTime))
return true;
......@@ -95,8 +90,8 @@ void TracksModel::sortList()
case FMH::MODEL_KEY::ALBUM:
case FMH::MODEL_KEY::FORMAT:
{
const auto str1 = QString(e1[role]).toLower();
const auto str2 = QString(e2[role]).toLower();
const auto str1 = QString(e1[key]).toLower();
const auto str2 = QString(e2[key]).toLower();
if(str1 < str2)
return true;
......@@ -104,7 +99,7 @@ void TracksModel::sortList()
}
default:
if(e1[role] < e2[role])
if(e1[key] < e2[key])
return true;
}
......@@ -115,10 +110,7 @@ void TracksModel::sortList()
void TracksModel::setList()
{
emit this->preListChanged();
this->list = this->db->getDBData(this->query);
qDebug()<< "my LIST" ;
this->sortList();
emit this->postListChanged();
}
......@@ -133,15 +125,8 @@ QVariantMap TracksModel::get(const int &index) const
QVariantList TracksModel::getAll()
{
QVariantList res;
for(auto item : this->list)
{
QVariantMap map;
for(auto key : item.keys())
map.insert(FMH::MODEL_NAME[key], item[key]);
res << map;
}
for(const auto &item : this->list)
res << FM::toMap(item);
return res;
}
......@@ -151,17 +136,8 @@ void TracksModel::append(const QVariantMap &item)
if(item.isEmpty())
return;
emit this->preItemAppended();
FMH::MODEL model;
for(auto key : item.keys())
model.insert(FMH::MODEL_NAME_KEY[key], item[key].toString());
qDebug() << "Appending item to list" << item;
this->list << model;
qDebug()<< this->list;
emit this->preItemAppended();
this->list << FM::toModel(item);
emit this->postItemAppended();
}
......@@ -173,29 +149,15 @@ void TracksModel::append(const QVariantMap &item, const int &at)
if(at > this->list.size() || at < 0)
return;
qDebug()<< "trying to append at" << at << item["title"];
emit this->preItemAppendedAt(at);
FMH::MODEL model;
for(auto key : item.keys())
model.insert(FMH::MODEL_NAME_KEY[key], item[key].toString());
this->list.insert(at, model);
this->list.insert(at, FM::toModel(item));
emit this->postItemAppended();
}
void TracksModel::appendQuery(const QString &query)
{
if(query.isEmpty() || query == this->query)
return;
this->query = query;
emit this->preListChanged();
this->list << this->db->getDBData(query);
emit this->postListChanged();
}
......
......@@ -10,7 +10,7 @@
namespace FLoader
{
inline QStringList getPathContents(QStringList urls, QString path)
inline QStringList getPathContents(QStringList &urls, const QString &path)
{
if(!FMH::fileExists(path))
return urls;
......
......@@ -82,7 +82,6 @@ function notify(title, body)
bae.notify(title, body)
}
function addPlaylist(playlist)
{
playlistsView.playlistViewModel.model.insert(0, playlist)
......
......@@ -16,7 +16,7 @@ function playTrack(index)
if(currentTrack.artwork && currentTrack.artwork.length && currentTrack.artwork !== "NONE")
currentArtwork = currentTrack.artwork
// else bae.loadCover(currentTrack.url)
// else bae.loadCover(currentTrack.url)
progressBar.enabled = true
......@@ -24,8 +24,8 @@ function playTrack(index)
{
root.title = currentTrack.title + " - " +currentTrack.artist
// if(!root.active)
// bae.notifySong(currentTrack.url)
// if(!root.active)
// bae.notifySong(currentTrack.url)
}
// if(currentTrack.lyrics.length < 1)
......@@ -39,16 +39,12 @@ function playTrack(index)
}
function queueTracks(tracks)
{
if(tracks)
{
if(tracks && tracks.length > 0)
{
if(tracks.length > 0)
{
onQueue++
console.log(onQueue)
appendTracksAt(tracks, currentTrackIndex+1)
root.notify("", "Queue", tracks.length + " tracks added put on queue")
}
appendTracksAt(tracks, currentTrackIndex+onQueue+1)
onQueue++
root.notify("", "Queue", tracks.length + " tracks added put on queue")
}
}
......
......@@ -448,8 +448,8 @@ inline bool artworkCache(FMH::MODEL &track, const FMH::MODEL_KEY &type = FMH::MO
QDirIterator it(CachePath, QDir::Files, QDirIterator::NoIteratorFlags);
while (it.hasNext())
{
auto file = it.next();
auto fileName = QFileInfo(file).baseName();
const auto file = it.next();
const auto fileName = QFileInfo(file).baseName();
switch(type)
{
case FMH::MODEL_KEY::ALBUM:
......
......@@ -123,23 +123,22 @@ void vvave::openUrls(const QStringList &urls)
QVariantList data;
TagInfo info;
for(QString url : urls)
for(const auto &url : urls)
if(db->check_existance(BAE::TABLEMAP[BAE::TABLE::TRACKS], FMH::MODEL_NAME[FMH::MODEL_KEY::URL], url))
{
data << FM::toMap(this->db->getDBData(QStringList() << url).first());
}
else
}else
{
if(info.feed(url))
{
auto album = BAE::fixString(info.getAlbum());
auto track= info.getTrack();
auto title = BAE::fixString(info.getTitle()); /* to fix*/
auto artist = BAE::fixString(info.getArtist());
auto genre = info.getGenre();
auto sourceUrl = QFileInfo(url).dir().path();
auto duration = info.getDuration();
auto year = info.getYear();
const auto album = BAE::fixString(info.getAlbum());
const auto track= info.getTrack();
const auto title = BAE::fixString(info.getTitle()); /* to fix*/
const auto artist = BAE::fixString(info.getArtist());
const auto genre = info.getGenre();
const auto sourceUrl = QFileInfo(url).dir().path();
const auto duration = info.getDuration();
const auto year = info.getYear();
data << QVariantMap({
{FMH::MODEL_NAME[FMH::MODEL_KEY::URL], url},
......@@ -156,8 +155,6 @@ void vvave::openUrls(const QStringList &urls)
}
}
qDebug()<<"opening urls " << urls << data;
emit this->openFiles(data);
}
......
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