Skip to content

Commit 1ad7dc5

Browse files
committed
version 1.0.2
1 parent 6ee1a6f commit 1ad7dc5

15 files changed

+85
-43
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.2 - 2013-03-18
2+
* Removed requirement to add trackers/webseeds (for DHT-only torrents)
3+
*
4+
15
# 1.0.1 - 2013-03-15
26
* Relicensed under BSD 2-clause license.
37

Diff for: LICENSE.txt renamed to LICENSE

File renamed without changes.

Diff for: createtorrent.cpp

+3-13
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@
2525

2626
#include "createtorrent.h"
2727

28-
#include <boost/version.hpp>
29-
#if BOOST_VERSION >= 104800
30-
#define BOOST_ASIO_DYN_LINK
31-
#endif
32-
33-
#include <libtorrent/version.hpp>
34-
#if LIBTORRENT_VERSION_MINOR < 16
35-
#define BOOST_FILESYSTEM_VERSION 2
36-
#endif
37-
3828
#include <fstream>
3929
#include <boost/filesystem/path.hpp>
4030
#include <boost/bind.hpp>
@@ -48,7 +38,7 @@ CreateTorrent::CreateTorrent(QObject *parent) :
4838
{
4939
}
5040

51-
void CreateTorrent::makeTorrentFiles(QString source, QString outputLocation, bool isBatch, QString announceUrls, QString webSeeds, QString comment, QString creator, int pieceSizeIndex, bool isPrivate) {
41+
void CreateTorrent::makeTorrentFiles(QString source, QString outputLocation, bool isBatch, QString announceUrls, QString webSeeds, QString comment, QString creator, int pieceSizeIndex, int flags, bool isPrivate) {
5242
this->source = source;
5343
this->outputLocation = outputLocation;
5444
this->isBatch = isBatch;
@@ -60,7 +50,7 @@ void CreateTorrent::makeTorrentFiles(QString source, QString outputLocation, boo
6050
this->pieceSize = 0;
6151
else
6252
this->pieceSize = 1024 * (2 << (pieceSizeIndex + 2));
63-
qDebug() << this->pieceSize;
53+
this->flags = flags;
6454
this->isPrivate = isPrivate;
6555
start();
6656

@@ -128,7 +118,7 @@ void CreateTorrent::run() {
128118

129119
file_storage fs;
130120
add_files(fs, input.toUtf8().constData(), file_filter);
131-
create_torrent torrent(fs, this->pieceSize);
121+
create_torrent torrent(fs, this->pieceSize, -1, this->flags);
132122
this->pieceCount = torrent.num_pieces();
133123

134124
foreach(const QString &webSeed, this->webSeeds) {

Diff for: createtorrent.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
#ifndef CREATETORRENT_H
2626
#define CREATETORRENT_H
2727

28+
#include <boost/version.hpp>
29+
#if BOOST_VERSION >= 104800
30+
#define BOOST_ASIO_DYN_LINK
31+
#endif
32+
33+
#include <libtorrent/version.hpp>
34+
#if LIBTORRENT_VERSION_MINOR < 16
35+
#define BOOST_FILESYSTEM_VERSION 2
36+
#endif
37+
2838
#include <QThread>
2939
#include <QStringList>
3040

@@ -33,7 +43,7 @@ class CreateTorrent : public QThread
3343
Q_OBJECT
3444
public:
3545
explicit CreateTorrent(QObject *parent = 0);
36-
void makeTorrentFiles(QString source, QString outputLocation, bool isBatch, QString announceUrls, QString webSeeds, QString comment, QString creator, int pieceSizeIndex, bool isPrivate);
46+
void makeTorrentFiles(QString source, QString outputLocation, bool isBatch, QString announceUrls, QString webSeeds, QString comment, QString creator, int pieceSizeIndex, int flags, bool isPrivate);
3747
void sendProgressSignal(int i);
3848
signals:
3949
void updateProgress(int i);
@@ -51,6 +61,7 @@ public slots:
5161
QString comment;
5262
QString creator;
5363
int pieceSize;
64+
int flags;
5465
bool isPrivate;
5566
int pieceCount;
5667

Diff for: creationpage.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "creationpage.h"
2727
#include "ui_creationpage.h"
2828
#include "createtorrent.h"
29+
#include "version.h"
30+
#include <libtorrent/create_torrent.hpp>
2931
#include <QtGui>
3032

3133
CreationPage::CreationPage(QWidget *parent) :
@@ -57,5 +59,12 @@ void CreationPage::initializePage() {
5759
connect(ctThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgress(int)));
5860
connect(ctThread, SIGNAL(logStatusMessage(QString)), this, SLOT(logAddedFile(QString)));
5961
connect(ctThread, SIGNAL(finished()), this, SLOT(setFinishedText()));
60-
ctThread->makeTorrentFiles(field("inputPath").toString(), field("outputPath").toString(), field("batchMode").toBool(), field("announceUrls").toString(), field("webSeeds").toString(), field("comment").toString(), field("creator").toString(), field("pieceSize").toInt(), field("privateTorrent").toBool());
62+
63+
using namespace libtorrent;
64+
65+
int includeFileModTimes = field("includeFileModTimes").toBool() ? create_torrent::modification_time : 0;
66+
int includeSymlinks = field("includeSymlinks").toBool() ? create_torrent::symlinks : 0;
67+
int flags = includeFileModTimes | includeSymlinks;
68+
69+
ctThread->makeTorrentFiles(field("inputPath").toString(), field("outputPath").toString(), field("batchMode").toBool(), field("announceUrls").toString(), field("webSeeds").toString(), field("comment").toString(), QString("%1 %2").arg(PROGRAM_NAME, PROGRAM_VERSION), field("pieceSize").toInt(), flags, field("privateTorrent").toBool());
6170
}

Diff for: outputpage.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ OutputPage::OutputPage(QWidget *parent) :
4040
}
4141

4242
void OutputPage::initializePage() {
43-
QFileInfo inputInfo(field("inputPath").toString());
43+
inputInfo = QFileInfo(field("inputPath").toString());
4444
showSaveDir = inputInfo.isDir() && field("batchMode").toBool();
4545
if(showSaveDir)
4646
ui->description->setText("Choose a directory to save the torrent files in.");
@@ -52,6 +52,7 @@ void OutputPage::browseOutputLocation() {
5252
QFileDialog dialog(this);
5353
dialog.setAcceptMode(QFileDialog::AcceptSave);
5454
if(!showSaveDir) {
55+
dialog.selectFile(inputInfo.baseName() + ".torrent");
5556
dialog.setDefaultSuffix("torrent");
5657
dialog.setNameFilter("Torrent file (*.torrent)");
5758
}

Diff for: outputpage.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public slots:
4646
private:
4747
Ui::OutputPage *ui;
4848
bool showSaveDir;
49+
QFileInfo inputInfo;
4950
};
5051

5152
#endif // OUTPUTPAGE_H

Diff for: propertiespage.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ PropertiesPage::PropertiesPage(QWidget *parent) :
3535
ui->setupUi(this);
3636

3737
registerField("comment", ui->comment);
38-
registerField("creator", ui->creator);
3938
registerField("pieceSize", ui->pieceSize);
39+
registerField("includeFileModTimes", ui->includeFileModTimes);
40+
registerField("includeSymlinks", ui->includeSymlinks);
4041
registerField("privateTorrent", ui->privateTorrent);
4142

42-
ui->creator->setText(QString("%1 %2").arg(PROGRAM_NAME, PROGRAM_VERSION));
4343
}
4444

4545
void PropertiesPage::initializePage() {

Diff for: propertiespage.ui

+37-11
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,14 @@
4444
<item>
4545
<widget class="QLineEdit" name="comment"/>
4646
</item>
47-
<item>
48-
<widget class="QLabel" name="creatorLabel">
49-
<property name="text">
50-
<string>Creator</string>
51-
</property>
52-
</widget>
53-
</item>
54-
<item>
55-
<widget class="QLineEdit" name="creator"/>
56-
</item>
5747
<item>
5848
<layout class="QHBoxLayout" name="horizontalLayout">
5949
<item>
60-
<widget class="QComboBox" name="pieceSize"/>
50+
<widget class="QComboBox" name="pieceSize">
51+
<property name="toolTip">
52+
<string>If set to&quot;auto,&quot; a piece size will be calculated such that the torrent file is roughly 40 kB.</string>
53+
</property>
54+
</widget>
6155
</item>
6256
<item>
6357
<widget class="QLabel" name="pieceSizeLabel">
@@ -68,8 +62,40 @@
6862
</item>
6963
</layout>
7064
</item>
65+
<item>
66+
<widget class="QCheckBox" name="includeFileModTimes">
67+
<property name="toolTip">
68+
<string>This will include the file modification time as part of the torrent.
69+
This is not enabled by default, as it might cause problems
70+
when you create a torrent from separate files with the same content,
71+
hoping to yield the same info-hash. If the files have different
72+
modification times, with this option enabled, you would get
73+
different info-hashes for the files.</string>
74+
</property>
75+
<property name="text">
76+
<string>Include file modification times</string>
77+
</property>
78+
</widget>
79+
</item>
80+
<item>
81+
<widget class="QCheckBox" name="includeSymlinks">
82+
<property name="toolTip">
83+
<string>If this flag is set, files that are symlinks get a symlink attribute set on
84+
them and their data will not be included in the torrent.
85+
This is useful if you need to reconstruct a file hierarchy which
86+
contains symlinks.</string>
87+
</property>
88+
<property name="text">
89+
<string>Include symlinks</string>
90+
</property>
91+
</widget>
92+
</item>
7193
<item>
7294
<widget class="QCheckBox" name="privateTorrent">
95+
<property name="toolTip">
96+
<string>Sets the private flag, which instructs torrent clients to
97+
not use DHT or PEX.</string>
98+
</property>
7399
<property name="text">
74100
<string>Private torrent</string>
75101
</property>

Diff for: qMakeTorrent.pro

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ FORMS += \
4242
LIBS += -lboost_system -ltorrent-rasterbar -lboost_filesystem
4343

4444
OTHER_FILES += \
45-
readme.md
45+
readme.md \
46+
README.md \
47+
CHANGELOG.md \
48+
LICENSE

Diff for: trackerspage.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ TrackersPage::TrackersPage(QWidget *parent) :
3535
registerField("announceUrls", ui->announceUrls, "plainText");
3636
registerField("webSeeds", ui->webSeeds, "plainText");
3737

38-
connect(ui->announceUrls, SIGNAL(textChanged()), this, SIGNAL(completeChanged()));
39-
connect(ui->webSeeds, SIGNAL(textChanged()), this, SIGNAL(completeChanged()));
40-
}
41-
42-
bool TrackersPage::isComplete() const {
43-
if(ui->announceUrls->toPlainText().length() != 0 || ui->webSeeds->toPlainText().length() != 0)
44-
return true;
45-
return false;
4638
}
4739

4840
TrackersPage::~TrackersPage()

Diff for: trackerspage.h

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class TrackersPage : public QWizardPage
3939
explicit TrackersPage(QWidget *parent = 0);
4040
~TrackersPage();
4141

42-
bool isComplete() const;
43-
4442
public slots:
4543

4644
private:

Diff for: trackerspage.ui

+7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
<item>
3535
<widget class="QPlainTextEdit" name="webSeeds"/>
3636
</item>
37+
<item>
38+
<widget class="QLabel" name="dhtOnlyLabel">
39+
<property name="text">
40+
<string>You may leave both fields blank for a DHT/PEX-only torrent.</string>
41+
</property>
42+
</widget>
43+
</item>
3744
</layout>
3845
</widget>
3946
<resources/>

Diff for: version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define VERSION_H
2727

2828
#define PROGRAM_NAME "qMakeTorrent"
29-
#define PROGRAM_VERSION "1.0.1"
29+
#define PROGRAM_VERSION "1.0.2"
3030
#define PROGRAM_URL "http://whitehat2k9.github.com/qMakeTorrent"
3131

3232
#endif

Diff for: wizard.ui

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>400</width>
10-
<height>300</height>
9+
<width>447</width>
10+
<height>309</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">

0 commit comments

Comments
 (0)