mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Improved torrent creator tool behavior during creation process
This commit is contained in:
parent
a451cf2d5f
commit
75002906aa
@ -188,16 +188,29 @@ void createtorrent::on_createButton_clicked(){
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Disable dialog
|
||||||
|
setEnabled(false);
|
||||||
|
// Set busy cursor
|
||||||
|
setCursor(QCursor(Qt::WaitCursor));
|
||||||
|
// Actually create the torrent
|
||||||
QStringList url_seeds = allItems(URLSeeds_list);
|
QStringList url_seeds = allItems(URLSeeds_list);
|
||||||
QString comment = txt_comment->toPlainText();
|
QString comment = txt_comment->toPlainText();
|
||||||
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 createtorrent::handleCreationFailure(QString msg) {
|
void createtorrent::handleCreationFailure(QString msg) {
|
||||||
|
// Enable dialog
|
||||||
|
setEnabled(true);
|
||||||
|
// Remove busy cursor
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
|
void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
|
||||||
|
// Enable Dialog
|
||||||
|
setEnabled(true);
|
||||||
|
// Remove busy cursor
|
||||||
|
setCursor(QCursor(Qt::ArrowCursor));
|
||||||
if(checkStartSeeding->isChecked()) {
|
if(checkStartSeeding->isChecked()) {
|
||||||
// Create save path temp data
|
// Create save path temp data
|
||||||
boost::intrusive_ptr<torrent_info> t;
|
boost::intrusive_ptr<torrent_info> t;
|
||||||
@ -219,6 +232,18 @@ void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createtorrent::on_cancelButton_clicked() {
|
||||||
|
// End torrent creation thread
|
||||||
|
if(creatorThread->isRunning()) {
|
||||||
|
creatorThread->abortCreation();
|
||||||
|
creatorThread->terminate();
|
||||||
|
// Wait for termination
|
||||||
|
creatorThread->wait();
|
||||||
|
}
|
||||||
|
// Close the dialog
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
|
||||||
void createtorrent::updateProgressBar(int progress) {
|
void createtorrent::updateProgressBar(int progress) {
|
||||||
progressBar->setValue(progress);
|
progressBar->setValue(progress);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ class torrentCreatorThread : public QThread {
|
|||||||
}
|
}
|
||||||
void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size);
|
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 sendProgressSignal(int progress);
|
||||||
|
void abortCreation() { abort = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
@ -87,6 +88,7 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateProgressBar(int progress);
|
void updateProgressBar(int progress);
|
||||||
|
void on_cancelButton_clicked();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void on_createButton_clicked();
|
void on_createButton_clicked();
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
<string>Add file</string>
|
<string>Add file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/document-new.png</normaloff>:/Icons/oxygen/document-new.png</iconset>
|
<normaloff>:/Icons/oxygen/document-new.png</normaloff>:/Icons/oxygen/document-new.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
<string>Add folder</string>
|
<string>Add folder</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/folder-new.png</normaloff>:/Icons/oxygen/folder-new.png</iconset>
|
<normaloff>:/Icons/oxygen/folder-new.png</normaloff>:/Icons/oxygen/folder-new.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -202,7 +202,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -231,7 +231,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -313,7 +313,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -342,7 +342,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -539,24 +539,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>cancelButton</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>createTorrentDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>355</x>
|
|
||||||
<y>275</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>179</x>
|
|
||||||
<y>282</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user