Browse Source

FEATURE: Remember the last trackers used in the torrent creation tool

FEATURE: The optimal piece size is now automatically computed in the torrent creation tool
 COSMETIC: Improved the torrent creation tool appearance
adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
3ecc8c8d67
  1. 3
      Changelog
  2. 36
      src/misc.cpp
  3. 2
      src/misc.h
  4. 4
      src/src.pro
  5. 330
      src/torrentcreator/createtorrent.ui
  6. 10
      src/torrentcreator/torrentcreator.pri
  7. 252
      src/torrentcreator/torrentcreatordlg.cpp
  8. 58
      src/torrentcreator/torrentcreatordlg.h
  9. 123
      src/torrentcreator/torrentcreatorthread.cpp
  10. 73
      src/torrentcreator/torrentcreatorthread.h
  11. 545
      src/ui/createtorrent.ui

3
Changelog

@ -4,7 +4,10 @@
- FEATURE: Added a torrent import assistant to seed or keep downloading outside torrents - FEATURE: Added a torrent import assistant to seed or keep downloading outside torrents
- FEATURE: qBittorrent can update itself from Sourceforge (Windows/Mac OS X only) - FEATURE: qBittorrent can update itself from Sourceforge (Windows/Mac OS X only)
- FEATURE: Added a transfer list column to display the current tracker - FEATURE: Added a transfer list column to display the current tracker
- FEATURE: Remember the last trackers used in the torrent creation tool
- FEATURE: The optimal piece size is now automatically computed in the torrent creation tool
- COSMETIC: Replaced message box by on-screen notification for download errors - COSMETIC: Replaced message box by on-screen notification for download errors
- COSMETIC: Improved the torrent creation tool appearance
* Tue Aug 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.0 * Tue Aug 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.0
- FEATURE: Added actions to "Move to top/bottom" of priority queue - FEATURE: Added actions to "Move to top/bottom" of priority queue

36
src/misc.cpp

@ -80,9 +80,9 @@ QString misc::QDesktopServicesDataLocation() {
#if defined Q_WS_WINCE #if defined Q_WS_WINCE
if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE))
#else #else
if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE))
#endif #endif
result = QString::fromWCharArray(path); result = QString::fromWCharArray(path);
if (!QCoreApplication::applicationName().isEmpty()) if (!QCoreApplication::applicationName().isEmpty())
result = result + QLatin1String("\\") + qApp->applicationName(); result = result + QLatin1String("\\") + qApp->applicationName();
if(!result.endsWith("\\")) if(!result.endsWith("\\"))
@ -106,7 +106,7 @@ QString misc::QDesktopServicesDataLocation() {
if (xdgDataHome.isEmpty()) if (xdgDataHome.isEmpty())
xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
xdgDataHome += QLatin1String("/data/") xdgDataHome += QLatin1String("/data/")
+ qApp->applicationName(); + qApp->applicationName();
return xdgDataHome; return xdgDataHome;
#endif #endif
#endif #endif
@ -158,7 +158,7 @@ long long misc::freeDiskSpaceOnPath(QString path) {
const int ret = statfs (qPrintable(statfs_path), &stats) ; const int ret = statfs (qPrintable(statfs_path), &stats) ;
if(ret == 0) { if(ret == 0) {
available = ((unsigned long long)stats.f_bavail) * available = ((unsigned long long)stats.f_bavail) *
((unsigned long long)stats.f_bsize) ; ((unsigned long long)stats.f_bsize) ;
return available; return available;
} else { } else {
return -1; return -1;
@ -170,10 +170,10 @@ long long misc::freeDiskSpaceOnPath(QString path) {
PULARGE_INTEGER); PULARGE_INTEGER);
GetDiskFreeSpaceEx_t GetDiskFreeSpaceEx_t
pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
( (
::GetModuleHandle(TEXT("kernel32.dll")), ::GetModuleHandle(TEXT("kernel32.dll")),
"GetDiskFreeSpaceExW" "GetDiskFreeSpaceExW"
); );
if ( pGetDiskFreeSpaceEx ) if ( pGetDiskFreeSpaceEx )
{ {
ULARGE_INTEGER bytesFree, bytesTotal; ULARGE_INTEGER bytesFree, bytesTotal;
@ -220,7 +220,7 @@ void misc::shutdownComputer() {
AEDisposeDesc(&targetDesc); AEDisposeDesc(&targetDesc);
if (error != noErr) if (error != noErr)
{ {
return; return;
} }
error = AESend(&appleEventToSend, &eventReply, kAENoReply, error = AESend(&appleEventToSend, &eventReply, kAENoReply,
@ -730,3 +730,21 @@ QList<bool> misc::boolListfromStringList(const QStringList &l) {
} }
return ret; return ret;
} }
quint64 misc::computePathSize(QString path)
{
// Check if it is a file
QFileInfo fi(path);
if(!fi.exists()) return 0;
if(fi.isFile()) return fi.size();
// Compute folder size
quint64 size = 0;
foreach(const QFileInfo &subfi, QDir(path).entryInfoList(QDir::Dirs|QDir::Files)) {
if(subfi.fileName().startsWith(".")) continue;
if(subfi.isDir())
size += misc::computePathSize(subfi.absoluteFilePath());
else
size += subfi.size();
}
return size;
}

2
src/misc.h

@ -117,6 +117,8 @@ public:
return MyFile.remove(); return MyFile.remove();
} }
static quint64 computePathSize(QString path);
static QString truncateRootFolder(boost::intrusive_ptr<torrent_info> t); static QString truncateRootFolder(boost::intrusive_ptr<torrent_info> t);
static QString truncateRootFolder(torrent_handle h); static QString truncateRootFolder(torrent_handle h);

4
src/src.pro

@ -309,7 +309,6 @@ contains(DEFINES, DISABLE_GUI) {
cookiesdlg.h \ cookiesdlg.h \
hidabletabwidget.h \ hidabletabwidget.h \
sessionapplication.h \ sessionapplication.h \
torrentcreatordlg.h \
torrentimportdlg.h torrentimportdlg.h
win32 { win32 {
@ -349,13 +348,13 @@ include(tracker/tracker.pri)
include(properties/properties.pri) include(properties/properties.pri)
include(searchengine/searchengine.pri) include(searchengine/searchengine.pri)
include(rss/rss.pri) include(rss/rss.pri)
include(torrentcreator/torrentcreator.pri)
} }
!contains(DEFINES, DISABLE_GUI) { !contains(DEFINES, DISABLE_GUI) {
FORMS += ui/mainwindow.ui \ FORMS += ui/mainwindow.ui \
ui/options.ui \ ui/options.ui \
ui/about.ui \ ui/about.ui \
ui/createtorrent.ui \
ui/preview.ui \ ui/preview.ui \
ui/login.ui \ ui/login.ui \
ui/downloadfromurldlg.ui \ ui/downloadfromurldlg.ui \
@ -384,7 +383,6 @@ SOURCES += main.cpp \
cookiesdlg.cpp \ cookiesdlg.cpp \
torrentadditiondlg.cpp \ torrentadditiondlg.cpp \
sessionapplication.cpp \ sessionapplication.cpp \
torrentcreatordlg.cpp \
torrentimportdlg.cpp torrentimportdlg.cpp
win32 { win32 {

330
src/torrentcreator/createtorrent.ui

@ -0,0 +1,330 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>createTorrentDialog</class>
<widget class="QDialog" name="createTorrentDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>658</height>
</rect>
</property>
<property name="windowTitle">
<string>Torrent Creation Tool</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="createTorrent_title">
<property name="minimumSize">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>27</height>
</size>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>14</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text">
<string>Torrent file creation</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_input">
<property name="text">
<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 file</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/document-new.png</normaloff>:/Icons/oxygen/document-new.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addFolder_button">
<property name="text">
<string>Add folder</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/folder-new.png</normaloff>:/Icons/oxygen/folder-new.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lbl_announce_url">
<property name="text">
<string>Tracker URLs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring></cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="urlSeeds_lbl">
<property name="text">
<string>Web seeds urls:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_comment">
<property name="text">
<string>Comment:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>txt_comment</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QTextEdit" name="txt_comment">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QTextEdit" name="trackers_list">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QTextEdit" name="URLSeeds_list">
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="txtPieceSize">
<property name="text">
<string>Piece size:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboPieceSize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<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>
<widget class="QCheckBox" name="checkAutoPieceSize">
<property name="text">
<string>Auto</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="check_private">
<property name="text">
<string>Private (won't be distributed on DHT network if enabled)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkStartSeeding">
<property name="text">
<string>Start seeding after creation</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="progressLbl">
<property name="text">
<string>Progress:</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create and save...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

10
src/torrentcreator/torrentcreator.pri

@ -0,0 +1,10 @@
INCLUDEPATH += $$PWD
FORMS += $$PWD/createtorrent.ui
HEADERS += $$PWD/torrentcreatordlg.h \
$$PWD/torrentcreatorthread.h
SOURCES += $$PWD/torrentcreatordlg.cpp \
$$PWD/torrentcreatorthread.cpp

252
src/torrentcreatordlg.cpp → src/torrentcreator/torrentcreatordlg.cpp

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2010 Christophe Dumez
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,52 +32,29 @@
#include <QMessageBox> #include <QMessageBox>
#include <QInputDialog> #include <QInputDialog>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/bind.hpp>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/file.hpp>
#include <libtorrent/storage.hpp>
#include <libtorrent/hasher.hpp>
#include <libtorrent/file_pool.hpp>
#include <libtorrent/create_torrent.hpp>
#include "torrentpersistentdata.h" #include "torrentpersistentdata.h"
#include "torrentcreatordlg.h" #include "torrentcreatordlg.h"
#include "misc.h" #include "misc.h"
#include "qinisettings.h" #include "qinisettings.h"
#include "torrentcreatorthread.h"
using namespace libtorrent; const uint NB_PIECES_MIN = 1200;
using namespace boost::filesystem; const uint NB_PIECES_MAX = 2200;
// do not include files and folders whose
// name starts with a .
bool file_filter(boost::filesystem::path const& filename)
{
if (filename.leaf()[0] == '.') return false;
std::cerr << filename << std::endl;
return true;
}
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent){ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent), creatorThread(0) {
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setModal(true); setModal(true);
creatorThread = new torrentCreatorThread(this); showProgressBar(false);
connect(creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString))); loadTrackerList();
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString))); // Piece sizes
connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int))); m_piece_sizes << 32 << 64 << 128 << 256 << 512 << 1024 << 2048 << 4096;
path::default_name_check(no_check);
show(); show();
} }
TorrentCreatorDlg::~TorrentCreatorDlg() { TorrentCreatorDlg::~TorrentCreatorDlg() {
delete creatorThread; if(creatorThread)
delete creatorThread;
} }
void TorrentCreatorDlg::on_addFolder_button_clicked(){ void TorrentCreatorDlg::on_addFolder_button_clicked(){
@ -90,6 +67,9 @@ void TorrentCreatorDlg::on_addFolder_button_clicked(){
dir = dir.replace("/", "\\"); dir = dir.replace("/", "\\");
#endif #endif
textInputPath->setText(dir); textInputPath->setText(dir);
// Update piece size
if(checkAutoPieceSize->isChecked())
updateOptimalPieceSize();
} }
} }
@ -103,75 +83,14 @@ void TorrentCreatorDlg::on_addFile_button_clicked(){
file = file.replace("/", "\\"); file = file.replace("/", "\\");
#endif #endif
textInputPath->setText(file); textInputPath->setText(file);
} // Update piece size
} if(checkAutoPieceSize->isChecked())
updateOptimalPieceSize();
void TorrentCreatorDlg::on_removeTracker_button_clicked() {
QModelIndexList selectedIndexes = trackers_list->selectionModel()->selectedIndexes();
for(int i=selectedIndexes.size()-1; i>=0; --i){
QListWidgetItem *item = trackers_list->takeItem(selectedIndexes.at(i).row());
delete item;
} }
} }
int TorrentCreatorDlg::getPieceSize() const { int TorrentCreatorDlg::getPieceSize() const {
switch(comboPieceSize->currentIndex()) { return m_piece_sizes.at(comboPieceSize->currentIndex())*1024;
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 TorrentCreatorDlg::on_addTracker_button_clicked() {
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
"http://", &ok);
if(ok){
if(trackers_list->findItems(URL, Qt::MatchFixedString).size() == 0)
trackers_list->addItem(URL);
}
}
void TorrentCreatorDlg::on_removeURLSeed_button_clicked(){
QModelIndexList selectedIndexes = URLSeeds_list->selectionModel()->selectedIndexes();
for(int i=selectedIndexes.size()-1; i>=0; --i){
QListWidgetItem *item = URLSeeds_list->takeItem(selectedIndexes.at(i).row());
delete item;
}
}
void TorrentCreatorDlg::on_addURLSeed_button_clicked(){
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type a web seed url"),
tr("Web seed URL:"), QLineEdit::Normal,
"http://", &ok);
if(ok){
if(URLSeeds_list->findItems(URL, Qt::MatchFixedString).size() == 0)
URLSeeds_list->addItem(URL);
}
}
QStringList TorrentCreatorDlg::allItems(QListWidget *list){
QStringList res;
unsigned int nbItems = list->count();
for(unsigned int i=0; i< nbItems; ++i){
res << list->item(i)->text();
}
return res;
} }
// Main function that create a .torrent file // Main function that create a .torrent file
@ -183,7 +102,9 @@ void TorrentCreatorDlg::on_createButton_clicked(){
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first")); QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
return; return;
} }
QStringList trackers = allItems(trackers_list); QStringList trackers = trackers_list->toPlainText().split("\n");
if(!trackers_list->toPlainText().trimmed().isEmpty())
saveTrackerList();
QIniSettings settings("qBittorrent", "qBittorrent"); QIniSettings settings("qBittorrent", "qBittorrent");
QString last_path = settings.value("CreateTorrent/last_save_path", QDir::homePath()).toString(); QString last_path = settings.value("CreateTorrent/last_save_path", QDir::homePath()).toString();
@ -197,26 +118,30 @@ void TorrentCreatorDlg::on_createButton_clicked(){
return; return;
} }
// Disable dialog // Disable dialog
setEnabled(false); setInteractionEnabled(false);
showProgressBar(true);
// Set busy cursor // Set busy cursor
setCursor(QCursor(Qt::WaitCursor)); setCursor(QCursor(Qt::WaitCursor));
// Actually create the torrent // Actually create the torrent
QStringList url_seeds = allItems(URLSeeds_list); QStringList url_seeds = URLSeeds_list->toPlainText().split("\n");
QString comment = txt_comment->toPlainText(); QString comment = txt_comment->toPlainText();
// Create the creator thread
creatorThread = new TorrentCreatorThread(this);
connect(creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
creatorThread->create(input, destination, trackers, url_seeds, comment, check_private->isChecked(), getPieceSize()); creatorThread->create(input, destination, trackers, url_seeds, comment, check_private->isChecked(), getPieceSize());
} }
void TorrentCreatorDlg::handleCreationFailure(QString msg) { void TorrentCreatorDlg::handleCreationFailure(QString msg) {
// Enable dialog
setEnabled(true);
// Remove busy cursor // Remove busy cursor
setCursor(QCursor(Qt::ArrowCursor)); setCursor(QCursor(Qt::ArrowCursor));
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg)); QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg));
setInteractionEnabled(true);
showProgressBar(false);
} }
void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path) { void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path) {
// Enable Dialog
setEnabled(true);
// Remove busy cursor // Remove busy cursor
setCursor(QCursor(Qt::ArrowCursor)); setCursor(QCursor(Qt::ArrowCursor));
if(checkStartSeeding->isChecked()) { if(checkStartSeeding->isChecked()) {
@ -248,7 +173,7 @@ void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path)
void TorrentCreatorDlg::on_cancelButton_clicked() { void TorrentCreatorDlg::on_cancelButton_clicked() {
// End torrent creation thread // End torrent creation thread
if(creatorThread->isRunning()) { if(creatorThread && creatorThread->isRunning()) {
creatorThread->abortCreation(); creatorThread->abortCreation();
creatorThread->terminate(); creatorThread->terminate();
// Wait for termination // Wait for termination
@ -262,66 +187,69 @@ void TorrentCreatorDlg::updateProgressBar(int progress) {
progressBar->setValue(progress); progressBar->setValue(progress);
} }
// void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
// Torrent Creator Thread {
// textInputPath->setEnabled(enabled);
addFile_button->setEnabled(enabled);
void torrentCreatorThread::create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size) { addFolder_button->setEnabled(enabled);
input_path = _input_path; trackers_list->setEnabled(enabled);
save_path = _save_path; URLSeeds_list->setEnabled(enabled);
trackers = _trackers; txt_comment->setEnabled(enabled);
url_seeds = _url_seeds; comboPieceSize->setEnabled(enabled);
comment = _comment; check_private->setEnabled(enabled);
is_private = _is_private; checkStartSeeding->setEnabled(enabled);
piece_size = _piece_size; createButton->setEnabled(enabled);
abort = false; //cancelButton->setEnabled(!enabled);
start(); }
void TorrentCreatorDlg::showProgressBar(bool show)
{
progressLbl->setVisible(show);
progressBar->setVisible(show);
} }
void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){ void TorrentCreatorDlg::on_checkAutoPieceSize_clicked(bool checked)
parent->sendProgressSignal((int)(i*100./(float)num)); {
comboPieceSize->setEnabled(!checked);
if(checked) {
updateOptimalPieceSize();
}
} }
void torrentCreatorThread::sendProgressSignal(int progress) { void TorrentCreatorDlg::updateOptimalPieceSize()
emit updateProgress(progress); {
quint64 torrent_size = misc::computePathSize(textInputPath->text());
qDebug("Torrent size is %lld", torrent_size);
if(torrent_size == 0) return;
int i = 0;
qulonglong nb_pieces = 0;
do {
nb_pieces = (double)torrent_size/(m_piece_sizes.at(i)*1024.);
qDebug("nb_pieces=%lld with piece_size=%s", nb_pieces, qPrintable(comboPieceSize->itemText(i)));
if(nb_pieces <= NB_PIECES_MIN) {
if(i > 1)
--i;
break;
}
if(nb_pieces < NB_PIECES_MAX) {
qDebug("Good, nb_pieces=%lld < %d", nb_pieces, NB_PIECES_MAX);
break;
}
++i;
}while(i<m_piece_sizes.size());
qDebug("ASSERT value %d <= %d", (int)(torrent_size/(m_piece_sizes.at(i)*1024.)), NB_PIECES_MIN);
Q_ASSERT((double)torrent_size/(m_piece_sizes.at(i)*1024.) > NB_PIECES_MIN);
comboPieceSize->setCurrentIndex(i);
} }
void torrentCreatorThread::run() { void TorrentCreatorDlg::saveTrackerList()
emit updateProgress(0); {
char const* creator_str = "qBittorrent "VERSION; QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
try { settings.setValue("CreateTorrent/TrackerList", trackers_list->toPlainText());
file_storage fs; }
path full_path = complete(path(input_path.toUtf8().constData()));
// Adding files to the torrent
add_files(fs, full_path, file_filter);
if(abort) return;
create_torrent t(fs, piece_size);
// Add url seeds void TorrentCreatorDlg::loadTrackerList()
QString seed; {
foreach(seed, url_seeds){ QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
t.add_url_seed(seed.toLocal8Bit().data()); trackers_list->setPlainText(settings.value("CreateTorrent/TrackerList", "").toString());
}
for(int i=0; i<trackers.size(); ++i){
t.add_tracker(trackers.at(i).toLocal8Bit().data());
}
if(abort) return;
// calculate the hash for all pieces
set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
// Set qBittorrent as creator and add user comment to
// torrent_info structure
t.set_creator(creator_str);
t.set_comment((const char*)comment.toUtf8());
// Is private ?
t.set_priv(is_private);
if(abort) return;
// create the torrent and print it to out
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary);
bencode(std::ostream_iterator<char>(out), t.generate());
emit updateProgress(100);
emit creationSuccess(save_path, QString::fromUtf8(full_path.branch_path().string().c_str()));
}
catch (std::exception& e){
emit creationFailure(QString::fromUtf8(e.what()));
}
} }

58
src/torrentcreatordlg.h → src/torrentcreator/torrentcreatordlg.h

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2010 Christophe Dumez
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -31,56 +31,16 @@
#ifndef CREATE_TORRENT_IMP_H #ifndef CREATE_TORRENT_IMP_H
#define CREATE_TORRENT_IMP_H #define CREATE_TORRENT_IMP_H
#include <QThread>
#include "ui_createtorrent.h" #include "ui_createtorrent.h"
class torrentCreatorThread : public QThread { class TorrentCreatorThread;
Q_OBJECT
QString input_path;
QString save_path;
QStringList trackers;
QStringList url_seeds;
QString comment;
bool is_private;
int piece_size;
bool abort;
QDialog *parent;
public:
torrentCreatorThread(QDialog *_parent) {
parent = _parent;
}
~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);
void sendProgressSignal(int progress);
void abortCreation() { abort = true; }
protected:
void run();
signals:
void creationFailure(QString msg);
void creationSuccess(QString path, QString branch_path);
signals:
void updateProgress(int progress);
};
class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{ class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{
Q_OBJECT Q_OBJECT
private:
torrentCreatorThread *creatorThread;
public: public:
TorrentCreatorDlg(QWidget *parent = 0); TorrentCreatorDlg(QWidget *parent = 0);
~TorrentCreatorDlg(); ~TorrentCreatorDlg();
QStringList allItems(QListWidget *list);
int getPieceSize() const; int getPieceSize() const;
signals: signals:
@ -94,12 +54,18 @@ class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{
void on_createButton_clicked(); void on_createButton_clicked();
void on_addFile_button_clicked(); void on_addFile_button_clicked();
void on_addFolder_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();
void handleCreationFailure(QString msg); void handleCreationFailure(QString msg);
void handleCreationSuccess(QString path, QString branch_path); void handleCreationSuccess(QString path, QString branch_path);
void setInteractionEnabled(bool enabled);
void showProgressBar(bool show);
void on_checkAutoPieceSize_clicked(bool checked);
void updateOptimalPieceSize();
void saveTrackerList();
void loadTrackerList();
private:
TorrentCreatorThread *creatorThread;
QList<int> m_piece_sizes;
}; };
#endif #endif

123
src/torrentcreator/torrentcreatorthread.cpp

@ -0,0 +1,123 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2010 Christophe Dumez
*
* 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.
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/bind.hpp>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/file.hpp>
#include <libtorrent/storage.hpp>
#include <libtorrent/hasher.hpp>
#include <libtorrent/file_pool.hpp>
#include <libtorrent/create_torrent.hpp>
#include <QFile>
#include "torrentcreatorthread.h"
#include "misc.h"
using namespace libtorrent;
using namespace boost::filesystem;
// do not include files and folders whose
// name starts with a .
bool file_filter(boost::filesystem::path const& filename)
{
if (filename.leaf()[0] == '.') return false;
std::cerr << filename << std::endl;
return true;
}
void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size)
{
input_path = _input_path;
save_path = _save_path;
if(QFile(save_path).exists())
misc::safeRemove(save_path);
trackers = _trackers;
url_seeds = _url_seeds;
comment = _comment;
is_private = _is_private;
piece_size = _piece_size;
path::default_name_check(no_check);
abort = false;
start();
}
void sendProgressUpdateSignal(int i, int num, TorrentCreatorThread *parent){
parent->sendProgressSignal((int)(i*100./(float)num));
}
void TorrentCreatorThread::sendProgressSignal(int progress) {
emit updateProgress(progress);
}
void TorrentCreatorThread::run() {
emit updateProgress(0);
char const* creator_str = "qBittorrent "VERSION;
try {
file_storage fs;
path full_path = complete(path(input_path.toUtf8().constData()));
// Adding files to the torrent
add_files(fs, full_path, file_filter);
if(abort) return;
create_torrent t(fs, piece_size);
// Add url seeds
foreach(const QString &seed, url_seeds){
t.add_url_seed(seed.trimmed().toLocal8Bit().data());
}
foreach(const QString &tracker, trackers) {
t.add_tracker(tracker.trimmed().toLocal8Bit().data());
}
if(abort) return;
// calculate the hash for all pieces
set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
// Set qBittorrent as creator and add user comment to
// torrent_info structure
t.set_creator(creator_str);
t.set_comment((const char*)comment.toUtf8());
// Is private ?
t.set_priv(is_private);
if(abort) return;
// create the torrent and print it to out
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary);
bencode(std::ostream_iterator<char>(out), t.generate());
emit updateProgress(100);
emit creationSuccess(save_path, QString::fromUtf8(full_path.branch_path().string().c_str()));
}
catch (std::exception& e){
emit creationFailure(QString::fromUtf8(e.what()));
}
}

