1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2011 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Authored by: Andrea Azzarone <azzaronea@gmail.com>
20
#include "ShortcutHint.h"
22
#include <core/core.h> // Compiz...
23
#include <NuxCore/Logger.h>
25
#include "ShortcutHintPrivate.h"
33
nux::logging::Logger logger("unity.shortcut");
34
} // anonymouse namespace
37
Hint::Hint(std::string const& category,
38
std::string const& prefix,
39
std::string const& postfix,
40
std::string const& description,
41
OptionType const type,
42
std::string const& arg1,
43
std::string const& arg2,
44
std::string const& arg3)
45
: AbstractHint(category, prefix, postfix, description, type, arg1, arg2, arg3)
55
* Gets and fills the shortcut value.
56
* Returns true if everything was OK, returns false otherwise.
57
* Use member property Value to get it.
63
case COMPIZ_MOUSE_OPTION:
66
// Arg2 = key Option name
67
CompPlugin* p = CompPlugin::find(arg1().c_str());
72
foreach (CompOption &opt, p->vTable->getOptions())
74
if (opt.name() == arg2())
76
std::string temp = impl::FixMouseShortcut(impl::FixShortcutFormat(opt.value().action().buttonToString()));
77
temp = impl::ProperCase(temp);
82
shortkey = prefix() + value() + postfix();
93
case COMPIZ_KEY_OPTION:
96
// Arg2 = key Option name
97
CompPlugin* p = CompPlugin::find(arg1().c_str());
102
foreach (CompOption &opt, p->vTable->getOptions())
104
if (opt.name() == arg2())
106
std::string temp = impl::FixShortcutFormat(opt.value().action().keyToString());
107
temp = impl::ProperCase(temp);
112
shortkey = prefix() + value() + postfix();
121
case HARDCODED_OPTION:
125
shortkey = prefix() + value() + postfix();
130
LOG_WARNING(logger) << "Unable to find the option type" << type();
136
} // namespace shortcut