File indexing completed on 2024-04-28 04:57:30

0001 /***************************************************************************
0002  *   Copyright (C) 2007 by Joris Guisson and Ivan Vasic                    *
0003  *   joris.guisson@gmail.com                                               *
0004  *   ivasic@gmail.com                                                      *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, write to the                         *
0018  *   Free Software Foundation, Inc.,                                       *
0019  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
0020  ***************************************************************************/
0021 #ifndef KT_SCANDLG_HH
0022 #define KT_SCANDLG_HH
0023 
0024 #include <QDialog>
0025 #include <QMutex>
0026 #include <QTimer>
0027 
0028 #include "ui_scandlg.h"
0029 #include <torrent/job.h>
0030 #include <version.h>
0031 
0032 namespace bt
0033 {
0034 class TorrentInterface;
0035 }
0036 
0037 namespace kt
0038 {
0039 class TorrentInterface;
0040 
0041 class ScanDlg : public QDialog
0042 {
0043     Q_OBJECT
0044 public:
0045     ScanDlg(KJob *job, QWidget *parent);
0046     ~ScanDlg() override;
0047 
0048 protected:
0049     /// Handle the close event
0050     void closeEvent(QCloseEvent *e) override;
0051 
0052 protected Q_SLOTS:
0053     void reject() override;
0054     void accept() override;
0055 
0056 private Q_SLOTS:
0057     void description(KJob *job, const QString &title, const QPair<QString, QString> &field1, const QPair<QString, QString> &field2);
0058     void result(KJob *job);
0059     void percent(KJob *job, unsigned long percent);
0060 
0061 private:
0062     bt::Job *m_job;
0063     QProgressBar *m_progress;
0064     QPushButton *m_cancel;
0065     QLabel *m_torrent_label;
0066     QLabel *m_chunks_failed;
0067     QLabel *m_chunks_found;
0068     QLabel *m_chunks_not_downloaded;
0069     QLabel *m_chunks_downloaded;
0070 };
0071 }
0072 
0073 #endif