73
src/torrentcreator/torrentcreatorthread.h

@ -0,0 +1,73 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2010 Christophe Dumez
*
* 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.
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef TORRENTCREATORTHREAD_H
#define TORRENTCREATORTHREAD_H
#include <QThread>
#include <QStringList>
#include <QDialog>
class TorrentCreatorThread : public QThread {
Q_OBJECT
public:
TorrentCreatorThread(QDialog *_parent) {
parent = _parent;
}
~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);
void sendProgressSignal(int progress);
void abortCreation() { abort = true; }
protected:
void run();
signals:
void creationFailure(QString msg);
void creationSuccess(QString path, QString branch_path);
void updateProgress(int progress);
private:
QString input_path;
QString save_path;
QStringList trackers;
QStringList url_seeds;
QString comment;
bool is_private;
int piece_size;
bool abort;
QDialog *parent;
};
#endif // TORRENTCREATORTHREAD_H

545
src/ui/createtorrent.ui

@ -1,545 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>createTorrentDialog</class>
<widget class="QDialog" name="createTorrentDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>658</height>
</rect>
</property>
<property name="windowTitle">
<string>Torrent Creation Tool</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="createTorrent_title">
<property name="minimumSize">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>27</height>
</size>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>14</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text">
<string>Torrent file creation</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_input">
<property name="text">
<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 file</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/document-new.png</normaloff>:/Icons/oxygen/document-new.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addFolder_button">
<property name="text">
<string>Add folder</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/folder-new.png</normaloff>:/Icons/oxygen/folder-new.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">
<size>
<width>0</width>
<height>102</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
</size>
</property>
<property name="text">
<string>Announce urls (trackers):</string>
</property>
<property name="buddy">
<cstring></cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="urlSeeds_lbl">
<property name="minimumSize">
<size>
<width>0</width>
<height>101</height>
</size>
</property>
<property name="text">
<string>Web seeds urls (optional):</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_comment">
<property name="minimumSize">
<size>
<width>0</width>
<height>102</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>102</height>
</size>
</property>
<property name="text">
<string>Comment (optional):</string>
</property>
<property name="buddy">
<cstring>txt_comment</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="trackers_list">
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addTracker_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>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeTracker_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>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="URLSeeds_list">
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addURLSeed_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>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeURLSeed_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>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="txt_comment">
<property name="maximumSize">
<size>
<width>421</width>
<height>102</height>
</size>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="txtPieceSize">
<property name="text">
<string>Piece size:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboPieceSize">
<property name="currentIndex">
<number>3</number>
</property>
<item>
<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" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="check_private">
<property name="text">
<string>Private (won't be distributed on DHT network if enabled)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkStartSeeding">
<property name="text">
<string>Start seeding after creation</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="progressLbl">
<property name="text">
<string>Progress:</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>131</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create and save...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>
Loading…
Cancel
Save