File indexing completed on 2024-05-19 04:50:18

0001 /****************************************************************************************
0002  * Copyright (c) 2006,2007 Nikolaj Hald Nielsen <nhn@kde.org>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef MAGNATUNE_DOWNLOAD_INFO_H
0018 #define MAGNATUNE_DOWNLOAD_INFO_H
0019 
0020 #include <QUrl>
0021 
0022 #include <QDomElement>
0023 #include <qmap.h>
0024 #include <QString>
0025 
0026 
0027 typedef QMap<QString, QString> DownloadFormatMap;
0028 
0029 /**
0030 Class for parsing and storing the info from a download xml file or string
0031 
0032     @author Nikolaj Hald Nielsen
0033 */
0034 class MagnatuneDownloadInfo{
0035 public:
0036     MagnatuneDownloadInfo();
0037     ~MagnatuneDownloadInfo();
0038 
0039     bool initFromString( const QString &downloadInfoString, bool membershipDownload );
0040     bool initFromRedownloadXml( const QDomElement &element );
0041 
0042     void setMembershipInfo( const QString &username, const QString &password );
0043     bool isMembershipDownload() const;
0044 
0045     DownloadFormatMap formatMap() const;
0046     QString userName() const;
0047     QString password() const;
0048     QString downloadMessage() const;
0049     QString albumCode() const;
0050 
0051     const QString albumName() const;
0052     const QString artistName() const;
0053     const QString coverUrl() const;
0054 
0055     void setAlbumName( const QString  &albumName );
0056     void setArtistName( const QString  &artistName );
0057     void setCoverUrl( const QString &coverUrl );
0058     void setFormatSelection( const QString &selectedFormat );
0059     void setUnpackUrl( const QString &unpackUrl );
0060     void setAlbumCode( const QString & albumCode );
0061     bool isReadyForDownload();
0062     QUrl completeDownloadUrl();
0063     QString unpackLocation() const;
0064 
0065 
0066 
0067 protected:
0068 
0069     DownloadFormatMap m_downloadFormats;
0070     QString m_userName;
0071     QString m_password;
0072     QString m_downloadMessage;
0073 
0074     QString m_artistName;
0075     QString m_albumName;
0076     QString m_albumCode;
0077     QString m_coverUrl;
0078     
0079     bool m_membershipDownload;
0080 
0081     //the following members are for storing the user selections regarding a download
0082     QString m_unpackUrl;
0083     QString m_selectedDownloadFormat;
0084 
0085 };
0086 
0087 #endif