diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-09-26 17:10:51 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-09-26 17:10:51 +0000 |
| commit | 76095a46370939213ceffca85129baa3d9bac0d4 (patch) | |
| tree | f71b49e6f0c1cdcc2cf378610f90b439943a95ec /src/ui | |
| parent | 525d822bec49c9952388b71ffd7c293528b31c24 (diff) | |
| download | qmmp-76095a46370939213ceffca85129baa3d9bac0d4.tar.gz qmmp-76095a46370939213ceffca85129baa3d9bac0d4.tar.bz2 qmmp-76095a46370939213ceffca85129baa3d9bac0d4.zip | |
enabled in-stream metadata support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@562 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/mainwindow.cpp | 40 | ||||
| -rw-r--r-- | src/ui/mainwindow.h | 1 | ||||
| -rw-r--r-- | src/ui/playlistitem.cpp | 18 | ||||
| -rw-r--r-- | src/ui/playlistitem.h | 3 |
4 files changed, 47 insertions, 15 deletions
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index e456183ed..e2e3709ce 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -148,8 +148,7 @@ MainWindow::MainWindow(const QStringList& args, BuiltinCommandLineOption* option connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(showState(Qmmp::State))); connect(m_core, SIGNAL(elapsedChanged(qint64)),m_playlist, SLOT(setTime(qint64))); connect(m_core, SIGNAL(elapsedChanged(qint64)),m_titlebar, SLOT(setTime(qint64))); - - + connect(m_core, SIGNAL(metaDataChanged()),SLOT(showMetaData())); updateEQ(); @@ -208,7 +207,7 @@ void MainWindow::play() } else { - //find out the reason why the playback failed + //find out the reason why playback failed switch ((int) m_core->state()) { case Qmmp::FatalError: @@ -333,13 +332,13 @@ void MainWindow::showState(Qmmp::State state) case Qmmp::Playing: { m_generalHandler->setState(General::Playing); - if (m_playListModel->currentItem()) + /*if (m_playListModel->currentItem()) { SongInfo info = *m_playListModel->currentItem(); if (info.isEmpty()) info.setValue(SongInfo::TITLE, m_playlist->currentItem()->text()); m_generalHandler->setSongInfo(info); - } + }*/ if (m_playlist->listWidget()) m_playlist->listWidget()->updateList(); //removes progress message from TextScroller break; @@ -456,6 +455,37 @@ void MainWindow::showState(Qmmp::State state) } }*/ +void MainWindow::showMetaData() +{ + qDebug("===== metadata ======"); + qDebug("ARTIST = %s", qPrintable(m_core->metaData(Qmmp::TITLE))); + qDebug("TITLE = %s", qPrintable(m_core->metaData(Qmmp::ARTIST))); + qDebug("ALBUM = %s", qPrintable(m_core->metaData(Qmmp::ALBUM))); + qDebug("COMMENT = %s", qPrintable(m_core->metaData(Qmmp::COMMENT))); + qDebug("GENRE = %s", qPrintable(m_core->metaData(Qmmp::GENRE))); + qDebug("YEAR = %s", qPrintable(m_core->metaData(Qmmp::YEAR))); + qDebug("TRACK = %s", qPrintable(m_core->metaData(Qmmp::TRACK))); + qDebug("== end of metadata =="); + + if (m_playlist->currentItem()) + { + SongInfo info; + info.setValue(SongInfo::TITLE, m_core->metaData(Qmmp::TITLE)); + info.setValue(SongInfo::ARTIST, m_core->metaData(Qmmp::ARTIST)); + info.setValue(SongInfo::ALBUM, m_core->metaData(Qmmp::ALBUM)); + info.setValue(SongInfo::COMMENT, m_core->metaData(Qmmp::COMMENT)); + info.setValue(SongInfo::GENRE, m_core->metaData(Qmmp::GENRE)); + info.setValue(SongInfo::YEAR, m_core->metaData(Qmmp::YEAR).toUInt()); + info.setValue(SongInfo::TRACK, m_core->metaData(Qmmp::TRACK).toUInt()); + //info.setValue(SongInfo::LENGTH, st.tag()->length()); + info.setValue(SongInfo::STREAM, !QFile::exists(m_playlist->currentItem()->path())); + info.setValue(SongInfo::PATH, m_playlist->currentItem()->path()); + m_generalHandler->setSongInfo(info); + m_playlist->currentItem()->updateMetaData(m_core->metaData()); + m_playlist->listWidget()->updateList(); + } +} + void MainWindow::changeTitle(const QString &title) { if (m_playlist->currentItem()) diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index 3a2a7a52f..515ab685c 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -96,6 +96,7 @@ private slots: //void showOutputState(const OutputState&); //void showDecoderState(const DecoderState&); void showState(Qmmp::State state); + void showMetaData(); void changeTitle(const QString&); void clear(); void startSeek(); diff --git a/src/ui/playlistitem.cpp b/src/ui/playlistitem.cpp index 6d30d4180..0759e3354 100644 --- a/src/ui/playlistitem.cpp +++ b/src/ui/playlistitem.cpp @@ -58,6 +58,8 @@ PlayListItem::PlayListItem(const QString& path) : SongInfo(), m_flag(FREE) PlayListItem::~PlayListItem() { + if (m_info) + delete m_info; } void PlayListItem::setSelected(bool yes) @@ -90,17 +92,15 @@ PlayListItem::FLAGS PlayListItem::flag() const return m_flag; } -/*void PlayListItem::updateTags(const FileTag *tag) +void PlayListItem::updateMetaData(const QMap <Qmmp::MetaData, QString> &metaData) { - if (m_info) - { - delete m_info; - m_info = 0; - } - if (!tag->isEmpty()) - m_info = new FileTag(*tag); + if (!m_info) + m_info = new FileInfo(); + + m_info->setMetaData(metaData); + m_use_meta = TRUE; readMetadata(); -}*/ +} void PlayListItem::updateTags() { diff --git a/src/ui/playlistitem.h b/src/ui/playlistitem.h index 6e028b202..818bc7eeb 100644 --- a/src/ui/playlistitem.h +++ b/src/ui/playlistitem.h @@ -21,6 +21,7 @@ #define PLAYLISTITEM_H #include <qmmpui/songinfo.h> +#include <qmmp/qmmp.h> class FileInfo; /** @@ -52,7 +53,7 @@ public: const QString text() const; void setText(const QString &title); //modify functions - //void updateTags(const FileTag *tag); + void updateMetaData(const QMap <Qmmp::MetaData, QString> &metaData); void updateTags(); private: |
