Commit e00b4f7b authored by camilo higuita's avatar camilo higuita

mor wrok towards plasmo integration

parent 52bdc6d3
......@@ -155,61 +155,92 @@ Maui.ApplicationWindow
/* UI */
altToolBars: false
accentColor: babeColor
headBarFGColor: altColorText
headBarBGColor: "#212121"
altColorText: darkTextColor
// headBarFGColor: altColorText
// headBarBGColor: "#212121"
// altColorText: darkTextColor
floatingBar: false
headBar.spacing: space.big
headBar.middleContent : [
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
headBar.middleContent : Kirigami.ActionToolBar
{
},
hiddenActions: [
Maui.ToolButton
{
text: qsTr("Albums")
active: currentView === viewsIndex.albums
iconName: /*"album"*/ "view-media-album-cover"
iconColor: currentView === viewsIndex.albums ? babeColor : altColorText
onClicked: currentView = viewsIndex.albums
colorScheme.highlightColor: babeColor
showIndicator: true
},
Kirigami.Action
{
text: qsTr("Folders")
icon.name: "folder"
checked: currentView === viewsIndex.folders
checkable: false
onTriggered: currentView = viewsIndex.folders
},
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
{
text: qsTr("Playlists")
active: currentView === viewsIndex.playlists
iconName: "view-media-playlist"
iconColor: currentView === viewsIndex.playlists ? babeColor : altColorText
onClicked: currentView = viewsIndex.playlists
colorScheme.highlightColor: babeColor
showIndicator: true
]
actions: [
Kirigami.Action
{
icon.name: "view-media-track"
checked: currentView === viewsIndex.tracks
// showIndicator: true
// icon.color: active ? babeColor : altColorText
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.implicitHeight: footBar.visible ? toolBarHeight * 1.2 : 0
......@@ -343,7 +374,7 @@ Maui.ApplicationWindow
}
leftIcon.iconColor: currentView === viewsIndex.search ? babeColor : altColorText
// leftIcon.iconColor: currentView === viewsIndex.search ? babeColor : altColorText
onSearchButtonClicked:
{
currentView = viewsIndex.search
......@@ -385,12 +416,6 @@ Maui.ApplicationWindow
// }
// },
MenuItem
{
text: qsTr("Folders")
icon.name: "folder"
onTriggered: currentView = viewsIndex.folders
},
// Maui.MenuItem
// {
......@@ -404,13 +429,7 @@ Maui.ApplicationWindow
// }
// },
MenuItem
{
text: qsTr("YouTube")
icon.name: "internet-services"
onTriggered: currentView = viewsIndex.youtube
},
// Maui.MenuItem
// {
......@@ -880,7 +899,7 @@ Maui.ApplicationWindow
onPlayAll:
{
mainPlaylist.list.clear()
// mainPlaylist.list.sortBy = Tracks.NONE
// mainPlaylist.list.sortBy = Tracks.NONE
mainPlaylist.list.query = foldersView.list.list.query
Player.playAll()
}
......@@ -1010,26 +1029,26 @@ Maui.ApplicationWindow
onRefreshAlbums: H.refreshAlbums()
onRefreshArtists: H.refreshArtists()
// onCoverReady:
// {
// root.currentArtwork = path
// currentTrack.artwork = currentArtwork
// mainPlaylist.list.update(currentTrack, currentTrackIndex);
// }
// onTrackLyricsReady:
// {
// console.log(lyrics)
// if (url === currentTrack.url)
// Player.setLyrics(lyrics)
// }
// onSkipTrack: Player.nextTrack()
// onBabeIt: if (!mainlistEmpty)
// {
// mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.list.get(currentTrackIndex).fav == "1"))
// currentBabe = mainPlaylist.list.get(currentTrackIndex).fav == "1"
// }
// onCoverReady:
// {
// root.currentArtwork = path
// currentTrack.artwork = currentArtwork
// mainPlaylist.list.update(currentTrack, currentTrackIndex);
// }
// onTrackLyricsReady:
// {
// console.log(lyrics)
// if (url === currentTrack.url)
// Player.setLyrics(lyrics)
// }
// onSkipTrack: Player.nextTrack()
// onBabeIt: if (!mainlistEmpty)
// {
// mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.list.get(currentTrackIndex).fav == "1"))
// currentBabe = mainPlaylist.list.get(currentTrackIndex).fav == "1"
// }
onOpenFiles:
{
......
......@@ -107,14 +107,14 @@ void AlbumsModel::setList()
//get albums data with modifier for missing images for artworks
this->list = this->db->getDBData(m_Query, [&](FMH::MODEL &item)
{
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));
item[FMH::MODEL_KEY::ARTWORK] = "";
}
});
this->sortList();
emit this->postListChanged();
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));
item[FMH::MODEL_KEY::ARTWORK] = "";
}
});
this->sortList();
emit this->postListChanged();
}
void AlbumsModel::fetchInformation()
......@@ -124,8 +124,11 @@ void AlbumsModel::fetchInformation()
QObject::connect(watcher, &QFutureWatcher<void>::finished,
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;
int index = -1;
for(auto album : this->list)
......@@ -182,7 +185,6 @@ void AlbumsModel::fetchInformation()
Pulpo pulpo;
QEventLoop loop;
QObject::connect(&pulpo, &Pulpo::finished, &loop, &QEventLoop::quit);
bool stop = false;
QObject::connect(this, &AlbumsModel::destroyed, [&stop]()
{
......@@ -195,11 +197,18 @@ void AlbumsModel::fetchInformation()
for(const auto &req : requests)
{
pulpo.request(req);
loop.exec();
if(stop)
{
loop.quit();
return;
qDebug()<< "TRYING EXITING THREAD LOADINFO" << loop.isRunning();
if(loop.isRunning())
loop.quit();
qDebug()<< "EXITING THREAD LOADINFO" << loop.isRunning();
break;
}else {
loop.exec();
}
}
};
......
......@@ -41,6 +41,7 @@ public:
AlbumsModel::SORTBY getSortBy() const;
private:
bool stopThreads = false;
CollectionDB *db;
FMH::MODEL_LIST list;
void sortList();
......
......@@ -66,7 +66,7 @@ function refreshTracks()
function refreshAlbums()
{
albumsView.list.refresh()
albumsView.list.fetchInformation();
// albumsView.list.fetchInformation();
}
function refreshArtists()
......
import QtQuick 2.9
import QtQuick.Controls 2.2
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 BaseModel 1.0
......@@ -56,30 +56,33 @@ BabeList
focus: true
headBar.plegable: false
headBar.leftContent: [
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"
//headBar.middleStrech: false
headBar.leftSretch: false
onClicked: sortMenu.popup()
Maui.Menu
headBar.rightContent: Kirigami.ActionToolBar
{
Layout.fillWidth: true
actions: [
Kirigami.Action
{
id: sortMenu
Maui.MenuItem
id : playAllBtn
text: qsTr("Play all")
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")
checkable: true
......@@ -87,7 +90,7 @@ BabeList
onTriggered: list.sortBy = Tracks.TITLE
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Track")
checkable: true
......@@ -95,7 +98,7 @@ BabeList
onTriggered: list.sortBy = Tracks.TRACK
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Artist")
checkable: true
......@@ -103,7 +106,7 @@ BabeList
onTriggered: list.sortBy = Tracks.ARTIST
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Album")
checkable: true
......@@ -111,7 +114,7 @@ BabeList
onTriggered: list.sortBy = Tracks.ALBUM
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Most played")
checkable: true
......@@ -119,7 +122,7 @@ BabeList
onTriggered: list.sortBy = Tracks.COUNT
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Rate")
checkable: true
......@@ -127,7 +130,7 @@ BabeList
onTriggered: list.sortBy = Tracks.RATE
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Fav")
checkable: true
......@@ -135,7 +138,7 @@ BabeList
onTriggered: list.sortBy = Tracks.FAV
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Release date")
checkable: true
......@@ -143,7 +146,7 @@ BabeList
onTriggered: list.sortBy = Tracks.RELEASEDATE
}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Add date")
checkable: true
......@@ -151,38 +154,28 @@ BabeList
onTriggered: list.sortBy = Tracks.ADDDATE
}
MenuSeparator{}
Maui.MenuItem
Kirigami.Action
{
text: qsTr("Group")
checkable: true
checked: 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
{
......
......@@ -7,7 +7,7 @@ import "../view_models/BabeTable"
import "../db/Queries.js" as Q
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 TracksList 1.0
import AlbumsList 1.0
......@@ -36,64 +36,53 @@ BabeGrid
visible: true
// topPadding: space.large
onAlbumCoverPressed: albumCoverPressedAndHold(album, artist)
headBar.visible: count
headBar.visible: false
headBarExit: false
headBar.leftContent: [
// Maui.ToolButton
// headBar.rightContent: Kirigami.ActionToolBar
// {
// Layout.fillWidth: true
// actions: [
// Kirigami.Action
// {
// id : playAllBtn
// visible : headBar.visible && albumsViewGrid.count > 0
// anim : true
// iconName : "media-playlist-play"
// onClicked : playAll()
// },
Maui.ToolButton
{
id: sortBtn
anim: true
iconName: "view-sort"
onClicked: sortMenu.popup()
Maui.Menu
{
id: sortMenu
Maui.MenuItem
{
text: qsTr("Artist")
checkable: true
checked: list.sortBy === Albums.ARTIST
onTriggered: list.sortBy = Albums.ARTIST
}
Maui.MenuItem
{
text: qsTr("Album")
checkable: true
checked: list.sortBy === Albums.ALBUM
onTriggered: list.sortBy = Albums.ALBUM
}
Maui.MenuItem
{
text: qsTr("Release date")
checkable: true
checked: list.sortBy === Albums.RELEASEDATE
onTriggered: list.sortBy = Albums.RELEASEDATE
}
Maui.MenuItem
{
text: qsTr("Add date")
checkable: true
checked: list.sortBy === Albums.ADDDATE
onTriggered: list.sortBy = Albums.ADDDATE
}
}
}
]
// id: sortBtn
// icon.name: "view-sort"
// text: qsTr("Sort")
// Kirigami.Action
// {
// text: qsTr("Artist")
// checkable: true
// checked: list.sortBy === Albums.ARTIST
// onTriggered: list.sortBy = Albums.ARTIST
// }
// Kirigami.Action
// {
// text: qsTr("Album")
// checkable: true
// checked: list.sortBy === Albums.ALBUM
// onTriggered: list.sortBy = Albums.ALBUM
// }
// Kirigami.Action
// {
// text: qsTr("Release date")
// checkable: true
// checked: list.sortBy === Albums.RELEASEDATE
// onTriggered: list.sortBy = Albums.RELEASEDATE
// }
// Kirigami.Action
// {
// text: qsTr("Add date")
// checkable: true
// checked: list.sortBy === Albums.ADDDATE
// onTriggered: list.sortBy = Albums.ADDDATE
// }
// }
// ]
// }
// headBar.rightContent: [
......@@ -110,7 +99,7 @@ BabeGrid
Maui.Dialog
{
id: albumDialog
// parent: parent
parent: parent
maxHeight: maxWidth
maxWidth: unit * 600
defaultButtons: false
......@@ -179,6 +168,7 @@ BabeGrid
Maui.TagsBar
{
id: tagBar
visible:false
Layout.fillWidth: true
allowEditMode: false
onTagClicked: H.searchFor("tag:"+tag)
......
......@@ -116,6 +116,7 @@ Maui.Page
Layout.alignment: Qt.AlignBottom | Qt.AlignTop
focus: true
headBar.visible: false
footBar.visible: false
quickPlayVisible: false
coverArtVisible: true
trackRating: true
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
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 PlaylistsList 1.0
import BaseModel 1.0
......@@ -36,20 +36,28 @@ BabeList
headBar.plegable: false
headBar.rightContent: [
Maui.ToolButton
{
iconName: "list-remove"
onClicked: removePlaylist()
},
Maui.ToolButton
{
id : createPlaylistBtn
anim : true
iconName : "list-add"
onClicked : newPlaylistDialog.open()
}
]
headBar.rightContent: Kirigami.ActionToolBar
{
Layout.fillWidth: true
actions:
[
Kirigami.Action
{
text: qsTr("Remove")
icon.name: "list-remove"
onTriggered: removePlaylist()
},
Kirigami.Action
{
id : createPlaylistBtn
text: qsTr("Add")
icon.name : "list-add"
onTriggered : newPlaylistDialog.open()
}
]
}
BaseModel
{
id: _playlistsModel
......
......@@ -12,7 +12,7 @@ BabeTable
trackDuration: true
trackRating: true
headBar.visible: !holder.visible
headBarTitle: count + " tracks"
// headBarTitle: count + " tracks"
headBarExit: false
coverArtVisible: false
holder.emoji: "qrc:/assets/MusicCloud.png"
......
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