[keyboard] Code tidy
- complain just once (globally) if ckbcomp is not found, rather than at every update to the layout. - tighten up QStringList constructor.
This commit is contained in:
parent
a1fce99a05
commit
4948f634ed
@ -124,10 +124,7 @@ KeyBoardPreview::loadCodes()
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList param;
|
||||
param << "-model"
|
||||
<< "pc106"
|
||||
<< "-layout" << layout << "-compact";
|
||||
QStringList param { "-model", "pc106", "-layout", layout, "-compact" };
|
||||
if ( !variant.isEmpty() )
|
||||
{
|
||||
param << "-variant" << variant;
|
||||
@ -140,13 +137,18 @@ KeyBoardPreview::loadCodes()
|
||||
process.start( "ckbcomp", param );
|
||||
if ( !process.waitForStarted() )
|
||||
{
|
||||
cWarning() << "ckbcomp not found , keyboard preview disabled";
|
||||
static bool need_warning = true;
|
||||
if ( need_warning )
|
||||
{
|
||||
cWarning() << "ckbcomp not found , keyboard preview disabled";
|
||||
need_warning = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !process.waitForFinished() )
|
||||
{
|
||||
cWarning() << "ckbcomp failed, keyboard preview disabled";
|
||||
cWarning() << "ckbcomp failed, keyboard preview skipped for" << layout << variant;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user