source: psi/vendor/affinix/current/src/filetransdlg.h@ 2

Last change on this file since 2 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 2.9 KB
Line 
1#ifndef FILETRANSDLG_H
2#define FILETRANSDLG_H
3
4#include"ui_filetrans.h"
5#include"im.h"
6#include"s5b.h"
7
8#if QT_VERSION < 0x030200
9typedef long int Q_LLONG;
10#endif
11
12class PsiCon;
13class PsiAccount;
14namespace XMPP
15{
16 class FileTransfer;
17}
18using namespace XMPP;
19
20class FileTransferHandler : public QObject
21{
22 Q_OBJECT
23public:
24 enum { ErrReject, ErrTransfer, ErrFile };
25 enum { Sending, Receiving };
26 FileTransferHandler(PsiAccount *pa, FileTransfer *ft=0);
27 ~FileTransferHandler();
28
29 PsiAccount *account() const;
30 int mode() const;
31 Jid peer() const;
32 QString fileName() const;
33 Q_LLONG fileSize() const;
34 QString description() const;
35 Q_LLONG offset() const;
36 int totalSteps() const;
37 bool resumeSupported() const;
38 QString saveName() const;
39
40 void send(const Jid &to, const QString &fname, const QString &desc);
41 void accept(const QString &saveName, const QString &fileName, Q_LLONG offset=0);
42
43signals:
44 void accepted();
45 void statusMessage(const QString &s);
46 void connected();
47 void progress(int p, Q_LLONG sent);
48 void error(int, int, const QString &s);
49
50private slots:
51 // s5b status
52 void s5b_proxyQuery();
53 void s5b_proxyResult(bool b);
54 void s5b_requesting();
55 void s5b_accepted();
56 void s5b_tryingHosts(const StreamHostList &hosts);
57 void s5b_proxyConnect();
58 void s5b_waitingForActivation();
59
60 // ft
61 void ft_accepted();
62 void ft_connected();
63 void ft_readyRead(const QByteArray &);
64 void ft_bytesWritten(int);
65 void ft_error(int);
66 void trySend();
67 void doFinish();
68
69private:
70 class Private;
71 Private *d;
72
73 void mapSignals();
74};
75
76class FileRequestDlg : public FileTransUI
77{
78 Q_OBJECT
79public:
80 FileRequestDlg(const Jid &j, PsiCon *psi, PsiAccount *pa);
81 FileRequestDlg(const Jid &j, PsiCon *psi, PsiAccount *pa, const QStringList& files);
82 FileRequestDlg(const QDateTime &ts, FileTransfer *ft, PsiAccount *pa);
83 ~FileRequestDlg();
84
85protected:
86 void keyPressEvent(QKeyEvent *);
87
88public slots:
89 void done(int r);
90
91private slots:
92 void updateIdentity(PsiAccount *);
93 void pa_disconnected();
94 void chooseFile();
95 void doStart();
96 void ft_accepted();
97 void ft_statusMessage(const QString &s);
98 void ft_connected();
99 void ft_error(int, int, const QString &);
100 void t_timeout();
101
102private:
103 class Private;
104 Private *d;
105
106 void blockWidgets();
107 void unblockWidgets();
108};
109
110class FileTransDlg : public QDialog
111{
112 Q_OBJECT
113public:
114 FileTransDlg(PsiCon *);
115 ~FileTransDlg();
116
117 int addItem(const QString &filename, Q_LLONG size, const QString &peer, bool sending);
118 void setProgress(int id, int step, int total, Q_LLONG sent, int bytesPerSecond, bool updateAll=false);
119 void setError(int id, const QString &reason);
120 void removeItem(int id);
121
122 void takeTransfer(FileTransferHandler *h, int p, Q_LLONG sent);
123 void killTransfers(PsiAccount *pa);
124
125private slots:
126 void clearFinished();
127 void ft_progress(int p, Q_LLONG sent);
128 void ft_error(int, int, const QString &s);
129 void updateItems();
130
131 void itemCancel(int);
132 void itemOpenDest(int);
133 void itemClear(int);
134
135private:
136 class Private;
137 Private *d;
138};
139
140#endif
Note: See TracBrowser for help on using the repository browser.