File indexing completed on 2024-04-21 04:57:13

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 */
0010 
0011 #ifndef BTTRANSFERHANDLER_H
0012 #define BTTRANSFERHANDLER_H
0013 
0014 #include "bttransfer.h"
0015 #include "core/transferhandler.h"
0016 #include <torrent/torrentcontrol.h>
0017 #include <version.h>
0018 
0019 class Scheduler;
0020 
0021 class BTAdvancedDetailsWidget;
0022 
0023 namespace kt
0024 {
0025 class ScanDlg;
0026 class Monitor;
0027 }
0028 
0029 class BTTransferHandler : public TransferHandler
0030 {
0031     Q_OBJECT
0032 public:
0033     BTTransferHandler(BTTransfer *transfer, Scheduler *scheduler);
0034     ~BTTransferHandler() override;
0035 
0036     int chunksTotal() const
0037     {
0038         return m_transfer->chunksTotal();
0039     }
0040     int chunksDownloaded() const
0041     {
0042         return m_transfer->chunksDownloaded();
0043     }
0044     int chunksExcluded() const
0045     {
0046         return m_transfer->chunksExcluded();
0047     }
0048     int chunksLeft() const
0049     {
0050         return m_transfer->chunksLeft();
0051     }
0052     int seedsConnected() const
0053     {
0054         return m_transfer->seedsConnected();
0055     }
0056     int seedsDisconnected() const
0057     {
0058         return m_transfer->seedsDisconnected();
0059     }
0060     int leechesConnected() const
0061     {
0062         return m_transfer->leechesConnected();
0063     }
0064     int leechesDisconnected() const
0065     {
0066         return m_transfer->leechesDisconnected();
0067     }
0068     bt::TorrentControl *torrentControl() const
0069     {
0070         return m_transfer->torrentControl();
0071     }
0072     bool ready() const
0073     {
0074         return m_transfer->ready();
0075     }
0076 
0077     void addTracker(QString url)
0078     {
0079         m_transfer->addTracker(url);
0080     }
0081     kt::Monitor *torrentMonitor() const;
0082 
0083 public Q_SLOTS:
0084     void createAdvancedDetails();
0085     void createScanDlg();
0086 
0087 private Q_SLOTS:
0088     void removeAdvancedDetails();
0089 
0090 private:
0091     BTTransfer *m_transfer;
0092     BTAdvancedDetailsWidget *advancedDetails;
0093     kt::ScanDlg *scanDlg;
0094 };
0095 
0096 #endif