From 935e31e01dcd5d680d6dda4b3fd9136649436f39 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 16 Sep 2009 12:45:41 +0000 Subject: enabled support for streams git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1226 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmp/downloader.cpp | 2 +- src/qmmp/soundcore.cpp | 19 +++++---- src/qmmp/soundcore.h | 3 -- src/qmmpui/abstractplaylistitem.cpp | 5 +++ src/qmmpui/abstractplaylistitem.h | 4 ++ src/qmmpui/detailsdialog.cpp | 29 +++++++------ src/qmmpui/detailsdialog.h | 1 + src/qmmpui/playlistmodel.cpp | 23 ---------- src/qmmpui/translations/libqmmpui_cs.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_de.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_it.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_lt.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_pl.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_pt_BR.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_ru.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_tr.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_uk_UA.ts | 67 ++++++------------------------ src/qmmpui/translations/libqmmpui_zh_CN.ts | 61 ++++----------------------- src/qmmpui/translations/libqmmpui_zh_TW.ts | 61 ++++----------------------- 19 files changed, 140 insertions(+), 623 deletions(-) diff --git a/src/qmmp/downloader.cpp b/src/qmmp/downloader.cpp index b9170972c..183a7fd8d 100644 --- a/src/qmmp/downloader.cpp +++ b/src/qmmp/downloader.cpp @@ -339,7 +339,7 @@ void Downloader::readICYMetaData() } void Downloader::parseICYMetaData(char *data) -{ +{ QString str(data); QStringList list(str.split(";", QString::SkipEmptyParts)); foreach(QString line, list) diff --git a/src/qmmp/soundcore.cpp b/src/qmmp/soundcore.cpp index aba3a4c2c..0b51adb15 100644 --- a/src/qmmp/soundcore.cpp +++ b/src/qmmp/soundcore.cpp @@ -42,8 +42,6 @@ SoundCore::SoundCore(QObject *parent) { m_instance = this; m_decoder = 0; - m_output = 0; - m_input = 0; m_paused = FALSE; m_useEQ = FALSE; m_update = FALSE; @@ -51,7 +49,6 @@ SoundCore::SoundCore(QObject *parent) m_preamp = 0; m_vis = 0; m_parentWidget = 0; - m_factory = 0; m_engine = 0; for (int i = 1; i < 10; ++i) m_bands[i] = 0; @@ -88,21 +85,24 @@ bool SoundCore::play(const QString &source, bool queue) else return decode(); - if(qobject_cast(m_inputSource->ioDevice())) - qobject_cast(m_inputSource->ioDevice())->downloadFile(); + StreamReader *reader = qobject_cast(m_inputSource->ioDevice()); + if(reader) + { + connect(reader, SIGNAL(bufferingProgress(int)), SIGNAL(bufferingProgress(int))); + reader->downloadFile(); + m_handler->dispatch(Qmmp::Buffering); + return TRUE; + } else m_inputSource->ioDevice()->open(QIODevice::ReadOnly); return decode(); - //return TRUE; } void SoundCore::stop() { - m_factory = 0; m_source.clear(); if(m_engine) m_engine->stop(); - m_input = 0; //update VolumeControl delete m_volumeControl; m_volumeControl = VolumeControl::create(this); @@ -228,6 +228,8 @@ QString SoundCore::metaData(Qmmp::MetaData key) bool SoundCore::decode() { qDebug("ready"); + if(!m_inputSource->ioDevice()->isOpen()) + m_inputSource->ioDevice()->open(QIODevice::ReadOnly); disconnect(m_inputSource->ioDevice(), SIGNAL(readyRead()), this, SLOT(decode())); if(!m_engine) @@ -250,7 +252,6 @@ bool SoundCore::decode() return FALSE; } - qDebug ("ok"); return TRUE; diff --git a/src/qmmp/soundcore.h b/src/qmmp/soundcore.h index f35d96656..aec2ad947 100644 --- a/src/qmmp/soundcore.h +++ b/src/qmmp/soundcore.h @@ -208,10 +208,7 @@ private slots: private: Decoder* m_decoder; - DecoderFactory* m_factory; QString m_source; - Output* m_output; - QIODevice* m_input; uint m_error; bool m_paused; bool m_useEQ; diff --git a/src/qmmpui/abstractplaylistitem.cpp b/src/qmmpui/abstractplaylistitem.cpp index 4c8a0f561..bbae56bd3 100644 --- a/src/qmmpui/abstractplaylistitem.cpp +++ b/src/qmmpui/abstractplaylistitem.cpp @@ -109,3 +109,8 @@ void AbstractPlaylistItem::setLength(qint64 length) { m_length = length; } + +const QMap AbstractPlaylistItem::metaData() +{ + return m_metaData; +} diff --git a/src/qmmpui/abstractplaylistitem.h b/src/qmmpui/abstractplaylistitem.h index 149291ace..ce4decd35 100644 --- a/src/qmmpui/abstractplaylistitem.h +++ b/src/qmmpui/abstractplaylistitem.h @@ -105,6 +105,10 @@ public: * Sets length in seconds. */ virtual void setLength(qint64 length); + /*! + * + */ + const QMap metaData(); private: QMap m_metaData; diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index 11d4a49a6..e8f8d8d90 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -37,24 +37,27 @@ DetailsDialog::DetailsDialog(AbstractPlaylistItem *item, QWidget *parent) setAttribute(Qt::WA_QuitOnClose, FALSE); setAttribute(Qt::WA_DeleteOnClose, FALSE); m_metaDataModel = 0; + m_item = item; ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose); m_path = item->url(); setWindowTitle (m_path.section('/',-1)); ui.pathEdit->setText(m_path); - DecoderFactory *fact = Decoder::findByPath(item->url()); - if(fact) - m_metaDataModel = fact->createMetaDataModel(item->url(), this); - else - return; - - printInfo(); - - foreach(TagModel *tagModel, m_metaDataModel->tags()) + if(QFile::exists(item->url())) { - ui.tabWidget->addTab(new TagEditor(tagModel, this), tagModel->name()); + DecoderFactory *fact = Decoder::findByPath(item->url()); + if(fact) + m_metaDataModel = fact->createMetaDataModel(item->url(), this); + else + return; + + foreach(TagModel *tagModel, m_metaDataModel->tags()) + { + ui.tabWidget->addTab(new TagEditor(tagModel, this), tagModel->name()); + } } + printInfo(); } DetailsDialog::~DetailsDialog() @@ -64,10 +67,10 @@ void DetailsDialog::printInfo() { QList flist = Decoder::createPlayList(m_path, TRUE); QMap metaData; - if(!flist.isEmpty()) + if(!flist.isEmpty() && QFile::exists(m_item->url())) metaData = flist.at(0)->metaData(); - /*else - TODO use metadata from playlist item*/ + else + metaData = m_item->metaData(); QString formattedText; formattedText.append(""); //tags diff --git a/src/qmmpui/detailsdialog.h b/src/qmmpui/detailsdialog.h index ce3dd7bff..26f70533f 100644 --- a/src/qmmpui/detailsdialog.h +++ b/src/qmmpui/detailsdialog.h @@ -52,6 +52,7 @@ private: QString m_path; QString formatRow(const QString key, const QString value); MetaDataModel *m_metaDataModel; + AbstractPlaylistItem *m_item; }; diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 893850e51..3428c0390 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -358,29 +358,6 @@ void PlayListModel::showDetails() { if (m_items.at(i)->isSelected()) { - if (!QFile::exists(m_items.at(i)->url())) - { - PlayListItem *item = m_items.at(i); - QString str; - str.append(tr("URL:") + " %1\n"); - str.append(tr("Title:") + " %2\n"); - str.append(tr("Artist:") + " %3\n"); - str.append(tr("Album:") + " %4\n"); - str.append(tr("Genre:") + " %5\n"); - str.append(tr("Comment:") + " %6\n"); - str.append(tr("Composer:") + " %7\n"); - str.append(tr("Disc number:") + " %8"); - str = str.arg(item->url()) - .arg(item->title().isEmpty() ? item->text() : item->title()) - .arg(item->artist()) - .arg(item->album()) - .arg(item->genre()) - .arg(item->comment()) - .arg(item->composer()) - .arg(item->discNumber()); - QMessageBox::information(0, m_items.at(i)->url(), str); - return; - } QDialog *d = new DetailsDialog(m_items.at(i)); //TODO set parent widget TagUpdater *updater = new TagUpdater(d, m_items.at(i)); m_editing_items.append(m_items.at(i)); diff --git a/src/qmmpui/translations/libqmmpui_cs.ts b/src/qmmpui/translations/libqmmpui_cs.ts index aa5ceb7b2..359b63e9c 100644 --- a/src/qmmpui/translations/libqmmpui_cs.ts +++ b/src/qmmpui/translations/libqmmpui_cs.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Název: - - - - Artist: - Umělec: - - - - Album: - - - - - Genre: - Žánr: - - - - Comment: - Poznámka: - - - - Composer: - Skladatel: - - - - Disc number: - Číslo disku: - - - - URL: - URL: - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_de.ts b/src/qmmpui/translations/libqmmpui_de.ts index 15a7df4e7..4cf2dd8bb 100644 --- a/src/qmmpui/translations/libqmmpui_de.ts +++ b/src/qmmpui/translations/libqmmpui_de.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Titel: - - - - Artist: - Interpret: - - - - Album: - Album: - - - - Genre: - Genre: - - - - Comment: - Kommentar: - - - - Composer: - Komponist: - - - - Disc number: - CD-Nummer: - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_it.ts b/src/qmmpui/translations/libqmmpui_it.ts index 9064555cd..a3a0c7a25 100644 --- a/src/qmmpui/translations/libqmmpui_it.ts +++ b/src/qmmpui/translations/libqmmpui_it.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Titolo: - - - - Artist: - Interprete: - - - - Album: - Album: - - - - Genre: - Genere: - - - - Comment: - Commento: - - - - Composer: - Compositore - - - - Disc number: - Disco numero: - - - - URL: - URL: - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_lt.ts b/src/qmmpui/translations/libqmmpui_lt.ts index 6ae2eadfb..756c3176d 100644 --- a/src/qmmpui/translations/libqmmpui_lt.ts +++ b/src/qmmpui/translations/libqmmpui_lt.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Pavadinimas: - - - - Artist: - Atlikėjas: - - - - Album: - Albumas: - - - - Genre: - Žanras: - - - - Comment: - Komantaras: - - - - Composer: - - - - - Disc number: - - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_pl.ts b/src/qmmpui/translations/libqmmpui_pl.ts index 8c9336d8e..dc599ebab 100644 --- a/src/qmmpui/translations/libqmmpui_pl.ts +++ b/src/qmmpui/translations/libqmmpui_pl.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Tytuł: - - - - Artist: - Artysta: - - - - Album: - Album: - - - - Genre: - Gatunek: - - - - Comment: - Komentarz: - - - - Composer: - Kompozytor: - - - - Disc number: - Numer albumu: - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_pt_BR.ts b/src/qmmpui/translations/libqmmpui_pt_BR.ts index e366d82c0..c450d8c08 100644 --- a/src/qmmpui/translations/libqmmpui_pt_BR.ts +++ b/src/qmmpui/translations/libqmmpui_pt_BR.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - - - - - Artist: - - - - - Album: - - - - - Genre: - - - - - Comment: - - - - - Composer: - - - - - Disc number: - - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_ru.ts b/src/qmmpui/translations/libqmmpui_ru.ts index c3040c409..9044feb48 100644 --- a/src/qmmpui/translations/libqmmpui_ru.ts +++ b/src/qmmpui/translations/libqmmpui_ru.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title Название - + Artist Исполнитель - + Album Альбом - + Comment Комментарий - + Genre Жанр - + Composer Композитр - + Year Год - + Track Дорожка - + Disc number Номер диска @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Название: - - - - Artist: - Исполнитель: - - - - Album: - Альбом: - - - - Genre: - Жанр: - - - - Comment: - Комментарий: - - - - Composer: - Композитор: - - - - Disc number: - Номер диска: - - - - URL: - URL: - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_tr.ts b/src/qmmpui/translations/libqmmpui_tr.ts index 0ed86a295..926df3b0e 100644 --- a/src/qmmpui/translations/libqmmpui_tr.ts +++ b/src/qmmpui/translations/libqmmpui_tr.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Başlık: - - - - Artist: - Artist: - - - - Album: - Albüm: - - - - Genre: - Tür: - - - - Comment: - Yorum: - - - - Composer: - - - - - Disc number: - - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_uk_UA.ts b/src/qmmpui/translations/libqmmpui_uk_UA.ts index 7e075b76b..37f4ea704 100644 --- a/src/qmmpui/translations/libqmmpui_uk_UA.ts +++ b/src/qmmpui/translations/libqmmpui_uk_UA.ts @@ -1,50 +1,50 @@ - - + + DetailsDialog - + Title Заголовок - + Artist Виконавець - + Album Альбом - + Comment Коментар - + Genre Жанр - + Composer Композитор - + Year Рік - + Track Доріжка - + Disc number Номер диску @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - Заголовок: - - - - Artist: - Виконавець: - - - - Album: - Альбом: - - - - Genre: - Жанр: - - - - Comment: - Коментар: - - - - Composer: - Композитор: - - - - Disc number: - Номер диску: - - - - URL: - URL: - - QtFileDialogFactory @@ -157,6 +114,8 @@ p, li { white-space: pre-wrap; } Номер диску: + + ? diff --git a/src/qmmpui/translations/libqmmpui_zh_CN.ts b/src/qmmpui/translations/libqmmpui_zh_CN.ts index c0a68feaf..513442d49 100644 --- a/src/qmmpui/translations/libqmmpui_zh_CN.ts +++ b/src/qmmpui/translations/libqmmpui_zh_CN.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - 标题: - - - - Artist: - 艺术家: - - - - Album: - 专辑: - - - - Genre: - 流派: - - - - Comment: - 备注: - - - - Composer: - - - - - Disc number: - - - - - URL: - - - QtFileDialogFactory diff --git a/src/qmmpui/translations/libqmmpui_zh_TW.ts b/src/qmmpui/translations/libqmmpui_zh_TW.ts index 5e573313f..5cee8eeec 100644 --- a/src/qmmpui/translations/libqmmpui_zh_TW.ts +++ b/src/qmmpui/translations/libqmmpui_zh_TW.ts @@ -4,47 +4,47 @@ DetailsDialog - + Title - + Artist - + Album - + Comment - + Genre - + Composer - + Year - + Track - + Disc number @@ -68,49 +68,6 @@ p, li { white-space: pre-wrap; } - - PlayListModel - - - Title: - 標題: - - - - Artist: - 藝術家: - - - - Album: - 專輯: - - - - Genre: - 流派: - - - - Comment: - 備註: - - - - Composer: - - - - - Disc number: - - - - - URL: - - - QtFileDialogFactory -- cgit v1.2.3-13-gbd6f