diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-05 03:36:25 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-05 03:36:25 -0600 |
commit | f4801b8134c88718f49292470fddf01cd630a57f (patch) | |
tree | e7be33c93a43ca3e01936fb9c5b5c14e22e7415f | |
parent | 08ec429042ff27d80c9bb978b12ca6ba2fb27b6b (diff) | |
download | horizon-f4801b8134c88718f49292470fddf01cd630a57f.tar.gz horizon-f4801b8134c88718f49292470fddf01cd630a57f.tar.bz2 horizon-f4801b8134c88718f49292470fddf01cd630a57f.tar.xz horizon-f4801b8134c88718f49292470fddf01cd630a57f.zip |
Actually refactor valid_keymaps into a reusable component
-rw-r--r-- | hscript/meta.cc | 11 | ||||
-rw-r--r-- | ui/qt5/inputpage.cc | 14 | ||||
-rw-r--r-- | util/keymaps.hh | 30 |
3 files changed, 32 insertions, 23 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc index ef6ff44..b5309f3 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -312,16 +312,7 @@ bool Language::execute(ScriptOptions opts) const { } -const std::set<std::string> valid_keymaps = { - "us", "ad", "af", "ara", "al", "am", "at", "az", "by", "be", "bd", "in", - "ba", "br", "bg", "ma", "mm", "ca", "cd", "cn", "hr", "cz", "dk", "nl", - "bt", "ee", "ir", "iq", "fo", "fi", "fr", "gh", "gn", "ge", "de", "gr", - "hu", "is", "il", "it", "jp", "kg", "kh", "kz", "la", "latam", "lt", "lv", - "mao", "me", "mk", "mt", "mn", "no", "pl", "pt", "ro", "ru", "rs", "si", - "sk", "es", "se", "ch", "sy", "tj", "lk", "th", "tr", "ua", "gb", "uz", - "vn", "kr", "ie", "pk", "mv", "za", "epo", "np", "ng", "et", "sn", "brai", - "tm", "ml", "tz", "ke", "bw", "ph" -}; +#include "util/keymaps.hh" Key *Keymap::parseFromData(const std::string &data, int lineno, int *errors, int *) { diff --git a/ui/qt5/inputpage.cc b/ui/qt5/inputpage.cc index 4717300..009fa86 100644 --- a/ui/qt5/inputpage.cc +++ b/ui/qt5/inputpage.cc @@ -16,19 +16,7 @@ #include <QLabel> #include <QVBoxLayout> -/* XXX TODO: Share with hscript/meta.cc - perhaps make a common header? */ -#include <set> -#include <string> -const std::set<std::string> valid_keymaps = { - "us", "ad", "af", "ara", "al", "am", "at", "az", "by", "be", "bd", "in", - "ba", "br", "bg", "ma", "mm", "ca", "cd", "cn", "hr", "cz", "dk", "nl", - "bt", "ee", "ir", "iq", "fo", "fi", "fr", "gh", "gn", "ge", "de", "gr", - "hu", "is", "il", "it", "jp", "kg", "kh", "kz", "la", "latam", "lt", "lv", - "mao", "me", "mk", "mt", "mn", "no", "pl", "pt", "ro", "ru", "rs", "si", - "sk", "es", "se", "ch", "sy", "tj", "lk", "th", "tr", "ua", "gb", "uz", - "vn", "kr", "ie", "pk", "mv", "za", "epo", "np", "ng", "et", "sn", "brai", - "tm", "ml", "tz", "ke", "bw", "ph" -}; +#include "util/keymaps.hh" #ifdef HAS_INSTALL_ENV #include <QProcess> diff --git a/util/keymaps.hh b/util/keymaps.hh new file mode 100644 index 0000000..91171dd --- /dev/null +++ b/util/keymaps.hh @@ -0,0 +1,30 @@ +/* + * keymaps.hh - Keymap definitions + * util, the utility library for + * Project Horizon + * + * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#ifndef HORIZON_KEYMAPS_HH_ +#define HORIZON_KEYMAPS_HH_ + +#include <set> +#include <string> + +const std::set<std::string> valid_keymaps = { + "us", "ad", "af", "ara", "al", "am", "at", "az", "by", "be", "bd", "in", + "ba", "br", "bg", "ma", "mm", "ca", "cd", "cn", "hr", "cz", "dk", "nl", + "bt", "ee", "ir", "iq", "fo", "fi", "fr", "gh", "gn", "ge", "de", "gr", + "hu", "is", "il", "it", "jp", "kg", "kh", "kz", "la", "latam", "lt", "lv", + "mao", "me", "mk", "mt", "mn", "no", "pl", "pt", "ro", "ru", "rs", "si", + "sk", "es", "se", "ch", "sy", "tj", "lk", "th", "tr", "ua", "gb", "uz", + "vn", "kr", "ie", "pk", "mv", "za", "epo", "np", "ng", "et", "sn", "brai", + "tm", "ml", "tz", "ke", "bw", "ph" +}; + +#endif /* !HORIZON_KEYMAPS_HH_ */ |