Commit Graph

54 Commits (d536173d66a03deade6c578156cc32a81bbe8d72)

Author SHA1 Message Date
Adriaan de Groot d536173d66 [keyboard] Factor out a 2-column k-v list
Adriaan de Groot 5afe54132b [keyboard] Use the models from Config
- Remove code that is duplicated in Config.
- Hook up UI for physical keyboard model, and back.
- For now, introduce some named slots with debugging output.
  This makes debugging a lot easier since we have function names
  to work with rather than anonymous lambdas
Adriaan de Groot 168be02c96 [keyboard] Hook up the model-selection again
Adriaan de Groot 87aafb2442 [keyboard] Tear up connections between widgets and model
Adriaan de Groot 6aedf4401f [keyboard] Apply coding style
Adriaan de Groot 5f1d7b2e8d [keyboard] Rename UI widgets to make code clearer
Adriaan de Groot d464e98e89 [keyboard] Move remaining variables to Config
- Config already *has* everythind, but drop the useless copies
  and duplicated code from the Page
- Plug the models model into the Page
- While here, document the model / layout / variant distinctions

The code doesn't fill the UI properly, and the drop-down
for the models combobox is not right, but at least the data
is shared.
Adriaan de Groot 0947cd8354 [keyboard] Migrate to Config::onActivate() which is badly-named
Adriaan de Groot 0ffa500432 [keyboard] Remove unused code
- this has already migrated to Config but had not been removed locally
Adriaan de Groot 35a2bd3f0f [keyboard] Use Config's own finalize()
Adriaan de Groot 14c079d1d6 [keyboard] Replace own copy of status by the one from Config
Adriaan de Groot acb5190217 [keyboard] Use Config methods rather than own copy
- this continues the port of the keyboard module to use the Config
  object, which was horribly botched earlier.
Adriaan de Groot a955791766 Apply coding style globally again
Adriaan de Groot 6b07bdf6ed [keyboard] Do not use deprecated Qt4-era indexChanged for text
Adriaan de Groot 2126be6d6d Warnings-- (~T() override)
Consistently use
	~T() override;
