• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • transfer-plugins
  • bittorrent
scandlg.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007 by Joris Guisson and Ivan Vasic *
3  * joris.guisson@gmail.com *
4  * ivasic@gmail.com *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20  ***************************************************************************/
21 #ifndef KT_SCANDLG_HH
22 #define KT_SCANDLG_HH
23 
24 #include <QTimer>
25 #include <QMutex>
26 #include <KDialog>
27 #include <version.h>
28 #if LIBKTORRENT_VERSION >= 0x010100
29 #include <torrent/job.h>
30 #else
31 #include <datachecker/datacheckerlistener.h>
32 #endif
33 #include "ui_scandlg.h"
34 
35 namespace bt
36 {
37  class TorrentInterface;
38 }
39 
40 namespace kt
41 {
42  class TorrentInterface;
43 
44 #if LIBKTORRENT_VERSION >= 0x010100
45  class ScanDlg : public KDialog
46  {
47  Q_OBJECT
48  public:
49  ScanDlg(KJob *job, QWidget* parent);
50  virtual ~ScanDlg();
51 
52  protected:
54  virtual void closeEvent(QCloseEvent* e);
55 
56  protected slots:
57  virtual void reject();
58  virtual void accept();
59 
60  private slots:
61  void description(KJob *job, const QString &title, const QPair<QString, QString > &field1, const QPair< QString, QString > &field2);
62  void result(KJob *job);
63  void percent(KJob *job, unsigned long percent);
64 
65  private:
66  bt::Job * m_job;
67  QProgressBar *m_progress;
68  KPushButton *m_cancel;
69  QLabel *m_torrent_label;
70  QLabel *m_chunks_failed;
71  QLabel *m_chunks_found;
72  QLabel *m_chunks_not_downloaded;
73  QLabel *m_chunks_downloaded;
74  };
75 #else
76  class ScanDlg : public KDialog,public bt::DataCheckerListener
77  {
78  Q_OBJECT
79  public:
80  ScanDlg(QWidget* parent);
81  virtual ~ScanDlg();
82 
84  void execute(bt::TorrentInterface* tc,bool silently);
85 
86  protected:
88  virtual void progress(bt::Uint32 num,bt::Uint32 total);
89 
91  virtual void status(bt::Uint32 failed,bt::Uint32 found,bt::Uint32 downloaded,bt::Uint32 not_downloaded);
92 
94  virtual void finished();
95 
97  virtual void closeEvent(QCloseEvent* e);
98 
99  virtual void error(const QString&);
100 
101  protected slots:
102  virtual void reject();
103  virtual void accept();
104  void onCancelPressed();
106  void update();
107  void scan();
108 
109  private:
110  bt::TorrentInterface* tc;
111  QMutex mutex;
112  QTimer timer;
113  bt::Uint32 num_chunks;
114  bt::Uint32 total_chunks;
115  bt::Uint32 num_downloaded;
116  bt::Uint32 num_failed;
117  bt::Uint32 num_found;
118  bt::Uint32 num_not_downloaded;
119  bool silently;
120  bool restart;
121  int qm_priority;
122  bool scanning;
123  QProgressBar *m_progress;
124  KPushButton *m_cancel;
125  QLabel *m_torrent_label;
126  QLabel *m_chunks_failed;
127  QLabel *m_chunks_found;
128  QLabel *m_chunks_not_downloaded;
129  QLabel *m_chunks_downloaded;
130  };
131 #endif
132 }
133 
134 #endif
kt::ScanDlg::update
void update()
Updates the GUI in app thread.
Definition: scandlg.cpp:276
QWidget
kt::ScanDlg::onCancelPressed
void onCancelPressed()
Definition: scandlg.cpp:271
kt::ScanDlg::closeEvent
virtual void closeEvent(QCloseEvent *e)
Handle the close event.
Definition: scandlg.cpp:246
KDialog
kt::ScanDlg::error
virtual void error(const QString &)
Definition: scandlg.cpp:241
kt::ScanDlg::progress
virtual void progress(bt::Uint32 num, bt::Uint32 total)
Update progress info, runs in scan threadnted"))
Definition: scandlg.cpp:190
kt::ScanDlg::scan
void scan()
Definition: scandlg.cpp:150
kt::ScanDlg::~ScanDlg
virtual ~ScanDlg()
Definition: scandlg.cpp:146
kt::ScanDlg::finished
virtual void finished()
Scan finished, runs in app thread.
Definition: scandlg.cpp:206
kt::ScanDlg
Definition: scandlg.h:76
kt::ScanDlg::status
virtual void status(bt::Uint32 failed, bt::Uint32 found, bt::Uint32 downloaded, bt::Uint32 not_downloaded)
Update status info, runs in scan thread.
Definition: scandlg.cpp:197
kt::ScanDlg::accept
virtual void accept()
Definition: scandlg.cpp:265
kt::ScanDlg::execute
void execute(bt::TorrentInterface *tc, bool silently)
Starts the scan threadvent(QC.
Definition: scandlg.cpp:164
kt::ScanDlg::reject
virtual void reject()
Definition: scandlg.cpp:254
KJob
kt::ScanDlg::ScanDlg
ScanDlg(QWidget *parent)
Definition: scandlg.cpp:114
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal