~gg-lp/music-app/music-app

49.2.1 by Andrew Hayzen
- Added worker for adding rows to Library model (allows gui respond
1
/*
409.3.70 by Victor Thompson
Update copyright
2
 * Copyright (C) 2013, 2014
3
 *      Andrew Hayzen <ahayzen@gmail.com>
4
 *      Daniel Holm <d.holmen@gmail.com>
5
 *      Victor Thompson <victor.thompson@gmail.com>
49.2.1 by Andrew Hayzen
- Added worker for adding rows to Library model (allows gui respond
6
 *
7
 * This program is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; version 3.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
21
WorkerScript.onMessage = function(msg) {
675.3.1 by Andrew Hayzen
* Create generic WorkerModelLoader.qml
22
    if (msg.clear === true) {
77.2.1 by Andrew Hayzen
- Subsections of Artist, Album and Playlist page are now correctly
23
        msg.model.clear();
710.1.2 by Andrew Hayzen
* Enforce a sync after a clear
24
        msg.model.sync();
675.3.1 by Andrew Hayzen
* Create generic WorkerModelLoader.qml
25
        WorkerScript.sendMessage({});
26
    } else if (msg.sync === true) {
27
        msg.model.sync();   // updates the changes to the list
675.3.5 by Andrew Hayzen
* Only set to complete once sync is complete
28
        WorkerScript.sendMessage({"sync": true});
675.3.1 by Andrew Hayzen
* Create generic WorkerModelLoader.qml
29
    } else {
77.2.1 by Andrew Hayzen
- Subsections of Artist, Album and Playlist page are now correctly
30
        msg.model.append(msg.add);
675.3.1 by Andrew Hayzen
* Create generic WorkerModelLoader.qml
31
        WorkerScript.sendMessage({});
77.2.1 by Andrew Hayzen
- Subsections of Artist, Album and Playlist page are now correctly
32
    }
49.2.1 by Andrew Hayzen
- Added worker for adding rows to Library model (allows gui respond
33
}