mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
- BUGFIX: Fixed deprecation warning with latest libtorrent svn
- FEATURE: Redesigned torrent creation dialog - FEATURE: Allow to set piece size when creating a torrent - improved new options dialog a little
This commit is contained in:
parent
2c2c1093c3
commit
9f36d521a4
8 changed files with 607 additions and 668 deletions
17
TODO
17
TODO
|
@ -42,7 +42,6 @@
|
|||
- Allow to disable UPnP/NAT-PMP/LSD in options?
|
||||
- Allow to automatically delete torrents when they reach a given ratio (in options) : easy
|
||||
- Allow to limit the number of downloading torrents simultaneously (other are paused until a download finishes)
|
||||
- Add "Mark all as read" feature for RSS
|
||||
- Allow to customize lists refreshing interval (in options)
|
||||
- Improve search plugin install (download drom url, choose in a list taken from plugins.qbittorrent.org)
|
||||
- Display the number of DHT node if possible
|
||||
|
@ -54,10 +53,6 @@
|
|||
- Fix all (or almost all) opened bugs in bug tracker
|
||||
- Add an option 'Automatically update search plugins'
|
||||
- Add an option 'Display current speed in title bar'
|
||||
- Add an option 'append .!qBT to incomplete files'
|
||||
- Add an option "preallocate all files"
|
||||
- Add an option 'Put new downloads in ...'
|
||||
- Add an option 'Put complete downloads in ...'
|
||||
- Improve systray tooltip
|
||||
- Use tooltips in options to explain
|
||||
- Keep documention up to date
|
||||
|
@ -66,19 +61,12 @@
|
|||
- valgrind --tool=memcheck --leak-check=full src/qbittorrent (Looks ok)
|
||||
- 128m 29m 16m S 4.8 2.9 0:02.28 qbittorrent
|
||||
* beta 7
|
||||
- Add "Mark all as read" feature for RSS
|
||||
- update doc for plugins (and add screenies)
|
||||
- Redesign options (fully)
|
||||
* Add options like "num uploads"
|
||||
- redesign torrent creation
|
||||
* lineEdit for input
|
||||
* Create and save button
|
||||
* piece size choice
|
||||
* Start seeding checkbox
|
||||
- Review torrent content selection
|
||||
* check the one in ktorrent
|
||||
- Translations update (IN PROGRESS)
|
||||
- Wait for some bug fixes in libtorrent :
|
||||
- Number of seeds non null for finished torrent (Ticket #122)
|
||||
|
||||
LANGUAGES UPDATED:
|
||||
- French *BETA6*
|
||||
|
@ -107,6 +95,8 @@ beta6->beta7 changelog:
|
|||
- FEATURE: Allow to drag'n drop plugin to list for install/update
|
||||
- FEATURE: Added some search plugins to http://plugins.qbittorrent.org
|
||||
- FEATURE: Added zip support in search plugins manager (can put .py & .png inside)
|
||||
- FEATURE: Redesigned torrent creation dialog
|
||||
- FEATURE: Allow to set piece size when creating a torrent
|
||||
- BUGFIX: In torrent content, it is now easier to filter all torrents using right click menu
|
||||
- BUGFIX: Updated man page / README / INSTALL
|
||||
- BUGFIX: Paused torrents could be displayed as connected for a sec after checking
|
||||
|
@ -120,4 +110,5 @@ beta6->beta7 changelog:
|
|||
- BUGFIX: the function that set the rows color doesn't handle hidden columns anymore
|
||||
- BUGFIX: improved search engine plugin manager code and fixed bugs
|
||||
- BUGFIX: Dropped Qt4.2 support, becomes too difficult to maintain
|
||||
- BUGFIX: Fixed deprecation warning with latest libtorrent svn
|
||||
- COSMETIC: Improved some icons
|
||||
|
|
|
@ -511,7 +511,8 @@ void GUI::closeEvent(QCloseEvent *e) {
|
|||
|
||||
// Display window to create a torrent
|
||||
void GUI::on_actionCreate_torrent_triggered() {
|
||||
new createtorrent(this);
|
||||
createtorrent *ct = new createtorrent(this);
|
||||
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString path)));
|
||||
}
|
||||
|
||||
// Called when we minimize the program
|
||||
|
@ -742,6 +743,10 @@ void GUI::processParams(const QStringList& params) {
|
|||
}
|
||||
}
|
||||
|
||||
void GUI::addTorrent(QString path) {
|
||||
BTSession->addTorrent(path);
|
||||
}
|
||||
|
||||
void GUI::processScannedFiles(const QStringList& params) {
|
||||
QString param;
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
|
|
|
@ -127,6 +127,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||
void checkConnectionStatus();
|
||||
void configureSession(bool deleteOptions);
|
||||
void processParams(const QStringList& params);
|
||||
void addTorrent(QString path);
|
||||
void addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker);
|
||||
void processScannedFiles(const QStringList& params);
|
||||
void processDownloadedFiles(QString path, QString url);
|
||||
|
|
|
@ -358,10 +358,10 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
|||
// Decode torrent file
|
||||
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
||||
// Getting torrent file informations
|
||||
torrent_info t(e);
|
||||
qDebug(" -> Hash: %s", misc::toString(t.info_hash()).c_str());
|
||||
qDebug(" -> Name: %s", t.name().c_str());
|
||||
QString hash = misc::toQString(t.info_hash());
|
||||
boost::intrusive_ptr<torrent_info> t(new torrent_info(e));
|
||||
qDebug(" -> Hash: %s", misc::toString(t->info_hash()).c_str());
|
||||
qDebug(" -> Name: %s", t->name().c_str());
|
||||
QString hash = misc::toQString(t->info_hash());
|
||||
if(file.startsWith(torrentBackup.path())) {
|
||||
QFileInfo fi(file);
|
||||
QString old_hash = fi.baseName();
|
||||
|
@ -378,7 +378,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
|||
// return;
|
||||
}
|
||||
}
|
||||
if(s->find_torrent(t.info_hash()).is_valid()) {
|
||||
if(s->find_torrent(t->info_hash()).is_valid()) {
|
||||
qDebug("/!\\ Torrent is already in download list");
|
||||
// Update info Bar
|
||||
if(!fromScanDir) {
|
||||
|
@ -456,7 +456,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
|||
}
|
||||
// Incremental download
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".incremental")) {
|
||||
qDebug("Incremental download enabled for %s", t.name().c_str());
|
||||
qDebug("Incremental download enabled for %s", t->name().c_str());
|
||||
h.set_sequenced_download_threshold(1);
|
||||
}
|
||||
// Start torrent because it was added in paused state
|
||||
|
@ -1086,7 +1086,7 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h) {
|
|||
fs::path saveDir = h.save_path_boost();
|
||||
QString fileName = h.name();
|
||||
QString hash = h.hash();
|
||||
torrent_info t = h.get_torrent_info();
|
||||
boost::intrusive_ptr<torrent_info> t(new torrent_info(h.get_torrent_info()));
|
||||
qDebug("Reloading torrent: %s", fileName.toUtf8().data());
|
||||
entry resumeData;
|
||||
// Checking if torrentBackup Dir exists
|
||||
|
|
|
@ -5,22 +5,16 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>605</width>
|
||||
<height>588</height>
|
||||
<width>592</width>
|
||||
<height>590</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Torrent Creation Tool</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="createTorrent_title" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>587</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
|
@ -51,49 +45,45 @@
|
|||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>42</y>
|
||||
<width>597</width>
|
||||
<height>438</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_input" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>101</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Input file or directory:</string>
|
||||
<string>File or folder to add to the torrent:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textInputPath" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFile_button" >
|
||||
<property name="text" >
|
||||
<string>Add a file</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/add_file.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFolder_button" >
|
||||
<property name="text" >
|
||||
<string>Add a folder</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/add_folder.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_announce_url" >
|
||||
<property name="minimumSize" >
|
||||
|
@ -155,129 +145,22 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="input_list" >
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFolder_button" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeFolder_button" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFile_button" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="trackers_list" >
|
||||
|
@ -288,12 +171,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
@ -324,6 +216,9 @@
|
|||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/skin/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -343,6 +238,9 @@
|
|||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/skin/remove.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -364,12 +262,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="URLSeeds_list" >
|
||||
<property name="selectionMode" >
|
||||
|
@ -379,12 +286,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
@ -415,6 +331,9 @@
|
|||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/skin/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -434,6 +353,9 @@
|
|||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/skin/remove.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -455,12 +377,6 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="txt_comment" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>421</width>
|
||||
<height>102</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>421</width>
|
||||
|
@ -475,89 +391,108 @@
|
|||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="check_private" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>482</y>
|
||||
<width>587</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Private (won't be distributed on trackerless network / DHT if enabled)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>510</y>
|
||||
<width>587</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
<item>
|
||||
<widget class="QLabel" name="txtPieceSize" >
|
||||
<property name="text" >
|
||||
<string>Piece size:</string>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboPieceSize" >
|
||||
<property name="currentIndex" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_destination" >
|
||||
<property name="maximumSize" >
|
||||
<property name="text" >
|
||||
<string>32 KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>64 KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>128 KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>256 KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>512 KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1 MiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>2 MiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>4 MiB</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="check_private" >
|
||||
<property name="text" >
|
||||
<string>Destination torrent file:</string>
|
||||
<string>Private (won't be distributed on DHT network if enabled)</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>txt_destination</cstring>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkStartSeeding" >
|
||||
<property name="text" >
|
||||
<string>Start seeding after creation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txt_destination" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="browse_destination" >
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>546</y>
|
||||
<width>587</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
|
@ -575,7 +510,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="createButton" >
|
||||
<property name="text" >
|
||||
<string>Create</string>
|
||||
<string>Create and save...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -600,9 +535,12 @@
|
|||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="icons.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
|
|
|
@ -42,52 +42,20 @@ using namespace boost::filesystem;
|
|||
|
||||
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
|
||||
setupUi(this);
|
||||
addTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
||||
removeTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||
addURLSeed_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
||||
removeURLSeed_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||
removeFolder_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
|
||||
addFolder_button->setIcon(QIcon(QString::fromUtf8(":/Icons/add_folder.png")));
|
||||
addFile_button->setIcon(QIcon(QString::fromUtf8(":/Icons/add_file.png")));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
show();
|
||||
}
|
||||
|
||||
void createtorrent::on_browse_destination_clicked(){
|
||||
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), QDir::homePath(), tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
|
||||
if(!destination.isEmpty()){
|
||||
if(!destination.endsWith(QString::fromUtf8(".torrent")))
|
||||
destination += QString::fromUtf8(".torrent");
|
||||
txt_destination->setText(destination);
|
||||
}
|
||||
}
|
||||
|
||||
void createtorrent::on_addFolder_button_clicked(){
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), QDir::homePath(), QFileDialog::ShowDirsOnly);
|
||||
if(!dir.isEmpty()) {
|
||||
input_list->addItem(dir);
|
||||
addFolder_button->setEnabled(false);
|
||||
addFile_button->setEnabled(false);
|
||||
}
|
||||
if(!dir.isEmpty())
|
||||
textInputPath->setText(dir);
|
||||
}
|
||||
|
||||
void createtorrent::on_addFile_button_clicked(){
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), QDir::homePath(), QString(), 0, QFileDialog::ShowDirsOnly);
|
||||
if(!file.isEmpty()) {
|
||||
input_list->addItem(file);
|
||||
addFolder_button->setEnabled(false);
|
||||
addFile_button->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void createtorrent::on_removeFolder_button_clicked(){
|
||||
QModelIndexList selectedIndexes = input_list->selectionModel()->selectedIndexes();
|
||||
if(!selectedIndexes.size()) return;
|
||||
Q_ASSERT(selectedIndexes.size() == 1);
|
||||
QListWidgetItem *item = input_list->takeItem(selectedIndexes.first().row());
|
||||
delete item;
|
||||
addFolder_button->setEnabled(true);
|
||||
addFile_button->setEnabled(true);
|
||||
if(!file.isEmpty())
|
||||
textInputPath->setText(file);
|
||||
}
|
||||
|
||||
void createtorrent::on_removeTracker_button_clicked() {
|
||||
|
@ -98,6 +66,27 @@ void createtorrent::on_removeTracker_button_clicked(){
|
|||
}
|
||||
}
|
||||
|
||||
int createtorrent::getPieceSize() const {
|
||||
switch(comboPieceSize->currentIndex()) {
|
||||
case 0:
|
||||
return 32*1024;
|
||||
case 1:
|
||||
return 64*1024;
|
||||
case 2:
|
||||
return 128*1024;
|
||||
case 3:
|
||||
return 256*1024;
|
||||
case 4:
|
||||
return 512*1024;
|
||||
case 5:
|
||||
return 1024*1024;
|
||||
case 6:
|
||||
return 2048*1024;
|
||||
default:
|
||||
return 256*1024;
|
||||
}
|
||||
}
|
||||
|
||||
void createtorrent::on_addTracker_button_clicked() {
|
||||
bool ok;
|
||||
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
|
||||
|
@ -151,61 +140,67 @@ QStringList createtorrent::allItems(QListWidget *list){
|
|||
|
||||
// Main function that create a .torrent file
|
||||
void createtorrent::on_createButton_clicked(){
|
||||
QString destination = txt_destination->text();
|
||||
if(destination.isEmpty()){
|
||||
QMessageBox::critical(0, tr("No destination path set"), tr("Please type a destination path first"));
|
||||
QString input = textInputPath->text().trimmed();
|
||||
if(input.isEmpty() == 0){
|
||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||
return;
|
||||
}
|
||||
QStringList input = allItems(input_list);
|
||||
if(input.size() == 0){
|
||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||
QStringList trackers = allItems(trackers_list);
|
||||
if(!trackers.size()){
|
||||
QMessageBox::critical(0, tr("No tracker path set"), tr("Please set at least one tracker"));
|
||||
return;
|
||||
}
|
||||
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), QDir::homePath(), tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
|
||||
if(!destination.isEmpty()) {
|
||||
if(!destination.endsWith(QString::fromUtf8(".torrent")))
|
||||
destination += QString::fromUtf8(".torrent");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
char const* creator_str = "qBittorrent "VERSION;
|
||||
try {
|
||||
torrent_info t;
|
||||
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
||||
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
|
||||
path full_path;
|
||||
// Adding files to the torrent
|
||||
QString input_path;
|
||||
foreach(input_path, input){
|
||||
full_path = complete(path(input_path.toUtf8().data()));
|
||||
add_files(t, full_path.branch_path(), full_path.leaf());
|
||||
}
|
||||
int piece_size = 256 * 1024;
|
||||
t.set_piece_size(piece_size);
|
||||
full_path = complete(path(input.toUtf8().data()));
|
||||
add_files(*t, full_path.branch_path(), full_path.leaf());
|
||||
// Set piece size
|
||||
int piece_size = getPieceSize();
|
||||
t->set_piece_size(piece_size);
|
||||
// Add url seeds
|
||||
QStringList urlSeeds = allItems(URLSeeds_list);
|
||||
QString seed;
|
||||
foreach(seed, urlSeeds){
|
||||
t.add_url_seed(seed.toUtf8().data());
|
||||
t->add_url_seed(seed.toUtf8().data());
|
||||
}
|
||||
QStringList trackers = allItems(trackers_list);
|
||||
for(int i=0; i<trackers.size(); ++i){
|
||||
t.add_tracker(trackers.at(i).toUtf8().data());
|
||||
t->add_tracker(trackers.at(i).toUtf8().data());
|
||||
}
|
||||
|
||||
// calculate the hash for all pieces
|
||||
file_pool fp;
|
||||
boost::scoped_ptr<storage_interface> st(default_storage_constructor(t, full_path.branch_path(), fp));
|
||||
int num = t.num_pieces();
|
||||
int num = t->num_pieces();
|
||||
std::vector<char> buf(piece_size);
|
||||
for (int i = 0; i < num; ++i) {
|
||||
st->read(&buf[0], i, 0, t.piece_size(i));
|
||||
hasher h(&buf[0], t.piece_size(i));
|
||||
t.set_hash(i, h.final());
|
||||
st->read(&buf[0], i, 0, t->piece_size(i));
|
||||
hasher h(&buf[0], t->piece_size(i));
|
||||
t->set_hash(i, h.final());
|
||||
}
|
||||
// Set qBittorrent as creator and add user comment to
|
||||
// torrent_info structure
|
||||
t.set_creator(creator_str);
|
||||
t.set_comment((const char*)txt_comment->toPlainText().toUtf8());
|
||||
t->set_creator(creator_str);
|
||||
t->set_comment((const char*)txt_comment->toPlainText().toUtf8());
|
||||
// Is private ?
|
||||
if(check_private->isChecked()){
|
||||
t.set_priv(true);
|
||||
t->set_priv(true);
|
||||
}
|
||||
// create the torrent and print it to out
|
||||
entry e = t.create_torrent();
|
||||
entry e = t->create_torrent();
|
||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||
if(checkStartSeeding->isChecked())
|
||||
emit torrent_to_seed(destination);
|
||||
}
|
||||
catch (std::exception& e){
|
||||
std::cerr << e.what() << "\n";
|
||||
|
|
|
@ -30,13 +30,15 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{
|
|||
public:
|
||||
createtorrent(QWidget *parent = 0);
|
||||
QStringList allItems(QListWidget *list);
|
||||
int getPieceSize() const;
|
||||
|
||||
signals:
|
||||
void torrent_to_seed(QString path);
|
||||
|
||||
protected slots:
|
||||
void on_browse_destination_clicked();
|
||||
void on_createButton_clicked();
|
||||
void on_addFile_button_clicked();
|
||||
void on_addFolder_button_clicked();
|
||||
void on_removeFolder_button_clicked();
|
||||
void on_addTracker_button_clicked();
|
||||
void on_removeTracker_button_clicked();
|
||||
void on_addURLSeed_button_clicked();
|
||||
|
|
|
@ -204,6 +204,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkSpeedInTitle" >
|
||||
<property name="text" >
|
||||
<string>Display current speed in title bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue