@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/*
* Bittorrent Client using Qt4 and libtorrent .
* Bittorrent Client using Qt and libtorrent .
* Copyright ( C ) 2006 Christophe Dumez < chris @ qbittorrent . org >
*
* This program is free software ; you can redistribute it and / or
@ -79,7 +79,7 @@ namespace
@@ -79,7 +79,7 @@ namespace
}
// Helper for setting style parameters when painting check box primitives.
class CheckBoxIconHelper : public QCheckBox
class CheckBoxIconHelper : public QCheckBox
{
public :
explicit CheckBoxIconHelper ( QWidget * parent ) ;
@ -108,7 +108,7 @@ namespace
@@ -108,7 +108,7 @@ namespace
}
// Tristate checkbox styled for use in menus.
class MenuCheckBox : public QWidget
class MenuCheckBox : public QWidget
{
public :
MenuCheckBox ( const QString & text , const ToggleFn & onToggle , Qt : : CheckState initialState ) ;
@ -188,7 +188,7 @@ namespace
@@ -188,7 +188,7 @@ namespace
m_checkBox - > click ( ) ;
}
class CheckBoxMenuItem : public QWidgetAction
class CheckBoxMenuItem : public QWidgetAction
{
public :
CheckBoxMenuItem ( const QString & text , const ToggleFn & onToggle , Qt : : CheckState initialState , QObject * parent )
@ -206,7 +206,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
@@ -206,7 +206,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
setUniformRowHeights ( true ) ;
// Load settings
bool column_l oaded = loadSettings ( ) ;
bool columnL oaded = loadSettings ( ) ;
// Create and apply delegate
m_listDelegate = new TransferListDelegate ( this ) ;
@ -238,7 +238,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
@@ -238,7 +238,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
header ( ) - > setStretchLastSection ( false ) ;
// Default hidden columns
if ( ! column_l oaded ) {
if ( ! columnL oaded ) {
setColumnHidden ( TorrentModel : : TR_ADD_DATE , true ) ;
setColumnHidden ( TorrentModel : : TR_SEED_DATE , true ) ;
setColumnHidden ( TorrentModel : : TR_UPLIMIT , true ) ;
@ -318,7 +318,7 @@ TransferListWidget::~TransferListWidget()
@@ -318,7 +318,7 @@ TransferListWidget::~TransferListWidget()
qDebug ( ) < < Q_FUNC_INFO < < " EXIT " ;
}
TorrentModel * TransferListWidget : : getSourceModel ( ) const
TorrentModel * TransferListWidget : : getSourceModel ( ) const
{
return m_listModel ;
}
@ -358,7 +358,7 @@ void TransferListWidget::torrentDoubleClicked()
@@ -358,7 +358,7 @@ void TransferListWidget::torrentDoubleClicked()
else
action = Preferences : : instance ( ) - > getActionOnDblClOnTorrentDl ( ) ;
switch ( action ) {
switch ( action ) {
case TOGGLE_PAUSE :
if ( torrent - > isPaused ( ) )
torrent - > resume ( ) ;
@ -531,7 +531,7 @@ void TransferListWidget::copySelectedMagnetURIs() const
@@ -531,7 +531,7 @@ void TransferListWidget::copySelectedMagnetURIs() const
foreach ( BitTorrent : : TorrentHandle * const torrent , getSelectedTorrents ( ) )
magnet_uris < < torrent - > toMagnetUri ( ) ;
qApp - > clipboard ( ) - > setText ( magnet_uris . join ( " \n " ) ) ;
qApp - > clipboard ( ) - > setText ( magnet_uris . join ( ' \n ' ) ) ;
}
void TransferListWidget : : copySelectedNames ( ) const
@ -540,7 +540,7 @@ void TransferListWidget::copySelectedNames() const
@@ -540,7 +540,7 @@ void TransferListWidget::copySelectedNames() const
foreach ( BitTorrent : : TorrentHandle * const torrent , getSelectedTorrents ( ) )
torrent_names < < torrent - > name ( ) ;
qApp - > clipboard ( ) - > setText ( torrent_names . join ( " \n " ) ) ;
qApp - > clipboard ( ) - > setText ( torrent_names . join ( ' \n ' ) ) ;
}
void TransferListWidget : : copySelectedHashes ( ) const
@ -703,8 +703,8 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
@@ -703,8 +703,8 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
hideshowColumn . setTitle ( tr ( " Column visibility " ) ) ;
QList < QAction * > actions ;
for ( int i = 0 ; i < m_listModel - > columnCount ( ) ; + + i ) {
if ( ! BitTorrent : : Session : : instance ( ) - > isQueueingSystemEnabled ( ) & & i = = TorrentModel : : TR_PRIORITY ) {
actions . append ( 0 ) ;
if ( ! BitTorrent : : Session : : instance ( ) - > isQueueingSystemEnabled ( ) & & ( i = = TorrentModel : : TR_PRIORITY ) ) {
actions . append ( nullptr ) ;
continue ;
}
QAction * myAct = hideshowColumn . addAction ( m_listModel - > headerData ( i , Qt : : Horizontal , Qt : : DisplayRole ) . toString ( ) ) ;
@ -872,16 +872,16 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -872,16 +872,16 @@ void TransferListWidget::displayListMenu(const QPoint&)
connect ( & actionForceStart , & QAction : : triggered , this , & TransferListWidget : : forceStartSelectedTorrents ) ;
QAction actionDelete ( GuiIconProvider : : instance ( ) - > getIcon ( " edit-delete " ) , tr ( " Delete " , " Delete the torrent " ) , nullptr ) ;
connect ( & actionDelete , & QAction : : triggered , this , & TransferListWidget : : softDeleteSelectedTorrents ) ;
QAction actionPreview_f ile ( GuiIconProvider : : instance ( ) - > getIcon ( " view-preview " ) , tr ( " Preview file... " ) , nullptr ) ;
connect ( & actionPreview_f ile , & QAction : : triggered , this , & TransferListWidget : : previewSelectedTorrents ) ;
QAction actionSet_max_r atio ( QIcon ( QLatin1String ( " :/icons/skin/ratio.png " ) ) , tr ( " Limit share ratio... " ) , nullptr ) ;
connect ( & actionSet_max_r atio , & QAction : : triggered , this , & TransferListWidget : : setMaxRatioSelectedTorrents ) ;
QAction actionSet_upload_l imit ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-set-max-upload-speed " ) , tr ( " Limit upload rate... " ) , nullptr ) ;
connect ( & actionSet_upload_l imit , & QAction : : triggered , this , & TransferListWidget : : setUpLimitSelectedTorrents ) ;
QAction actionSet_download_l imit ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-set-max-download-speed " ) , tr ( " Limit download rate... " ) , nullptr ) ;
connect ( & actionSet_download_l imit , & QAction : : triggered , this , & TransferListWidget : : setDlLimitSelectedTorrents ) ;
QAction actionOpen_destination_f older ( GuiIconProvider : : instance ( ) - > getIcon ( " inode-directory " ) , tr ( " Open destination folder " ) , nullptr ) ;
connect ( & actionOpen_destination_f older , & QAction : : triggered , this , & TransferListWidget : : openSelectedTorrentsFolder ) ;
QAction actionPreviewF ile ( GuiIconProvider : : instance ( ) - > getIcon ( " view-preview " ) , tr ( " Preview file... " ) , nullptr ) ;
connect ( & actionPreviewF ile , & QAction : : triggered , this , & TransferListWidget : : previewSelectedTorrents ) ;
QAction actionSetMaxR atio ( QIcon ( QLatin1String ( " :/icons/skin/ratio.png " ) ) , tr ( " Limit share ratio... " ) , nullptr ) ;
connect ( & actionSetMaxR atio , & QAction : : triggered , this , & TransferListWidget : : setMaxRatioSelectedTorrents ) ;
QAction actionSetUploadL imit ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-set-max-upload-speed " ) , tr ( " Limit upload rate... " ) , nullptr ) ;
connect ( & actionSetUploadL imit , & QAction : : triggered , this , & TransferListWidget : : setUpLimitSelectedTorrents ) ;
QAction actionSetDownloadL imit ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-set-max-download-speed " ) , tr ( " Limit download rate... " ) , nullptr ) ;
connect ( & actionSetDownloadL imit , & QAction : : triggered , this , & TransferListWidget : : setDlLimitSelectedTorrents ) ;
QAction actionOpenDestinationF older ( GuiIconProvider : : instance ( ) - > getIcon ( " inode-directory " ) , tr ( " Open destination folder " ) , nullptr ) ;
connect ( & actionOpenDestinationF older , & QAction : : triggered , this , & TransferListWidget : : openSelectedTorrentsFolder ) ;
QAction actionIncreasePriority ( GuiIconProvider : : instance ( ) - > getIcon ( " go-up " ) , tr ( " Move up " , " i.e. move up in the queue " ) , nullptr ) ;
connect ( & actionIncreasePriority , & QAction : : triggered , this , & TransferListWidget : : increasePrioSelectedTorrents ) ;
QAction actionDecreasePriority ( GuiIconProvider : : instance ( ) - > getIcon ( " go-down " ) , tr ( " Move down " , " i.e. Move down in the queue " ) , nullptr ) ;
@ -892,27 +892,27 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -892,27 +892,27 @@ void TransferListWidget::displayListMenu(const QPoint&)
connect ( & actionBottomPriority , & QAction : : triggered , this , & TransferListWidget : : bottomPrioSelectedTorrents ) ;
QAction actionSetTorrentPath ( GuiIconProvider : : instance ( ) - > getIcon ( " inode-directory " ) , tr ( " Set location... " ) , nullptr ) ;
connect ( & actionSetTorrentPath , & QAction : : triggered , this , & TransferListWidget : : setSelectedTorrentsLocation ) ;
QAction actionForce_r echeck ( GuiIconProvider : : instance ( ) - > getIcon ( " document-edit-verify " ) , tr ( " Force recheck " ) , nullptr ) ;
connect ( & actionForce_r echeck , & QAction : : triggered , this , & TransferListWidget : : recheckSelectedTorrents ) ;
QAction actionForce_r eannounce ( GuiIconProvider : : instance ( ) - > getIcon ( " document-edit-verify " ) , tr ( " Force reannounce " ) , nullptr ) ;
connect ( & actionForce_r eannounce , & QAction : : triggered , this , & TransferListWidget : : reannounceSelectedTorrents ) ;
QAction actionCopy_magnet_l ink ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-magnet " ) , tr ( " Copy magnet link " ) , nullptr ) ;
connect ( & actionCopy_magnet_l ink , & QAction : : triggered , this , & TransferListWidget : : copySelectedMagnetURIs ) ;
QAction actionCopy_n ame ( GuiIconProvider : : instance ( ) - > getIcon ( " edit-copy " ) , tr ( " Copy name " ) , nullptr ) ;
connect ( & actionCopy_n ame , & QAction : : triggered , this , & TransferListWidget : : copySelectedNames ) ;
QAction actionForceR echeck ( GuiIconProvider : : instance ( ) - > getIcon ( " document-edit-verify " ) , tr ( " Force recheck " ) , nullptr ) ;
connect ( & actionForceR echeck , & QAction : : triggered , this , & TransferListWidget : : recheckSelectedTorrents ) ;
QAction actionForceR eannounce ( GuiIconProvider : : instance ( ) - > getIcon ( " document-edit-verify " ) , tr ( " Force reannounce " ) , nullptr ) ;
connect ( & actionForceR eannounce , & QAction : : triggered , this , & TransferListWidget : : reannounceSelectedTorrents ) ;
QAction actionCopyMagnetL ink ( GuiIconProvider : : instance ( ) - > getIcon ( " kt-magnet " ) , tr ( " Copy magnet link " ) , nullptr ) ;
connect ( & actionCopyMagnetL ink , & QAction : : triggered , this , & TransferListWidget : : copySelectedMagnetURIs ) ;
QAction actionCopyN ame ( GuiIconProvider : : instance ( ) - > getIcon ( " edit-copy " ) , tr ( " Copy name " ) , nullptr ) ;
connect ( & actionCopyN ame , & QAction : : triggered , this , & TransferListWidget : : copySelectedNames ) ;
QAction actionCopyHash ( GuiIconProvider : : instance ( ) - > getIcon ( " edit-copy " ) , tr ( " Copy hash " ) , nullptr ) ;
connect ( & actionCopyHash , & QAction : : triggered , this , & TransferListWidget : : copySelectedHashes ) ;
QAction actionSuper_seeding_m ode ( tr ( " Super seeding mode " ) , nullptr ) ;
actionSuper_seeding_m ode . setCheckable ( true ) ;
connect ( & actionSuper_seeding_m ode , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedTorrentsSuperSeeding ) ;
QAction actionSuperSeedingM ode ( tr ( " Super seeding mode " ) , nullptr ) ;
actionSuperSeedingM ode . setCheckable ( true ) ;
connect ( & actionSuperSeedingM ode , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedTorrentsSuperSeeding ) ;
QAction actionRename ( GuiIconProvider : : instance ( ) - > getIcon ( " edit-rename " ) , tr ( " Rename... " ) , nullptr ) ;
connect ( & actionRename , & QAction : : triggered , this , & TransferListWidget : : renameSelectedTorrent ) ;
QAction actionSequential_d ownload ( tr ( " Download in sequential order " ) , nullptr ) ;
actionSequential_d ownload . setCheckable ( true ) ;
connect ( & actionSequential_d ownload , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedTorrentsSequentialDownload ) ;
QAction actionFirstLastPiece_p rio ( tr ( " Download first and last pieces first " ) , nullptr ) ;
actionFirstLastPiece_p rio . setCheckable ( true ) ;
connect ( & actionFirstLastPiece_p rio , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedFirstLastPiecePrio ) ;
QAction actionSequentialD ownload ( tr ( " Download in sequential order " ) , nullptr ) ;
actionSequentialD ownload . setCheckable ( true ) ;
connect ( & actionSequentialD ownload , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedTorrentsSequentialDownload ) ;
QAction actionFirstLastPieceP rio ( tr ( " Download first and last pieces first " ) , nullptr ) ;
actionFirstLastPieceP rio . setCheckable ( true ) ;
connect ( & actionFirstLastPieceP rio , & QAction : : triggered , this , & TransferListWidget : : toggleSelectedFirstLastPiecePrio ) ;
QAction actionAutoTMM ( tr ( " Automatic Torrent Management " ) , nullptr ) ;
actionAutoTMM . setCheckable ( true ) ;
actionAutoTMM . setToolTip ( tr ( " Automatic mode means that various torrent properties(eg save path) will be decided by the associated category " ) ) ;
@ -920,12 +920,12 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -920,12 +920,12 @@ void TransferListWidget::displayListMenu(const QPoint&)
// End of actions
// Enable/disable pause/start action given the DL state
bool needs_p ause = false , needs_s tart = false , needs_f orce = false , needs_p review = false ;
bool all_same_super_s eeding = true ;
bool super_seeding_m ode = false ;
bool all_same_sequential_download_m ode = true , all_same_prio_f irstlast = true ;
bool sequential_download_m ode = false , prioritize_first_l ast = false ;
bool one_has_m etadata = false , one_not_s eed = false ;
bool needsP ause = false , needsS tart = false , needsF orce = false , needsP review = false ;
bool allSameSuperS eeding = true ;
bool superSeedingM ode = false ;
bool allSameSequentialDownloadM ode = true , allSamePrioF irstlast = true ;
bool sequentialDownloadM ode = false , prioritizeFirstL ast = false ;
bool oneHasM etadata = false , oneNotS eed = false ;
bool allSameCategory = true ;
bool allSameAutoTMM = true ;
bool firstAutoTMM = false ;
@ -960,57 +960,57 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -960,57 +960,57 @@ void TransferListWidget::displayListMenu(const QPoint&)
allSameAutoTMM = false ;
if ( torrent - > hasMetadata ( ) )
one_has_m etadata = true ;
oneHasM etadata = true ;
if ( ! torrent - > isSeed ( ) ) {
one_not_s eed = true ;
oneNotS eed = true ;
if ( torrent - > hasMetadata ( ) ) {
if ( first ) {
sequential_download_m ode = torrent - > isSequentialDownload ( ) ;
prioritize_first_l ast = torrent - > hasFirstLastPiecePriority ( ) ;
sequentialDownloadM ode = torrent - > isSequentialDownload ( ) ;
prioritizeFirstL ast = torrent - > hasFirstLastPiecePriority ( ) ;
}
else {
if ( sequential_download_m ode ! = torrent - > isSequentialDownload ( ) )
all_same_sequential_download_m ode = false ;
if ( prioritize_first_l ast ! = torrent - > hasFirstLastPiecePriority ( ) )
all_same_prio_f irstlast = false ;
if ( sequentialDownloadM ode ! = torrent - > isSequentialDownload ( ) )
allSameSequentialDownloadM ode = false ;
if ( prioritizeFirstL ast ! = torrent - > hasFirstLastPiecePriority ( ) )
allSamePrioF irstlast = false ;
}
}
}
else {
if ( ! one_not_seed & & all_same_super_s eeding & & torrent - > hasMetadata ( ) ) {
if ( ! oneNotSeed & & allSameSuperS eeding & & torrent - > hasMetadata ( ) ) {
if ( first ) {
super_seeding_m ode = torrent - > superSeeding ( ) ;
superSeedingM ode = torrent - > superSeeding ( ) ;
}
else if ( super_seeding_m ode ! = torrent - > superSeeding ( ) )
all_same_super_s eeding = false ;
else if ( superSeedingM ode ! = torrent - > superSeeding ( ) )
allSameSuperS eeding = false ;
}
}
if ( ! torrent - > isForced ( ) )
needs_f orce = true ;
needsF orce = true ;
else
needs_s tart = true ;
needsS tart = true ;
if ( torrent - > isPaused ( ) )
needs_s tart = true ;
needsS tart = true ;
else
needs_p ause = true ;
needsP ause = true ;
if ( torrent - > hasMetadata ( ) )
needs_p review = true ;
needsP review = true ;
first = false ;
if ( one_has_metadata & & one_not_s eed & & ! all_same_sequential_download_m ode
& & ! all_same_prio_f irstlast & & ! all_same_super_s eeding & & ! allSameCategory
& & needs_start & & needs_force & & needs_pause & & needs_p review & & ! allSameAutoTMM ) {
if ( oneHasMetadata & & oneNotS eed & & ! allSameSequentialDownloadM ode
& & ! allSamePrioF irstlast & & ! allSameSuperS eeding & & ! allSameCategory
& & needsStart & & needsForce & & needsPause & & needsP review & & ! allSameAutoTMM ) {
break ;
}
}
QMenu listMenu ( this ) ;
if ( needs_s tart )
if ( needsS tart )
listMenu . addAction ( & actionStart ) ;
if ( needs_p ause )
if ( needsP ause )
listMenu . addAction ( & actionPause ) ;
if ( needs_f orce )
if ( needsF orce )
listMenu . addAction ( & actionForceStart ) ;
listMenu . addSeparator ( ) ;
listMenu . addAction ( & actionDelete ) ;
@ -1068,42 +1068,42 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -1068,42 +1068,42 @@ void TransferListWidget::displayListMenu(const QPoint&)
}
listMenu . addSeparator ( ) ;
if ( one_not_s eed )
listMenu . addAction ( & actionSet_download_l imit ) ;
listMenu . addAction ( & actionSet_upload_l imit ) ;
listMenu . addAction ( & actionSet_max_r atio ) ;
if ( ! one_not_seed & & all_same_super_seeding & & one_has_m etadata ) {
actionSuper_seeding_m ode . setChecked ( super_seeding_m ode ) ;
listMenu . addAction ( & actionSuper_seeding_m ode ) ;
if ( oneNotS eed )
listMenu . addAction ( & actionSetDownloadL imit ) ;
listMenu . addAction ( & actionSetUploadL imit ) ;
listMenu . addAction ( & actionSetMaxR atio ) ;
if ( ! oneNotSeed & & allSameSuperSeeding & & oneHasM etadata ) {
actionSuperSeedingM ode . setChecked ( superSeedingM ode ) ;
listMenu . addAction ( & actionSuperSeedingM ode ) ;
}
listMenu . addSeparator ( ) ;
bool added_preview_a ction = false ;
if ( needs_p review ) {
listMenu . addAction ( & actionPreview_f ile ) ;
added_preview_a ction = true ;
bool addedPreviewA ction = false ;
if ( needsP review ) {
listMenu . addAction ( & actionPreviewF ile ) ;
addedPreviewA ction = true ;
}
if ( one_not_seed & & one_has_m etadata ) {
if ( all_same_sequential_download_m ode ) {
actionSequential_d ownload . setChecked ( sequential_download_m ode ) ;
listMenu . addAction ( & actionSequential_d ownload ) ;
added_preview_a ction = true ;
if ( oneNotSeed & & oneHasM etadata ) {
if ( allSameSequentialDownloadM ode ) {
actionSequentialD ownload . setChecked ( sequentialDownloadM ode ) ;
listMenu . addAction ( & actionSequentialD ownload ) ;
addedPreviewA ction = true ;
}
if ( all_same_prio_f irstlast ) {
actionFirstLastPiece_p rio . setChecked ( prioritize_first_l ast ) ;
listMenu . addAction ( & actionFirstLastPiece_p rio ) ;
added_preview_a ction = true ;
if ( allSamePrioF irstlast ) {
actionFirstLastPieceP rio . setChecked ( prioritizeFirstL ast ) ;
listMenu . addAction ( & actionFirstLastPieceP rio ) ;
addedPreviewA ction = true ;
}
}
if ( added_preview_a ction )
if ( addedPreviewA ction )
listMenu . addSeparator ( ) ;
if ( one_has_m etadata ) {
listMenu . addAction ( & actionForce_r echeck ) ;
listMenu . addAction ( & actionForce_r eannounce ) ;
if ( oneHasM etadata ) {
listMenu . addAction ( & actionForceR echeck ) ;
listMenu . addAction ( & actionForceR eannounce ) ;
listMenu . addSeparator ( ) ;
}
listMenu . addAction ( & actionOpen_destination_f older ) ;
if ( BitTorrent : : Session : : instance ( ) - > isQueueingSystemEnabled ( ) & & one_not_s eed ) {
listMenu . addAction ( & actionOpenDestinationF older ) ;
if ( BitTorrent : : Session : : instance ( ) - > isQueueingSystemEnabled ( ) & & oneNotS eed ) {
listMenu . addSeparator ( ) ;
QMenu * prioMenu = listMenu . addMenu ( tr ( " Priority " ) ) ;
prioMenu - > addAction ( & actionTopPriority ) ;
@ -1112,9 +1112,9 @@ void TransferListWidget::displayListMenu(const QPoint&)
@@ -1112,9 +1112,9 @@ void TransferListWidget::displayListMenu(const QPoint&)
prioMenu - > addAction ( & actionBottomPriority ) ;
}
listMenu . addSeparator ( ) ;
listMenu . addAction ( & actionCopy_n ame ) ;
listMenu . addAction ( & actionCopyN ame ) ;
listMenu . addAction ( & actionCopyHash ) ;
listMenu . addAction ( & actionCopy_magnet_l ink ) ;
listMenu . addAction ( & actionCopyMagnetL ink ) ;
// Call menu
QAction * act = nullptr ;
act = listMenu . exec ( QCursor : : pos ( ) ) ;
@ -1186,7 +1186,7 @@ void TransferListWidget::applyTrackerFilter(const QStringList &hashes)
@@ -1186,7 +1186,7 @@ void TransferListWidget::applyTrackerFilter(const QStringList &hashes)
m_sortFilterModel - > setTrackerFilter ( hashes ) ;
}
void TransferListWidget : : applyNameFilter ( const QString & name )
void TransferListWidget : : applyNameFilter ( const QString & name )
{
m_sortFilterModel - > setFilterRegExp ( QRegExp ( name , Qt : : CaseInsensitive , QRegExp : : WildcardUnix ) ) ;
}
@ -1195,7 +1195,7 @@ void TransferListWidget::applyStatusFilter(int f)
@@ -1195,7 +1195,7 @@ void TransferListWidget::applyStatusFilter(int f)
{
m_sortFilterModel - > setStatusFilter ( static_cast < TorrentFilter : : Type > ( f ) ) ;
// Select first item if nothing is selected
if ( selectionModel ( ) - > selectedRows ( 0 ) . empty ( ) & & m_sortFilterModel - > rowCount ( ) > 0 ) {
if ( selectionModel ( ) - > selectedRows ( 0 ) . empty ( ) & & ( m_sortFilterModel - > rowCount ( ) > 0 ) ) {
qDebug ( " Nothing is selected, selecting first row: %s " , qUtf8Printable ( m_sortFilterModel - > index ( 0 , TorrentModel : : TR_NAME ) . data ( ) . toString ( ) ) ) ;
selectionModel ( ) - > setCurrentIndex ( m_sortFilterModel - > index ( 0 , TorrentModel : : TR_NAME ) , QItemSelectionModel : : SelectCurrent | QItemSelectionModel : : Rows ) ;
}