[shellprocess] Tidy code
- resolve TODO, use a unique_ptr to hang onto the command-list - sort the #includes, use correct quoting
This commit is contained in:
parent
71a73ee1a1
commit
39cc13cb25
@ -18,10 +18,6 @@
|
||||
|
||||
#include "ShellProcessJob.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
|
||||
#include "CalamaresVersion.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
@ -30,6 +26,10 @@
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
|
||||
ShellProcessJob::ShellProcessJob( QObject* parent )
|
||||
: Calamares::CppJob( parent )
|
||||
, m_commands( nullptr )
|
||||
@ -37,11 +37,7 @@ ShellProcessJob::ShellProcessJob( QObject* parent )
|
||||
}
|
||||
|
||||
|
||||
ShellProcessJob::~ShellProcessJob()
|
||||
{
|
||||
delete m_commands;
|
||||
m_commands = nullptr; // TODO: UniquePtr
|
||||
}
|
||||
ShellProcessJob::~ShellProcessJob() {}
|
||||
|
||||
|
||||
QString
|
||||
@ -77,7 +73,7 @@ ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
|
||||
if ( configurationMap.contains( "script" ) )
|
||||
{
|
||||
m_commands = new CalamaresUtils::CommandList(
|
||||
m_commands = std::make_unique< CalamaresUtils::CommandList >(
|
||||
configurationMap.value( "script" ), !dontChroot, std::chrono::seconds( timeout ) );
|
||||
if ( m_commands->isEmpty() )
|
||||
{
|
||||
|
@ -19,16 +19,16 @@
|
||||
#ifndef SHELLPROCESSJOB_H
|
||||
#define SHELLPROCESSJOB_H
|
||||
|
||||
#include "CppJob.h"
|
||||
#include "PluginDllMacro.h"
|
||||
|
||||
#include "utils/CommandList.h"
|
||||
#include "utils/PluginFactory.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <CppJob.h>
|
||||
|
||||
#include <utils/CommandList.h>
|
||||
#include <utils/PluginFactory.h>
|
||||
|
||||
#include <PluginDllMacro.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class PLUGINDLLEXPORT ShellProcessJob : public Calamares::CppJob
|
||||
{
|
||||
@ -45,7 +45,7 @@ public:
|
||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||
|
||||
private:
|
||||
CalamaresUtils::CommandList* m_commands;
|
||||
std::unique_ptr< CalamaresUtils::CommandList > m_commands;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( ShellProcessJobFactory )
|
||||
|
Loading…
Reference in New Issue
Block a user