Browse Source

Use qt5 connect style for searchengine, pluginselectdlg and searchwidget.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
a77e1c9f36
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 28
      src/base/searchengine.cpp
  2. 28
      src/gui/search/pluginselectdlg.cpp
  3. 22
      src/gui/search/searchwidget.cpp

28
src/base/searchengine.cpp

@ -70,13 +70,13 @@ SearchEngine::SearchEngine() @@ -70,13 +70,13 @@ SearchEngine::SearchEngine()
m_searchProcess = new QProcess(this);
m_searchProcess->setEnvironment(QProcess::systemEnvironment());
connect(m_searchProcess, SIGNAL(started()), this, SIGNAL(searchStarted()));
connect(m_searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput()));
connect(m_searchProcess, SIGNAL(finished(int)), this, SLOT(processFinished(int)));
connect(m_searchProcess, &QProcess::started, this, &SearchEngine::searchStarted);
connect(m_searchProcess, &QProcess::readyReadStandardOutput, this, &SearchEngine::readSearchOutput);
connect(m_searchProcess, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &SearchEngine::processFinished);
m_searchTimeout = new QTimer(this);
m_searchTimeout->setSingleShot(true);
connect(m_searchTimeout, SIGNAL(timeout()), this, SLOT(onTimeout()));
connect(m_searchTimeout, &QTimer::timeout, this, &SearchEngine::onTimeout);
update();
}
@ -156,9 +156,11 @@ void SearchEngine::installPlugin(const QString &source) @@ -156,9 +156,11 @@ void SearchEngine::installPlugin(const QString &source)
qDebug("Asked to install plugin at %s", qPrintable(source));
if (Utils::Misc::isUrl(source)) {
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(source, true);
connect(handler, SIGNAL(downloadFinished(QString, QString)), this, SLOT(pluginDownloaded(QString, QString)));
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(pluginDownloadFailed(QString, QString)));
using namespace Net;
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(source, true);
connect(handler, static_cast<void (DownloadHandler::*)(const QString &, const QString &)>(&DownloadHandler::downloadFinished)
, this, &SearchEngine::pluginDownloaded);
connect(handler, &DownloadHandler::downloadFailed, this, &SearchEngine::pluginDownloadFailed);
}
else {
QString path = source;
@ -256,10 +258,12 @@ void SearchEngine::updateIconPath(PluginInfo * const plugin) @@ -256,10 +258,12 @@ void SearchEngine::updateIconPath(PluginInfo * const plugin)
void SearchEngine::checkForUpdates()
{
// Download version file from update server on sourceforge
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(m_updateUrl + "versions.txt");
connect(handler, SIGNAL(downloadFinished(QString, QByteArray)), this, SLOT(versionInfoDownloaded(QString, QByteArray)));
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(versionInfoDownloadFailed(QString, QString)));
// Download version file from update server
using namespace Net;
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(m_updateUrl + "versions.txt");
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()
@ -281,7 +285,7 @@ void SearchEngine::downloadTorrent(const QString &siteUrl, const QString &url) @@ -281,7 +285,7 @@ void SearchEngine::downloadTorrent(const QString &siteUrl, const QString &url)
{
QProcess *downloadProcess = new QProcess(this);
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;
QStringList params {
Utils::Fs::toNativePath(engineLocation() + "/nova2dl.py"),

28
src/gui/search/pluginselectdlg.cpp

@ -85,18 +85,18 @@ PluginSelectDlg::PluginSelectDlg(SearchEngine *pluginManager, QWidget *parent) @@ -85,18 +85,18 @@ PluginSelectDlg::PluginSelectDlg(SearchEngine *pluginManager, QWidget *parent)
m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
connect(m_ui->actionEnable, SIGNAL(toggled(bool)), this, SLOT(enableSelection(bool)));
connect(m_ui->pluginsTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContextMenu(const QPoint&)));
connect(m_ui->pluginsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(togglePluginState(QTreeWidgetItem*, int)));
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDlg::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDlg::displayContextMenu);
connect(m_ui->pluginsTree, &QTreeWidget::itemDoubleClicked, this, &PluginSelectDlg::togglePluginState);
loadSupportedSearchPlugins();
connect(m_pluginManager, SIGNAL(pluginInstalled(QString)), SLOT(pluginInstalled(QString)));
connect(m_pluginManager, SIGNAL(pluginInstallationFailed(QString, QString)), SLOT(pluginInstallationFailed(QString, QString)));
connect(m_pluginManager, SIGNAL(pluginUpdated(QString)), SLOT(pluginUpdated(QString)));
connect(m_pluginManager, SIGNAL(pluginUpdateFailed(QString, QString)), SLOT(pluginUpdateFailed(QString, QString)));
connect(m_pluginManager, &SearchEngine::pluginInstalled, this, &PluginSelectDlg::pluginInstalled);
connect(m_pluginManager, &SearchEngine::pluginInstallationFailed, this, &PluginSelectDlg::pluginInstallationFailed);
connect(m_pluginManager, &SearchEngine::pluginUpdated, this, &PluginSelectDlg::pluginUpdated);
connect(m_pluginManager, &SearchEngine::pluginUpdateFailed, this, &PluginSelectDlg::pluginUpdateFailed);
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();
}
@ -294,9 +294,11 @@ void PluginSelectDlg::addNewPlugin(QString pluginName) @@ -294,9 +294,11 @@ void PluginSelectDlg::addNewPlugin(QString pluginName)
}
else {
// Icon is missing, we must download it
Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true);
connect(handler, SIGNAL(downloadFinished(QString, QString)), this, SLOT(iconDownloaded(QString, QString)));
connect(handler, SIGNAL(downloadFailed(QString, QString)), this, SLOT(iconDownloadFailed(QString, QString)));
using namespace Net;
DownloadHandler *handler = DownloadManager::instance()->downloadUrl(plugin->url + "/favicon.ico", true);
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);
}
@ -328,8 +330,8 @@ void PluginSelectDlg::finishPluginUpdate() @@ -328,8 +330,8 @@ void PluginSelectDlg::finishPluginUpdate()
void PluginSelectDlg::on_installButton_clicked()
{
PluginSourceDlg *dlg = new PluginSourceDlg(this);
connect(dlg, SIGNAL(askForLocalFile()), this, SLOT(askForLocalPlugin()));
connect(dlg, SIGNAL(askForUrl()), this, SLOT(askForPluginUrl()));
connect(dlg, &PluginSourceDlg::askForLocalFile, this, &PluginSelectDlg::askForLocalPlugin);
connect(dlg, &PluginSourceDlg::askForUrl, this, &PluginSelectDlg::askForPluginUrl);
}
void PluginSelectDlg::askForPluginUrl()