in class declarations (so no virtual in front, and avoid
warnings due to the missing override in back).
Adriaan de Groot 1cd9b93a22 REUSE: Giant boilerplate cleanup
- point to main Calamares site in the 'part of' headers instead
  of to github (this is the "this file is part of Calamares"
  opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
  this is the 3-paragraph summary of the GPL-3.0-or-later, which has
  a meaning entirely covered by the SPDX tag.
Adriaan de Groot 30a85668b7 REUSE: (GPL-3.0-or-later) C++ modules
Adriaan de Groot 192263cf9d [libcalamares][modules] Use compatibility for QString::split()
- Use the compatibility value, which has an enum value suitable
  for the Qt version in use.
Adriaan de Groot c6d147bde6 [keyboard] Give Canadian English the US keyboard layout, eh
Camilo Higuita 835850c02a [keyboardq] apply the style script
Adriaan de Groot b704933b58 [keyboard] Avoid crash with unconfigured keyboards
- If there's no items at all, ->currentItem() can return nullptr,
   so don't dereference that.

Found on FreeBSD.
Adriaan de Groot a1e08d2236 [keyboard] Don't use useless rvalue-ref
- Weird && usage here made redundant through RVO, just return
   something normally instead.
Adriaan de Groot cef2f50510 Reduce warnings about extra ;
- Trailing ; after Q_UNUSED
 - Trailing ; after CALAMARES_RETRANSLATE
Adriaan de Groot 520478847c Make logging more consistent.
- Across all the C++ modules, use Logger::SubEntry for sub/continues
   log lines, instead of somewhat-random indent strings.
Harald Sitter 311af6de5d [locale] prefer native language and country names when available
This basically means we talk about localization in the respective
localized variant. e.g. "German (Germany)" ➡ "Deutsch (Deutschland)".

If geoip lookup failed or isn't configured for whatever reason it's a
stretch to expect the user to know english enough to find their own
language. Preferring the localized strings resolves this issue.

Additionally this happens to bypass  respectively
https://bugreports.qt.io/browse/QTBUG-34287
as the native names are properly spelled. So, as long as Qt has localized
names the names will also be properly spelled.
Adriaan de Groot dd8e53dc22 Copyright: update copyright lines on files touched in 2018
Contributions from:
  Adriaan de Groot <groot@kde.org>
  Gabriel Craciunescu <crazy@frugalware.org>
  AlmAck <gluca86@gmail.com>
  Andrius Štikonas <andrius@stikonas.eu>
  Caio Carvalho <caiojcarvalho@gmail.com>
  Raul Rodrigo Segura <raurodse@gmail.com>
Adriaan de Groot ac769d1de8 Style: use QStringLiteral
- In many cases, using QLatin1String is a de-optimization, when
   applied to a C string literal. Kevin Kofler pointed out that
   those should basically all be QStringLiteral, instead. (Compile
   tests with -O3 show that in the optimized object file, the
   code size difference is negligible).
 - Drop the explicit constructor entirely in cases where we're calling
   QProcess::execute(), for consistency.
 - Do a little less messing around in the mapping of keyboard locales
   to keyboard map names.
Adriaan de Groot 3ff68bce98 [keyboard] Correct guessing for Arabic variants
Adriaan de Groot 7249b41e3e [keyboard] Explain table format, add more edge cases
Adriaan de Groot 0d56b9b9c5 Merge branch 'master' into i689-kayboard-layout
Adriaan de Groot 762ad54344 Documentation: change http links to GitHub to https
Adriaan de Groot 6704121946 Keyboard: try a little harder to match keyboard layouts with selected system language
Adriaan de Groot 9b9801d48d Code-style: format the keyboard module
Adriaan de Groot ea07d9e1d8 Merge branch 'master' into i689-kayboard-layout
Adriaan de Groot 3527c82327 Clang: make private internal class less visible
Adriaan de Groot bd3786ebeb Clang: reduce warnings in various places
Adriaan de Groot e9ab78cd52 Keyboard: special-case, pc+latin interpreted as us,
instead of as unknown which selects the first layout in the list.
Adriaan de Groot 6ef2f5d769 Keyboard: code-docs, copyright
Adriaan de Groot 59605d552e Keyboard: simplify execution of setxkbmap.
Use QProcess::execute() with the 'safer' argument-list, rather than
escaping and de-escaping strings. Also reduce noise by only passing
a variant if there is one.
Adriaan de Groot 88715b9a0f Keyboard: guess at layout based on locale
Split locale into <language>_<country> and go looking for keyboard
layouts that match. Do that in reverse, so look for country first.

- known weakness is el_CY (should get layout gr) because CY and el
  don't name any keyboard layout.
- known weakness are Hausa, Igbo .. which are ha_NG and ig_NG. They select
  keyboard layout ng, which is labeled "English (Nigeria)"; they ought
  to select ng(hausa) and ng(igbo), which are the right variant keyboard
  layouts to use.
- similar selecting a locale in Canada (en_CA, fr_CA, iu_CA ...) will
  select keyboard layout ca, which is for French-speaking Canada.
  Locale en_CA should select keyboard en -- e.g. en(us). But iu_CA
  (Inuktituk) needs layout ca(ike).
Adriaan de Groot 3ae12f2573 Keyboard: avoid multiple connects
When selecting keyboard layout, pause, then select another, the
QTimer wasn't being disconnected from the previously selected
language, so the second selection would fire the timeout, and
then call *two* slots .. and then three, ... Disconnect when
the timer fires, too.
Teo Mrnjavac 5bf4bb8787 Make writeEtcDefaultKeyboard an option in keyboard.conf.
Andrius Štikonas 9f0ca042fe Port away from most cases of Q_FOREACH to C++11 ranged for loop.
In order to avoid deep copies, Qt containers over which we iterate must be const
The remaining unported cases require qAsConst (Qt 5.7) or std::as_const (C++17)
Teo Mrnjavac 09f650ecf5 Use KeyboardLayoutModel+QListView instead of QListWidget, and defer setxkbmap until keyboardSearch is over.
Teo Mrnjavac 9bded2dcfc Initialize all members.
Kevin Kofler 9b75999706 keyboard: Preselect the current keyboard layout variant.
Teo Mrnjavac 52a1a28696 Fix focus handling in Keyboard page.
Teo Mrnjavac 688cc8f798 Use Retranslator in KeyboardPage.
Kevin Kofler 86d51b4a9c keyboard: Pass settings directly, not through GlobalStorage.
Pass the settings from keyboard.conf directly to the
SetKeyboardLayoutJob rather than through GlobalStorage.
Kevin Kofler 4f9f7d7858 keyboard: Write the keyboard model and layout settings to the root mount point.
This is implemented as a new SetKeyboardLayout job that does the work.

Portions of the code are adapted from systemd-localed's source code,
which is under a compatible license (LGPLv2.1+, can be converted to our
GPLv3+ license). I ported it from C to to C++/Qt and made some minor
tweaks to the mapping logic (from X11 to vconsole layouts) though.

Fixes .

Tested on a Fedora Remix (Kannolo 21) with the default module settings
(finds the converted X11 keymaps for the virtual console) and with
convertedKeymapPath: "" (does the legacy keymap conversion as expected).