~ubuntu-branches/ubuntu/wily/kid3/wily

« back to all changes in this revision

Viewing changes to src/qml/app/BatchImportPage.qml

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-05-12 18:56:41 UTC
  • mfrom: (1.1.19) (2.3.3 sid)
  • Revision ID: package-import@ubuntu.com-20150512185641-hgeys2pingwq9mwn
Tags: 3.2.1-1
* New upstream release.
  - Add new build dependency qt4-dev-tools.
* Uploading to unstable.
* Switch to DEP5 debian/copyright format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file BatchImportPage.qml
 
3
 * Batch import page.
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 16 Feb 2015
 
8
 *
 
9
 * Copyright (C) 2015  Urs Fleisch
 
10
 *
 
11
 * This program is free software; you can redistribute it and/or modify
 
12
 * it under the terms of the GNU Lesser General Public License as published by
 
13
 * the Free Software Foundation; version 3.
 
14
 *
 
15
 * This program is distributed in the hope that it will be useful,
 
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 * GNU Lesser General Public License for more details.
 
19
 *
 
20
 * You should have received a copy of the GNU Lesser General Public License
 
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
22
 */
 
23
 
 
24
import QtQuick 2.2
 
25
import "../componentsqtquick" //@!Ubuntu
 
26
//import Ubuntu.Components 1.1 //@Ubuntu
 
27
//import Ubuntu.Components.Popups 1.0 //@Ubuntu
 
28
import Kid3 1.0
 
29
 
 
30
Page {
 
31
  id: page
 
32
 
 
33
  title: qsTr("Automatic Import")
 
34
 
 
35
  Connections {
 
36
    target: app.batchImporter
 
37
    onReportImportEvent: {
 
38
      var str
 
39
      switch (type) {
 
40
      case BatchImporter.ReadingDirectory:
 
41
        str = qsTr("Reading Directory")
 
42
        break
 
43
      case BatchImporter.Started:
 
44
        str = qsTr("Started")
 
45
        break
 
46
      case BatchImporter.SourceSelected:
 
47
        str = qsTr("Source")
 
48
        break
 
49
      case BatchImporter.QueryingAlbumList:
 
50
        str = qsTr("Querying")
 
51
        break
 
52
      case BatchImporter.FetchingTrackList:
 
53
      case BatchImporter.FetchingCoverArt:
 
54
        str = qsTr("Fetching")
 
55
        break
 
56
      case BatchImporter.TrackListReceived:
 
57
        str = qsTr("Data received")
 
58
        break
 
59
      case BatchImporter.CoverArtReceived:
 
60
        str = qsTr("Cover")
 
61
        break
 
62
      case BatchImporter.Finished:
 
63
        str = qsTr("Finished")
 
64
        break
 
65
      case BatchImporter.Aborted:
 
66
        str = qsTr("Aborted")
 
67
        break
 
68
      case BatchImporter.Error:
 
69
        str = qsTr("Error")
 
70
        break
 
71
      }
 
72
      if (text) {
 
73
        str += ": "
 
74
        str += text
 
75
      }
 
76
      str += "\n"
 
77
      textArea.text += str
 
78
    }
 
79
  }
 
80
 
 
81
  Grid {
 
82
    id: profileRow
 
83
    property int labelWidth: constants.gu(10)
 
84
    property int valueWidth: width - labelWidth -spacing
 
85
    anchors {
 
86
      left: parent.left
 
87
      right: parent.right
 
88
      top: parent.top
 
89
      margins: constants.margins
 
90
    }
 
91
    columns: 2
 
92
    spacing: constants.spacing
 
93
    Label {
 
94
      text: qsTr("Destination:")
 
95
      width: parent.labelWidth
 
96
    }
 
97
    ComboBox {
 
98
      id: destinationComboBox
 
99
      dropDownParent: page
 
100
      width: parent.valueWidth
 
101
      model: [ qsTr("Tag 1"),
 
102
               qsTr("Tag 2"),
 
103
               qsTr("Tag 1 and Tag 2") ]
 
104
      function getTagVersion() {
 
105
        return [ Frame.TagV1, Frame.TagV2, Frame.TagV2V1 ][currentIndex]
 
106
      }
 
107
    }
 
108
 
 
109
    Label {
 
110
      width: parent.labelWidth
 
111
      height: profileComboBox.height
 
112
      verticalAlignment: Text.AlignVCenter
 
113
      text: qsTr("Profile:")
 
114
    }
 
115
    ComboBox {
 
116
      id: profileComboBox
 
117
      width: parent.valueWidth
 
118
      dropDownParent: page
 
119
      model: configs.batchImportConfig().profileNames
 
120
      currentIndex: configs.batchImportConfig().profileIndex
 
121
    }
 
122
  }
 
123
 
 
124
  TextArea {
 
125
    id: textArea
 
126
    anchors {
 
127
      left: parent.left
 
128
      right: parent.right
 
129
      top: profileRow.bottom
 
130
      bottom: buttonRow.top
 
131
      margins: constants.margins
 
132
    }
 
133
    readOnly: true
 
134
    selectByMouse: false
 
135
  }
 
136
  Row {
 
137
    id: buttonRow
 
138
    anchors {
 
139
      left: parent.left
 
140
      right: parent.right
 
141
      bottom: parent.bottom
 
142
      margins: constants.margins
 
143
    }
 
144
    spacing: constants.spacing
 
145
    Button {
 
146
      width: (parent.width - parent.spacing) / 2
 
147
      text: qsTr("Close")
 
148
      onClicked: {
 
149
        pageStack.pop()
 
150
      }
 
151
    }
 
152
    Button {
 
153
      width: (parent.width - parent.spacing) / 2
 
154
      text: qsTr("Start")
 
155
      onClicked: {
 
156
        textArea.text = ""
 
157
        app.batchImport(profileComboBox.currentText,
 
158
                        script.toTagVersion(destinationComboBox.getTagVersion()))
 
159
      }
 
160
    }
 
161
  }
 
162
 
 
163
  onActiveChanged: {
 
164
    if (active) {
 
165
      textArea.text = ""
 
166
    } else {
 
167
      app.batchImporter.abort()
 
168
    }
 
169
  }
 
170
}