mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
[partition] Fix parsing of partition size in partition layout
When setting the size of a partition without indicating the unit, two problems occur: - the size is parsed as an integer, not as a string, hence the configuration parsing fails - the size parser doesn't recognize the fact that the size has no units and defaults to 100% This patch fixes the configuration parsing as well as the size string parsing. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
parent
18bb71aceb
commit
cf45d55b32
2 changed files with 24 additions and 4 deletions
|
@ -57,11 +57,18 @@ parseSizeString( QString sizeString, PartitionLayout::SizeUnit *unit )
|
|||
{
|
||||
double value;
|
||||
bool ok;
|
||||
QString valueString;
|
||||
QString unitString;
|
||||
|
||||
QRegExp rx( "[KkMmGg%]" );
|
||||
int pos = rx.indexIn( sizeString );
|
||||
QString valueString = sizeString.mid( 0, pos );
|
||||
QString unitString = sizeString.mid( pos );
|
||||
if (pos > 0)
|
||||
{
|
||||
valueString = sizeString.mid( 0, pos );
|
||||
unitString = sizeString.mid( pos );
|
||||
}
|
||||
else
|
||||
valueString = sizeString;
|
||||
|
||||
value = valueString.toDouble( &ok );
|
||||
if ( !ok )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue