Merge lp:~mixxxcontributors/mixxx/features_autodj into lp:~mixxxdevelopers/mixxx/trunk
- features_autodj
- Merge into trunk
Proposed by
RJ Skerry-Ryan
Status: | Merged |
---|---|
Merged at revision: | 2989 |
Proposed branch: | lp:~mixxxcontributors/mixxx/features_autodj |
Merge into: | lp:~mixxxdevelopers/mixxx/trunk |
Diff against target: |
2584 lines (+1353/-475) 16 files modified
mixxx/res/images/autodj/bottom.svg (+137/-0) mixxx/res/images/autodj/media-playlist-shuffle.svg (+214/-0) mixxx/res/images/autodj/stock_mail-send-receive.svg (+87/-0) mixxx/res/mixxx.qrc (+3/-0) mixxx/src/dlgautodj.cpp (+487/-225) mixxx/src/dlgautodj.h (+32/-9) mixxx/src/dlgautodj.ui (+110/-18) mixxx/src/library/autodjfeature.cpp (+33/-31) mixxx/src/library/autodjfeature.h (+5/-3) mixxx/src/library/browse/browsefeature.cpp (+94/-68) mixxx/src/library/browse/browsefeature.h (+2/-2) mixxx/src/library/browse/browsetablemodel.cpp (+108/-107) mixxx/src/library/browse/browsetablemodel.h (+1/-1) mixxx/src/library/dao/cratedao.h (+2/-0) mixxx/src/widget/wtracktableview.cpp (+33/-8) mixxx/src/widget/wtracktableview.h (+5/-3) |
To merge this branch: | bzr merge lp:~mixxxcontributors/mixxx/features_autodj |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
RJ Skerry-Ryan | Approve | ||
Review via email: mp+96961@code.launchpad.net |
Commit message
Description of the change
This branch brings Daniel Schürmann improvements to AutoDJ into Mixxx. I have reviewed the branch and it looks good to me from a stability and product/feature point of view.
To post a comment you must log in.
Revision history for this message
RJ Skerry-Ryan (rryan) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'mixxx/res/images/autodj' | |||
2 | === added file 'mixxx/res/images/autodj/bottom.svg' | |||
3 | --- mixxx/res/images/autodj/bottom.svg 1970-01-01 00:00:00 +0000 | |||
4 | +++ mixxx/res/images/autodj/bottom.svg 2012-03-12 04:06:20 +0000 | |||
5 | @@ -0,0 +1,137 @@ | |||
6 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
7 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
8 | 3 | <svg | ||
9 | 4 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
10 | 5 | xmlns:cc="http://creativecommons.org/ns#" | ||
11 | 6 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
12 | 7 | xmlns:svg="http://www.w3.org/2000/svg" | ||
13 | 8 | xmlns="http://www.w3.org/2000/svg" | ||
14 | 9 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
15 | 10 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
16 | 11 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
17 | 12 | width="48px" | ||
18 | 13 | height="48px" | ||
19 | 14 | id="svg4289" | ||
20 | 15 | sodipodi:version="0.32" | ||
21 | 16 | inkscape:version="0.46" | ||
22 | 17 | sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/categories" | ||
23 | 18 | sodipodi:docname="bottom.svg" | ||
24 | 19 | inkscape:output_extension="org.inkscape.output.svg.inkscape"> | ||
25 | 20 | <defs | ||
26 | 21 | id="defs4291"> | ||
27 | 22 | <linearGradient | ||
28 | 23 | id="linearGradient3155" | ||
29 | 24 | inkscape:collect="always"> | ||
30 | 25 | <stop | ||
31 | 26 | id="stop3157" | ||
32 | 27 | offset="0" | ||
33 | 28 | style="stop-color:#ffb584;stop-opacity:1;" /> | ||
34 | 29 | <stop | ||
35 | 30 | id="stop3159" | ||
36 | 31 | offset="1" | ||
37 | 32 | style="stop-color:#ffb584;stop-opacity:0;" /> | ||
38 | 33 | </linearGradient> | ||
39 | 34 | <linearGradient | ||
40 | 35 | inkscape:collect="always" | ||
41 | 36 | xlink:href="#linearGradient3155" | ||
42 | 37 | id="linearGradient3273" | ||
43 | 38 | gradientUnits="userSpaceOnUse" | ||
44 | 39 | gradientTransform="matrix(0.1532521,0,0,0.1530054,-25.916429,-53.611392)" | ||
45 | 40 | x1="325.71429" | ||
46 | 41 | y1="369.50507" | ||
47 | 42 | x2="325.71429" | ||
48 | 43 | y2="546.64789" /> | ||
49 | 44 | </defs> | ||
50 | 45 | <sodipodi:namedview | ||
51 | 46 | id="base" | ||
52 | 47 | pagecolor="#ffffff" | ||
53 | 48 | bordercolor="#666" | ||
54 | 49 | borderopacity="0.31372549" | ||
55 | 50 | inkscape:pageopacity="0.0" | ||
56 | 51 | inkscape:pageshadow="2" | ||
57 | 52 | inkscape:zoom="5.656854" | ||
58 | 53 | inkscape:cx="25.963489" | ||
59 | 54 | inkscape:cy="20.551712" | ||
60 | 55 | inkscape:current-layer="layer1" | ||
61 | 56 | showgrid="true" | ||
62 | 57 | inkscape:grid-bbox="true" | ||
63 | 58 | inkscape:document-units="px" | ||
64 | 59 | inkscape:window-width="1019" | ||
65 | 60 | inkscape:window-height="732" | ||
66 | 61 | inkscape:window-x="259" | ||
67 | 62 | inkscape:window-y="19" | ||
68 | 63 | inkscape:showpageshadow="false" /> | ||
69 | 64 | <metadata | ||
70 | 65 | id="metadata4294"> | ||
71 | 66 | <rdf:RDF> | ||
72 | 67 | <cc:Work | ||
73 | 68 | rdf:about=""> | ||
74 | 69 | <dc:format>image/svg+xml</dc:format> | ||
75 | 70 | <dc:type | ||
76 | 71 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
77 | 72 | <dc:title>System Preferences</dc:title> | ||
78 | 73 | <dc:creator> | ||
79 | 74 | <cc:Agent> | ||
80 | 75 | <dc:title>Andreas Nilsson</dc:title> | ||
81 | 76 | </cc:Agent> | ||
82 | 77 | </dc:creator> | ||
83 | 78 | <dc:subject> | ||
84 | 79 | <rdf:Bag> | ||
85 | 80 | <rdf:li>category</rdf:li> | ||
86 | 81 | <rdf:li>system</rdf:li> | ||
87 | 82 | <rdf:li>preferences</rdf:li> | ||
88 | 83 | <rdf:li>settings</rdf:li> | ||
89 | 84 | <rdf:li>control center</rdf:li> | ||
90 | 85 | </rdf:Bag> | ||
91 | 86 | </dc:subject> | ||
92 | 87 | <dc:contributor> | ||
93 | 88 | <cc:Agent> | ||
94 | 89 | <dc:title>Jakub Steiner</dc:title> | ||
95 | 90 | </cc:Agent> | ||
96 | 91 | </dc:contributor> | ||
97 | 92 | <cc:license | ||
98 | 93 | rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" /> | ||
99 | 94 | </cc:Work> | ||
100 | 95 | <cc:License | ||
101 | 96 | rdf:about="http://creativecommons.org/licenses/GPL/2.0/"> | ||
102 | 97 | <cc:permits | ||
103 | 98 | rdf:resource="http://web.resource.org/cc/Reproduction" /> | ||
104 | 99 | <cc:permits | ||
105 | 100 | rdf:resource="http://web.resource.org/cc/Distribution" /> | ||
106 | 101 | <cc:requires | ||
107 | 102 | rdf:resource="http://web.resource.org/cc/Notice" /> | ||
108 | 103 | <cc:permits | ||
109 | 104 | rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> | ||
110 | 105 | <cc:requires | ||
111 | 106 | rdf:resource="http://web.resource.org/cc/ShareAlike" /> | ||
112 | 107 | <cc:requires | ||
113 | 108 | rdf:resource="http://web.resource.org/cc/SourceCode" /> | ||
114 | 109 | </cc:License> | ||
115 | 110 | </rdf:RDF> | ||
116 | 111 | </metadata> | ||
117 | 112 | <g | ||
118 | 113 | id="layer1" | ||
119 | 114 | inkscape:label="Layer 1" | ||
120 | 115 | inkscape:groupmode="layer"> | ||
121 | 116 | <g | ||
122 | 117 | id="g2453" | ||
123 | 118 | inkscape:label="Calque 1" | ||
124 | 119 | transform="matrix(0.1337942,0,0,0.1337942,-18.472238,-41.04701)" /> | ||
125 | 120 | <path | ||
126 | 121 | style="fill:#ea5d00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.9139747;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" | ||
127 | 122 | d="M 6.7500156,19.774362 L 24.043348,39.555555 L 41.25,19.774362 L 33.004787,19.774362 L 33.004787,4.0000015 L 15.136157,4.0000015 L 15.136157,19.774362 L 6.7500156,19.774362 z" | ||
128 | 123 | id="path4348" | ||
129 | 124 | sodipodi:nodetypes="cccccccc" /> | ||
130 | 125 | <rect | ||
131 | 126 | y="39.555557" | ||
132 | 127 | x="6.75" | ||
133 | 128 | height="4.4444442" | ||
134 | 129 | width="34.499985" | ||
135 | 130 | id="rect4242" | ||
136 | 131 | style="fill:#ea5d00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.84845495;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
137 | 132 | <path | ||
138 | 133 | style="fill:url(#linearGradient3273);fill-opacity:1" | ||
139 | 134 | d="M 15.131549,4.0000015 L 15.131549,19.76389 L 6.75,19.76389 L 15.027214,29.208333 C 17.837762,29.718667 20.845017,30.041667 23.999992,30.041667 C 27.180083,30.041667 30.212896,29.726456 33.042326,29.208333 L 41.249983,19.76389 L 33.007548,19.76389 L 33.007548,4.0000015 L 15.131549,4.0000015 z" | ||
140 | 135 | id="path3261" /> | ||
141 | 136 | </g> | ||
142 | 137 | </svg> | ||
143 | 0 | 138 | ||
144 | === added file 'mixxx/res/images/autodj/media-playlist-shuffle.svg' | |||
145 | --- mixxx/res/images/autodj/media-playlist-shuffle.svg 1970-01-01 00:00:00 +0000 | |||
146 | +++ mixxx/res/images/autodj/media-playlist-shuffle.svg 2012-03-12 04:06:20 +0000 | |||
147 | @@ -0,0 +1,214 @@ | |||
148 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
149 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
150 | 3 | |||
151 | 4 | <svg | ||
152 | 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
153 | 6 | xmlns:cc="http://creativecommons.org/ns#" | ||
154 | 7 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
155 | 8 | xmlns:svg="http://www.w3.org/2000/svg" | ||
156 | 9 | xmlns="http://www.w3.org/2000/svg" | ||
157 | 10 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
158 | 11 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
159 | 12 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
160 | 13 | width="48" | ||
161 | 14 | height="48" | ||
162 | 15 | id="svg7854" | ||
163 | 16 | sodipodi:version="0.32" | ||
164 | 17 | inkscape:version="0.47 r22583" | ||
165 | 18 | version="1.0" | ||
166 | 19 | sodipodi:docname="media-playlist-shuffle.svg" | ||
167 | 20 | inkscape:output_extension="org.inkscape.output.svg.inkscape" | ||
168 | 21 | inkscape:export-filename="/home/lapo/Icone/gnome-icon-theme/32x32/status/media-playlist-repeat.png" | ||
169 | 22 | inkscape:export-xdpi="90" | ||
170 | 23 | inkscape:export-ydpi="90"> | ||
171 | 24 | <defs | ||
172 | 25 | id="defs7856"> | ||
173 | 26 | <linearGradient | ||
174 | 27 | gradientUnits="userSpaceOnUse" | ||
175 | 28 | y2="21.132059" | ||
176 | 29 | x2="22.892584" | ||
177 | 30 | y1="0.90414524" | ||
178 | 31 | x1="22.892584" | ||
179 | 32 | id="linearGradient3178" | ||
180 | 33 | xlink:href="#linearGradient3172" | ||
181 | 34 | inkscape:collect="always" /> | ||
182 | 35 | <linearGradient | ||
183 | 36 | id="linearGradient3172"> | ||
184 | 37 | <stop | ||
185 | 38 | id="stop3174" | ||
186 | 39 | offset="0" | ||
187 | 40 | style="stop-color:#ffb584;stop-opacity:1;" /> | ||
188 | 41 | <stop | ||
189 | 42 | id="stop3176" | ||
190 | 43 | offset="1" | ||
191 | 44 | style="stop-color:#ffb584;stop-opacity:0;" /> | ||
192 | 45 | </linearGradient> | ||
193 | 46 | <linearGradient | ||
194 | 47 | inkscape:collect="always" | ||
195 | 48 | xlink:href="#linearGradient3172" | ||
196 | 49 | id="linearGradient3747" | ||
197 | 50 | gradientUnits="userSpaceOnUse" | ||
198 | 51 | x1="22.892584" | ||
199 | 52 | y1="0.90414524" | ||
200 | 53 | x2="22.892584" | ||
201 | 54 | y2="21.132059" /> | ||
202 | 55 | <linearGradient | ||
203 | 56 | inkscape:collect="always" | ||
204 | 57 | xlink:href="#linearGradient3172" | ||
205 | 58 | id="linearGradient3752" | ||
206 | 59 | gradientUnits="userSpaceOnUse" | ||
207 | 60 | x1="22.892584" | ||
208 | 61 | y1="0.90414524" | ||
209 | 62 | x2="22.892584" | ||
210 | 63 | y2="21.132059" | ||
211 | 64 | gradientTransform="matrix(0.644962,0,0,-1.1832362,59.235153,43.983663)" /> | ||
212 | 65 | <linearGradient | ||
213 | 66 | inkscape:collect="always" | ||
214 | 67 | xlink:href="#linearGradient3172" | ||
215 | 68 | id="linearGradient3755" | ||
216 | 69 | gradientUnits="userSpaceOnUse" | ||
217 | 70 | gradientTransform="matrix(0.644962,0,0,1.1832362,9.235153,4.016337)" | ||
218 | 71 | x1="22.892584" | ||
219 | 72 | y1="0.90414524" | ||
220 | 73 | x2="22.892584" | ||
221 | 74 | y2="21.132059" /> | ||
222 | 75 | </defs> | ||
223 | 76 | <sodipodi:namedview | ||
224 | 77 | id="base" | ||
225 | 78 | pagecolor="#ffffff" | ||
226 | 79 | bordercolor="#afafaf" | ||
227 | 80 | borderopacity="1" | ||
228 | 81 | gridtolerance="15.1" | ||
229 | 82 | guidetolerance="10" | ||
230 | 83 | objecttolerance="10" | ||
231 | 84 | inkscape:pageopacity="0" | ||
232 | 85 | inkscape:pageshadow="2" | ||
233 | 86 | inkscape:zoom="8" | ||
234 | 87 | inkscape:cx="20.022534" | ||
235 | 88 | inkscape:cy="20.71947" | ||
236 | 89 | inkscape:document-units="px" | ||
237 | 90 | inkscape:current-layer="layer1" | ||
238 | 91 | width="48px" | ||
239 | 92 | height="48px" | ||
240 | 93 | inkscape:showpageshadow="false" | ||
241 | 94 | inkscape:window-width="872" | ||
242 | 95 | inkscape:window-height="723" | ||
243 | 96 | inkscape:window-x="406" | ||
244 | 97 | inkscape:window-y="21" | ||
245 | 98 | showgrid="false" | ||
246 | 99 | inkscape:grid-points="false" | ||
247 | 100 | showborder="true" | ||
248 | 101 | showguides="false" | ||
249 | 102 | inkscape:guide-bbox="false" | ||
250 | 103 | inkscape:grid-bbox="true" | ||
251 | 104 | inkscape:object-paths="false" | ||
252 | 105 | inkscape:window-maximized="0"> | ||
253 | 106 | <sodipodi:guide | ||
254 | 107 | orientation="horizontal" | ||
255 | 108 | position="8.6620581" | ||
256 | 109 | id="guide7377" /> | ||
257 | 110 | <sodipodi:guide | ||
258 | 111 | orientation="horizontal" | ||
259 | 112 | position="6" | ||
260 | 113 | id="guide7379" /> | ||
261 | 114 | <sodipodi:guide | ||
262 | 115 | orientation="horizontal" | ||
263 | 116 | position="36.062446" | ||
264 | 117 | id="guide7492" /> | ||
265 | 118 | <sodipodi:guide | ||
266 | 119 | orientation="horizontal" | ||
267 | 120 | position="51" | ||
268 | 121 | id="guide7046" /> | ||
269 | 122 | <sodipodi:guide | ||
270 | 123 | orientation="horizontal" | ||
271 | 124 | position="-17.5" | ||
272 | 125 | id="guide7233" /> | ||
273 | 126 | <sodipodi:guide | ||
274 | 127 | orientation="horizontal" | ||
275 | 128 | position="-29" | ||
276 | 129 | id="guide7235" /> | ||
277 | 130 | <sodipodi:guide | ||
278 | 131 | orientation="horizontal" | ||
279 | 132 | position="44.547727" | ||
280 | 133 | id="guide6795" /> | ||
281 | 134 | <sodipodi:guide | ||
282 | 135 | orientation="horizontal" | ||
283 | 136 | position="16.970563" | ||
284 | 137 | id="guide6797" /> | ||
285 | 138 | <sodipodi:guide | ||
286 | 139 | orientation="horizontal" | ||
287 | 140 | position="23.511301" | ||
288 | 141 | id="guide6914" /> | ||
289 | 142 | <inkscape:grid | ||
290 | 143 | id="GridFromPre046Settings" | ||
291 | 144 | type="xygrid" | ||
292 | 145 | originx="0px" | ||
293 | 146 | originy="0px" | ||
294 | 147 | spacingx="0.5px" | ||
295 | 148 | spacingy="0.5px" | ||
296 | 149 | color="#0000ff" | ||
297 | 150 | empcolor="#0000ff" | ||
298 | 151 | opacity="0.2" | ||
299 | 152 | empopacity="0.4" | ||
300 | 153 | empspacing="2" /> | ||
301 | 154 | </sodipodi:namedview> | ||
302 | 155 | <metadata | ||
303 | 156 | id="metadata7859"> | ||
304 | 157 | <rdf:RDF> | ||
305 | 158 | <cc:Work | ||
306 | 159 | rdf:about=""> | ||
307 | 160 | <dc:format>image/svg+xml</dc:format> | ||
308 | 161 | <dc:type | ||
309 | 162 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
310 | 163 | <dc:creator> | ||
311 | 164 | <cc:Agent> | ||
312 | 165 | <dc:title>Lapo Calamandrei</dc:title> | ||
313 | 166 | </cc:Agent> | ||
314 | 167 | </dc:creator> | ||
315 | 168 | <dc:source /> | ||
316 | 169 | <cc:license | ||
317 | 170 | rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" /> | ||
318 | 171 | <dc:title></dc:title> | ||
319 | 172 | <dc:subject> | ||
320 | 173 | <rdf:Bag /> | ||
321 | 174 | </dc:subject> | ||
322 | 175 | </cc:Work> | ||
323 | 176 | <cc:License | ||
324 | 177 | rdf:about="http://creativecommons.org/licenses/GPL/2.0/"> | ||
325 | 178 | <cc:permits | ||
326 | 179 | rdf:resource="http://web.resource.org/cc/Reproduction" /> | ||
327 | 180 | <cc:permits | ||
328 | 181 | rdf:resource="http://web.resource.org/cc/Distribution" /> | ||
329 | 182 | <cc:requires | ||
330 | 183 | rdf:resource="http://web.resource.org/cc/Notice" /> | ||
331 | 184 | <cc:permits | ||
332 | 185 | rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> | ||
333 | 186 | <cc:requires | ||
334 | 187 | rdf:resource="http://web.resource.org/cc/ShareAlike" /> | ||
335 | 188 | <cc:requires | ||
336 | 189 | rdf:resource="http://web.resource.org/cc/SourceCode" /> | ||
337 | 190 | </cc:License> | ||
338 | 191 | </rdf:RDF> | ||
339 | 192 | </metadata> | ||
340 | 193 | <g | ||
341 | 194 | inkscape:label="Layer 1" | ||
342 | 195 | inkscape:groupmode="layer" | ||
343 | 196 | id="layer1"> | ||
344 | 197 | <path | ||
345 | 198 | style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#ea5d00;fill:#ea5d00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Charter;-inkscape-font-specification:Bitstream Charter" | ||
346 | 199 | d="m 31.458167,11 0,0.971084 0,2.506024 -2.5498,0 c -2.309243,1e-6 -4.600856,0.959829 -6.438247,2.568675 -1.848702,1.618749 -3.250996,4.052721 -3.250996,6.954217 0,1.569915 -0.481869,2.684008 -1.211156,3.414458 -0.729287,0.73045 -1.72852,1.096385 -2.868526,1.096385 l -4.589641,0 -2.0398408,0 -0.5099602,0 0,0.501205 0,4.009639 0,0.501205 0.5099602,0 2.0398408,0 4.589641,0 c 4.913523,0 9.179283,-4.047685 9.179283,-9.522892 0,-1.311125 0.627138,-2.380239 1.593626,-3.226506 0.947549,-0.829685 2.290606,-1.284337 2.996016,-1.284337 l 2.5498,0 0,2.506024 0,0.971084 L 32.25498,22.40241 39.394422,17.390361 40,16.983133 39.394422,16.575904 32.25498,11.563855 31.458167,11 z M 8,14.477108 l 0,0.501205 0,4.009639 0,0.501205 0.5099602,0 2.0398408,0 4.589641,0 c 1.140006,0 2.139239,0.365935 2.868526,1.096385 0.383279,0.38389 0.711734,0.865992 0.924303,1.472289 0.409442,-1.928125 1.388391,-3.582339 2.645418,-4.855421 -0.0054,-0.0055 0.0055,-0.0258 0,-0.03133 -1.680631,-1.696317 -3.981485,-2.693972 -6.438247,-2.693972 l -4.589641,0 -2.0398408,0 -0.5099602,0 z m 23.458167,10.556627 0,0.971084 0,2.506024 -2.5498,0 c -0.70541,0 -2.048467,-0.454652 -2.996016,-1.284337 -0.528622,-0.462867 -0.932659,-0.998256 -1.211156,-1.59759 -0.308884,1.992948 -1.187966,3.74975 -2.422311,5.137349 0.06485,0.05987 0.125211,0.13014 0.191236,0.187952 1.837391,1.608846 4.129004,2.568674 6.438247,2.568675 l 2.5498,0 0,2.506024 0,0.971084 0.796813,-0.563855 7.139442,-5.012049 L 40,31.016867 39.394422,30.609639 32.25498,25.59759 31.458167,25.033735 z" | ||
347 | 200 | id="path6784" /> | ||
348 | 201 | <path | ||
349 | 202 | style="fill:url(#linearGradient3755);fill-opacity:1;stroke:none" | ||
350 | 203 | d="m 24,29.65625 c -0.297307,0 -0.5803,-0.02559 -0.875,-0.03125 0.774683,-1.167911 1.33229,-2.514662 1.5625,-4 0.278497,0.599334 0.690128,1.130883 1.21875,1.59375 0.947549,0.829685 2.29459,1.28125 3,1.28125 l 2.5625,0 0,-2.5 0,-0.96875 0.78125,0.5625 3.46875,2.4375 C 32.250392,29.058149 28.258286,29.65625 24,29.65625 z M 22.5625,29.625 C 19.537058,29.52951 16.652999,29.1332 14.03125,28.5 l 1.09375,0 c 1.140006,0 2.145713,-0.3633 2.875,-1.09375 0.729287,-0.73045 1.21875,-1.836335 1.21875,-3.40625 0,-2.901496 1.401298,-5.350001 3.25,-6.96875 1.837391,-1.608846 4.128257,-2.562499 6.4375,-2.5625 l 2.5625,0 0,-2.5 0,-0.96875 0.78125,0.5625 7.15625,5 L 40,16.96875 39.40625,17.375 32.25,22.40625 l -0.78125,0.5625 0,-0.96875 0,-2.5 -2.5625,0 c -0.70541,0 -2.052451,0.451565 -3,1.28125 C 24.939762,21.627517 24.3125,22.688875 24.3125,24 c 0,2.153291 -0.650512,4.072677 -1.75,5.625 z m -3.625,-7.5625 C 18.724931,21.456203 18.383279,20.97764 18,20.59375 17.270713,19.8633 16.265006,19.5 15.125,19.5 l -4.5625,0 -2.0625,0 -0.5,0 0,-0.5 0,-4.03125 0,-0.5 0.5,0 2.0625,0 4.5625,0 c 2.456762,0 4.756869,0.991183 6.4375,2.6875 0.0055,0.0055 -0.0054,0.02575 0,0.03125 -1.257027,1.273082 -2.215558,2.946875 -2.625,4.875 z" | ||
351 | 204 | id="path3741" /> | ||
352 | 205 | <g | ||
353 | 206 | transform="matrix(0.1337942,0,0,-0.1337942,31.527762,89.04701)" | ||
354 | 207 | inkscape:label="Calque 1" | ||
355 | 208 | id="g3743" /> | ||
356 | 209 | <g | ||
357 | 210 | transform="matrix(0.1672428,0,0,-0.1672428,38.442916,104.62323)" | ||
358 | 211 | inkscape:label="Calque 1" | ||
359 | 212 | id="g3745" /> | ||
360 | 213 | </g> | ||
361 | 214 | </svg> | ||
362 | 0 | 215 | ||
363 | === added file 'mixxx/res/images/autodj/stock_mail-send-receive.svg' | |||
364 | --- mixxx/res/images/autodj/stock_mail-send-receive.svg 1970-01-01 00:00:00 +0000 | |||
365 | +++ mixxx/res/images/autodj/stock_mail-send-receive.svg 2012-03-12 04:06:20 +0000 | |||
366 | @@ -0,0 +1,87 @@ | |||
367 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
368 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
369 | 3 | |||
370 | 4 | <svg | ||
371 | 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
372 | 6 | xmlns:cc="http://creativecommons.org/ns#" | ||
373 | 7 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
374 | 8 | xmlns:svg="http://www.w3.org/2000/svg" | ||
375 | 9 | xmlns="http://www.w3.org/2000/svg" | ||
376 | 10 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
377 | 11 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
378 | 12 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
379 | 13 | width="48px" | ||
380 | 14 | height="48px" | ||
381 | 15 | id="svg3787" | ||
382 | 16 | version="1.1" | ||
383 | 17 | inkscape:version="0.47 r22583" | ||
384 | 18 | sodipodi:docname="Nouveau document 4"> | ||
385 | 19 | <defs | ||
386 | 20 | id="defs3789"> | ||
387 | 21 | <linearGradient | ||
388 | 22 | inkscape:collect="always" | ||
389 | 23 | xlink:href="#linearGradient3172" | ||
390 | 24 | id="linearGradient3767" | ||
391 | 25 | gradientUnits="userSpaceOnUse" | ||
392 | 26 | gradientTransform="matrix(0.644962,0,0,1.1832362,9.235153,4.016337)" | ||
393 | 27 | x1="22.892584" | ||
394 | 28 | y1="0.90414524" | ||
395 | 29 | x2="22.892584" | ||
396 | 30 | y2="21.132059" /> | ||
397 | 31 | <linearGradient | ||
398 | 32 | id="linearGradient3172"> | ||
399 | 33 | <stop | ||
400 | 34 | id="stop3174" | ||
401 | 35 | offset="0" | ||
402 | 36 | style="stop-color:#ffb584;stop-opacity:1;" /> | ||
403 | 37 | <stop | ||
404 | 38 | id="stop3176" | ||
405 | 39 | offset="1" | ||
406 | 40 | style="stop-color:#ffb584;stop-opacity:0;" /> | ||
407 | 41 | </linearGradient> | ||
408 | 42 | </defs> | ||
409 | 43 | <sodipodi:namedview | ||
410 | 44 | id="base" | ||
411 | 45 | pagecolor="#ffffff" | ||
412 | 46 | bordercolor="#666666" | ||
413 | 47 | borderopacity="1.0" | ||
414 | 48 | inkscape:pageopacity="0.0" | ||
415 | 49 | inkscape:pageshadow="2" | ||
416 | 50 | inkscape:zoom="7" | ||
417 | 51 | inkscape:cx="24" | ||
418 | 52 | inkscape:cy="24" | ||
419 | 53 | inkscape:current-layer="layer1" | ||
420 | 54 | showgrid="true" | ||
421 | 55 | inkscape:grid-bbox="true" | ||
422 | 56 | inkscape:document-units="px" | ||
423 | 57 | inkscape:window-width="596" | ||
424 | 58 | inkscape:window-height="502" | ||
425 | 59 | inkscape:window-x="768" | ||
426 | 60 | inkscape:window-y="24" | ||
427 | 61 | inkscape:window-maximized="0" /> | ||
428 | 62 | <metadata | ||
429 | 63 | id="metadata3792"> | ||
430 | 64 | <rdf:RDF> | ||
431 | 65 | <cc:Work | ||
432 | 66 | rdf:about=""> | ||
433 | 67 | <dc:format>image/svg+xml</dc:format> | ||
434 | 68 | <dc:type | ||
435 | 69 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
436 | 70 | <dc:title></dc:title> | ||
437 | 71 | </cc:Work> | ||
438 | 72 | </rdf:RDF> | ||
439 | 73 | </metadata> | ||
440 | 74 | <g | ||
441 | 75 | id="layer1" | ||
442 | 76 | inkscape:label="Layer 1" | ||
443 | 77 | inkscape:groupmode="layer"> | ||
444 | 78 | <path | ||
445 | 79 | style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#ea5d00;fill:#ea5d00;fill-opacity:1;stroke:none;stroke-width:0.99999988;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Charter;-inkscape-font-specification:Bitstream Charter" | ||
446 | 80 | d="m 14.59375,4 -0.375,0.375 -9.46875,9.15625 -0.75,0.75 1.125,0 4.3125,0 0,18.03125 0,0.46875 0.53125,-0.03125 9.3125,-0.03125 0.5,0 0,-0.4375 0,-18 4.375,0 1.15625,0 -0.75,-0.75 L 14.96875,4.375 14.59375,4 z m 13.46875,11.21875 0,0.4375 0,18.0625 -4.25,0 -1.15625,0 0.75,0.75 L 32.875,43.625 33.25,44 l 0.40625,-0.375 9.5625,-9.15625 0.78125,-0.75 -1.15625,0 -4.40625,0 0,-18 0,-0.4375 -0.53125,0 -9.3125,-0.0625 -0.53125,0 z" | ||
447 | 81 | id="path4360" /> | ||
448 | 82 | <path | ||
449 | 83 | style="fill:url(#linearGradient3767);fill-opacity:1;stroke:none" | ||
450 | 84 | d="M 19.78125,29.4375 C 15.932317,29.076763 12.418889,28.236656 9.4375,27.03125 l 0,-12.75 -4.3125,0 -1.125,0 0.75,-0.75 9.46875,-9.15625 0.375,-0.375 0.375,0.375 9.59375,9.15625 0.75,0.75 -1.15625,0 -4.375,0 0,15.15625 z m 8.28125,0 0,-13.78125 0,-0.4375 0.53125,0 9.3125,0.0625 0.53125,0 0,0.4375 0,11.34375 c -2.995811,1.195807 -6.517914,2.027067 -10.375,2.375 z" | ||
451 | 85 | id="path3753" /> | ||
452 | 86 | </g> | ||
453 | 87 | </svg> | ||
454 | 0 | 88 | ||
455 | === modified file 'mixxx/res/mixxx.qrc' | |||
456 | --- mixxx/res/mixxx.qrc 2011-12-22 18:43:09 +0000 | |||
457 | +++ mixxx/res/mixxx.qrc 2012-03-12 04:06:20 +0000 | |||
458 | @@ -1,5 +1,8 @@ | |||
459 | 1 | <RCC> | 1 | <RCC> |
460 | 2 | <qresource prefix="/"> | 2 | <qresource prefix="/"> |
461 | 3 | <file>images/autodj/media-playlist-shuffle.svg</file> | ||
462 | 4 | <file>images/autodj/stock_mail-send-receive.svg</file> | ||
463 | 5 | <file>images/autodj/bottom.svg</file> | ||
464 | 3 | <file>html/crates.html</file> | 6 | <file>html/crates.html</file> |
465 | 4 | <file>html/playlists.html</file> | 7 | <file>html/playlists.html</file> |
466 | 5 | <file>images/mixxx-icon.png</file> | 8 | <file>images/mixxx-icon.png</file> |
467 | 6 | 9 | ||
468 | === modified file 'mixxx/src/dlgautodj.cpp' | |||
469 | --- mixxx/src/dlgautodj.cpp 2011-11-30 06:19:47 +0000 | |||
470 | +++ mixxx/src/dlgautodj.cpp 2012-03-12 04:06:20 +0000 | |||
471 | @@ -1,28 +1,38 @@ | |||
472 | 1 | #include <QSqlTableModel> | 1 | #include <QSqlTableModel> |
476 | 2 | #include "widget/wwidget.h" | 2 | |
477 | 3 | #include "widget/wskincolor.h" | 3 | #include "dlgautodj.h" |
478 | 4 | #include "widget/wtracktableview.h" | 4 | |
479 | 5 | #include "controlobject.h" | 5 | #include "controlobject.h" |
480 | 6 | #include "controlobjectthreadmain.h" | 6 | #include "controlobjectthreadmain.h" |
481 | 7 | #include "library/playlisttablemodel.h" | ||
482 | 7 | #include "library/trackcollection.h" | 8 | #include "library/trackcollection.h" |
485 | 8 | #include "library/playlisttablemodel.h" | 9 | #include "playerinfo.h" |
486 | 9 | #include "dlgautodj.h" | 10 | #include "widget/wskincolor.h" |
487 | 11 | #include "widget/wtracktableview.h" | ||
488 | 12 | #include "widget/wwidget.h" | ||
489 | 10 | 13 | ||
490 | 14 | #define CONFIG_KEY "[Auto DJ]" | ||
491 | 15 | const char* kTransitionPreferenceName = "Transition"; | ||
492 | 16 | const int kTransitionPreferenceDefault = 10; | ||
493 | 11 | 17 | ||
494 | 12 | DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, | 18 | DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, |
498 | 13 | TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) | 19 | TrackCollection* pTrackCollection, |
499 | 14 | : QWidget(parent), Ui::DlgAutoDJ(), m_playlistDao(pTrackCollection->getPlaylistDAO()) | 20 | MixxxKeyboard* pKeyboard) |
500 | 15 | { | 21 | : QWidget(parent), |
501 | 22 | Ui::DlgAutoDJ(), | ||
502 | 23 | m_pConfig(pConfig), | ||
503 | 24 | m_pTrackCollection(pTrackCollection), | ||
504 | 25 | m_pTrackTableView( | ||
505 | 26 | new WTrackTableView(this, pConfig, m_pTrackCollection)), | ||
506 | 27 | m_playlistDao(pTrackCollection->getPlaylistDAO()), | ||
507 | 28 | m_bAutoDJEnabled(false), | ||
508 | 29 | m_bFadeNow(false), | ||
509 | 30 | m_eState(ADJ_IDLE), | ||
510 | 31 | m_posThreshold1(1.0f), | ||
511 | 32 | m_posThreshold2(1.0f) { | ||
512 | 16 | setupUi(this); | 33 | setupUi(this); |
513 | 17 | 34 | ||
514 | 18 | m_pConfig = pConfig; | ||
515 | 19 | m_pTrackCollection = pTrackCollection; | ||
516 | 20 | m_bAutoDJEnabled = false; | ||
517 | 21 | m_bPlayer1Primed = false; | ||
518 | 22 | m_bPlayer2Primed = false; | ||
519 | 23 | m_pTrackTableView = new WTrackTableView(this, pConfig, m_pTrackCollection); | ||
520 | 24 | m_pTrackTableView->installEventFilter(pKeyboard); | 35 | m_pTrackTableView->installEventFilter(pKeyboard); |
521 | 25 | |||
522 | 26 | connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), | 36 | connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), |
523 | 27 | this, SIGNAL(loadTrack(TrackPointer))); | 37 | this, SIGNAL(loadTrack(TrackPointer))); |
524 | 28 | connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), | 38 | connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), |
525 | @@ -34,8 +44,8 @@ | |||
526 | 34 | m_pTrackTablePlaceholder->hide(); | 44 | m_pTrackTablePlaceholder->hide(); |
527 | 35 | box->insertWidget(1, m_pTrackTableView); | 45 | box->insertWidget(1, m_pTrackTableView); |
528 | 36 | 46 | ||
531 | 37 | m_pAutoDJTableModel = new PlaylistTableModel(this, pTrackCollection, | 47 | m_pAutoDJTableModel = new PlaylistTableModel(this, pTrackCollection, |
532 | 38 | "mixxx.db.model.autodj"); | 48 | "mixxx.db.model.autodj"); |
533 | 39 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | 49 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); |
534 | 40 | if (playlistId < 0) { | 50 | if (playlistId < 0) { |
535 | 41 | m_playlistDao.createPlaylist(AUTODJ_TABLE, true); | 51 | m_playlistDao.createPlaylist(AUTODJ_TABLE, true); |
536 | @@ -44,7 +54,7 @@ | |||
537 | 44 | m_pAutoDJTableModel->setPlaylist(playlistId); | 54 | m_pAutoDJTableModel->setPlaylist(playlistId); |
538 | 45 | m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); | 55 | m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); |
539 | 46 | 56 | ||
541 | 47 | //Override some playlist-view properties: | 57 | // Override some playlist-view properties: |
542 | 48 | 58 | ||
543 | 49 | // Do not set this because it disables auto-scrolling | 59 | // Do not set this because it disables auto-scrolling |
544 | 50 | //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); | 60 | //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); |
545 | @@ -55,43 +65,65 @@ | |||
546 | 55 | connect(pushButtonShuffle, SIGNAL(clicked(bool)), | 65 | connect(pushButtonShuffle, SIGNAL(clicked(bool)), |
547 | 56 | this, SLOT(shufflePlaylist(bool))); | 66 | this, SLOT(shufflePlaylist(bool))); |
548 | 57 | 67 | ||
549 | 68 | connect(pushButtonSkipNext, SIGNAL(clicked(bool)), | ||
550 | 69 | this, SLOT(skipNext(bool))); | ||
551 | 70 | |||
552 | 71 | connect(pushButtonFadeNow, SIGNAL(clicked(bool)), | ||
553 | 72 | this, SLOT(fadeNow(bool))); | ||
554 | 73 | |||
555 | 74 | connect(spinBoxTransition, SIGNAL(valueChanged(int)), | ||
556 | 75 | this, SLOT(transitionValueChanged(int))); | ||
557 | 76 | |||
558 | 58 | connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), | 77 | connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), |
559 | 59 | this, SLOT(toggleAutoDJ(bool))); _blah; | 78 | this, SLOT(toggleAutoDJ(bool))); _blah; |
560 | 60 | 79 | ||
561 | 80 | // playposition is from -0.14 to + 1.14 | ||
562 | 61 | m_pCOPlayPos1 = new ControlObjectThreadMain( | 81 | m_pCOPlayPos1 = new ControlObjectThreadMain( |
564 | 62 | ControlObject::getControl(ConfigKey("[Channel1]", "playposition"))); | 82 | ControlObject::getControl(ConfigKey("[Channel1]", "playposition"))); |
565 | 63 | m_pCOPlayPos2 = new ControlObjectThreadMain( | 83 | m_pCOPlayPos2 = new ControlObjectThreadMain( |
567 | 64 | ControlObject::getControl(ConfigKey("[Channel2]", "playposition"))); | 84 | ControlObject::getControl(ConfigKey("[Channel2]", "playposition"))); |
568 | 65 | m_pCOPlay1 = new ControlObjectThreadMain( | 85 | m_pCOPlay1 = new ControlObjectThreadMain( |
570 | 66 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); | 86 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); |
571 | 67 | m_pCOPlay2 = new ControlObjectThreadMain( | 87 | m_pCOPlay2 = new ControlObjectThreadMain( |
573 | 68 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); | 88 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); |
574 | 89 | m_pCOPlay1Fb = new ControlObjectThreadMain( | ||
575 | 90 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); | ||
576 | 91 | m_pCOPlay2Fb = new ControlObjectThreadMain( | ||
577 | 92 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); | ||
578 | 69 | m_pCORepeat1 = new ControlObjectThreadMain( | 93 | m_pCORepeat1 = new ControlObjectThreadMain( |
580 | 70 | ControlObject::getControl(ConfigKey("[Channel1]", "repeat"))); | 94 | ControlObject::getControl(ConfigKey("[Channel1]", "repeat"))); |
581 | 71 | m_pCORepeat2 = new ControlObjectThreadMain( | 95 | m_pCORepeat2 = new ControlObjectThreadMain( |
583 | 72 | ControlObject::getControl(ConfigKey("[Channel2]", "repeat"))); | 96 | ControlObject::getControl(ConfigKey("[Channel2]", "repeat"))); |
584 | 73 | m_pCOCrossfader = new ControlObjectThreadMain( | 97 | m_pCOCrossfader = new ControlObjectThreadMain( |
586 | 74 | ControlObject::getControl(ConfigKey("[Master]", "crossfader"))); | 98 | ControlObject::getControl(ConfigKey("[Master]", "crossfader"))); |
587 | 99 | |||
588 | 100 | QString str_autoDjTransition = m_pConfig->getValueString( | ||
589 | 101 | ConfigKey(CONFIG_KEY, kTransitionPreferenceName)); | ||
590 | 102 | if (str_autoDjTransition.isEmpty()) { | ||
591 | 103 | spinBoxTransition->setValue(kTransitionPreferenceDefault); | ||
592 | 104 | } else { | ||
593 | 105 | spinBoxTransition->setValue(str_autoDjTransition.toInt()); | ||
594 | 106 | } | ||
595 | 75 | } | 107 | } |
596 | 76 | 108 | ||
599 | 77 | DlgAutoDJ::~DlgAutoDJ() | 109 | DlgAutoDJ::~DlgAutoDJ() { |
598 | 78 | { | ||
600 | 79 | delete m_pCOPlayPos1; | 110 | delete m_pCOPlayPos1; |
601 | 80 | delete m_pCOPlayPos2; | 111 | delete m_pCOPlayPos2; |
602 | 81 | delete m_pCOPlay1; | 112 | delete m_pCOPlay1; |
603 | 82 | delete m_pCOPlay2; | 113 | delete m_pCOPlay2; |
604 | 114 | delete m_pCOPlay1Fb; | ||
605 | 115 | delete m_pCOPlay2Fb; | ||
606 | 116 | delete m_pCORepeat1; | ||
607 | 83 | delete m_pCORepeat2; | 117 | delete m_pCORepeat2; |
608 | 84 | delete m_pCOCrossfader; | 118 | delete m_pCOCrossfader; |
609 | 119 | delete m_pAutoDJTableModel; | ||
610 | 85 | } | 120 | } |
611 | 86 | 121 | ||
614 | 87 | void DlgAutoDJ::onShow() | 122 | void DlgAutoDJ::onShow() { |
613 | 88 | { | ||
615 | 89 | m_pAutoDJTableModel->select(); | 123 | m_pAutoDJTableModel->select(); |
616 | 90 | } | 124 | } |
617 | 91 | 125 | ||
621 | 92 | void DlgAutoDJ::setup(QDomNode node) | 126 | void DlgAutoDJ::setup(QDomNode node) { |
619 | 93 | { | ||
620 | 94 | |||
622 | 95 | QPalette pal = palette(); | 127 | QPalette pal = palette(); |
623 | 96 | 128 | ||
624 | 97 | // Row colors | 129 | // Row colors |
625 | @@ -108,9 +140,6 @@ | |||
626 | 108 | // the future this should be configurable from the skin with this as the | 140 | // the future this should be configurable from the skin with this as the |
627 | 109 | // fallback option | 141 | // fallback option |
628 | 110 | QColor text(255 - r1.red(), 255 - r1.green(), 255 - r1.blue()); | 142 | QColor text(255 - r1.red(), 255 - r1.green(), 255 - r1.blue()); |
629 | 111 | |||
630 | 112 | //setAlternatingRowColors ( true ); | ||
631 | 113 | |||
632 | 114 | QColor fgColor; | 143 | QColor fgColor; |
633 | 115 | fgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor")); | 144 | fgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor")); |
634 | 116 | fgColor = WSkinColor::getCorrectColor(fgColor); | 145 | fgColor = WSkinColor::getCorrectColor(fgColor); |
635 | @@ -119,26 +148,24 @@ | |||
636 | 119 | pal.setColor(QPalette::AlternateBase, r2); | 148 | pal.setColor(QPalette::AlternateBase, r2); |
637 | 120 | pal.setColor(QPalette::Text, text); | 149 | pal.setColor(QPalette::Text, text); |
638 | 121 | pal.setColor(QPalette::WindowText, fgColor); | 150 | pal.setColor(QPalette::WindowText, fgColor); |
639 | 122 | |||
640 | 123 | } | 151 | } |
641 | 124 | 152 | ||
642 | 125 | setPalette(pal); | 153 | setPalette(pal); |
643 | 126 | 154 | ||
644 | 127 | pushButtonAutoDJ->setPalette(pal); | 155 | pushButtonAutoDJ->setPalette(pal); |
659 | 128 | //m_pTrackTableView->setPalette(pal); //Since we're getting this passed into us already created, | 156 | |
660 | 129 | //shouldn't need to set the palette. | 157 | // Since we're getting this passed into us already created, shouldn't need |
661 | 130 | } | 158 | // to set the palette. |
662 | 131 | 159 | //m_pTrackTableView->setPalette(pal); | |
663 | 132 | void DlgAutoDJ::onSearchStarting() | 160 | } |
664 | 133 | { | 161 | |
665 | 134 | } | 162 | void DlgAutoDJ::onSearchStarting() { |
666 | 135 | 163 | } | |
667 | 136 | void DlgAutoDJ::onSearchCleared() | 164 | |
668 | 137 | { | 165 | void DlgAutoDJ::onSearchCleared() { |
669 | 138 | } | 166 | } |
670 | 139 | 167 | ||
671 | 140 | void DlgAutoDJ::onSearch(const QString& text) | 168 | void DlgAutoDJ::onSearch(const QString& text) { |
658 | 141 | { | ||
672 | 142 | m_pAutoDJTableModel->search(text); | 169 | m_pAutoDJTableModel->search(text); |
673 | 143 | } | 170 | } |
674 | 144 | 171 | ||
675 | @@ -154,204 +181,439 @@ | |||
676 | 154 | m_pTrackTableView->moveSelection(delta); | 181 | m_pTrackTableView->moveSelection(delta); |
677 | 155 | } | 182 | } |
678 | 156 | 183 | ||
681 | 157 | void DlgAutoDJ::shufflePlaylist(bool buttonChecked) | 184 | void DlgAutoDJ::shufflePlaylist(bool buttonChecked) { |
680 | 158 | { | ||
682 | 159 | Q_UNUSED(buttonChecked); | 185 | Q_UNUSED(buttonChecked); |
683 | 160 | qDebug() << "Shuffling AutoDJ playlist"; | 186 | qDebug() << "Shuffling AutoDJ playlist"; |
684 | 161 | m_pAutoDJTableModel->shuffleTracks(m_pAutoDJTableModel->index(0, 0)); | 187 | m_pAutoDJTableModel->shuffleTracks(m_pAutoDJTableModel->index(0, 0)); |
685 | 162 | qDebug() << "Shuffling done"; | 188 | qDebug() << "Shuffling done"; |
686 | 163 | } | 189 | } |
687 | 164 | 190 | ||
693 | 165 | void DlgAutoDJ::toggleAutoDJ(bool toggle) | 191 | void DlgAutoDJ::skipNext(bool buttonChecked) { |
694 | 166 | { | 192 | Q_UNUSED(buttonChecked); |
695 | 167 | if (toggle) //Enable Auto DJ | 193 | qDebug() << "Skip Next"; |
696 | 168 | { | 194 | // Load the next song from the queue. |
697 | 169 | if (m_pCOPlay1->get() == 1.0f && m_pCOPlay2->get() == 1.0f) { | 195 | if (m_pCOPlay1Fb->get() == 0.0f) { |
698 | 196 | removePlayingTrackFromQueue("[Channel1]"); | ||
699 | 197 | loadNextTrackFromQueue(); | ||
700 | 198 | } else if (m_pCOPlay2Fb->get() == 0.0f) { | ||
701 | 199 | removePlayingTrackFromQueue("[Channel2]"); | ||
702 | 200 | loadNextTrackFromQueue(); | ||
703 | 201 | } | ||
704 | 202 | } | ||
705 | 203 | |||
706 | 204 | void DlgAutoDJ::fadeNow(bool buttonChecked) { | ||
707 | 205 | Q_UNUSED(buttonChecked); | ||
708 | 206 | qDebug() << "Fade Now"; | ||
709 | 207 | if (m_eState == ADJ_IDLE && m_bAutoDJEnabled) { | ||
710 | 208 | m_bFadeNow = true; | ||
711 | 209 | double crossfader = m_pCOCrossfader->get(); | ||
712 | 210 | if (crossfader <= 0.3f && m_pCOPlay1Fb->get() == 1.0f) { | ||
713 | 211 | m_posThreshold1 = m_pCOPlayPos1->get() - | ||
714 | 212 | ((crossfader + 1.0f) / 2 * (m_fadeDuration1)); | ||
715 | 213 | // Repeat is disabled by FadeNow but disables auto Fade | ||
716 | 214 | m_pCORepeat1->slotSet(0.0f); | ||
717 | 215 | } else if (crossfader >= -0.3f && m_pCOPlay2Fb->get() == 1.0f) { | ||
718 | 216 | m_posThreshold2 = m_pCOPlayPos2->get() - | ||
719 | 217 | ((1.0f - crossfader) / 2 * (m_fadeDuration2)); | ||
720 | 218 | // Repeat is disabled by FadeNow but disables auto Fade | ||
721 | 219 | m_pCORepeat2->slotSet(0.0f); | ||
722 | 220 | } | ||
723 | 221 | } | ||
724 | 222 | } | ||
725 | 223 | |||
726 | 224 | void DlgAutoDJ::toggleAutoDJ(bool toggle) { | ||
727 | 225 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; | ||
728 | 226 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; | ||
729 | 227 | |||
730 | 228 | if (toggle) { // Enable Auto DJ | ||
731 | 229 | if (deck1Playing && deck2Playing) { | ||
732 | 230 | QMessageBox::warning( | ||
733 | 231 | NULL, tr("Auto-DJ"), | ||
734 | 232 | tr("One player must be stopped to enable Auto-DJ mode."), | ||
735 | 233 | QMessageBox::Ok); | ||
736 | 170 | qDebug() << "One player must be stopped before enabling Auto DJ mode"; | 234 | qDebug() << "One player must be stopped before enabling Auto DJ mode"; |
737 | 171 | pushButtonAutoDJ->setChecked(false); | 235 | pushButtonAutoDJ->setChecked(false); |
738 | 172 | return; | 236 | return; |
739 | 173 | } | 237 | } |
740 | 174 | 238 | ||
741 | 239 | // Never load the same track if it is already playing | ||
742 | 240 | if (deck1Playing) { | ||
743 | 241 | removePlayingTrackFromQueue("[Channel1]"); | ||
744 | 242 | } | ||
745 | 243 | if (deck2Playing) { | ||
746 | 244 | removePlayingTrackFromQueue("[Channel2]"); | ||
747 | 245 | } | ||
748 | 246 | |||
749 | 247 | TrackPointer nextTrack = getNextTrackFromQueue(); | ||
750 | 248 | if (!nextTrack) { | ||
751 | 249 | qDebug() << "Queue is empty now"; | ||
752 | 250 | pushButtonAutoDJ->setChecked(false); | ||
753 | 251 | return; | ||
754 | 252 | } | ||
755 | 253 | |||
756 | 254 | // Track is available so GO | ||
757 | 255 | pushButtonAutoDJ->setToolTip(tr("Disable Auto DJ")); | ||
758 | 175 | pushButtonAutoDJ->setText(tr("Disable Auto DJ")); | 256 | pushButtonAutoDJ->setText(tr("Disable Auto DJ")); |
759 | 257 | qDebug() << "Auto DJ enabled"; | ||
760 | 176 | m_bAutoDJEnabled = true; | 258 | m_bAutoDJEnabled = true; |
761 | 259 | |||
762 | 177 | connect(m_pCOPlayPos1, SIGNAL(valueChanged(double)), | 260 | connect(m_pCOPlayPos1, SIGNAL(valueChanged(double)), |
764 | 178 | this, SLOT(player1PositionChanged(double))); | 261 | this, SLOT(player1PositionChanged(double))); |
765 | 179 | connect(m_pCOPlayPos2, SIGNAL(valueChanged(double)), | 262 | connect(m_pCOPlayPos2, SIGNAL(valueChanged(double)), |
824 | 180 | this, SLOT(player2PositionChanged(double))); | 263 | this, SLOT(player2PositionChanged(double))); |
825 | 181 | 264 | ||
826 | 182 | 265 | connect(m_pCOPlay1Fb, SIGNAL(valueChanged(double)), | |
827 | 183 | //Manually override the "next track is already loaded" flag | 266 | this, SLOT(player1PlayChanged(double))); |
828 | 184 | //because we've already primed a player with the first track. | 267 | connect(m_pCOPlay2Fb, SIGNAL(valueChanged(double)), |
829 | 185 | //We do this so that you don't lose the first song in your | 268 | this, SLOT(player2PlayChanged(double))); |
830 | 186 | //Auto DJ queue if you enable Auto DJ then change your mind | 269 | |
831 | 187 | //and disable it right away. This just makes it a little bit | 270 | if (!deck1Playing && !deck2Playing) { |
832 | 188 | //more user friendly. :) | 271 | // both decks are stopped |
833 | 189 | //m_bNextTrackAlreadyLoaded = true; | 272 | m_eState = ADJ_ENABLE_P1LOADED; |
834 | 190 | m_bPlayer1Primed = false; | 273 | // Force Update on load Track |
835 | 191 | m_bPlayer2Primed = false; | 274 | m_pCOPlayPos1->slotSet(-0.001f); |
836 | 192 | 275 | } else if (deck1Playing) { | |
837 | 193 | //If there are no tracks in the Auto DJ queue, disable Auto DJ mode. | 276 | // deck 1 is already playing |
838 | 194 | /* if (m_pAutoDJTableModel->rowCount() == 0) | 277 | m_eState = ADJ_IDLE; |
839 | 195 | { | 278 | player1PlayChanged(1.0f); |
840 | 196 | //Queue was empty. Disable and return. | 279 | } else { |
841 | 197 | pushButtonAutoDJ->setChecked(false); | 280 | // deck 2 is already playing |
842 | 198 | return; | 281 | m_eState = ADJ_IDLE; |
843 | 199 | }*/ //don't need this code, above block takes care of this case. | 282 | player2PlayChanged(1.0f); |
844 | 200 | 283 | } | |
845 | 201 | //If only one of the players is playing... | 284 | // Loads into first deck If stopped else into second else not |
846 | 202 | if ((m_pCOPlay1->get() == 1.0f && m_pCOPlay2->get() == 0.0f) || | 285 | emit(loadTrack(nextTrack)); |
847 | 203 | (m_pCOPlay1->get() == 0.0f && m_pCOPlay2->get() == 1.0f)) | 286 | } else { // Disable Auto DJ |
848 | 204 | { | 287 | pushButtonAutoDJ->setToolTip(tr("Enable Auto DJ")); |
791 | 205 | //Load the first song from the queue. | ||
792 | 206 | if (!loadNextTrackFromQueue(false)) { | ||
793 | 207 | //Queue was empty. Disable and return. | ||
794 | 208 | pushButtonAutoDJ->setChecked(false); | ||
795 | 209 | return; | ||
796 | 210 | } | ||
797 | 211 | //Set the primed flags so the crossfading algorithm knows | ||
798 | 212 | //that it doesn't need to load a track into whatever player. | ||
799 | 213 | if (m_pCOPlay1->get() == 1.0f) | ||
800 | 214 | { | ||
801 | 215 | m_bPlayer1Primed = true; | ||
802 | 216 | } | ||
803 | 217 | if (m_pCOPlay2->get() == 1.0f) | ||
804 | 218 | { | ||
805 | 219 | m_bPlayer2Primed = true; | ||
806 | 220 | } | ||
807 | 221 | } | ||
808 | 222 | //If both players are stopped, start the first one (which should have just had a track loaded into it) | ||
809 | 223 | else if (m_pCOPlay1->get() == 0.0f && m_pCOPlay2->get() == 0.0f) { | ||
810 | 224 | //Load the first song from the queue. | ||
811 | 225 | if (!loadNextTrackFromQueue(false)) { | ||
812 | 226 | //Queue was empty. Disable and return. | ||
813 | 227 | pushButtonAutoDJ->setChecked(false); | ||
814 | 228 | return; | ||
815 | 229 | } | ||
816 | 230 | m_pCOCrossfader->slotSet(-1.0f); //Move crossfader to the left! | ||
817 | 231 | m_pCORepeat1->slotSet(1.0f); //Turn on repeat mode to avoid race condition between async load | ||
818 | 232 | //and "play" command. | ||
819 | 233 | m_pCOPlay1->slotSet(1.0f); //Play the track in player 1 | ||
820 | 234 | } | ||
821 | 235 | } | ||
822 | 236 | else //Disable Auto DJ | ||
823 | 237 | { | ||
849 | 238 | pushButtonAutoDJ->setText(tr("Enable Auto DJ")); | 288 | pushButtonAutoDJ->setText(tr("Enable Auto DJ")); |
850 | 239 | qDebug() << "Auto DJ disabled"; | 289 | qDebug() << "Auto DJ disabled"; |
851 | 240 | m_bAutoDJEnabled = false; | 290 | m_bAutoDJEnabled = false; |
852 | 291 | m_bFadeNow = false; | ||
853 | 241 | m_pCOPlayPos1->disconnect(this); | 292 | m_pCOPlayPos1->disconnect(this); |
854 | 242 | m_pCOPlayPos2->disconnect(this); | 293 | m_pCOPlayPos2->disconnect(this); |
960 | 243 | m_pCORepeat1->slotSet(0.0f); //Turn off repeat mode | 294 | m_pCOPlay1->disconnect(this); |
961 | 244 | m_pCORepeat2->slotSet(0.0f); //Turn off repeat mode | 295 | m_pCOPlay2->disconnect(this); |
962 | 245 | } | 296 | } |
963 | 246 | } | 297 | } |
964 | 247 | 298 | ||
965 | 248 | void DlgAutoDJ::player1PositionChanged(double value) | 299 | void DlgAutoDJ::player1PositionChanged(double value) { |
966 | 249 | { | 300 | // 95% playback is when we crossfade and do stuff |
967 | 250 | const float posThreshold = 0.95; //95% playback is when we crossfade and do stuff | 301 | // const float posThreshold = 0.95; |
968 | 251 | if (value > posThreshold) | 302 | |
969 | 252 | { | 303 | // 0.05; // 5% playback is crossfade duration |
970 | 253 | //Crossfade! | 304 | const float fadeDuration = m_fadeDuration1; |
971 | 254 | float crossfadeValue = -1.0f + 2*(value-posThreshold)/(1.0f-posThreshold); | 305 | |
972 | 255 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | 306 | // qDebug() << "player1PositionChanged(" << value << ")"; |
973 | 256 | //If the second player doesn't have a new track loaded in it... | 307 | if (!m_bAutoDJEnabled) { |
974 | 257 | if (!m_bPlayer2Primed) | 308 | //nothing to do |
975 | 258 | { | 309 | return; |
976 | 259 | qDebug() << "pp1c loading"; | 310 | } |
977 | 260 | 311 | ||
978 | 261 | //Load the next track into Player 2 | 312 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; |
979 | 262 | //if (!m_bNextTrackAlreadyLoaded) //Fudge to make us not skip the first track | 313 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; |
980 | 263 | { | 314 | |
981 | 264 | if (!loadNextTrackFromQueue(true)) | 315 | if (m_eState == ADJ_ENABLE_P1LOADED) { |
982 | 265 | return; | 316 | // Auto DJ Start |
983 | 266 | } | 317 | if (!deck1Playing && !deck2Playing) { |
984 | 267 | //m_bNextTrackAlreadyLoaded = false; //Reset fudge | 318 | m_pCOCrossfader->slotSet(-1.0f); // Move crossfader to the left! |
985 | 268 | m_bPlayer2Primed = true; | 319 | m_pCOPlay1->slotSet(1.0f); // Play the track in player 1 |
986 | 269 | } | 320 | removePlayingTrackFromQueue("[Channel1]"); |
987 | 270 | //If the second player is stopped... | 321 | } else if (deck1Playing && !deck2Playing) { |
988 | 271 | if (m_pCOPlay2->get() == 0.0f) | 322 | // Here we are, if first deck was playing before starting Auto DJ |
989 | 272 | { | 323 | // or if it was started just before |
990 | 273 | //Turn off repeat mode to tell Player 1 to stop at the end | 324 | loadNextTrackFromQueue(); |
991 | 274 | m_pCORepeat1->slotSet(0.0f); | 325 | m_eState = ADJ_IDLE; |
992 | 275 | 326 | // if we start the deck from code we don`t get a signal | |
993 | 276 | //Turn on repeat mode to tell Player 2 to start playing when the new track is loaded. | 327 | player1PlayChanged(1.0f); |
994 | 277 | //This helps us get around the fact that it takes time for the track to be loaded | 328 | // call function manually |
995 | 278 | //and that is executed asynchronously (so we get around the race condition). | 329 | } else { |
996 | 279 | m_pCORepeat2->slotSet(1.0f); | 330 | m_eState = ADJ_IDLE; |
997 | 280 | //Play! | 331 | player2PlayChanged(1.0f); |
998 | 281 | m_pCOPlay2->slotSet(1.0f); | 332 | } |
999 | 282 | } | 333 | return; |
1000 | 283 | 334 | } | |
1001 | 284 | if (value == 1.0f) | 335 | |
1002 | 285 | { | 336 | if (m_eState == ADJ_P2FADING) { |
1003 | 286 | m_pCOPlay1->slotSet(0.0f); //Stop the player | 337 | if (deck1Playing && !deck2Playing) { |
1004 | 287 | m_bPlayer1Primed = false; | 338 | loadNextTrackFromQueue(); |
1005 | 288 | } | 339 | // End State |
1006 | 289 | } | 340 | m_pCOCrossfader->slotSet(-1.0f); // Move crossfader to the left! |
1007 | 290 | } | 341 | // qDebug() << "1: m_pCOCrossfader->slotSet(_-1.0f_);"; |
1008 | 291 | 342 | m_eState = ADJ_IDLE; | |
1009 | 292 | void DlgAutoDJ::player2PositionChanged(double value) | 343 | } |
1010 | 293 | { | 344 | return; |
1011 | 294 | const float posThreshold = 0.95; //95% playback is when we crossfade and do stuff | 345 | } |
1012 | 295 | if (value > posThreshold) | 346 | |
1013 | 296 | { | 347 | if (m_eState == ADJ_IDLE) { |
1014 | 297 | //Crossfade! | 348 | if (m_pCORepeat1->get() == 1.0f) { |
1015 | 298 | float crossfadeValue = 1.0f - 2*(value-posThreshold)/(1.0f-posThreshold); | 349 | // repeat disables auto DJ |
1016 | 299 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | 350 | return; |
1017 | 300 | 351 | } | |
1018 | 301 | //If the first player doesn't have the next track loaded, load a track into | 352 | } |
1019 | 302 | //it and start playing it! | 353 | |
1020 | 303 | if (!m_bPlayer1Primed) | 354 | if (value >= m_posThreshold1) { |
1021 | 304 | { | 355 | if (m_eState == ADJ_IDLE && |
1022 | 305 | //Load the next track into player 1 | 356 | (deck1Playing || m_posThreshold1 >= 1.0f)) { |
1023 | 306 | //if (!m_bNextTrackAlreadyLoaded) //Fudge to make us not skip the first track | 357 | if (!deck2Playing) { |
1024 | 307 | { | 358 | // Start Deck 2 |
1025 | 308 | if (!loadNextTrackFromQueue(true)) | 359 | player2PlayChanged(1.0f); |
1026 | 309 | return; | 360 | m_pCOPlay2->slotSet(1.0f); |
1027 | 310 | } | 361 | if (fadeDuration < 0.0f) { |
1028 | 311 | //m_bNextTrackAlreadyLoaded = false; //Reset fudge | 362 | // Scroll back for pause between tracks |
1029 | 312 | m_bPlayer1Primed = true; | 363 | m_pCOPlayPos2->slotSet(m_fadeDuration2); |
1030 | 313 | } | 364 | } |
1031 | 314 | if (m_pCOPlay1->get() == 0.0f) | 365 | } |
1032 | 315 | { | 366 | removePlayingTrackFromQueue("[Channel2]"); |
1033 | 316 | //Turn off repeat mode to tell Player 2 to stop at the end | 367 | m_eState = ADJ_P1FADING; |
1034 | 317 | m_pCORepeat2->slotSet(0.0f); | 368 | } |
1035 | 318 | 369 | ||
1036 | 319 | //Turn on repeat mode to tell Player 1 to start playing when the new track is loaded. | 370 | float posFadeEnd = math_min(1.0, m_posThreshold1 + fadeDuration); |
1037 | 320 | //This helps us get around the fact that it takes time for the track to be loaded | 371 | |
1038 | 321 | //and that is executed asynchronously (so we get around the race condition). | 372 | if (value >= posFadeEnd) { |
1039 | 322 | m_pCORepeat1->slotSet(1.0f); | 373 | // Pre-EndState |
1040 | 323 | m_pCOPlay1->slotSet(1.0f); | 374 | // m_pCOCrossfader->slotSet(1.0f); //Move crossfader to the right! |
1041 | 324 | } | 375 | |
1042 | 325 | 376 | m_pCOPlay1->slotSet(0.0f); // Stop the player | |
1043 | 326 | if (value == 1.0f) | 377 | //m_posThreshold = 1.0f - fadeDuration; // back to default |
1044 | 327 | { | 378 | |
1045 | 328 | m_pCOPlay2->slotSet(0.0f); //Stop the player | 379 | // does not work always immediately after stop |
1046 | 329 | m_bPlayer2Primed = false; | 380 | // loadNextTrackFromQueue(); |
1047 | 330 | } | 381 | // m_eState = ADJ_IDLE; // Fading ready |
1048 | 331 | } | 382 | } else { |
1049 | 332 | } | 383 | // Crossfade! |
1050 | 333 | 384 | float crossfadeValue = -1.0f + | |
1051 | 334 | 385 | 2*(value-m_posThreshold1)/(posFadeEnd-m_posThreshold1); | |
1052 | 335 | bool DlgAutoDJ::loadNextTrackFromQueue(bool removeTopMostBeforeLoading) | 386 | // crossfadeValue = -1.0f -> + 1.0f |
1053 | 336 | { | 387 | // Move crossfader to the right! |
1054 | 337 | if (removeTopMostBeforeLoading) { | 388 | m_pCOCrossfader->slotSet(crossfadeValue); |
1055 | 338 | //Only remove the top track if this isn't the start of Auto DJ mode. | 389 | // qDebug() << "1: m_pCOCrossfader->slotSet " << crossfadeValue; |
1056 | 339 | m_pAutoDJTableModel->removeTrack(m_pAutoDJTableModel->index(0, 0)); | 390 | } |
1057 | 340 | } | 391 | } |
1058 | 341 | 392 | } | |
1059 | 342 | //Get the track at the top of the playlist... | 393 | |
1060 | 343 | TrackPointer nextTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(0, 0)); | 394 | void DlgAutoDJ::player2PositionChanged(double value) { |
1061 | 344 | 395 | // 95% playback is when we crossfade and do stuff | |
1062 | 345 | if (!nextTrack) //We ran out of tracks in the queue... | 396 | // const float posThreshold = 0.95; |
1063 | 346 | { | 397 | |
1064 | 347 | //Disable auto DJ and return... | 398 | // 0.05; // 5% playback is crossfade duration |
1065 | 399 | float fadeDuration = m_fadeDuration2; | ||
1066 | 400 | |||
1067 | 401 | //qDebug() << "player2PositionChanged(" << value << ")"; | ||
1068 | 402 | if (!m_bAutoDJEnabled) { | ||
1069 | 403 | //nothing to do | ||
1070 | 404 | return; | ||
1071 | 405 | } | ||
1072 | 406 | |||
1073 | 407 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; | ||
1074 | 408 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; | ||
1075 | 409 | |||
1076 | 410 | if (m_eState == ADJ_P1FADING) { | ||
1077 | 411 | if (!deck1Playing && deck2Playing) { | ||
1078 | 412 | // End State | ||
1079 | 413 | // Move crossfader to the right! | ||
1080 | 414 | m_pCOCrossfader->slotSet(1.0f); | ||
1081 | 415 | // qDebug() << "1: m_pCOCrossfader->slotSet(_1.0f_);"; | ||
1082 | 416 | m_eState = ADJ_IDLE; | ||
1083 | 417 | loadNextTrackFromQueue(); | ||
1084 | 418 | } | ||
1085 | 419 | return; | ||
1086 | 420 | } | ||
1087 | 421 | |||
1088 | 422 | if (m_eState == ADJ_IDLE) { | ||
1089 | 423 | if (m_pCORepeat2->get() == 1.0f) { | ||
1090 | 424 | //repeat disables auto DJ | ||
1091 | 425 | return; | ||
1092 | 426 | } | ||
1093 | 427 | } | ||
1094 | 428 | |||
1095 | 429 | if (value >= m_posThreshold2) { | ||
1096 | 430 | if (m_eState == ADJ_IDLE && | ||
1097 | 431 | (deck2Playing || m_posThreshold2 >= 1.0f)) { | ||
1098 | 432 | if (!deck1Playing) { | ||
1099 | 433 | player1PlayChanged(1.0f); | ||
1100 | 434 | m_pCOPlay1->slotSet(1.0f); | ||
1101 | 435 | if (fadeDuration < 0) { | ||
1102 | 436 | // Scroll back for pause between tracks | ||
1103 | 437 | m_pCOPlayPos1->slotSet(m_fadeDuration1); | ||
1104 | 438 | } | ||
1105 | 439 | } | ||
1106 | 440 | removePlayingTrackFromQueue("[Channel1]"); | ||
1107 | 441 | m_eState = ADJ_P2FADING; | ||
1108 | 442 | } | ||
1109 | 443 | |||
1110 | 444 | float posFadeEnd = math_min(1.0, m_posThreshold2 + fadeDuration); | ||
1111 | 445 | |||
1112 | 446 | if (value >= posFadeEnd) { | ||
1113 | 447 | // Pre-End State | ||
1114 | 448 | //m_pCOCrossfader->slotSet(-1.0f); //Move crossfader to the left! | ||
1115 | 449 | |||
1116 | 450 | m_pCOPlay2->slotSet(0.0f); // Stop the player | ||
1117 | 451 | |||
1118 | 452 | //m_posThreshold = 1.0f - fadeDuration; // back to default | ||
1119 | 453 | |||
1120 | 454 | // does not work always immediately after stop | ||
1121 | 455 | // loadNextTrackFromQueue(); | ||
1122 | 456 | // m_eState = ADJ_IDLE; // Fading ready | ||
1123 | 457 | } else { | ||
1124 | 458 | //Crossfade! | ||
1125 | 459 | float crossfadeValue = 1.0f - | ||
1126 | 460 | 2*(value-m_posThreshold2)/(posFadeEnd-m_posThreshold2); | ||
1127 | 461 | // crossfadeValue = 1.0f -> + -1.0f | ||
1128 | 462 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | ||
1129 | 463 | // qDebug() << "2: m_pCOCrossfader->slotSet " << crossfadeValue; | ||
1130 | 464 | } | ||
1131 | 465 | } | ||
1132 | 466 | } | ||
1133 | 467 | |||
1134 | 468 | TrackPointer DlgAutoDJ::getNextTrackFromQueue() { | ||
1135 | 469 | // Get the track at the top of the playlist... | ||
1136 | 470 | TrackPointer nextTrack; | ||
1137 | 471 | |||
1138 | 472 | while (true) { | ||
1139 | 473 | nextTrack = m_pAutoDJTableModel->getTrack( | ||
1140 | 474 | m_pAutoDJTableModel->index(0, 0)); | ||
1141 | 475 | |||
1142 | 476 | if (nextTrack) { | ||
1143 | 477 | if (nextTrack->exists()) { | ||
1144 | 478 | // found a valid Track | ||
1145 | 479 | return nextTrack; | ||
1146 | 480 | } else { | ||
1147 | 481 | // Remove missing song from auto DJ playlist | ||
1148 | 482 | m_pAutoDJTableModel->removeTrack( | ||
1149 | 483 | m_pAutoDJTableModel->index(0, 0)); | ||
1150 | 484 | } | ||
1151 | 485 | } else { | ||
1152 | 486 | // we are running out of tracks | ||
1153 | 487 | break; | ||
1154 | 488 | } | ||
1155 | 489 | } | ||
1156 | 490 | return nextTrack; | ||
1157 | 491 | } | ||
1158 | 492 | |||
1159 | 493 | bool DlgAutoDJ::loadNextTrackFromQueue() { | ||
1160 | 494 | TrackPointer nextTrack = getNextTrackFromQueue(); | ||
1161 | 495 | |||
1162 | 496 | // We ran out of tracks in the queue... | ||
1163 | 497 | if (!nextTrack) { | ||
1164 | 498 | // Disable auto DJ and return... | ||
1165 | 348 | pushButtonAutoDJ->setChecked(false); | 499 | pushButtonAutoDJ->setChecked(false); |
1166 | 349 | return false; | 500 | return false; |
1167 | 350 | } | 501 | } |
1168 | 351 | 502 | ||
1169 | 352 | //m_bNextTrackAlreadyLoaded = false; | ||
1170 | 353 | |||
1171 | 354 | emit(loadTrack(nextTrack)); | 503 | emit(loadTrack(nextTrack)); |
1174 | 355 | 504 | return true; | |
1175 | 356 | return true; | 505 | } |
1176 | 506 | |||
1177 | 507 | bool DlgAutoDJ::removePlayingTrackFromQueue(QString group) { | ||
1178 | 508 | TrackPointer nextTrack, loadedTrack; | ||
1179 | 509 | int nextId = 0, loadedId = 0; | ||
1180 | 510 | |||
1181 | 511 | // Get the track at the top of the playlist... | ||
1182 | 512 | nextTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(0, 0)); | ||
1183 | 513 | if (nextTrack) { | ||
1184 | 514 | nextId = nextTrack->getId(); | ||
1185 | 515 | } | ||
1186 | 516 | |||
1187 | 517 | // Get loaded track | ||
1188 | 518 | loadedTrack = PlayerInfo::Instance().getTrackInfo(group); | ||
1189 | 519 | if (loadedTrack) { | ||
1190 | 520 | loadedId = loadedTrack->getId(); | ||
1191 | 521 | } | ||
1192 | 522 | |||
1193 | 523 | // When enable auto DJ and Topmost Song is already on second deck, nothing to do | ||
1194 | 524 | // BaseTrackPlayer::getLoadedTrack() | ||
1195 | 525 | // pTrack = PlayerInfo::Instance().getCurrentPlayingTrack(); | ||
1196 | 526 | |||
1197 | 527 | if (loadedId != nextId) { | ||
1198 | 528 | // Do not remove when the user has loaded a track manualy | ||
1199 | 529 | return false; | ||
1200 | 530 | } | ||
1201 | 531 | |||
1202 | 532 | // remove the top track | ||
1203 | 533 | m_pAutoDJTableModel->removeTrack(m_pAutoDJTableModel->index(0, 0)); | ||
1204 | 534 | |||
1205 | 535 | return true; | ||
1206 | 536 | } | ||
1207 | 537 | |||
1208 | 538 | void DlgAutoDJ::player1PlayChanged(double value) { | ||
1209 | 539 | //qDebug() << "player1PlayChanged(" << value << ")"; | ||
1210 | 540 | if (!m_bAutoDJEnabled) { | ||
1211 | 541 | return; | ||
1212 | 542 | } | ||
1213 | 543 | |||
1214 | 544 | if (value == 1.0f && m_eState == ADJ_IDLE) { | ||
1215 | 545 | TrackPointer loadedTrack = | ||
1216 | 546 | PlayerInfo::Instance().getTrackInfo("[Channel1]"); | ||
1217 | 547 | if (loadedTrack) { | ||
1218 | 548 | int TrackDuration = loadedTrack->getDuration(); | ||
1219 | 549 | qDebug() << "TrackDuration = " << TrackDuration; | ||
1220 | 550 | |||
1221 | 551 | int autoDjTransition = spinBoxTransition->value(); | ||
1222 | 552 | |||
1223 | 553 | if (TrackDuration > autoDjTransition) { | ||
1224 | 554 | m_fadeDuration1 = static_cast<float>(autoDjTransition) / | ||
1225 | 555 | static_cast<float>(TrackDuration); | ||
1226 | 556 | } else { | ||
1227 | 557 | m_fadeDuration1 = 0; | ||
1228 | 558 | } | ||
1229 | 559 | |||
1230 | 560 | if (autoDjTransition > 0) { | ||
1231 | 561 | m_posThreshold1 = 1.0f - m_fadeDuration1; | ||
1232 | 562 | } else { | ||
1233 | 563 | // in case of pause | ||
1234 | 564 | m_posThreshold1 = 1.0f; | ||
1235 | 565 | } | ||
1236 | 566 | qDebug() << "m_fadeDuration1 = " << m_fadeDuration1; | ||
1237 | 567 | } | ||
1238 | 568 | } | ||
1239 | 569 | } | ||
1240 | 570 | |||
1241 | 571 | void DlgAutoDJ::player2PlayChanged(double value) { | ||
1242 | 572 | //qDebug() << "player2PlayChanged(" << value << ")"; | ||
1243 | 573 | if (!m_bAutoDJEnabled) { | ||
1244 | 574 | return; | ||
1245 | 575 | } | ||
1246 | 576 | |||
1247 | 577 | if (value == 1.0f && m_eState == ADJ_IDLE) { | ||
1248 | 578 | TrackPointer loadedTrack = | ||
1249 | 579 | PlayerInfo::Instance().getTrackInfo("[Channel2]"); | ||
1250 | 580 | if (loadedTrack) { | ||
1251 | 581 | int TrackDuration = loadedTrack->getDuration(); | ||
1252 | 582 | qDebug() << "TrackDuration = " << TrackDuration; | ||
1253 | 583 | |||
1254 | 584 | int autoDjTransition = spinBoxTransition->value(); | ||
1255 | 585 | |||
1256 | 586 | if (TrackDuration > autoDjTransition) { | ||
1257 | 587 | m_fadeDuration2 = static_cast<float>(autoDjTransition) / | ||
1258 | 588 | static_cast<float>(TrackDuration); | ||
1259 | 589 | } else { | ||
1260 | 590 | m_fadeDuration2 = 0; | ||
1261 | 591 | } | ||
1262 | 592 | |||
1263 | 593 | if (autoDjTransition > 0) { | ||
1264 | 594 | m_posThreshold2 = 1.0f - m_fadeDuration2; | ||
1265 | 595 | } else { | ||
1266 | 596 | // in case of pause | ||
1267 | 597 | m_posThreshold2 = 1.0f; | ||
1268 | 598 | } | ||
1269 | 599 | qDebug() << "m_fadeDuration2 = " << m_fadeDuration2; | ||
1270 | 600 | } | ||
1271 | 601 | } | ||
1272 | 602 | } | ||
1273 | 603 | |||
1274 | 604 | void DlgAutoDJ::transitionValueChanged(int value) { | ||
1275 | 605 | if (m_bAutoDJEnabled && m_eState == ADJ_IDLE) { | ||
1276 | 606 | if (m_pCOPlay1Fb->get() == 1.0f) { | ||
1277 | 607 | player1PlayChanged(1.0f); | ||
1278 | 608 | } | ||
1279 | 609 | if (m_pCOPlay2Fb->get() == 1.0f) { | ||
1280 | 610 | player2PlayChanged(1.0f); | ||
1281 | 611 | } | ||
1282 | 612 | } | ||
1283 | 613 | m_pConfig->set(ConfigKey(CONFIG_KEY, kTransitionPreferenceName), | ||
1284 | 614 | ConfigValue(value)); | ||
1285 | 615 | } | ||
1286 | 616 | |||
1287 | 617 | bool DlgAutoDJ::appendTrack(int trackId) { | ||
1288 | 618 | return m_pAutoDJTableModel->appendTrack(trackId); | ||
1289 | 357 | } | 619 | } |
1290 | 358 | 620 | ||
1291 | === modified file 'mixxx/src/dlgautodj.h' | |||
1292 | --- mixxx/src/dlgautodj.h 2011-04-24 06:00:11 +0000 | |||
1293 | +++ mixxx/src/dlgautodj.h 2012-03-12 04:06:20 +0000 | |||
1294 | @@ -31,19 +31,35 @@ | |||
1295 | 31 | virtual void loadSelectedTrack(); | 31 | virtual void loadSelectedTrack(); |
1296 | 32 | virtual void loadSelectedTrackToGroup(QString group); | 32 | virtual void loadSelectedTrackToGroup(QString group); |
1297 | 33 | virtual void moveSelection(int delta); | 33 | virtual void moveSelection(int delta); |
1298 | 34 | virtual bool appendTrack(int trackId); | ||
1299 | 34 | 35 | ||
1300 | 35 | public slots: | 36 | public slots: |
1301 | 36 | void shufflePlaylist(bool buttonChecked); | 37 | void shufflePlaylist(bool buttonChecked); |
1302 | 38 | void skipNext(bool buttonChecked); | ||
1303 | 39 | void fadeNow(bool buttonChecked); | ||
1304 | 37 | void toggleAutoDJ(bool toggle); | 40 | void toggleAutoDJ(bool toggle); |
1305 | 38 | void player1PositionChanged(double value); | 41 | void player1PositionChanged(double value); |
1306 | 39 | void player2PositionChanged(double value); | 42 | void player2PositionChanged(double value); |
1307 | 43 | void player1PlayChanged(double value); | ||
1308 | 44 | void player2PlayChanged(double value); | ||
1309 | 45 | void transitionValueChanged(int value); | ||
1310 | 40 | 46 | ||
1311 | 41 | signals: | 47 | signals: |
1312 | 42 | void loadTrack(TrackPointer tio); | 48 | void loadTrack(TrackPointer tio); |
1313 | 43 | void loadTrackToPlayer(TrackPointer tio, QString group); | 49 | void loadTrackToPlayer(TrackPointer tio, QString group); |
1314 | 44 | 50 | ||
1315 | 45 | private: | 51 | private: |
1317 | 46 | bool loadNextTrackFromQueue(bool removeTopMostBeforeLoading); | 52 | enum ADJstates { |
1318 | 53 | ADJ_IDLE = 0, | ||
1319 | 54 | ADJ_P1FADING, | ||
1320 | 55 | ADJ_P2FADING, | ||
1321 | 56 | ADJ_ENABLE_P1LOADED, | ||
1322 | 57 | ADJ_ENABLE_P1PLAYING | ||
1323 | 58 | }; | ||
1324 | 59 | |||
1325 | 60 | TrackPointer getNextTrackFromQueue(); | ||
1326 | 61 | bool loadNextTrackFromQueue(); | ||
1327 | 62 | bool removePlayingTrackFromQueue(QString group); | ||
1328 | 47 | 63 | ||
1329 | 48 | ConfigObject<ConfigValue>* m_pConfig; | 64 | ConfigObject<ConfigValue>* m_pConfig; |
1330 | 49 | TrackCollection* m_pTrackCollection; | 65 | TrackCollection* m_pTrackCollection; |
1331 | @@ -51,17 +67,24 @@ | |||
1332 | 51 | PlaylistTableModel* m_pAutoDJTableModel; | 67 | PlaylistTableModel* m_pAutoDJTableModel; |
1333 | 52 | PlaylistDAO& m_playlistDao; | 68 | PlaylistDAO& m_playlistDao; |
1334 | 53 | bool m_bAutoDJEnabled; | 69 | bool m_bAutoDJEnabled; |
1342 | 54 | bool m_bNextTrackAlreadyLoaded; /** Makes our Auto DJ logic assume the | 70 | |
1343 | 55 | next track that should be played is | 71 | // Makes our Auto DJ logic assume the next track that should be played is |
1344 | 56 | already loaded. We need this flag to | 72 | // already loaded. We need this flag to make our |
1345 | 57 | make our first-track-gets-loaded-but- | 73 | // first-track-gets-loaded-but- not-removed-from-the-queue behaviour work. |
1346 | 58 | not-removed-from-the-queue behaviour | 74 | bool m_bNextTrackAlreadyLoaded; |
1347 | 59 | work. */ | 75 | |
1348 | 60 | bool m_bPlayer1Primed, m_bPlayer2Primed; | 76 | bool m_bFadeNow; |
1349 | 77 | enum ADJstates m_eState; | ||
1350 | 78 | float m_posThreshold1; | ||
1351 | 79 | float m_posThreshold2; | ||
1352 | 80 | float m_fadeDuration1; | ||
1353 | 81 | float m_fadeDuration2; | ||
1354 | 61 | ControlObjectThreadMain* m_pCOPlayPos1; | 82 | ControlObjectThreadMain* m_pCOPlayPos1; |
1355 | 62 | ControlObjectThreadMain* m_pCOPlayPos2; | 83 | ControlObjectThreadMain* m_pCOPlayPos2; |
1356 | 63 | ControlObjectThreadMain* m_pCOPlay1; | 84 | ControlObjectThreadMain* m_pCOPlay1; |
1357 | 64 | ControlObjectThreadMain* m_pCOPlay2; | 85 | ControlObjectThreadMain* m_pCOPlay2; |
1358 | 86 | ControlObjectThreadMain* m_pCOPlay1Fb; | ||
1359 | 87 | ControlObjectThreadMain* m_pCOPlay2Fb; | ||
1360 | 65 | ControlObjectThreadMain* m_pCORepeat1; | 88 | ControlObjectThreadMain* m_pCORepeat1; |
1361 | 66 | ControlObjectThreadMain* m_pCORepeat2; | 89 | ControlObjectThreadMain* m_pCORepeat2; |
1362 | 67 | ControlObjectThreadMain* m_pCOCrossfader; | 90 | ControlObjectThreadMain* m_pCOCrossfader; |
1363 | @@ -82,7 +105,7 @@ | |||
1364 | 82 | 105 | ||
1365 | 83 | 106 | ||
1366 | 84 | #define _blah if ((QDate::currentDate().day() == 1) && (QDate::currentDate().month() == 4)) \ | 107 | #define _blah if ((QDate::currentDate().day() == 1) && (QDate::currentDate().month() == 4)) \ |
1368 | 85 | pushButtonAutoDJ->setText("\x45\x6e\x61\x62\x6c\x65\x20\x50\x65\x65" \ | 108 | pushButtonAutoDJ->setText("\x45\x6e\x61\x62\x6c\x65\x20\x50\x65\x65" \ |
1369 | 86 | "\x20\x42\x72\x65\x61\x6b\x20\x4d\x6f\x64\x65") | 109 | "\x20\x42\x72\x65\x61\x6b\x20\x4d\x6f\x64\x65") |
1370 | 87 | 110 | ||
1371 | 88 | 111 | ||
1372 | 89 | 112 | ||
1373 | === modified file 'mixxx/src/dlgautodj.ui' | |||
1374 | --- mixxx/src/dlgautodj.ui 2011-10-05 03:30:02 +0000 | |||
1375 | +++ mixxx/src/dlgautodj.ui 2012-03-12 04:06:20 +0000 | |||
1376 | @@ -6,13 +6,28 @@ | |||
1377 | 6 | <rect> | 6 | <rect> |
1378 | 7 | <x>0</x> | 7 | <x>0</x> |
1379 | 8 | <y>0</y> | 8 | <y>0</y> |
1381 | 9 | <width>582</width> | 9 | <width>500</width> |
1382 | 10 | <height>399</height> | 10 | <height>399</height> |
1383 | 11 | </rect> | 11 | </rect> |
1384 | 12 | </property> | 12 | </property> |
1385 | 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
1386 | 14 | <string>Manage</string> | 14 | <string>Manage</string> |
1387 | 15 | </property> | 15 | </property> |
1388 | 16 | <property name="styleSheet"> | ||
1389 | 17 | <string notr="true">#pushButtonShuffle{ | ||
1390 | 18 | border-image: url(:/images/autodj/media-playlist-shuffle.svg); | ||
1391 | 19 | } | ||
1392 | 20 | |||
1393 | 21 | #pushButtonSkipNext{ | ||
1394 | 22 | border-image: url(:/images/autodj/bottom.svg); | ||
1395 | 23 | } | ||
1396 | 24 | |||
1397 | 25 | #pushButtonFadeNow{ | ||
1398 | 26 | border-image: url(:/images/autodj/stock_mail-send-receive.svg); | ||
1399 | 27 | } | ||
1400 | 28 | |||
1401 | 29 | </string> | ||
1402 | 30 | </property> | ||
1403 | 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 31 | <layout class="QVBoxLayout" name="verticalLayout"> |
1404 | 17 | <property name="leftMargin"> | 32 | <property name="leftMargin"> |
1405 | 18 | <number>0</number> | 33 | <number>0</number> |
1406 | @@ -25,13 +40,89 @@ | |||
1407 | 25 | </property> | 40 | </property> |
1408 | 26 | <item> | 41 | <item> |
1409 | 27 | <layout class="QHBoxLayout" name="horizontalLayout"> | 42 | <layout class="QHBoxLayout" name="horizontalLayout"> |
1410 | 43 | <property name="sizeConstraint"> | ||
1411 | 44 | <enum>QLayout::SetMinimumSize</enum> | ||
1412 | 45 | </property> | ||
1413 | 28 | <item> | 46 | <item> |
1414 | 29 | <widget class="QPushButton" name="pushButtonShuffle"> | 47 | <widget class="QPushButton" name="pushButtonShuffle"> |
1420 | 30 | <property name="text"> | 48 | <property name="maximumSize"> |
1421 | 31 | <string>Shuffle playlist</string> | 49 | <size> |
1422 | 32 | </property> | 50 | <width>24</width> |
1423 | 33 | <property name="checkable"> | 51 | <height>24</height> |
1424 | 34 | <bool>false</bool> | 52 | </size> |
1425 | 53 | </property> | ||
1426 | 54 | <property name="toolTip"> | ||
1427 | 55 | <string>Shuffle Playlist</string> | ||
1428 | 56 | </property> | ||
1429 | 57 | <property name="text"> | ||
1430 | 58 | <string/> | ||
1431 | 59 | </property> | ||
1432 | 60 | <property name="checkable"> | ||
1433 | 61 | <bool>false</bool> | ||
1434 | 62 | </property> | ||
1435 | 63 | </widget> | ||
1436 | 64 | </item> | ||
1437 | 65 | <item> | ||
1438 | 66 | <widget class="QPushButton" name="pushButtonSkipNext"> | ||
1439 | 67 | <property name="maximumSize"> | ||
1440 | 68 | <size> | ||
1441 | 69 | <width>24</width> | ||
1442 | 70 | <height>24</height> | ||
1443 | 71 | </size> | ||
1444 | 72 | </property> | ||
1445 | 73 | <property name="toolTip"> | ||
1446 | 74 | <string>Skip Next Track</string> | ||
1447 | 75 | </property> | ||
1448 | 76 | <property name="text"> | ||
1449 | 77 | <string/> | ||
1450 | 78 | </property> | ||
1451 | 79 | <property name="checkable"> | ||
1452 | 80 | <bool>false</bool> | ||
1453 | 81 | </property> | ||
1454 | 82 | </widget> | ||
1455 | 83 | </item> | ||
1456 | 84 | <item> | ||
1457 | 85 | <widget class="QLabel" name="label_2"> | ||
1458 | 86 | <property name="text"> | ||
1459 | 87 | <string>Transition [sec]</string> | ||
1460 | 88 | </property> | ||
1461 | 89 | </widget> | ||
1462 | 90 | </item> | ||
1463 | 91 | <item> | ||
1464 | 92 | <widget class="QSpinBox" name="spinBoxTransition"> | ||
1465 | 93 | <property name="sizePolicy"> | ||
1466 | 94 | <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
1467 | 95 | <horstretch>0</horstretch> | ||
1468 | 96 | <verstretch>0</verstretch> | ||
1469 | 97 | </sizepolicy> | ||
1470 | 98 | </property> | ||
1471 | 99 | <property name="maximumSize"> | ||
1472 | 100 | <size> | ||
1473 | 101 | <width>45</width> | ||
1474 | 102 | <height>16777215</height> | ||
1475 | 103 | </size> | ||
1476 | 104 | </property> | ||
1477 | 105 | <property name="alignment"> | ||
1478 | 106 | <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | ||
1479 | 107 | </property> | ||
1480 | 108 | <property name="minimum"> | ||
1481 | 109 | <number>-9</number> | ||
1482 | 110 | </property> | ||
1483 | 111 | </widget> | ||
1484 | 112 | </item> | ||
1485 | 113 | <item> | ||
1486 | 114 | <widget class="QPushButton" name="pushButtonFadeNow"> | ||
1487 | 115 | <property name="maximumSize"> | ||
1488 | 116 | <size> | ||
1489 | 117 | <width>24</width> | ||
1490 | 118 | <height>24</height> | ||
1491 | 119 | </size> | ||
1492 | 120 | </property> | ||
1493 | 121 | <property name="toolTip"> | ||
1494 | 122 | <string>Fade Now</string> | ||
1495 | 123 | </property> | ||
1496 | 124 | <property name="text"> | ||
1497 | 125 | <string/> | ||
1498 | 35 | </property> | 126 | </property> |
1499 | 36 | </widget> | 127 | </widget> |
1500 | 37 | </item> | 128 | </item> |
1501 | @@ -42,24 +133,17 @@ | |||
1502 | 42 | </property> | 133 | </property> |
1503 | 43 | <property name="sizeHint" stdset="0"> | 134 | <property name="sizeHint" stdset="0"> |
1504 | 44 | <size> | 135 | <size> |
1506 | 45 | <width>40</width> | 136 | <width>1</width> |
1507 | 46 | <height>20</height> | 137 | <height>20</height> |
1508 | 47 | </size> | 138 | </size> |
1509 | 48 | </property> | 139 | </property> |
1510 | 49 | </spacer> | 140 | </spacer> |
1511 | 50 | </item> | 141 | </item> |
1512 | 51 | <item> | 142 | <item> |
1513 | 52 | <widget class="QLabel" name="label"> | ||
1514 | 53 | <property name="text"> | ||
1515 | 54 | <string>Add tracks to the queue below...</string> | ||
1516 | 55 | </property> | ||
1517 | 56 | <property name="buddy" > | ||
1518 | 57 | <cstring>m_pTrackTablePlaceholder</cstring> | ||
1519 | 58 | </property> | ||
1520 | 59 | </widget> | ||
1521 | 60 | </item> | ||
1522 | 61 | <item> | ||
1523 | 62 | <widget class="QPushButton" name="pushButtonAutoDJ"> | 143 | <widget class="QPushButton" name="pushButtonAutoDJ"> |
1524 | 144 | <property name="toolTip"> | ||
1525 | 145 | <string>Enable Auto DJ</string> | ||
1526 | 146 | </property> | ||
1527 | 63 | <property name="text"> | 147 | <property name="text"> |
1528 | 64 | <string>Enable Auto DJ</string> | 148 | <string>Enable Auto DJ</string> |
1529 | 65 | </property> | 149 | </property> |
1530 | @@ -88,6 +172,12 @@ | |||
1531 | 88 | </item> | 172 | </item> |
1532 | 89 | <item> | 173 | <item> |
1533 | 90 | <widget class="QTableView" name="m_pTrackTablePlaceholder"> | 174 | <widget class="QTableView" name="m_pTrackTablePlaceholder"> |
1534 | 175 | <property name="sizePolicy"> | ||
1535 | 176 | <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||
1536 | 177 | <horstretch>0</horstretch> | ||
1537 | 178 | <verstretch>0</verstretch> | ||
1538 | 179 | </sizepolicy> | ||
1539 | 180 | </property> | ||
1540 | 91 | <property name="showGrid"> | 181 | <property name="showGrid"> |
1541 | 92 | <bool>true</bool> | 182 | <bool>true</bool> |
1542 | 93 | </property> | 183 | </property> |
1543 | @@ -95,6 +185,8 @@ | |||
1544 | 95 | </item> | 185 | </item> |
1545 | 96 | </layout> | 186 | </layout> |
1546 | 97 | </widget> | 187 | </widget> |
1548 | 98 | <resources/> | 188 | <resources> |
1549 | 189 | <include location="../res/mixxx.qrc"/> | ||
1550 | 190 | </resources> | ||
1551 | 99 | <connections/> | 191 | <connections/> |
1552 | 100 | </ui> | 192 | </ui> |
1553 | 101 | 193 | ||
1554 | === modified file 'mixxx/src/library/autodjfeature.cpp' | |||
1555 | --- mixxx/src/library/autodjfeature.cpp 2011-10-12 17:29:43 +0000 | |||
1556 | +++ mixxx/src/library/autodjfeature.cpp 2012-03-12 04:06:20 +0000 | |||
1557 | @@ -23,6 +23,7 @@ | |||
1558 | 23 | m_pConfig(pConfig), | 23 | m_pConfig(pConfig), |
1559 | 24 | m_pTrackCollection(pTrackCollection), | 24 | m_pTrackCollection(pTrackCollection), |
1560 | 25 | m_playlistDao(pTrackCollection->getPlaylistDAO()) { | 25 | m_playlistDao(pTrackCollection->getPlaylistDAO()) { |
1561 | 26 | m_pAutoDJView = NULL; | ||
1562 | 26 | } | 27 | } |
1563 | 27 | 28 | ||
1564 | 28 | AutoDJFeature::~AutoDJFeature() { | 29 | AutoDJFeature::~AutoDJFeature() { |
1565 | @@ -36,47 +37,43 @@ | |||
1566 | 36 | return QIcon(":/images/library/ic_library_autodj.png"); | 37 | return QIcon(":/images/library/ic_library_autodj.png"); |
1567 | 37 | } | 38 | } |
1568 | 38 | 39 | ||
1570 | 39 | void AutoDJFeature::bindWidget(WLibrarySidebar* sidebarWidget, | 40 | void AutoDJFeature::bindWidget(WLibrarySidebar* /*sidebarWidget*/, |
1571 | 40 | WLibrary* libraryWidget, | 41 | WLibrary* libraryWidget, |
1572 | 41 | MixxxKeyboard* keyboard) { | 42 | MixxxKeyboard* keyboard) { |
1581 | 42 | 43 | m_pAutoDJView = new DlgAutoDJ(libraryWidget, | |
1582 | 43 | DlgAutoDJ* pAutoDJView = new DlgAutoDJ(libraryWidget, | 44 | m_pConfig, |
1583 | 44 | m_pConfig, | 45 | m_pTrackCollection, |
1584 | 45 | m_pTrackCollection, | 46 | keyboard); |
1585 | 46 | keyboard); | 47 | m_pAutoDJView->installEventFilter(keyboard); |
1586 | 47 | pAutoDJView->installEventFilter(keyboard); | 48 | libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); |
1587 | 48 | libraryWidget->registerView(m_sAutoDJViewName, pAutoDJView); | 49 | connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), |
1580 | 49 | connect(pAutoDJView, SIGNAL(loadTrack(TrackPointer)), | ||
1588 | 50 | this, SIGNAL(loadTrack(TrackPointer))); | 50 | this, SIGNAL(loadTrack(TrackPointer))); |
1590 | 51 | connect(pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), | 51 | connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), |
1591 | 52 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); | 52 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); |
1592 | 53 | } | 53 | } |
1593 | 54 | 54 | ||
1594 | 55 | TreeItemModel* AutoDJFeature::getChildModel() { | 55 | TreeItemModel* AutoDJFeature::getChildModel() { |
1596 | 56 | return &m_childModel; | 56 | return &m_childModel; |
1597 | 57 | } | 57 | } |
1598 | 58 | 58 | ||
1599 | 59 | void AutoDJFeature::activate() { | 59 | void AutoDJFeature::activate() { |
1600 | 60 | //qDebug() << "AutoDJFeature::activate()"; | 60 | //qDebug() << "AutoDJFeature::activate()"; |
1601 | 61 | //emit(showTrackModel(m_pAutoDJTableModelProxy)); | 61 | //emit(showTrackModel(m_pAutoDJTableModelProxy)); |
1614 | 62 | emit(switchToView("Auto DJ")); | 62 | emit(switchToView(m_sAutoDJViewName)); |
1615 | 63 | } | 63 | } |
1616 | 64 | 64 | ||
1617 | 65 | void AutoDJFeature::activateChild(const QModelIndex& index) { | 65 | void AutoDJFeature::activateChild(const QModelIndex& /*index*/) { |
1618 | 66 | 66 | } | |
1619 | 67 | } | 67 | |
1620 | 68 | 68 | void AutoDJFeature::onRightClick(const QPoint& /*globalPos*/) { | |
1621 | 69 | void AutoDJFeature::onRightClick(const QPoint& globalPos) { | 69 | } |
1622 | 70 | } | 70 | |
1623 | 71 | 71 | void AutoDJFeature::onRightClickChild(const QPoint& /*globalPos*/, | |
1624 | 72 | void AutoDJFeature::onRightClickChild(const QPoint& globalPos, | 72 | QModelIndex /*index*/) { |
1613 | 73 | QModelIndex index) { | ||
1625 | 74 | } | 73 | } |
1626 | 75 | 74 | ||
1627 | 76 | bool AutoDJFeature::dropAccept(QUrl url) { | 75 | bool AutoDJFeature::dropAccept(QUrl url) { |
1628 | 77 | |||
1629 | 78 | //TODO: Filter by supported formats regex and reject anything that doesn't match. | 76 | //TODO: Filter by supported formats regex and reject anything that doesn't match. |
1630 | 79 | |||
1631 | 80 | TrackDAO &trackDao = m_pTrackCollection->getTrackDAO(); | 77 | TrackDAO &trackDao = m_pTrackCollection->getTrackDAO(); |
1632 | 81 | 78 | ||
1633 | 82 | //If a track is dropped onto a playlist's name, but the track isn't in the library, | 79 | //If a track is dropped onto a playlist's name, but the track isn't in the library, |
1634 | @@ -98,12 +95,17 @@ | |||
1635 | 98 | } | 95 | } |
1636 | 99 | 96 | ||
1637 | 100 | // TODO(XXX) No feedback on whether this worked. | 97 | // TODO(XXX) No feedback on whether this worked. |
1640 | 101 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | 98 | if (m_pAutoDJView) { |
1641 | 102 | m_playlistDao.appendTrackToPlaylist(trackId, playlistId); | 99 | m_pAutoDJView->appendTrack(trackId); |
1642 | 100 | } else { | ||
1643 | 101 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | ||
1644 | 102 | m_playlistDao.appendTrackToPlaylist(trackId, playlistId); | ||
1645 | 103 | } | ||
1646 | 104 | |||
1647 | 103 | return true; | 105 | return true; |
1648 | 104 | } | 106 | } |
1649 | 105 | 107 | ||
1651 | 106 | bool AutoDJFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { | 108 | bool AutoDJFeature::dropAcceptChild(const QModelIndex& /*index*/, QUrl /*url*/) { |
1652 | 107 | return false; | 109 | return false; |
1653 | 108 | } | 110 | } |
1654 | 109 | 111 | ||
1655 | @@ -112,10 +114,10 @@ | |||
1656 | 112 | return SoundSourceProxy::isFilenameSupported(file.fileName()); | 114 | return SoundSourceProxy::isFilenameSupported(file.fileName()); |
1657 | 113 | } | 115 | } |
1658 | 114 | 116 | ||
1661 | 115 | bool AutoDJFeature::dragMoveAcceptChild(const QModelIndex& index, | 117 | bool AutoDJFeature::dragMoveAcceptChild(const QModelIndex& /*index*/, |
1662 | 116 | QUrl url) { | 118 | QUrl /*url*/) { |
1663 | 117 | return false; | 119 | return false; |
1664 | 118 | } | 120 | } |
1666 | 119 | void AutoDJFeature::onLazyChildExpandation(const QModelIndex &index){ | 121 | void AutoDJFeature::onLazyChildExpandation(const QModelIndex& /*index*/){ |
1667 | 120 | //Nothing to do because the childmodel is not of lazy nature. | 122 | //Nothing to do because the childmodel is not of lazy nature. |
1668 | 121 | } | 123 | } |
1669 | 122 | 124 | ||
1670 | === modified file 'mixxx/src/library/autodjfeature.h' | |||
1671 | --- mixxx/src/library/autodjfeature.h 2011-03-10 13:37:21 +0000 | |||
1672 | +++ mixxx/src/library/autodjfeature.h 2012-03-12 04:06:20 +0000 | |||
1673 | @@ -11,13 +11,14 @@ | |||
1674 | 11 | #include "library/dao/playlistdao.h" | 11 | #include "library/dao/playlistdao.h" |
1675 | 12 | #include "configobject.h" | 12 | #include "configobject.h" |
1676 | 13 | #include "treeitemmodel.h" | 13 | #include "treeitemmodel.h" |
1677 | 14 | #include "dlgautodj.h" | ||
1678 | 14 | 15 | ||
1679 | 15 | class PlaylistTableModel; | 16 | class PlaylistTableModel; |
1680 | 16 | class TrackCollection; | 17 | class TrackCollection; |
1681 | 17 | 18 | ||
1682 | 18 | class AutoDJFeature : public LibraryFeature { | 19 | class AutoDJFeature : public LibraryFeature { |
1683 | 19 | Q_OBJECT | 20 | Q_OBJECT |
1685 | 20 | public: | 21 | public: |
1686 | 21 | AutoDJFeature(QObject* parent, | 22 | AutoDJFeature(QObject* parent, |
1687 | 22 | ConfigObject<ConfigValue>* pConfig, | 23 | ConfigObject<ConfigValue>* pConfig, |
1688 | 23 | TrackCollection* pTrackCollection); | 24 | TrackCollection* pTrackCollection); |
1689 | @@ -37,19 +38,20 @@ | |||
1690 | 37 | 38 | ||
1691 | 38 | TreeItemModel* getChildModel(); | 39 | TreeItemModel* getChildModel(); |
1692 | 39 | 40 | ||
1694 | 40 | public slots: | 41 | public slots: |
1695 | 41 | void activate(); | 42 | void activate(); |
1696 | 42 | void activateChild(const QModelIndex& index); | 43 | void activateChild(const QModelIndex& index); |
1697 | 43 | void onRightClick(const QPoint& globalPos); | 44 | void onRightClick(const QPoint& globalPos); |
1698 | 44 | void onRightClickChild(const QPoint& globalPos, QModelIndex index); | 45 | void onRightClickChild(const QPoint& globalPos, QModelIndex index); |
1699 | 45 | void onLazyChildExpandation(const QModelIndex& index); | 46 | void onLazyChildExpandation(const QModelIndex& index); |
1700 | 46 | 47 | ||
1702 | 47 | private: | 48 | private: |
1703 | 48 | ConfigObject<ConfigValue>* m_pConfig; | 49 | ConfigObject<ConfigValue>* m_pConfig; |
1704 | 49 | TrackCollection* m_pTrackCollection; | 50 | TrackCollection* m_pTrackCollection; |
1705 | 50 | PlaylistDAO& m_playlistDao; | 51 | PlaylistDAO& m_playlistDao; |
1706 | 51 | const static QString m_sAutoDJViewName; | 52 | const static QString m_sAutoDJViewName; |
1707 | 52 | TreeItemModel m_childModel; | 53 | TreeItemModel m_childModel; |
1708 | 54 | DlgAutoDJ* m_pAutoDJView; | ||
1709 | 53 | }; | 55 | }; |
1710 | 54 | 56 | ||
1711 | 55 | 57 | ||
1712 | 56 | 58 | ||
1713 | === modified file 'mixxx/src/library/browse/browsefeature.cpp' | |||
1714 | --- mixxx/src/library/browse/browsefeature.cpp 2012-01-07 08:36:51 +0000 | |||
1715 | +++ mixxx/src/library/browse/browsefeature.cpp 2012-03-12 04:06:20 +0000 | |||
1716 | @@ -14,7 +14,8 @@ | |||
1717 | 14 | #include "library/trackcollection.h" | 14 | #include "library/trackcollection.h" |
1718 | 15 | #include "library/dao/trackdao.h" | 15 | #include "library/dao/trackdao.h" |
1719 | 16 | 16 | ||
1721 | 17 | BrowseFeature::BrowseFeature(QObject* parent, ConfigObject<ConfigValue>* pConfig, | 17 | BrowseFeature::BrowseFeature(QObject* parent, |
1722 | 18 | ConfigObject<ConfigValue>* pConfig, | ||
1723 | 18 | TrackCollection* pTrackCollection, | 19 | TrackCollection* pTrackCollection, |
1724 | 19 | RecordingManager* pRecordingManager) | 20 | RecordingManager* pRecordingManager) |
1725 | 20 | : LibraryFeature(parent), | 21 | : LibraryFeature(parent), |
1726 | @@ -22,44 +23,47 @@ | |||
1727 | 22 | m_browseModel(this, pTrackCollection, pRecordingManager), | 23 | m_browseModel(this, pTrackCollection, pRecordingManager), |
1728 | 23 | m_proxyModel(&m_browseModel), | 24 | m_proxyModel(&m_browseModel), |
1729 | 24 | m_pTrackCollection(pTrackCollection) { | 25 | m_pTrackCollection(pTrackCollection) { |
1730 | 25 | |||
1731 | 26 | m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive); | 26 | m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive); |
1732 | 27 | m_proxyModel.setSortCaseSensitivity(Qt::CaseInsensitive); | 27 | m_proxyModel.setSortCaseSensitivity(Qt::CaseInsensitive); |
1733 | 28 | 28 | ||
1735 | 29 | //The invisible root item of the child model | 29 | // The invisible root item of the child model |
1736 | 30 | TreeItem* rootItem = new TreeItem(); | 30 | TreeItem* rootItem = new TreeItem(); |
1737 | 31 | 31 | ||
1739 | 32 | TreeItem* quick_link = new TreeItem(tr("Quick Links"), QUICK_LINK_NODE ,this , rootItem); | 32 | TreeItem* quick_link = new TreeItem( |
1740 | 33 | tr("Quick Links"), QUICK_LINK_NODE, this, rootItem); | ||
1741 | 33 | rootItem->appendChild(quick_link); | 34 | rootItem->appendChild(quick_link); |
1742 | 34 | 35 | ||
1744 | 35 | //Create the 'devices' shortcut | 36 | // Create the 'devices' shortcut |
1745 | 36 | #if defined(__WINDOWS__) | 37 | #if defined(__WINDOWS__) |
1747 | 37 | TreeItem* devices_link = new TreeItem(tr("Devices"), DEVICE_NODE ,this , rootItem); | 38 | TreeItem* devices_link = new TreeItem( |
1748 | 39 | tr("Devices"), DEVICE_NODE, this, rootItem); | ||
1749 | 38 | rootItem->appendChild(devices_link); | 40 | rootItem->appendChild(devices_link); |
1751 | 39 | //show drive letters | 41 | // show drive letters |
1752 | 40 | QFileInfoList drives = QDir::drives(); | 42 | QFileInfoList drives = QDir::drives(); |
1755 | 41 | //show drive letters | 43 | // show drive letters |
1756 | 42 | foreach(QFileInfo drive, drives){ | 44 | foreach (QFileInfo drive, drives) { |
1757 | 43 | TreeItem* driveLetter = new TreeItem( | 45 | TreeItem* driveLetter = new TreeItem( |
1762 | 44 | drive.canonicalPath(), // displays C: | 46 | drive.canonicalPath(), // displays C: |
1763 | 45 | drive.filePath(), //Displays C:/ | 47 | drive.filePath(), // Displays C:/ |
1764 | 46 | this , | 48 | this , |
1765 | 47 | devices_link); | 49 | devices_link); |
1766 | 48 | devices_link->appendChild(driveLetter); | 50 | devices_link->appendChild(driveLetter); |
1767 | 49 | } | 51 | } |
1768 | 50 | #elif defined(__APPLE__) | 52 | #elif defined(__APPLE__) |
1772 | 51 | //Apple hides the base Linux file structure | 53 | // Apple hides the base Linux file structure But all devices are mounted at |
1773 | 52 | //But all devices are mounted at /Volumes | 54 | // /Volumes |
1774 | 53 | TreeItem* devices_link = new TreeItem(tr("Devices"), "/Volumes/", this , rootItem); | 55 | TreeItem* devices_link = new TreeItem( |
1775 | 56 | tr("Devices"), "/Volumes/", this, rootItem); | ||
1776 | 54 | rootItem->appendChild(devices_link); | 57 | rootItem->appendChild(devices_link); |
1779 | 55 | #else //LINUX | 58 | #else // LINUX |
1780 | 56 | TreeItem* devices_link = new TreeItem(tr("Removable Devices"), "/media/", this , rootItem); | 59 | TreeItem* devices_link = new TreeItem( |
1781 | 60 | tr("Removable Devices"), "/media/", this, rootItem); | ||
1782 | 57 | rootItem->appendChild(devices_link); | 61 | rootItem->appendChild(devices_link); |
1783 | 58 | 62 | ||
1786 | 59 | //show root directory on UNIX-based operating systems | 63 | // show root directory on UNIX-based operating systems |
1787 | 60 | TreeItem* root_folder_item = new TreeItem(QDir::rootPath(), QDir::rootPath(),this , rootItem); | 64 | TreeItem* root_folder_item = new TreeItem( |
1788 | 65 | QDir::rootPath(), QDir::rootPath(), this, rootItem); | ||
1789 | 61 | rootItem->appendChild(root_folder_item); | 66 | rootItem->appendChild(root_folder_item); |
1790 | 62 | |||
1791 | 63 | #endif | 67 | #endif |
1792 | 64 | 68 | ||
1793 | 65 | /* | 69 | /* |
1794 | @@ -76,34 +80,43 @@ | |||
1795 | 76 | * deletion. | 80 | * deletion. |
1796 | 77 | */ | 81 | */ |
1797 | 78 | 82 | ||
1804 | 79 | //Add a shortcut to the Music folder which Mixxx uses | 83 | // Add a shortcut to the Music folder which Mixxx uses |
1805 | 80 | QString mixxx_music_dir = m_pConfig->getValueString(ConfigKey("[Playlist]","Directory")); | 84 | QString mixxx_music_dir = m_pConfig->getValueString( |
1806 | 81 | QString os_music_folder_dir = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); | 85 | ConfigKey("[Playlist]", "Directory")); |
1807 | 82 | QString os_documents_folder_dir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); | 86 | QString os_music_folder_dir = QDesktopServices::storageLocation( |
1808 | 83 | QString os_home_folder_dir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation); | 87 | QDesktopServices::MusicLocation); |
1809 | 84 | QString os_desktop_folder_dir = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); | 88 | QString os_documents_folder_dir = QDesktopServices::storageLocation( |
1810 | 89 | QDesktopServices::DocumentsLocation); | ||
1811 | 90 | QString os_home_folder_dir = QDesktopServices::storageLocation( | ||
1812 | 91 | QDesktopServices::HomeLocation); | ||
1813 | 92 | QString os_desktop_folder_dir = QDesktopServices::storageLocation( | ||
1814 | 93 | QDesktopServices::DesktopLocation); | ||
1815 | 85 | 94 | ||
1817 | 86 | TreeItem* mixxx_library_dir_item = new TreeItem(tr("Mixxx Library"), mixxx_music_dir +"/" ,this , quick_link); | 95 | TreeItem* mixxx_library_dir_item = new TreeItem( |
1818 | 96 | tr("Mixxx Library"), mixxx_music_dir + "/", this, quick_link); | ||
1819 | 87 | quick_link->appendChild(mixxx_library_dir_item); | 97 | quick_link->appendChild(mixxx_library_dir_item); |
1820 | 88 | 98 | ||
1822 | 89 | TreeItem*os_home_dir_item = new TreeItem(tr("Home"), os_home_folder_dir +"/" , this , quick_link); | 99 | TreeItem* os_home_dir_item = new TreeItem( |
1823 | 100 | tr("Home"), os_home_folder_dir + "/", this, quick_link); | ||
1824 | 90 | quick_link->appendChild(os_home_dir_item); | 101 | quick_link->appendChild(os_home_dir_item); |
1825 | 91 | 102 | ||
1827 | 92 | TreeItem*os_music_dir_item = new TreeItem(tr("Music"), os_music_folder_dir +"/" , this , quick_link); | 103 | TreeItem* os_music_dir_item = new TreeItem( |
1828 | 104 | tr("Music"), os_music_folder_dir + "/", this, quick_link); | ||
1829 | 93 | quick_link->appendChild(os_music_dir_item); | 105 | quick_link->appendChild(os_music_dir_item); |
1830 | 94 | 106 | ||
1832 | 95 | TreeItem*os_docs_dir_item = new TreeItem(tr("Documents"), os_documents_folder_dir +"/" , this , quick_link); | 107 | TreeItem* os_docs_dir_item = new TreeItem( |
1833 | 108 | tr("Documents"), os_documents_folder_dir + "/", this, quick_link); | ||
1834 | 96 | quick_link->appendChild(os_docs_dir_item); | 109 | quick_link->appendChild(os_docs_dir_item); |
1835 | 97 | 110 | ||
1837 | 98 | TreeItem*os_desktop_dir_item = new TreeItem(tr("Desktop"), os_desktop_folder_dir +"/" , this , quick_link); | 111 | TreeItem* os_desktop_dir_item = new TreeItem( |
1838 | 112 | tr("Desktop"), os_desktop_folder_dir + "/", this, quick_link); | ||
1839 | 99 | quick_link->appendChild(os_desktop_dir_item); | 113 | quick_link->appendChild(os_desktop_dir_item); |
1840 | 100 | 114 | ||
1842 | 101 | //initialize the model | 115 | // initialize the model |
1843 | 102 | m_childModel.setRootItem(rootItem); | 116 | m_childModel.setRootItem(rootItem); |
1844 | 103 | } | 117 | } |
1845 | 104 | 118 | ||
1846 | 105 | BrowseFeature::~BrowseFeature() { | 119 | BrowseFeature::~BrowseFeature() { |
1847 | 106 | |||
1848 | 107 | } | 120 | } |
1849 | 108 | 121 | ||
1850 | 109 | QVariant BrowseFeature::title() { | 122 | QVariant BrowseFeature::title() { |
1851 | @@ -119,18 +132,24 @@ | |||
1852 | 119 | } | 132 | } |
1853 | 120 | 133 | ||
1854 | 121 | bool BrowseFeature::dropAccept(QUrl url) { | 134 | bool BrowseFeature::dropAccept(QUrl url) { |
1855 | 135 | Q_UNUSED(url); | ||
1856 | 122 | return false; | 136 | return false; |
1857 | 123 | } | 137 | } |
1858 | 124 | 138 | ||
1859 | 125 | bool BrowseFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { | 139 | bool BrowseFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { |
1860 | 140 | Q_UNUSED(index); | ||
1861 | 141 | Q_UNUSED(url); | ||
1862 | 126 | return false; | 142 | return false; |
1863 | 127 | } | 143 | } |
1864 | 128 | 144 | ||
1865 | 129 | bool BrowseFeature::dragMoveAccept(QUrl url) { | 145 | bool BrowseFeature::dragMoveAccept(QUrl url) { |
1866 | 146 | Q_UNUSED(url); | ||
1867 | 130 | return false; | 147 | return false; |
1868 | 131 | } | 148 | } |
1869 | 132 | 149 | ||
1870 | 133 | bool BrowseFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { | 150 | bool BrowseFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { |
1871 | 151 | Q_UNUSED(index); | ||
1872 | 152 | Q_UNUSED(url); | ||
1873 | 134 | return false; | 153 | return false; |
1874 | 135 | } | 154 | } |
1875 | 136 | 155 | ||
1876 | @@ -143,59 +162,64 @@ | |||
1877 | 143 | */ | 162 | */ |
1878 | 144 | void BrowseFeature::activateChild(const QModelIndex& index) { | 163 | void BrowseFeature::activateChild(const QModelIndex& index) { |
1879 | 145 | TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); | 164 | TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); |
1881 | 146 | qDebug() << "BrowseFeature::activateChild " << item->data() << " " << item->dataPath(); | 165 | qDebug() << "BrowseFeature::activateChild " << item->data() << " " |
1882 | 166 | << item->dataPath(); | ||
1883 | 147 | m_browseModel.setPath(item->dataPath().toString()); | 167 | m_browseModel.setPath(item->dataPath().toString()); |
1884 | 148 | emit(showTrackModel(&m_proxyModel)); | 168 | emit(showTrackModel(&m_proxyModel)); |
1885 | 149 | |||
1886 | 150 | } | 169 | } |
1887 | 151 | 170 | ||
1888 | 152 | void BrowseFeature::onRightClick(const QPoint& globalPos) { | 171 | void BrowseFeature::onRightClick(const QPoint& globalPos) { |
1893 | 153 | } | 172 | Q_UNUSED(globalPos); |
1894 | 154 | 173 | } | |
1895 | 155 | void BrowseFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { | 174 | |
1896 | 156 | } | 175 | void BrowseFeature::onRightClickChild(const QPoint& globalPos, |
1897 | 176 | QModelIndex index) { | ||
1898 | 177 | Q_UNUSED(globalPos); | ||
1899 | 178 | Q_UNUSED(index); | ||
1900 | 179 | } | ||
1901 | 180 | |||
1902 | 157 | /* | 181 | /* |
1903 | 158 | * This is called whenever you double click or use the triangle symbol to expand | 182 | * This is called whenever you double click or use the triangle symbol to expand |
1904 | 159 | * the subtree. The method will read the subfolders. | 183 | * the subtree. The method will read the subfolders. |
1905 | 160 | */ | 184 | */ |
1906 | 161 | void BrowseFeature::onLazyChildExpandation(const QModelIndex &index){ | 185 | void BrowseFeature::onLazyChildExpandation(const QModelIndex &index){ |
1907 | 162 | TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); | 186 | TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); |
1909 | 163 | qDebug() << "BrowseFeature::onLazyChildExpandation " << item->data() << " " << item->dataPath(); | 187 | qDebug() << "BrowseFeature::onLazyChildExpandation " << item->data() |
1910 | 188 | << " " << item->dataPath(); | ||
1911 | 164 | 189 | ||
1912 | 165 | // If the item is a build-in node, e.g., 'QuickLink' return | 190 | // If the item is a build-in node, e.g., 'QuickLink' return |
1914 | 166 | if(item->dataPath().toString() == QUICK_LINK_NODE) | 191 | if (item->dataPath().toString() == QUICK_LINK_NODE) { |
1915 | 167 | return; | 192 | return; |
1916 | 193 | } | ||
1917 | 168 | 194 | ||
1920 | 169 | //Before we populate the subtree, we need to delete old subtrees | 195 | // Before we populate the subtree, we need to delete old subtrees |
1921 | 170 | m_childModel.removeRows(0, item->childCount(), index); | 196 | m_childModel.removeRows(0, item->childCount(), index); |
1922 | 171 | 197 | ||
1923 | 172 | // List of subfolders or drive letters | 198 | // List of subfolders or drive letters |
1924 | 173 | QList<TreeItem*> folders; | 199 | QList<TreeItem*> folders; |
1925 | 174 | 200 | ||
1926 | 175 | // If we are on the special device node | 201 | // If we are on the special device node |
1929 | 176 | if(item->dataPath().toString() == DEVICE_NODE){ | 202 | if (item->dataPath().toString() == DEVICE_NODE) { |
1930 | 177 | //Repopulate drive list | 203 | // Repopulate drive list |
1931 | 178 | QFileInfoList drives = QDir::drives(); | 204 | QFileInfoList drives = QDir::drives(); |
1934 | 179 | //show drive letters | 205 | // show drive letters |
1935 | 180 | foreach(QFileInfo drive, drives){ | 206 | foreach (QFileInfo drive, drives) { |
1936 | 181 | TreeItem* driveLetter = new TreeItem( | 207 | TreeItem* driveLetter = new TreeItem( |
1941 | 182 | drive.canonicalPath(), // displays C: | 208 | drive.canonicalPath(), // displays C: |
1942 | 183 | drive.filePath(), //Displays C:/ | 209 | drive.filePath(), //Displays C:/ |
1943 | 184 | this , | 210 | this , |
1944 | 185 | item); | 211 | item); |
1945 | 186 | folders << driveLetter; | 212 | folders << driveLetter; |
1946 | 187 | } | 213 | } |
1952 | 188 | 214 | } else { // we assume that the path refers to a folder in the file system | |
1953 | 189 | } | 215 | // populate childs |
1949 | 190 | else // we assume that the path refers to a folder in the file system | ||
1950 | 191 | { | ||
1951 | 192 | //populate childs | ||
1954 | 193 | QDir dir(item->dataPath().toString()); | 216 | QDir dir(item->dataPath().toString()); |
1956 | 194 | QFileInfoList all = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); | 217 | QFileInfoList all = dir.entryInfoList( |
1957 | 218 | QDir::Dirs | QDir::NoDotAndDotDot); | ||
1958 | 195 | 219 | ||
1959 | 196 | // loop through all the item and construct the childs | 220 | // loop through all the item and construct the childs |
1962 | 197 | foreach(QFileInfo one, all){ | 221 | foreach (QFileInfo one, all) { |
1963 | 198 | //Skip folders that end with .app on OS X | 222 | // Skip folders that end with .app on OS X |
1964 | 199 | #if defined(__APPLE__) | 223 | #if defined(__APPLE__) |
1965 | 200 | if (one.isDir() && one.fileName().endsWith(".app")) | 224 | if (one.isDir() && one.fileName().endsWith(".app")) |
1966 | 201 | continue; | 225 | continue; |
1967 | @@ -203,15 +227,17 @@ | |||
1968 | 203 | // We here create new items for the sidebar models | 227 | // We here create new items for the sidebar models |
1969 | 204 | // Once the items are added to the TreeItemModel, | 228 | // Once the items are added to the TreeItemModel, |
1970 | 205 | // the models takes ownership of them and ensures their deletion | 229 | // the models takes ownership of them and ensures their deletion |
1975 | 206 | TreeItem* folder = new TreeItem(one.fileName(), | 230 | TreeItem* folder = new TreeItem( |
1976 | 207 | item->dataPath().toString().append(one.fileName() +"/"), | 231 | one.fileName(), |
1977 | 208 | this, | 232 | item->dataPath().toString().append(one.fileName() +"/"), |
1978 | 209 | item); | 233 | this, item); |
1979 | 210 | folders << folder; | 234 | folders << folder; |
1980 | 211 | } | 235 | } |
1981 | 212 | } | 236 | } |
1986 | 213 | //we need to check here if subfolders are found | 237 | // we need to check here if subfolders are found |
1987 | 214 | //On Ubuntu 10.04, otherwise, this will draw an icon although the folder has no subfolders | 238 | // On Ubuntu 10.04, otherwise, this will draw an icon although the folder |
1988 | 215 | if(!folders.isEmpty()) | 239 | // has no subfolders |
1989 | 216 | m_childModel.insertRows(folders, 0, folders.size() , index); | 240 | if (!folders.isEmpty()) { |
1990 | 241 | m_childModel.insertRows(folders, 0, folders.size() , index); | ||
1991 | 242 | } | ||
1992 | 217 | } | 243 | } |
1993 | 218 | 244 | ||
1994 | === modified file 'mixxx/src/library/browse/browsefeature.h' | |||
1995 | --- mixxx/src/library/browse/browsefeature.h 2011-03-30 21:53:33 +0000 | |||
1996 | +++ mixxx/src/library/browse/browsefeature.h 2012-03-12 04:06:20 +0000 | |||
1997 | @@ -44,8 +44,8 @@ | |||
1998 | 44 | void onRightClickChild(const QPoint& globalPos, QModelIndex index); | 44 | void onRightClickChild(const QPoint& globalPos, QModelIndex index); |
1999 | 45 | 45 | ||
2000 | 46 | void onLazyChildExpandation(const QModelIndex& index); | 46 | void onLazyChildExpandation(const QModelIndex& index); |
2003 | 47 | 47 | ||
2004 | 48 | signals: | 48 | signals: |
2005 | 49 | void setRootIndex(const QModelIndex&); | 49 | void setRootIndex(const QModelIndex&); |
2006 | 50 | 50 | ||
2007 | 51 | private: | 51 | private: |
2008 | 52 | 52 | ||
2009 | === modified file 'mixxx/src/library/browse/browsetablemodel.cpp' | |||
2010 | --- mixxx/src/library/browse/browsetablemodel.cpp 2011-12-28 20:30:15 +0000 | |||
2011 | +++ mixxx/src/library/browse/browsetablemodel.cpp 2012-03-12 04:06:20 +0000 | |||
2012 | @@ -16,13 +16,14 @@ | |||
2013 | 16 | #include "audiotagger.h" | 16 | #include "audiotagger.h" |
2014 | 17 | 17 | ||
2015 | 18 | 18 | ||
2017 | 19 | BrowseTableModel::BrowseTableModel(QObject* parent, TrackCollection* pTrackCollection, | 19 | BrowseTableModel::BrowseTableModel(QObject* parent, |
2018 | 20 | TrackCollection* pTrackCollection, | ||
2019 | 20 | RecordingManager* pRecordingManager) | 21 | RecordingManager* pRecordingManager) |
2021 | 21 | : TrackModel(pTrackCollection->getDatabase(), // TrackCollections m_db (defaultConnection) | 22 | : TrackModel(pTrackCollection->getDatabase(), |
2022 | 22 | "mixxx.db.model.browse"), | 23 | "mixxx.db.model.browse"), |
2023 | 23 | QStandardItemModel(parent), | 24 | QStandardItemModel(parent), |
2024 | 24 | m_pTrackCollection(pTrackCollection), | 25 | m_pTrackCollection(pTrackCollection), |
2026 | 25 | m_pRecordingManager(pRecordingManager) { | 26 | m_pRecordingManager(pRecordingManager) { |
2027 | 26 | QStringList header_data; | 27 | QStringList header_data; |
2028 | 27 | header_data.insert(COLUMN_FILENAME, tr("Filename")); | 28 | header_data.insert(COLUMN_FILENAME, tr("Filename")); |
2029 | 28 | header_data.insert(COLUMN_ARTIST, tr("Artist")); | 29 | header_data.insert(COLUMN_ARTIST, tr("Artist")); |
2030 | @@ -50,23 +51,24 @@ | |||
2031 | 50 | addSearchColumn(COLUMN_COMMENT); | 51 | addSearchColumn(COLUMN_COMMENT); |
2032 | 51 | 52 | ||
2033 | 52 | setHorizontalHeaderLabels(header_data); | 53 | setHorizontalHeaderLabels(header_data); |
2036 | 53 | //register the QList<T> as a metatype since we use QueuedConnection below | 54 | // register the QList<T> as a metatype since we use QueuedConnection below |
2037 | 54 | qRegisterMetaType< QList< QList<QStandardItem*> > >("QList< QList<QStandardItem*> >"); | 55 | qRegisterMetaType< QList< QList<QStandardItem*> > >( |
2038 | 56 | "QList< QList<QStandardItem*> >"); | ||
2039 | 55 | qRegisterMetaType<BrowseTableModel*>("BrowseTableModel*"); | 57 | qRegisterMetaType<BrowseTableModel*>("BrowseTableModel*"); |
2040 | 56 | 58 | ||
2041 | 57 | connect(BrowseThread::getInstance(), SIGNAL(clearModel(BrowseTableModel*)), | 59 | connect(BrowseThread::getInstance(), SIGNAL(clearModel(BrowseTableModel*)), |
2042 | 58 | this, SLOT(slotClear(BrowseTableModel*)), | 60 | this, SLOT(slotClear(BrowseTableModel*)), |
2043 | 59 | Qt::QueuedConnection); | 61 | Qt::QueuedConnection); |
2044 | 60 | 62 | ||
2049 | 61 | connect(BrowseThread::getInstance(), SIGNAL(rowsAppended(const QList< QList<QStandardItem*> >&, BrowseTableModel*)), | 63 | connect( |
2050 | 62 | this, SLOT(slotInsert(const QList< QList<QStandardItem*> >&, BrowseTableModel*)), | 64 | BrowseThread::getInstance(), |
2051 | 63 | Qt::QueuedConnection); | 65 | SIGNAL(rowsAppended(const QList< QList<QStandardItem*> >&, BrowseTableModel*)), |
2052 | 64 | 66 | this, | |
2053 | 67 | SLOT(slotInsert(const QList< QList<QStandardItem*> >&, BrowseTableModel*)), | ||
2054 | 68 | Qt::QueuedConnection); | ||
2055 | 65 | } | 69 | } |
2056 | 66 | 70 | ||
2060 | 67 | BrowseTableModel::~BrowseTableModel() | 71 | BrowseTableModel::~BrowseTableModel() { |
2058 | 68 | { | ||
2059 | 69 | |||
2061 | 70 | } | 72 | } |
2062 | 71 | 73 | ||
2063 | 72 | const QList<int>& BrowseTableModel::searchColumns() const { | 74 | const QList<int>& BrowseTableModel::searchColumns() const { |
2064 | @@ -77,20 +79,19 @@ | |||
2065 | 77 | m_searchColumns.push_back(index); | 79 | m_searchColumns.push_back(index); |
2066 | 78 | } | 80 | } |
2067 | 79 | 81 | ||
2070 | 80 | void BrowseTableModel::setPath(QString absPath) | 82 | void BrowseTableModel::setPath(QString absPath) { |
2069 | 81 | { | ||
2071 | 82 | m_current_path = absPath; | 83 | m_current_path = absPath; |
2072 | 83 | BrowseThread::getInstance()->executePopulation(m_current_path, this); | 84 | BrowseThread::getInstance()->executePopulation(m_current_path, this); |
2073 | 84 | |||
2074 | 85 | } | 85 | } |
2075 | 86 | 86 | ||
2078 | 87 | TrackPointer BrowseTableModel::getTrack(const QModelIndex& index) const | 87 | TrackPointer BrowseTableModel::getTrack(const QModelIndex& index) const { |
2077 | 88 | { | ||
2079 | 89 | QString track_location = getTrackLocation(index); | 88 | QString track_location = getTrackLocation(index); |
2084 | 90 | if(m_pRecordingManager->getRecordingLocation() == track_location) { | 89 | if (m_pRecordingManager->getRecordingLocation() == track_location) { |
2085 | 91 | QMessageBox::critical(0, tr("Mixxx Library"),tr("Could not load the following file because" | 90 | QMessageBox::critical( |
2086 | 92 | " it is in use by Mixxx or another application.") | 91 | 0, tr("Mixxx Library"), |
2087 | 93 | + "\n" +track_location); | 92 | tr("Could not load the following file because" |
2088 | 93 | " it is in use by Mixxx or another application.") | ||
2089 | 94 | + "\n" +track_location); | ||
2090 | 94 | return TrackPointer(); | 95 | return TrackPointer(); |
2091 | 95 | } | 96 | } |
2092 | 96 | 97 | ||
2093 | @@ -104,29 +105,27 @@ | |||
2094 | 104 | return track_dao.getTrack(track_id); | 105 | return track_dao.getTrack(track_id); |
2095 | 105 | } | 106 | } |
2096 | 106 | 107 | ||
2099 | 107 | QString BrowseTableModel::getTrackLocation(const QModelIndex& index) const | 108 | QString BrowseTableModel::getTrackLocation(const QModelIndex& index) const { |
2098 | 108 | { | ||
2100 | 109 | int row = index.row(); | 109 | int row = index.row(); |
2101 | 110 | 110 | ||
2102 | 111 | QModelIndex index2 = this->index(row, COLUMN_LOCATION); | 111 | QModelIndex index2 = this->index(row, COLUMN_LOCATION); |
2103 | 112 | return data(index2).toString(); | 112 | return data(index2).toString(); |
2104 | 113 | |||
2105 | 114 | } | 113 | } |
2106 | 115 | 114 | ||
2107 | 116 | int BrowseTableModel::getTrackId(const QModelIndex& index) const { | 115 | int BrowseTableModel::getTrackId(const QModelIndex& index) const { |
2110 | 117 | Q_UNUSED(index); | 116 | Q_UNUSED(index); |
2111 | 118 | // We can't implement this as it stands. | 117 | // We can't implement this as it stands. |
2112 | 119 | return -1; | 118 | return -1; |
2113 | 120 | } | 119 | } |
2114 | 121 | 120 | ||
2115 | 122 | const QLinkedList<int> BrowseTableModel::getTrackRows(int trackId) const { | 121 | const QLinkedList<int> BrowseTableModel::getTrackRows(int trackId) const { |
2119 | 123 | Q_UNUSED(trackId); | 122 | Q_UNUSED(trackId); |
2120 | 124 | // We can't implement this as it stands. | 123 | // We can't implement this as it stands. |
2121 | 125 | return QLinkedList<int>(); | 124 | return QLinkedList<int>(); |
2122 | 126 | } | 125 | } |
2123 | 127 | 126 | ||
2124 | 128 | void BrowseTableModel::search(const QString& searchText) { | 127 | void BrowseTableModel::search(const QString& searchText) { |
2126 | 129 | Q_UNUSED(searchText); | 128 | Q_UNUSED(searchText); |
2127 | 130 | } | 129 | } |
2128 | 131 | 130 | ||
2129 | 132 | const QString BrowseTableModel::currentSearch() const { | 131 | const QString BrowseTableModel::currentSearch() const { |
2130 | @@ -142,16 +141,14 @@ | |||
2131 | 142 | } | 141 | } |
2132 | 143 | 142 | ||
2133 | 144 | void BrowseTableModel::moveTrack(const QModelIndex&, const QModelIndex&) { | 143 | void BrowseTableModel::moveTrack(const QModelIndex&, const QModelIndex&) { |
2134 | 145 | |||
2135 | 146 | } | 144 | } |
2136 | 147 | 145 | ||
2137 | 148 | QItemDelegate* BrowseTableModel::delegateForColumn(const int) { | 146 | QItemDelegate* BrowseTableModel::delegateForColumn(const int) { |
2138 | 149 | return NULL; | 147 | return NULL; |
2139 | 150 | } | 148 | } |
2140 | 151 | 149 | ||
2144 | 152 | void BrowseTableModel::removeTrack(const QModelIndex& index) | 150 | void BrowseTableModel::removeTrack(const QModelIndex& index) { |
2145 | 153 | { | 151 | if (!index.isValid()) { |
2143 | 154 | if(!index.isValid()) { | ||
2146 | 155 | return; | 152 | return; |
2147 | 156 | } | 153 | } |
2148 | 157 | QStringList trackLocations; | 154 | QStringList trackLocations; |
2149 | @@ -159,8 +156,7 @@ | |||
2150 | 159 | removeTracks(trackLocations); | 156 | removeTracks(trackLocations); |
2151 | 160 | } | 157 | } |
2152 | 161 | 158 | ||
2155 | 162 | void BrowseTableModel::removeTracks(const QModelIndexList& indices) | 159 | void BrowseTableModel::removeTracks(const QModelIndexList& indices) { |
2154 | 163 | { | ||
2156 | 164 | QStringList trackLocations; | 160 | QStringList trackLocations; |
2157 | 165 | foreach (QModelIndex index, indices) { | 161 | foreach (QModelIndex index, indices) { |
2158 | 166 | if (!index.isValid()) { | 162 | if (!index.isValid()) { |
2159 | @@ -176,11 +172,12 @@ | |||
2160 | 176 | return; | 172 | return; |
2161 | 177 | 173 | ||
2162 | 178 | // Ask user if s/he is sure | 174 | // Ask user if s/he is sure |
2168 | 179 | if (QMessageBox::question(NULL, tr("Mixxx Library"), | 175 | if (QMessageBox::question( |
2169 | 180 | tr("Warning: This will permanently delete the following files:") | 176 | NULL, tr("Mixxx Library"), |
2170 | 181 | + "\n" + trackLocations.join("\n") + "\n" + | 177 | tr("Warning: This will permanently delete the following files:") |
2171 | 182 | tr("Are you sure you want to delete these files from your computer?"), | 178 | + "\n" + trackLocations.join("\n") + "\n" + |
2172 | 183 | QMessageBox::Yes, QMessageBox::Abort) == QMessageBox::Abort) { | 179 | tr("Are you sure you want to delete these files from your computer?"), |
2173 | 180 | QMessageBox::Yes, QMessageBox::Abort) == QMessageBox::Abort) { | ||
2174 | 184 | return; | 181 | return; |
2175 | 185 | } | 182 | } |
2176 | 186 | 183 | ||
2177 | @@ -191,8 +188,10 @@ | |||
2178 | 191 | foreach (QString track_location, trackLocations) { | 188 | foreach (QString track_location, trackLocations) { |
2179 | 192 | // If track is in use or deletion fails, show an error message. | 189 | // If track is in use or deletion fails, show an error message. |
2180 | 193 | if (isTrackInUse(track_location) || !QFile::remove(track_location)) { | 190 | if (isTrackInUse(track_location) || !QFile::remove(track_location)) { |
2183 | 194 | QMessageBox::critical(0, tr("Mixxx Library"),tr("Could not delete the following file because" | 191 | QMessageBox::critical( |
2184 | 195 | " it is in use by Mixxx or another application:") + "\n" +track_location); | 192 | 0, tr("Mixxx Library"), |
2185 | 193 | tr("Could not delete the following file because" | ||
2186 | 194 | " it is in use by Mixxx or another application:") + "\n" +track_location); | ||
2187 | 196 | continue; | 195 | continue; |
2188 | 197 | } | 196 | } |
2189 | 198 | 197 | ||
2190 | @@ -213,20 +212,19 @@ | |||
2191 | 213 | } | 212 | } |
2192 | 214 | } | 213 | } |
2193 | 215 | 214 | ||
2196 | 216 | bool BrowseTableModel::addTrack(const QModelIndex& index, QString location) | 215 | bool BrowseTableModel::addTrack(const QModelIndex& index, QString location) { |
2195 | 217 | { | ||
2197 | 218 | Q_UNUSED(index); | 216 | Q_UNUSED(index); |
2198 | 219 | Q_UNUSED(location); | 217 | Q_UNUSED(location); |
2200 | 220 | return false; | 218 | return false; |
2201 | 221 | } | 219 | } |
2202 | 222 | 220 | ||
2203 | 223 | QMimeData* BrowseTableModel::mimeData(const QModelIndexList &indexes) const { | 221 | QMimeData* BrowseTableModel::mimeData(const QModelIndexList &indexes) const { |
2204 | 224 | QMimeData *mimeData = new QMimeData(); | 222 | QMimeData *mimeData = new QMimeData(); |
2205 | 225 | QList<QUrl> urls; | 223 | QList<QUrl> urls; |
2206 | 226 | 224 | ||
2210 | 227 | //Ok, so the list of indexes we're given contains separates indexes for | 225 | // Ok, so the list of indexes we're given contains separates indexes for |
2211 | 228 | //each column, so even if only one row is selected, we'll have like 7 indexes. | 226 | // each column, so even if only one row is selected, we'll have like 7 |
2212 | 229 | //We need to only count each row once: | 227 | // indexes. We need to only count each row once: |
2213 | 230 | QList<int> rows; | 228 | QList<int> rows; |
2214 | 231 | 229 | ||
2215 | 232 | foreach (QModelIndex index, indexes) { | 230 | foreach (QModelIndex index, indexes) { |
2216 | @@ -234,9 +232,9 @@ | |||
2217 | 234 | if (!rows.contains(index.row())) { | 232 | if (!rows.contains(index.row())) { |
2218 | 235 | rows.push_back(index.row()); | 233 | rows.push_back(index.row()); |
2219 | 236 | QUrl url = QUrl::fromLocalFile(getTrackLocation(index)); | 234 | QUrl url = QUrl::fromLocalFile(getTrackLocation(index)); |
2221 | 237 | if (!url.isValid()) | 235 | if (!url.isValid()) { |
2222 | 238 | qDebug() << "ERROR invalid url\n"; | 236 | qDebug() << "ERROR invalid url\n"; |
2224 | 239 | else { | 237 | } else { |
2225 | 240 | urls.append(url); | 238 | urls.append(url); |
2226 | 241 | qDebug() << "Appending URL:" << url; | 239 | qDebug() << "Appending URL:" << url; |
2227 | 242 | } | 240 | } |
2228 | @@ -247,22 +245,23 @@ | |||
2229 | 247 | return mimeData; | 245 | return mimeData; |
2230 | 248 | } | 246 | } |
2231 | 249 | 247 | ||
2235 | 250 | void BrowseTableModel::slotClear(BrowseTableModel* caller_object) | 248 | void BrowseTableModel::slotClear(BrowseTableModel* caller_object) { |
2236 | 251 | { | 249 | if (caller_object == this) { |
2234 | 252 | if(caller_object == this) | ||
2237 | 253 | removeRows(0, rowCount()); | 250 | removeRows(0, rowCount()); |
2238 | 251 | } | ||
2239 | 254 | } | 252 | } |
2240 | 255 | 253 | ||
2245 | 256 | void BrowseTableModel::slotInsert(const QList< QList<QStandardItem*> >& rows, BrowseTableModel* caller_object) { | 254 | void BrowseTableModel::slotInsert(const QList< QList<QStandardItem*> >& rows, |
2246 | 257 | //There exists more than one BrowseTableModel in Mixxx | 255 | BrowseTableModel* caller_object) { |
2247 | 258 | //We only want to receive items here, this object has 'ordered' by the BrowserThread (singleton) | 256 | // There exists more than one BrowseTableModel in Mixxx We only want to |
2248 | 259 | if(caller_object == this) { | 257 | // receive items here, this object has 'ordered' by the BrowserThread |
2249 | 258 | // (singleton) | ||
2250 | 259 | if (caller_object == this) { | ||
2251 | 260 | //qDebug() << "BrowseTableModel::slotInsert"; | 260 | //qDebug() << "BrowseTableModel::slotInsert"; |
2253 | 261 | for(int i=0; i < rows.size(); ++i) { | 261 | for (int i = 0; i < rows.size(); ++i) { |
2254 | 262 | appendRow(rows.at(i)); | 262 | appendRow(rows.at(i)); |
2255 | 263 | } | 263 | } |
2256 | 264 | } | 264 | } |
2257 | 265 | |||
2258 | 266 | } | 265 | } |
2259 | 267 | 266 | ||
2260 | 268 | TrackModel::CapabilitiesFlags BrowseTableModel::getCapabilities() const { | 267 | TrackModel::CapabilitiesFlags BrowseTableModel::getCapabilities() const { |
2261 | @@ -275,106 +274,108 @@ | |||
2262 | 275 | | TRACKMODELCAPS_LOADTOSAMPLER; | 274 | | TRACKMODELCAPS_LOADTOSAMPLER; |
2263 | 276 | } | 275 | } |
2264 | 277 | 276 | ||
2267 | 278 | Qt::ItemFlags BrowseTableModel::flags(const QModelIndex &index) const{ | 277 | Qt::ItemFlags BrowseTableModel::flags(const QModelIndex &index) const { |
2266 | 279 | |||
2268 | 280 | Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); | 278 | Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index); |
2269 | 281 | 279 | ||
2272 | 282 | //Enable dragging songs from this data model to elsewhere (like the waveform | 280 | // Enable dragging songs from this data model to elsewhere (like the |
2273 | 283 | //widget to load a track into a Player). | 281 | // waveform widget to load a track into a Player). |
2274 | 284 | defaultFlags |= Qt::ItemIsDragEnabled; | 282 | defaultFlags |= Qt::ItemIsDragEnabled; |
2275 | 285 | 283 | ||
2276 | 286 | QString track_location = getTrackLocation(index); | 284 | QString track_location = getTrackLocation(index); |
2277 | 287 | int column = index.column(); | 285 | int column = index.column(); |
2278 | 288 | 286 | ||
2280 | 289 | if(isTrackInUse(track_location) || | 287 | if (isTrackInUse(track_location) || |
2281 | 290 | column == COLUMN_FILENAME || | 288 | column == COLUMN_FILENAME || |
2282 | 291 | column == COLUMN_BITRATE || | 289 | column == COLUMN_BITRATE || |
2283 | 292 | column == COLUMN_DURATION || | 290 | column == COLUMN_DURATION || |
2284 | 293 | column == COLUMN_TYPE) { | 291 | column == COLUMN_TYPE) { |
2285 | 294 | return defaultFlags; | 292 | return defaultFlags; |
2288 | 295 | } | 293 | } else { |
2287 | 296 | else{ | ||
2289 | 297 | return defaultFlags | Qt::ItemIsEditable; | 294 | return defaultFlags | Qt::ItemIsEditable; |
2290 | 298 | } | 295 | } |
2291 | 299 | } | 296 | } |
2292 | 300 | 297 | ||
2300 | 301 | bool BrowseTableModel::isTrackInUse(QString &track_location) const | 298 | bool BrowseTableModel::isTrackInUse(const QString &track_location) const { |
2301 | 302 | { | 299 | int decks = ControlObject::getControl( |
2302 | 303 | int decks = ControlObject::getControl(ConfigKey("[Master]","num_decks"))->get(); | 300 | ConfigKey("[Master]", "num_decks"))->get(); |
2303 | 304 | //check if file is loaded to a deck | 301 | // check if file is loaded to a deck |
2304 | 305 | for(int i=1; i <= decks; ++i) { | 302 | for (int i = 1; i <= decks; ++i) { |
2305 | 306 | TrackPointer loaded_track = PlayerInfo::Instance().getTrackInfo(QString("[Channel%1]").arg(i)); | 303 | TrackPointer loaded_track = PlayerInfo::Instance().getTrackInfo( |
2306 | 307 | if(loaded_track && (loaded_track->getLocation() == track_location)) { | 304 | QString("[Channel%1]").arg(i)); |
2307 | 305 | if (loaded_track && (loaded_track->getLocation() == track_location)) { | ||
2308 | 308 | return true; | 306 | return true; |
2309 | 309 | } | 307 | } |
2310 | 310 | } | 308 | } |
2311 | 311 | 309 | ||
2313 | 312 | if(m_pRecordingManager->getRecordingLocation() == track_location) { | 310 | if (m_pRecordingManager->getRecordingLocation() == track_location) { |
2314 | 313 | return true; | 311 | return true; |
2315 | 314 | } | 312 | } |
2316 | 315 | 313 | ||
2317 | 316 | return false; | 314 | return false; |
2318 | 317 | } | 315 | } |
2319 | 318 | 316 | ||
2322 | 319 | bool BrowseTableModel::setData(const QModelIndex &index, const QVariant &value, int role) | 317 | bool BrowseTableModel::setData(const QModelIndex &index, const QVariant &value, |
2323 | 320 | { | 318 | int role) { |
2324 | 321 | Q_UNUSED(role); | 319 | Q_UNUSED(role); |
2325 | 322 | 320 | ||
2327 | 323 | if(!index.isValid()) | 321 | if (!index.isValid()) { |
2328 | 324 | return false; | 322 | return false; |
2329 | 323 | } | ||
2330 | 325 | qDebug() << "BrowseTableModel::setData(" << index.data() << ")"; | 324 | qDebug() << "BrowseTableModel::setData(" << index.data() << ")"; |
2331 | 326 | int row = index.row(); | 325 | int row = index.row(); |
2332 | 327 | int col = index.column(); | 326 | int col = index.column(); |
2333 | 328 | QString track_location = getTrackLocation(index); | 327 | QString track_location = getTrackLocation(index); |
2334 | 329 | AudioTagger tagger(track_location); | 328 | AudioTagger tagger(track_location); |
2335 | 330 | 329 | ||
2347 | 331 | //set tagger information | 330 | // set tagger information |
2348 | 332 | tagger.setArtist(this->index(row,COLUMN_ARTIST).data().toString()); | 331 | tagger.setArtist(this->index(row, COLUMN_ARTIST).data().toString()); |
2349 | 333 | tagger.setTitle(this->index(row,COLUMN_TITLE).data().toString()); | 332 | tagger.setTitle(this->index(row, COLUMN_TITLE).data().toString()); |
2350 | 334 | tagger.setAlbum(this->index(row,COLUMN_ALBUM).data().toString()); | 333 | tagger.setAlbum(this->index(row, COLUMN_ALBUM).data().toString()); |
2351 | 335 | tagger.setKey(this->index(row,COLUMN_KEY).data().toString()); | 334 | tagger.setKey(this->index(row, COLUMN_KEY).data().toString()); |
2352 | 336 | tagger.setBpm(this->index(row,COLUMN_BPM).data().toString()); | 335 | tagger.setBpm(this->index(row, COLUMN_BPM).data().toString()); |
2353 | 337 | tagger.setComment(this->index(row,COLUMN_COMMENT).data().toString()); | 336 | tagger.setComment(this->index(row, COLUMN_COMMENT).data().toString()); |
2354 | 338 | tagger.setTracknumber(this->index(row,COLUMN_TRACK_NUMBER).data().toString()); | 337 | tagger.setTracknumber( |
2355 | 339 | tagger.setYear(this->index(row,COLUMN_YEAR).data().toString()); | 338 | this->index(row, COLUMN_TRACK_NUMBER).data().toString()); |
2356 | 340 | tagger.setGenre(this->index(row,COLUMN_GENRE).data().toString()); | 339 | tagger.setYear(this->index(row, COLUMN_YEAR).data().toString()); |
2357 | 341 | tagger.setComposer(this->index(row,COLUMN_COMPOSER).data().toString()); | 340 | tagger.setGenre(this->index(row, COLUMN_GENRE).data().toString()); |
2358 | 341 | tagger.setComposer(this->index(row, COLUMN_COMPOSER).data().toString()); | ||
2359 | 342 | 342 | ||
2362 | 343 | //check if one the item were edited | 343 | // check if one the item were edited |
2363 | 344 | if(col == COLUMN_ARTIST) { | 344 | if (col == COLUMN_ARTIST) { |
2364 | 345 | tagger.setArtist(value.toString()); | 345 | tagger.setArtist(value.toString()); |
2366 | 346 | } else if(col == COLUMN_TITLE) { | 346 | } else if (col == COLUMN_TITLE) { |
2367 | 347 | tagger.setTitle(value.toString()); | 347 | tagger.setTitle(value.toString()); |
2369 | 348 | } else if(col == COLUMN_ALBUM) { | 348 | } else if (col == COLUMN_ALBUM) { |
2370 | 349 | tagger.setAlbum(value.toString()); | 349 | tagger.setAlbum(value.toString()); |
2372 | 350 | } else if(col == COLUMN_BPM) { | 350 | } else if (col == COLUMN_BPM) { |
2373 | 351 | tagger.setBpm(value.toString()); | 351 | tagger.setBpm(value.toString()); |
2375 | 352 | } else if(col == COLUMN_KEY) { | 352 | } else if (col == COLUMN_KEY) { |
2376 | 353 | tagger.setKey(value.toString()); | 353 | tagger.setKey(value.toString()); |
2378 | 354 | } else if(col == COLUMN_TRACK_NUMBER) { | 354 | } else if (col == COLUMN_TRACK_NUMBER) { |
2379 | 355 | tagger.setTracknumber(value.toString()); | 355 | tagger.setTracknumber(value.toString()); |
2381 | 356 | } else if(col == COLUMN_COMMENT) { | 356 | } else if (col == COLUMN_COMMENT) { |
2382 | 357 | tagger.setComment(value.toString()); | 357 | tagger.setComment(value.toString()); |
2384 | 358 | } else if(col == COLUMN_GENRE) { | 358 | } else if (col == COLUMN_GENRE) { |
2385 | 359 | tagger.setGenre(value.toString()); | 359 | tagger.setGenre(value.toString()); |
2387 | 360 | } else if(col == COLUMN_COMPOSER) { | 360 | } else if (col == COLUMN_COMPOSER) { |
2388 | 361 | tagger.setComposer(value.toString()); | 361 | tagger.setComposer(value.toString()); |
2390 | 362 | } else if(col == COLUMN_YEAR) { | 362 | } else if (col == COLUMN_YEAR) { |
2391 | 363 | tagger.setYear(value.toString()); | 363 | tagger.setYear(value.toString()); |
2392 | 364 | } | 364 | } |
2393 | 365 | 365 | ||
2394 | 366 | 366 | ||
2395 | 367 | QStandardItem* item = itemFromIndex(index); | 367 | QStandardItem* item = itemFromIndex(index); |
2398 | 368 | if(tagger.save()) { | 368 | if (tagger.save()) { |
2399 | 369 | //Modify underlying interalPointer object | 369 | // Modify underlying interalPointer object |
2400 | 370 | item->setText(value.toString()); | 370 | item->setText(value.toString()); |
2401 | 371 | return true; | 371 | return true; |
2405 | 372 | } | 372 | } else { |
2406 | 373 | else { | 373 | // reset to old value in error |
2404 | 374 | //reset to old value in error | ||
2407 | 375 | item->setText(index.data().toString()); | 374 | item->setText(index.data().toString()); |
2410 | 376 | QMessageBox::critical(0, tr("Mixxx Library"),tr("Could not update file metadata.") | 375 | QMessageBox::critical( |
2411 | 377 | + "\n" +track_location); | 376 | 0, tr("Mixxx Library"), |
2412 | 377 | tr("Could not update file metadata.") | ||
2413 | 378 | + "\n" +track_location); | ||
2414 | 378 | return false; | 379 | return false; |
2415 | 379 | } | 380 | } |
2416 | 380 | } | 381 | } |
2417 | 381 | 382 | ||
2418 | === modified file 'mixxx/src/library/browse/browsetablemodel.h' | |||
2419 | --- mixxx/src/library/browse/browsetablemodel.h 2012-01-07 05:48:41 +0000 | |||
2420 | +++ mixxx/src/library/browse/browsetablemodel.h 2012-03-12 04:06:20 +0000 | |||
2421 | @@ -66,7 +66,7 @@ | |||
2422 | 66 | void removeTracks(QStringList trackLocations); | 66 | void removeTracks(QStringList trackLocations); |
2423 | 67 | 67 | ||
2424 | 68 | void addSearchColumn(int index); | 68 | void addSearchColumn(int index); |
2426 | 69 | bool isTrackInUse(QString& file) const; | 69 | bool isTrackInUse(const QString& file) const; |
2427 | 70 | QList<int> m_searchColumns; | 70 | QList<int> m_searchColumns; |
2428 | 71 | QString m_current_path; | 71 | QString m_current_path; |
2429 | 72 | TrackCollection* m_pTrackCollection; | 72 | TrackCollection* m_pTrackCollection; |
2430 | 73 | 73 | ||
2431 | === modified file 'mixxx/src/library/dao/cratedao.h' | |||
2432 | --- mixxx/src/library/dao/cratedao.h 2011-10-21 00:42:23 +0000 | |||
2433 | +++ mixxx/src/library/dao/cratedao.h 2012-03-12 04:06:20 +0000 | |||
2434 | @@ -47,6 +47,8 @@ | |||
2435 | 47 | void changed(int crateId); | 47 | void changed(int crateId); |
2436 | 48 | void trackAdded(int crateId, int trackId); | 48 | void trackAdded(int crateId, int trackId); |
2437 | 49 | void trackRemoved(int crateId, int trackId); | 49 | void trackRemoved(int crateId, int trackId); |
2438 | 50 | void renamed(int crateId); | ||
2439 | 51 | void lockChanged(int crateId); | ||
2440 | 50 | 52 | ||
2441 | 51 | private: | 53 | private: |
2442 | 52 | QSqlDatabase& m_database; | 54 | QSqlDatabase& m_database; |
2443 | 53 | 55 | ||
2444 | === modified file 'mixxx/src/widget/wtracktableview.cpp' | |||
2445 | --- mixxx/src/widget/wtracktableview.cpp 2011-12-14 17:22:49 +0000 | |||
2446 | +++ mixxx/src/widget/wtracktableview.cpp 2012-03-12 04:06:20 +0000 | |||
2447 | @@ -82,6 +82,7 @@ | |||
2448 | 82 | 82 | ||
2449 | 83 | delete m_pReloadMetadataAct; | 83 | delete m_pReloadMetadataAct; |
2450 | 84 | delete m_pAutoDJAct; | 84 | delete m_pAutoDJAct; |
2451 | 85 | delete m_pAutoDJTopAct; | ||
2452 | 85 | delete m_pRemoveAct; | 86 | delete m_pRemoveAct; |
2453 | 86 | delete m_pPropertiesAct; | 87 | delete m_pPropertiesAct; |
2454 | 87 | delete m_pMenu; | 88 | delete m_pMenu; |
2455 | @@ -241,7 +242,8 @@ | |||
2456 | 241 | void WTrackTableView::disableSorting() { | 242 | void WTrackTableView::disableSorting() { |
2457 | 242 | // We have to manually do this because setSortingEnabled(false) does not | 243 | // We have to manually do this because setSortingEnabled(false) does not |
2458 | 243 | // properly disconnect the signals for some reason. | 244 | // properly disconnect the signals for some reason. |
2460 | 244 | disconnect(horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), | 245 | disconnect(horizontalHeader(), |
2461 | 246 | SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), | ||
2462 | 245 | this, SLOT(doSortByColumn(int))); | 247 | this, SLOT(doSortByColumn(int))); |
2463 | 246 | horizontalHeader()->setSortIndicatorShown(false); | 248 | horizontalHeader()->setSortIndicatorShown(false); |
2464 | 247 | } | 249 | } |
2465 | @@ -250,17 +252,23 @@ | |||
2466 | 250 | Q_ASSERT(m_pMenu); | 252 | Q_ASSERT(m_pMenu); |
2467 | 251 | Q_ASSERT(m_pSamplerMenu); | 253 | Q_ASSERT(m_pSamplerMenu); |
2468 | 252 | 254 | ||
2470 | 253 | m_pRemoveAct = new QAction(tr("Remove"),this); | 255 | m_pRemoveAct = new QAction(tr("Remove"), this); |
2471 | 254 | connect(m_pRemoveAct, SIGNAL(triggered()), this, SLOT(slotRemove())); | 256 | connect(m_pRemoveAct, SIGNAL(triggered()), this, SLOT(slotRemove())); |
2472 | 255 | 257 | ||
2473 | 256 | m_pPropertiesAct = new QAction(tr("Properties..."), this); | 258 | m_pPropertiesAct = new QAction(tr("Properties..."), this); |
2475 | 257 | connect(m_pPropertiesAct, SIGNAL(triggered()), this, SLOT(slotShowTrackInfo())); | 259 | connect(m_pPropertiesAct, SIGNAL(triggered()), |
2476 | 260 | this, SLOT(slotShowTrackInfo())); | ||
2477 | 258 | 261 | ||
2479 | 259 | m_pAutoDJAct = new QAction(tr("Add to Auto DJ Queue"),this); | 262 | m_pAutoDJAct = new QAction(tr("Add to Auto-DJ Queue (bottom)"), this); |
2480 | 260 | connect(m_pAutoDJAct, SIGNAL(triggered()), this, SLOT(slotSendToAutoDJ())); | 263 | connect(m_pAutoDJAct, SIGNAL(triggered()), this, SLOT(slotSendToAutoDJ())); |
2481 | 261 | 264 | ||
2482 | 265 | m_pAutoDJTopAct = new QAction(tr("Add to Auto-DJ Queue (top)"), this); | ||
2483 | 266 | connect(m_pAutoDJTopAct, SIGNAL(triggered()), | ||
2484 | 267 | this, SLOT(slotSendToAutoDJTop())); | ||
2485 | 268 | |||
2486 | 262 | m_pReloadMetadataAct = new QAction(tr("Reload Track Metadata"), this); | 269 | m_pReloadMetadataAct = new QAction(tr("Reload Track Metadata"), this); |
2488 | 263 | connect(m_pReloadMetadataAct, SIGNAL(triggered()), this, SLOT(slotReloadTrackMetadata())); | 270 | connect(m_pReloadMetadataAct, SIGNAL(triggered()), |
2489 | 271 | this, SLOT(slotReloadTrackMetadata())); | ||
2490 | 264 | } | 272 | } |
2491 | 265 | 273 | ||
2492 | 266 | void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) { | 274 | void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) { |
2493 | @@ -345,8 +353,7 @@ | |||
2494 | 345 | m_pTrackInfo->show(); | 353 | m_pTrackInfo->show(); |
2495 | 346 | } | 354 | } |
2496 | 347 | 355 | ||
2499 | 348 | void WTrackTableView::contextMenuEvent(QContextMenuEvent * event) | 356 | void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) { |
2498 | 349 | { | ||
2500 | 350 | QModelIndexList indices = selectionModel()->selectedRows(); | 357 | QModelIndexList indices = selectionModel()->selectedRows(); |
2501 | 351 | 358 | ||
2502 | 352 | // Gray out some stuff if multiple songs were selected. | 359 | // Gray out some stuff if multiple songs were selected. |
2503 | @@ -356,6 +363,7 @@ | |||
2504 | 356 | 363 | ||
2505 | 357 | if (modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { | 364 | if (modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { |
2506 | 358 | m_pMenu->addAction(m_pAutoDJAct); | 365 | m_pMenu->addAction(m_pAutoDJAct); |
2507 | 366 | m_pMenu->addAction(m_pAutoDJTopAct); | ||
2508 | 359 | m_pMenu->addSeparator(); | 367 | m_pMenu->addSeparator(); |
2509 | 360 | } | 368 | } |
2510 | 361 | 369 | ||
2511 | @@ -800,6 +808,15 @@ | |||
2512 | 800 | } | 808 | } |
2513 | 801 | 809 | ||
2514 | 802 | void WTrackTableView::slotSendToAutoDJ() { | 810 | void WTrackTableView::slotSendToAutoDJ() { |
2515 | 811 | // append to auto DJ | ||
2516 | 812 | sendToAutoDJ(false); // bTop = false | ||
2517 | 813 | } | ||
2518 | 814 | |||
2519 | 815 | void WTrackTableView::slotSendToAutoDJTop() { | ||
2520 | 816 | sendToAutoDJ(true); // bTop = true | ||
2521 | 817 | } | ||
2522 | 818 | |||
2523 | 819 | void WTrackTableView::sendToAutoDJ(bool bTop) { | ||
2524 | 803 | if (!modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { | 820 | if (!modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { |
2525 | 804 | return; | 821 | return; |
2526 | 805 | } | 822 | } |
2527 | @@ -819,7 +836,15 @@ | |||
2528 | 819 | (pTrack = trackModel->getTrack(index))) { | 836 | (pTrack = trackModel->getTrack(index))) { |
2529 | 820 | int iTrackId = pTrack->getId(); | 837 | int iTrackId = pTrack->getId(); |
2530 | 821 | if (iTrackId != -1) { | 838 | if (iTrackId != -1) { |
2532 | 822 | playlistDao.appendTrackToPlaylist(iTrackId, iAutoDJPlaylistId); | 839 | if (bTop) { |
2533 | 840 | // Load track to position two because position one is | ||
2534 | 841 | // already loaded to the player | ||
2535 | 842 | playlistDao.insertTrackIntoPlaylist(iTrackId, | ||
2536 | 843 | iAutoDJPlaylistId, 2); | ||
2537 | 844 | } else { | ||
2538 | 845 | playlistDao.appendTrackToPlaylist( | ||
2539 | 846 | iTrackId, iAutoDJPlaylistId); | ||
2540 | 847 | } | ||
2541 | 823 | } | 848 | } |
2542 | 824 | } | 849 | } |
2543 | 825 | } | 850 | } |
2544 | 826 | 851 | ||
2545 | === modified file 'mixxx/src/widget/wtracktableview.h' | |||
2546 | --- mixxx/src/widget/wtracktableview.h 2011-10-14 03:58:14 +0000 | |||
2547 | +++ mixxx/src/widget/wtracktableview.h 2012-03-12 04:06:20 +0000 | |||
2548 | @@ -19,10 +19,9 @@ | |||
2549 | 19 | const QString LIBRARY_CONFIGVALUE = "[Library]"; /** ConfigValue "value" (wtf) for library stuff */ | 19 | const QString LIBRARY_CONFIGVALUE = "[Library]"; /** ConfigValue "value" (wtf) for library stuff */ |
2550 | 20 | 20 | ||
2551 | 21 | 21 | ||
2554 | 22 | class WTrackTableView : public WLibraryTableView | 22 | class WTrackTableView : public WLibraryTableView { |
2553 | 23 | { | ||
2555 | 24 | Q_OBJECT | 23 | Q_OBJECT |
2557 | 25 | public: | 24 | public: |
2558 | 26 | WTrackTableView(QWidget* parent, ConfigObject<ConfigValue>* pConfig, | 25 | WTrackTableView(QWidget* parent, ConfigObject<ConfigValue>* pConfig, |
2559 | 27 | TrackCollection* pTrackCollection); | 26 | TrackCollection* pTrackCollection); |
2560 | 28 | virtual ~WTrackTableView(); | 27 | virtual ~WTrackTableView(); |
2561 | @@ -46,6 +45,7 @@ | |||
2562 | 46 | void slotNextTrackInfo(); | 45 | void slotNextTrackInfo(); |
2563 | 47 | void slotPrevTrackInfo(); | 46 | void slotPrevTrackInfo(); |
2564 | 48 | void slotSendToAutoDJ(); | 47 | void slotSendToAutoDJ(); |
2565 | 48 | void slotSendToAutoDJTop(); | ||
2566 | 49 | void slotReloadTrackMetadata(); | 49 | void slotReloadTrackMetadata(); |
2567 | 50 | void addSelectionToPlaylist(int iPlaylistId); | 50 | void addSelectionToPlaylist(int iPlaylistId); |
2568 | 51 | void addSelectionToCrate(int iCrateId); | 51 | void addSelectionToCrate(int iCrateId); |
2569 | @@ -53,6 +53,7 @@ | |||
2570 | 53 | void doSortByColumn(int headerSection); | 53 | void doSortByColumn(int headerSection); |
2571 | 54 | 54 | ||
2572 | 55 | private: | 55 | private: |
2573 | 56 | void sendToAutoDJ(bool bTop); | ||
2574 | 56 | void showTrackInfo(QModelIndex index); | 57 | void showTrackInfo(QModelIndex index); |
2575 | 57 | void createActions(); | 58 | void createActions(); |
2576 | 58 | void dragMoveEvent(QDragMoveEvent * event); | 59 | void dragMoveEvent(QDragMoveEvent * event); |
2577 | @@ -89,6 +90,7 @@ | |||
2578 | 89 | 90 | ||
2579 | 90 | // Send to Auto-DJ Action | 91 | // Send to Auto-DJ Action |
2580 | 91 | QAction *m_pAutoDJAct; | 92 | QAction *m_pAutoDJAct; |
2581 | 93 | QAction *m_pAutoDJTopAct; | ||
2582 | 92 | 94 | ||
2583 | 93 | // Remove from table | 95 | // Remove from table |
2584 | 94 | QAction *m_pRemoveAct; | 96 | QAction *m_pRemoveAct; |