diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-28 21:19:59 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-28 21:19:59 +0000 |
| commit | 910c5067e8d7ae22b3fde6bd483391314de1ba16 (patch) | |
| tree | af57d00445efa54a4992ad1609cf71f59cdf9494 /src/qmmpui | |
| parent | 26724c66d4764a77ca653ce6c0a1573e9e97e97c (diff) | |
| download | qmmp-910c5067e8d7ae22b3fde6bd483391314de1ba16.tar.gz qmmp-910c5067e8d7ae22b3fde6bd483391314de1ba16.tar.bz2 qmmp-910c5067e8d7ae22b3fde6bd483391314de1ba16.zip | |
general api changes, removed unused code
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@647 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
| -rw-r--r-- | src/qmmpui/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | src/qmmpui/abstractplaylist.cpp | 32 | ||||
| -rw-r--r-- | src/qmmpui/abstractplaylist.h | 38 | ||||
| -rw-r--r-- | src/qmmpui/abstractplaylistitem.cpp | 101 | ||||
| -rw-r--r-- | src/qmmpui/abstractplaylistitem.h (renamed from src/qmmpui/songinfo.h) | 63 | ||||
| -rw-r--r-- | src/qmmpui/general.cpp | 15 | ||||
| -rw-r--r-- | src/qmmpui/general.h | 12 | ||||
| -rw-r--r-- | src/qmmpui/generalhandler.h | 22 | ||||
| -rw-r--r-- | src/qmmpui/playlistformat.h | 6 | ||||
| -rw-r--r-- | src/qmmpui/playlistparser.h | 1 | ||||
| -rw-r--r-- | src/qmmpui/qmmpui.pro | 6 | ||||
| -rw-r--r-- | src/qmmpui/songinfo.cpp | 155 |
12 files changed, 212 insertions, 255 deletions
diff --git a/src/qmmpui/CMakeLists.txt b/src/qmmpui/CMakeLists.txt index c98b4ee8d..96517cf0f 100644 --- a/src/qmmpui/CMakeLists.txt +++ b/src/qmmpui/CMakeLists.txt @@ -20,7 +20,13 @@ ELSE(SVN_VERSION) ADD_DEFINITIONS(-DQMMP_STR_VERSION=\\\"${QMMP_VERSION}\\\") ENDIF(SVN_VERSION) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +# libqmmp +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) + +link_directories(${CMAKE_INSTALL_PREFIX}/${LIB_DIR}) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../qmmp) SET(libqmmpui_SRCS general.cpp @@ -29,7 +35,8 @@ SET(libqmmpui_SRCS commandlinemanager.cpp filedialog.cpp qtfiledialog.cpp - songinfo.cpp + abstractplaylist.cpp + abstractplaylistitem.cpp ) SET(libqmmpui_MOC_HDRS @@ -43,7 +50,8 @@ SET(libqmmpui_MOC_HDRS filedialog.h filedialogfactory.h qtfiledialog.h - songinfo.h + abstractplaylist.h + abstractplaylistitem.h ) SET(libqmmpui_DEVEL_HDRS @@ -56,6 +64,8 @@ SET(libqmmpui_DEVEL_HDRS commandlineoption.h filedialog.h filedialogfactory.h + abstractplaylist.h + abstractplaylistitem.h ) diff --git a/src/qmmpui/abstractplaylist.cpp b/src/qmmpui/abstractplaylist.cpp new file mode 100644 index 000000000..607165426 --- /dev/null +++ b/src/qmmpui/abstractplaylist.cpp @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2008 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "abstractplaylist.h" + +AbstractPlaylist::AbstractPlaylist(QObject *parent) + : QObject(parent) +{ +} + + +AbstractPlaylist::~AbstractPlaylist() +{ +} + + diff --git a/src/qmmpui/abstractplaylist.h b/src/qmmpui/abstractplaylist.h new file mode 100644 index 000000000..6190cd8b4 --- /dev/null +++ b/src/qmmpui/abstractplaylist.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2008 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef ABSTRACTPLAYLIST_H +#define ABSTRACTPLAYLIST_H + +#include <QObject> + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class AbstractPlaylist : public QObject +{ +Q_OBJECT +public: + AbstractPlaylist(QObject *parent = 0); + + ~AbstractPlaylist(); + +}; + +#endif diff --git a/src/qmmpui/abstractplaylistitem.cpp b/src/qmmpui/abstractplaylistitem.cpp new file mode 100644 index 000000000..164d7c500 --- /dev/null +++ b/src/qmmpui/abstractplaylistitem.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright (C) 2008 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "abstractplaylistitem.h" + +AbstractPlaylistItem::AbstractPlaylistItem() +{ + m_length = 0; +} + + +AbstractPlaylistItem::~AbstractPlaylistItem() +{ +} + +const QString AbstractPlaylistItem::title () const +{ + return m_metaData.value(Qmmp::TITLE); +} + +const QString AbstractPlaylistItem::artist () const +{ + return m_metaData.value(Qmmp::ARTIST); +} + +const QString AbstractPlaylistItem::album () const +{ + return m_metaData.value(Qmmp::ALBUM); +} + +const QString AbstractPlaylistItem::comment () const +{ + return m_metaData.value(Qmmp::COMMENT); +} + +const QString AbstractPlaylistItem::genre () const +{ + return m_metaData.value(Qmmp::GENRE); +} + +const QString AbstractPlaylistItem::track () const +{ + return m_metaData.value(Qmmp::TRACK); +} + +const QString AbstractPlaylistItem::year () const +{ + return m_metaData.value(Qmmp::YEAR); +} + +const QString AbstractPlaylistItem::url () const +{ + return m_metaData.value(Qmmp::URL); +} + +qint64 AbstractPlaylistItem::length () +{ + return m_length; +} + +bool AbstractPlaylistItem::isEmpty() +{ + return m_metaData.isEmpty(); +} + +void AbstractPlaylistItem::clear() +{ + m_metaData.clear(); + m_length = 0; +} + +void AbstractPlaylistItem::setMetaData(const QMap <Qmmp::MetaData, QString> &metaData) +{ + m_metaData = metaData; +} + +void AbstractPlaylistItem::setMetaData(Qmmp::MetaData key, const QString &value) +{ + m_metaData.insert(key, value); +} + +void AbstractPlaylistItem::setLength(qint64 length) +{ + m_length = length; +} diff --git a/src/qmmpui/songinfo.h b/src/qmmpui/abstractplaylistitem.h index 98600f7d3..cea50739c 100644 --- a/src/qmmpui/songinfo.h +++ b/src/qmmpui/abstractplaylistitem.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007 by Ilya Kotov * + * Copyright (C) 2008 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -17,64 +17,43 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef SONGINFO_H -#define SONGINFO_H +#ifndef ABSTRACTPLAYLISTITEM_H +#define ABSTRACTPLAYLISTITEM_H #include <QMap> #include <QString> +#include <qmmp/qmmp.h> /** - @author Ilya Kotov <forkotov02@hotmail.ru> + @author Ilya Kotov <forkotov02@hotmail.ru> */ - -class SongInfo{ +class AbstractPlaylistItem +{ public: - public: - SongInfo(); - SongInfo(const SongInfo &other); - - ~SongInfo(); + AbstractPlaylistItem(); - enum Type - { - TITLE = 0, - ARTIST, - ALBUM, - COMMENT, - GENRE, - YEAR, - TRACK, - LENGTH, - STREAM, - PATH - }; + ~AbstractPlaylistItem(); - void operator=(const SongInfo &info); - bool operator==(const SongInfo &info); - bool operator!=(const SongInfo &info); - 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 QString fileName () const; - uint year () const; - uint track () const; - uint length () const; - bool isEmpty () const; - bool isStream () const; + const QString track () const; + const QString year () const; + const QString url () const; + + qint64 length (); + bool isEmpty(); void clear(); -private: - QMap <uint, QString> m_strValues; - QMap <uint, uint> m_numValues; - bool m_stream; - QString m_path; + virtual void setMetaData(const QMap <Qmmp::MetaData, QString> &metaData); + virtual void setMetaData(Qmmp::MetaData key, const QString &value); + virtual void setLength(qint64 length); +private: + QMap <Qmmp::MetaData, QString> m_metaData; + qint64 m_length; }; #endif diff --git a/src/qmmpui/general.cpp b/src/qmmpui/general.cpp index d0ebe2632..a4580941e 100644 --- a/src/qmmpui/general.cpp +++ b/src/qmmpui/general.cpp @@ -72,15 +72,6 @@ General::General(QObject *parent) General::~General() {} -/*void General::setState(const uint&) -{} - -void General::setSongInfo(const SongInfo &song) -{} - -void General::setTime(int) -{}*/ - void General::play() { //TODO use AbstractPlayList and SoundCore @@ -103,12 +94,6 @@ QList<GeneralFactory*> *General::generalFactories() return factories; } -/*void General::setVolume(int left, int right) -{ - Q_UNUSED(left); - Q_UNUSED(right); -}*/ - QStringList General::generalFiles() { checkFactories(); diff --git a/src/qmmpui/general.h b/src/qmmpui/general.h index 981d32585..edcb884b6 100644 --- a/src/qmmpui/general.h +++ b/src/qmmpui/general.h @@ -39,18 +39,6 @@ public: ~General(); - /*enum State - { - Playing = 0, - Paused, - Stopped - }; - - virtual void setState(const uint &state); - virtual void setSongInfo(const SongInfo &song); - virtual void setVolume(int left, int right); - virtual void setTime(int time);*/ - //static methods static QList<GeneralFactory*> *generalFactories(); static QStringList generalFiles(); diff --git a/src/qmmpui/generalhandler.h b/src/qmmpui/generalhandler.h index 710e817a1..7a1eb3502 100644 --- a/src/qmmpui/generalhandler.h +++ b/src/qmmpui/generalhandler.h @@ -39,10 +39,6 @@ public: ~GeneralHandler(); - /*void setSongInfo(const SongInfo &info); - void setVolume(int left, int right); - void setTime(int time);*/ - void setEnabled(GeneralFactory* factory, bool enable); void showSettings(GeneralFactory* factory, QWidget* parentWidget); bool visibilityControl(); @@ -51,29 +47,11 @@ public: signals: void playCalled(); - /*void pauseCalled(); - void stopCalled(); - void nextCalled(); - void previousCalled(); - void seekCalled(int);*/ void exitCalled(); void toggleVisibilityCalled(); - //void volumeChanged(int left, int right); - -/*public slots: - void setState(uint state);*/ - -/*private slots: - void processCommand(uint command);*/ private: - void connectSignals(General*); QMap <GeneralFactory*, General*> m_generals; - //SongInfo m_songInfo; - //Control* m_control; - //int m_time; - //uint m_state; - //int m_left, m_right; CommandLineManager *m_commandLineManager; static GeneralHandler* m_instance; }; diff --git a/src/qmmpui/playlistformat.h b/src/qmmpui/playlistformat.h index 0a5bfdbcc..c5135486c 100644 --- a/src/qmmpui/playlistformat.h +++ b/src/qmmpui/playlistformat.h @@ -23,7 +23,7 @@ #include <QStringList> -class SongInfo; +class AbstractPlaylistItem; /*! * Abstract interface for playlist formats. * @@ -43,10 +43,10 @@ public: virtual QStringList decode(const QString& contents) = 0; /*! - * Takes the list of SongInfo objects, should return string of + * Takes the list of AbstractPlaylistItem objects, should return string of * encoded playlist file */ - virtual QString encode(const QList<SongInfo*>& contents) = 0; + virtual QString encode(const QList<AbstractPlaylistItem*>& contents) = 0; /*! * Returns list of file extensions that current format supports diff --git a/src/qmmpui/playlistparser.h b/src/qmmpui/playlistparser.h index b2c5585ee..a3ff358e3 100644 --- a/src/qmmpui/playlistparser.h +++ b/src/qmmpui/playlistparser.h @@ -23,7 +23,6 @@ #include <QObject> -class SongInfo; class PlaylistFormat; /** diff --git a/src/qmmpui/qmmpui.pro b/src/qmmpui/qmmpui.pro index 0f0f40f28..3d60de0c8 100644 --- a/src/qmmpui/qmmpui.pro +++ b/src/qmmpui/qmmpui.pro @@ -40,14 +40,16 @@ HEADERS += general.h \ filedialog.h \ filedialogfactory.h \ qtfiledialog.h \ - songinfo.h + abstractplaylist.h \ + abstractplaylistitem.h SOURCES += general.cpp \ generalhandler.cpp \ playlistparser.cpp \ commandlinemanager.cpp \ filedialog.cpp \ qtfiledialog.cpp \ - songinfo.cpp + abstractplaylist.cpp \ + abstractplaylistitem.cpp DESTDIR = . diff --git a/src/qmmpui/songinfo.cpp b/src/qmmpui/songinfo.cpp deleted file mode 100644 index 417db8a67..000000000 --- a/src/qmmpui/songinfo.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Ilya Kotov * - * forkotov02@hotmail.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "songinfo.h" - -SongInfo::SongInfo() -{} - -SongInfo::SongInfo(const SongInfo &other) -{ - *this = other; -} - -SongInfo::~SongInfo() -{} - -void SongInfo::operator=(const SongInfo &info) -{ - setValue(TITLE,info.title ()); - setValue(ARTIST,info.artist ()); - setValue(ALBUM,info.album ()); - setValue(COMMENT,info.comment ()); - setValue(GENRE,info.genre ()); - setValue(YEAR,info.year ()); - setValue(TRACK,info.track ()); - setValue(LENGTH,info.length ()); - setValue(STREAM,info.isStream()); - setValue(PATH,info.path()); -} - -bool SongInfo::operator==(const SongInfo &info) -{ - return title() == info.title() && - artist() == info.artist() && - album() == info.album() && - comment() == info.comment() && - genre() == info.genre() && - track() == info.track() && - year() == info.year() && - isStream() == info.isStream() && - path() == info.path(); -} - -bool SongInfo::operator!=(const SongInfo &info) -{ - return !operator==(info); -} - -void SongInfo::setValue(uint key, const QString &value) -{ - if (!value.isEmpty()) - { - if (key == PATH) - m_path = value; - else - m_strValues.insert (key, value); - } -} - -void SongInfo::setValue(uint key, const uint &value) -{ - if (value > 0) - m_numValues.insert (key, value); -} - -void SongInfo::setValue(uint key, const bool &value) -{ - if(key == STREAM) - m_stream = value; -} - -const QString SongInfo::title () const -{ - return m_strValues[TITLE]; -} - -const QString SongInfo::artist () const -{ - return m_strValues[ARTIST]; -} - -const QString SongInfo::album () const -{ - return m_strValues[ALBUM]; -} - -const QString SongInfo::comment () const -{ - return m_strValues[COMMENT]; -} - -const QString SongInfo::genre () const -{ - return m_strValues[GENRE]; -} - -const QString SongInfo::path () const -{ - return m_path; -} - -const QString SongInfo::fileName () const -{ - return m_path.section('/',-1); -} - -uint SongInfo::year () const -{ - return m_numValues[YEAR]; -} - -uint SongInfo::track () const -{ - return m_numValues[TRACK]; -} - -uint SongInfo::length () const -{ - return m_numValues[LENGTH]; -} - -bool SongInfo::isEmpty () const -{ - return m_strValues.isEmpty(); -} - -void SongInfo::clear () -{ - m_path.clear(); - m_strValues.clear(); - m_numValues.clear(); - m_stream = FALSE; -} - -bool SongInfo::isStream () const -{ - return m_stream; -} - |
