Robin Sheat wrote:
Thanks a lot! okayyy. I've got a patch, which I have attached to this mail. I'm quite sure it's not according to coding practices. I'll clean up the code as soon as it works completely. Loading the currently highlighted track into one of the two turntables with a MIDI signal works fine already.On Wednesday 12 December 2007 21:53:35 Jan Jockusch wrote: But I'm having a bit of a problem with cursor movements in the playlist, though. You'll find new methods moveNext() and movePrevious() in WTrackTableView. These use the protected moveCursor() method. These are in turn called from within the Track object. I have no idea whether I've hooked everything in at the right place, but the "CurrTrack" feature works fine already. But the cursor (selected line in the playlist) doesn't move a bit. Maybe a Qt expert could give me a hint of how to move the selected line up and down in the WTrackTableView widget? In my naivety, I thought the moveCursor() method would be it, but I guess I was wrong... - Ján |
Index: src/wtracktableview.cpp
===================================================================
--- src/wtracktableview.cpp (revision 1670)
+++ src/wtracktableview.cpp (working copy)
@@ -421,6 +421,16 @@
m_pTrack = pTrack;
}
+void WTrackTableView::moveNext()
+{
+ moveCursor(QAbstractItemView::MoveDown, Qt::NoModifier);
+}
+
+void WTrackTableView::movePrevious()
+{
+ moveCursor(QAbstractItemView::MoveUp, Qt::NoModifier);
+}
+
void WTrackTableView::slotLoadPlayer1()
{
if (!m_pTable) //Browse mode
Index: src/track.h
===================================================================
--- src/track.h (revision 1670)
+++ src/track.h (working copy)
@@ -99,6 +99,12 @@
void slotNextTrackPlayer2(double);
/** Slot for loading previous track in player 1 */
void slotPrevTrackPlayer2(double);
+
+ void slotCurrTrackCh1(double);
+ void slotCurrTrackCh2(double);
+ void slotMoveNextTrack(double);
+ void slotMovePrevTrack(double);
+
/** Returns pointer to active playlist */
TrackPlaylist *getActivePlaylist();
/** Slot for sending track to Play Queue */
@@ -147,6 +153,8 @@
ControlObjectThreadMain *m_pPlayButtonCh1, *m_pPlayButtonCh2;
/** Pointer to ControlObject for next/prev buttons */
ControlObjectThreadMain *m_pNextTrackCh1, *m_pNextTrackCh2, *m_pPrevTrackCh1, *m_pPrevTrackCh2;
+ /** Pointer to ControlObject for playlist navigation/loading into Players */
+ ControlObjectThreadMain *m_pCurrTrackCh1, *m_pCurrTrackCh2, *m_pMoveNextTrack, *m_pMovePrevTrack;
/** Pointer to ControlObject for play position */
ControlObjectThreadMain *m_pPlayPositionCh1, *m_pPlayPositionCh2;
/** Pointer to waveform summary generator */
Index: src/wtracktableview.h
===================================================================
--- src/wtracktableview.h (revision 1670)
+++ src/wtracktableview.h (working copy)
@@ -77,6 +77,9 @@
/**Current WTrackTableModel**/
WTrackTableModel *m_pTable;
+ void moveNext();
+ void movePrevious();
+
private:
/** Config object*/
ConfigObject<ConfigValue> *m_pConfig;
Index: src/track.cpp
===================================================================
--- src/track.cpp (revision 1670)
+++ src/track.cpp (working copy)
@@ -157,6 +157,16 @@
connect(m_pNextTrackCh2, SIGNAL(valueChanged(double)), this, SLOT(slotNextTrackPlayer2(double)));
connect(m_pPrevTrackCh2, SIGNAL(valueChanged(double)), this, SLOT(slotPrevTrackPlayer2(double)));
+ // Make controls for tracklist navigation and current track loading
+ m_pCurrTrackCh1 = new ControlObjectThreadMain(new ControlObject(ConfigKey("[Channel1]","CurrTrack")));
+ m_pCurrTrackCh2 = new ControlObjectThreadMain(new ControlObject(ConfigKey("[Channel2]","CurrTrack")));
+ m_pMoveNextTrack = new ControlObjectThreadMain(new ControlObject(ConfigKey("[Playlist]","MoveNextTrack")));
+ m_pMovePrevTrack = new ControlObjectThreadMain(new ControlObject(ConfigKey("[Playlist]","MovePrevTrack")));
+ connect(m_pCurrTrackCh1, SIGNAL(valueChanged(double)), this, SLOT(slotCurrTrackCh1(double)));
+ connect(m_pCurrTrackCh2, SIGNAL(valueChanged(double)), this, SLOT(slotCurrTrackCh2(double)));
+ connect(m_pMoveNextTrack, SIGNAL(valueChanged(double)), this, SLOT(slotMoveNextTrack(double)));
+ connect(m_pMovePrevTrack, SIGNAL(valueChanged(double)), this, SLOT(slotMovePrevTrack(double)));
+
TrackPlaylist::setTrack(this);
m_pView->m_pTrackTableView->repaintEverything();
@@ -764,6 +774,44 @@
//m_pEndOfTrackCh2->slotSet(0.);
}
+void Track::slotCurrTrackCh1(double v)
+{
+ QModelIndex index;
+ TrackInfoObject *pTrack;
+ if (v && m_pView->m_pTrackTableView->m_pTable) {
+ index = m_pView->m_pTrackTableView->currentIndex();
+ pTrack = m_pView->m_pTrackTableView->m_pTable->m_pTrackPlaylist->getTrackAt(index.row());
+ slotLoadPlayer1(pTrack);
+ }
+}
+
+void Track::slotCurrTrackCh2(double v)
+{
+ QModelIndex index;
+ TrackInfoObject *pTrack;
+ if (v && m_pView->m_pTrackTableView->m_pTable) {
+ index = m_pView->m_pTrackTableView->currentIndex();
+ pTrack = m_pView->m_pTrackTableView->m_pTable->m_pTrackPlaylist->getTrackAt(index.row());
+ slotLoadPlayer1(pTrack);
+ }
+}
+
+void Track::slotMoveNextTrack(double v)
+{
+ if (v) {
+ m_pView->m_pTrackTableView->moveNext();
+ qDebug("moveNextTrack");
+ }
+}
+
+void Track::slotMovePrevTrack(double v)
+{
+ if (v) {
+ m_pView->m_pTrackTableView->movePrevious();
+ qDebug("movePrevTrack");
+ }
+}
+
void Track::slotNextTrackPlayer1(double v)
{
if (v && m_pTrackPlayer1)
------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________ Mixxx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mixxx-devel
