KVIrc  4.9.2
DeveloperAPIs
KviFileTransfer.h
Go to the documentation of this file.
1 #ifndef _KVI_FILETRANSFER_H_
2 #define _KVI_FILETRANSFER_H_
3 
4 //=============================================================================
5 //
6 // File : KviFileTransfer.h
7 // Creation date : Mon Apr 21 22:14:31 2003 GMT by Szymon Stefanek
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 2003-2010 Szymon Stefanek (pragma at kvirc dot net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
28 #include "kvi_settings.h"
29 #include "KviPointerList.h"
30 #include "KviTalTableWidget.h"
31 
32 #include <QObject>
33 
34 class KviFileTransfer;
35 class KviWindow;
36 class QMenu;
37 class QPainter;
38 
39 // This is for the external extension
40 #define KVI_FILE_TRANSFER_WINDOW_EXTENSION_NAME "File transfer extension"
41 
42 class KVIRC_API KviFileTransferManager : public QObject
43 {
44  friend class KviApplication;
45  friend class KviFileTransfer;
46  friend class FileTransferWindow; // FIXME: This is in a module!
47  Q_OBJECT
48 public:
51 
52 protected:
55 
56 protected:
57  static void cleanup();
58  void registerTransfer(KviFileTransfer * t);
59  void unregisterTransfer(KviFileTransfer * t);
60  void setTransferWindow(KviWindow * wnd) { m_pTransferWindow = wnd; };
61 public:
62  // might be zero!
63  KviWindow * transferWindow() { return m_pTransferWindow; };
64  static KviFileTransferManager * instance();
65  KviPointerList<KviFileTransfer> * transferList() { return m_pTransferList; };
66  void invokeTransferWindow(bool bCreateMinimized = false, bool bNoRaise = false);
67  void killAllTransfers();
68  void killTerminatedTransfers();
69 signals:
72 };
73 
74 #define COLUMN_TRANSFERTYPE 0
75 #define COLUMN_FILEINFO 1
76 #define COLUMN_PROGRESS 2
77 
78 class KVIRC_API KviFileTransfer : public QObject
79 {
80  Q_OBJECT
81 public:
83  ~KviFileTransfer();
84 
85 protected:
86  int m_iId;
88 
89 public:
90  // This is called by KviFileTransferItem at any time
91  void setDisplayItem(KviTalTableWidgetItemEx * i) { m_pDisplayItem = i; };
92  int id() { return m_iId; };
93  // this is just a convenience function : it's equivalent to !active()
94  bool terminated();
95  // This may be used to invoke the transfer window
96  void invokeTransferWindow(bool bCreateMinimized = false, bool bNoRaise = false);
98  // this returns the pointer to the transfer window : may be 0!
99  KviWindow * transferWindow() { return manager()->transferWindow(); };
100  // this returns transferWindow() if not 0, otherwise the application's active window
101  KviWindow * outputWindow();
102 
103  // this may be called by the transfers to update the display when the state changes
104  void displayUpdate();
105 
106  // this must be implemented by the transfer
107  virtual bool active() = 0;
108  virtual void displayPaint(QPainter * p, int column, QRect rect) = 0;
109  virtual QString tipText();
110  virtual QString localFileName();
111  virtual QString retryCommand();
112  virtual int displayHeight(int iLineSpacing);
113  virtual void fillContextPopup(QMenu * m) = 0;
114  virtual void die();
115 };
116 
117 #endif
void setDisplayItem(KviTalTableWidgetItemEx *i)
Definition: KviFileTransfer.h:91
KviPointerList< KviFileTransfer > * m_pTransferList
Definition: KviFileTransfer.h:53
Definition: KviFileTransfer.h:78
void transferUnregistering(KviFileTransfer *t)
Definition: FileTransferWindow.cpp:386
#define KVIRC_API
Definition: kvi_settings.h:128
m_iId
Definition: KvsObject_buttonGroup.cpp:62
#define m
Definition: detector.cpp:77
Definition: KviFileTransfer.h:42
int m_iId
Definition: KviFileTransfer.h:86
Definition: FileTransferWindow.h:91
Definition: KviTalTableWidget.h:67
KviWindow * m_pTransferWindow
Definition: KviFileTransfer.h:54
void setTransferWindow(KviWindow *wnd)
Definition: KviFileTransfer.h:60
#define i
Definition: detector.cpp:73
KviTalTableWidgetItemEx * m_pDisplayItem
Definition: KviFileTransfer.h:87
QHashIterator< int, QFile * > t(getDict)
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
KviWindow * transferWindow()
Definition: KviFileTransfer.h:99
Definition: KviApplication.h:102
static KviFileTransferManager * instance()
Definition: KviFileTransfer.cpp:48
void transferRegistered(KviFileTransfer *t)
Definition: FileTransferWindow.cpp:381
KviPointerList< KviFileTransfer > * transferList()
Definition: KviFileTransfer.h:65
KviFileTransferManager * manager()
Definition: KviFileTransfer.h:97
KviWindow * transferWindow()
Definition: KviFileTransfer.h:63
This file contains compile time settings.
#define p
Definition: detector.cpp:80
int id()
Definition: KviFileTransfer.h:92