[partition] Apply coding style to core/

This commit is contained in:
Adriaan de Groot 2021-06-18 11:23:27 +02:00
parent f9659989b1
commit 9fa5ab04e5
6 changed files with 32 additions and 21 deletions

View File

@ -208,9 +208,10 @@ Config::setSwapChoice( Config::SwapChoice c )
}
void
Config::setEraseFsTypeChoice(const QString& choice)
Config::setEraseFsTypeChoice( const QString& choice )
{
if(choice != m_eraseFsTypeChoice){
if ( choice != m_eraseFsTypeChoice )
{
m_eraseFsTypeChoice = choice;
}
}
@ -249,14 +250,18 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
gs->insert( "allowManualPartitioning",
CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
if ( configurationMap.contains( "availableFileSystemTypes" ) ) {
if(configurationMap.value( "availableFileSystemTypes" ).type() == QVariant::List ){
if ( configurationMap.contains( "availableFileSystemTypes" ) )
{
if ( configurationMap.value( "availableFileSystemTypes" ).type() == QVariant::List )
{
m_eraseFsTypes.clear();
m_eraseFsTypes.append(configurationMap.value( "availableFileSystemTypes" ).toStringList());
m_eraseFsTypeChoice = m_eraseFsTypes[0];
} else if ( configurationMap.value( "availableFileSystemTypes" ).type() == QVariant::String ){
m_eraseFsTypes.append(configurationMap.value( "availableFileSystemTypes" ).toString());
m_eraseFsTypeChoice = m_eraseFsTypes[0];
m_eraseFsTypes.append( configurationMap.value( "availableFileSystemTypes" ).toStringList() );
m_eraseFsTypeChoice = m_eraseFsTypes[ 0 ];
}
else if ( configurationMap.value( "availableFileSystemTypes" ).type() == QVariant::String )
{
m_eraseFsTypes.append( configurationMap.value( "availableFileSystemTypes" ).toString() );
m_eraseFsTypeChoice = m_eraseFsTypes[ 0 ];
}
}

View File

@ -96,9 +96,9 @@ public:
*/
SwapChoice swapChoice() const { return m_swapChoice; }
EraseFsTypesSet eraseFsTypes() const {return m_eraseFsTypes; }
EraseFsTypesSet eraseFsTypes() const { return m_eraseFsTypes; }
QString eraseFsType() const {return m_eraseFsTypeChoice; }
QString eraseFsType() const { return m_eraseFsTypeChoice; }
///@brief Is manual partitioning allowed (not explicitly disnabled in the config file)?

View File

@ -10,8 +10,8 @@
#include "DeviceList.h"
#include "utils/Logger.h"
#include "partition/PartitionIterator.h"
#include "utils/Logger.h"
#include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h>
@ -133,11 +133,11 @@ getDevices( DeviceType which )
#endif
// Unsafe partitioning
auto removeInAllModes = []( DeviceList& l, DeviceList::iterator& it) { return erase(l, it); };
auto removeInSafeMode = []( DeviceList&, DeviceList::iterator& it) { return ++it; };
auto removeInAllModes = []( DeviceList& l, DeviceList::iterator& it ) { return erase( l, it ); };
auto removeInSafeMode = []( DeviceList&, DeviceList::iterator& it ) { return ++it; };
#else
// Safe partitioning
auto removeInAllModes = []( DeviceList& l, DeviceList::iterator& it) { return erase(l, it); };
auto removeInAllModes = []( DeviceList& l, DeviceList::iterator& it ) { return erase( l, it ); };
auto& removeInSafeMode = removeInAllModes;
#endif

View File

@ -177,7 +177,8 @@ canBeResized( Partition* candidate, const Logger::Once& o )
if ( availableStorageB > advisedStorageB )
{
cDebug() << o << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install.";
cDebug() << o << "Partition" << convenienceName( candidate )
<< "authorized for resize + autopartition install.";
return true;
}
else
@ -412,8 +413,14 @@ runOsprober( DeviceModel* dm )
FstabEntryList fstabEntries = lookForFstabEntries( path );
QString homePath = findPartitionPathForMountPoint( fstabEntries, "/home" );
osproberEntries.append(
{ prettyName, path, file, QString(), canBeResized( dm, path, o ), lineColumns, fstabEntries, homePath } );
osproberEntries.append( { prettyName,
path,
file,
QString(),
canBeResized( dm, path, o ),
lineColumns,
fstabEntries,
homePath } );
osproberCleanLines.append( line );
}
}

View File

@ -26,7 +26,7 @@ class DeviceModel;
class Partition;
namespace Logger
{
class Once;
class Once;
}
namespace PartUtils

View File

@ -258,7 +258,7 @@ PartitionCoreModule::doInit()
cDebug() << Logger::SubEntry << "node\tcapacity\tname\tprettyName";
for ( auto device : devices )
{
cDebug() << Logger::SubEntry << Logger::Pointer(device);
cDebug() << Logger::SubEntry << Logger::Pointer( device );
if ( device )
{
// Gives ownership of the Device* to the DeviceInfo object
@ -390,7 +390,6 @@ PartitionCoreModule::createPartitionTable( Device* device, PartitionTable::Table
OperationHelper helper( partitionModelForDevice( device ), this );
deviceInfo->makeJob< CreatePartitionTableJob >( type );
}
}