mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
Use qt5 connect style for searchengine, pluginselectdlg and searchwidget.
This commit is contained in:
parent
dee0b63cc5
commit
a77e1c9f36
@ -70,13 +70,13 @@ SearchEngine::SearchEngine()
|
|||||||
|
|
||||||
m_searchProcess = new QProcess(this);
|
m_searchProcess = new QProcess(this);
|
||||||
m_searchProcess->setEnvironment(QProcess::systemEnvironment());
|
m_searchProcess->setEnvironment(QProcess::systemEnvironment());
|
||||||
connect(m_searchProcess, SIGNAL(started()), this, SIGNAL(searchStarted()));
|
connect(m_searchProcess, &QProcess::started, this, &SearchEngine::searchStarted);
|
||||||
connect(m_searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput()));
|
connect(m_searchProcess, &QProcess::readyReadStandardOutput, this, &SearchEngine::readSearchOutput);
|
||||||
connect(m_searchProcess, SIGNAL(finished(int)), this, SLOT(processFinished(int)));
|
connect(m_searchProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &SearchEngine::processFinished);
|
||||||
|
|
||||||
m_searchTimeout = new QTimer(this);
|
m_searchTimeout = new QTimer(this);
|
||||||
m_searchTimeout->setSingleShot(true);
|
m_searchTimeout->setSingleShot(true);
|
||||||
connect(m_searchTimeout, SIGNAL(timeout()), this, SLOT(onTimeout()));
|
connect(m_searchTimeout, &QTimer::timeout, this, &SearchEngine::onTimeout);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -156,9 +156,11 @@ void SearchEngine::installPlugin(const QString &source)
|
|||||||
qDebug("Asked to install plugin at %s", qPrintable(source));
|
qDebug("Asked to install plugin at %s", qPrintable(source));
|
||||||
|
|
||||||
if (Utils::Misc::isUrl(source)) {
|
if (Utils::Misc::isUrl(source)) {
|
||||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(source, true);
|
using namespace Net;
|
||||||
connect(handler, SIGNAL(downloadFinished(QString, QString)), this, SLOT(pluginDownloaded(QString, QString)));
|
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(source, true);
|
||||||
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(pluginDownloadFailed(QString, QString)));
|
connect(handler, static_cast<void (DownloadHandler::*)(const QString &, const QString &)>(&DownloadHandler::downloadFinished)
|
||||||
|
, this, &SearchEngine::pluginDownloaded);
|
||||||
|
connect(handler, &DownloadHandler::downloadFailed, this, &SearchEngine::pluginDownloadFailed);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString path = source;
|
QString path = source;
|
||||||
@ -256,10 +258,12 @@ void SearchEngine::updateIconPath(PluginInfo * const plugin)
|
|||||||
|
|
||||||
void SearchEngine::checkForUpdates()
|
void SearchEngine::checkForUpdates()
|
||||||
{
|
{
|
||||||
// Download version file from update server on sourceforge
|
// Download version file from update server
|
||||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(m_updateUrl + "versions.txt");
|
using namespace Net;
|
||||||
connect(handler, SIGNAL(downloadFinished(QString, QByteArray)), this, SLOT(versionInfoDownloaded(QString, QByteArray)));
|
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(m_updateUrl + "versions.txt");
|
||||||
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(versionInfoDownloadFailed(QString, QString)));
|
connect(handler, static_cast<void (DownloadHandler::*)(const QString &, const QByteArray &)>(&DownloadHandler::downloadFinished)
|
||||||
|
, this, &SearchEngine::versionInfoDownloaded);
|
||||||
|
connect(handler, &DownloadHandler::downloadFailed, this, &SearchEngine::versionInfoDownloadFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchEngine::cancelSearch()
|
void SearchEngine::cancelSearch()
|
||||||
@ -281,7 +285,7 @@ void SearchEngine::downloadTorrent(const QString &siteUrl, const QString &url)
|
|||||||
{
|
{
|
||||||
QProcess *downloadProcess = new QProcess(this);
|
QProcess *downloadProcess = new QProcess(this);
|
||||||
downloadProcess->setEnvironment(QProcess::systemEnvironment());
|
downloadProcess->setEnvironment(QProcess::systemEnvironment());
|
||||||
connect(downloadProcess, SIGNAL(finished(int)), this, SLOT(torrentFileDownloadFinished(int)));
|
connect(downloadProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &SearchEngine::torrentFileDownloadFinished);
|
||||||
m_downloaders << downloadProcess;
|
m_downloaders << downloadProcess;
|
||||||
QStringList params {
|
QStringList params {
|
||||||
Utils::Fs::toNativePath(engineLocation() + "/nova2dl.py"),
|
Utils::Fs::toNativePath(engineLocation() + "/nova2dl.py"),
|
||||||
|
@ -85,18 +85,18 @@ PluginSelectDlg::PluginSelectDlg(SearchEngine *pluginManager, QWidget *parent)
|
|||||||
|
|
||||||
m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
|
m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
|
||||||
|
|
||||||
connect(m_ui->actionEnable, SIGNAL(toggled(bool)), this, SLOT(enableSelection(bool)));
|
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDlg::enableSelection);
|
||||||
connect(m_ui->pluginsTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContextMenu(const QPoint&)));
|
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDlg::displayContextMenu);
|
||||||
connect(m_ui->pluginsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(togglePluginState(QTreeWidgetItem*, int)));
|
connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDlg::togglePluginState);
|
||||||
|
|
||||||
loadSupportedSearchPlugins();
|
loadSupportedSearchPlugins();
|
||||||
|
|
||||||
connect(m_pluginManager, SIGNAL(pluginInstalled(QString)), SLOT(pluginInstalled(QString)));
|
connect(m_pluginManager, &SearchEngine::pluginInstalled, this, &PluginSelectDlg::pluginInstalled);
|
||||||
connect(m_pluginManager, SIGNAL(pluginInstallationFailed(QString, QString)), SLOT(pluginInstallationFailed(QString, QString)));
|
connect(m_pluginManager, &SearchEngine::pluginInstallationFailed, this, &PluginSelectDlg::pluginInstallationFailed);
|
||||||
connect(m_pluginManager, SIGNAL(pluginUpdated(QString)), SLOT(pluginUpdated(QString)));
|
connect(m_pluginManager, &SearchEngine::pluginUpdated, this, &PluginSelectDlg::pluginUpdated);
|
||||||
connect(m_pluginManager, SIGNAL(pluginUpdateFailed(QString, QString)), SLOT(pluginUpdateFailed(QString, QString)));
|
connect(m_pluginManager, &SearchEngine::pluginUpdateFailed, this, &PluginSelectDlg::pluginUpdateFailed);
|
||||||
connect(m_pluginManager, &SearchEngine::checkForUpdatesFinished, this, &PluginSelectDlg::checkForUpdatesFinished);
|
connect(m_pluginManager, &SearchEngine::checkForUpdatesFinished, this, &PluginSelectDlg::checkForUpdatesFinished);
|
||||||
connect(m_pluginManager, SIGNAL(checkForUpdatesFailed(QString)), SLOT(checkForUpdatesFailed(QString)));
|
connect(m_pluginManager, &SearchEngine::checkForUpdatesFailed, this, &PluginSelectDlg::checkForUpdatesFailed);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
@ -294,9 +294,11 @@ void PluginSelectDlg::addNewPlugin(QString pluginName)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Icon is missing, we must download it
|
// Icon is missing, we must download it
|
||||||
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true);
|
using namespace Net;
|
||||||
connect(handler, SIGNAL(downloadFinished(QString, QString)), this, SLOT(iconDownloaded(QString, QString)));
|
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true);
|
||||||
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(iconDownloadFailed(QString, QString)));
|
connect(handler, static_cast<void (DownloadHandler::*)(const QString &, const QString &)>(&DownloadHandler::downloadFinished)
|
||||||
|
, this, &PluginSelectDlg::iconDownloaded);
|
||||||
|
connect(handler, &DownloadHandler::downloadFailed, this, &PluginSelectDlg::iconDownloadFailed);
|
||||||
}
|
}
|
||||||
item->setText(PLUGIN_VERSION, plugin->version);
|
item->setText(PLUGIN_VERSION, plugin->version);
|
||||||
}
|
}
|
||||||
@ -328,8 +330,8 @@ void PluginSelectDlg::finishPluginUpdate()
|
|||||||
void PluginSelectDlg::on_installButton_clicked()
|
void PluginSelectDlg::on_installButton_clicked()
|
||||||
{
|
{
|
||||||
PluginSourceDlg *dlg = new PluginSourceDlg(this);
|
PluginSourceDlg *dlg = new PluginSourceDlg(this);
|
||||||
connect(dlg, SIGNAL(askForLocalFile()), this, SLOT(askForLocalPlugin()));
|
connect(dlg, &PluginSourceDlg::askForLocalFile, this, &PluginSelectDlg::askForLocalPlugin);
|
||||||
connect(dlg, SIGNAL(askForUrl()), this, SLOT(askForPluginUrl()));
|
connect(dlg, &PluginSourceDlg::askForUrl, this, &PluginSelectDlg::askForPluginUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSelectDlg::askForPluginUrl()
|
void PluginSelectDlg::askForPluginUrl()
|
||||||
|
@ -105,14 +105,14 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
|||||||
m_ui->goToDescBtn->setIcon(GuiIconProvider::instance()->getIcon("application-x-mswinurl"));
|
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"));
|
m_ui->copyURLBtn->setIcon(GuiIconProvider::instance()->getIcon("edit-copy"));
|
||||||
connect(m_ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
connect(m_ui->tabWidget, &QTabWidget::tabCloseRequested, this, &SearchWidget::closeTab);
|
||||||
|
|
||||||
m_searchEngine = new SearchEngine;
|
m_searchEngine = new SearchEngine;
|
||||||
connect(m_searchEngine, SIGNAL(searchStarted()), SLOT(searchStarted()));
|
connect(m_searchEngine, &SearchEngine::searchStarted, this, &SearchWidget::searchStarted);
|
||||||
connect(m_searchEngine, SIGNAL(newSearchResults(QList<SearchResult>)), SLOT(appendSearchResults(QList<SearchResult>)));
|
connect(m_searchEngine, &SearchEngine::newSearchResults, this, &SearchWidget::appendSearchResults);
|
||||||
connect(m_searchEngine, SIGNAL(searchFinished(bool)), SLOT(searchFinished(bool)));
|
connect(m_searchEngine, &SearchEngine::searchFinished, this, &SearchWidget::searchFinished);
|
||||||
connect(m_searchEngine, SIGNAL(searchFailed()), SLOT(searchFailed()));
|
connect(m_searchEngine, &SearchEngine::searchFailed, this, &SearchWidget::searchFailed);
|
||||||
connect(m_searchEngine, SIGNAL(torrentFileDownloaded(QString)), SLOT(addTorrentToSession(QString)));
|
connect(m_searchEngine, &SearchEngine::torrentFileDownloaded, this, &SearchWidget::addTorrentToSession);
|
||||||
|
|
||||||
// Fill in category combobox
|
// Fill in category combobox
|
||||||
fillCatCombobox();
|
fillCatCombobox();
|
||||||
@ -120,9 +120,9 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
|||||||
|
|
||||||
selectActivePage();
|
selectActivePage();
|
||||||
|
|
||||||
connect(m_ui->m_searchPattern, SIGNAL(returnPressed()), m_ui->searchButton, SLOT(click()));
|
connect(m_ui->m_searchPattern, &LineEdit::returnPressed, m_ui->searchButton, &QPushButton::click);
|
||||||
connect(m_ui->m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
|
connect(m_ui->m_searchPattern, &LineEdit::textEdited, this, &SearchWidget::searchTextEdited);
|
||||||
connect(m_ui->selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int)));
|
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SearchWidget::selectMultipleBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchWidget::fillCatCombobox()
|
void SearchWidget::fillCatCombobox()
|
||||||
@ -242,8 +242,8 @@ void SearchWidget::addTorrentToSession(const QString &source)
|
|||||||
void SearchWidget::on_pluginsButton_clicked()
|
void SearchWidget::on_pluginsButton_clicked()
|
||||||
{
|
{
|
||||||
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
|
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
|
||||||
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillCatCombobox()));
|
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::fillCatCombobox);
|
||||||
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillPluginComboBox()));
|
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::fillPluginComboBox);
|
||||||
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::selectActivePage);
|
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::selectActivePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user