Cosmetics changes in search engine

This commit is contained in:
ngosang 2015-06-28 14:38:17 +02:00
parent 1bcfae5265
commit 326a74425f
2 changed files with 12 additions and 12 deletions

View file

@ -171,7 +171,7 @@ void engineSelectDlg::on_actionUninstall_triggered() {
} }
} }
if (error) if (error)
QMessageBox::warning(0, tr("Uninstall warning"), tr("Some plugins could not be uninstalled because they are included in qBittorrent.\n Only the ones you added yourself can be uninstalled.\nHowever, those plugins were disabled.")); QMessageBox::warning(0, tr("Uninstall warning"), tr("Some plugins could not be uninstalled because they are included in qBittorrent. Only the ones you added yourself can be uninstalled.\nThose plugins were disabled."));
else else
QMessageBox::information(0, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully")); QMessageBox::information(0, tr("Uninstall success"), tr("All selected plugins were uninstalled successfully"));
} }
@ -234,7 +234,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
qDebug("Version to be installed: %.2f", new_version); qDebug("Version to be installed: %.2f", new_version);
if (!isUpdateNeeded(plugin_name, new_version)) { if (!isUpdateNeeded(plugin_name, new_version)) {
qDebug("Apparently update is not needed, we have a more recent version"); qDebug("Apparently update is not needed, we have a more recent version");
QMessageBox::information(this, tr("Search plugin install")+" -- qBittorrent", tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::information(this, tr("Search plugin install"), tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name));
return; return;
} }
// Process with install // Process with install
@ -259,12 +259,12 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
// restore backup // restore backup
QFile::copy(dest_path+".bak", dest_path); QFile::copy(dest_path+".bak", dest_path);
Utils::Fs::forceRemove(dest_path+".bak"); Utils::Fs::forceRemove(dest_path+".bak");
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::warning(this, tr("Search plugin install"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name));
return; return;
} else { } else {
// Remove broken file // Remove broken file
Utils::Fs::forceRemove(dest_path); Utils::Fs::forceRemove(dest_path);
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::warning(this, tr("Search plugin install"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name));
return; return;
} }
} }
@ -274,10 +274,10 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
qreal version = SearchEngine::getPluginVersion(Utils::Fs::searchEngineLocation() + "/engines/" + plugin_name + ".py"); qreal version = SearchEngine::getPluginVersion(Utils::Fs::searchEngineLocation() + "/engines/" + plugin_name + ".py");
QTreeWidgetItem *item = findItemWithID(plugin_name); QTreeWidgetItem *item = findItemWithID(plugin_name);
item->setText(ENGINE_VERSION, QString::number(version, 'f', 2)); item->setText(ENGINE_VERSION, QString::number(version, 'f', 2));
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::information(this, tr("Search plugin install"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name));
return; return;
} else { } else {
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::information(this, tr("Search plugin install"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name));
return; return;
} }
} }
@ -354,7 +354,7 @@ void engineSelectDlg::askForPluginUrl() {
void engineSelectDlg::askForLocalPlugin() { void engineSelectDlg::askForLocalPlugin() {
QStringList pathsList = QFileDialog::getOpenFileNames(0, QStringList pathsList = QFileDialog::getOpenFileNames(0,
tr("Select search plugins"), QDir::homePath(), tr("Select search plugins"), QDir::homePath(),
tr("qBittorrent search plugins")+QString::fromUtf8(" (*.py)")); tr("qBittorrent search plugin")+QString::fromUtf8(" (*.py)"));
QString path; QString path;
foreach (path, pathsList) { foreach (path, pathsList) {
if (path.endsWith(".py", Qt::CaseInsensitive)) { if (path.endsWith(".py", Qt::CaseInsensitive)) {
@ -406,7 +406,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) {
// Clean up tmp file // Clean up tmp file
Utils::Fs::forceRemove(versions_file); Utils::Fs::forceRemove(versions_file);
if (file_correct && !updated) { if (file_correct && !updated) {
QMessageBox::information(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("All your plugins are already up to date.")); QMessageBox::information(this, tr("Search plugin update"), tr("All your plugins are already up to date."));
} }
return file_correct; return file_correct;
} }
@ -447,7 +447,7 @@ void engineSelectDlg::processDownloadedFile(const QString &url, QString filePath
} }
if (url.endsWith("versions.txt")) { if (url.endsWith("versions.txt")) {
if (!parseVersionsFile(filePath)) { if (!parseVersionsFile(filePath)) {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, update server is temporarily unavailable."));
} }
Utils::Fs::forceRemove(filePath); Utils::Fs::forceRemove(filePath);
return; return;
@ -468,13 +468,13 @@ void engineSelectDlg::handleDownloadFailure(const QString &url, const QString &r
return; return;
} }
if (url.endsWith("versions.txt")) { if (url.endsWith("versions.txt")) {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, update server is temporarily unavailable."));
return; return;
} }
if (url.endsWith(".py", Qt::CaseInsensitive)) { if (url.endsWith(".py", Qt::CaseInsensitive)) {
// a plugin update download has been failed // a plugin update download has been failed
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".py", "", Qt::CaseInsensitive); plugin_name.replace(".py", "", Qt::CaseInsensitive);
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name)); QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, %1 search plugin installation failed.", "%1 is the name of the search engine").arg(plugin_name));
} }
} }

View file

@ -527,7 +527,7 @@ void SearchEngine::on_download_button_clicked() {
QString torrent_url = model->data(model->index(index.row(), URL_COLUMN)).toString(); QString torrent_url = model->data(model->index(index.row(), URL_COLUMN)).toString();
QString engine_url = model->data(model->index(index.row(), ENGINE_URL_COLUMN)).toString(); QString engine_url = model->data(model->index(index.row(), ENGINE_URL_COLUMN)).toString();
downloadTorrent(engine_url, torrent_url); downloadTorrent(engine_url, torrent_url);
all_tab.at(tabWidget->currentIndex())->setRowColor(index.row(), "red"); all_tab.at(tabWidget->currentIndex())->setRowColor(index.row(), "blue");
} }
} }
} }