SynchronousProcess: Change exit code interpreter to function object

Change-Id: Ic48d4f5810f171c070f0980581fb6e45f6fe6b4a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2016-04-25 14:40:42 +02:00
parent cb08a44e7e
commit 967177d3d8
14 changed files with 54 additions and 126 deletions

View File

@@ -61,13 +61,6 @@ using namespace Core;
namespace UpdateInfo {
namespace Internal {
class IgnoreExitCode : public Utils::ExitCodeInterpreter
{
public:
IgnoreExitCode(QObject *parent);
Utils::SynchronousProcessResponse::Result interpretExitCode(int code) const override;
};
class UpdateInfoPluginPrivate
{
public:
@@ -84,17 +77,6 @@ public:
QDate m_lastCheckDate;
};
IgnoreExitCode::IgnoreExitCode(QObject *parent)
: Utils::ExitCodeInterpreter(parent)
{
}
Utils::SynchronousProcessResponse::Result IgnoreExitCode::interpretExitCode(int code) const
{
Q_UNUSED(code)
return Utils::SynchronousProcessResponse::Finished;
}
UpdateInfoPlugin::UpdateInfoPlugin()
: d(new UpdateInfoPluginPrivate)
{
@@ -147,7 +129,8 @@ void UpdateInfoPlugin::startCheckForUpdates()
connect(d->m_checkUpdatesCommand, &ShellCommand::stdOutText, this, &UpdateInfoPlugin::collectCheckForUpdatesOutput);
connect(d->m_checkUpdatesCommand, &ShellCommand::finished, this, &UpdateInfoPlugin::checkForUpdatesFinished);
d->m_checkUpdatesCommand->addJob(Utils::FileName(QFileInfo(d->m_maintenanceTool)), QStringList(QLatin1String("--checkupdates")),
/*workingDirectory=*/QString(), new IgnoreExitCode(d->m_checkUpdatesCommand));
/*workingDirectory=*/QString(),
[](int /*exitCode*/) { return Utils::SynchronousProcessResponse::Finished; });
d->m_checkUpdatesCommand->execute();
emit checkForUpdatesRunningChanged(true);
}