Merge lp:~daschuer/mixxx/1.10-autodj into lp:mixxx/1.10
- 1.10-autodj
- Merge into release-1.10.x
Proposed by
Daniel Schürmann
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Daniel Schürmann | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~daschuer/mixxx/1.10-autodj | ||||
Merge into: | lp:mixxx/1.10 | ||||
Diff against target: |
1731 lines (+680/-326) 31 files modified
mixxx/src/dlgautodj.cpp (+467/-233) mixxx/src/dlgautodj.h (+32/-10) mixxx/src/dlgprepare.h (+2/-0) mixxx/src/dlgrecording.cpp (+1/-0) mixxx/src/dlgrecording.h (+1/-0) mixxx/src/library/autodjfeature.cpp (+31/-25) mixxx/src/library/autodjfeature.h (+2/-0) mixxx/src/library/basesqltablemodel.cpp (+2/-1) mixxx/src/library/browse/browsefeature.cpp (+2/-1) mixxx/src/library/browse/browsefeature.h (+0/-1) mixxx/src/library/browse/browsetablemodel.cpp (+9/-9) mixxx/src/library/cratefeature.cpp (+1/-0) mixxx/src/library/dao/cratedao.h (+2/-0) mixxx/src/library/dao/playlistdao.cpp (+11/-3) mixxx/src/library/dao/playlistdao.h (+3/-1) mixxx/src/library/itunes/itunesfeature.cpp (+2/-3) mixxx/src/library/playlistfeature.cpp (+9/-2) mixxx/src/library/playlistfeature.h (+1/-0) mixxx/src/library/playlisttablemodel.cpp (+33/-11) mixxx/src/library/playlisttablemodel.h (+2/-3) mixxx/src/library/preparefeature.cpp (+16/-11) mixxx/src/library/preparefeature.h (+2/-0) mixxx/src/library/proxytrackmodel.cpp (+2/-1) mixxx/src/library/recording/recordingfeature.cpp (+20/-5) mixxx/src/library/recording/recordingfeature.h (+0/-1) mixxx/src/library/rhythmbox/rhythmboxfeature.cpp (+1/-2) mixxx/src/library/traktor/traktorfeature.cpp (+2/-2) mixxx/src/soundmanager.h (+1/-1) mixxx/src/widget/wsearchlineedit.cpp (+11/-0) mixxx/src/widget/wtracktableview.cpp (+9/-0) mixxx/src/widget/wtracktableview.h (+3/-0) |
||||
To merge this branch: | bzr merge lp:~daschuer/mixxx/1.10-autodj | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
RJ Skerry-Ryan | Approve | ||
Review via email: mp+108245@code.launchpad.net |
Commit message
Description of the change
Back port of the auto DJ patches, without the new controls.
To post a comment you must log in.
Revision history for this message
Daniel Schürmann (daschuer) wrote : | # |
Merged to #3107
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'mixxx/src/dlgautodj.cpp' | |||
2 | --- mixxx/src/dlgautodj.cpp 2011-11-30 06:19:47 +0000 | |||
3 | +++ mixxx/src/dlgautodj.cpp 2012-05-31 20:47:26 +0000 | |||
4 | @@ -1,28 +1,35 @@ | |||
5 | 1 | #include <QSqlTableModel> | 1 | #include <QSqlTableModel> |
9 | 2 | #include "widget/wwidget.h" | 2 | |
10 | 3 | #include "widget/wskincolor.h" | 3 | #include "dlgautodj.h" |
11 | 4 | #include "widget/wtracktableview.h" | 4 | |
12 | 5 | #include "controlobject.h" | 5 | #include "controlobject.h" |
13 | 6 | #include "controlobjectthreadmain.h" | 6 | #include "controlobjectthreadmain.h" |
14 | 7 | #include "library/playlisttablemodel.h" | ||
15 | 7 | #include "library/trackcollection.h" | 8 | #include "library/trackcollection.h" |
18 | 8 | #include "library/playlisttablemodel.h" | 9 | #include "playerinfo.h" |
19 | 9 | #include "dlgautodj.h" | 10 | #include "widget/wskincolor.h" |
20 | 11 | #include "widget/wtracktableview.h" | ||
21 | 12 | #include "widget/wwidget.h" | ||
22 | 10 | 13 | ||
23 | 14 | #define CONFIG_KEY "[Auto DJ]" | ||
24 | 11 | 15 | ||
25 | 12 | DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, | 16 | DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, |
29 | 13 | TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) | 17 | TrackCollection* pTrackCollection, |
30 | 14 | : QWidget(parent), Ui::DlgAutoDJ(), m_playlistDao(pTrackCollection->getPlaylistDAO()) | 18 | MixxxKeyboard* pKeyboard) |
31 | 15 | { | 19 | : QWidget(parent), |
32 | 20 | Ui::DlgAutoDJ(), | ||
33 | 21 | m_pConfig(pConfig), | ||
34 | 22 | m_pTrackCollection(pTrackCollection), | ||
35 | 23 | m_pTrackTableView( | ||
36 | 24 | new WTrackTableView(this, pConfig, m_pTrackCollection)), | ||
37 | 25 | m_playlistDao(pTrackCollection->getPlaylistDAO()), | ||
38 | 26 | m_bFadeNow(false), | ||
39 | 27 | m_eState(ADJ_DISABLED), | ||
40 | 28 | m_posThreshold1(1.0f), | ||
41 | 29 | m_posThreshold2(1.0f) { | ||
42 | 16 | setupUi(this); | 30 | setupUi(this); |
43 | 17 | 31 | ||
44 | 18 | m_pConfig = pConfig; | ||
45 | 19 | m_pTrackCollection = pTrackCollection; | ||
46 | 20 | m_bAutoDJEnabled = false; | ||
47 | 21 | m_bPlayer1Primed = false; | ||
48 | 22 | m_bPlayer2Primed = false; | ||
49 | 23 | m_pTrackTableView = new WTrackTableView(this, pConfig, m_pTrackCollection); | ||
50 | 24 | m_pTrackTableView->installEventFilter(pKeyboard); | 32 | m_pTrackTableView->installEventFilter(pKeyboard); |
51 | 25 | |||
52 | 26 | connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), | 33 | connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), |
53 | 27 | this, SIGNAL(loadTrack(TrackPointer))); | 34 | this, SIGNAL(loadTrack(TrackPointer))); |
54 | 28 | connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), | 35 | connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), |
55 | @@ -34,8 +41,8 @@ | |||
56 | 34 | m_pTrackTablePlaceholder->hide(); | 41 | m_pTrackTablePlaceholder->hide(); |
57 | 35 | box->insertWidget(1, m_pTrackTableView); | 42 | box->insertWidget(1, m_pTrackTableView); |
58 | 36 | 43 | ||
61 | 37 | m_pAutoDJTableModel = new PlaylistTableModel(this, pTrackCollection, | 44 | m_pAutoDJTableModel = new PlaylistTableModel(this, pTrackCollection, |
62 | 38 | "mixxx.db.model.autodj"); | 45 | "mixxx.db.model.autodj"); |
63 | 39 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | 46 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); |
64 | 40 | if (playlistId < 0) { | 47 | if (playlistId < 0) { |
65 | 41 | m_playlistDao.createPlaylist(AUTODJ_TABLE, true); | 48 | m_playlistDao.createPlaylist(AUTODJ_TABLE, true); |
66 | @@ -44,7 +51,7 @@ | |||
67 | 44 | m_pAutoDJTableModel->setPlaylist(playlistId); | 51 | m_pAutoDJTableModel->setPlaylist(playlistId); |
68 | 45 | m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); | 52 | m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); |
69 | 46 | 53 | ||
71 | 47 | //Override some playlist-view properties: | 54 | // Override some playlist-view properties: |
72 | 48 | 55 | ||
73 | 49 | // Do not set this because it disables auto-scrolling | 56 | // Do not set this because it disables auto-scrolling |
74 | 50 | //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); | 57 | //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); |
75 | @@ -58,40 +65,49 @@ | |||
76 | 58 | connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), | 65 | connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), |
77 | 59 | this, SLOT(toggleAutoDJ(bool))); _blah; | 66 | this, SLOT(toggleAutoDJ(bool))); _blah; |
78 | 60 | 67 | ||
79 | 68 | // playposition is from -0.14 to + 1.14 | ||
80 | 61 | m_pCOPlayPos1 = new ControlObjectThreadMain( | 69 | m_pCOPlayPos1 = new ControlObjectThreadMain( |
82 | 62 | ControlObject::getControl(ConfigKey("[Channel1]", "playposition"))); | 70 | ControlObject::getControl(ConfigKey("[Channel1]", "playposition"))); |
83 | 63 | m_pCOPlayPos2 = new ControlObjectThreadMain( | 71 | m_pCOPlayPos2 = new ControlObjectThreadMain( |
85 | 64 | ControlObject::getControl(ConfigKey("[Channel2]", "playposition"))); | 72 | ControlObject::getControl(ConfigKey("[Channel2]", "playposition"))); |
86 | 65 | m_pCOPlay1 = new ControlObjectThreadMain( | 73 | m_pCOPlay1 = new ControlObjectThreadMain( |
88 | 66 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); | 74 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); |
89 | 67 | m_pCOPlay2 = new ControlObjectThreadMain( | 75 | m_pCOPlay2 = new ControlObjectThreadMain( |
91 | 68 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); | 76 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); |
92 | 77 | m_pCOPlay1Fb = new ControlObjectThreadMain( | ||
93 | 78 | ControlObject::getControl(ConfigKey("[Channel1]", "play"))); | ||
94 | 79 | m_pCOPlay2Fb = new ControlObjectThreadMain( | ||
95 | 80 | ControlObject::getControl(ConfigKey("[Channel2]", "play"))); | ||
96 | 69 | m_pCORepeat1 = new ControlObjectThreadMain( | 81 | m_pCORepeat1 = new ControlObjectThreadMain( |
98 | 70 | ControlObject::getControl(ConfigKey("[Channel1]", "repeat"))); | 82 | ControlObject::getControl(ConfigKey("[Channel1]", "repeat"))); |
99 | 71 | m_pCORepeat2 = new ControlObjectThreadMain( | 83 | m_pCORepeat2 = new ControlObjectThreadMain( |
101 | 72 | ControlObject::getControl(ConfigKey("[Channel2]", "repeat"))); | 84 | ControlObject::getControl(ConfigKey("[Channel2]", "repeat"))); |
102 | 73 | m_pCOCrossfader = new ControlObjectThreadMain( | 85 | m_pCOCrossfader = new ControlObjectThreadMain( |
104 | 74 | ControlObject::getControl(ConfigKey("[Master]", "crossfader"))); | 86 | ControlObject::getControl(ConfigKey("[Master]", "crossfader"))); |
105 | 75 | } | 87 | } |
106 | 76 | 88 | ||
109 | 77 | DlgAutoDJ::~DlgAutoDJ() | 89 | DlgAutoDJ::~DlgAutoDJ() { |
110 | 78 | { | 90 | qDebug() << "~DlgAutoDJ()"; |
111 | 79 | delete m_pCOPlayPos1; | 91 | delete m_pCOPlayPos1; |
112 | 80 | delete m_pCOPlayPos2; | 92 | delete m_pCOPlayPos2; |
113 | 81 | delete m_pCOPlay1; | 93 | delete m_pCOPlay1; |
114 | 82 | delete m_pCOPlay2; | 94 | delete m_pCOPlay2; |
115 | 95 | delete m_pCOPlay1Fb; | ||
116 | 96 | delete m_pCOPlay2Fb; | ||
117 | 97 | delete m_pCORepeat1; | ||
118 | 83 | delete m_pCORepeat2; | 98 | delete m_pCORepeat2; |
119 | 84 | delete m_pCOCrossfader; | 99 | delete m_pCOCrossfader; |
120 | 100 | // Delete m_pTrackTableView before the table model. This is because the | ||
121 | 101 | // table view saves the header state using the model. | ||
122 | 102 | delete m_pTrackTableView; | ||
123 | 103 | delete m_pAutoDJTableModel; | ||
124 | 85 | } | 104 | } |
125 | 86 | 105 | ||
128 | 87 | void DlgAutoDJ::onShow() | 106 | void DlgAutoDJ::onShow() { |
127 | 88 | { | ||
129 | 89 | m_pAutoDJTableModel->select(); | 107 | m_pAutoDJTableModel->select(); |
130 | 90 | } | 108 | } |
131 | 91 | 109 | ||
135 | 92 | void DlgAutoDJ::setup(QDomNode node) | 110 | void DlgAutoDJ::setup(QDomNode node) { |
133 | 93 | { | ||
134 | 94 | |||
136 | 95 | QPalette pal = palette(); | 111 | QPalette pal = palette(); |
137 | 96 | 112 | ||
138 | 97 | // Row colors | 113 | // Row colors |
139 | @@ -108,9 +124,6 @@ | |||
140 | 108 | // the future this should be configurable from the skin with this as the | 124 | // the future this should be configurable from the skin with this as the |
141 | 109 | // fallback option | 125 | // fallback option |
142 | 110 | QColor text(255 - r1.red(), 255 - r1.green(), 255 - r1.blue()); | 126 | QColor text(255 - r1.red(), 255 - r1.green(), 255 - r1.blue()); |
143 | 111 | |||
144 | 112 | //setAlternatingRowColors ( true ); | ||
145 | 113 | |||
146 | 114 | QColor fgColor; | 127 | QColor fgColor; |
147 | 115 | fgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor")); | 128 | fgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor")); |
148 | 116 | fgColor = WSkinColor::getCorrectColor(fgColor); | 129 | fgColor = WSkinColor::getCorrectColor(fgColor); |
149 | @@ -119,26 +132,24 @@ | |||
150 | 119 | pal.setColor(QPalette::AlternateBase, r2); | 132 | pal.setColor(QPalette::AlternateBase, r2); |
151 | 120 | pal.setColor(QPalette::Text, text); | 133 | pal.setColor(QPalette::Text, text); |
152 | 121 | pal.setColor(QPalette::WindowText, fgColor); | 134 | pal.setColor(QPalette::WindowText, fgColor); |
153 | 122 | |||
154 | 123 | } | 135 | } |
155 | 124 | 136 | ||
156 | 125 | setPalette(pal); | 137 | setPalette(pal); |
157 | 126 | 138 | ||
158 | 127 | pushButtonAutoDJ->setPalette(pal); | 139 | pushButtonAutoDJ->setPalette(pal); |
173 | 128 | //m_pTrackTableView->setPalette(pal); //Since we're getting this passed into us already created, | 140 | |
174 | 129 | //shouldn't need to set the palette. | 141 | // Since we're getting this passed into us already created, shouldn't need |
175 | 130 | } | 142 | // to set the palette. |
176 | 131 | 143 | //m_pTrackTableView->setPalette(pal); | |
177 | 132 | void DlgAutoDJ::onSearchStarting() | 144 | } |
178 | 133 | { | 145 | |
179 | 134 | } | 146 | void DlgAutoDJ::onSearchStarting() { |
180 | 135 | 147 | } | |
181 | 136 | void DlgAutoDJ::onSearchCleared() | 148 | |
182 | 137 | { | 149 | void DlgAutoDJ::onSearchCleared() { |
183 | 138 | } | 150 | } |
184 | 139 | 151 | ||
185 | 140 | void DlgAutoDJ::onSearch(const QString& text) | 152 | void DlgAutoDJ::onSearch(const QString& text) { |
172 | 141 | { | ||
186 | 142 | m_pAutoDJTableModel->search(text); | 153 | m_pAutoDJTableModel->search(text); |
187 | 143 | } | 154 | } |
188 | 144 | 155 | ||
189 | @@ -154,204 +165,427 @@ | |||
190 | 154 | m_pTrackTableView->moveSelection(delta); | 165 | m_pTrackTableView->moveSelection(delta); |
191 | 155 | } | 166 | } |
192 | 156 | 167 | ||
195 | 157 | void DlgAutoDJ::shufflePlaylist(bool buttonChecked) | 168 | void DlgAutoDJ::shufflePlaylist(bool buttonChecked) { |
194 | 158 | { | ||
196 | 159 | Q_UNUSED(buttonChecked); | 169 | Q_UNUSED(buttonChecked); |
197 | 160 | qDebug() << "Shuffling AutoDJ playlist"; | 170 | qDebug() << "Shuffling AutoDJ playlist"; |
199 | 161 | m_pAutoDJTableModel->shuffleTracks(m_pAutoDJTableModel->index(0, 0)); | 171 | int row; |
200 | 172 | if(m_eState == ADJ_DISABLED) { | ||
201 | 173 | row = 0; | ||
202 | 174 | } else { | ||
203 | 175 | row = 1; | ||
204 | 176 | } | ||
205 | 177 | m_pAutoDJTableModel->shuffleTracks(m_pAutoDJTableModel->index(row, 0)); | ||
206 | 162 | qDebug() << "Shuffling done"; | 178 | qDebug() << "Shuffling done"; |
207 | 163 | } | 179 | } |
208 | 164 | 180 | ||
219 | 165 | void DlgAutoDJ::toggleAutoDJ(bool toggle) | 181 | void DlgAutoDJ::skipNext(bool buttonChecked) { |
220 | 166 | { | 182 | Q_UNUSED(buttonChecked); |
221 | 167 | if (toggle) //Enable Auto DJ | 183 | qDebug() << "Skip Next"; |
222 | 168 | { | 184 | // Load the next song from the queue. |
223 | 169 | if (m_pCOPlay1->get() == 1.0f && m_pCOPlay2->get() == 1.0f) { | 185 | if (m_pCOPlay1Fb->get() == 0.0f) { |
224 | 170 | qDebug() << "One player must be stopped before enabling Auto DJ mode"; | 186 | removePlayingTrackFromQueue("[Channel1]"); |
225 | 171 | pushButtonAutoDJ->setChecked(false); | 187 | loadNextTrackFromQueue(); |
226 | 172 | return; | 188 | } else if (m_pCOPlay2Fb->get() == 0.0f) { |
227 | 173 | } | 189 | removePlayingTrackFromQueue("[Channel2]"); |
228 | 174 | 190 | loadNextTrackFromQueue(); | |
229 | 191 | } | ||
230 | 192 | } | ||
231 | 193 | |||
232 | 194 | void DlgAutoDJ::fadeNow(bool buttonChecked) { | ||
233 | 195 | Q_UNUSED(buttonChecked); | ||
234 | 196 | qDebug() << "Fade Now"; | ||
235 | 197 | if (m_eState == ADJ_IDLE) { | ||
236 | 198 | m_bFadeNow = true; | ||
237 | 199 | double crossfader = m_pCOCrossfader->get(); | ||
238 | 200 | if (crossfader <= 0.3f && m_pCOPlay1Fb->get() == 1.0f) { | ||
239 | 201 | m_posThreshold1 = m_pCOPlayPos1->get() - | ||
240 | 202 | ((crossfader + 1.0f) / 2 * (m_fadeDuration1)); | ||
241 | 203 | // Repeat is disabled by FadeNow but disables auto Fade | ||
242 | 204 | m_pCORepeat1->slotSet(0.0f); | ||
243 | 205 | } else if (crossfader >= -0.3f && m_pCOPlay2Fb->get() == 1.0f) { | ||
244 | 206 | m_posThreshold2 = m_pCOPlayPos2->get() - | ||
245 | 207 | ((1.0f - crossfader) / 2 * (m_fadeDuration2)); | ||
246 | 208 | // Repeat is disabled by FadeNow but disables auto Fade | ||
247 | 209 | m_pCORepeat2->slotSet(0.0f); | ||
248 | 210 | } | ||
249 | 211 | } | ||
250 | 212 | } | ||
251 | 213 | |||
252 | 214 | void DlgAutoDJ::toggleAutoDJ(bool toggle) { | ||
253 | 215 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; | ||
254 | 216 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; | ||
255 | 217 | |||
256 | 218 | if (toggle) { // Enable Auto DJ | ||
257 | 219 | if (deck1Playing && deck2Playing) { | ||
258 | 220 | QMessageBox::warning( | ||
259 | 221 | NULL, tr("Auto-DJ"), | ||
260 | 222 | tr("One deck must be stopped to enable Auto-DJ mode."), | ||
261 | 223 | QMessageBox::Ok); | ||
262 | 224 | qDebug() << "One deck must be stopped before enabling Auto DJ mode"; | ||
263 | 225 | pushButtonAutoDJ->setChecked(false); | ||
264 | 226 | return; | ||
265 | 227 | } | ||
266 | 228 | |||
267 | 229 | // Never load the same track if it is already playing | ||
268 | 230 | if (deck1Playing) { | ||
269 | 231 | removePlayingTrackFromQueue("[Channel1]"); | ||
270 | 232 | } | ||
271 | 233 | if (deck2Playing) { | ||
272 | 234 | removePlayingTrackFromQueue("[Channel2]"); | ||
273 | 235 | } | ||
274 | 236 | |||
275 | 237 | TrackPointer nextTrack = getNextTrackFromQueue(); | ||
276 | 238 | if (!nextTrack) { | ||
277 | 239 | qDebug() << "Queue is empty now"; | ||
278 | 240 | pushButtonAutoDJ->setChecked(false); | ||
279 | 241 | return; | ||
280 | 242 | } | ||
281 | 243 | |||
282 | 244 | // Track is available so GO | ||
283 | 245 | pushButtonAutoDJ->setToolTip(tr("Disable Auto DJ")); | ||
284 | 175 | pushButtonAutoDJ->setText(tr("Disable Auto DJ")); | 246 | pushButtonAutoDJ->setText(tr("Disable Auto DJ")); |
286 | 176 | m_bAutoDJEnabled = true; | 247 | qDebug() << "Auto DJ enabled"; |
287 | 248 | |||
288 | 177 | connect(m_pCOPlayPos1, SIGNAL(valueChanged(double)), | 249 | connect(m_pCOPlayPos1, SIGNAL(valueChanged(double)), |
290 | 178 | this, SLOT(player1PositionChanged(double))); | 250 | this, SLOT(player1PositionChanged(double))); |
291 | 179 | connect(m_pCOPlayPos2, SIGNAL(valueChanged(double)), | 251 | connect(m_pCOPlayPos2, SIGNAL(valueChanged(double)), |
350 | 180 | this, SLOT(player2PositionChanged(double))); | 252 | this, SLOT(player2PositionChanged(double))); |
351 | 181 | 253 | ||
352 | 182 | 254 | connect(m_pCOPlay1Fb, SIGNAL(valueChanged(double)), | |
353 | 183 | //Manually override the "next track is already loaded" flag | 255 | this, SLOT(player1PlayChanged(double))); |
354 | 184 | //because we've already primed a player with the first track. | 256 | connect(m_pCOPlay2Fb, SIGNAL(valueChanged(double)), |
355 | 185 | //We do this so that you don't lose the first song in your | 257 | this, SLOT(player2PlayChanged(double))); |
356 | 186 | //Auto DJ queue if you enable Auto DJ then change your mind | 258 | |
357 | 187 | //and disable it right away. This just makes it a little bit | 259 | if (!deck1Playing && !deck2Playing) { |
358 | 188 | //more user friendly. :) | 260 | // both decks are stopped |
359 | 189 | //m_bNextTrackAlreadyLoaded = true; | 261 | m_eState = ADJ_ENABLE_P1LOADED; |
360 | 190 | m_bPlayer1Primed = false; | 262 | // Force Update on load Track |
361 | 191 | m_bPlayer2Primed = false; | 263 | m_pCOPlayPos1->slotSet(-0.001f); |
362 | 192 | 264 | } else { | |
363 | 193 | //If there are no tracks in the Auto DJ queue, disable Auto DJ mode. | 265 | m_eState = ADJ_IDLE; |
364 | 194 | /* if (m_pAutoDJTableModel->rowCount() == 0) | 266 | if (deck1Playing) { |
365 | 195 | { | 267 | // deck 1 is already playing |
366 | 196 | //Queue was empty. Disable and return. | 268 | player1PlayChanged(1.0f); |
367 | 197 | pushButtonAutoDJ->setChecked(false); | 269 | } else { |
368 | 198 | return; | 270 | // deck 2 is already playing |
369 | 199 | }*/ //don't need this code, above block takes care of this case. | 271 | player2PlayChanged(1.0f); |
370 | 200 | 272 | } | |
371 | 201 | //If only one of the players is playing... | 273 | } |
372 | 202 | if ((m_pCOPlay1->get() == 1.0f && m_pCOPlay2->get() == 0.0f) || | 274 | // Loads into first deck If stopped else into second else not |
373 | 203 | (m_pCOPlay1->get() == 0.0f && m_pCOPlay2->get() == 1.0f)) | 275 | emit(loadTrack(nextTrack)); |
374 | 204 | { | 276 | } else { // Disable Auto DJ |
375 | 205 | //Load the first song from the queue. | 277 | pushButtonAutoDJ->setToolTip(tr("Enable Auto DJ")); |
318 | 206 | if (!loadNextTrackFromQueue(false)) { | ||
319 | 207 | //Queue was empty. Disable and return. | ||
320 | 208 | pushButtonAutoDJ->setChecked(false); | ||
321 | 209 | return; | ||
322 | 210 | } | ||
323 | 211 | //Set the primed flags so the crossfading algorithm knows | ||
324 | 212 | //that it doesn't need to load a track into whatever player. | ||
325 | 213 | if (m_pCOPlay1->get() == 1.0f) | ||
326 | 214 | { | ||
327 | 215 | m_bPlayer1Primed = true; | ||
328 | 216 | } | ||
329 | 217 | if (m_pCOPlay2->get() == 1.0f) | ||
330 | 218 | { | ||
331 | 219 | m_bPlayer2Primed = true; | ||
332 | 220 | } | ||
333 | 221 | } | ||
334 | 222 | //If both players are stopped, start the first one (which should have just had a track loaded into it) | ||
335 | 223 | else if (m_pCOPlay1->get() == 0.0f && m_pCOPlay2->get() == 0.0f) { | ||
336 | 224 | //Load the first song from the queue. | ||
337 | 225 | if (!loadNextTrackFromQueue(false)) { | ||
338 | 226 | //Queue was empty. Disable and return. | ||
339 | 227 | pushButtonAutoDJ->setChecked(false); | ||
340 | 228 | return; | ||
341 | 229 | } | ||
342 | 230 | m_pCOCrossfader->slotSet(-1.0f); //Move crossfader to the left! | ||
343 | 231 | m_pCORepeat1->slotSet(1.0f); //Turn on repeat mode to avoid race condition between async load | ||
344 | 232 | //and "play" command. | ||
345 | 233 | m_pCOPlay1->slotSet(1.0f); //Play the track in player 1 | ||
346 | 234 | } | ||
347 | 235 | } | ||
348 | 236 | else //Disable Auto DJ | ||
349 | 237 | { | ||
376 | 238 | pushButtonAutoDJ->setText(tr("Enable Auto DJ")); | 278 | pushButtonAutoDJ->setText(tr("Enable Auto DJ")); |
377 | 239 | qDebug() << "Auto DJ disabled"; | 279 | qDebug() << "Auto DJ disabled"; |
379 | 240 | m_bAutoDJEnabled = false; | 280 | m_eState = ADJ_DISABLED; |
380 | 281 | m_bFadeNow = false; | ||
381 | 241 | m_pCOPlayPos1->disconnect(this); | 282 | m_pCOPlayPos1->disconnect(this); |
382 | 242 | m_pCOPlayPos2->disconnect(this); | 283 | m_pCOPlayPos2->disconnect(this); |
488 | 243 | m_pCORepeat1->slotSet(0.0f); //Turn off repeat mode | 284 | m_pCOPlay1->disconnect(this); |
489 | 244 | m_pCORepeat2->slotSet(0.0f); //Turn off repeat mode | 285 | m_pCOPlay2->disconnect(this); |
490 | 245 | } | 286 | } |
491 | 246 | } | 287 | } |
492 | 247 | 288 | ||
493 | 248 | void DlgAutoDJ::player1PositionChanged(double value) | 289 | void DlgAutoDJ::player1PositionChanged(double value) { |
494 | 249 | { | 290 | // 95% playback is when we crossfade and do stuff |
495 | 250 | const float posThreshold = 0.95; //95% playback is when we crossfade and do stuff | 291 | // const float posThreshold = 0.95; |
496 | 251 | if (value > posThreshold) | 292 | |
497 | 252 | { | 293 | // 0.05; // 5% playback is crossfade duration |
498 | 253 | //Crossfade! | 294 | const float fadeDuration = m_fadeDuration1; |
499 | 254 | float crossfadeValue = -1.0f + 2*(value-posThreshold)/(1.0f-posThreshold); | 295 | |
500 | 255 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | 296 | // qDebug() << "player1PositionChanged(" << value << ")"; |
501 | 256 | //If the second player doesn't have a new track loaded in it... | 297 | if (m_eState == ADJ_DISABLED) { |
502 | 257 | if (!m_bPlayer2Primed) | 298 | //nothing to do |
503 | 258 | { | 299 | return; |
504 | 259 | qDebug() << "pp1c loading"; | 300 | } |
505 | 260 | 301 | ||
506 | 261 | //Load the next track into Player 2 | 302 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; |
507 | 262 | //if (!m_bNextTrackAlreadyLoaded) //Fudge to make us not skip the first track | 303 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; |
508 | 263 | { | 304 | |
509 | 264 | if (!loadNextTrackFromQueue(true)) | 305 | if (m_eState == ADJ_ENABLE_P1LOADED) { |
510 | 265 | return; | 306 | // Auto DJ Start |
511 | 266 | } | 307 | if (!deck1Playing && !deck2Playing) { |
512 | 267 | //m_bNextTrackAlreadyLoaded = false; //Reset fudge | 308 | m_pCOCrossfader->slotSet(-1.0f); // Move crossfader to the left! |
513 | 268 | m_bPlayer2Primed = true; | 309 | m_pCOPlay1->slotSet(1.0f); // Play the track in player 1 |
514 | 269 | } | 310 | removePlayingTrackFromQueue("[Channel1]"); |
515 | 270 | //If the second player is stopped... | 311 | } else { |
516 | 271 | if (m_pCOPlay2->get() == 0.0f) | 312 | m_eState = ADJ_IDLE; |
517 | 272 | { | 313 | if (deck1Playing && !deck2Playing) { |
518 | 273 | //Turn off repeat mode to tell Player 1 to stop at the end | 314 | // Here we are, if first deck was playing before starting Auto DJ |
519 | 274 | m_pCORepeat1->slotSet(0.0f); | 315 | // or if it was started just before |
520 | 275 | 316 | loadNextTrackFromQueue(); | |
521 | 276 | //Turn on repeat mode to tell Player 2 to start playing when the new track is loaded. | 317 | // if we start the deck from code we don`t get a signal |
522 | 277 | //This helps us get around the fact that it takes time for the track to be loaded | 318 | player1PlayChanged(1.0f); |
523 | 278 | //and that is executed asynchronously (so we get around the race condition). | 319 | // call function manually |
524 | 279 | m_pCORepeat2->slotSet(1.0f); | 320 | } else { |
525 | 280 | //Play! | 321 | player2PlayChanged(1.0f); |
526 | 281 | m_pCOPlay2->slotSet(1.0f); | 322 | } |
527 | 282 | } | 323 | } |
528 | 283 | 324 | return; | |
529 | 284 | if (value == 1.0f) | 325 | } |
530 | 285 | { | 326 | |
531 | 286 | m_pCOPlay1->slotSet(0.0f); //Stop the player | 327 | if (m_eState == ADJ_P2FADING) { |
532 | 287 | m_bPlayer1Primed = false; | 328 | if (deck1Playing && !deck2Playing) { |
533 | 288 | } | 329 | // End State |
534 | 289 | } | 330 | m_pCOCrossfader->slotSet(-1.0f); // Move crossfader to the left! |
535 | 290 | } | 331 | // qDebug() << "1: m_pCOCrossfader->slotSet(_-1.0f_);"; |
536 | 291 | 332 | m_eState = ADJ_IDLE; | |
537 | 292 | void DlgAutoDJ::player2PositionChanged(double value) | 333 | loadNextTrackFromQueue(); |
538 | 293 | { | 334 | } |
539 | 294 | const float posThreshold = 0.95; //95% playback is when we crossfade and do stuff | 335 | return; |
540 | 295 | if (value > posThreshold) | 336 | } |
541 | 296 | { | 337 | |
542 | 297 | //Crossfade! | 338 | if (m_eState == ADJ_IDLE) { |
543 | 298 | float crossfadeValue = 1.0f - 2*(value-posThreshold)/(1.0f-posThreshold); | 339 | if (m_pCORepeat1->get() == 1.0f) { |
544 | 299 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | 340 | // repeat disables auto DJ |
545 | 300 | 341 | return; | |
546 | 301 | //If the first player doesn't have the next track loaded, load a track into | 342 | } |
547 | 302 | //it and start playing it! | 343 | } |
548 | 303 | if (!m_bPlayer1Primed) | 344 | |
549 | 304 | { | 345 | if (value >= m_posThreshold1) { |
550 | 305 | //Load the next track into player 1 | 346 | if (m_eState == ADJ_IDLE && |
551 | 306 | //if (!m_bNextTrackAlreadyLoaded) //Fudge to make us not skip the first track | 347 | (deck1Playing || m_posThreshold1 >= 1.0f)) { |
552 | 307 | { | 348 | if (!deck2Playing) { |
553 | 308 | if (!loadNextTrackFromQueue(true)) | 349 | // Start Deck 2 |
554 | 309 | return; | 350 | player2PlayChanged(1.0f); |
555 | 310 | } | 351 | m_pCOPlay2->slotSet(1.0f); |
556 | 311 | //m_bNextTrackAlreadyLoaded = false; //Reset fudge | 352 | if (fadeDuration < 0.0f) { |
557 | 312 | m_bPlayer1Primed = true; | 353 | // Scroll back for pause between tracks |
558 | 313 | } | 354 | m_pCOPlayPos2->slotSet(m_fadeDuration2); |
559 | 314 | if (m_pCOPlay1->get() == 0.0f) | 355 | } |
560 | 315 | { | 356 | } |
561 | 316 | //Turn off repeat mode to tell Player 2 to stop at the end | 357 | removePlayingTrackFromQueue("[Channel2]"); |
562 | 317 | m_pCORepeat2->slotSet(0.0f); | 358 | m_eState = ADJ_P1FADING; |
563 | 318 | 359 | } | |
564 | 319 | //Turn on repeat mode to tell Player 1 to start playing when the new track is loaded. | 360 | |
565 | 320 | //This helps us get around the fact that it takes time for the track to be loaded | 361 | float posFadeEnd = math_min(1.0, m_posThreshold1 + fadeDuration); |
566 | 321 | //and that is executed asynchronously (so we get around the race condition). | 362 | |
567 | 322 | m_pCORepeat1->slotSet(1.0f); | 363 | if (value >= posFadeEnd) { |
568 | 323 | m_pCOPlay1->slotSet(1.0f); | 364 | // Pre-EndState |
569 | 324 | } | 365 | // m_pCOCrossfader->slotSet(1.0f); //Move crossfader to the right! |
570 | 325 | 366 | ||
571 | 326 | if (value == 1.0f) | 367 | m_pCOPlay1->slotSet(0.0f); // Stop the player |
572 | 327 | { | 368 | //m_posThreshold = 1.0f - fadeDuration; // back to default |
573 | 328 | m_pCOPlay2->slotSet(0.0f); //Stop the player | 369 | |
574 | 329 | m_bPlayer2Primed = false; | 370 | // does not work always immediately after stop |
575 | 330 | } | 371 | // loadNextTrackFromQueue(); |
576 | 331 | } | 372 | // m_eState = ADJ_IDLE; // Fading ready |
577 | 332 | } | 373 | } else { |
578 | 333 | 374 | // Crossfade! | |
579 | 334 | 375 | float crossfadeValue = -1.0f + | |
580 | 335 | bool DlgAutoDJ::loadNextTrackFromQueue(bool removeTopMostBeforeLoading) | 376 | 2*(value-m_posThreshold1)/(posFadeEnd-m_posThreshold1); |
581 | 336 | { | 377 | // crossfadeValue = -1.0f -> + 1.0f |
582 | 337 | if (removeTopMostBeforeLoading) { | 378 | // Move crossfader to the right! |
583 | 338 | //Only remove the top track if this isn't the start of Auto DJ mode. | 379 | m_pCOCrossfader->slotSet(crossfadeValue); |
584 | 339 | m_pAutoDJTableModel->removeTrack(m_pAutoDJTableModel->index(0, 0)); | 380 | // qDebug() << "1: m_pCOCrossfader->slotSet " << crossfadeValue; |
585 | 340 | } | 381 | } |
586 | 341 | 382 | } | |
587 | 342 | //Get the track at the top of the playlist... | 383 | } |
588 | 343 | TrackPointer nextTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(0, 0)); | 384 | |
589 | 344 | 385 | void DlgAutoDJ::player2PositionChanged(double value) { | |
590 | 345 | if (!nextTrack) //We ran out of tracks in the queue... | 386 | // 95% playback is when we crossfade and do stuff |
591 | 346 | { | 387 | // const float posThreshold = 0.95; |
592 | 347 | //Disable auto DJ and return... | 388 | |
593 | 389 | // 0.05; // 5% playback is crossfade duration | ||
594 | 390 | float fadeDuration = m_fadeDuration2; | ||
595 | 391 | |||
596 | 392 | //qDebug() << "player2PositionChanged(" << value << ")"; | ||
597 | 393 | if (m_eState == ADJ_DISABLED) { | ||
598 | 394 | //nothing to do | ||
599 | 395 | return; | ||
600 | 396 | } | ||
601 | 397 | |||
602 | 398 | bool deck1Playing = m_pCOPlay1Fb->get() == 1.0f; | ||
603 | 399 | bool deck2Playing = m_pCOPlay2Fb->get() == 1.0f; | ||
604 | 400 | |||
605 | 401 | if (m_eState == ADJ_P1FADING) { | ||
606 | 402 | if (!deck1Playing && deck2Playing) { | ||
607 | 403 | // End State | ||
608 | 404 | // Move crossfader to the right! | ||
609 | 405 | m_pCOCrossfader->slotSet(1.0f); | ||
610 | 406 | // qDebug() << "1: m_pCOCrossfader->slotSet(_1.0f_);"; | ||
611 | 407 | m_eState = ADJ_IDLE; | ||
612 | 408 | loadNextTrackFromQueue(); | ||
613 | 409 | } | ||
614 | 410 | return; | ||
615 | 411 | } | ||
616 | 412 | |||
617 | 413 | if (m_eState == ADJ_IDLE) { | ||
618 | 414 | if (m_pCORepeat2->get() == 1.0f) { | ||
619 | 415 | //repeat disables auto DJ | ||
620 | 416 | return; | ||
621 | 417 | } | ||
622 | 418 | } | ||
623 | 419 | |||
624 | 420 | if (value >= m_posThreshold2) { | ||
625 | 421 | if (m_eState == ADJ_IDLE && | ||
626 | 422 | (deck2Playing || m_posThreshold2 >= 1.0f)) { | ||
627 | 423 | if (!deck1Playing) { | ||
628 | 424 | player1PlayChanged(1.0f); | ||
629 | 425 | m_pCOPlay1->slotSet(1.0f); | ||
630 | 426 | if (fadeDuration < 0) { | ||
631 | 427 | // Scroll back for pause between tracks | ||
632 | 428 | m_pCOPlayPos1->slotSet(m_fadeDuration1); | ||
633 | 429 | } | ||
634 | 430 | } | ||
635 | 431 | removePlayingTrackFromQueue("[Channel1]"); | ||
636 | 432 | m_eState = ADJ_P2FADING; | ||
637 | 433 | } | ||
638 | 434 | |||
639 | 435 | float posFadeEnd = math_min(1.0, m_posThreshold2 + fadeDuration); | ||
640 | 436 | |||
641 | 437 | if (value >= posFadeEnd) { | ||
642 | 438 | // Pre-End State | ||
643 | 439 | //m_pCOCrossfader->slotSet(-1.0f); //Move crossfader to the left! | ||
644 | 440 | |||
645 | 441 | m_pCOPlay2->slotSet(0.0f); // Stop the player | ||
646 | 442 | |||
647 | 443 | //m_posThreshold = 1.0f - fadeDuration; // back to default | ||
648 | 444 | |||
649 | 445 | // does not work always immediately after stop | ||
650 | 446 | // loadNextTrackFromQueue(); | ||
651 | 447 | // m_eState = ADJ_IDLE; // Fading ready | ||
652 | 448 | } else { | ||
653 | 449 | //Crossfade! | ||
654 | 450 | float crossfadeValue = 1.0f - | ||
655 | 451 | 2*(value-m_posThreshold2)/(posFadeEnd-m_posThreshold2); | ||
656 | 452 | // crossfadeValue = 1.0f -> + -1.0f | ||
657 | 453 | m_pCOCrossfader->slotSet(crossfadeValue); //Move crossfader to the right! | ||
658 | 454 | // qDebug() << "2: m_pCOCrossfader->slotSet " << crossfadeValue; | ||
659 | 455 | } | ||
660 | 456 | } | ||
661 | 457 | } | ||
662 | 458 | |||
663 | 459 | TrackPointer DlgAutoDJ::getNextTrackFromQueue() { | ||
664 | 460 | // Get the track at the top of the playlist... | ||
665 | 461 | TrackPointer nextTrack; | ||
666 | 462 | |||
667 | 463 | while (true) { | ||
668 | 464 | nextTrack = m_pAutoDJTableModel->getTrack( | ||
669 | 465 | m_pAutoDJTableModel->index(0, 0)); | ||
670 | 466 | |||
671 | 467 | if (nextTrack) { | ||
672 | 468 | if (nextTrack->exists()) { | ||
673 | 469 | // found a valid Track | ||
674 | 470 | return nextTrack; | ||
675 | 471 | } else { | ||
676 | 472 | // Remove missing song from auto DJ playlist | ||
677 | 473 | m_pAutoDJTableModel->removeTrack( | ||
678 | 474 | m_pAutoDJTableModel->index(0, 0)); | ||
679 | 475 | } | ||
680 | 476 | } else { | ||
681 | 477 | // we are running out of tracks | ||
682 | 478 | break; | ||
683 | 479 | } | ||
684 | 480 | } | ||
685 | 481 | return nextTrack; | ||
686 | 482 | } | ||
687 | 483 | |||
688 | 484 | bool DlgAutoDJ::loadNextTrackFromQueue() { | ||
689 | 485 | TrackPointer nextTrack = getNextTrackFromQueue(); | ||
690 | 486 | |||
691 | 487 | // We ran out of tracks in the queue... | ||
692 | 488 | if (!nextTrack) { | ||
693 | 489 | // Disable auto DJ and return... | ||
694 | 348 | pushButtonAutoDJ->setChecked(false); | 490 | pushButtonAutoDJ->setChecked(false); |
695 | 491 | // And eject track as "End of auto DJ warning" | ||
696 | 492 | emit(loadTrack(nextTrack)); | ||
697 | 349 | return false; | 493 | return false; |
698 | 350 | } | 494 | } |
699 | 351 | 495 | ||
700 | 352 | //m_bNextTrackAlreadyLoaded = false; | ||
701 | 353 | |||
702 | 354 | emit(loadTrack(nextTrack)); | 496 | emit(loadTrack(nextTrack)); |
705 | 355 | 497 | return true; | |
706 | 356 | return true; | 498 | } |
707 | 499 | |||
708 | 500 | bool DlgAutoDJ::removePlayingTrackFromQueue(QString group) { | ||
709 | 501 | TrackPointer nextTrack, loadedTrack; | ||
710 | 502 | int nextId = 0, loadedId = 0; | ||
711 | 503 | |||
712 | 504 | // Get the track at the top of the playlist... | ||
713 | 505 | nextTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(0, 0)); | ||
714 | 506 | if (nextTrack) { | ||
715 | 507 | nextId = nextTrack->getId(); | ||
716 | 508 | } | ||
717 | 509 | |||
718 | 510 | // Get loaded track | ||
719 | 511 | loadedTrack = PlayerInfo::Instance().getTrackInfo(group); | ||
720 | 512 | if (loadedTrack) { | ||
721 | 513 | loadedId = loadedTrack->getId(); | ||
722 | 514 | } | ||
723 | 515 | |||
724 | 516 | // When enable auto DJ and Topmost Song is already on second deck, nothing to do | ||
725 | 517 | //BaseTrackPlayer::getLoadedTrack() | ||
726 | 518 | //pTrack = PlayerInfo::Instance().getCurrentPlayingTrack(); | ||
727 | 519 | |||
728 | 520 | if (loadedId != nextId) { | ||
729 | 521 | // Do not remove when the user has loaded a track manually | ||
730 | 522 | return false; | ||
731 | 523 | } | ||
732 | 524 | |||
733 | 525 | // remove the top track | ||
734 | 526 | m_pAutoDJTableModel->removeTrack(m_pAutoDJTableModel->index(0, 0)); | ||
735 | 527 | |||
736 | 528 | return true; | ||
737 | 529 | } | ||
738 | 530 | |||
739 | 531 | void DlgAutoDJ::player1PlayChanged(double value) { | ||
740 | 532 | //qDebug() << "player1PlayChanged(" << value << ")"; | ||
741 | 533 | if (value == 1.0f && m_eState == ADJ_IDLE) { | ||
742 | 534 | TrackPointer loadedTrack = | ||
743 | 535 | PlayerInfo::Instance().getTrackInfo("[Channel1]"); | ||
744 | 536 | if (loadedTrack) { | ||
745 | 537 | int TrackDuration = loadedTrack->getDuration(); | ||
746 | 538 | qDebug() << "TrackDuration = " << TrackDuration; | ||
747 | 539 | |||
748 | 540 | int autoDjTransition = 5; | ||
749 | 541 | |||
750 | 542 | if (TrackDuration > autoDjTransition) { | ||
751 | 543 | m_fadeDuration1 = static_cast<float>(autoDjTransition) / | ||
752 | 544 | static_cast<float>(TrackDuration); | ||
753 | 545 | } else { | ||
754 | 546 | m_fadeDuration1 = 0; | ||
755 | 547 | } | ||
756 | 548 | |||
757 | 549 | if (autoDjTransition > 0) { | ||
758 | 550 | m_posThreshold1 = 1.0f - m_fadeDuration1; | ||
759 | 551 | } else { | ||
760 | 552 | // in case of pause | ||
761 | 553 | m_posThreshold1 = 1.0f; | ||
762 | 554 | } | ||
763 | 555 | qDebug() << "m_fadeDuration1 = " << m_fadeDuration1; | ||
764 | 556 | } | ||
765 | 557 | } | ||
766 | 558 | } | ||
767 | 559 | |||
768 | 560 | void DlgAutoDJ::player2PlayChanged(double value) { | ||
769 | 561 | //qDebug() << "player2PlayChanged(" << value << ")"; | ||
770 | 562 | if (value == 1.0f && m_eState == ADJ_IDLE) { | ||
771 | 563 | TrackPointer loadedTrack = | ||
772 | 564 | PlayerInfo::Instance().getTrackInfo("[Channel2]"); | ||
773 | 565 | if (loadedTrack) { | ||
774 | 566 | int TrackDuration = loadedTrack->getDuration(); | ||
775 | 567 | qDebug() << "TrackDuration = " << TrackDuration; | ||
776 | 568 | |||
777 | 569 | int autoDjTransition = 5; | ||
778 | 570 | |||
779 | 571 | if (TrackDuration > autoDjTransition) { | ||
780 | 572 | m_fadeDuration2 = static_cast<float>(autoDjTransition) / | ||
781 | 573 | static_cast<float>(TrackDuration); | ||
782 | 574 | } else { | ||
783 | 575 | m_fadeDuration2 = 0; | ||
784 | 576 | } | ||
785 | 577 | |||
786 | 578 | if (autoDjTransition > 0) { | ||
787 | 579 | m_posThreshold2 = 1.0f - m_fadeDuration2; | ||
788 | 580 | } else { | ||
789 | 581 | // in case of pause | ||
790 | 582 | m_posThreshold2 = 1.0f; | ||
791 | 583 | } | ||
792 | 584 | qDebug() << "m_fadeDuration2 = " << m_fadeDuration2; | ||
793 | 585 | } | ||
794 | 586 | } | ||
795 | 587 | } | ||
796 | 588 | |||
797 | 589 | bool DlgAutoDJ::appendTrack(int trackId) { | ||
798 | 590 | return m_pAutoDJTableModel->appendTrack(trackId); | ||
799 | 357 | } | 591 | } |
800 | 358 | 592 | ||
801 | === modified file 'mixxx/src/dlgautodj.h' | |||
802 | --- mixxx/src/dlgautodj.h 2011-04-24 06:00:11 +0000 | |||
803 | +++ mixxx/src/dlgautodj.h 2012-05-31 20:47:26 +0000 | |||
804 | @@ -31,37 +31,59 @@ | |||
805 | 31 | virtual void loadSelectedTrack(); | 31 | virtual void loadSelectedTrack(); |
806 | 32 | virtual void loadSelectedTrackToGroup(QString group); | 32 | virtual void loadSelectedTrackToGroup(QString group); |
807 | 33 | virtual void moveSelection(int delta); | 33 | virtual void moveSelection(int delta); |
808 | 34 | virtual bool appendTrack(int trackId); | ||
809 | 34 | 35 | ||
810 | 35 | public slots: | 36 | public slots: |
811 | 36 | void shufflePlaylist(bool buttonChecked); | 37 | void shufflePlaylist(bool buttonChecked); |
812 | 38 | void skipNext(bool buttonChecked); | ||
813 | 39 | void fadeNow(bool buttonChecked); | ||
814 | 37 | void toggleAutoDJ(bool toggle); | 40 | void toggleAutoDJ(bool toggle); |
815 | 38 | void player1PositionChanged(double value); | 41 | void player1PositionChanged(double value); |
816 | 39 | void player2PositionChanged(double value); | 42 | void player2PositionChanged(double value); |
817 | 43 | void player1PlayChanged(double value); | ||
818 | 44 | void player2PlayChanged(double value); | ||
819 | 40 | 45 | ||
820 | 41 | signals: | 46 | signals: |
821 | 42 | void loadTrack(TrackPointer tio); | 47 | void loadTrack(TrackPointer tio); |
822 | 43 | void loadTrackToPlayer(TrackPointer tio, QString group); | 48 | void loadTrackToPlayer(TrackPointer tio, QString group); |
823 | 44 | 49 | ||
824 | 45 | private: | 50 | private: |
826 | 46 | bool loadNextTrackFromQueue(bool removeTopMostBeforeLoading); | 51 | enum ADJstates { |
827 | 52 | ADJ_IDLE = 0, | ||
828 | 53 | ADJ_P1FADING, | ||
829 | 54 | ADJ_P2FADING, | ||
830 | 55 | ADJ_ENABLE_P1LOADED, | ||
831 | 56 | ADJ_ENABLE_P1PLAYING, | ||
832 | 57 | ADJ_DISABLED | ||
833 | 58 | }; | ||
834 | 59 | |||
835 | 60 | TrackPointer getNextTrackFromQueue(); | ||
836 | 61 | bool loadNextTrackFromQueue(); | ||
837 | 62 | bool removePlayingTrackFromQueue(QString group); | ||
838 | 47 | 63 | ||
839 | 48 | ConfigObject<ConfigValue>* m_pConfig; | 64 | ConfigObject<ConfigValue>* m_pConfig; |
840 | 49 | TrackCollection* m_pTrackCollection; | 65 | TrackCollection* m_pTrackCollection; |
841 | 50 | WTrackTableView* m_pTrackTableView; | 66 | WTrackTableView* m_pTrackTableView; |
842 | 51 | PlaylistTableModel* m_pAutoDJTableModel; | 67 | PlaylistTableModel* m_pAutoDJTableModel; |
843 | 52 | PlaylistDAO& m_playlistDao; | 68 | PlaylistDAO& m_playlistDao; |
852 | 53 | bool m_bAutoDJEnabled; | 69 | |
853 | 54 | bool m_bNextTrackAlreadyLoaded; /** Makes our Auto DJ logic assume the | 70 | // Makes our Auto DJ logic assume the next track that should be played is |
854 | 55 | next track that should be played is | 71 | // already loaded. We need this flag to make our |
855 | 56 | already loaded. We need this flag to | 72 | // first-track-gets-loaded-but- not-removed-from-the-queue behaviour work. |
856 | 57 | make our first-track-gets-loaded-but- | 73 | bool m_bNextTrackAlreadyLoaded; |
857 | 58 | not-removed-from-the-queue behaviour | 74 | |
858 | 59 | work. */ | 75 | bool m_bFadeNow; |
859 | 60 | bool m_bPlayer1Primed, m_bPlayer2Primed; | 76 | enum ADJstates m_eState; |
860 | 77 | float m_posThreshold1; | ||
861 | 78 | float m_posThreshold2; | ||
862 | 79 | float m_fadeDuration1; | ||
863 | 80 | float m_fadeDuration2; | ||
864 | 61 | ControlObjectThreadMain* m_pCOPlayPos1; | 81 | ControlObjectThreadMain* m_pCOPlayPos1; |
865 | 62 | ControlObjectThreadMain* m_pCOPlayPos2; | 82 | ControlObjectThreadMain* m_pCOPlayPos2; |
866 | 63 | ControlObjectThreadMain* m_pCOPlay1; | 83 | ControlObjectThreadMain* m_pCOPlay1; |
867 | 64 | ControlObjectThreadMain* m_pCOPlay2; | 84 | ControlObjectThreadMain* m_pCOPlay2; |
868 | 85 | ControlObjectThreadMain* m_pCOPlay1Fb; | ||
869 | 86 | ControlObjectThreadMain* m_pCOPlay2Fb; | ||
870 | 65 | ControlObjectThreadMain* m_pCORepeat1; | 87 | ControlObjectThreadMain* m_pCORepeat1; |
871 | 66 | ControlObjectThreadMain* m_pCORepeat2; | 88 | ControlObjectThreadMain* m_pCORepeat2; |
872 | 67 | ControlObjectThreadMain* m_pCOCrossfader; | 89 | ControlObjectThreadMain* m_pCOCrossfader; |
873 | @@ -82,7 +104,7 @@ | |||
874 | 82 | 104 | ||
875 | 83 | 105 | ||
876 | 84 | #define _blah if ((QDate::currentDate().day() == 1) && (QDate::currentDate().month() == 4)) \ | 106 | #define _blah if ((QDate::currentDate().day() == 1) && (QDate::currentDate().month() == 4)) \ |
878 | 85 | pushButtonAutoDJ->setText("\x45\x6e\x61\x62\x6c\x65\x20\x50\x65\x65" \ | 107 | pushButtonAutoDJ->setText("\x45\x6e\x61\x62\x6c\x65\x20\x50\x65\x65" \ |
879 | 86 | "\x20\x42\x72\x65\x61\x6b\x20\x4d\x6f\x64\x65") | 108 | "\x20\x42\x72\x65\x61\x6b\x20\x4d\x6f\x64\x65") |
880 | 87 | 109 | ||
881 | 88 | 110 | ||
882 | 89 | 111 | ||
883 | === modified file 'mixxx/src/dlgprepare.h' | |||
884 | --- mixxx/src/dlgprepare.h 2011-03-26 12:29:21 +0000 | |||
885 | +++ mixxx/src/dlgprepare.h 2012-05-31 20:47:26 +0000 | |||
886 | @@ -6,6 +6,7 @@ | |||
887 | 6 | #include "configobject.h" | 6 | #include "configobject.h" |
888 | 7 | #include "library/libraryview.h" | 7 | #include "library/libraryview.h" |
889 | 8 | #include "library/trackcollection.h" | 8 | #include "library/trackcollection.h" |
890 | 9 | #include "library/preparelibrarytablemodel.h" | ||
891 | 9 | 10 | ||
892 | 10 | class PrepareLibraryTableModel; | 11 | class PrepareLibraryTableModel; |
893 | 11 | class WPrepareCratesTableView; | 12 | class WPrepareCratesTableView; |
894 | @@ -29,6 +30,7 @@ | |||
895 | 29 | virtual void loadSelectedTrack(); | 30 | virtual void loadSelectedTrack(); |
896 | 30 | virtual void loadSelectedTrackToGroup(QString group); | 31 | virtual void loadSelectedTrackToGroup(QString group); |
897 | 31 | virtual void moveSelection(int delta); | 32 | virtual void moveSelection(int delta); |
898 | 33 | inline const QString currentSearch() { return m_pPrepareLibraryTableModel->currentSearch(); }; | ||
899 | 32 | 34 | ||
900 | 33 | public slots: | 35 | public slots: |
901 | 34 | void tableSelectionChanged(const QItemSelection& selected, | 36 | void tableSelectionChanged(const QItemSelection& selected, |
902 | 35 | 37 | ||
903 | === modified file 'mixxx/src/dlgrecording.cpp' | |||
904 | --- mixxx/src/dlgrecording.cpp 2011-11-04 23:15:03 +0000 | |||
905 | +++ mixxx/src/dlgrecording.cpp 2012-05-31 20:47:26 +0000 | |||
906 | @@ -119,6 +119,7 @@ | |||
907 | 119 | void DlgRecording::onSearchCleared() | 119 | void DlgRecording::onSearchCleared() |
908 | 120 | { | 120 | { |
909 | 121 | } | 121 | } |
910 | 122 | |||
911 | 122 | void DlgRecording::refreshBrowseModel(){ | 123 | void DlgRecording::refreshBrowseModel(){ |
912 | 123 | m_browseModel.setPath(m_recordingDir); | 124 | m_browseModel.setPath(m_recordingDir); |
913 | 124 | } | 125 | } |
914 | 125 | 126 | ||
915 | === modified file 'mixxx/src/dlgrecording.h' | |||
916 | --- mixxx/src/dlgrecording.h 2011-03-31 18:47:04 +0000 | |||
917 | +++ mixxx/src/dlgrecording.h 2012-05-31 20:47:26 +0000 | |||
918 | @@ -35,6 +35,7 @@ | |||
919 | 35 | virtual void loadSelectedTrackToGroup(QString group); | 35 | virtual void loadSelectedTrackToGroup(QString group); |
920 | 36 | virtual void moveSelection(int delta); | 36 | virtual void moveSelection(int delta); |
921 | 37 | void refreshBrowseModel(); | 37 | void refreshBrowseModel(); |
922 | 38 | inline const QString currentSearch() { return m_proxyModel.currentSearch(); } | ||
923 | 38 | 39 | ||
924 | 39 | public slots: | 40 | public slots: |
925 | 40 | void toggleRecording(bool toggle); | 41 | void toggleRecording(bool toggle); |
926 | 41 | 42 | ||
927 | === modified file 'mixxx/src/library/autodjfeature.cpp' | |||
928 | --- mixxx/src/library/autodjfeature.cpp 2011-10-12 17:29:43 +0000 | |||
929 | +++ mixxx/src/library/autodjfeature.cpp 2012-05-31 20:47:26 +0000 | |||
930 | @@ -23,6 +23,7 @@ | |||
931 | 23 | m_pConfig(pConfig), | 23 | m_pConfig(pConfig), |
932 | 24 | m_pTrackCollection(pTrackCollection), | 24 | m_pTrackCollection(pTrackCollection), |
933 | 25 | m_playlistDao(pTrackCollection->getPlaylistDAO()) { | 25 | m_playlistDao(pTrackCollection->getPlaylistDAO()) { |
934 | 26 | m_pAutoDJView = NULL; | ||
935 | 26 | } | 27 | } |
936 | 27 | 28 | ||
937 | 28 | AutoDJFeature::~AutoDJFeature() { | 29 | AutoDJFeature::~AutoDJFeature() { |
938 | @@ -36,19 +37,19 @@ | |||
939 | 36 | return QIcon(":/images/library/ic_library_autodj.png"); | 37 | return QIcon(":/images/library/ic_library_autodj.png"); |
940 | 37 | } | 38 | } |
941 | 38 | 39 | ||
943 | 39 | void AutoDJFeature::bindWidget(WLibrarySidebar* sidebarWidget, | 40 | void AutoDJFeature::bindWidget(WLibrarySidebar* /*sidebarWidget*/, |
944 | 40 | WLibrary* libraryWidget, | 41 | WLibrary* libraryWidget, |
945 | 41 | MixxxKeyboard* keyboard) { | 42 | MixxxKeyboard* keyboard) { |
946 | 42 | 43 | ||
948 | 43 | DlgAutoDJ* pAutoDJView = new DlgAutoDJ(libraryWidget, | 44 | m_pAutoDJView = new DlgAutoDJ(libraryWidget, |
949 | 44 | m_pConfig, | 45 | m_pConfig, |
950 | 45 | m_pTrackCollection, | 46 | m_pTrackCollection, |
951 | 46 | keyboard); | 47 | keyboard); |
955 | 47 | pAutoDJView->installEventFilter(keyboard); | 48 | m_pAutoDJView->installEventFilter(keyboard); |
956 | 48 | libraryWidget->registerView(m_sAutoDJViewName, pAutoDJView); | 49 | libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); |
957 | 49 | connect(pAutoDJView, SIGNAL(loadTrack(TrackPointer)), | 50 | connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), |
958 | 50 | this, SIGNAL(loadTrack(TrackPointer))); | 51 | this, SIGNAL(loadTrack(TrackPointer))); |
960 | 51 | connect(pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), | 52 | connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), |
961 | 52 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); | 53 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); |
962 | 53 | } | 54 | } |
963 | 54 | 55 | ||
964 | @@ -58,19 +59,18 @@ | |||
965 | 58 | 59 | ||
966 | 59 | void AutoDJFeature::activate() { | 60 | void AutoDJFeature::activate() { |
967 | 60 | //qDebug() << "AutoDJFeature::activate()"; | 61 | //qDebug() << "AutoDJFeature::activate()"; |
981 | 61 | //emit(showTrackModel(m_pAutoDJTableModelProxy)); | 62 | emit(switchToView(m_sAutoDJViewName)); |
982 | 62 | emit(switchToView("Auto DJ")); | 63 | emit(restoreSearch(QString())); //Null String disables search box |
983 | 63 | } | 64 | } |
984 | 64 | 65 | ||
985 | 65 | void AutoDJFeature::activateChild(const QModelIndex& index) { | 66 | void AutoDJFeature::activateChild(const QModelIndex& /*index*/) { |
986 | 66 | 67 | } | |
987 | 67 | } | 68 | |
988 | 68 | 69 | void AutoDJFeature::onRightClick(const QPoint& /*globalPos*/) { | |
989 | 69 | void AutoDJFeature::onRightClick(const QPoint& globalPos) { | 70 | } |
990 | 70 | } | 71 | |
991 | 71 | 72 | void AutoDJFeature::onRightClickChild(const QPoint& /*globalPos*/, | |
992 | 72 | void AutoDJFeature::onRightClickChild(const QPoint& globalPos, | 73 | QModelIndex /*index*/) { |
980 | 73 | QModelIndex index) { | ||
993 | 74 | } | 74 | } |
994 | 75 | 75 | ||
995 | 76 | bool AutoDJFeature::dropAccept(QUrl url) { | 76 | bool AutoDJFeature::dropAccept(QUrl url) { |
996 | @@ -98,12 +98,18 @@ | |||
997 | 98 | } | 98 | } |
998 | 99 | 99 | ||
999 | 100 | // TODO(XXX) No feedback on whether this worked. | 100 | // TODO(XXX) No feedback on whether this worked. |
1002 | 101 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | 101 | if( m_pAutoDJView ){ |
1003 | 102 | m_playlistDao.appendTrackToPlaylist(trackId, playlistId); | 102 | m_pAutoDJView->appendTrack(trackId); |
1004 | 103 | } | ||
1005 | 104 | else{ | ||
1006 | 105 | int playlistId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE); | ||
1007 | 106 | m_playlistDao.appendTrackToPlaylist(trackId, playlistId); | ||
1008 | 107 | } | ||
1009 | 108 | |||
1010 | 103 | return true; | 109 | return true; |
1011 | 104 | } | 110 | } |
1012 | 105 | 111 | ||
1014 | 106 | bool AutoDJFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { | 112 | bool AutoDJFeature::dropAcceptChild(const QModelIndex& /*index*/, QUrl /*url*/) { |
1015 | 107 | return false; | 113 | return false; |
1016 | 108 | } | 114 | } |
1017 | 109 | 115 | ||
1018 | @@ -112,10 +118,10 @@ | |||
1019 | 112 | return SoundSourceProxy::isFilenameSupported(file.fileName()); | 118 | return SoundSourceProxy::isFilenameSupported(file.fileName()); |
1020 | 113 | } | 119 | } |
1021 | 114 | 120 | ||
1024 | 115 | bool AutoDJFeature::dragMoveAcceptChild(const QModelIndex& index, | 121 | bool AutoDJFeature::dragMoveAcceptChild(const QModelIndex& /*index*/, |
1025 | 116 | QUrl url) { | 122 | QUrl /*url*/) { |
1026 | 117 | return false; | 123 | return false; |
1027 | 118 | } | 124 | } |
1029 | 119 | void AutoDJFeature::onLazyChildExpandation(const QModelIndex &index){ | 125 | void AutoDJFeature::onLazyChildExpandation(const QModelIndex& /*index*/){ |
1030 | 120 | //Nothing to do because the childmodel is not of lazy nature. | 126 | //Nothing to do because the childmodel is not of lazy nature. |
1031 | 121 | } | 127 | } |
1032 | 122 | 128 | ||
1033 | === modified file 'mixxx/src/library/autodjfeature.h' | |||
1034 | --- mixxx/src/library/autodjfeature.h 2011-03-10 13:37:21 +0000 | |||
1035 | +++ mixxx/src/library/autodjfeature.h 2012-05-31 20:47:26 +0000 | |||
1036 | @@ -11,6 +11,7 @@ | |||
1037 | 11 | #include "library/dao/playlistdao.h" | 11 | #include "library/dao/playlistdao.h" |
1038 | 12 | #include "configobject.h" | 12 | #include "configobject.h" |
1039 | 13 | #include "treeitemmodel.h" | 13 | #include "treeitemmodel.h" |
1040 | 14 | #include "dlgautodj.h" | ||
1041 | 14 | 15 | ||
1042 | 15 | class PlaylistTableModel; | 16 | class PlaylistTableModel; |
1043 | 16 | class TrackCollection; | 17 | class TrackCollection; |
1044 | @@ -50,6 +51,7 @@ | |||
1045 | 50 | PlaylistDAO& m_playlistDao; | 51 | PlaylistDAO& m_playlistDao; |
1046 | 51 | const static QString m_sAutoDJViewName; | 52 | const static QString m_sAutoDJViewName; |
1047 | 52 | TreeItemModel m_childModel; | 53 | TreeItemModel m_childModel; |
1048 | 54 | DlgAutoDJ* m_pAutoDJView; | ||
1049 | 53 | }; | 55 | }; |
1050 | 54 | 56 | ||
1051 | 55 | 57 | ||
1052 | 56 | 58 | ||
1053 | === modified file 'mixxx/src/library/basesqltablemodel.cpp' | |||
1054 | --- mixxx/src/library/basesqltablemodel.cpp 2011-12-18 18:50:40 +0000 | |||
1055 | +++ mixxx/src/library/basesqltablemodel.cpp 2012-05-31 20:47:26 +0000 | |||
1056 | @@ -18,6 +18,7 @@ | |||
1057 | 18 | QString settingsNamespace) | 18 | QString settingsNamespace) |
1058 | 19 | : QAbstractTableModel(pParent), | 19 | : QAbstractTableModel(pParent), |
1059 | 20 | TrackModel(db, settingsNamespace), | 20 | TrackModel(db, settingsNamespace), |
1060 | 21 | m_currentSearch(""), | ||
1061 | 21 | m_pTrackCollection(pTrackCollection), | 22 | m_pTrackCollection(pTrackCollection), |
1062 | 22 | m_trackDAO(m_pTrackCollection->getTrackDAO()), | 23 | m_trackDAO(m_pTrackCollection->getTrackDAO()), |
1063 | 23 | m_database(db) { | 24 | m_database(db) { |
1064 | @@ -528,7 +529,7 @@ | |||
1065 | 528 | // waveform widget to load a track into a Player). | 529 | // waveform widget to load a track into a Player). |
1066 | 529 | defaultFlags |= Qt::ItemIsDragEnabled; | 530 | defaultFlags |= Qt::ItemIsDragEnabled; |
1067 | 530 | 531 | ||
1069 | 531 | int row = index.row(); | 532 | //int row = index.row(); // not used |
1070 | 532 | int column = index.column(); | 533 | int column = index.column(); |
1071 | 533 | 534 | ||
1072 | 534 | if ( column == fieldIndex(LIBRARYTABLE_FILETYPE) | 535 | if ( column == fieldIndex(LIBRARYTABLE_FILETYPE) |
1073 | 535 | 536 | ||
1074 | === modified file 'mixxx/src/library/browse/browsefeature.cpp' | |||
1075 | --- mixxx/src/library/browse/browsefeature.cpp 2012-03-13 04:36:19 +0000 | |||
1076 | +++ mixxx/src/library/browse/browsefeature.cpp 2012-05-31 20:47:26 +0000 | |||
1077 | @@ -141,8 +141,9 @@ | |||
1078 | 141 | } | 141 | } |
1079 | 142 | 142 | ||
1080 | 143 | void BrowseFeature::activate() { | 143 | void BrowseFeature::activate() { |
1082 | 144 | emit(restoreSearch(m_currentSearch)); | 144 | emit(restoreSearch(QString())); |
1083 | 145 | } | 145 | } |
1084 | 146 | |||
1085 | 146 | /* | 147 | /* |
1086 | 147 | * Note: This is executed whenever you single click on an child item | 148 | * Note: This is executed whenever you single click on an child item |
1087 | 148 | * Single clicks will not populate sub folders | 149 | * Single clicks will not populate sub folders |
1088 | 149 | 150 | ||
1089 | === modified file 'mixxx/src/library/browse/browsefeature.h' | |||
1090 | --- mixxx/src/library/browse/browsefeature.h 2011-03-30 21:53:33 +0000 | |||
1091 | +++ mixxx/src/library/browse/browsefeature.h 2012-05-31 20:47:26 +0000 | |||
1092 | @@ -54,7 +54,6 @@ | |||
1093 | 54 | ProxyTrackModel m_proxyModel; | 54 | ProxyTrackModel m_proxyModel; |
1094 | 55 | TrackCollection* m_pTrackCollection; | 55 | TrackCollection* m_pTrackCollection; |
1095 | 56 | FolderTreeModel m_childModel; | 56 | FolderTreeModel m_childModel; |
1096 | 57 | QString m_currentSearch; | ||
1097 | 58 | }; | 57 | }; |
1098 | 59 | 58 | ||
1099 | 60 | #endif /* BROWSEFEATURE_H */ | 59 | #endif /* BROWSEFEATURE_H */ |
1100 | 61 | 60 | ||
1101 | === modified file 'mixxx/src/library/browse/browsetablemodel.cpp' | |||
1102 | --- mixxx/src/library/browse/browsetablemodel.cpp 2011-12-22 10:56:03 +0000 | |||
1103 | +++ mixxx/src/library/browse/browsetablemodel.cpp 2012-05-31 20:47:26 +0000 | |||
1104 | @@ -112,23 +112,23 @@ | |||
1105 | 112 | } | 112 | } |
1106 | 113 | 113 | ||
1107 | 114 | int BrowseTableModel::getTrackId(const QModelIndex& index) const { | 114 | int BrowseTableModel::getTrackId(const QModelIndex& index) const { |
1110 | 115 | Q_UNUSED(index); | 115 | Q_UNUSED(index); |
1111 | 116 | // We can't implement this as it stands. | 116 | // We can't implement this as it stands. |
1112 | 117 | return -1; | 117 | return -1; |
1113 | 118 | } | 118 | } |
1114 | 119 | 119 | ||
1115 | 120 | const QLinkedList<int> BrowseTableModel::getTrackRows(int trackId) const { | 120 | const QLinkedList<int> BrowseTableModel::getTrackRows(int trackId) const { |
1119 | 121 | Q_UNUSED(trackId); | 121 | Q_UNUSED(trackId); |
1120 | 122 | // We can't implement this as it stands. | 122 | // We can't implement this as it stands. |
1121 | 123 | return QLinkedList<int>(); | 123 | return QLinkedList<int>(); |
1122 | 124 | } | 124 | } |
1123 | 125 | 125 | ||
1124 | 126 | void BrowseTableModel::search(const QString& searchText) { | 126 | void BrowseTableModel::search(const QString& searchText) { |
1126 | 127 | Q_UNUSED(searchText); | 127 | Q_UNUSED(searchText); |
1127 | 128 | } | 128 | } |
1128 | 129 | 129 | ||
1129 | 130 | const QString BrowseTableModel::currentSearch() const { | 130 | const QString BrowseTableModel::currentSearch() const { |
1131 | 131 | return QString(); | 131 | return QString(""); |
1132 | 132 | } | 132 | } |
1133 | 133 | 133 | ||
1134 | 134 | bool BrowseTableModel::isColumnInternal(int) { | 134 | bool BrowseTableModel::isColumnInternal(int) { |
1135 | @@ -215,7 +215,7 @@ | |||
1136 | 215 | { | 215 | { |
1137 | 216 | Q_UNUSED(index); | 216 | Q_UNUSED(index); |
1138 | 217 | Q_UNUSED(location); | 217 | Q_UNUSED(location); |
1140 | 218 | return false; | 218 | return false; |
1141 | 219 | } | 219 | } |
1142 | 220 | 220 | ||
1143 | 221 | QMimeData* BrowseTableModel::mimeData(const QModelIndexList &indexes) const { | 221 | QMimeData* BrowseTableModel::mimeData(const QModelIndexList &indexes) const { |
1144 | @@ -318,7 +318,7 @@ | |||
1145 | 318 | { | 318 | { |
1146 | 319 | Q_UNUSED(role); | 319 | Q_UNUSED(role); |
1147 | 320 | 320 | ||
1149 | 321 | if(!index.isValid()) | 321 | if(!index.isValid()) |
1150 | 322 | return false; | 322 | return false; |
1151 | 323 | qDebug() << "BrowseTableModel::setData(" << index.data() << ")"; | 323 | qDebug() << "BrowseTableModel::setData(" << index.data() << ")"; |
1152 | 324 | int row = index.row(); | 324 | int row = index.row(); |
1153 | 325 | 325 | ||
1154 | === modified file 'mixxx/src/library/cratefeature.cpp' | |||
1155 | --- mixxx/src/library/cratefeature.cpp 2011-12-09 02:49:02 +0000 | |||
1156 | +++ mixxx/src/library/cratefeature.cpp 2012-05-31 20:47:26 +0000 | |||
1157 | @@ -137,6 +137,7 @@ | |||
1158 | 137 | void CrateFeature::activate() { | 137 | void CrateFeature::activate() { |
1159 | 138 | emit(showPage(QUrl("qrc:/html/crates.html"))); | 138 | emit(showPage(QUrl("qrc:/html/crates.html"))); |
1160 | 139 | emit(switchToView("CRATEHOME")); | 139 | emit(switchToView("CRATEHOME")); |
1161 | 140 | emit(restoreSearch(QString())); //disable search on crate home | ||
1162 | 140 | } | 141 | } |
1163 | 141 | 142 | ||
1164 | 142 | void CrateFeature::activateChild(const QModelIndex& index) { | 143 | void CrateFeature::activateChild(const QModelIndex& index) { |
1165 | 143 | 144 | ||
1166 | === modified file 'mixxx/src/library/dao/cratedao.h' | |||
1167 | --- mixxx/src/library/dao/cratedao.h 2012-05-04 05:38:59 +0000 | |||
1168 | +++ mixxx/src/library/dao/cratedao.h 2012-05-31 20:47:26 +0000 | |||
1169 | @@ -50,6 +50,8 @@ | |||
1170 | 50 | void changed(int crateId); | 50 | void changed(int crateId); |
1171 | 51 | void trackAdded(int crateId, int trackId); | 51 | void trackAdded(int crateId, int trackId); |
1172 | 52 | void trackRemoved(int crateId, int trackId); | 52 | void trackRemoved(int crateId, int trackId); |
1173 | 53 | void renamed(int crateId); | ||
1174 | 54 | void lockChanged(int crateId); | ||
1175 | 53 | 55 | ||
1176 | 54 | private: | 56 | private: |
1177 | 55 | QSqlDatabase& m_database; | 57 | QSqlDatabase& m_database; |
1178 | 56 | 58 | ||
1179 | === modified file 'mixxx/src/library/dao/playlistdao.cpp' | |||
1180 | --- mixxx/src/library/dao/playlistdao.cpp 2012-05-04 05:38:59 +0000 | |||
1181 | +++ mixxx/src/library/dao/playlistdao.cpp 2012-05-31 20:47:26 +0000 | |||
1182 | @@ -505,7 +505,7 @@ | |||
1183 | 505 | return tracksAdded; | 505 | return tracksAdded; |
1184 | 506 | } | 506 | } |
1185 | 507 | 507 | ||
1187 | 508 | void PlaylistDAO::addToAutoDJQueue(int playlistId) { | 508 | void PlaylistDAO::addToAutoDJQueue(int playlistId, bool bTop) { |
1188 | 509 | //qDebug() << "Adding tracks from playlist " << playlistId << " to the Auto-DJ Queue"; | 509 | //qDebug() << "Adding tracks from playlist " << playlistId << " to the Auto-DJ Queue"; |
1189 | 510 | 510 | ||
1190 | 511 | // Query the PlaylistTracks database to locate tracks in the selected playlist | 511 | // Query the PlaylistTracks database to locate tracks in the selected playlist |
1191 | @@ -520,7 +520,15 @@ | |||
1192 | 520 | // Get the ID of the Auto-DJ playlist | 520 | // Get the ID of the Auto-DJ playlist |
1193 | 521 | int autoDJId = getPlaylistIdFromName(AUTODJ_TABLE); | 521 | int autoDJId = getPlaylistIdFromName(AUTODJ_TABLE); |
1194 | 522 | // Loop through the tracks, adding them to the Auto-DJ Queue | 522 | // Loop through the tracks, adding them to the Auto-DJ Queue |
1197 | 523 | while(query.next()) { | 523 | |
1198 | 524 | appendTrackToPlaylist(query.value(0).toInt(), autoDJId); | 524 | int i = 2; // Start at position 2 because position 1 was already loaded to the deck |
1199 | 525 | |||
1200 | 526 | while (query.next()) { | ||
1201 | 527 | if (bTop) { | ||
1202 | 528 | insertTrackIntoPlaylist(query.value(0).toInt(), autoDJId, i++); | ||
1203 | 529 | } | ||
1204 | 530 | else { | ||
1205 | 531 | appendTrackToPlaylist(query.value(0).toInt(), autoDJId); | ||
1206 | 532 | } | ||
1207 | 525 | } | 533 | } |
1208 | 526 | } | 534 | } |
1209 | 527 | 535 | ||
1210 | === modified file 'mixxx/src/library/dao/playlistdao.h' | |||
1211 | --- mixxx/src/library/dao/playlistdao.h 2012-05-04 05:38:59 +0000 | |||
1212 | +++ mixxx/src/library/dao/playlistdao.h 2012-05-31 20:47:26 +0000 | |||
1213 | @@ -57,13 +57,15 @@ | |||
1214 | 57 | /** Inserts a list of tracks into playlist*/ | 57 | /** Inserts a list of tracks into playlist*/ |
1215 | 58 | int insertTracksIntoPlaylist(QList<int> trackIds, int playlistId, int position); | 58 | int insertTracksIntoPlaylist(QList<int> trackIds, int playlistId, int position); |
1216 | 59 | /** Add a playlist to the Auto-DJ Queue */ | 59 | /** Add a playlist to the Auto-DJ Queue */ |
1218 | 60 | void addToAutoDJQueue(int playlistId); | 60 | void addToAutoDJQueue(int playlistId, bool bTop); |
1219 | 61 | signals: | 61 | signals: |
1220 | 62 | void added(int playlistId); | 62 | void added(int playlistId); |
1221 | 63 | void deleted(int playlistId); | 63 | void deleted(int playlistId); |
1222 | 64 | void changed(int playlistId); | 64 | void changed(int playlistId); |
1223 | 65 | void trackAdded(int playlistId, int trackId, int position); | 65 | void trackAdded(int playlistId, int trackId, int position); |
1224 | 66 | void trackRemoved(int playlistId, int trackId, int position); | 66 | void trackRemoved(int playlistId, int trackId, int position); |
1225 | 67 | void renamed(int playlistId); | ||
1226 | 68 | void lockChanged(int playlistId); | ||
1227 | 67 | private: | 69 | private: |
1228 | 68 | QSqlDatabase& m_database; | 70 | QSqlDatabase& m_database; |
1229 | 69 | DISALLOW_COPY_AND_ASSIGN(PlaylistDAO); | 71 | DISALLOW_COPY_AND_ASSIGN(PlaylistDAO); |
1230 | 70 | 72 | ||
1231 | === modified file 'mixxx/src/library/itunes/itunesfeature.cpp' | |||
1232 | --- mixxx/src/library/itunes/itunesfeature.cpp 2011-10-16 03:12:52 +0000 | |||
1233 | +++ mixxx/src/library/itunes/itunesfeature.cpp 2012-05-31 20:47:26 +0000 | |||
1234 | @@ -116,6 +116,7 @@ | |||
1235 | 116 | tr("Select your iTunes library"), | 116 | tr("Select your iTunes library"), |
1236 | 117 | QDir::homePath(), "*.xml"); | 117 | QDir::homePath(), "*.xml"); |
1237 | 118 | if (m_dbfile.isEmpty() || !QFile::exists(m_dbfile)) { | 118 | if (m_dbfile.isEmpty() || !QFile::exists(m_dbfile)) { |
1238 | 119 | emit(showTrackModel(m_pITunesTrackModel)); | ||
1239 | 119 | return; | 120 | return; |
1240 | 120 | } | 121 | } |
1241 | 121 | settings.setValue(ITDB_PATH_KEY, m_dbfile); | 122 | settings.setValue(ITDB_PATH_KEY, m_dbfile); |
1242 | @@ -138,10 +139,8 @@ | |||
1243 | 138 | //calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed. | 139 | //calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed. |
1244 | 139 | emit (featureIsLoading(this)); | 140 | emit (featureIsLoading(this)); |
1245 | 140 | } | 141 | } |
1246 | 141 | else{ | ||
1247 | 142 | emit(showTrackModel(m_pITunesTrackModel)); | ||
1248 | 143 | } | ||
1249 | 144 | 142 | ||
1250 | 143 | emit(showTrackModel(m_pITunesTrackModel)); | ||
1251 | 145 | } | 144 | } |
1252 | 146 | 145 | ||
1253 | 147 | void ITunesFeature::activateChild(const QModelIndex& index) { | 146 | void ITunesFeature::activateChild(const QModelIndex& index) { |
1254 | 148 | 147 | ||
1255 | === modified file 'mixxx/src/library/playlistfeature.cpp' | |||
1256 | --- mixxx/src/library/playlistfeature.cpp 2012-03-27 18:17:26 +0000 | |||
1257 | +++ mixxx/src/library/playlistfeature.cpp 2012-05-31 20:47:26 +0000 | |||
1258 | @@ -102,6 +102,7 @@ | |||
1259 | 102 | void PlaylistFeature::activate() { | 102 | void PlaylistFeature::activate() { |
1260 | 103 | emit(showPage(QUrl("qrc:/html/playlists.html"))); | 103 | emit(showPage(QUrl("qrc:/html/playlists.html"))); |
1261 | 104 | emit(switchToView("PLAYLISTHOME")); | 104 | emit(switchToView("PLAYLISTHOME")); |
1262 | 105 | emit(restoreSearch(QString())); // Null String disables search box | ||
1263 | 105 | } | 106 | } |
1264 | 106 | 107 | ||
1265 | 107 | void PlaylistFeature::activateChild(const QModelIndex& index) { | 108 | void PlaylistFeature::activateChild(const QModelIndex& index) { |
1266 | @@ -448,7 +449,7 @@ | |||
1267 | 448 | new PlaylistTableModel(this, m_pTrackCollection, | 449 | new PlaylistTableModel(this, m_pTrackCollection, |
1268 | 449 | "mixxx.db.model.playlist_export")); | 450 | "mixxx.db.model.playlist_export")); |
1269 | 450 | 451 | ||
1271 | 451 | pPlaylistTableModel->setPlaylist(m_pPlaylistTableModel->getPlaylist()); | 452 | pPlaylistTableModel->setPlaylist(m_pPlaylistTableModel->getPlaylistId()); |
1272 | 452 | pPlaylistTableModel->setSort(pPlaylistTableModel->fieldIndex(PLAYLISTTRACKSTABLE_POSITION), Qt::AscendingOrder); | 453 | pPlaylistTableModel->setSort(pPlaylistTableModel->fieldIndex(PLAYLISTTRACKSTABLE_POSITION), Qt::AscendingOrder); |
1273 | 453 | pPlaylistTableModel->select(); | 454 | pPlaylistTableModel->select(); |
1274 | 454 | int rows = pPlaylistTableModel->rowCount(); | 455 | int rows = pPlaylistTableModel->rowCount(); |
1275 | @@ -481,12 +482,18 @@ | |||
1276 | 481 | 482 | ||
1277 | 482 | void PlaylistFeature::slotAddToAutoDJ() { | 483 | void PlaylistFeature::slotAddToAutoDJ() { |
1278 | 483 | //qDebug() << "slotAddToAutoDJ() row:" << m_lastRightClickedIndex.data(); | 484 | //qDebug() << "slotAddToAutoDJ() row:" << m_lastRightClickedIndex.data(); |
1279 | 485 | addToAutoDJ(false); // Top = True | ||
1280 | 486 | } | ||
1281 | 487 | |||
1282 | 488 | void PlaylistFeature::addToAutoDJ(bool bTop) { | ||
1283 | 489 | //qDebug() << "slotAddToAutoDJ() row:" << m_lastRightClickedIndex.data(); | ||
1284 | 484 | 490 | ||
1285 | 485 | if (m_lastRightClickedIndex.isValid()) { | 491 | if (m_lastRightClickedIndex.isValid()) { |
1286 | 486 | int playlistId = m_playlistDao.getPlaylistIdFromName( | 492 | int playlistId = m_playlistDao.getPlaylistIdFromName( |
1287 | 487 | m_lastRightClickedIndex.data().toString()); | 493 | m_lastRightClickedIndex.data().toString()); |
1288 | 488 | if (playlistId >= 0) { | 494 | if (playlistId >= 0) { |
1290 | 489 | m_playlistDao.addToAutoDJQueue(playlistId); | 495 | // Insert this playlist |
1291 | 496 | m_playlistDao.addToAutoDJQueue(playlistId, bTop); | ||
1292 | 490 | } | 497 | } |
1293 | 491 | } | 498 | } |
1294 | 492 | emit(featureUpdated()); | 499 | emit(featureUpdated()); |
1295 | 493 | 500 | ||
1296 | === modified file 'mixxx/src/library/playlistfeature.h' | |||
1297 | --- mixxx/src/library/playlistfeature.h 2011-11-27 06:59:02 +0000 | |||
1298 | +++ mixxx/src/library/playlistfeature.h 2012-05-31 20:47:26 +0000 | |||
1299 | @@ -59,6 +59,7 @@ | |||
1300 | 59 | private: | 59 | private: |
1301 | 60 | void constructChildModel(); | 60 | void constructChildModel(); |
1302 | 61 | void clearChildModel(); | 61 | void clearChildModel(); |
1303 | 62 | void addToAutoDJ(bool bTop); | ||
1304 | 62 | 63 | ||
1305 | 63 | TrackCollection* m_pTrackCollection; | 64 | TrackCollection* m_pTrackCollection; |
1306 | 64 | PlaylistTableModel* m_pPlaylistTableModel; | 65 | PlaylistTableModel* m_pPlaylistTableModel; |
1307 | 65 | 66 | ||
1308 | === modified file 'mixxx/src/library/playlisttablemodel.cpp' | |||
1309 | --- mixxx/src/library/playlisttablemodel.cpp 2012-05-04 05:38:59 +0000 | |||
1310 | +++ mixxx/src/library/playlisttablemodel.cpp 2012-05-31 20:47:26 +0000 | |||
1311 | @@ -5,7 +5,6 @@ | |||
1312 | 5 | #include "library/trackcollection.h" | 5 | #include "library/trackcollection.h" |
1313 | 6 | #include "library/playlisttablemodel.h" | 6 | #include "library/playlisttablemodel.h" |
1314 | 7 | #include "library/queryutil.h" | 7 | #include "library/queryutil.h" |
1315 | 8 | |||
1316 | 9 | #include "mixxxutils.cpp" | 8 | #include "mixxxutils.cpp" |
1317 | 10 | 9 | ||
1318 | 11 | PlaylistTableModel::PlaylistTableModel(QObject* parent, | 10 | PlaylistTableModel::PlaylistTableModel(QObject* parent, |
1319 | @@ -64,6 +63,12 @@ | |||
1320 | 64 | initHeaderData(); | 63 | initHeaderData(); |
1321 | 65 | setSearch(""); | 64 | setSearch(""); |
1322 | 66 | setDefaultSort(fieldIndex("position"), Qt::AscendingOrder); | 65 | setDefaultSort(fieldIndex("position"), Qt::AscendingOrder); |
1323 | 66 | setSort(defaultSortColumn(),defaultSortOrder()); | ||
1324 | 67 | } | ||
1325 | 68 | |||
1326 | 69 | int PlaylistTableModel::getPlaylistId() | ||
1327 | 70 | { | ||
1328 | 71 | return m_iPlaylistId; | ||
1329 | 67 | } | 72 | } |
1330 | 68 | 73 | ||
1331 | 69 | bool PlaylistTableModel::addTrack(const QModelIndex& index, QString location) { | 74 | bool PlaylistTableModel::addTrack(const QModelIndex& index, QString location) { |
1332 | @@ -94,6 +99,16 @@ | |||
1333 | 94 | return true; | 99 | return true; |
1334 | 95 | } | 100 | } |
1335 | 96 | 101 | ||
1336 | 102 | bool PlaylistTableModel::appendTrack(int trackId) { | ||
1337 | 103 | if (trackId < 0) { | ||
1338 | 104 | return false; | ||
1339 | 105 | } | ||
1340 | 106 | |||
1341 | 107 | m_playlistDao.appendTrackToPlaylist(trackId, m_iPlaylistId); | ||
1342 | 108 | |||
1343 | 109 | select(); //Repopulate the data model. | ||
1344 | 110 | return true; | ||
1345 | 111 | } | ||
1346 | 97 | 112 | ||
1347 | 98 | int PlaylistTableModel::addTracks(const QModelIndex& index, QList<QString> locations) { | 113 | int PlaylistTableModel::addTracks(const QModelIndex& index, QList<QString> locations) { |
1348 | 99 | const int positionColumn = fieldIndex(PLAYLISTTRACKSTABLE_POSITION); | 114 | const int positionColumn = fieldIndex(PLAYLISTTRACKSTABLE_POSITION); |
1349 | @@ -272,32 +287,38 @@ | |||
1350 | 272 | 287 | ||
1351 | 273 | //Print out any SQL error, if there was one. | 288 | //Print out any SQL error, if there was one. |
1352 | 274 | if (query.lastError().isValid()) { | 289 | if (query.lastError().isValid()) { |
1354 | 275 | qDebug() << query.lastError(); | 290 | qDebug() << query.lastError(); |
1355 | 276 | } | 291 | } |
1356 | 277 | 292 | ||
1357 | 278 | select(); | 293 | select(); |
1358 | 279 | } | 294 | } |
1359 | 280 | 295 | ||
1361 | 281 | void PlaylistTableModel::shuffleTracks(const QModelIndex& currentIndex) { | 296 | void PlaylistTableModel::shuffleTracks(const QModelIndex& shuffleStartIndex) { |
1362 | 282 | int numOfTracks = rowCount(); | 297 | int numOfTracks = rowCount(); |
1363 | 283 | int seed = QDateTime::currentDateTime().toTime_t(); | 298 | int seed = QDateTime::currentDateTime().toTime_t(); |
1364 | 284 | qsrand(seed); | 299 | qsrand(seed); |
1365 | 285 | QSqlQuery query(m_pTrackCollection->getDatabase()); | 300 | QSqlQuery query(m_pTrackCollection->getDatabase()); |
1366 | 286 | const int positionColumnIndex = fieldIndex(PLAYLISTTRACKSTABLE_POSITION); | 301 | const int positionColumnIndex = fieldIndex(PLAYLISTTRACKSTABLE_POSITION); |
1369 | 287 | int currentPosition = currentIndex.sibling(currentIndex.row(), positionColumnIndex).data().toInt(); | 302 | int shuffleStartRow = shuffleStartIndex.row(); |
1368 | 288 | int shuffleStartIndex = currentPosition + 1; | ||
1370 | 289 | 303 | ||
1371 | 290 | m_pTrackCollection->getDatabase().transaction(); | 304 | m_pTrackCollection->getDatabase().transaction(); |
1372 | 291 | 305 | ||
1373 | 292 | // This is a simple Fisher-Yates shuffling algorithm | 306 | // This is a simple Fisher-Yates shuffling algorithm |
1375 | 293 | for (int i=numOfTracks-1; i >= shuffleStartIndex; i--) | 307 | for (int i=numOfTracks-1; i >= shuffleStartRow; i--) |
1376 | 294 | { | 308 | { |
1379 | 295 | int random = int(qrand() / (RAND_MAX + 1.0) * (numOfTracks + 1 - shuffleStartIndex) + shuffleStartIndex); | 309 | int oldPosition = index(i, positionColumnIndex).data().toInt(); |
1380 | 296 | qDebug() << "Swapping tracks " << i << " and " << random; | 310 | int random = int(qrand() / (RAND_MAX + 1.0) * (numOfTracks - shuffleStartRow) + shuffleStartRow + 1); |
1381 | 311 | qDebug() << "Swapping tracks " << oldPosition << " and " << random; | ||
1382 | 297 | QString swapQuery = "UPDATE PlaylistTracks SET position=%1 WHERE position=%2 AND playlist_id=%3"; | 312 | QString swapQuery = "UPDATE PlaylistTracks SET position=%1 WHERE position=%2 AND playlist_id=%3"; |
1386 | 298 | query.exec(swapQuery.arg(-1).arg(i).arg(m_iPlaylistId)); | 313 | query.exec(swapQuery.arg(QString::number(-1), |
1387 | 299 | query.exec(swapQuery.arg(i).arg(random).arg(m_iPlaylistId)); | 314 | QString::number(oldPosition), |
1388 | 300 | query.exec(swapQuery.arg(random).arg(-1).arg(m_iPlaylistId)); | 315 | QString::number(m_iPlaylistId))); |
1389 | 316 | query.exec(swapQuery.arg(QString::number(oldPosition), | ||
1390 | 317 | QString::number(random), | ||
1391 | 318 | QString::number(m_iPlaylistId))); | ||
1392 | 319 | query.exec(swapQuery.arg(QString::number(random), | ||
1393 | 320 | QString::number(-1), | ||
1394 | 321 | QString::number(m_iPlaylistId))); | ||
1395 | 301 | 322 | ||
1396 | 302 | if (query.lastError().isValid()) | 323 | if (query.lastError().isValid()) |
1397 | 303 | qDebug() << query.lastError(); | 324 | qDebug() << query.lastError(); |
1398 | @@ -336,6 +357,7 @@ | |||
1399 | 336 | } | 357 | } |
1400 | 337 | 358 | ||
1401 | 338 | QItemDelegate* PlaylistTableModel::delegateForColumn(const int i) { | 359 | QItemDelegate* PlaylistTableModel::delegateForColumn(const int i) { |
1402 | 360 | Q_UNUSED(i); | ||
1403 | 339 | return NULL; | 361 | return NULL; |
1404 | 340 | } | 362 | } |
1405 | 341 | 363 | ||
1406 | 342 | 364 | ||
1407 | === modified file 'mixxx/src/library/playlisttablemodel.h' | |||
1408 | --- mixxx/src/library/playlisttablemodel.h 2012-05-04 05:38:59 +0000 | |||
1409 | +++ mixxx/src/library/playlisttablemodel.h 2012-05-31 20:47:26 +0000 | |||
1410 | @@ -19,9 +19,7 @@ | |||
1411 | 19 | QString settingsNamespace); | 19 | QString settingsNamespace); |
1412 | 20 | virtual ~PlaylistTableModel(); | 20 | virtual ~PlaylistTableModel(); |
1413 | 21 | void setPlaylist(int playlistId); | 21 | void setPlaylist(int playlistId); |
1417 | 22 | int getPlaylist() const { | 22 | int getPlaylistId(void); |
1415 | 23 | return m_iPlaylistId; | ||
1416 | 24 | } | ||
1418 | 25 | virtual TrackPointer getTrack(const QModelIndex& index) const; | 23 | virtual TrackPointer getTrack(const QModelIndex& index) const; |
1419 | 26 | 24 | ||
1420 | 27 | virtual void search(const QString& searchText); | 25 | virtual void search(const QString& searchText); |
1421 | @@ -30,6 +28,7 @@ | |||
1422 | 30 | virtual void removeTrack(const QModelIndex& index); | 28 | virtual void removeTrack(const QModelIndex& index); |
1423 | 31 | virtual void removeTracks(const QModelIndexList& indices); | 29 | virtual void removeTracks(const QModelIndexList& indices); |
1424 | 32 | virtual bool addTrack(const QModelIndex& index, QString location); | 30 | virtual bool addTrack(const QModelIndex& index, QString location); |
1425 | 31 | virtual bool appendTrack(int trackId); | ||
1426 | 33 | // Adding multiple tracks at one to a playlist. Returns the number of | 32 | // Adding multiple tracks at one to a playlist. Returns the number of |
1427 | 34 | // successful additions. | 33 | // successful additions. |
1428 | 35 | virtual int addTracks(const QModelIndex& index, QList<QString> locations); | 34 | virtual int addTracks(const QModelIndex& index, QList<QString> locations); |
1429 | 36 | 35 | ||
1430 | === modified file 'mixxx/src/library/preparefeature.cpp' | |||
1431 | --- mixxx/src/library/preparefeature.cpp 2011-03-26 12:29:21 +0000 | |||
1432 | +++ mixxx/src/library/preparefeature.cpp 2012-05-31 20:47:26 +0000 | |||
1433 | @@ -41,31 +41,35 @@ | |||
1434 | 41 | void PrepareFeature::bindWidget(WLibrarySidebar* sidebarWidget, | 41 | void PrepareFeature::bindWidget(WLibrarySidebar* sidebarWidget, |
1435 | 42 | WLibrary* libraryWidget, | 42 | WLibrary* libraryWidget, |
1436 | 43 | MixxxKeyboard* keyboard) { | 43 | MixxxKeyboard* keyboard) { |
1438 | 44 | DlgPrepare* pPrepareView = new DlgPrepare(libraryWidget, | 44 | m_pPrepareView = new DlgPrepare(libraryWidget, |
1439 | 45 | m_pConfig, | 45 | m_pConfig, |
1440 | 46 | m_pTrackCollection); | 46 | m_pTrackCollection); |
1442 | 47 | connect(pPrepareView, SIGNAL(loadTrack(TrackPointer)), | 47 | connect(m_pPrepareView, SIGNAL(loadTrack(TrackPointer)), |
1443 | 48 | this, SIGNAL(loadTrack(TrackPointer))); | 48 | this, SIGNAL(loadTrack(TrackPointer))); |
1445 | 49 | connect(pPrepareView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), | 49 | connect(m_pPrepareView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), |
1446 | 50 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); | 50 | this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); |
1448 | 51 | connect(pPrepareView, SIGNAL(analyzeTracks(QList<int>)), | 51 | connect(m_pPrepareView, SIGNAL(analyzeTracks(QList<int>)), |
1449 | 52 | this, SLOT(analyzeTracks(QList<int>))); | 52 | this, SLOT(analyzeTracks(QList<int>))); |
1451 | 53 | connect(pPrepareView, SIGNAL(stopAnalysis()), | 53 | connect(m_pPrepareView, SIGNAL(stopAnalysis()), |
1452 | 54 | this, SLOT(stopAnalysis())); | 54 | this, SLOT(stopAnalysis())); |
1453 | 55 | 55 | ||
1454 | 56 | connect(this, SIGNAL(analysisActive(bool)), | 56 | connect(this, SIGNAL(analysisActive(bool)), |
1456 | 57 | pPrepareView, SLOT(analysisActive(bool))); | 57 | m_pPrepareView, SLOT(analysisActive(bool))); |
1457 | 58 | connect(this, SIGNAL(trackAnalysisProgress(TrackPointer, int)), | 58 | connect(this, SIGNAL(trackAnalysisProgress(TrackPointer, int)), |
1462 | 59 | pPrepareView, SLOT(trackAnalysisProgress(TrackPointer, int))); | 59 | m_pPrepareView, SLOT(trackAnalysisProgress(TrackPointer, int))); |
1463 | 60 | connect(this, SIGNAL(trackAnalysisFinished(TrackPointer)), | 60 | connect(this, SIGNAL(trackAnalysisFinished(TrackPointer)), |
1464 | 61 | pPrepareView, SLOT(trackAnalysisFinished(TrackPointer))); | 61 | m_pPrepareView, SLOT(trackAnalysisFinished(TrackPointer))); |
1465 | 62 | pPrepareView->installEventFilter(keyboard); | 62 | |
1466 | 63 | connect(this, SIGNAL(trackAnalysisFinished(TrackPointer)), | ||
1467 | 64 | m_pPrepareView, SLOT(trackAnalysisFinished(TrackPointer))); | ||
1468 | 65 | |||
1469 | 66 | m_pPrepareView->installEventFilter(keyboard); | ||
1470 | 63 | 67 | ||
1471 | 64 | // Let the DlgPrepare know whether or not analysis is active. | 68 | // Let the DlgPrepare know whether or not analysis is active. |
1472 | 65 | bool bAnalysisActive = m_pAnalyserQueue != NULL; | 69 | bool bAnalysisActive = m_pAnalyserQueue != NULL; |
1473 | 66 | emit(analysisActive(bAnalysisActive)); | 70 | emit(analysisActive(bAnalysisActive)); |
1474 | 67 | 71 | ||
1476 | 68 | libraryWidget->registerView(m_sPrepareViewName, pPrepareView); | 72 | libraryWidget->registerView(m_sPrepareViewName, m_pPrepareView); |
1477 | 69 | } | 73 | } |
1478 | 70 | 74 | ||
1479 | 71 | TreeItemModel* PrepareFeature::getChildModel() { | 75 | TreeItemModel* PrepareFeature::getChildModel() { |
1480 | @@ -75,6 +79,7 @@ | |||
1481 | 75 | void PrepareFeature::activate() { | 79 | void PrepareFeature::activate() { |
1482 | 76 | //qDebug() << "PrepareFeature::activate()"; | 80 | //qDebug() << "PrepareFeature::activate()"; |
1483 | 77 | emit(switchToView(m_sPrepareViewName)); | 81 | emit(switchToView(m_sPrepareViewName)); |
1484 | 82 | emit(restoreSearch(m_pPrepareView->currentSearch())); | ||
1485 | 78 | } | 83 | } |
1486 | 79 | 84 | ||
1487 | 80 | void PrepareFeature::activateChild(const QModelIndex& index) { | 85 | void PrepareFeature::activateChild(const QModelIndex& index) { |
1488 | 81 | 86 | ||
1489 | === modified file 'mixxx/src/library/preparefeature.h' | |||
1490 | --- mixxx/src/library/preparefeature.h 2011-03-26 12:29:21 +0000 | |||
1491 | +++ mixxx/src/library/preparefeature.h 2012-05-31 20:47:26 +0000 | |||
1492 | @@ -9,6 +9,7 @@ | |||
1493 | 9 | #include "library/libraryfeature.h" | 9 | #include "library/libraryfeature.h" |
1494 | 10 | #include "configobject.h" | 10 | #include "configobject.h" |
1495 | 11 | #include "treeitemmodel.h" | 11 | #include "treeitemmodel.h" |
1496 | 12 | #include "dlgprepare.h" | ||
1497 | 12 | 13 | ||
1498 | 13 | class AnalyserQueue; | 14 | class AnalyserQueue; |
1499 | 14 | class LibraryTableModel; | 15 | class LibraryTableModel; |
1500 | @@ -63,6 +64,7 @@ | |||
1501 | 63 | int m_iOldBpmEnabled; | 64 | int m_iOldBpmEnabled; |
1502 | 64 | TreeItemModel m_childModel; | 65 | TreeItemModel m_childModel; |
1503 | 65 | const static QString m_sPrepareViewName; | 66 | const static QString m_sPrepareViewName; |
1504 | 67 | DlgPrepare* m_pPrepareView; | ||
1505 | 66 | }; | 68 | }; |
1506 | 67 | 69 | ||
1507 | 68 | 70 | ||
1508 | 69 | 71 | ||
1509 | === modified file 'mixxx/src/library/proxytrackmodel.cpp' | |||
1510 | --- mixxx/src/library/proxytrackmodel.cpp 2011-09-25 08:08:35 +0000 | |||
1511 | +++ mixxx/src/library/proxytrackmodel.cpp 2012-05-31 20:47:26 +0000 | |||
1512 | @@ -11,7 +11,8 @@ | |||
1513 | 11 | // ProxyTrackModel proxies settings requests to the composed TrackModel, | 11 | // ProxyTrackModel proxies settings requests to the composed TrackModel, |
1514 | 12 | // don't initialize its TrackModel with valid parameters. | 12 | // don't initialize its TrackModel with valid parameters. |
1515 | 13 | : TrackModel(QSqlDatabase(), ""), | 13 | : TrackModel(QSqlDatabase(), ""), |
1517 | 14 | m_bHandleSearches(bHandleSearches) { | 14 | m_bHandleSearches(bHandleSearches), |
1518 | 15 | m_currentSearch("") { | ||
1519 | 15 | m_pTrackModel = dynamic_cast<TrackModel*>(pTrackModel); | 16 | m_pTrackModel = dynamic_cast<TrackModel*>(pTrackModel); |
1520 | 16 | Q_ASSERT(m_pTrackModel && pTrackModel); | 17 | Q_ASSERT(m_pTrackModel && pTrackModel); |
1521 | 17 | setSourceModel(pTrackModel); | 18 | setSourceModel(pTrackModel); |
1522 | 18 | 19 | ||
1523 | === modified file 'mixxx/src/library/recording/recordingfeature.cpp' | |||
1524 | --- mixxx/src/library/recording/recordingfeature.cpp 2011-04-10 18:23:52 +0000 | |||
1525 | +++ mixxx/src/library/recording/recordingfeature.cpp 2012-05-31 20:47:26 +0000 | |||
1526 | @@ -23,8 +23,9 @@ | |||
1527 | 23 | TrackCollection* pTrackCollection, | 23 | TrackCollection* pTrackCollection, |
1528 | 24 | RecordingManager* pRecordingManager) | 24 | RecordingManager* pRecordingManager) |
1529 | 25 | : LibraryFeature(parent), | 25 | : LibraryFeature(parent), |
1532 | 26 | m_pConfig(pConfig), m_pRecordingView(0), | 26 | m_pConfig(pConfig), |
1533 | 27 | m_pTrackCollection(pTrackCollection), | 27 | m_pTrackCollection(pTrackCollection), |
1534 | 28 | m_pRecordingView(0), | ||
1535 | 28 | m_pRecordingManager(pRecordingManager){ | 29 | m_pRecordingManager(pRecordingManager){ |
1536 | 29 | 30 | ||
1537 | 30 | } | 31 | } |
1538 | @@ -48,6 +49,8 @@ | |||
1539 | 48 | WLibrary *libraryWidget, | 49 | WLibrary *libraryWidget, |
1540 | 49 | MixxxKeyboard *keyboard) | 50 | MixxxKeyboard *keyboard) |
1541 | 50 | { | 51 | { |
1542 | 52 | Q_UNUSED(sidebarWidget); | ||
1543 | 53 | |||
1544 | 51 | //The view will be deleted by LibraryWidget | 54 | //The view will be deleted by LibraryWidget |
1545 | 52 | m_pRecordingView = new DlgRecording(libraryWidget, | 55 | m_pRecordingView = new DlgRecording(libraryWidget, |
1546 | 53 | m_pConfig, | 56 | m_pConfig, |
1547 | @@ -64,35 +67,47 @@ | |||
1548 | 64 | } | 67 | } |
1549 | 65 | 68 | ||
1550 | 66 | bool RecordingFeature::dropAccept(QUrl url) { | 69 | bool RecordingFeature::dropAccept(QUrl url) { |
1551 | 70 | Q_UNUSED(url); | ||
1552 | 67 | return false; | 71 | return false; |
1553 | 68 | } | 72 | } |
1554 | 69 | 73 | ||
1555 | 70 | bool RecordingFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { | 74 | bool RecordingFeature::dropAcceptChild(const QModelIndex& index, QUrl url) { |
1556 | 75 | Q_UNUSED(index); | ||
1557 | 76 | Q_UNUSED(url); | ||
1558 | 71 | return false; | 77 | return false; |
1559 | 72 | } | 78 | } |
1560 | 73 | 79 | ||
1561 | 74 | bool RecordingFeature::dragMoveAccept(QUrl url) { | 80 | bool RecordingFeature::dragMoveAccept(QUrl url) { |
1562 | 81 | Q_UNUSED(url); | ||
1563 | 75 | return false; | 82 | return false; |
1564 | 76 | } | 83 | } |
1565 | 77 | 84 | ||
1566 | 78 | bool RecordingFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { | 85 | bool RecordingFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { |
1567 | 86 | Q_UNUSED(index); | ||
1568 | 87 | Q_UNUSED(url); | ||
1569 | 79 | return false; | 88 | return false; |
1570 | 80 | } | 89 | } |
1571 | 81 | 90 | ||
1572 | 82 | void RecordingFeature::activate() { | 91 | void RecordingFeature::activate() { |
1573 | 83 | m_pRecordingView->refreshBrowseModel(); | 92 | m_pRecordingView->refreshBrowseModel(); |
1575 | 84 | emit(switchToView("Recording")); | 93 | emit(switchToView(m_sRecordingViewName)); |
1576 | 94 | emit(restoreSearch(m_pRecordingView->currentSearch())); | ||
1577 | 85 | } | 95 | } |
1578 | 86 | 96 | ||
1579 | 87 | void RecordingFeature::activateChild(const QModelIndex& index) { | 97 | void RecordingFeature::activateChild(const QModelIndex& index) { |
1581 | 88 | 98 | Q_UNUSED(index); | |
1582 | 89 | } | 99 | } |
1583 | 90 | 100 | ||
1584 | 91 | void RecordingFeature::onRightClick(const QPoint& globalPos) { | 101 | void RecordingFeature::onRightClick(const QPoint& globalPos) { |
1585 | 102 | Q_UNUSED(globalPos); | ||
1586 | 92 | } | 103 | } |
1587 | 93 | 104 | ||
1588 | 94 | void RecordingFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { | 105 | void RecordingFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { |
1589 | 106 | Q_UNUSED(globalPos); | ||
1590 | 107 | Q_UNUSED(index); | ||
1591 | 95 | } | 108 | } |
1592 | 109 | |||
1593 | 96 | void RecordingFeature::onLazyChildExpandation(const QModelIndex &index){ | 110 | void RecordingFeature::onLazyChildExpandation(const QModelIndex &index){ |
1595 | 97 | //Nothing to do here since we have no child models | 111 | Q_UNUSED(index); |
1596 | 112 | // Nothing to do here since we have no child models | ||
1597 | 98 | } | 113 | } |
1598 | 99 | 114 | ||
1599 | === modified file 'mixxx/src/library/recording/recordingfeature.h' | |||
1600 | --- mixxx/src/library/recording/recordingfeature.h 2011-04-10 18:23:52 +0000 | |||
1601 | +++ mixxx/src/library/recording/recordingfeature.h 2012-05-31 20:47:26 +0000 | |||
1602 | @@ -53,7 +53,6 @@ | |||
1603 | 53 | ConfigObject<ConfigValue>* m_pConfig; | 53 | ConfigObject<ConfigValue>* m_pConfig; |
1604 | 54 | TrackCollection* m_pTrackCollection; | 54 | TrackCollection* m_pTrackCollection; |
1605 | 55 | FolderTreeModel m_childModel; | 55 | FolderTreeModel m_childModel; |
1606 | 56 | QString m_currentSearch; | ||
1607 | 57 | const static QString m_sRecordingViewName; | 56 | const static QString m_sRecordingViewName; |
1608 | 58 | DlgRecording* m_pRecordingView; | 57 | DlgRecording* m_pRecordingView; |
1609 | 59 | RecordingManager* m_pRecordingManager; | 58 | RecordingManager* m_pRecordingManager; |
1610 | 60 | 59 | ||
1611 | === modified file 'mixxx/src/library/rhythmbox/rhythmboxfeature.cpp' | |||
1612 | --- mixxx/src/library/rhythmbox/rhythmboxfeature.cpp 2012-05-14 20:28:12 +0000 | |||
1613 | +++ mixxx/src/library/rhythmbox/rhythmboxfeature.cpp 2012-05-31 20:47:26 +0000 | |||
1614 | @@ -100,9 +100,8 @@ | |||
1615 | 100 | //calls a slot in the sidebar model such that 'Rhythmbox (isLoading)' is displayed. | 100 | //calls a slot in the sidebar model such that 'Rhythmbox (isLoading)' is displayed. |
1616 | 101 | emit (featureIsLoading(this)); | 101 | emit (featureIsLoading(this)); |
1617 | 102 | } | 102 | } |
1618 | 103 | else | ||
1619 | 104 | emit(showTrackModel(m_pRhythmboxTrackModel)); | ||
1620 | 105 | 103 | ||
1621 | 104 | emit(showTrackModel(m_pRhythmboxTrackModel)); | ||
1622 | 106 | } | 105 | } |
1623 | 107 | 106 | ||
1624 | 108 | void RhythmboxFeature::activateChild(const QModelIndex& index) { | 107 | void RhythmboxFeature::activateChild(const QModelIndex& index) { |
1625 | 109 | 108 | ||
1626 | === modified file 'mixxx/src/library/traktor/traktorfeature.cpp' | |||
1627 | --- mixxx/src/library/traktor/traktorfeature.cpp 2011-10-18 05:12:35 +0000 | |||
1628 | +++ mixxx/src/library/traktor/traktorfeature.cpp 2012-05-31 20:47:26 +0000 | |||
1629 | @@ -109,9 +109,9 @@ | |||
1630 | 109 | m_title = tr("(loading) Traktor"); | 109 | m_title = tr("(loading) Traktor"); |
1631 | 110 | //calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed. | 110 | //calls a slot in the sidebar model such that 'iTunes (isLoading)' is displayed. |
1632 | 111 | emit (featureIsLoading(this)); | 111 | emit (featureIsLoading(this)); |
1633 | 112 | } else { | ||
1634 | 113 | emit(showTrackModel(m_pTraktorTableModel)); | ||
1635 | 114 | } | 112 | } |
1636 | 113 | |||
1637 | 114 | emit(showTrackModel(m_pTraktorTableModel)); | ||
1638 | 115 | } | 115 | } |
1639 | 116 | 116 | ||
1640 | 117 | void TraktorFeature::activateChild(const QModelIndex& index) { | 117 | void TraktorFeature::activateChild(const QModelIndex& index) { |
1641 | 118 | 118 | ||
1642 | === modified file 'mixxx/src/soundmanager.h' | |||
1643 | --- mixxx/src/soundmanager.h 2011-10-16 02:09:36 +0000 | |||
1644 | +++ mixxx/src/soundmanager.h 2012-05-31 20:47:26 +0000 | |||
1645 | @@ -92,7 +92,7 @@ | |||
1646 | 92 | #ifdef __PORTAUDIO__ | 92 | #ifdef __PORTAUDIO__ |
1647 | 93 | bool m_paInitialized; | 93 | bool m_paInitialized; |
1648 | 94 | unsigned int m_jackSampleRate; | 94 | unsigned int m_jackSampleRate; |
1650 | 95 | #endif | 95 | #endif |
1651 | 96 | QHash<AudioOutput, const AudioSource*> m_registeredSources; | 96 | QHash<AudioOutput, const AudioSource*> m_registeredSources; |
1652 | 97 | QHash<AudioInput, AudioDestination*> m_registeredDestinations; | 97 | QHash<AudioInput, AudioDestination*> m_registeredDestinations; |
1653 | 98 | 98 | ||
1654 | 99 | 99 | ||
1655 | === modified file 'mixxx/src/widget/wsearchlineedit.cpp' | |||
1656 | --- mixxx/src/widget/wsearchlineedit.cpp 2012-03-13 03:40:29 +0000 | |||
1657 | +++ mixxx/src/widget/wsearchlineedit.cpp 2012-05-31 20:47:26 +0000 | |||
1658 | @@ -117,7 +117,17 @@ | |||
1659 | 117 | } | 117 | } |
1660 | 118 | } | 118 | } |
1661 | 119 | 119 | ||
1662 | 120 | // slot | ||
1663 | 120 | void WSearchLineEdit::restoreSearch(const QString& text) { | 121 | void WSearchLineEdit::restoreSearch(const QString& text) { |
1664 | 122 | if(text.isNull()) { | ||
1665 | 123 | // disable | ||
1666 | 124 | setEnabled(false); | ||
1667 | 125 | blockSignals(true); | ||
1668 | 126 | setText("- - -"); | ||
1669 | 127 | blockSignals(false); | ||
1670 | 128 | return; | ||
1671 | 129 | } | ||
1672 | 130 | setEnabled(true); | ||
1673 | 121 | qDebug() << "WSearchLineEdit::restoreSearch(" << text << ")"; | 131 | qDebug() << "WSearchLineEdit::restoreSearch(" << text << ")"; |
1674 | 122 | blockSignals(true); | 132 | blockSignals(true); |
1675 | 123 | setText(text); | 133 | setText(text); |
1676 | @@ -136,6 +146,7 @@ | |||
1677 | 136 | 146 | ||
1678 | 137 | void WSearchLineEdit::slotSetupTimer(const QString& text) | 147 | void WSearchLineEdit::slotSetupTimer(const QString& text) |
1679 | 138 | { | 148 | { |
1680 | 149 | Q_UNUSED(text); | ||
1681 | 139 | m_searchTimer.stop(); | 150 | m_searchTimer.stop(); |
1682 | 140 | //300 milliseconds timeout | 151 | //300 milliseconds timeout |
1683 | 141 | m_searchTimer.start(300); | 152 | m_searchTimer.start(300); |
1684 | 142 | 153 | ||
1685 | === modified file 'mixxx/src/widget/wtracktableview.cpp' | |||
1686 | --- mixxx/src/widget/wtracktableview.cpp 2012-05-04 05:38:59 +0000 | |||
1687 | +++ mixxx/src/widget/wtracktableview.cpp 2012-05-31 20:47:26 +0000 | |||
1688 | @@ -816,6 +816,15 @@ | |||
1689 | 816 | } | 816 | } |
1690 | 817 | 817 | ||
1691 | 818 | void WTrackTableView::slotSendToAutoDJ() { | 818 | void WTrackTableView::slotSendToAutoDJ() { |
1692 | 819 | // append to auto DJ | ||
1693 | 820 | sendToAutoDJ(false); // bTop = false | ||
1694 | 821 | } | ||
1695 | 822 | |||
1696 | 823 | void WTrackTableView::slotSendToAutoDJTop() { | ||
1697 | 824 | sendToAutoDJ(true); // bTop = true | ||
1698 | 825 | } | ||
1699 | 826 | |||
1700 | 827 | void WTrackTableView::sendToAutoDJ(bool bTop) { | ||
1701 | 819 | if (!modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { | 828 | if (!modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { |
1702 | 820 | return; | 829 | return; |
1703 | 821 | } | 830 | } |
1704 | 822 | 831 | ||
1705 | === modified file 'mixxx/src/widget/wtracktableview.h' | |||
1706 | --- mixxx/src/widget/wtracktableview.h 2012-05-04 03:00:08 +0000 | |||
1707 | +++ mixxx/src/widget/wtracktableview.h 2012-05-31 20:47:26 +0000 | |||
1708 | @@ -46,6 +46,7 @@ | |||
1709 | 46 | void slotNextTrackInfo(); | 46 | void slotNextTrackInfo(); |
1710 | 47 | void slotPrevTrackInfo(); | 47 | void slotPrevTrackInfo(); |
1711 | 48 | void slotSendToAutoDJ(); | 48 | void slotSendToAutoDJ(); |
1712 | 49 | void slotSendToAutoDJTop(); | ||
1713 | 49 | void slotReloadTrackMetadata(); | 50 | void slotReloadTrackMetadata(); |
1714 | 50 | void slotResetPlayed(); | 51 | void slotResetPlayed(); |
1715 | 51 | void addSelectionToPlaylist(int iPlaylistId); | 52 | void addSelectionToPlaylist(int iPlaylistId); |
1716 | @@ -54,6 +55,7 @@ | |||
1717 | 54 | void doSortByColumn(int headerSection); | 55 | void doSortByColumn(int headerSection); |
1718 | 55 | 56 | ||
1719 | 56 | private: | 57 | private: |
1720 | 58 | void sendToAutoDJ(bool bTop); | ||
1721 | 57 | void showTrackInfo(QModelIndex index); | 59 | void showTrackInfo(QModelIndex index); |
1722 | 58 | void createActions(); | 60 | void createActions(); |
1723 | 59 | void dragMoveEvent(QDragMoveEvent * event); | 61 | void dragMoveEvent(QDragMoveEvent * event); |
1724 | @@ -90,6 +92,7 @@ | |||
1725 | 90 | 92 | ||
1726 | 91 | // Send to Auto-DJ Action | 93 | // Send to Auto-DJ Action |
1727 | 92 | QAction *m_pAutoDJAct; | 94 | QAction *m_pAutoDJAct; |
1728 | 95 | QAction *m_pAutoDJTopAct; | ||
1729 | 93 | 96 | ||
1730 | 94 | // Remove from table | 97 | // Remove from table |
1731 | 95 | QAction *m_pRemoveAct; | 98 | QAction *m_pRemoveAct; |
Looks good -- please merge!