diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:50:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:50:49 +0000 |
commit | c853ffb5b2f75f5a889ed2e3ef89b818a736e87a (patch) | |
tree | 7d13a0883bb7936b84d6ecdd7bc332b41ed04bee /src/actions/actions-hint-data.cpp | |
parent | Initial commit. (diff) | |
download | inkscape-upstream.tar.xz inkscape-upstream.zip |
Adding upstream version 1.3+ds.upstream/1.3+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/actions/actions-hint-data.cpp')
-rw-r--r-- | src/actions/actions-hint-data.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/actions/actions-hint-data.cpp b/src/actions/actions-hint-data.cpp new file mode 100644 index 0000000..23cf368 --- /dev/null +++ b/src/actions/actions-hint-data.cpp @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** \file + * + * Command Palette input placeholder hint data + * + * Authors: + * Sushant A A <sushant.co19@gmail.com> + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include "actions-hint-data.h" +#include <glibmm/i18n.h> + +std::vector<Glib::ustring> +InkActionHintData::get_actions() +{ + // To get all the Placeholder hints + std::vector<Glib::ustring> action_names; + for (auto hint : data) { + action_names.emplace_back(hint.first); + } + return action_names; +} + +Glib::ustring +InkActionHintData::get_tooltip_hint_for_action(Glib::ustring const &action_name, bool translated) +{ + // Hint for a particular Action + Glib::ustring value; + auto search = data.find(action_name); + if (search != data.end()) { + value = translated ? _(search->second.c_str()) : search->second; + } + return value; +} + +void +InkActionHintData::add_data(std::vector<std::vector<Glib::ustring>> &hint_data) +{ + for (auto hint : hint_data) { + // Action Name , Hint + data.emplace(hint[0], hint[1]); + } +}
\ No newline at end of file |