~danielholm/musicapp/trunk

« back to all changes in this revision

Viewing changes to MusicSettings.qml

  • Committer: Daniel Holm
  • Date: 2013-05-17 11:49:30 UTC
  • Revision ID: admin@danielholm.se-20130517114930-noc4gn344hj6qx1u
Added setting and database to save users music dir. Now uses that setting, too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import Ubuntu.Components 0.1
22
22
import Ubuntu.Components.ListItems 0.1 as ListItem
23
23
import Ubuntu.Components.Popups 0.1
 
24
import QtQuick.LocalStorage 2.0
 
25
import "storage.js" as Storage
24
26
 
25
27
Dialog {
26
28
    id: root
27
29
 
 
30
    Row {
 
31
        spacing: units.gu(2)
 
32
        TextField {
 
33
            id: musicDirField
 
34
            placeholderText: "/home/username/Music"
 
35
            hasClearButton: false
 
36
            text: ""
 
37
        }
 
38
    }
 
39
 
28
40
    // Shuffle or not
29
41
    Row {
30
42
        spacing: units.gu(2)
122
134
    }
123
135
    Button {
124
136
        text: i18n.tr("Close")
125
 
        onClicked: PopupUtils.close(root)
 
137
        onClicked: {
 
138
            PopupUtils.close(root)
 
139
            // set new music dir
 
140
            Storage.initialize()
 
141
            Storage.setSetting("currentfolder", musicDirField.text)
 
142
            console.debug("Debug: Set new music dir to: "+musicDirField.text)
 
143
        }
126
144
    }
127
145
 
128
146
}