22
src/gui/search/searchwidget.cpp

@ -105,14 +105,14 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) @@ -105,14 +105,14 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
m_ui->goToDescBtn->setIcon(GuiIconProvider::instance()->getIcon("application-x-mswinurl"));
m_ui->pluginsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
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;
connect(m_searchEngine, SIGNAL(searchStarted()), SLOT(searchStarted()));
connect(m_searchEngine, SIGNAL(newSearchResults(QList<SearchResult>)), SLOT(appendSearchResults(QList<SearchResult>)));
connect(m_searchEngine, SIGNAL(searchFinished(bool)), SLOT(searchFinished(bool)));
connect(m_searchEngine, SIGNAL(searchFailed()), SLOT(searchFailed()));
connect(m_searchEngine, SIGNAL(torrentFileDownloaded(QString)), SLOT(addTorrentToSession(QString)));
connect(m_searchEngine, &SearchEngine::searchStarted, this, &SearchWidget::searchStarted);
connect(m_searchEngine, &SearchEngine::newSearchResults, this, &SearchWidget::appendSearchResults);
connect(m_searchEngine, &SearchEngine::searchFinished, this, &SearchWidget::searchFinished);
connect(m_searchEngine, &SearchEngine::searchFailed, this, &SearchWidget::searchFailed);
connect(m_searchEngine, &SearchEngine::torrentFileDownloaded, this, &SearchWidget::addTorrentToSession);
// Fill in category combobox
fillCatCombobox();
@ -120,9 +120,9 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) @@ -120,9 +120,9 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
selectActivePage();
connect(m_ui->m_searchPattern, SIGNAL(returnPressed()), m_ui->searchButton, SLOT(click()));
connect(m_ui->m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
connect(m_ui->selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int)));
connect(m_ui->m_searchPattern, &LineEdit::returnPressed, m_ui->searchButton, &QPushButton::click);
connect(m_ui->m_searchPattern, &LineEdit::textEdited, this, &SearchWidget::searchTextEdited);
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SearchWidget::selectMultipleBox);
}
void SearchWidget::fillCatCombobox()
@ -242,8 +242,8 @@ void SearchWidget::addTorrentToSession(const QString &source) @@ -242,8 +242,8 @@ void SearchWidget::addTorrentToSession(const QString &source)
void SearchWidget::on_pluginsButton_clicked()
{
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillCatCombobox()));
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillPluginComboBox()));
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::fillCatCombobox);
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::fillPluginComboBox);
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::selectActivePage);
}

Loading…
Cancel
Save