KVIrc  4.9.2
DeveloperAPIs
HttpFileTransfer.h
Go to the documentation of this file.
1 #ifndef _HTTPFILETRANSFER_H_
2 #define _HTTPFILETRANSFER_H_
3 //=============================================================================
4 //
5 // File : HttpFileTransfer.h
6 // Creation date : Tue Apr 22 2003 02:00:12 GMT by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2003-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "KviFileTransfer.h"
28 #include "KviHttpRequest.h"
29 #include "KviTimeUtils.h"
30 #include "KviKvsVariant.h"
31 
32 #include <QStringList>
33 #include <QTimer>
34 
35 class QPainter;
36 class QMenu;
37 
39 {
41  {
47  };
48  Q_OBJECT
49 public:
52 
53 private:
54  int m_TimerId;
58 
59  QStringList m_lHeaders;
60  QStringList m_lRequest;
61 
65 
70 
73 
74 public:
76  static unsigned int runningTransfers();
77  static void init();
78  static void done();
79 
80  virtual bool startDownload();
81 
82  void setCompletionCallback(const QString & szCallback) { m_szCompletionCallback = szCallback; };
83  void setMagicIdentifier(const KviKvsVariant & vIdentifier) { m_vMagicIdentifier = vIdentifier; };
84  void setNotifyCompletion(bool bNotify) { m_bNotifyCompletion = bNotify; };
85  void setAutoClean(bool bAutoClean) { m_bAutoClean = bAutoClean; };
86  void setNoOutput(bool bNoOutput) { m_bNoOutput = bNoOutput; };
87 
88  virtual void displayPaint(QPainter * p, int column, QRect rect);
89  virtual int displayHeight(int iLineSpacing);
90  virtual void fillContextPopup(QMenu * m);
91  virtual bool active();
92  virtual QString tipText();
93  virtual QString localFileName();
94 protected slots:
95  void statusMessage(const QString & txt);
96  void transferTerminated(bool bSuccess);
98  void requestSent(const QStringList & sl);
99 
100  void resolvingHost(const QString & hostname);
101  void contactingHost(const QString & ipandport);
102  void receivedResponse(const QString & response);
103  void connectionEstablished();
104  void abort();
105  void autoClean();
106 };
107 
108 #endif
Definition: KviFileTransfer.h:78
QString m_szCompletionCallback
Definition: HttpFileTransfer.h:72
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
~HttpFileTransfer()
Definition: HttpFileTransfer.cpp:73
void setMagicIdentifier(const KviKvsVariant &vIdentifier)
Definition: HttpFileTransfer.h:83
virtual QString localFileName()
Definition: HttpFileTransfer.cpp:90
void setCompletionCallback(const QString &szCallback)
Definition: HttpFileTransfer.h:82
QString m_szStatusString
Definition: HttpFileTransfer.h:57
Definition: HttpFileTransfer.h:38
kvi_time_t m_tTransferStartTime
Definition: HttpFileTransfer.h:63
#define m
Definition: detector.cpp:77
GeneralStatus m_eGeneralStatus
Definition: HttpFileTransfer.h:56
Definition: HttpFileTransfer.h:45
GeneralStatus
Definition: HttpFileTransfer.h:40
Definition: HttpFileTransfer.h:42
void autoClean()
Definition: HttpFileTransfer.cpp:84
int m_TimerId
Definition: HttpFileTransfer.h:54
#define kvi_time_t
Definition: KviTimeUtils.h:43
static void done()
Definition: HttpFileTransfer.cpp:354
void resolvingHost(const QString &hostname)
Definition: HttpFileTransfer.cpp:403
virtual void fillContextPopup(QMenu *m)
Definition: HttpFileTransfer.cpp:100
kvi_time_t m_tStartTime
Definition: HttpFileTransfer.h:62
static unsigned int runningTransfers()
Definition: HttpFileTransfer.cpp:369
void headersReceived(KviPointerHashTable< const char *, KviCString > *h)
Definition: HttpFileTransfer.cpp:497
#define h
Definition: detector.cpp:72
void abort()
Definition: HttpFileTransfer.cpp:95
virtual void displayPaint(QPainter *p, int column, QRect rect)
Definition: HttpFileTransfer.cpp:112
HttpFileTransfer()
Definition: HttpFileTransfer.cpp:43
kvi_time_t m_tTransferEndTime
Definition: HttpFileTransfer.h:64
void contactingHost(const QString &ipandport)
Definition: HttpFileTransfer.cpp:409
Time management.
Definition: KviHttpRequest.h:58
QStringList m_lRequest
Definition: HttpFileTransfer.h:60
void setNotifyCompletion(bool bNotify)
Definition: HttpFileTransfer.h:84
KviHttpRequest * request()
Definition: HttpFileTransfer.h:75
bool m_bNoOutput
Definition: HttpFileTransfer.h:69
void receivedResponse(const QString &response)
Definition: HttpFileTransfer.cpp:415
void statusMessage(const QString &txt)
Definition: HttpFileTransfer.cpp:425
QStringList m_lHeaders
Definition: HttpFileTransfer.h:59
virtual int displayHeight(int iLineSpacing)
Definition: HttpFileTransfer.cpp:298
Definition: HttpFileTransfer.h:46
Definition: HttpFileTransfer.h:43
virtual QString tipText()
Definition: HttpFileTransfer.cpp:304
Definition: HttpFileTransfer.h:44
Handling of variant data type in KVS.
virtual bool active()
Definition: HttpFileTransfer.cpp:107
A fast pointer hash table implementation.
Definition: KviPointerHashTable.h:391
static void init()
Definition: HttpFileTransfer.cpp:340
bool m_bNotifyCompletion
Definition: HttpFileTransfer.h:67
KviKvsVariant m_vMagicIdentifier
Definition: HttpFileTransfer.h:66
bool m_bAutoClean
Definition: HttpFileTransfer.h:68
#define p
Definition: detector.cpp:80
QTimer * m_pAutoCleanTimer
Definition: HttpFileTransfer.h:71
void transferTerminated(bool bSuccess)
Definition: HttpFileTransfer.cpp:432
void setAutoClean(bool bAutoClean)
Definition: HttpFileTransfer.h:85
void requestSent(const QStringList &sl)
Definition: HttpFileTransfer.cpp:376
virtual bool startDownload()
Definition: HttpFileTransfer.cpp:518
void connectionEstablished()
Definition: HttpFileTransfer.cpp:397
void setNoOutput(bool bNoOutput)
Definition: HttpFileTransfer.h:86
KviHttpRequest * m_pHttpRequest
Definition: HttpFileTransfer.h:55
QString hostname()
Definition: KviRuntimeInfo.cpp:720