~vthompson/music-app/fix-1291398

« back to all changes in this revision

Viewing changes to music-app.qml

* Merge of trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
        onTriggered: player.toggle()
95
95
    }
96
96
    Action {
 
97
        id: backAction
 
98
        text: i18n.tr("Back")
 
99
        keywords: i18n.tr("Go back to last page")
 
100
        onTriggered: musicToolbar.goBack();
 
101
    }
 
102
 
 
103
    // With a default Quit action only the first 4 actions are displayed
 
104
    // until the user searches for them within the HUD
 
105
    Action {
97
106
        id: prevAction
98
107
        text: i18n.tr("Previous")
99
108
        keywords: i18n.tr("Previous Track")
105
114
        keywords: i18n.tr("Stop Playback")
106
115
        onTriggered: player.stop()
107
116
    }
108
 
    Action {
109
 
        id: backAction
110
 
        text: i18n.tr("Back")
111
 
        keywords: i18n.tr("Go back to last page")
112
 
        onTriggered: musicToolbar.goBack();
113
 
    }
 
117
 
 
118
    // TODO: Currently there are no settings, so do not display the Action
114
119
    Action {
115
120
        id: settingsAction
116
121
        text: i18n.tr("Settings")
120
125
            musicSettings.visible = true
121
126
        }
122
127
    }
123
 
    Action {
124
 
        id: quitAction
125
 
        text: i18n.tr("Quit")
126
 
        keywords: i18n.tr("Close application")
127
 
        onTriggered: Qt.quit()
128
 
    }
129
128
 
130
 
    actions: [searchAction, nextAction, playsAction, prevAction, stopAction, backAction, settingsAction, quitAction]
 
129
    actions: [searchAction, nextAction, playsAction, prevAction, stopAction, backAction]
131
130
 
132
131
    // signal to open new URIs
133
132
    // TODO currently this only allows playing file:// URIs of known files
251
250
            Settings.setSetting("repeat", "0") // default state of repeat
252
251
            //Settings.setSetting("scrobble", "0") // default state of scrobble
253
252
        }
254
 
        //Library.reset()
255
 
        Library.initialize();
 
253
        Library.reset()
 
254
        //Library.initialize();
256
255
 
257
256
        // initialize playlists
258
257
        Playlists.initializePlaylists()
564
563
            }
565
564
 
566
565
            onFinished: {
567
 
                var currentLibrary = Library.getAllFileOrder();
568
566
                var read_arg = false;
569
567
 
570
568
                // FIXME: remove when grilo is fixed
612
610
                        read_arg = true;
613
611
                    }
614
612
 
615
 
                    // Only write to database if the record has actually changed
616
 
                    var index = exists(currentLibrary, record);
617
 
 
618
 
                    if (index === false || index < 0)  // in grilo !in lib or lib out of date
619
 
                    {
620
 
                        //console.log("Artist:"+ media.artist + ", Album:"+media.album + ", Title:"+media.title + ", File:"+file + ", Cover:"+media.thumbnail + ", Number:"+media.trackNumber + ", Genre:"+media.genre);
621
 
                        Library.setMetadata(record)
622
 
 
623
 
                        if (index < 0)
624
 
                        {
625
 
                            index = -(index + 1);
626
 
                        }
627
 
                    }
628
 
 
629
 
                    if (index !== false)
630
 
                    {
631
 
                        currentLibrary.splice(index, 1);
632
 
                    }
 
613
                    //console.log("Artist:"+ media.artist + ", Album:"+media.album + ", Title:"+media.title + ", File:"+file + ", Cover:"+media.thumbnail + ", Number:"+media.trackNumber + ", Genre:"+media.genre);
 
614
                    Library.setMetadata(record)
633
615
                }
634
616
 
635
617
                Library.writeDb()
636
618
 
637
 
                // Any items left in currentLibrary aren't in the grilo model so have been deleted
638
 
                if (currentLibrary.length > 0)
639
 
                {
640
 
                    console.debug("Removing deleted songs:", currentLibrary.length);
641
 
                    Library.removeFiles(currentLibrary);
642
 
                }
643
 
 
644
619
                console.debug("Grilo duplicates:", duplicates);  // FIXME: remove when grilo is fixed
645
620
                griloModel.loaded = true
646
621
                tabs.ensurePopulated(tabs.selectedTab);