From 90d3aeb642ba4d6445932343010294a39b33efe2 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 12 Nov 2009 22:00:02 +0000 Subject: added multiple playlists support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1363 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/covermanager/covermanager.cpp | 2 +- src/plugins/General/fileops/fileops.cpp | 3 ++- .../General/fileops/translations/fileops_plugin_cs.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_de.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_it.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_lt.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_pl.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_ru.ts | 14 +++++++------- .../General/fileops/translations/fileops_plugin_tr.ts | 14 +++++++------- .../fileops/translations/fileops_plugin_uk_UA.ts | 14 +++++++------- .../fileops/translations/fileops_plugin_zh_CN.ts | 14 +++++++------- .../fileops/translations/fileops_plugin_zh_TW.ts | 14 +++++++------- src/plugins/General/hal/halplugin.cpp | 14 +++++++------- src/plugins/General/lyrics/lyrics.cpp | 5 +++-- src/plugins/General/mpris/playerobject.cpp | 17 ++++++++--------- src/plugins/General/mpris/playerobject.h | 6 +++--- src/plugins/General/mpris/tracklistobject.cpp | 19 +++++++++++++++---- src/plugins/General/mpris/tracklistobject.h | 5 ++++- 18 files changed, 113 insertions(+), 98 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/General/covermanager/covermanager.cpp b/src/plugins/General/covermanager/covermanager.cpp index 5cb285f25..ab4303c8e 100644 --- a/src/plugins/General/covermanager/covermanager.cpp +++ b/src/plugins/General/covermanager/covermanager.cpp @@ -37,7 +37,7 @@ CoverManager::CoverManager(QObject *parent) : General(parent) void CoverManager::showWindow() { - QList items = MediaPlayer::instance()->playListModel()->getSelectedItems(); + QList items = MediaPlayer::instance()->playListManager()->selectedPlayList()->getSelectedItems(); if (!items.isEmpty()) { if (items.at(0)->url().contains("://")) diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp index 62e723a89..a2cf0ee5d 100644 --- a/src/plugins/General/fileops/fileops.cpp +++ b/src/plugins/General/fileops/fileops.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "fileops.h" @@ -84,7 +85,7 @@ void FileOps::execAction(int n) QString pattern = m_patterns.at(n); QString destination = m_destinations.at(n); - PlayListModel *model = MediaPlayer::instance()->playListModel(); + PlayListModel *model = MediaPlayer::instance()->playListManager()->selectedPlayList(); QList items = model->getSelectedItems(); switch (type) diff --git a/src/plugins/General/fileops/translations/fileops_plugin_cs.ts b/src/plugins/General/fileops/translations/fileops_plugin_cs.ts index 80cd25897..6a8220b8e 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_cs.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_cs.ts @@ -4,37 +4,37 @@ FileOps - + Error Chyba - + Destination directory doesn't exist Cílový adresář neexistuje - + Copying Kopíruje se - + Stop Přerušit - + Copying file %1/%2 Kopíruje se soubor %1/%2 - + Remove files Odstranit soubory - + Are you sure you want to remove %n file(s) from disk? Jste si jisti, že chcete z disku odstranit %n soubor? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_de.ts b/src/plugins/General/fileops/translations/fileops_plugin_de.ts index 4cd826e89..341477a22 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_de.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_de.ts @@ -4,37 +4,37 @@ FileOps - + Error Fehler - + Destination directory doesn't exist Das Zielverzeichnis existiert nicht - + Copying Kopiere - + Stop Stopp - + Copying file %1/%2 Kopiere Datei %1/%2 - + Remove files Dateien entfernen - + Are you sure you want to remove %n file(s) from disk? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_it.ts b/src/plugins/General/fileops/translations/fileops_plugin_it.ts index 000c64c7e..96b5634bf 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_it.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_it.ts @@ -4,37 +4,37 @@ FileOps - + Error Errore - + Destination directory doesn't exist Cartella di destinazione - + Copying Copia - + Stop Ferma - + Copying file %1/%2 Copia del file - + Remove files Rimuovi file - + Are you sure you want to remove %n file(s) from disk? Vuoi davvero rimuovere %n file(s) dal disco? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_lt.ts b/src/plugins/General/fileops/translations/fileops_plugin_lt.ts index 69ac4bc3d..fb6e6bf79 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_lt.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_lt.ts @@ -4,37 +4,37 @@ FileOps - + Error Klaida - + Destination directory doesn't exist Aplankas neegzistuoja - + Copying Kopijuoju - + Stop Stop - + Copying file %1/%2 Kopijuoju bylą %1/%2 - + Remove files Ištrinti bylas - + Are you sure you want to remove %n file(s) from disk? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_pl.ts b/src/plugins/General/fileops/translations/fileops_plugin_pl.ts index 2d67a70ec..db73e9c36 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_pl.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_pl.ts @@ -4,37 +4,37 @@ FileOps - + Error Błąd - + Destination directory doesn't exist Katalog docelowy nie istnieje - + Copying Kopiowanie - + Stop - + Copying file %1/%2 Kopiowanie pliku %1/%2 - + Remove files Usuń pliki - + Are you sure you want to remove %n file(s) from disk? Czy napewno chcesz usunąć %n plik(ów) z dysku? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_ru.ts b/src/plugins/General/fileops/translations/fileops_plugin_ru.ts index 8da9527f4..54353ecc7 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_ru.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_ru.ts @@ -4,37 +4,37 @@ FileOps - + Error Ошибка - + Destination directory doesn't exist Директория назначения не существует - + Copying Копирование - + Stop Остановить - + Copying file %1/%2 Копирование файла %1/%2 - + Remove files Удалить файлы - + Are you sure you want to remove %n file(s) from disk? Вы уверены, что хотите удалить %n файл с диска? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_tr.ts b/src/plugins/General/fileops/translations/fileops_plugin_tr.ts index 96df85603..88ef5d138 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_tr.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_tr.ts @@ -4,37 +4,37 @@ FileOps - + Error Hata - + Destination directory doesn't exist Hedef dizin mevcut değil - + Copying Kopyalıyor - + Stop Dur - + Copying file %1/%2 %1/%2 dosyası kopyalanıyor - + Remove files Dosyaları kaldır - + Are you sure you want to remove %n file(s) from disk? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts b/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts index 330683148..6f846f613 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_uk_UA.ts @@ -4,37 +4,37 @@ FileOps - + Error Помилка - + Destination directory doesn't exist Тека призначення не існує - + Copying Копіювання - + Stop Зупинити - + Copying file %1/%2 Копіювання файла %1/%2 - + Remove files Видалити файли - + Are you sure you want to remove %n file(s) from disk? Ви дійсно бажаєте видалити %n файл(ів) з диску? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts b/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts index 6bbd98d7d..5223deb6d 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_zh_CN.ts @@ -4,37 +4,37 @@ FileOps - + Error 错误 - + Destination directory doesn't exist 目标目录不存在 - + Copying 正在复制 - + Stop 停止 - + Copying file %1/%2 正在复制文件 %1/%2 - + Remove files 删除文件 - + Are you sure you want to remove %n file(s) from disk? diff --git a/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts b/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts index 013bf5e7a..2238a5356 100644 --- a/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts +++ b/src/plugins/General/fileops/translations/fileops_plugin_zh_TW.ts @@ -4,37 +4,37 @@ FileOps - + Error 錯誤 - + Destination directory doesn't exist 目標目錄早已存在 - + Copying 正在復制 - + Stop 停止 - + Copying file %1/%2 復制檔案 %1/%2 - + Remove files 刪除檔案 - + Are you sure you want to remove %n file(s) from disk? diff --git a/src/plugins/General/hal/halplugin.cpp b/src/plugins/General/hal/halplugin.cpp index 002ebc0e3..1d40e0c8b 100644 --- a/src/plugins/General/hal/halplugin.cpp +++ b/src/plugins/General/hal/halplugin.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include "haldevice.h" @@ -190,9 +190,9 @@ void HalPlugin::processAction(QAction *action) qDebug("HalPlugin: action triggered: %s", qPrintable(action->data().toString())); QString path = action->data().toString(); if (path.startsWith("cdda://")) - MediaPlayer::instance()->playListModel()->addFile(path); + MediaPlayer::instance()->playListManager()->selectedPlayList()->addFile(path); else - MediaPlayer::instance()->playListModel()->addDirectory(path); + MediaPlayer::instance()->playListManager()->selectedPlayList()->addDirectory(path); } QAction *HalPlugin::findAction(const QString &dev_path) @@ -229,7 +229,7 @@ HalDevice *HalPlugin::findDevice(QAction *action) void HalPlugin::addPath(const QString &path) { - foreach(PlayListItem *item, MediaPlayer::instance()->playListModel()->items()) // Is it already exist? + foreach(PlayListItem *item, MediaPlayer::instance()->playListManager()->selectedPlayList()->items()) // Is it already exist? { if (item->url().startsWith(path)) return; @@ -237,11 +237,11 @@ void HalPlugin::addPath(const QString &path) if (path.startsWith("cdda://") && m_addTracks) { - MediaPlayer::instance()->playListModel()->addFile(path); + MediaPlayer::instance()->playListManager()->selectedPlayList()->addFile(path); return; } else if (!path.startsWith("cdda://") && m_addFiles) - MediaPlayer::instance()->playListModel()->addDirectory(path); + MediaPlayer::instance()->playListManager()->selectedPlayList()->addDirectory(path); } void HalPlugin::removePath(const QString &path) @@ -250,7 +250,7 @@ void HalPlugin::removePath(const QString &path) (!path.startsWith("cdda://") && !m_removeFiles)) //process settings return; - PlayListModel *model = MediaPlayer::instance()->playListModel(); + PlayListModel *model = MediaPlayer::instance()->playListManager()->selectedPlayList(); int i = 0; while (model->count() > 0 && i < model->count()) diff --git a/src/plugins/General/lyrics/lyrics.cpp b/src/plugins/General/lyrics/lyrics.cpp index e0492cbf5..65ab6182a 100644 --- a/src/plugins/General/lyrics/lyrics.cpp +++ b/src/plugins/General/lyrics/lyrics.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include "lyricswindow.h" @@ -43,7 +43,8 @@ Lyrics::~Lyrics() void Lyrics::showLyrics() { - QList items = MediaPlayer::instance()->playListModel()->getSelectedItems(); + PlayListManager *pl_manager = MediaPlayer::instance()->playListManager(); + QList items = pl_manager->selectedPlayList()->getSelectedItems(); if (!items.isEmpty()) { if (items.at(0)->artist().isEmpty() || items.at(0)->title().isEmpty()) diff --git a/src/plugins/General/mpris/playerobject.cpp b/src/plugins/General/mpris/playerobject.cpp index 894b68617..d7166e964 100644 --- a/src/plugins/General/mpris/playerobject.cpp +++ b/src/plugins/General/mpris/playerobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "playerobject.h" @@ -53,18 +53,17 @@ const QDBusArgument &operator >> (const QDBusArgument &arg, PlayerStatus &status return arg; } -PlayerObject::PlayerObject(QObject *parent) - : QObject(parent) +PlayerObject::PlayerObject(QObject *parent) : QObject(parent) { qDBusRegisterMetaType(); m_core = SoundCore::instance(); m_player = MediaPlayer::instance(); - m_model = m_player->playListModel(); + m_pl_manager = m_player->playListManager(); connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateCaps())); connect(m_core, SIGNAL(metaDataChanged ()), SLOT(updateTrack())); connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateStatus())); - connect(m_model, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus())); - connect(m_model, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus())); + connect(m_pl_manager, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus())); + connect(m_pl_manager, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus())); connect(m_player, SIGNAL(repeatableChanged(bool)), SLOT(updateStatus())); } @@ -118,9 +117,9 @@ PlayerStatus PlayerObject::GetStatus() case Qmmp::Paused: st.state = 1; }; - st.random = int(m_model->isShuffle()); + st.random = int(m_pl_manager->isShuffle()); st.repeat = int(m_player->isRepeatable()); - st.repeatPlayList = int(m_model->isRepeatableList()); + st.repeatPlayList = int(m_pl_manager->isRepeatableList()); return st; } diff --git a/src/plugins/General/mpris/playerobject.h b/src/plugins/General/mpris/playerobject.h index dbd7e771c..709357387 100644 --- a/src/plugins/General/mpris/playerobject.h +++ b/src/plugins/General/mpris/playerobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -25,7 +25,7 @@ class SoundCore; class MediaPlayer; -class PlayListModel; +class PlayListManager; /** @author Ilya Kotov @@ -94,7 +94,7 @@ private slots: private: SoundCore *m_core; MediaPlayer *m_player; - PlayListModel *m_model; + PlayListManager *m_pl_manager; }; diff --git a/src/plugins/General/mpris/tracklistobject.cpp b/src/plugins/General/mpris/tracklistobject.cpp index 6b3699a0c..3ca1830ba 100644 --- a/src/plugins/General/mpris/tracklistobject.cpp +++ b/src/plugins/General/mpris/tracklistobject.cpp @@ -21,18 +21,20 @@ #include #include -#include +#include #include #include #include "tracklistobject.h" -TrackListObject::TrackListObject(QObject *parent) - : QObject(parent) +TrackListObject::TrackListObject(QObject *parent) : QObject(parent) { m_player = MediaPlayer::instance(); - m_model = m_player->playListModel(); + m_pl_manager = m_player->playListManager(); + m_model = m_pl_manager->currentPlayList(); connect (m_model, SIGNAL(listChanged()), SLOT(updateTrackList())); + connect (m_pl_manager, SIGNAL(currentPlayListChanged(PlayListModel*,PlayListModel*)), + SLOT(switchPlayList(PlayListModel*,PlayListModel*))); } @@ -111,3 +113,12 @@ void TrackListObject::updateTrackList() { emit TrackListChange(m_model->count()); } + +void TrackListObject::switchPlayList(PlayListModel *cur, PlayListModel *prev) +{ + m_model = cur; + connect (m_model, SIGNAL(listChanged()), SLOT(updateTrackList())); + if(prev) + disconnect(prev,0,this,0); + updateTrackList(); +} diff --git a/src/plugins/General/mpris/tracklistobject.h b/src/plugins/General/mpris/tracklistobject.h index 856ebd5df..0004f25b9 100644 --- a/src/plugins/General/mpris/tracklistobject.h +++ b/src/plugins/General/mpris/tracklistobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -25,6 +25,7 @@ #include class PlayListModel; +class PlayListManager; class MediaPlayer; /** @@ -54,9 +55,11 @@ signals: private slots: void updateTrackList(); + void switchPlayList(PlayListModel *cur, PlayListModel *prev); private: PlayListModel *m_model; + PlayListManager *m_pl_manager; MediaPlayer *m_player; }; -- cgit v1.2.3-13-gbd6f