@ -1,6 +1,7 @@
/*
/*
* Bittorrent Client using Qt4 and libtorrent .
* Bittorrent Client using Qt and libtorrent .
* Copyright ( C ) 2010 Christophe Dumez
* Copyright ( C ) 2017 Mike Tzou ( Chocobo1 )
* Copyright ( C ) 2010 Christophe Dumez < chris @ qbittorrent . org >
*
*
* 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
@ -24,8 +25,6 @@
* modify file ( s ) , you may extend this exception to your version of the file ( s ) ,
* 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
* but you are not obligated to do so . If you do not wish to do so , delete this
* exception statement from your version .
* exception statement from your version .
*
* Contact : chris @ qbittorrent . org
*/
*/
# include "torrentcreatordlg.h"
# include "torrentcreatordlg.h"
@ -68,8 +67,8 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setText ( tr ( " Create Torrent " ) ) ;
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setText ( tr ( " Create Torrent " ) ) ;
connect ( m_ui - > addFile_b utton , SIGNAL ( clicked ( bool ) ) , SLOT ( onAddFileButtonClicked ( ) ) ) ;
connect ( m_ui - > addFileB utton , SIGNAL ( clicked ( bool ) ) , SLOT ( onAddFileButtonClicked ( ) ) ) ;
connect ( m_ui - > addFolder_b utton , SIGNAL ( clicked ( bool ) ) , SLOT ( onAddFolderButtonClicked ( ) ) ) ;
connect ( m_ui - > addFolderB utton , SIGNAL ( clicked ( bool ) ) , SLOT ( onAddFolderButtonClicked ( ) ) ) ;
connect ( m_ui - > buttonBox , SIGNAL ( accepted ( ) ) , SLOT ( onCreateButtonClicked ( ) ) ) ;
connect ( m_ui - > buttonBox , SIGNAL ( accepted ( ) ) , SLOT ( onCreateButtonClicked ( ) ) ) ;
connect ( m_creatorThread , SIGNAL ( creationSuccess ( QString , QString ) ) , this , SLOT ( handleCreationSuccess ( QString , QString ) ) ) ;
connect ( m_creatorThread , SIGNAL ( creationSuccess ( QString , QString ) ) , this , SLOT ( handleCreationSuccess ( QString , QString ) ) ) ;
@ -164,12 +163,12 @@ void TorrentCreatorDlg::onCreateButtonClicked()
setInteractionEnabled ( false ) ;
setInteractionEnabled ( false ) ;
setCursor ( QCursor ( Qt : : WaitCursor ) ) ;
setCursor ( QCursor ( Qt : : WaitCursor ) ) ;
QStringList trackers = m_ui - > trackers_l ist - > toPlainText ( ) . split ( " \n " ) ;
QStringList trackers = m_ui - > trackersL ist - > toPlainText ( ) . split ( " \n " ) ;
QStringList urlSeeds = m_ui - > URLSeeds_l ist - > toPlainText ( ) . split ( " \n " ) ;
QStringList urlSeeds = m_ui - > URLSeedsL ist - > toPlainText ( ) . split ( " \n " ) ;
QString comment = m_ui - > txt_c omment - > toPlainText ( ) ;
QString comment = m_ui - > txtC omment - > toPlainText ( ) ;
// run the creator thread
// run the creator thread
m_creatorThread - > create ( input , destination , trackers , urlSeeds , comment , m_ui - > check_p rivate - > isChecked ( ) , getPieceSize ( ) ) ;
m_creatorThread - > create ( input , destination , trackers , urlSeeds , comment , m_ui - > checkP rivate - > isChecked ( ) , getPieceSize ( ) ) ;
}
}
void TorrentCreatorDlg : : handleCreationFailure ( const QString & msg )
void TorrentCreatorDlg : : handleCreationFailure ( const QString & msg )
@ -211,13 +210,13 @@ void TorrentCreatorDlg::updateProgressBar(int progress)
void TorrentCreatorDlg : : setInteractionEnabled ( bool enabled )
void TorrentCreatorDlg : : setInteractionEnabled ( bool enabled )
{
{
m_ui - > textInputPath - > setEnabled ( enabled ) ;
m_ui - > textInputPath - > setEnabled ( enabled ) ;
m_ui - > addFile_b utton - > setEnabled ( enabled ) ;
m_ui - > addFileB utton - > setEnabled ( enabled ) ;
m_ui - > addFolder_b utton - > setEnabled ( enabled ) ;
m_ui - > addFolderB utton - > setEnabled ( enabled ) ;
m_ui - > trackers_l ist - > setEnabled ( enabled ) ;
m_ui - > trackersL ist - > setEnabled ( enabled ) ;
m_ui - > URLSeeds_l ist - > setEnabled ( enabled ) ;
m_ui - > URLSeedsL ist - > setEnabled ( enabled ) ;
m_ui - > txt_c omment - > setEnabled ( enabled ) ;
m_ui - > txtC omment - > setEnabled ( enabled ) ;
m_ui - > comboPieceSize - > setEnabled ( enabled ) ;
m_ui - > comboPieceSize - > setEnabled ( enabled ) ;
m_ui - > check_p rivate - > setEnabled ( enabled ) ;
m_ui - > checkP rivate - > setEnabled ( enabled ) ;
m_ui - > checkStartSeeding - > setEnabled ( enabled ) ;
m_ui - > checkStartSeeding - > setEnabled ( enabled ) ;
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setEnabled ( enabled ) ;
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setEnabled ( enabled ) ;
m_ui - > checkIgnoreShareLimits - > setEnabled ( enabled & & m_ui - > checkStartSeeding - > isChecked ( ) ) ;
m_ui - > checkIgnoreShareLimits - > setEnabled ( enabled & & m_ui - > checkStartSeeding - > isChecked ( ) ) ;
@ -228,13 +227,13 @@ void TorrentCreatorDlg::saveSettings()
m_storeLastAddPath = m_ui - > textInputPath - > text ( ) . trimmed ( ) ;
m_storeLastAddPath = m_ui - > textInputPath - > text ( ) . trimmed ( ) ;
m_storePieceSize = m_ui - > comboPieceSize - > currentIndex ( ) ;
m_storePieceSize = m_ui - > comboPieceSize - > currentIndex ( ) ;
m_storePrivateTorrent = m_ui - > check_p rivate - > isChecked ( ) ;
m_storePrivateTorrent = m_ui - > checkP rivate - > isChecked ( ) ;
m_storeStartSeeding = m_ui - > checkStartSeeding - > isChecked ( ) ;
m_storeStartSeeding = m_ui - > checkStartSeeding - > isChecked ( ) ;
m_storeIgnoreRatio = m_ui - > checkIgnoreShareLimits - > isChecked ( ) ;
m_storeIgnoreRatio = m_ui - > checkIgnoreShareLimits - > isChecked ( ) ;
m_storeTrackerList = m_ui - > trackers_l ist - > toPlainText ( ) ;
m_storeTrackerList = m_ui - > trackersL ist - > toPlainText ( ) ;
m_storeWebSeedList = m_ui - > URLSeeds_l ist - > toPlainText ( ) ;
m_storeWebSeedList = m_ui - > URLSeedsL ist - > toPlainText ( ) ;
m_storeComments = m_ui - > txt_c omment - > toPlainText ( ) ;
m_storeComments = m_ui - > txtC omment - > toPlainText ( ) ;
m_storeDialogSize = size ( ) ;
m_storeDialogSize = size ( ) ;
}
}
@ -244,14 +243,14 @@ void TorrentCreatorDlg::loadSettings()
m_ui - > textInputPath - > setText ( m_storeLastAddPath ) ;
m_ui - > textInputPath - > setText ( m_storeLastAddPath ) ;
m_ui - > comboPieceSize - > setCurrentIndex ( m_storePieceSize ) ;
m_ui - > comboPieceSize - > setCurrentIndex ( m_storePieceSize ) ;
m_ui - > check_p rivate - > setChecked ( m_storePrivateTorrent ) ;
m_ui - > checkP rivate - > setChecked ( m_storePrivateTorrent ) ;
m_ui - > checkStartSeeding - > setChecked ( m_storeStartSeeding ) ;
m_ui - > checkStartSeeding - > setChecked ( m_storeStartSeeding ) ;
m_ui - > checkIgnoreShareLimits - > setChecked ( m_storeIgnoreRatio ) ;
m_ui - > checkIgnoreShareLimits - > setChecked ( m_storeIgnoreRatio ) ;
m_ui - > checkIgnoreShareLimits - > setEnabled ( m_ui - > checkStartSeeding - > isChecked ( ) ) ;
m_ui - > checkIgnoreShareLimits - > setEnabled ( m_ui - > checkStartSeeding - > isChecked ( ) ) ;
m_ui - > trackers_l ist - > setPlainText ( m_storeTrackerList ) ;
m_ui - > trackersL ist - > setPlainText ( m_storeTrackerList ) ;
m_ui - > URLSeeds_l ist - > setPlainText ( m_storeWebSeedList ) ;
m_ui - > URLSeedsL ist - > setPlainText ( m_storeWebSeedList ) ;
m_ui - > txt_c omment - > setPlainText ( m_storeComments ) ;
m_ui - > txtC omment - > setPlainText ( m_storeComments ) ;
if ( m_storeDialogSize . value ( ) . isValid ( ) )
if ( m_storeDialogSize . value ( ) . isValid ( ) )
resize ( m_storeDialogSize ) ;
resize ( m_storeDialogSize ) ;