~ubuntu-branches/ubuntu/karmic/kid3/karmic

« back to all changes in this revision

Viewing changes to kid3/downloaddialog.h

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Matthäi
  • Date: 2009-05-20 16:12:30 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090520161230-qetp532r8ydujkz2
Tags: upstream-1.2
Import upstream version 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file downloaddialog.h
 
3
 * Dialog displayed during a download.
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 31 Dec 2008
 
8
 *
 
9
 * Copyright (C) 2008-2009  Urs Fleisch
 
10
 *
 
11
 * This file is part of Kid3.
 
12
 *
 
13
 * Kid3 is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License as published by
 
15
 * the Free Software Foundation; either version 2 of the License, or
 
16
 * (at your option) any later version.
 
17
 *
 
18
 * Kid3 is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 */
 
26
 
 
27
#ifndef DOWNLOADDIALOG_H
 
28
#define DOWNLOADDIALOG_H
 
29
 
 
30
#include <qprogressdialog.h>
 
31
#include <qstring.h>
 
32
 
 
33
class HttpClient;
 
34
 
 
35
/**
 
36
 * Dialog displayed during a download.
 
37
 */
 
38
class DownloadDialog : public QProgressDialog {
 
39
Q_OBJECT
 
40
 
 
41
public:
 
42
        /**
 
43
         * Constructor.
 
44
   *
 
45
         * @param parent  parent widget
 
46
         * @param caption dialog title
 
47
   */
 
48
        DownloadDialog(QWidget* parent, const QString& caption);
 
49
 
 
50
        /**
 
51
         * Destructor.
 
52
         */
 
53
        virtual ~DownloadDialog();
 
54
 
 
55
  /**
 
56
   * Send a download request.
 
57
   *
 
58
   * @param hostName server
 
59
   * @param path     path on server
 
60
   */
 
61
        void startDownload(const QString& hostName, const QString& path);
 
62
 
 
63
public slots:
 
64
        /**
 
65
         * Cancel a download.
 
66
         */
 
67
        void cancelDownload();
 
68
 
 
69
private slots:
 
70
        /**
 
71
         * Handle response when request is finished.
 
72
         * downloadFinished() is emitted.
 
73
         *
 
74
         * @param data received data
 
75
         */
 
76
        void requestFinished(const QByteArray& data);
 
77
 
 
78
        /**
 
79
         * Display progress status.
 
80
         *
 
81
         * @param msg           status message
 
82
         * @param receivedBytes bytes received
 
83
         * @param totalBytes    total bytes
 
84
         */
 
85
        void updateProgressStatus(const QString& msg, int receivedBytes, int totalBytes);
 
86
 
 
87
signals:
 
88
        /**
 
89
         * Emitted when download finished.
 
90
         * Parameter: bytes containing download, content type, URL
 
91
         */
 
92
        void downloadFinished(const QByteArray&, const QString&, const QString&);
 
93
 
 
94
private:
 
95
        HttpClient* m_client;
 
96
        QString m_url;
 
97
};
 
98
 
 
99
#endif // DOWNLOADDIALOG_H