1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _DCCMANAGER_H
#define _DCCMANAGER_H
#include <time.h>
#include <qobject.h>
#include "dccManagerbase.h"
#include "klistview.h"
class dccManager;
class QSignal;
class QObject;
class dccItem : public QObject,
public KListViewItem
{
Q_OBJECT
public:
enum dccStatus {
dccRecving,
dccOpen,
dccWaitOnResume,
dccResumed,
dccSentOffer,
dccGotOffer,
dccSending,
dccDone,
dccCancel,
dccError
};
enum dccType {
dccGet,
dccChat,
dccSend
};
dccItem( KListView *, dccManager *, enum dccType, const QString &file, const QString &who, enum dccStatus, unsigned int size );
dccItem( KListViewItem *, dccManager *, enum dccType, const QString &file, const QString &who, enum dccStatus, unsigned int size );
virtual ~dccItem();
void changeStatus(enum dccStatus);
void setReceivedBytes(int bytes);
void setWhoPostfix(const QString &post);
void changeFilename(const QString &file);
void changeWho(const QString &who);
const QString who() { return m_who; }
const QString file() { return m_file; }
enum dccStatus status() { return m_status; }
enum dccType type() { return m_type; }
double getPercent() { return m_percent; }
void doRename();
signals:
void statusChanged(QListViewItem *);
void itemRenamed(dccItem *, QString oldNick, QString oldFile);
protected:
QString enumToStatus(enum dccStatus);
virtual void okRename ( int col );
virtual void cancelRename ( int col );
private:
dccManager *m_manager;
QString m_who;
QString m_file;
QString m_post;
int m_percent;
unsigned int m_size;
enum dccStatus m_status;
const enum dccType m_type;
time_t m_stime;
time_t m_lasttime;
};
class dccNew;
class dccManager : public dccManagerbase
{
Q_OBJECT
public:
dccManager( QWidget *parent = 0, const char *name = 0 );
~dccManager();
dccItem *newSendItem(QString file, QString who, enum dccItem::dccStatus, unsigned int size);
dccItem *newGetItem(QString file, QString who, enum dccItem::dccStatus, unsigned int size);
dccItem *newChatItem(QString who, enum dccItem::dccStatus);
void doChanged() { emit changed(false, QString("dcc activity")); };
public slots:
virtual void kpbNew_clicked();
virtual void kpbConnect_clicked();
virtual void kpbResume_clicked();
virtual void kpbRename_clicked();
virtual void kpbAbort_clicked();
signals:
void outputLine(QCString);
void changed(bool, QString);
virtual void dccConnectClicked(dccItem *);
virtual void dccResumeClicked(dccItem *);
virtual void dccRenameClicked(dccItem *);
virtual void dccAbortClicked(dccItem *);
protected slots:
virtual void getSelChange(QListViewItem *);
virtual void sendSelChange(QListViewItem *);
virtual void dccNewAccepted(int type, QString nick, QString file);
private:
KListViewItem *m_getit;
KListViewItem *m_sendit;
KListViewItem *m_chatit;
dccNew *dccNewDialog;
};
#endif
|