Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
actions-hint-data.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
14#include "actions-hint-data.h"
15#include <glibmm/i18n.h>
16
17std::vector<Glib::ustring>
19{
20 // To get all the Placeholder hints
21 std::vector<Glib::ustring> action_names;
22 for (auto hint : data) {
23 action_names.emplace_back(hint.first);
24 }
25 return action_names;
26}
27
28Glib::ustring
29InkActionHintData::get_tooltip_hint_for_action(Glib::ustring const &action_name, bool translated)
30{
31 // Hint for a particular Action
32 Glib::ustring value;
33 auto search = data.find(action_name);
34 if (search != data.end()) {
35 value = translated ? _(search->second.c_str()) : search->second;
36 }
37 return value;
38}
39
40void
41InkActionHintData::add_data(std::vector<std::vector<Glib::ustring>> &hint_data)
42{
43 for (auto hint : hint_data) {
44 // Action Name , Hint
45 data.emplace(hint[0], hint[1]);
46 }
47}
const char * action_name
Authors: Sushant A A sushant.co19@gmail.com
void add_data(std::vector< std::vector< Glib::ustring > > &raw_data)
Glib::ustring get_tooltip_hint_for_action(Glib::ustring const &action_name, bool translated=true)
std::vector< Glib::ustring > get_actions()
std::map< Glib::ustring, Glib::ustring > data