From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/actions/actions-hint-data.cpp | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/actions/actions-hint-data.cpp (limited to 'src/actions/actions-hint-data.cpp') 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 + * + * Copyright (C) 2021 Authors + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include "actions-hint-data.h" +#include + +std::vector +InkActionHintData::get_actions() +{ + // To get all the Placeholder hints + std::vector 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> &hint_data) +{ + for (auto hint : hint_data) { + // Action Name , Hint + data.emplace(hint[0], hint[1]); + } +} \ No newline at end of file -- cgit v1.2.3