mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 05:38:06 -06:00
Remove duplicated code from search tab and widget
Both download handlers (in the tab and widget classes) convert model index into an URL, set row color, and call download function. Make the download button handler (in the SearchWidget class) call the slot of the SearchTab class.
This commit is contained in:
@@ -392,11 +392,7 @@ void SearchWidget::on_downloadButton_clicked()
|
||||
QModelIndexList selectedIndexes = m_allTabs.at(tabWidget->currentIndex())->getCurrentTreeView()->selectionModel()->selectedIndexes();
|
||||
foreach (const QModelIndex &index, selectedIndexes) {
|
||||
if (index.column() == SearchSortModel::NAME) {
|
||||
// Get Item url
|
||||
QSortFilterProxyModel *model = m_allTabs.at(tabWidget->currentIndex())->getCurrentSearchListProxy();
|
||||
QString torrentUrl = model->data(model->index(index.row(), URL_COLUMN)).toString();
|
||||
downloadTorrent(torrentUrl);
|
||||
m_allTabs.at(tabWidget->currentIndex())->setRowColor(index.row(), "blue");
|
||||
m_allTabs.at(tabWidget->currentIndex())->downloadItem(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user