~mterry/podbird/ok

« back to all changes in this revision

Viewing changes to app/ui/EpisodesPage.qml

  • Committer: Nekhelesh Ramananthan
  • Date: 2016-03-14 00:34:03 UTC
  • mfrom: (125.1.19 add-playlist-support)
  • Revision ID: krnekhelesh@gmail.com-20160314003403-lgvcejsz09wvs9ws
Added Queue Support

This however removes,
 - usermetrics since it won't be updated due to the app being in the background
 - playing from the previously saved position...again this won't work when the app is in the background.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
import QtQuick 2.4
20
 
import QtMultimedia 5.4
 
20
import QtMultimedia 5.6
21
21
import Ubuntu.Components 1.3
22
22
import QtQuick.LocalStorage 2.0
23
23
import Ubuntu.DownloadManager 0.1
443
443
                id: listItemLayout
444
444
 
445
445
                title.text: model.name !== undefined ? model.name.trim() : "Undefined"
446
 
                title.color: currentGuid === model.guid || downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText
447
 
                                                                                                     : podbird.appTheme.baseText
 
446
                title.color: downloader.downloadingGuid === model.guid ? podbird.appTheme.focusText
 
447
                                                                       : podbird.appTheme.baseText
448
448
                // #FIXME: Change this 2 to prevent title eliding when UITK is updated to rev > 1800
449
449
                title.maximumLineCount: 1
450
450
 
512
512
                    },
513
513
 
514
514
                    Action {
 
515
                        iconName: "add-to-playlist"
 
516
                        onTriggered: {
 
517
                            var url = model.downloadedfile ? model.downloadedfile : model.audiourl
 
518
                            player.addEpisodeToQueue(model.guid, model.image, model.name, model.artist, url)
 
519
                        }
 
520
                    },
 
521
 
 
522
                    Action {
515
523
                        iconName: model.favourited ? "unlike" : "like"
516
524
                        onTriggered: {
517
525
                            var db = Podcasts.init();
537
545
 
538
546
            onClicked: {
539
547
                Haptics.play()
540
 
                var db = Podcasts.init();
541
 
                db.transaction(function (tx) {
542
 
                    if (currentGuid !== model.guid) {
543
 
                        currentGuid = "";
544
 
                        currentUrl = model.downloadedfile ? model.downloadedfile : model.audiourl;
545
 
                        var rs = tx.executeSql("SELECT position FROM Episode WHERE guid=?", [model.guid]);
546
 
                        playerLoader.item.play();
547
 
                        playerLoader.item.seek(rs.rows.item(0).position);
548
 
                        currentName = model.name;
549
 
                        currentArtist = model.artist;
550
 
                        currentImage = model.image;
551
 
                        currentGuid = model.guid;
552
 
                    }
553
 
                });
 
548
                if (currentGuid !== model.guid) {
 
549
                    currentUrl = model.downloadedfile ? model.downloadedfile : model.audiourl;
 
550
                    player.playEpisode(model.guid, model.image, model.name, model.artist, currentUrl)
 
551
                }
554
552
            }
555
553
        }
556
554