diff options
Diffstat (limited to 'src/plugins')
34 files changed, 167 insertions, 116 deletions
diff --git a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp index 8e8f12c7e..f8b36c29d 100644 --- a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp +++ b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp @@ -99,7 +99,7 @@ QString PlayListOption::executeCommand(const QString& opt_str, const QStringList PlayListModel *model = pl_manager->playListAt(pl_id); if(!model) return tr("Invalid playlist ID") + "\n"; - PlayListItem *item = model->item(track_id); + PlayListTrack *item = model->item(track_id); if(!item) return tr("Invalid track ID") + "\n"; player->stop(); diff --git a/src/plugins/General/converter/converterdialog.cpp b/src/plugins/General/converter/converterdialog.cpp index 2cf238441..2c83e5416 100644 --- a/src/plugins/General/converter/converterdialog.cpp +++ b/src/plugins/General/converter/converterdialog.cpp @@ -29,11 +29,11 @@ #include "preseteditor.h" #include "converterdialog.h" -ConverterDialog::ConverterDialog(QList <PlayListItem *> items, QWidget *parent) : QDialog(parent) +ConverterDialog::ConverterDialog(QList <PlayListTrack *> items, QWidget *parent) : QDialog(parent) { ui.setupUi(this); MetaDataFormatter formatter("%p%if(%p&%t, - ,)%t - %l"); - foreach(PlayListItem *item , items) + foreach(PlayListTrack *item , items) { if(item->length() == 0) continue; diff --git a/src/plugins/General/converter/converterdialog.h b/src/plugins/General/converter/converterdialog.h index a7f531b55..981a726fc 100644 --- a/src/plugins/General/converter/converterdialog.h +++ b/src/plugins/General/converter/converterdialog.h @@ -26,7 +26,7 @@ #include "ui_converterdialog.h" class QAction; -class PlayListItem; +class PlayListTrack; class ConverterPreset; /** @@ -36,7 +36,7 @@ class ConverterDialog : public QDialog { Q_OBJECT public: - explicit ConverterDialog(QList <PlayListItem *> items, QWidget *parent = 0); + explicit ConverterDialog(QList <PlayListTrack *> items, QWidget *parent = 0); virtual ~ConverterDialog(); QStringList selectedUrls() const; diff --git a/src/plugins/General/converter/converterhelper.cpp b/src/plugins/General/converter/converterhelper.cpp index 96ccf72a2..0a93990c6 100644 --- a/src/plugins/General/converter/converterhelper.cpp +++ b/src/plugins/General/converter/converterhelper.cpp @@ -55,7 +55,7 @@ ConverterHelper::~ConverterHelper() void ConverterHelper::openConverter() { PlayListManager *pl_manager = MediaPlayer::instance()->playListManager(); - QList <PlayListItem *> items = pl_manager->selectedPlayList()->selectedItems(); + QList <PlayListTrack *> items = pl_manager->selectedPlayList()->selectedItems(); if (items.isEmpty()) return; diff --git a/src/plugins/General/copypaste/copypaste.cpp b/src/plugins/General/copypaste/copypaste.cpp index 87fc8a275..2d9576187 100644 --- a/src/plugins/General/copypaste/copypaste.cpp +++ b/src/plugins/General/copypaste/copypaste.cpp @@ -66,9 +66,9 @@ void CopyPaste::cut() qDebug("%s", Q_FUNC_INFO); qDeleteAll(m_buffer); m_buffer.clear(); - foreach(PlayListItem *item, m_pl_manager->selectedPlayList()->selectedItems()) + foreach(PlayListTrack *item, m_pl_manager->selectedPlayList()->selectedItems()) { - m_buffer.append(new PlayListItem(*item)); + m_buffer.append(new PlayListTrack(*item)); } m_pl_manager->selectedPlayList()->removeSelected(); } @@ -78,17 +78,17 @@ void CopyPaste::copy() qDebug("%s", Q_FUNC_INFO); qDeleteAll(m_buffer); m_buffer.clear(); - foreach(PlayListItem *item, m_pl_manager->selectedPlayList()->selectedItems()) + foreach(PlayListTrack *item, m_pl_manager->selectedPlayList()->selectedItems()) { - m_buffer.append(new PlayListItem(*item)); + m_buffer.append(new PlayListTrack(*item)); } } void CopyPaste::paste() { qDebug("%s", Q_FUNC_INFO); - foreach(PlayListItem *item, m_buffer) + foreach(PlayListTrack *item, m_buffer) { - m_pl_manager->selectedPlayList()->add(new PlayListItem(*item)); + m_pl_manager->selectedPlayList()->add(new PlayListTrack(*item)); } } diff --git a/src/plugins/General/copypaste/copypaste.h b/src/plugins/General/copypaste/copypaste.h index 9a444f26c..3b550122c 100644 --- a/src/plugins/General/copypaste/copypaste.h +++ b/src/plugins/General/copypaste/copypaste.h @@ -26,7 +26,7 @@ class QAction; class SoundCore; -class PlayListItem; +class PlayListTrack; class PlayListManager; /** @@ -47,7 +47,7 @@ private slots: private: PlayListManager *m_pl_manager; - QList<PlayListItem *> m_buffer; + QList<PlayListTrack *> m_buffer; }; #endif //COPYPASTE_H diff --git a/src/plugins/General/covermanager/covermanager.cpp b/src/plugins/General/covermanager/covermanager.cpp index 7ab4c82dc..a01bffa60 100644 --- a/src/plugins/General/covermanager/covermanager.cpp +++ b/src/plugins/General/covermanager/covermanager.cpp @@ -40,7 +40,7 @@ CoverManager::CoverManager(QObject *parent) : QObject(parent) void CoverManager::showWindow() { - QList <PlayListItem *> items = MediaPlayer::instance()->playListManager()->selectedPlayList()->selectedItems(); + QList <PlayListTrack *> items = MediaPlayer::instance()->playListManager()->selectedPlayList()->selectedItems(); if (!items.isEmpty()) { CoverWidget *w = new CoverWidget(qApp->activeWindow ()); diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp index 245c4fe20..4283bb187 100644 --- a/src/plugins/General/fileops/fileops.cpp +++ b/src/plugins/General/fileops/fileops.cpp @@ -85,7 +85,7 @@ void FileOps::execAction(int n) QString destination = m_destinations.at(n); PlayListModel *model = MediaPlayer::instance()->playListManager()->selectedPlayList(); - QList<PlayListItem*> items = model->selectedItems(); + QList<PlayListTrack*> items = model->selectedItems(); switch (type) { @@ -105,7 +105,7 @@ void FileOps::execAction(int n) progress.show(); progress.setAutoClose (false); int i = 0; - foreach(PlayListItem *item, items) + foreach(PlayListTrack *item, items) { if (!QFile::exists(item->url())) continue; @@ -158,7 +158,7 @@ void FileOps::execAction(int n) } case RENAME: qDebug("FileOps: rename"); - foreach(PlayListItem *item, items) + foreach(PlayListTrack *item, items) { if (!QFile::exists(item->url())) continue; @@ -191,7 +191,7 @@ void FileOps::execAction(int n) QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) break; - foreach(PlayListItem *item, items) + foreach(PlayListTrack *item, items) { if (QFile::exists(item->url()) && QFile::remove(item->url())) model->removeAt (model->indexOf(item)); diff --git a/src/plugins/General/fileops/fileops.h b/src/plugins/General/fileops/fileops.h index 23c35c6de..fdd87182f 100644 --- a/src/plugins/General/fileops/fileops.h +++ b/src/plugins/General/fileops/fileops.h @@ -25,7 +25,7 @@ class QAction; class SoundCore; -class PlayListItem; +class PlayListTrack; /** @author Ilya Kotov <forkotov02@hotmail.ru> diff --git a/src/plugins/General/hal/halplugin.cpp b/src/plugins/General/hal/halplugin.cpp index 51db4d894..2f1dfd067 100644 --- a/src/plugins/General/hal/halplugin.cpp +++ b/src/plugins/General/hal/halplugin.cpp @@ -237,7 +237,7 @@ HalDevice *HalPlugin::findDevice(QAction *action) void HalPlugin::addPath(const QString &path) { - foreach(PlayListItem *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? + foreach(PlayListTrack *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? { if (item->url().startsWith(path)) return; diff --git a/src/plugins/General/lyrics/lyrics.cpp b/src/plugins/General/lyrics/lyrics.cpp index 415e04647..fef704801 100644 --- a/src/plugins/General/lyrics/lyrics.cpp +++ b/src/plugins/General/lyrics/lyrics.cpp @@ -42,7 +42,7 @@ Lyrics::~Lyrics() void Lyrics::showLyrics() { PlayListManager *pl_manager = MediaPlayer::instance()->playListManager(); - QList <PlayListItem *> items = pl_manager->selectedPlayList()->selectedItems(); + QList <PlayListTrack *> items = pl_manager->selectedPlayList()->selectedItems(); if (!items.isEmpty()) { if (items.at(0)->value(Qmmp::ARTIST).isEmpty() || items.at(0)->value(Qmmp::TITLE).isEmpty()) diff --git a/src/plugins/General/mpris/mpris1/tracklistobject.cpp b/src/plugins/General/mpris/mpris1/tracklistobject.cpp index 9576a902a..e75900439 100644 --- a/src/plugins/General/mpris/mpris1/tracklistobject.cpp +++ b/src/plugins/General/mpris/mpris1/tracklistobject.cpp @@ -82,7 +82,7 @@ int TrackListObject::GetLength() QVariantMap TrackListObject::GetMetadata(int in0) { QVariantMap map; - PlayListItem *item = m_model->item(in0); + PlayListTrack *item = m_model->item(in0); if (item) { if (QFile::exists(item->url())) diff --git a/src/plugins/General/mpris/mpris2/player2object.cpp b/src/plugins/General/mpris/mpris2/player2object.cpp index 1aeb4b2ac..af22d1eb7 100644 --- a/src/plugins/General/mpris/mpris2/player2object.cpp +++ b/src/plugins/General/mpris/mpris2/player2object.cpp @@ -119,7 +119,7 @@ double Player2Object::maximumRate() const QVariantMap Player2Object::metadata() const { - PlayListItem *item = m_pl_manager->currentPlayList()->currentItem(); + PlayListTrack *item = m_pl_manager->currentPlayList()->currentItem(); if(!item || m_core->metaData(Qmmp::URL).isEmpty()) return QVariantMap(); QVariantMap map; @@ -222,8 +222,8 @@ void Player2Object::OpenUri(const QString &in0) if(!m_pl_manager->currentPlayList()->isLoaderRunning()) { m_pl_manager->selectPlayList(m_pl_manager->currentPlayList()); - connect(m_pl_manager->currentPlayList(), SIGNAL(itemAdded(PlayListItem*)), - SLOT(playItem(PlayListItem*))); + connect(m_pl_manager->currentPlayList(), SIGNAL(itemAdded(PlayListTrack*)), + SLOT(playItem(PlayListTrack*))); connect(m_pl_manager->currentPlayList(), SIGNAL(loaderFinished()), this, SLOT(disconnectPl())); } m_pl_manager->currentPlayList()->add(path); @@ -343,11 +343,11 @@ void Player2Object::checkSeeking(qint64 elapsed) m_previous_pos = elapsed; } -void Player2Object::playItem(PlayListItem *item) +void Player2Object::playItem(PlayListTrack *item) { m_pl_manager->selectPlayList((PlayListModel*)sender()); m_pl_manager->activatePlayList((PlayListModel*)sender()); - disconnect(sender(), SIGNAL(itemAddded(itemAdded(PlayListItem*))), this, SLOT(playItem(PlayListItem*))); + disconnect(sender(), SIGNAL(itemAddded(itemAdded(PlayListTrack*))), this, SLOT(playItem(PlayListTrack*))); if(!m_pl_manager->currentPlayList()->setCurrent(item)) return; m_core->stop(); @@ -356,8 +356,8 @@ void Player2Object::playItem(PlayListItem *item) void Player2Object::disconnectPl() { - disconnect(sender(), SIGNAL(itemAddded(itemAdded(PlayListItem*))), - this, SLOT(playItem(PlayListItem*))); + disconnect(sender(), SIGNAL(itemAddded(itemAdded(PlayListTrack*))), + this, SLOT(playItem(PlayListTrack*))); } void Player2Object::setModel(PlayListModel *selected, PlayListModel *previous) diff --git a/src/plugins/General/mpris/mpris2/player2object.h b/src/plugins/General/mpris/mpris2/player2object.h index 37d332cf2..b808f83e5 100644 --- a/src/plugins/General/mpris/mpris2/player2object.h +++ b/src/plugins/General/mpris/mpris2/player2object.h @@ -30,7 +30,7 @@ class SoundCore; class MediaPlayer; class PlayListManager; -class PlayListItem; +class PlayListTrack; class PlayListModel; /** @@ -97,7 +97,7 @@ private slots: void updateId(); void checkState(Qmmp::State state); void checkSeeking(qint64 elapsed); - void playItem(PlayListItem *item); + void playItem(PlayListTrack *item); void disconnectPl(); void setModel(PlayListModel *selected, PlayListModel *previous); @@ -109,7 +109,7 @@ private: PlayListManager *m_pl_manager; QMap<QString, QVariant> m_props; QDBusObjectPath m_trackID; - PlayListItem *m_prev_item; + PlayListTrack *m_prev_item; qint64 m_previous_pos; }; diff --git a/src/plugins/General/trackchange/trackchange.h b/src/plugins/General/trackchange/trackchange.h index 372964551..727f2e2d5 100644 --- a/src/plugins/General/trackchange/trackchange.h +++ b/src/plugins/General/trackchange/trackchange.h @@ -26,7 +26,7 @@ class QAction; class SoundCore; -class PlayListItem; +class PlayListTrack; class PlayListManager; /** diff --git a/src/plugins/General/udisks/udisksplugin.cpp b/src/plugins/General/udisks/udisksplugin.cpp index ae342165d..220bf2c03 100644 --- a/src/plugins/General/udisks/udisksplugin.cpp +++ b/src/plugins/General/udisks/udisksplugin.cpp @@ -231,7 +231,7 @@ UDisksDevice *UDisksPlugin::findDevice(QAction *action) void UDisksPlugin::addPath(const QString &path) { - foreach(PlayListItem *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? + foreach(PlayListTrack *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? { if (item->url().startsWith(path)) return; diff --git a/src/plugins/General/udisks2/udisks2plugin.cpp b/src/plugins/General/udisks2/udisks2plugin.cpp index 39c8c6af7..bfee228d8 100644 --- a/src/plugins/General/udisks2/udisks2plugin.cpp +++ b/src/plugins/General/udisks2/udisks2plugin.cpp @@ -211,7 +211,7 @@ UDisks2Device *UDisks2Plugin::findDevice(QAction *action) void UDisks2Plugin::addPath(const QString &path) { - foreach(PlayListItem *item, PlayListManager::instance()->selectedPlayList()->items()) // Is it already exist? + foreach(PlayListTrack *item, PlayListManager::instance()->selectedPlayList()->items()) // Is it already exist? { if (item->url().startsWith(path)) return; diff --git a/src/plugins/PlayListFormats/m3u/m3uplaylistformat.cpp b/src/plugins/PlayListFormats/m3u/m3uplaylistformat.cpp index 7f916dda1..d426fe1ff 100644 --- a/src/plugins/PlayListFormats/m3u/m3uplaylistformat.cpp +++ b/src/plugins/PlayListFormats/m3u/m3uplaylistformat.cpp @@ -51,11 +51,11 @@ QStringList M3UPlaylistFormat::decode(const QString & contents) return out; } -QString M3UPlaylistFormat::encode(const QList<PlayListItem*> & contents) +QString M3UPlaylistFormat::encode(const QList<PlayListTrack*> & contents) { QStringList out; out << QString("#EXTM3U"); - foreach(PlayListItem* f,contents) + foreach(PlayListTrack* f,contents) { QString info = "#EXTINF:" + QString::number(f->length()) + "," + f->value(Qmmp::TITLE); out.append(info); diff --git a/src/plugins/PlayListFormats/m3u/m3uplaylistformat.h b/src/plugins/PlayListFormats/m3u/m3uplaylistformat.h index 4c2405abf..6e9397f0c 100644 --- a/src/plugins/PlayListFormats/m3u/m3uplaylistformat.h +++ b/src/plugins/PlayListFormats/m3u/m3uplaylistformat.h @@ -37,7 +37,7 @@ class M3UPlaylistFormat : public QObject, public PlayListFormat public: const PlayListFormatProperties properties() const; QStringList decode(const QString& contents); - QString encode(const QList<PlayListItem*>& contents); + QString encode(const QList<PlayListTrack*>& contents); }; diff --git a/src/plugins/PlayListFormats/pls/plsplaylistformat.cpp b/src/plugins/PlayListFormats/pls/plsplaylistformat.cpp index f73d7cc87..76073a7c6 100644 --- a/src/plugins/PlayListFormats/pls/plsplaylistformat.cpp +++ b/src/plugins/PlayListFormats/pls/plsplaylistformat.cpp @@ -64,12 +64,12 @@ QStringList PLSPlaylistFormat::decode(const QString & contents) return QStringList(); } -QString PLSPlaylistFormat::encode(const QList<PlayListItem *> & contents) +QString PLSPlaylistFormat::encode(const QList<PlayListTrack *> & contents) { QStringList out; out << QString("[playlist]"); int counter = 1; - foreach(PlayListItem* f,contents) + foreach(PlayListTrack* f,contents) { QString begin = "File" + QString::number(counter) + "="; out.append(begin + f->url()); diff --git a/src/plugins/PlayListFormats/pls/plsplaylistformat.h b/src/plugins/PlayListFormats/pls/plsplaylistformat.h index 42fbb48f6..28b5b724e 100644 --- a/src/plugins/PlayListFormats/pls/plsplaylistformat.h +++ b/src/plugins/PlayListFormats/pls/plsplaylistformat.h @@ -37,7 +37,7 @@ class PLSPlaylistFormat : public QObject, public PlayListFormat public: const PlayListFormatProperties properties() const; QStringList decode(const QString& contents); - QString encode(const QList<PlayListItem*>& contents); + QString encode(const QList<PlayListTrack*>& contents); }; diff --git a/src/plugins/PlayListFormats/xspf/xspfplaylistformat.cpp b/src/plugins/PlayListFormats/xspf/xspfplaylistformat.cpp index 9d37610de..08b840177 100644 --- a/src/plugins/PlayListFormats/xspf/xspfplaylistformat.cpp +++ b/src/plugins/PlayListFormats/xspf/xspfplaylistformat.cpp @@ -75,7 +75,7 @@ QStringList XSPFPlaylistFormat::decode(const QString & contents) // Needs more work - it's better use libSpiff there and put it as plugin. -QString XSPFPlaylistFormat::encode(const QList<PlayListItem*> & files) +QString XSPFPlaylistFormat::encode(const QList<PlayListTrack*> & files) { QDomDocument doc; QDomElement root = doc.createElement("playlist"); @@ -90,7 +90,7 @@ QString XSPFPlaylistFormat::encode(const QList<PlayListItem*> & files) QDomElement tracklist = doc.createElement("trackList"); int counter = 1; - foreach(PlayListItem* f,files) + foreach(PlayListTrack* f,files) { QDomElement track = doc.createElement("track"); diff --git a/src/plugins/PlayListFormats/xspf/xspfplaylistformat.h b/src/plugins/PlayListFormats/xspf/xspfplaylistformat.h index 4570c041d..d7f705c55 100644 --- a/src/plugins/PlayListFormats/xspf/xspfplaylistformat.h +++ b/src/plugins/PlayListFormats/xspf/xspfplaylistformat.h @@ -37,7 +37,7 @@ class XSPFPlaylistFormat : public QObject, public PlayListFormat public: const PlayListFormatProperties properties() const; QStringList decode(const QString& contents); - QString encode(const QList<PlayListItem*>& contents); + QString encode(const QList<PlayListTrack*>& contents); }; #endif diff --git a/src/plugins/Ui/skinned/eqwidget.cpp b/src/plugins/Ui/skinned/eqwidget.cpp index 5068e0861..54450b705 100644 --- a/src/plugins/Ui/skinned/eqwidget.cpp +++ b/src/plugins/Ui/skinned/eqwidget.cpp @@ -323,22 +323,22 @@ void EqWidget::savePreset() void EqWidget::saveAutoPreset() { - PlayList* playlist = qobject_cast<MainWindow*>(parent())->playlist(); - if (!playlist->currentItem()) - return; + PlayList* playlist;// = qobject_cast<MainWindow*>(parent())->playlist(); + /*if (!playlist->currentItem()) + return;*/ //delete preset if it already exists - EQPreset* preset = findPreset(playlist->currentItem()->url().section("/",-1)); - if (preset) - deletePreset(preset); + //EQPreset* preset = findPreset(playlist->currentItem()->url().section("/",-1)); + //if (preset) + // deletePreset(preset); //create new preset - preset = new EQPreset(); - preset->setText(playlist->currentItem()->url().section("/",-1)); - preset->setPreamp(m_preamp->value()); + //preset = new EQPreset(); + //preset->setText(playlist->currentItem()->url().section("/",-1)); + /*preset->setPreamp(m_preamp->value()); for (int i = 0; i<10; ++i) { preset->setGain(i, m_sliders.at (i)->value()); } - m_autoPresets.append(preset); + m_autoPresets.append(preset);*/ } void EqWidget::setPreset(EQPreset* preset) diff --git a/src/plugins/Ui/skinned/eqwidget.h b/src/plugins/Ui/skinned/eqwidget.h index 1f96d1310..8ed690e94 100644 --- a/src/plugins/Ui/skinned/eqwidget.h +++ b/src/plugins/Ui/skinned/eqwidget.h @@ -35,7 +35,7 @@ class ToggleButton; class EQGraph; class Button; class EQPreset; -class PlayListItem; +class PlayListTrack; class SoundCore; class EqWidget : public PixmapWidget diff --git a/src/plugins/Ui/skinned/listwidget.cpp b/src/plugins/Ui/skinned/listwidget.cpp index f4e9c1c2f..64fb4f770 100644 --- a/src/plugins/Ui/skinned/listwidget.cpp +++ b/src/plugins/Ui/skinned/listwidget.cpp @@ -168,50 +168,80 @@ void ListWidget::paintEvent(QPaintEvent *) for (int i = 0; i < m_rows.size(); ++i ) { + sy = (i + 1) * (2 + m_metrics->lineSpacing()) - 2 - m_metrics->descent(); + + if(m_rows[i]->separator) + { + painter.setPen(m_normal); + if(m_number_width) + { + sx = 10 + m_number_width + m_metrics->width("9"); + if(rtl) + { + sx = width() - sx - m_metrics->width(m_rows[i]->title); + } + } + else + { + sx = rtl ? width() - 10 - m_metrics->width(m_rows[i]->title) : 10; + } + painter.drawLine(sx, sy - m_metrics->lineSpacing()/2 + 2, + sx + 30, sy - m_metrics->lineSpacing()/2 + 2); + + painter.drawLine(sx + 35 + m_metrics->width(m_rows[i]->title) + 5, + sy - m_metrics->lineSpacing()/2 + 2, + width() - 10, + sy - m_metrics->lineSpacing()/2 + 2); + + painter.drawText(sx + 35, sy, m_rows[i]->title); + continue; + } + if (m_show_anchor && i == m_anchor_row - m_first) { - painter.setBrush(m_rows[i]->item->isSelected() ? m_selected_bg : m_normal_bg); + painter.setBrush(m_rows[i]->selected ? m_selected_bg : m_normal_bg); painter.setPen(m_normal); painter.drawRect (6, i * (m_metrics->lineSpacing() + 2), - width() - 10, m_metrics->lineSpacing() + 1); + width() - 10, m_metrics->lineSpacing() + 1); } else { - if (m_rows[i]->item->isSelected()) + if (m_rows[i]->selected) { painter.setBrush(QBrush(m_selected_bg)); painter.setPen(m_selected_bg); painter.drawRect (6, i * (m_metrics->lineSpacing() + 2), - width() - 10, m_metrics->lineSpacing() + 1); + width() - 10, m_metrics->lineSpacing() + 1); } } - if (m_model->currentIndex() == m_rows[i]->index) + + if (m_model->currentIndex() == m_first + i) painter.setPen(m_current); else painter.setPen(m_normal); //243,58 - sy = (i + 1) * (2 + m_metrics->lineSpacing()) - 2 - m_metrics->descent(); if(m_number_width) { - QString number = QString("%1").arg(m_first+i+1); + QString number = QString("%1").arg(m_rows[i]->number); sx = 10 + m_number_width - m_metrics->width(number); if(rtl) sx = width() - sx - m_metrics->width(number); - painter.drawText(sx, sy, number); + if(!m_rows[i]->separator) + painter.drawText(sx, sy, number); sx = 10 + m_number_width + m_metrics->width("9"); if(rtl) sx = width() - sx - m_metrics->width(m_rows[i]->title); - painter.drawText(sx, sy, m_rows[i]->title); } else { sx = rtl ? width() - 10 - m_metrics->width(m_rows[i]->title) : 10; - painter.drawText(sx, sy, m_rows[i]->title); } + painter.drawText(sx, sy, m_rows[i]->title); + QString extra_string = m_rows[i]->extraString; if(!extra_string.isEmpty()) @@ -349,7 +379,7 @@ void ListWidget::wheelEvent (QWheelEvent *e) bool ListWidget::event (QEvent *e) { - if(m_popupWidget) + /*if(m_popupWidget) { if(e->type() == QEvent::ToolTip) { @@ -366,7 +396,7 @@ bool ListWidget::event (QEvent *e) } else if(e->type() == QEvent::Leave) m_popupWidget->deactivate(); - } + }*/ return QWidget::event(e); } @@ -391,34 +421,51 @@ void ListWidget::updateList() //song numbers width if(m_show_number && m_align_numbres && m_model->count()) { - m_number_width = m_metrics->width("9") * QString::number(m_model->count()).size(); + m_number_width = m_metrics->width("9") * QString::number(m_model->trackCount()).size(); } else m_number_width = 0; - qDeleteAll(m_rows); //TODO do not delete all row objects + qDeleteAll(m_rows); m_rows.clear(); QList<PlayListItem *> items = m_model->mid(m_first, m_row_count); + + while(m_rows.count() < qMin(m_row_count, items.count())) + m_rows << new ListWidgetRow; + while(m_rows.count() > qMin(m_row_count, items.count())) + delete m_rows.takeFirst(); + for(int i = 0; i < items.count(); ++i) { - ListWidgetRow *row = new ListWidgetRow; - row->item = items[i]; - row->title = items[i]->formattedTitle(); - row->length = items[i]->formattedLength(); - row->index = m_first + i; - //add numbers - if(m_show_number && !m_align_numbres) - row->title.prepend(QString("%1").arg(m_first+i+1)+". "); - //elide titles - row->extraString = getExtraString(m_first + i); - int extra_string_width = row->extraString.isEmpty() ? 0 : m_metrics->width(row->extraString); - if(m_number_width) - extra_string_width += m_number_width + m_metrics->width("9"); - row->title = m_metrics->elidedText (row->title, Qt::ElideRight, - width() - m_metrics->width(row->length) - 22 - extra_string_width); - - m_rows.append(row); + ListWidgetRow *row = m_rows[i]; + if(items[i]->isGroup()) + { + row->separator = true; + row->number = 0; + row->title = items[i]->formattedTitle(); + row->length.clear(); + row->selected = false; + row->title = m_metrics->elidedText (row->title, Qt::ElideRight, + width() - m_number_width - 22 - 70); + } + else + { + row->separator = false; + row->number = m_model->numberOfTrack(m_first+i) + 1; + row->title = items[i]->formattedTitle(); + row->length = items[i]->formattedLength(); + row->selected = items[i]->isSelected(); + if(m_show_number && !m_align_numbres) + row->title.prepend(QString("%1").arg(row->number)+". "); + row->extraString = getExtraString(m_first + i); + //elide titles + int extra_string_width = row->extraString.isEmpty() ? 0 : m_metrics->width(row->extraString); + if(m_number_width) + extra_string_width += m_number_width + m_metrics->width("9"); + row->title = m_metrics->elidedText (row->title, Qt::ElideRight, + width() - m_metrics->width(row->length) - 22 - extra_string_width); + } } m_scroll = false; update(); @@ -504,18 +551,22 @@ const QString ListWidget::getExtraString(int i) { QString extra_string; - if (m_show_protocol && m_model->item(i)->url().contains("://")) - extra_string = "[" + m_model->item(i)->url().split("://").at(0) + "]"; + PlayListTrack *track = m_model->track(i); + if(!track) + return extra_string; - if (m_model->isQueued(m_model->item(i))) + if (m_show_protocol && track->url().contains("://")) + extra_string = "[" + track->url().split("://").at(0) + "]"; + + if (m_model->isQueued(track)) { - int index = m_model->queuedIndex(m_model->item(i)); + int index = m_model->queuedIndex(track); extra_string += "|"+QString::number(index + 1)+"|"; } if(m_model->currentIndex() == i && m_player->isRepeatable()) extra_string += "|R|"; - else if(m_model->isStopAfter(m_model->item(i))) + else if(m_model->isStopAfter(track)) extra_string += "|S|"; extra_string = extra_string.trimmed(); //remove white space @@ -570,8 +621,8 @@ void ListWidget::mouseMoveEvent(QMouseEvent *e) else if(m_popupWidget) { int row = rowAt(e->y()); - if(row < 0 || m_popupWidget->url() != m_model->item(row)->url()) - m_popupWidget->deactivate(); + /*if(row < 0 || m_popupWidget->url() != m_model->item(row)->url()) + m_popupWidget->deactivate();*/ } } diff --git a/src/plugins/Ui/skinned/listwidget.h b/src/plugins/Ui/skinned/listwidget.h index 75dd12427..b7e902203 100644 --- a/src/plugins/Ui/skinned/listwidget.h +++ b/src/plugins/Ui/skinned/listwidget.h @@ -46,8 +46,9 @@ struct ListWidgetRow QString title; QString length; QString extraString; - int index; - PlayListItem *item; + int number; + bool separator; + bool selected; }; /** diff --git a/src/plugins/Ui/skinned/mainwindow.cpp b/src/plugins/Ui/skinned/mainwindow.cpp index c042e757b..d46e8e315 100644 --- a/src/plugins/Ui/skinned/mainwindow.cpp +++ b/src/plugins/Ui/skinned/mainwindow.cpp @@ -174,8 +174,8 @@ void MainWindow::showState(Qmmp::State state) switch ((int) state) { case Qmmp::Playing: - if (m_pl_manager->currentPlayList()->currentItem()) - m_equalizer->loadPreset(m_pl_manager->currentPlayList()->currentItem()->url().section("/",-1)); + //if (m_pl_manager->currentPlayList()->currentItem()) + // m_equalizer->loadPreset(m_pl_manager->currentPlayList()->currentItem()->url().section("/",-1)); break; case Qmmp::Paused: break; @@ -191,11 +191,11 @@ void MainWindow::showState(Qmmp::State state) void MainWindow::showMetaData() { - if (m_playlist->currentItem() && + /*if (m_playlist->currentItem() && m_playlist->currentItem()->url() == m_core->metaData().value(Qmmp::URL)) { setWindowTitle(m_playlist->currentItem()->formattedTitle()); - } + }*/ } void MainWindow::closeEvent (QCloseEvent *) diff --git a/src/plugins/Ui/skinned/playlist.cpp b/src/plugins/Ui/skinned/playlist.cpp index c72802606..57ca57550 100644 --- a/src/plugins/Ui/skinned/playlist.cpp +++ b/src/plugins/Ui/skinned/playlist.cpp @@ -522,7 +522,7 @@ void PlayList::updateList() PlayListItem *PlayList::currentItem() { - return m_pl_manager->currentPlayList()->currentItem(); + return m_pl_manager->currentPlayList()->currentTrack(); } void PlayList::showPlaylistMenu() @@ -582,7 +582,7 @@ void PlayList::generateCopySelectedMenu() void PlayList::copySelectedMenuActionTriggered(QAction *action) { - PlayListModel *targetPlayList = 0; + /*PlayListModel *targetPlayList = 0; QString actionText=action->text(); if(action == m_copySelectedMenu->actions().at(0))//actionText == tr ("&New PlayList")) { @@ -606,13 +606,13 @@ void PlayList::copySelectedMenuActionTriggered(QAction *action) qWarning("Error: Cannot find target playlist '%s'",qPrintable(actionText)); return; } - QList <PlayListItem *> theCopy; + QList <PlayListTrack *> theCopy; foreach(PlayListItem *item, m_pl_manager->selectedPlayList()->selectedItems()) { - PlayListItem *newItem = new PlayListItem(*item); + PlayListTrack *newItem = new PlayListTrack(*item); theCopy << newItem; } - targetPlayList->add(theCopy); + targetPlayList->add(theCopy);*/ } void PlayList::setMinimalMode(bool b) diff --git a/src/plugins/Ui/skinned/playlist.h b/src/plugins/Ui/skinned/playlist.h index 80adaf3c7..fc1bd3959 100644 --- a/src/plugins/Ui/skinned/playlist.h +++ b/src/plugins/Ui/skinned/playlist.h @@ -51,7 +51,6 @@ class PlayList : public QWidget PlayList (PlayListManager *manager, QWidget *parent = 0); virtual ~PlayList(); - void load (PlayListItem *); void readSettings(); PlayListItem *currentItem(); ListWidget* listWidget() const diff --git a/src/plugins/Ui/skinned/playlisttitlebar.cpp b/src/plugins/Ui/skinned/playlisttitlebar.cpp index 3c5e5d55e..017bed82c 100644 --- a/src/plugins/Ui/skinned/playlisttitlebar.cpp +++ b/src/plugins/Ui/skinned/playlisttitlebar.cpp @@ -260,9 +260,9 @@ void PlayListTitleBar::mouseDoubleClickEvent (QMouseEvent *) void PlayListTitleBar::showCurrent() { - if (m_model) + /*if (m_model) { - PlayListItem* info = m_model->currentItem(); + PlayListTrack* info = m_model->currentItem(); if (info) { m_text = QString("%1. %2").arg(m_model->currentIndex()+1) @@ -278,5 +278,5 @@ void PlayListTitleBar::showCurrent() } QFontMetrics metrics(m_font); m_truncatedText = metrics.elidedText (m_text, Qt::ElideRight, width() - 35*m_ratio); - updatePixmap(); + updatePixmap();*/ } diff --git a/src/plugins/Ui/skinned/popupwidget.cpp b/src/plugins/Ui/skinned/popupwidget.cpp index 640a4fddb..8714f966d 100644 --- a/src/plugins/Ui/skinned/popupwidget.cpp +++ b/src/plugins/Ui/skinned/popupwidget.cpp @@ -81,7 +81,7 @@ void PopupWidget::mouseMoveEvent (QMouseEvent *) hide(); } -void PopupWidget::prepare(PlayListItem *item, QPoint pos) +void PopupWidget::prepare(PlayListTrack *item, QPoint pos) { pos += QPoint(15,10); diff --git a/src/plugins/Ui/skinned/popupwidget.h b/src/plugins/Ui/skinned/popupwidget.h index 87c3bed2b..806165851 100644 --- a/src/plugins/Ui/skinned/popupwidget.h +++ b/src/plugins/Ui/skinned/popupwidget.h @@ -26,7 +26,7 @@ class QTimer; class QLabel; -class PlayListItem; +class PlayListTrack; namespace PlayListPopup { /** @@ -40,7 +40,7 @@ public: ~PopupWidget(); - void prepare(PlayListItem *item, QPoint pos); + void prepare(PlayListTrack *item, QPoint pos); void deactivate(); const QString url() const; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index facdc240c..58a47ba9b 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,14 +1,14 @@ SUBDIRS += Input \ Output \ - General \ + #General \ Visual \ Transports \ Effect \ - PlayListFormats \ + #PlayListFormats \ FileDialogs \ Ui -unix:SUBDIRS += CommandLineOptions \ - Engines +#unix:SUBDIRS += CommandLineOptions \ +# Engines TEMPLATE = subdirs |
