[fsresizer] Tiny step towards getting data from KPMcore

main
Adriaan de Groot 6 years ago
parent 579f1dfee7
commit 428929b64f

@ -22,6 +22,9 @@
#include <QDateTime> #include <QDateTime>
#include <QThread> #include <QThread>
#include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h>
#include "CalamaresVersion.h" #include "CalamaresVersion.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
@ -36,8 +39,8 @@ ResizeFSJob::RelativeSize::RelativeSize()
template<int N> template<int N>
void matchUnitSuffix( void matchUnitSuffix(
const QString& s, const QString& s,
const char (&suffix)[N], const char (&suffix)[N],
ResizeFSJob::RelativeSize::Unit matchedUnit, ResizeFSJob::RelativeSize::Unit matchedUnit,
int& value, int& value,
@ -50,15 +53,15 @@ void matchUnitSuffix(
unit = matchedUnit; unit = matchedUnit;
} }
} }
ResizeFSJob::RelativeSize::RelativeSize( const QString& s) ResizeFSJob::RelativeSize::RelativeSize( const QString& s)
: m_value( 0 ) : m_value( 0 )
, m_unit( None ) , m_unit( None )
{ {
matchUnitSuffix( s, "%", Percent, m_value, m_unit ); matchUnitSuffix( s, "%", Percent, m_value, m_unit );
matchUnitSuffix( s, "MiB", Absolute, m_value, m_unit ); matchUnitSuffix( s, "MiB", Absolute, m_value, m_unit );
if ( !m_value ) if ( !m_value )
m_unit = None; m_unit = None;
} }
@ -85,11 +88,18 @@ ResizeFSJob::prettyName() const
Calamares::JobResult Calamares::JobResult
ResizeFSJob::exec() ResizeFSJob::exec()
{ {
auto backend_p = CoreBackendManager::self()->backend();
if ( backend_p )
cDebug() << "KPMCore backend @" << (void *)backend_p << backend_p->id() << backend_p->version();
else
cDebug() << "No KPMCore backend";
if ( !isValid() ) if ( !isValid() )
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Invalid configuration" ), tr( "Invalid configuration" ),
tr( "The file-system resize job has an invalid configuration " tr( "The file-system resize job has an invalid configuration "
"and will not run." ) ); "and will not run." ) );
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }

Loading…
Cancel
Save