|
|
@ -243,7 +243,8 @@ void SearchEngine::searchStarted(){ |
|
|
|
void SearchEngine::downloadSelectedItem(const QModelIndex& index){ |
|
|
|
void SearchEngine::downloadSelectedItem(const QModelIndex& index){ |
|
|
|
int row = index.row(); |
|
|
|
int row = index.row(); |
|
|
|
// Get Item url
|
|
|
|
// Get Item url
|
|
|
|
QString url = searchResultsUrls.value(all_tab.at(tabWidget->currentIndex())->getCurrentSearchListModel()->data(all_tab.at(tabWidget->currentIndex())->getCurrentSearchListModel()->index(row, NAME)).toString()); |
|
|
|
QStandardItemModel *model = all_tab.at(tabWidget->currentIndex())->getCurrentSearchListModel(); |
|
|
|
|
|
|
|
QString url = model->data(model->index(index.row(), URL_COLUMN)).toString(); |
|
|
|
// Download from url
|
|
|
|
// Download from url
|
|
|
|
BTSession->downloadFromUrl(url); |
|
|
|
BTSession->downloadFromUrl(url); |
|
|
|
// Set item color to RED
|
|
|
|
// Set item color to RED
|
|
|
@ -375,21 +376,17 @@ void SearchEngine::appendSearchResult(QString line){ |
|
|
|
} |
|
|
|
} |
|
|
|
QString url = parts.takeFirst().trimmed(); |
|
|
|
QString url = parts.takeFirst().trimmed(); |
|
|
|
QString filename = parts.first().trimmed(); |
|
|
|
QString filename = parts.first().trimmed(); |
|
|
|
// XXX: Two results can't have the same name (right?)
|
|
|
|
parts << url; |
|
|
|
if(searchResultsUrls.contains(filename)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Add item to search result list
|
|
|
|
// Add item to search result list
|
|
|
|
int row = currentSearchTab->getCurrentSearchListModel()->rowCount(); |
|
|
|
int row = currentSearchTab->getCurrentSearchListModel()->rowCount(); |
|
|
|
currentSearchTab->getCurrentSearchListModel()->insertRow(row); |
|
|
|
currentSearchTab->getCurrentSearchListModel()->insertRow(row); |
|
|
|
for(int i=0; i<5; ++i){ |
|
|
|
for(int i=0; i<6; ++i){ |
|
|
|
if(parts.at(i).trimmed().toFloat() == -1 && i != SIZE) |
|
|
|
if(parts.at(i).trimmed().toFloat() == -1 && i != SIZE) |
|
|
|
currentSearchTab->getCurrentSearchListModel()->setData(currentSearchTab->getCurrentSearchListModel()->index(row, i), tr("Unknown")); |
|
|
|
currentSearchTab->getCurrentSearchListModel()->setData(currentSearchTab->getCurrentSearchListModel()->index(row, i), tr("Unknown")); |
|
|
|
else |
|
|
|
else |
|
|
|
currentSearchTab->getCurrentSearchListModel()->setData(currentSearchTab->getCurrentSearchListModel()->index(row, i), QVariant(parts.at(i).trimmed())); |
|
|
|
currentSearchTab->getCurrentSearchListModel()->setData(currentSearchTab->getCurrentSearchListModel()->index(row, i), QVariant(parts.at(i).trimmed())); |
|
|
|
} |
|
|
|
} |
|
|
|
// Add url to searchResultsUrls associative array
|
|
|
|
// Add url to searchResultsUrls associative array
|
|
|
|
searchResultsUrls.insert(filename, url); |
|
|
|
|
|
|
|
no_search_results = false; |
|
|
|
no_search_results = false; |
|
|
|
++nb_search_results; |
|
|
|
++nb_search_results; |
|
|
|
// Enable clear & download buttons
|
|
|
|
// Enable clear & download buttons
|
|
|
@ -440,7 +437,8 @@ void SearchEngine::on_download_button_clicked(){ |
|
|
|
foreach(const QModelIndex &index, selectedIndexes){ |
|
|
|
foreach(const QModelIndex &index, selectedIndexes){ |
|
|
|
if(index.column() == NAME){ |
|
|
|
if(index.column() == NAME){ |
|
|
|
// Get Item url
|
|
|
|
// Get Item url
|
|
|
|
QString url = searchResultsUrls.value(index.data().toString()); |
|
|
|
QStandardItemModel *model = all_tab.at(tabWidget->currentIndex())->getCurrentSearchListModel(); |
|
|
|
|
|
|
|
QString url = model->data(model->index(index.row(), URL_COLUMN)).toString(); |
|
|
|
BTSession->downloadFromUrl(url); |
|
|
|
BTSession->downloadFromUrl(url); |
|
|
|
all_tab.at(tabWidget->currentIndex())->setRowColor(index.row(), "red"); |
|
|
|
all_tab.at(tabWidget->currentIndex())->setRowColor(index.row(), "red"); |
|
|
|
} |
|
|
|
} |
|
|
|