|
|
@ -334,6 +334,7 @@ void SearchEngine::readSearchOutput(){ |
|
|
|
foreach(const QByteArray &line, lines_list){ |
|
|
|
foreach(const QByteArray &line, lines_list){ |
|
|
|
appendSearchResult(QString::fromUtf8(line)); |
|
|
|
appendSearchResult(QString::fromUtf8(line)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(currentSearchTab) |
|
|
|
currentSearchTab->getCurrentLabel()->setText(tr("Results")+QString::fromUtf8(" <i>(")+misc::toQString(nb_search_results)+QString::fromUtf8(")</i>:")); |
|
|
|
currentSearchTab->getCurrentLabel()->setText(tr("Results")+QString::fromUtf8(" <i>(")+misc::toQString(nb_search_results)+QString::fromUtf8(")</i>:")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -436,6 +437,9 @@ void SearchEngine::updateNova() { |
|
|
|
// Search can be finished for 3 reasons :
|
|
|
|
// Search can be finished for 3 reasons :
|
|
|
|
// Error | Stopped by user | Finished normally
|
|
|
|
// Error | Stopped by user | Finished normally
|
|
|
|
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ |
|
|
|
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ |
|
|
|
|
|
|
|
if(searchTimeout->isActive()) { |
|
|
|
|
|
|
|
searchTimeout->stop(); |
|
|
|
|
|
|
|
} |
|
|
|
QSettings settings("qBittorrent", "qBittorrent"); |
|
|
|
QSettings settings("qBittorrent", "qBittorrent"); |
|
|
|
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool(); |
|
|
|
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool(); |
|
|
|
if(useNotificationBalloons && parent->getCurrentTabIndex() != TAB_SEARCH) { |
|
|
|
if(useNotificationBalloons && parent->getCurrentTabIndex() != TAB_SEARCH) { |
|
|
@ -457,22 +461,30 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ |
|
|
|
if(currentSearchTab) |
|
|
|
if(currentSearchTab) |
|
|
|
currentSearchTab->getCurrentLabel()->setText(tr("Results", "i.e: Search results")+QString::fromUtf8(" <i>(")+misc::toQString(nb_search_results)+QString::fromUtf8(")</i>:")); |
|
|
|
currentSearchTab->getCurrentLabel()->setText(tr("Results", "i.e: Search results")+QString::fromUtf8(" <i>(")+misc::toQString(nb_search_results)+QString::fromUtf8(")</i>:")); |
|
|
|
search_button->setText("Search"); |
|
|
|
search_button->setText("Search"); |
|
|
|
if(searchTimeout->isActive()) { |
|
|
|
|
|
|
|
searchTimeout->stop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SLOT to append one line to search results list
|
|
|
|
// SLOT to append one line to search results list
|
|
|
|
// Line is in the following form :
|
|
|
|
// Line is in the following form :
|
|
|
|
// file url | file name | file size | nb seeds | nb leechers | Search engine url
|
|
|
|
// file url | file name | file size | nb seeds | nb leechers | Search engine url
|
|
|
|
void SearchEngine::appendSearchResult(QString line){ |
|
|
|
void SearchEngine::appendSearchResult(QString line){ |
|
|
|
|
|
|
|
if(!currentSearchTab) { |
|
|
|
|
|
|
|
if(searchProcess->state() != QProcess::NotRunning){ |
|
|
|
|
|
|
|
searchProcess->terminate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(searchTimeout->isActive()) { |
|
|
|
|
|
|
|
searchTimeout->stop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
search_stopped = true; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
QStringList parts = line.split("|"); |
|
|
|
QStringList parts = line.split("|"); |
|
|
|
if(parts.size() != 6){ |
|
|
|
if(parts.size() != 6){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Q_ASSERT(currentSearchTab); |
|
|
|
// Add item to search result list
|
|
|
|
// Add item to search result list
|
|
|
|
QStandardItemModel* cur_model = currentSearchTab->getCurrentSearchListModel(); |
|
|
|
QStandardItemModel* cur_model = currentSearchTab->getCurrentSearchListModel(); |
|
|
|
|
|
|
|
Q_ASSERT(cur_model); |
|
|
|
int row = cur_model->rowCount(); |
|
|
|
int row = cur_model->rowCount(); |
|
|
|
cur_model->insertRow(row); |
|
|
|
cur_model->insertRow(row); |
|
|
|
|
|
|
|
|
|
|
@ -513,7 +525,7 @@ void SearchEngine::closeTab(int index) { |
|
|
|
search_stopped = true; |
|
|
|
search_stopped = true; |
|
|
|
currentSearchTab = 0; |
|
|
|
currentSearchTab = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
delete all_tab.takeAt(tabWidget->currentIndex()); |
|
|
|
delete all_tab.takeAt(index); |
|
|
|
if(!all_tab.size()) { |
|
|
|
if(!all_tab.size()) { |
|
|
|
download_button->setEnabled(false); |
|
|
|
download_button->setEnabled(false); |
|
|
|
} |
|
|
|
} |
|
|
|