Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes
unity::shortcut::Hint Class Reference

#include <ShortcutHint.h>

Inheritance diagram for unity::shortcut::Hint:
Inheritance graph
[legend]
Collaboration diagram for unity::shortcut::Hint:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr
< AbstractHint
Ptr

Public Member Functions

 Hint (std::string const &category, std::string const &prefix, std::string const &postfix, std::string const &description, OptionType const type, std::string const &arg1, std::string const &arg2="", std::string const &arg3="")
 ~Hint ()
bool Fill ()

Public Attributes

nux::Property< std::string > category
nux::Property< std::string > prefix
nux::Property< std::string > postfix
nux::Property< std::string > description
nux::Property< OptionTypetype
nux::Property< std::string > arg1
nux::Property< std::string > arg2
nux::Property< std::string > arg3
nux::Property< std::string > value
nux::Property< std::string > shortkey

Detailed Description

Definition at line 30 of file ShortcutHint.h.


Member Typedef Documentation

typedef std::shared_ptr<AbstractHint> unity::shortcut::AbstractHint::Ptr [inherited]

Definition at line 46 of file AbstractShortcutHint.h.


Constructor & Destructor Documentation

unity::shortcut::Hint::Hint ( std::string const &  category,
std::string const &  prefix,
std::string const &  postfix,
std::string const &  description,
OptionType const  type,
std::string const &  arg1,
std::string const &  arg2 = "",
std::string const &  arg3 = "" 
)

Definition at line 37 of file ShortcutHint.cpp.

Definition at line 50 of file ShortcutHint.cpp.

{
}

Member Function Documentation

bool unity::shortcut::Hint::Fill ( ) [virtual]

Implements unity::shortcut::AbstractHint.

Definition at line 59 of file ShortcutHint.cpp.

{
  switch(type())
  {
    case COMPIZ_MOUSE_OPTION:
    {
      // Arg1 = Plugin name
      // Arg2 = key Option name
      CompPlugin* p = CompPlugin::find(arg1().c_str());

      if (!p) 
        return false;

      foreach (CompOption &opt, p->vTable->getOptions())
      {
          if (opt.name() == arg2())
          {
            std::string temp = impl::FixMouseShortcut(impl::FixShortcutFormat(opt.value().action().buttonToString()));
            temp = impl::ProperCase(temp);
            
            if (value() != temp)
            {
              value = temp;
              shortkey = prefix() + value() + postfix();
            }
              
            return true;
          }
      }

      break;
    }
    break;
    
    case COMPIZ_KEY_OPTION:
    {
      // Arg1 = Plugin name
      // Arg2 = key Option name
      CompPlugin* p = CompPlugin::find(arg1().c_str());

      if (!p) 
        return false;

      foreach (CompOption &opt, p->vTable->getOptions())
      {
          if (opt.name() == arg2())
          {
            std::string temp(impl::GetTranslatableLabel(opt.value().action().keyToString()));
            temp = impl::ProperCase(temp);
            
            if (value() != temp)
            {
              value = temp;
              shortkey = prefix() + value() + postfix();
            }
              
            return true;
          }
      }

      break;
    }
    case COMPIZ_METAKEY_OPTION:
    {
      // Arg1 = Plugin name
      // Arg2 = key Option name
      CompPlugin* p = CompPlugin::find(arg1().c_str());

      if (!p) 
        return false;

      foreach (CompOption &opt, p->vTable->getOptions())
      {
          if (opt.name() == arg2())
          {
            std::string temp(impl::GetMetaKey(opt.value().action().keyToString()));
            temp = impl::GetTranslatableLabel(temp);
            temp = impl::ProperCase(temp);
            
            if (value() != temp)
            {
              value = temp;
              shortkey = prefix() + value() + postfix();
            }
              
            return true;
          }
      }

      break;
    }
    case HARDCODED_OPTION:
      if (value != arg1())
      {
        value = arg1();
        shortkey = prefix() + value() + postfix();
      }
      return true;

    default:
      LOG_WARNING(logger) << "Unable to find the option type" << type(); 
  }

  return false;
}

Here is the call graph for this function:


Member Data Documentation

nux::Property<std::string> unity::shortcut::AbstractHint::arg1 [inherited]

Definition at line 94 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::arg2 [inherited]

Definition at line 95 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::arg3 [inherited]

Definition at line 96 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::category [inherited]

Definition at line 89 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::description [inherited]

Definition at line 92 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::postfix [inherited]

Definition at line 91 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::prefix [inherited]

Definition at line 90 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::shortkey [inherited]

Definition at line 98 of file AbstractShortcutHint.h.

nux::Property<OptionType> unity::shortcut::AbstractHint::type [inherited]

Definition at line 93 of file AbstractShortcutHint.h.

nux::Property<std::string> unity::shortcut::AbstractHint::value [inherited]

Definition at line 97 of file AbstractShortcutHint.h.


The documentation for this class was generated from the following files: