[libcalamares] GS improve load/save

- save should be const
- rename save() to saveJson() for parity with saveYaml()
This commit is contained in:
Adriaan de Groot 2020-08-07 00:01:20 +02:00
parent 104452513b
commit 0121e3755b
3 changed files with 7 additions and 7 deletions

View File

@ -94,7 +94,7 @@ GlobalStorage::debugDump() const
}
bool
GlobalStorage::save( const QString& filename )
GlobalStorage::saveJson( const QString& filename ) const
{
QFile f( filename );
if ( !f.open( QFile::WriteOnly ) )
@ -108,7 +108,7 @@ GlobalStorage::save( const QString& filename )
}
bool
GlobalStorage::load( const QString& filename )
GlobalStorage::loadJson( const QString& filename )
{
QFile f( filename );
if ( !f.open( QFile::ReadOnly ) )
@ -139,7 +139,7 @@ GlobalStorage::load( const QString& filename )
}
bool
GlobalStorage::saveYaml( const QString& filename )
GlobalStorage::saveYaml( const QString& filename ) const
{
return CalamaresUtils::saveYaml( filename, m );
}

View File

@ -94,7 +94,7 @@ public:
* and this JSON file will contain that password in-the-only-slightly-
* obscured form.
*/
bool save( const QString& filename );
bool saveJson( const QString& filename ) const;
/** @brief Adds the keys from the given JSON file
*
@ -103,13 +103,13 @@ public:
* the global storage. The storage is not cleared first: existing
* keys will remain; keys that also occur in the JSON file are overwritten.
*/
bool load( const QString& filename );
bool loadJson( const QString& filename );
/** @brief write as YAML to the given filename
*
* See also save(), above.
*/
bool saveYaml( const QString& filename );
bool saveYaml( const QString& filename ) const;
/** @brief reads settings from the given filename
*

View File

@ -138,7 +138,7 @@ PreserveFiles::exec()
}
if ( it.type == ItemType::Config )
{
if ( Calamares::JobQueue::instance()->globalStorage()->save( dest ) )
if ( Calamares::JobQueue::instance()->globalStorage()->saveJson( dest ) )
{
cWarning() << "Could not write config for" << dest;
}