Commit 498c7617 authored by Harald Sitter's avatar Harald Sitter 🐕

kbd preview: add error description

previously we've only had the error details which is a raw dump of the
output from xkbcomp, give it some nice context so users know what's
going on
parent 3e49c920
......@@ -119,6 +119,7 @@ int main(int argc, char *argv[])
memset(&componentNames, 0, sizeof(XkbComponentNamesRec));
XkbRF_GetComponents(rules, &varDefs, &componentNames);
QString errorDescription;
QString errorDetails;
std::unique_ptr<Geometry> geometry;
......@@ -143,6 +144,11 @@ int main(int argc, char *argv[])
setxkbmap.waitForFinished();
xkbcomp.waitForFinished();
errorDescription = i18nc("@label",
"The keyboard geometry failed to load."
" This often indicates that the selected model does not support a specific layout"
" or layout variant."
" This problem will likely also present when you try to use this combination of model, layout and variant.");
errorDetails = xkbcomp.readAllStandardOutput();
} else {
Q_ASSERT(xkb);
......@@ -172,6 +178,7 @@ int main(int argc, char *argv[])
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.rootContext()->setContextProperty("geometry", geometry.get());
engine.rootContext()->setContextProperty("errorDescription", errorDescription);
engine.rootContext()->setContextProperty("errorDetails", errorDetails);
engine.load(url);
......
......@@ -62,6 +62,13 @@ Window {
visible: false
anchors.fill: parent
Label {
Layout.fillWidth: true
text: errorDescription
color: activePalette.text
wrapMode: Text.WordWrap
}
TextArea {
Layout.fillWidth: true
text: errorDetails
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment