|
|
@ -104,10 +104,7 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) |
|
|
|
#ifndef Q_OS_MAC |
|
|
|
#ifndef Q_OS_MAC |
|
|
|
// Icons
|
|
|
|
// Icons
|
|
|
|
m_ui->searchButton->setIcon(GuiIconProvider::instance()->getIcon("edit-find")); |
|
|
|
m_ui->searchButton->setIcon(GuiIconProvider::instance()->getIcon("edit-find")); |
|
|
|
m_ui->downloadButton->setIcon(GuiIconProvider::instance()->getIcon("download")); |
|
|
|
|
|
|
|
m_ui->goToDescBtn->setIcon(GuiIconProvider::instance()->getIcon("application-x-mswinurl")); |
|
|
|
|
|
|
|
m_ui->pluginsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network")); |
|
|
|
m_ui->pluginsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network")); |
|
|
|
m_ui->copyURLBtn->setIcon(GuiIconProvider::instance()->getIcon("edit-copy")); |
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
// On macOS the icons overlap the text otherwise
|
|
|
|
// On macOS the icons overlap the text otherwise
|
|
|
|
QSize iconSize = m_ui->tabWidget->iconSize(); |
|
|
|
QSize iconSize = m_ui->tabWidget->iconSize(); |
|
|
@ -217,26 +214,11 @@ SearchWidget::~SearchWidget() |
|
|
|
delete m_ui; |
|
|
|
delete m_ui; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::updateButtons() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (m_currentSearchTab && (m_currentSearchTab->visibleResultsCount() > 0)) { |
|
|
|
|
|
|
|
m_ui->downloadButton->setEnabled(true); |
|
|
|
|
|
|
|
m_ui->goToDescBtn->setEnabled(true); |
|
|
|
|
|
|
|
m_ui->copyURLBtn->setEnabled(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
m_ui->downloadButton->setEnabled(false); |
|
|
|
|
|
|
|
m_ui->goToDescBtn->setEnabled(false); |
|
|
|
|
|
|
|
m_ui->copyURLBtn->setEnabled(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::tabChanged(int index) |
|
|
|
void SearchWidget::tabChanged(int index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// when we switch from a tab that is not empty to another that is empty
|
|
|
|
// when we switch from a tab that is not empty to another that is empty
|
|
|
|
// the download button doesn't have to be available
|
|
|
|
// the download button doesn't have to be available
|
|
|
|
m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex())); |
|
|
|
m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex())); |
|
|
|
updateButtons(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::selectMultipleBox(int index) |
|
|
|
void SearchWidget::selectMultipleBox(int index) |
|
|
@ -324,7 +306,6 @@ void SearchWidget::on_searchButton_clicked() |
|
|
|
m_ui->tabWidget->addTab(newTab, tabName); |
|
|
|
m_ui->tabWidget->addTab(newTab, tabName); |
|
|
|
m_ui->tabWidget->setCurrentWidget(newTab); |
|
|
|
m_ui->tabWidget->setCurrentWidget(newTab); |
|
|
|
|
|
|
|
|
|
|
|
connect(newTab, &SearchJobWidget::resultsCountUpdated, this, &SearchWidget::resultsCountUpdated); |
|
|
|
|
|
|
|
connect(newTab, &SearchJobWidget::statusChanged, this, [this, newTab]() { tabStatusChanged(newTab); }); |
|
|
|
connect(newTab, &SearchJobWidget::statusChanged, this, [this, newTab]() { tabStatusChanged(newTab); }); |
|
|
|
|
|
|
|
|
|
|
|
m_ui->searchButton->setText(tr("Stop")); |
|
|
|
m_ui->searchButton->setText(tr("Stop")); |
|
|
@ -332,11 +313,6 @@ void SearchWidget::on_searchButton_clicked() |
|
|
|
tabStatusChanged(newTab); |
|
|
|
tabStatusChanged(newTab); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::resultsCountUpdated() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
updateButtons(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::tabStatusChanged(QWidget *tab) |
|
|
|
void SearchWidget::tabStatusChanged(QWidget *tab) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const int tabIndex = m_ui->tabWidget->indexOf(tab); |
|
|
|
const int tabIndex = m_ui->tabWidget->indexOf(tab); |
|
|
@ -367,19 +343,3 @@ void SearchWidget::closeTab(int index) |
|
|
|
|
|
|
|
|
|
|
|
delete tab; |
|
|
|
delete tab; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Download selected items in search results list
|
|
|
|
|
|
|
|
void SearchWidget::on_downloadButton_clicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_allTabs.at(m_ui->tabWidget->currentIndex())->downloadTorrents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::on_goToDescBtn_clicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_allTabs.at(m_ui->tabWidget->currentIndex())->openTorrentPages(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SearchWidget::on_copyURLBtn_clicked() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_allTabs.at(m_ui->tabWidget->currentIndex())->copyTorrentURLs(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|