2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
2007-07-14 18:31:59 +04:00
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
2007-07-14 18:31:59 +04:00
|
|
|
* 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.
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-14 18:31:59 +04:00
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contact : chris@qbittorrent.org
|
2006-09-30 20:02:39 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CREATE_TORRENT_IMP_H
|
|
|
|
#define CREATE_TORRENT_IMP_H
|
|
|
|
|
2007-12-31 19:57:35 +03:00
|
|
|
#include <QThread>
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
#include "ui_createtorrent.h"
|
|
|
|
|
2007-12-31 19:57:35 +03:00
|
|
|
class torrentCreatorThread : public QThread {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QString input_path;
|
|
|
|
QString save_path;
|
|
|
|
QStringList trackers;
|
|
|
|
QStringList url_seeds;
|
|
|
|
QString comment;
|
|
|
|
bool is_private;
|
|
|
|
int piece_size;
|
|
|
|
bool abort;
|
2008-11-02 00:42:56 +03:00
|
|
|
QDialog *parent;
|
2007-12-31 19:57:35 +03:00
|
|
|
|
|
|
|
public:
|
2008-11-02 00:42:56 +03:00
|
|
|
torrentCreatorThread(QDialog *_parent) {
|
|
|
|
parent = _parent;
|
|
|
|
}
|
2007-12-31 19:57:35 +03:00
|
|
|
~torrentCreatorThread() {
|
|
|
|
abort = true;
|
|
|
|
wait();
|
|
|
|
}
|
|
|
|
void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void run();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void creationFailure(QString msg);
|
2008-11-02 00:42:56 +03:00
|
|
|
void creationSuccess(QString path, const char* branch_path);
|
2007-12-31 19:57:35 +03:00
|
|
|
void updateProgress(int progress);
|
|
|
|
};
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
class createtorrent : public QDialog, private Ui::createTorrentDialog{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2007-12-31 19:57:35 +03:00
|
|
|
private:
|
|
|
|
torrentCreatorThread *creatorThread;
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
public:
|
|
|
|
createtorrent(QWidget *parent = 0);
|
2007-12-31 19:57:35 +03:00
|
|
|
~createtorrent();
|
2007-04-04 22:55:38 +04:00
|
|
|
QStringList allItems(QListWidget *list);
|
2007-09-04 08:18:51 +04:00
|
|
|
int getPieceSize() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void torrent_to_seed(QString path);
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2008-11-02 00:42:56 +03:00
|
|
|
public slots:
|
|
|
|
void updateProgressBar(int progress);
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
protected slots:
|
|
|
|
void on_createButton_clicked();
|
2007-04-04 22:55:38 +04:00
|
|
|
void on_addFile_button_clicked();
|
|
|
|
void on_addFolder_button_clicked();
|
|
|
|
void on_addTracker_button_clicked();
|
|
|
|
void on_removeTracker_button_clicked();
|
|
|
|
void on_addURLSeed_button_clicked();
|
|
|
|
void on_removeURLSeed_button_clicked();
|
2007-12-31 19:57:35 +03:00
|
|
|
void handleCreationFailure(QString msg);
|
2008-11-02 00:42:56 +03:00
|
|
|
void handleCreationSuccess(QString path, const char* branch_path);
|
2006-09-30 20:02:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|