=== modified file 'mixxx/src/proxymodel.cpp' --- mixxx/src/proxymodel.cpp 2009-03-05 15:14:48 +0000 +++ mixxx/src/proxymodel.cpp 2009-05-19 15:19:18 +0000 @@ -4,6 +4,7 @@ // These 3 includes are required to get the sortOrder #include #include +#include #include SortFilterProxyModel::SortFilterProxyModel( QObject * parent ) : @@ -14,14 +15,26 @@ bool SortFilterProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex & sourceParent ) const { - QModelIndex index1 = sourceModel()->index(sourceRow, 0, sourceParent); - QModelIndex index2 = sourceModel()->index(sourceRow, 1, sourceParent); - QModelIndex index3 = sourceModel()->index(sourceRow, 6, sourceParent); - - return ( sourceModel()->data(index1).toString().contains(filterRegExp()) - || sourceModel()->data(index2).toString().contains(filterRegExp()) - || sourceModel()->data(index3).toString().contains(filterRegExp()) - ); + QModelIndex index1 = sourceModel()->index(sourceRow, WTrackTableModel::ARTIST, sourceParent); + QModelIndex index2 = sourceModel()->index(sourceRow, WTrackTableModel::TITLE, sourceParent); + QModelIndex index3 = sourceModel()->index(sourceRow, WTrackTableModel::COMMENT, sourceParent); + QModelIndex index4 = sourceModel()->index(sourceRow, WTrackTableModel::FILEPATH, sourceParent); + QModelIndex index5 = sourceModel()->index(sourceRow, WTrackTableModel::FILENAME, sourceParent); + + QString row_term = QString("%1 %2 %3 %4 %5").arg(sourceModel()->data(index1).toString()) + .arg(sourceModel()->data(index2).toString()) + .arg(sourceModel()->data(index3).toString()) + .arg(sourceModel()->data(index4).toString()) + .arg(sourceModel()->data(index5).toString()); + + //qDebug() << "row:" << row_term; + + foreach(QString i, filterRegExp().pattern().split(" ")) + { + if (! row_term.contains(i, Qt::CaseInsensitive)) + return false; + } + return true; } bool SortFilterProxyModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const === modified file 'mixxx/src/sounddeviceportaudio.cpp' --- mixxx/src/sounddeviceportaudio.cpp 2009-04-26 16:59:25 +0000 +++ mixxx/src/sounddeviceportaudio.cpp 2009-06-27 20:09:33 +0000 @@ -197,7 +197,7 @@ { qDebug() << "Opened PortAudio stream successfully... starting"; } - +/* #ifdef __LINUX__ //Attempt to dynamically load and resolve stuff in the PortAudio library //in order to enable RT priority with ALSA. @@ -214,7 +214,7 @@ } portaudio.unload(); #endif - +*/ // Start stream err = Pa_StartStream(m_pStream); if (err != paNoError) === modified file 'mixxx/src/track.cpp' --- mixxx/src/track.cpp 2009-05-03 02:34:18 +0000 +++ mixxx/src/track.cpp 2009-05-21 20:22:53 +0000 @@ -288,19 +288,23 @@ { double centa = m_pView->m_pTrackTableView->size().width()/100.; qDebug() << "Adjusting column widths: tracktable width =" << m_pView->m_pTrackTableView->size().width() <<" 1% of that is:"<< centa << " FIXME: this should be done when initalizing the skin."; - m_pView->m_pTrackTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_pView->m_pTrackTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + m_pView->m_pTrackTableView->setColumnHidden(WTrackTableModel::TYPE, true); + m_pView->m_pTrackTableView->setColumnHidden(WTrackTableModel::BITRATE, true); + m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::PLAYED, 20/2. * centa); + m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::FILENAME, 20 * centa); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::ARTIST, 15 * centa); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TITLE, 40 * centa); - m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TYPE, (20/4.) * centa); + //m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TYPE, (20/4.) * centa); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::LENGTH, (20/4.) * centa); - m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BITRATE, (20/4.) * centa); + //m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BITRATE, (20/4.) * centa); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BPM, (20/4.) * centa); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::COMMENT, 25 * centa); if ( (20/4.) * centa <= 42 ) { // If we won't get enough percentage to display length, we have to make some adjustments... qDebug() << "Shrinking Title/Comment for small screen... "; - m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TYPE, 35); + //m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TYPE, 35); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::LENGTH, 42); - m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BITRATE, 33); + //m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BITRATE, 33); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::BPM, 40); m_pView->m_pTrackTableView->setColumnWidth(WTrackTableModel::TITLE, (60 * centa) - (35+42+33+40)); } @@ -629,6 +633,8 @@ //Int to UTF-8 string coversion for cmetrics QByteArray baElapsed = QString(time.elapsed()).toUtf8(); + + qDebug() << "Changing library path, need to update view?"; #ifdef __C_METRICS__ === modified file 'mixxx/src/trackinfoobject.cpp' --- mixxx/src/trackinfoobject.cpp 2009-03-06 00:20:56 +0000 +++ mixxx/src/trackinfoobject.cpp 2009-06-04 21:39:02 +0000 @@ -67,6 +67,7 @@ m_iSampleRate = 0; m_iChannels = 0; m_fCuePoint = 0.0f; + m_bPlayed = false; m_dVisualResampleRate = 0; @@ -119,6 +120,7 @@ m_fBeatFirst = XmlParse::selectNodeQString(nodeHeader, "BeatFirst").toFloat(); m_bHeaderParsed = false; m_iScore = 0; + m_bPlayed = false; m_iId = XmlParse::selectNodeQString(nodeHeader, "Id").toInt(); m_fCuePoint = XmlParse::selectNodeQString(nodeHeader, "CuePoint").toFloat(); @@ -611,13 +613,35 @@ void TrackInfoObject::incTimesPlayed() { + qDebug() << "Track Played:" << m_sArtist << " - " << m_sTitle; m_qMutex.lock(); ++m_iTimesPlayed; + m_bPlayed = true; if (m_iTimesPlayed>siMaxTimesPlayed) siMaxTimesPlayed = m_iTimesPlayed; m_qMutex.unlock(); } +bool TrackInfoObject::getPlayed() const +{ + m_qMutex.lock(); + bool bPlayed = m_bPlayed; + m_qMutex.unlock(); + + return bPlayed; +} + +void TrackInfoObject::setPlayed(bool bPlayed) +{ + m_qMutex.lock(); + m_bPlayed = bPlayed; + if (bPlayed) + qDebug() << "Track Played:" << m_sArtist << " - " << m_sTitle; + else + qDebug() << "Track Unplayed:" << m_sArtist << " - " << m_sTitle; + m_qMutex.unlock(); +} + void TrackInfoObject::setFilepath(QString s) { m_qMutex.lock(); === modified file 'mixxx/src/trackinfoobject.h' --- mixxx/src/trackinfoobject.h 2009-02-02 05:47:04 +0000 +++ mixxx/src/trackinfoobject.h 2009-05-20 23:15:31 +0000 @@ -139,6 +139,10 @@ int getTimesPlayed() const; /** Increment times played with one */ void incTimesPlayed(); + /** Returns true if track has been played this instance*/ + bool getPlayed() const; + /** Set Played status*/ + void setPlayed(bool); /** Sets the filepath */ void setFilepath(QString); /** Returns the score */ @@ -224,6 +228,8 @@ int m_iBitrate; /** Number of times the track has been played */ int m_iTimesPlayed; + /** Has track been played this run? */ + int m_bPlayed; /** Beat per minutes (BPM) */ float m_fBpm; /** Bpm Correction Factors */ === modified file 'mixxx/src/wtracktablemodel.cpp' --- mixxx/src/wtracktablemodel.cpp 2009-07-08 16:12:00 +0000 +++ mixxx/src/wtracktablemodel.cpp 2009-07-10 00:54:54 +0000 @@ -12,8 +12,10 @@ { rowColors = false; m_pTrackPlaylist = NULL; + m_sPrefix = QString(""); //setHeaderData(WTrackTableModel::SCORE,Qt::Horizontal, tr("**")); + setHeaderData(WTrackTableModel::PLAYED,Qt::Horizontal, tr("Played")); setHeaderData(WTrackTableModel::TITLE,Qt::Horizontal, tr("Title")); setHeaderData(WTrackTableModel::ARTIST,Qt::Horizontal, tr("Artist")); setHeaderData(WTrackTableModel::TYPE,Qt::Horizontal, tr("Type")); @@ -21,6 +23,8 @@ setHeaderData(WTrackTableModel::BITRATE,Qt::Horizontal, tr("kbit")); setHeaderData(WTrackTableModel::BPM,Qt::Horizontal, tr("BPM")); setHeaderData(WTrackTableModel::COMMENT,Qt::Horizontal, tr("Comment")); + setHeaderData(WTrackTableModel::FILEPATH,Qt::Horizontal, tr("Filepath")); + setHeaderData(WTrackTableModel::FILENAME,Qt::Horizontal, tr("Filename")); } WTrackTableModel::~WTrackTableModel() @@ -55,23 +59,48 @@ { switch(index.column()) { - //case WTrackTableModel::SCORE: return m_pTrackInfo->getScoreStr(); - case WTrackTableModel::TITLE: return m_pTrackInfo->getTitle(); - case WTrackTableModel::ARTIST: return m_pTrackInfo->getArtist(); - case WTrackTableModel::TYPE: return m_pTrackInfo->getType(); - case WTrackTableModel::LENGTH: return m_pTrackInfo->getDurationStr(); - case WTrackTableModel::BITRATE: return m_pTrackInfo->getBitrateStr(); - case WTrackTableModel::BPM: return m_pTrackInfo->getBpmStr(); - case WTrackTableModel::COMMENT: return m_pTrackInfo->getComment(); - default: - qDebug() << "index.column =" << index.column(); - Q_ASSERT(FALSE); //we should never get here - return QVariant(); + //case WTrackTableModel::SCORE: return m_pTrackInfo->getScoreStr(); + case WTrackTableModel::TITLE: return m_pTrackInfo->getTitle(); + case WTrackTableModel::ARTIST: return m_pTrackInfo->getArtist(); + case WTrackTableModel::TYPE: return m_pTrackInfo->getType(); + case WTrackTableModel::LENGTH: return m_pTrackInfo->getDurationStr(); + case WTrackTableModel::BITRATE: return m_pTrackInfo->getBitrateStr(); + case WTrackTableModel::BPM: return m_pTrackInfo->getBpmStr(); + case WTrackTableModel::COMMENT: return m_pTrackInfo->getComment(); + case WTrackTableModel::FILEPATH: return m_pTrackInfo->getFilepath().remove(0, m_sPrefix.size() + 1); + case WTrackTableModel::FILENAME: return m_pTrackInfo->getFilename(); + case WTrackTableModel::PLAYED: return QString("(%1)").arg(m_pTrackInfo->getTimesPlayed()); + default: + qDebug() << "index.column =" << index.column(); + Q_ASSERT(FALSE); //we should never get here + return QVariant(); } } - - else - return QVariant(); + else if (role == Qt::EditRole) + { + switch(index.column()) + { + case WTrackTableModel::BPM: return m_pTrackInfo->getBpmStr(); + case WTrackTableModel::COMMENT: return m_pTrackInfo->getComment(); + case WTrackTableModel::PLAYED: return m_pTrackInfo->getPlayed(); + default: + qDebug() << "Can't edit this column" << index.column(); + return QVariant(); + } + } + else if (role == Qt::CheckStateRole) + { + if (index.column() == WTrackTableModel::PLAYED) + { + if (m_pTrackInfo->getPlayed()) + { + return Qt::Checked; + } + return Qt::Unchecked; + } + } + + return QVariant(); } QVariant WTrackTableModel::headerData(int section, Qt::Orientation orientation, int role) const @@ -99,6 +128,12 @@ return QString("BPM"); case WTrackTableModel::COMMENT: return QString("Comment"); + case WTrackTableModel::FILEPATH: + return QString("Filepath"); + case WTrackTableModel::FILENAME: + return QString("Filename"); + case WTrackTableModel::PLAYED: + return QString("Played"); default: //this is a nasty error for the user to see, but its better than a crash and should help with debugging return QString("ERROR: WTrackTableModel::headerData Invalid section parameter"); @@ -119,6 +154,7 @@ { case WTrackTableModel::BPM: return defaultFlags | QAbstractItemModel::flags(index) | Qt::ItemIsEditable; case WTrackTableModel::COMMENT: return defaultFlags | QAbstractItemModel::flags(index) | Qt::ItemIsEditable; + case WTrackTableModel::PLAYED: return defaultFlags | QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable; } return defaultFlags; } @@ -132,11 +168,26 @@ switch(index.column()) { - case WTrackTableModel::BPM: m_pTrackInfo->setBpm(value.toString().toFloat()); break; - case WTrackTableModel::COMMENT: m_pTrackInfo->setComment(value.toString()); break; + case WTrackTableModel::BPM: m_pTrackInfo->setBpm(value.toString().toFloat()); break; + case WTrackTableModel::COMMENT: + //qDebug() << "comment setting to" << value.toString() << "<--"; + m_pTrackInfo->setComment(value.toString()); + emit dataChanged(index, index); + break; } emit dataChanged(index, index); - return true; + return true; + } + else if (index.isValid() && role == Qt::CheckStateRole) + { + TrackInfoObject * m_pTrackInfo = m_pTrackPlaylist->at(index.row()); + //qDebug() << "got checkbox update"; + switch (index.column()) + { + case WTrackTableModel::PLAYED: m_pTrackInfo->setPlayed(value.toBool()); break; + } + emit dataChanged(index, index); + return true; } return false; } @@ -222,3 +273,8 @@ bpmConfirmColor = confirmColor; rowColors = true; } + +void WTrackTableModel::setLibraryPrefix(QString sPrefix) +{ + m_sPrefix = sPrefix; +} === modified file 'mixxx/src/wtracktablemodel.h' --- mixxx/src/wtracktablemodel.h 2009-03-06 00:20:56 +0000 +++ mixxx/src/wtracktablemodel.h 2009-06-10 14:07:19 +0000 @@ -23,6 +23,7 @@ void setForegroundColor(QColor fgColor); void setRowColor(QColor evenColor, QColor unevenColor); void setBpmColor(QColor confirmColor, QColor noConfirmColor); + void setLibraryPrefix(QString sPrefix); int rowCount(const QModelIndex &parent = QModelIndex()) const; bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); @@ -34,13 +35,16 @@ DISABLED = -1, SCORE = DISABLED, // Note: all disabled items must be set to disabled and must appear before the first non-disabled item. + PLAYED, + FILEPATH, + FILENAME, + COMMENT , ARTIST , TITLE , TYPE , LENGTH , BITRATE , BPM , - COMMENT , COLUMN_COUNT // Note: COLUMN_COUNT must remain the last entry. } TABLE_COLUMNS; @@ -56,6 +60,7 @@ QColor rowUnevenColor; QColor bpmNoConfirmColor; QColor bpmConfirmColor; + QString m_sPrefix; QModelIndex index; bool rowColors; === modified file 'mixxx/src/wtracktableview.cpp' --- mixxx/src/wtracktableview.cpp 2009-04-18 16:32:23 +0000 +++ mixxx/src/wtracktableview.cpp 2009-05-21 20:23:13 +0000 @@ -199,6 +199,8 @@ setColumnWidth(i.key(),WWidget::selectNodeQString(node, i.value()).toInt()); } }*/ + + setEditTriggers(QAbstractItemView::SelectedClicked); } /* Sets the table mode (library, play queue, browse, etc.) */ @@ -362,6 +364,8 @@ m_pTable = pSearchSourceModel; m_pSearchFilter->setSourceModel(m_pTable); setModel(m_pSearchFilter); + qDebug() << "setting new library path"; + m_pTable->setLibraryPrefix(m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory"))); } void WTrackTableView::setDirModel() @@ -369,12 +373,16 @@ m_pTable = NULL; //FIXME: Shouldn't set to NULL, should set m_iTableMode = TABLE_MODE_BROWSE instead setModel(m_pDirFilter); setRootIndex(m_pDirFilter->mapFromSource(m_dirindex)); + qDebug() << "setting new library path"; + m_pTable->setLibraryPrefix(m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory"))); } void WTrackTableView::setPlaylistListModel(WPlaylistListModel *model) { m_pPlaylistListModel = model; setModel(m_pPlaylistListModel); + qDebug() << "setting new library path"; + m_pTable->setLibraryPrefix(m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory"))); //FIXME: Set search filter model somewhere or something? } @@ -766,14 +774,21 @@ if (m_iTableMode == TABLE_MODE_BROWSE) //Browse mode m_pTrack->slotLoadPlayer1(m_selectedDirTrackNames.at(0)); else //Library mode + { m_pTrack->slotLoadPlayer1(m_selectedTrackInfoObjects.at(0)); + reset(); //this causes the checkbox to correctly redisplay its state + } } + void WTrackTableView::slotLoadPlayer2() { if (m_iTableMode == TABLE_MODE_BROWSE) //Browse mode m_pTrack->slotLoadPlayer2(m_selectedDirTrackNames.at(0)); - else //Library mode - m_pTrack->slotLoadPlayer2(m_selectedTrackInfoObjects.at(0)); + else //Library mode + { + m_pTrack->slotLoadPlayer2(m_selectedTrackInfoObjects.at(0)); + reset(); //this causes the checkbox to correctly redisplay its state + } } void WTrackTableView::slotSendToPlayqueue()