example/DemoGUI/ImageDownload.h
author cgandhi
Thu, 05 Aug 2010 16:35:33 +0530
changeset 16 b78fa4cdbf2b
permissions -rw-r--r--
pushing the demo application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     1
/****************************************************************************
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     2
**
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     3
** Trolltech hereby grants a license to use the Qt/Eclipse Integration
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     4
** plug-in (the software contained herein), in binary form, solely for the
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     5
** purpose of creating code to be used with Trolltech's Qt software.
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     6
**
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     7
** Qt Designer is licensed under the terms of the GNU General Public
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     8
** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
     9
** right to use certain no GPL licensed software under the terms of its GPL
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    10
** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    11
**
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    12
** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    13
** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    14
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    15
** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    16
** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    17
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    18
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    19
** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    20
** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    21
** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    22
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    23
**
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    24
** Since we now have the GPL exception I think that the "special exception
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    25
** is no longer needed. The license text proposed above (other than the
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    26
** special exception portion of it) is the BSD license and we have added
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    27
** the BSD license as a permissible license under the exception.
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    28
**
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    29
****************************************************************************/
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    30
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    31
#ifndef IMAGEDOWNLOAD_H_
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    32
#define IMAGEDOWNLOAD_H_
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    33
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    34
#include <QNetworkReply>
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    35
#include <QList>
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    36
#include <QNetworkAccessManager>
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    37
#include <qhash.h>
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    38
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    39
class HomeView;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    40
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    41
extern bool downloading;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    42
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    43
enum SmfItemIdentifier
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    44
	{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    45
	SmfFriendsFetch = 0,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    46
	SmfPostsFetch,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    47
	SmfAlbumsFetch,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    48
	SmfPhotosFetch,
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    49
	SmfActivityFetch
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    50
	};
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    51
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    52
class ImageDownload : public QObject
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    53
{
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    54
    Q_OBJECT
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    55
public:
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    56
    ImageDownload(QObject *parent = 0);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    57
    ~ImageDownload();
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    58
    void downloadImage(HomeView *homeView, QString name, QUrl url, const SmfItemIdentifier &identifier);
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    59
    
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    60
public slots:
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    61
    void networkReplyFinished ( QNetworkReply *aNetworkReply );
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    62
    
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    63
private:
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    64
    SmfItemIdentifier m_identifier;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    65
    QNetworkAccessManager *manager;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    66
    HomeView *m_homeView;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    67
    QString m_name;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    68
    QHash<QString, QNetworkReply*> m_nameReplyHash;
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    69
};
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    70
b78fa4cdbf2b pushing the demo application
cgandhi
parents:
diff changeset
    71
#endif /* IMAGEDOWNLOAD_H_ */