aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-04-04 19:46:17 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-04-04 19:46:17 +0000
commitb02f09d54e9e492090cce54c9ce908b0c4a00145 (patch)
tree4c628a0b02764ca49d47e02f56dd202e789f9db8 /src
parent95d26324afe30cab21c2e79e8618e538ab9c6dde (diff)
downloadqmmp-b02f09d54e9e492090cce54c9ce908b0c4a00145.tar.gz
qmmp-b02f09d54e9e492090cce54c9ce908b0c4a00145.tar.bz2
qmmp-b02f09d54e9e492090cce54c9ce908b0c4a00145.zip
make file path accessible by general plugins
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@330 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/qmmpui/songinfo.cpp26
-rw-r--r--src/qmmpui/songinfo.h11
-rw-r--r--src/ui/mainwindow.cpp2
3 files changed, 28 insertions, 11 deletions
diff --git a/src/qmmpui/songinfo.cpp b/src/qmmpui/songinfo.cpp
index 6fa1e831e..178f6eee6 100644
--- a/src/qmmpui/songinfo.cpp
+++ b/src/qmmpui/songinfo.cpp
@@ -41,6 +41,7 @@ void SongInfo::operator=(const SongInfo &info)
setValue(TRACK,info.track ());
setValue(LENGTH,info.length ());
setValue(STREAM,info.isStream());
+ setValue(PATH,info.path());
}
bool SongInfo::operator==(const SongInfo &info)
@@ -52,7 +53,8 @@ bool SongInfo::operator==(const SongInfo &info)
genre() == info.genre() &&
track() == info.track() &&
year() == info.year() &&
- isStream() == info.isStream();
+ isStream() == info.isStream() &&
+ path() == info.path();
}
bool SongInfo::operator!=(const SongInfo &info)
@@ -60,21 +62,26 @@ bool SongInfo::operator!=(const SongInfo &info)
return !operator==(info);
}
-void SongInfo::setValue(uint name, const QString &value)
+void SongInfo::setValue(uint key, const QString &value)
{
if (!value.isEmpty())
- m_strValues.insert (name, value);
+ {
+ if (key == PATH)
+ m_path = value;
+ else
+ m_strValues.insert (key, value);
+ }
}
-void SongInfo::setValue(uint name, const uint &value)
+void SongInfo::setValue(uint key, const uint &value)
{
if (value > 0)
- m_numValues.insert (name, value);
+ m_numValues.insert (key, value);
}
-void SongInfo::setValue(uint name, const bool &value)
+void SongInfo::setValue(uint key, const bool &value)
{
- if(name == STREAM)
+ if(key == STREAM)
m_stream = value;
}
@@ -103,6 +110,11 @@ const QString SongInfo::genre () const
return m_strValues[GENRE];
}
+const QString SongInfo::path () const
+{
+ return m_path;
+}
+
const uint SongInfo::year () const
{
return m_numValues[YEAR];
diff --git a/src/qmmpui/songinfo.h b/src/qmmpui/songinfo.h
index 7bc43381d..0180f35a5 100644
--- a/src/qmmpui/songinfo.h
+++ b/src/qmmpui/songinfo.h
@@ -45,20 +45,22 @@ public:
YEAR,
TRACK,
LENGTH,
- STREAM
+ STREAM,
+ PATH
};
void operator=(const SongInfo &info);
bool operator==(const SongInfo &info);
bool operator!=(const SongInfo &info);
- void setValue(uint name, const QString &value);
- void setValue(uint name, const uint &value);
- void setValue(uint name, const bool &value);
+ void setValue(uint key, const QString &value);
+ void setValue(uint key, const uint &value);
+ void setValue(uint key, const bool &value);
const QString title () const;
const QString artist () const;
const QString album () const;
const QString comment () const;
const QString genre () const;
+ const QString path () const;
const uint year () const;
const uint track () const;
const uint length () const;
@@ -70,6 +72,7 @@ private:
QMap <uint, QString> m_strValues;
QMap <uint, uint> m_numValues;
bool m_stream;
+ QString m_path;
};
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp
index 083a468c2..d35499282 100644
--- a/src/ui/mainwindow.cpp
+++ b/src/ui/mainwindow.cpp
@@ -345,6 +345,7 @@ void MainWindow::showOutputState(const OutputState &st)
info.setValue(SongInfo::LENGTH, (uint) m_playlist->currentItem()->length());
info.setValue(SongInfo::STREAM,
m_playlist->currentItem()->path().startsWith("http://"));
+ info.setValue(SongInfo::PATH, m_playlist->currentItem()->path());
m_generalHandler->setSongInfo(info);
}
break;
@@ -407,6 +408,7 @@ void MainWindow::showDecoderState(const DecoderState &st)
info.setValue(SongInfo::LENGTH, st.tag()->length());
info.setValue(SongInfo::STREAM,
m_playlist->currentItem()->path().startsWith("http://"));
+ info.setValue(SongInfo::PATH, m_playlist->currentItem()->path());
m_generalHandler->setSongInfo(info);
}
m_playlist->currentItem()->updateTags(st.tag());