KVIrc 5.2.4
Developer APIs
KTorrentDbusInterface.h
Go to the documentation of this file.
1#ifndef _TC_KTORRENTDCOPINTERFACE_H_
2#define _TC_KTORRENTDCOPINTERFACE_H_
3//=============================================================================
4//
5// DBus interface for KTorrent client.
6//
7// File : KTorrentDbusInterface.h
8// Creation date : Mon Nov 17 13:46:00 2008 GMT by Fabio Bas
9//
10// This file is part of the KVIrc IRC client distribution
11// Copyright (C) 2008 Fabio Bas (ctrlaltca at gmail dot com)
12//
13// This program is FREE software. You can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation; either version 2
16// of the License, or (at your option) any later version.
17//
18// This program 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.
21// See the 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, write to the Free Software Foundation,
25// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26//
27//=============================================================================
28
29#include "TorrentInterface.h"
30
31#ifdef COMPILE_KDE_SUPPORT
32
33#include <QtDBus/QtDBus>
34
35class KTorrentDbusInterface : public TorrentInterface
36{
37 Q_OBJECT
38
39public:
40 KTorrentDbusInterface();
41 ~KTorrentDbusInterface();
42
43 int detect() override;
44
45 bool startAll() override;
46 bool stopAll() override;
47
48 int count() override;
49 bool start(int i) override;
50 bool stop(int i) override;
51 bool announce(int i) override;
52 QString state(int i) override;
53 QString name(int i) override;
54 int fileCount(int i) override;
55 QString fileName(int i, int file) override;
56 QString filePriority(int i, int file) override;
57 bool setFilePriority(int i, int file, const QString & prio) override;
58
59 int maxUploadSpeed() override;
60 int maxDownloadSpeed() override;
61
62 bool setMaxUploadSpeed(int kbytes_per_sec) override;
63 bool setMaxDownloadSpeed(int kbytes_per_sec) override;
64
65 float speedUp() override;
66 float speedDown() override;
67
68 float trafficUp() override;
69 float trafficDown() override;
70 /*
71 private slots:
72 // polls client and extracts information.
73 // this is done because the order of torrents returned changes
74 // each time a torrent's state changes.
75 // we want to present a consistent list (in terms of indices) to
76 // the user, so we extract the info and sort it by name.
77 // otherwise the user would have a hard time figuring out what's
78 // going on. we could sort each time a function working with
79 // torrents is called, but this would be horribly slow ...
80 void slotTimer();
81 private:
82 struct TorrentInfo
83 {
84 // internal number
85 int num;
86 // name displayed in ktorrent
87 QString name;
88 // state of torrent
89 QString state;
90 // bytes
91 float size;
92 // bytes
93 float trafficUp;
94 // bytes
95 float trafficDown;
96 // KB/s
97 float speedUp;
98 // KB/s
99 float speedDown;
100 // percent complete
101 float percent;
102 // number of peers
103 int peers;
104 bool operator<(const TorrentInfo &ti) { return name < ti.name; }
105 };
106
107 QValueList<TorrentInfo> m_ti;
108*/
109private:
110 // bool makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret);
111 bool findRunningApp();
112};
113
114TORR_DECLARE_DESCRIPTOR(KTorrentDbusInterface)
115
116#endif // COMPILE_KDE_SUPPORT
117
118#endif // _TC_KTORRENTDCOPINTERFACE_H_
#define TORR_DECLARE_DESCRIPTOR(_interfaceclass)
Definition TorrentInterface.h:117
Definition TorrentInterface.h:35
virtual QString state(int i)=0
virtual float trafficUp()=0
virtual int maxUploadSpeed()=0
virtual QString name(int i)=0
virtual bool announce(int i)=0
virtual float speedUp()=0
virtual bool stopAll()=0
virtual float trafficDown()=0
virtual float speedDown()=0
virtual bool start(int i)=0
virtual QString filePriority(int i, int file)=0
virtual int maxDownloadSpeed()=0
virtual int detect()=0
virtual int count()=0
virtual bool setMaxDownloadSpeed(int kbytes_per_sec)=0
virtual QString fileName(int i, int file)=0
virtual bool stop(int i)=0
virtual bool setMaxUploadSpeed(int kbytes_per_sec)=0
virtual int fileCount(int i)=0
virtual bool startAll()=0
virtual bool setFilePriority(int i, int file, const QString &prio)=0
#define i
Definition detector.cpp:74