[libcalamaresui] Chase timeout-type into the UI library

(TODO: move ProcessJobModule to libcalamares, it has no UI dependency)
This commit is contained in:
Adriaan de Groot 2019-08-01 22:51:52 +02:00
parent cac07c1472
commit e2504627aa
2 changed files with 9 additions and 4 deletions

View File

@ -72,10 +72,13 @@ ProcessJobModule::initFrom( const QVariantMap& moduleDescriptor )
m_command = moduleDescriptor.value( "command" ).toString(); m_command = moduleDescriptor.value( "command" ).toString();
} }
m_secondsTimeout = 30; m_secondsTimeout = std::chrono::seconds( 30 );
if ( moduleDescriptor.contains( "timeout" ) && !moduleDescriptor.value( "timeout" ).isNull() ) if ( moduleDescriptor.contains( "timeout" ) && !moduleDescriptor.value( "timeout" ).isNull() )
{ {
m_secondsTimeout = moduleDescriptor.value( "timeout" ).toInt(); int sec = moduleDescriptor.value( "timeout" ).toInt();
if ( sec < 0 )
sec = 0;
m_secondsTimeout = std::chrono::seconds( sec );
} }
m_runInChroot = false; m_runInChroot = false;
@ -88,7 +91,7 @@ ProcessJobModule::initFrom( const QVariantMap& moduleDescriptor )
ProcessJobModule::ProcessJobModule() ProcessJobModule::ProcessJobModule()
: Module() : Module()
, m_secondsTimeout( 30 ) , m_secondsTimeout( std::chrono::seconds( 30 ) )
, m_runInChroot( false ) , m_runInChroot( false )
{ {
} }

View File

@ -24,6 +24,8 @@
#include "UiDllMacro.h" #include "UiDllMacro.h"
#include <chrono>
namespace Calamares namespace Calamares
{ {
@ -46,7 +48,7 @@ private:
QString m_command; QString m_command;
QString m_workingPath; QString m_workingPath;
int m_secondsTimeout; std::chrono::seconds m_secondsTimeout;
bool m_runInChroot; bool m_runInChroot;
job_ptr m_job; job_ptr m_job;
}; };