mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 20:05:37 -04:00
[keyboard] Refactor findLegacyKeymap into something testable
This commit is contained in:
parent
2e1dd8e7b1
commit
af3261b16f
1 changed files with 12 additions and 6 deletions
|
@ -79,8 +79,8 @@ SetKeyboardLayoutJob::findConvertedKeymap( const QString& convertedKeymapPath )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
STATICTEST QString
|
||||||
SetKeyboardLayoutJob::findLegacyKeymap() const
|
findLegacyKeymap( const QString& layout, const QString& model, const QString& variant )
|
||||||
{
|
{
|
||||||
cDebug() << "Looking for legacy keymap in QRC";
|
cDebug() << "Looking for legacy keymap in QRC";
|
||||||
|
|
||||||
|
@ -109,20 +109,20 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||||
// Determine how well matching this entry is
|
// Determine how well matching this entry is
|
||||||
// We assume here that we have one X11 layout. If the UI changes to
|
// We assume here that we have one X11 layout. If the UI changes to
|
||||||
// allow more than one layout, this should change too.
|
// allow more than one layout, this should change too.
|
||||||
if ( m_layout == mapping[ 1 ] )
|
if ( layout == mapping[ 1 ] )
|
||||||
// If we got an exact match, this is best
|
// If we got an exact match, this is best
|
||||||
{
|
{
|
||||||
matching = 10;
|
matching = 10;
|
||||||
}
|
}
|
||||||
// Look for an entry whose first layout matches ours
|
// Look for an entry whose first layout matches ours
|
||||||
else if ( mapping[ 1 ].startsWith( m_layout + ',' ) )
|
else if ( mapping[ 1 ].startsWith( layout + ',' ) )
|
||||||
{
|
{
|
||||||
matching = 5;
|
matching = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( matching > 0 )
|
if ( matching > 0 )
|
||||||
{
|
{
|
||||||
if ( m_model.isEmpty() || m_model == mapping[ 2 ] )
|
if ( model.isEmpty() || model == mapping[ 2 ] )
|
||||||
{
|
{
|
||||||
matching++;
|
matching++;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||||
mappingVariant.remove( 1, 0 );
|
mappingVariant.remove( 1, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_variant == mappingVariant )
|
if ( variant == mappingVariant )
|
||||||
{
|
{
|
||||||
matching++;
|
matching++;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,12 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||||
|
{
|
||||||
|
return ::findLegacyKeymap( m_layout, m_model, m_variant );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SetKeyboardLayoutJob::writeVConsoleData( const QString& vconsoleConfPath, const QString& convertedKeymapPath ) const
|
SetKeyboardLayoutJob::writeVConsoleData( const QString& vconsoleConfPath, const QString& convertedKeymapPath ) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue