|
|
@ -22,6 +22,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Yaml.h"
|
|
|
|
#include "utils/Yaml.h"
|
|
|
|
|
|
|
|
#include "utils/Units.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonDocument>
|
|
|
@ -37,6 +38,8 @@
|
|
|
|
namespace bp = boost::python;
|
|
|
|
namespace bp = boost::python;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using CalamaresUtils::operator""_MiB;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Calamares {
|
|
|
|
namespace Calamares {
|
|
|
|
|
|
|
|
|
|
|
|
GlobalStorage::GlobalStorage()
|
|
|
|
GlobalStorage::GlobalStorage()
|
|
|
@ -110,6 +113,30 @@ GlobalStorage::save(const QString& filename)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
|
|
|
GlobalStorage::load( const QString& filename )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QFile f( filename );
|
|
|
|
|
|
|
|
if ( !f.open( QFile::ReadOnly ) )
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QJsonParseError e;
|
|
|
|
|
|
|
|
QJsonDocument d = QJsonDocument::fromJson( f.read( 1_MiB ), &e );
|
|
|
|
|
|
|
|
if ( d.isNull() )
|
|
|
|
|
|
|
|
cWarning() << filename << e.errorString();
|
|
|
|
|
|
|
|
else if ( !d.isObject() )
|
|
|
|
|
|
|
|
cWarning() << filename << "Not suitable JSON.";
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto map = d.toVariant().toMap();
|
|
|
|
|
|
|
|
for( auto i = map.constBegin() ; i != map.constEnd() ; ++i )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
insert( i.key(), *i );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
GlobalStorage::saveYaml( const QString& filename )
|
|
|
|
GlobalStorage::saveYaml( const QString& filename )
|
|
|
|