Commit e00b4f7b authored by camilo higuita's avatar camilo higuita

mor wrok towards plasmo integration

parent 52bdc6d3
...@@ -155,61 +155,92 @@ Maui.ApplicationWindow ...@@ -155,61 +155,92 @@ Maui.ApplicationWindow
/* UI */ /* UI */
altToolBars: false altToolBars: false
accentColor: babeColor accentColor: babeColor
headBarFGColor: altColorText // headBarFGColor: altColorText
headBarBGColor: "#212121" // headBarBGColor: "#212121"
altColorText: darkTextColor // altColorText: darkTextColor
floatingBar: false floatingBar: false
headBar.spacing: space.big headBar.spacing: space.big
headBar.middleContent : [ headBar.middleContent : Kirigami.ActionToolBar
Maui.ToolButton {
{
iconName: "view-media-track"
active: currentView === viewsIndex.tracks
showIndicator: true
iconColor: active ? babeColor : altColorText
onClicked: currentView = viewsIndex.tracks
text: qsTr("Tracks")
colorScheme.highlightColor: babeColor
spacing: 0
}, hiddenActions: [
Maui.ToolButton Kirigami.Action
{ {
text: qsTr("Albums") text: qsTr("Folders")
active: currentView === viewsIndex.albums icon.name: "folder"
iconName: /*"album"*/ "view-media-album-cover" checked: currentView === viewsIndex.folders
iconColor: currentView === viewsIndex.albums ? babeColor : altColorText checkable: false
onClicked: currentView = viewsIndex.albums onTriggered: currentView = viewsIndex.folders
colorScheme.highlightColor: babeColor },
showIndicator: true
}, Kirigami.Action
{
text: qsTr("YouTube")
checkable: false
icon.name: "internet-services"
checked: currentView === viewsIndex.youtube
onTriggered: currentView = viewsIndex.youtube
Maui.ToolButton }
{
text: qsTr("Artists")
active: currentView === viewsIndex.artists
iconName: "view-media-artist"
iconColor: currentView === viewsIndex.artists ? babeColor : altColorText
onClicked: currentView = viewsIndex.artists
colorScheme.highlightColor: babeColor
showIndicator: true
},
Maui.ToolButton ]
{ actions: [
text: qsTr("Playlists") Kirigami.Action
active: currentView === viewsIndex.playlists {
iconName: "view-media-playlist" icon.name: "view-media-track"
iconColor: currentView === viewsIndex.playlists ? babeColor : altColorText checked: currentView === viewsIndex.tracks
onClicked: currentView = viewsIndex.playlists // showIndicator: true
colorScheme.highlightColor: babeColor // icon.color: active ? babeColor : altColorText
showIndicator: true onTriggered: currentView = viewsIndex.tracks
text: qsTr("Tracks")
checkable: false
// colorScheme.highlightColor: babeColor
// spacing: 0
},
Kirigami.Action
{
text: qsTr("Albums")
checkable: false
checked: currentView === viewsIndex.albums
icon.name: /*"album"*/ "view-media-album-cover"
// icon.color: currentView === viewsIndex.albums ? babeColor : altColorText
onTriggered: currentView = viewsIndex.albums
// colorScheme.highlightColor: babeColor
// showIndicator: true
},
Kirigami.Action
{
text: qsTr("Artists")
checkable: false
checked: currentView === viewsIndex.artists
icon.name: "view-media-artist"
Kirigami.Theme.textColor: currentView === viewsIndex.artists ? babeColor : altColorText
onTriggered: currentView = viewsIndex.artists
// colorScheme.highlightColor: babeColor
// showIndicator: true
},
Kirigami.Action
{
text: qsTr("Playlists")
checkable: false
checked: currentView === viewsIndex.playlists
icon.name: "view-media-playlist"
// icon.color: currentView === viewsIndex.playlists ? babeColor : altColorText
onTriggered: currentView = viewsIndex.playlists
// colorScheme.highlightColor: babeColor
// showIndicator: true
} }
]
]
}
footBar.visible: !mainlistEmpty footBar.visible: !mainlistEmpty
footBar.implicitHeight: footBar.visible ? toolBarHeight * 1.2 : 0 footBar.implicitHeight: footBar.visible ? toolBarHeight * 1.2 : 0
...@@ -343,7 +374,7 @@ Maui.ApplicationWindow ...@@ -343,7 +374,7 @@ Maui.ApplicationWindow
} }
leftIcon.iconColor: currentView === viewsIndex.search ? babeColor : altColorText // leftIcon.iconColor: currentView === viewsIndex.search ? babeColor : altColorText
onSearchButtonClicked: onSearchButtonClicked:
{ {
currentView = viewsIndex.search currentView = viewsIndex.search
...@@ -385,12 +416,6 @@ Maui.ApplicationWindow ...@@ -385,12 +416,6 @@ Maui.ApplicationWindow
// } // }
// }, // },
MenuItem
{
text: qsTr("Folders")
icon.name: "folder"
onTriggered: currentView = viewsIndex.folders
},
// Maui.MenuItem // Maui.MenuItem
// { // {
...@@ -404,13 +429,7 @@ Maui.ApplicationWindow ...@@ -404,13 +429,7 @@ Maui.ApplicationWindow
// } // }
// }, // },
MenuItem
{
text: qsTr("YouTube")
icon.name: "internet-services"
onTriggered: currentView = viewsIndex.youtube
},
// Maui.MenuItem // Maui.MenuItem
// { // {
...@@ -880,7 +899,7 @@ Maui.ApplicationWindow ...@@ -880,7 +899,7 @@ Maui.ApplicationWindow
onPlayAll: onPlayAll:
{ {
mainPlaylist.list.clear() mainPlaylist.list.clear()
// mainPlaylist.list.sortBy = Tracks.NONE // mainPlaylist.list.sortBy = Tracks.NONE
mainPlaylist.list.query = foldersView.list.list.query mainPlaylist.list.query = foldersView.list.list.query
Player.playAll() Player.playAll()
} }
...@@ -1010,26 +1029,26 @@ Maui.ApplicationWindow ...@@ -1010,26 +1029,26 @@ Maui.ApplicationWindow
onRefreshAlbums: H.refreshAlbums() onRefreshAlbums: H.refreshAlbums()
onRefreshArtists: H.refreshArtists() onRefreshArtists: H.refreshArtists()
// onCoverReady: // onCoverReady:
// { // {
// root.currentArtwork = path // root.currentArtwork = path
// currentTrack.artwork = currentArtwork // currentTrack.artwork = currentArtwork
// mainPlaylist.list.update(currentTrack, currentTrackIndex); // mainPlaylist.list.update(currentTrack, currentTrackIndex);
// } // }
// onTrackLyricsReady: // onTrackLyricsReady:
// { // {
// console.log(lyrics) // console.log(lyrics)
// if (url === currentTrack.url) // if (url === currentTrack.url)
// Player.setLyrics(lyrics) // Player.setLyrics(lyrics)
// } // }
// onSkipTrack: Player.nextTrack() // onSkipTrack: Player.nextTrack()
// onBabeIt: if (!mainlistEmpty) // onBabeIt: if (!mainlistEmpty)
// { // {
// mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.list.get(currentTrackIndex).fav == "1")) // mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.list.get(currentTrackIndex).fav == "1"))
// currentBabe = mainPlaylist.list.get(currentTrackIndex).fav == "1" // currentBabe = mainPlaylist.list.get(currentTrackIndex).fav == "1"
// } // }
onOpenFiles: onOpenFiles:
{ {
......
...@@ -107,14 +107,14 @@ void AlbumsModel::setList() ...@@ -107,14 +107,14 @@ void AlbumsModel::setList()
//get albums data with modifier for missing images for artworks //get albums data with modifier for missing images for artworks
this->list = this->db->getDBData(m_Query, [&](FMH::MODEL &item) this->list = this->db->getDBData(m_Query, [&](FMH::MODEL &item)
{ {
if(!item[FMH::MODEL_KEY::ARTWORK].isEmpty() && !FMH::fileExists(item[FMH::MODEL_KEY::ARTWORK])) if(!item[FMH::MODEL_KEY::ARTWORK].isEmpty() && !FMH::fileExists(item[FMH::MODEL_KEY::ARTWORK]))
{ {
this->db->removeArtwork(FMH::MODEL_NAME[static_cast<FMH::MODEL_KEY>(this->query)], FM::toMap(item)); this->db->removeArtwork(FMH::MODEL_NAME[static_cast<FMH::MODEL_KEY>(this->query)], FM::toMap(item));
item[FMH::MODEL_KEY::ARTWORK] = ""; item[FMH::MODEL_KEY::ARTWORK] = "";
} }
}); });
this->sortList(); this->sortList();
emit this->postListChanged(); emit this->postListChanged();
} }
void AlbumsModel::fetchInformation() void AlbumsModel::fetchInformation()
...@@ -124,8 +124,11 @@ void AlbumsModel::fetchInformation() ...@@ -124,8 +124,11 @@ void AlbumsModel::fetchInformation()
QObject::connect(watcher, &QFutureWatcher<void>::finished, QObject::connect(watcher, &QFutureWatcher<void>::finished,
watcher, &QFutureWatcher<void>::deleteLater); watcher, &QFutureWatcher<void>::deleteLater);
auto func = [&]() // QObject::connect(this, &AlbumsModel::destroyed, watcher, &QFutureWatcher<void>::waitForFinished);
auto func = [&, stop = bool()]() mutable
{ {
stop = false;
QList<PULPO::REQUEST> requests; QList<PULPO::REQUEST> requests;
int index = -1; int index = -1;
for(auto album : this->list) for(auto album : this->list)
...@@ -182,7 +185,6 @@ void AlbumsModel::fetchInformation() ...@@ -182,7 +185,6 @@ void AlbumsModel::fetchInformation()
Pulpo pulpo; Pulpo pulpo;
QEventLoop loop; QEventLoop loop;
QObject::connect(&pulpo, &Pulpo::finished, &loop, &QEventLoop::quit); QObject::connect(&pulpo, &Pulpo::finished, &loop, &QEventLoop::quit);
bool stop = false;
QObject::connect(this, &AlbumsModel::destroyed, [&stop]() QObject::connect(this, &AlbumsModel::destroyed, [&stop]()
{ {
...@@ -195,11 +197,18 @@ void AlbumsModel::fetchInformation() ...@@ -195,11 +197,18 @@ void AlbumsModel::fetchInformation()
for(const auto &req : requests) for(const auto &req : requests)
{ {
pulpo.request(req); pulpo.request(req);
loop.exec();
if(stop) if(stop)
{ {
loop.quit(); qDebug()<< "TRYING EXITING THREAD LOADINFO" << loop.isRunning();
return;
if(loop.isRunning())
loop.quit();
qDebug()<< "EXITING THREAD LOADINFO" << loop.isRunning();
break;
}else {
loop.exec();
} }
} }
}; };
......
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
AlbumsModel::SORTBY getSortBy() const; AlbumsModel::SORTBY getSortBy() const;
private: private:
bool stopThreads = false;
CollectionDB *db; CollectionDB *db;
FMH::MODEL_LIST list; FMH::MODEL_LIST list;
void sortList(); void sortList();
......
...@@ -66,7 +66,7 @@ function refreshTracks() ...@@ -66,7 +66,7 @@ function refreshTracks()
function refreshAlbums() function refreshAlbums()
{ {
albumsView.list.refresh() albumsView.list.refresh()
albumsView.list.fetchInformation(); // albumsView.list.fetchInformation();
} }
function refreshArtists() function refreshArtists()
......
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import org.kde.kirigami 2.2 as Kirigami import org.kde.kirigami 2.6 as Kirigami
import org.kde.mauikit 1.0 as Maui import org.kde.mauikit 1.0 as Maui
import BaseModel 1.0 import BaseModel 1.0
...@@ -56,30 +56,33 @@ BabeList ...@@ -56,30 +56,33 @@ BabeList
focus: true focus: true
headBar.plegable: false //headBar.middleStrech: false
headBar.leftContent: [ headBar.leftSretch: false
Maui.ToolButton
{
id : playAllBtn
visible : headBar.visible && count > 0
anim : true
iconName : "media-playlist-play"
onClicked : playAll()
},
Maui.ToolButton
{
id: sortBtn
anim: true
iconName: "view-sort"
onClicked: sortMenu.popup() headBar.rightContent: Kirigami.ActionToolBar
{
Maui.Menu Layout.fillWidth: true
actions: [
Kirigami.Action
{ {
id: sortMenu id : playAllBtn
text: qsTr("Play all")
Maui.MenuItem icon.name : "media-playlist-play"
onTriggered: playAll()
},
Kirigami.Action
{
id: appendBtn
text: qsTr("Append")
icon.name : "media-playlist-append"//"media-repeat-track-amarok"
onTriggered: appendAll()
},
Kirigami.Action
{
id: sortBtn
text: qsTr("Sort")
icon.name: "view-sort"
Kirigami.Action
{ {
text: qsTr("Title") text: qsTr("Title")
checkable: true checkable: true
...@@ -87,7 +90,7 @@ BabeList ...@@ -87,7 +90,7 @@ BabeList
onTriggered: list.sortBy = Tracks.TITLE onTriggered: list.sortBy = Tracks.TITLE
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Track") text: qsTr("Track")
checkable: true checkable: true
...@@ -95,7 +98,7 @@ BabeList ...@@ -95,7 +98,7 @@ BabeList
onTriggered: list.sortBy = Tracks.TRACK onTriggered: list.sortBy = Tracks.TRACK
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Artist") text: qsTr("Artist")
checkable: true checkable: true
...@@ -103,7 +106,7 @@ BabeList ...@@ -103,7 +106,7 @@ BabeList
onTriggered: list.sortBy = Tracks.ARTIST onTriggered: list.sortBy = Tracks.ARTIST
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Album") text: qsTr("Album")
checkable: true checkable: true
...@@ -111,7 +114,7 @@ BabeList ...@@ -111,7 +114,7 @@ BabeList
onTriggered: list.sortBy = Tracks.ALBUM onTriggered: list.sortBy = Tracks.ALBUM
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Most played") text: qsTr("Most played")
checkable: true checkable: true
...@@ -119,7 +122,7 @@ BabeList ...@@ -119,7 +122,7 @@ BabeList
onTriggered: list.sortBy = Tracks.COUNT onTriggered: list.sortBy = Tracks.COUNT
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Rate") text: qsTr("Rate")
checkable: true checkable: true
...@@ -127,7 +130,7 @@ BabeList ...@@ -127,7 +130,7 @@ BabeList
onTriggered: list.sortBy = Tracks.RATE onTriggered: list.sortBy = Tracks.RATE
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Fav") text: qsTr("Fav")
checkable: true checkable: true
...@@ -135,7 +138,7 @@ BabeList ...@@ -135,7 +138,7 @@ BabeList
onTriggered: list.sortBy = Tracks.FAV onTriggered: list.sortBy = Tracks.FAV
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Release date") text: qsTr("Release date")
checkable: true checkable: true
...@@ -143,7 +146,7 @@ BabeList ...@@ -143,7 +146,7 @@ BabeList
onTriggered: list.sortBy = Tracks.RELEASEDATE onTriggered: list.sortBy = Tracks.RELEASEDATE
} }
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Add date") text: qsTr("Add date")
checkable: true checkable: true
...@@ -151,38 +154,28 @@ BabeList ...@@ -151,38 +154,28 @@ BabeList
onTriggered: list.sortBy = Tracks.ADDDATE onTriggered: list.sortBy = Tracks.ADDDATE
} }
MenuSeparator{}
Maui.MenuItem Kirigami.Action
{ {
text: qsTr("Group") text: qsTr("Group")
checkable: true checkable: true
checked: group checked: group
onTriggered: group = !group onTriggered: group = !group
} }
},
Kirigami.Action
{
text: qsTr("Select")
icon.name: "item-select"
onTriggered: selectionMode = !selectionMode
checkable: false
checked: selectionMode
} }
} ]
] }
headBar.rightContent: [
Maui.ToolButton
{
id: appendBtn
visible: headBar.visible && count > 0
anim : true
iconName : "media-playlist-append"//"media-repeat-track-amarok"
onClicked: appendAll()
},
Maui.ToolButton
{
iconName: "item-select"
onClicked: selectionMode = !selectionMode
checkable: true
checked: selectionMode
}
]
Maui.Dialog Maui.Dialog
{ {
......
...@@ -7,7 +7,7 @@ import "../view_models/BabeTable" ...@@ -7,7 +7,7 @@ import "../view_models/BabeTable"
import "../db/Queries.js" as Q import "../db/Queries.js" as Q
import "../utils/Help.js" as H import "../utils/Help.js" as H
import org.kde.kirigami 2.2 as Kirigami import org.kde.kirigami 2.6 as Kirigami
import org.kde.mauikit 1.0 as Maui import org.kde.mauikit 1.0 as Maui
import TracksList 1.0 import TracksList 1.0
import AlbumsList 1.0 import AlbumsList 1.0
...@@ -36,64 +36,53 @@ BabeGrid ...@@ -36,64 +36,53 @@ BabeGrid
visible: true visible: true
// topPadding: space.large // topPadding: space.large
onAlbumCoverPressed: albumCoverPressedAndHold(album, artist) onAlbumCoverPressed: albumCoverPressedAndHold(album, artist)
headBar.visible: count headBar.visible: false
headBarExit: false headBarExit: false
headBar.leftContent: [ // headBar.rightContent: Kirigami.ActionToolBar
// Maui.ToolButton // {
// Layout.fillWidth: true
// actions: [
// Kirigami.Action
// { // {
// id : playAllBtn // id: sortBtn
// visible : headBar.visible && albumsViewGrid.count > 0 // icon.name: "view-sort"
// anim : true // text: qsTr("Sort")
// iconName : "media-playlist-play"
// onClicked : playAll()
// }, // Kirigami.Action
// {