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 {
|
||||
return;
|
||||
}
|
||||
// Disable dialog
|
||||
setEnabled(false);
|
||||
// Set busy cursor
|
||||
setCursor(QCursor(Qt::WaitCursor));
|
||||
// Actually create the torrent
|
||||
QStringList url_seeds = allItems(URLSeeds_list);
|
||||
QString comment = txt_comment->toPlainText();
|
||||
creatorThread->create(input, destination, trackers, url_seeds, comment, check_private->isChecked(), getPieceSize());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
|
||||
// Enable Dialog
|
||||
setEnabled(true);
|
||||
// Remove busy cursor
|
||||
setCursor(QCursor(Qt::ArrowCursor));
|
||||
if(checkStartSeeding->isChecked()) {
|
||||
// Create save path temp data
|
||||
boost::intrusive_ptr<torrent_info> t;
|
||||
@ -219,6 +232,18 @@ void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
|
||||
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) {
|
||||
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 sendProgressSignal(int progress);
|
||||
void abortCreation() { abort = true; }
|
||||
|
||||
protected:
|
||||
void run();
|
||||
@ -87,6 +88,7 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{
|
||||
|
||||
public slots:
|
||||
void updateProgressBar(int progress);
|
||||
void on_cancelButton_clicked();
|
||||
|
||||
protected slots:
|
||||
void on_createButton_clicked();
|
||||
|
@ -65,7 +65,7 @@
|
||||
<string>Add file</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/document-new.png</normaloff>:/Icons/oxygen/document-new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -76,7 +76,7 @@
|
||||
<string>Add folder</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/folder-new.png</normaloff>:/Icons/oxygen/folder-new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -202,7 +202,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -231,7 +231,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -313,7 +313,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/list-add.png</normaloff>:/Icons/oxygen/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -342,7 +342,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/list-remove.png</normaloff>:/Icons/oxygen/list-remove.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -539,24 +539,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user