[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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList param;
|
QStringList param { "-model", "pc106", "-layout", layout, "-compact" };
|
||||||
param << "-model"
|
|
||||||
<< "pc106"
|
|
||||||
<< "-layout" << layout << "-compact";
|
|
||||||
if ( !variant.isEmpty() )
|
if ( !variant.isEmpty() )
|
||||||
{
|
{
|
||||||
param << "-variant" << variant;
|
param << "-variant" << variant;
|
||||||
@ -140,13 +137,18 @@ KeyBoardPreview::loadCodes()
|
|||||||
process.start( "ckbcomp", param );
|
process.start( "ckbcomp", param );
|
||||||
if ( !process.waitForStarted() )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !process.waitForFinished() )
|
if ( !process.waitForFinished() )
|
||||||
{
|
{
|
||||||
cWarning() << "ckbcomp failed, keyboard preview disabled";
|
cWarning() << "ckbcomp failed, keyboard preview skipped for" << layout << variant;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user