mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-28 15:34:16 +00:00
Aggregate installed/updated plugin names and use a single messagebox to inform the user.
This commit is contained in:
parent
c2a2d306da
commit
dee0b63cc5
@ -65,6 +65,7 @@ PluginSelectDlg::PluginSelectDlg(SearchEngine *pluginManager, QWidget *parent)
|
|||||||
, m_ui(new Ui::PluginSelectDlg())
|
, m_ui(new Ui::PluginSelectDlg())
|
||||||
, m_pluginManager(pluginManager)
|
, m_pluginManager(pluginManager)
|
||||||
, m_asyncOps(0)
|
, m_asyncOps(0)
|
||||||
|
, m_pendingUpdates(0)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
@ -314,6 +315,16 @@ void PluginSelectDlg::finishAsyncOp()
|
|||||||
setCursor(QCursor(Qt::ArrowCursor));
|
setCursor(QCursor(Qt::ArrowCursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginSelectDlg::finishPluginUpdate()
|
||||||
|
{
|
||||||
|
--m_pendingUpdates;
|
||||||
|
if (m_pendingUpdates == 0 && !m_updatedPlugins.isEmpty()) {
|
||||||
|
m_updatedPlugins.sort(Qt::CaseInsensitive);
|
||||||
|
QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(", ")));
|
||||||
|
m_updatedPlugins.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PluginSelectDlg::on_installButton_clicked()
|
void PluginSelectDlg::on_installButton_clicked()
|
||||||
{
|
{
|
||||||
PluginSourceDlg *dlg = new PluginSourceDlg(this);
|
PluginSourceDlg *dlg = new PluginSourceDlg(this);
|
||||||
@ -414,6 +425,7 @@ void PluginSelectDlg::checkForUpdatesFinished(const QHash<QString, PluginVersion
|
|||||||
|
|
||||||
foreach (const QString &pluginName, updateInfo.keys()) {
|
foreach (const QString &pluginName, updateInfo.keys()) {
|
||||||
startAsyncOp();
|
startAsyncOp();
|
||||||
|
m_pendingUpdates++;
|
||||||
m_pluginManager->updatePlugin(pluginName);
|
m_pluginManager->updatePlugin(pluginName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,13 +440,15 @@ void PluginSelectDlg::pluginInstalled(const QString &name)
|
|||||||
{
|
{
|
||||||
addNewPlugin(name);
|
addNewPlugin(name);
|
||||||
finishAsyncOp();
|
finishAsyncOp();
|
||||||
QMessageBox::information(this, tr("Search plugin install"), tr("\"%1\" search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(name));
|
m_updatedPlugins.append(name);
|
||||||
|
finishPluginUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSelectDlg::pluginInstallationFailed(const QString &name, const QString &reason)
|
void PluginSelectDlg::pluginInstallationFailed(const QString &name, const QString &reason)
|
||||||
{
|
{
|
||||||
finishAsyncOp();
|
finishAsyncOp();
|
||||||
QMessageBox::information(this, tr("Search plugin install"), tr("Couldn't install \"%1\" search engine plugin. %2").arg(name).arg(reason));
|
QMessageBox::information(this, tr("Search plugin install"), tr("Couldn't install \"%1\" search engine plugin. %2").arg(name).arg(reason));
|
||||||
|
finishPluginUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSelectDlg::pluginUpdated(const QString &name)
|
void PluginSelectDlg::pluginUpdated(const QString &name)
|
||||||
@ -443,7 +457,8 @@ void PluginSelectDlg::pluginUpdated(const QString &name)
|
|||||||
PluginVersion version = m_pluginManager->pluginInfo(name)->version;
|
PluginVersion version = m_pluginManager->pluginInfo(name)->version;
|
||||||
QTreeWidgetItem *item = findItemWithID(name);
|
QTreeWidgetItem *item = findItemWithID(name);
|
||||||
item->setText(PLUGIN_VERSION, version);
|
item->setText(PLUGIN_VERSION, version);
|
||||||
QMessageBox::information(this, tr("Search plugin install"), tr("\"%1\" search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(name));
|
m_updatedPlugins.append(name);
|
||||||
|
finishPluginUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,4 +466,5 @@ void PluginSelectDlg::pluginUpdateFailed(const QString &name, const QString &rea
|
|||||||
{
|
{
|
||||||
finishAsyncOp();
|
finishAsyncOp();
|
||||||
QMessageBox::information(this, tr("Search plugin update"), tr("Couldn't update \"%1\" search engine plugin. %2").arg(name).arg(reason));
|
QMessageBox::information(this, tr("Search plugin update"), tr("Couldn't update \"%1\" search engine plugin. %2").arg(name).arg(reason));
|
||||||
|
finishPluginUpdate();
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "base/searchengine.h"
|
#include "base/searchengine.h"
|
||||||
|
|
||||||
class QDropEvent;
|
class QDropEvent;
|
||||||
|
class QStringList;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
@ -88,10 +89,13 @@ private:
|
|||||||
void addNewPlugin(QString pluginName);
|
void addNewPlugin(QString pluginName);
|
||||||
void startAsyncOp();
|
void startAsyncOp();
|
||||||
void finishAsyncOp();
|
void finishAsyncOp();
|
||||||
|
void finishPluginUpdate();
|
||||||
|
|
||||||
Ui::PluginSelectDlg *m_ui;
|
Ui::PluginSelectDlg *m_ui;
|
||||||
SearchEngine *m_pluginManager;
|
SearchEngine *m_pluginManager;
|
||||||
|
QStringList m_updatedPlugins;
|
||||||
int m_asyncOps;
|
int m_asyncOps;
|
||||||
|
int m_pendingUpdates;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLUGINSELECTDLG_H
|
#endif // PLUGINSELECTDLG_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user