Пример #1
0
int UserInputMapper::findAction(const QString& actionName) const {
    auto actions = getAllActions();
    for (auto action : actions) {
        if (getActionName(action) == actionName) {
            return action;
        }
    }
    // If the action isn't found, return -1
    return -1;
}
Пример #2
0
int ControllerScriptingInterface::findAction(QString actionName) {
    auto userInputMapper = DependencyManager::get<UserInputMapper>();
    auto actions = getAllActions();
    for (auto action : actions) {
        if (userInputMapper->getActionName(action) == actionName) {
            return action;
        }
    }
    // If the action isn't found, return -1
    return -1;
}
Пример #3
0
void Actions::init()
{
    clear();

    mGeneralActionInfo = getAllActions();
    GeneralActionInfos::const_iterator M = mGeneralActionInfo.constEnd();
    for (GeneralActionInfos::const_iterator I = mGeneralActionInfo.constBegin(); I != M; ++I)
    {
        if (I.value().type == QLatin1String("client"))
        {
            QString shortcut;
            QString description;
            bool enabled = false;
            QDBusObjectPath path;
            if (getClientActionInfoById(I.key(), shortcut, description, enabled, path))
            {
                ClientActionInfo info;
                info.shortcut = shortcut;
                info.description = description;
                info.enabled = enabled;
                info.path = path;
                mClientActionInfo[I.key()] = info;

                updateClientActionSender(I.key());
            }
        }
        else if (I.value().type == QLatin1String("method"))
        {
            QString shortcut;
            QString description;
            bool enabled = false;
            QString service;
            QDBusObjectPath path;
            QString interface;
            QString method;
            if (getMethodActionInfoById(I.key(), shortcut, description, enabled, service, path, interface, method))
            {
                MethodActionInfo info;
                info.shortcut = shortcut;
                info.description = description;
                info.enabled = enabled;
                info.service = service;
                info.path = path;
                info.interface = interface;
                info.method = method;
                mMethodActionInfo[I.key()] = info;
            }
        }
        else if (I.value().type == QLatin1String("command"))
        {
            QString shortcut;
            QString description;
            bool enabled = false;
            QString command;
            QStringList arguments;
            if (getCommandActionInfoById(I.key(), shortcut, description, enabled, command, arguments))
            {
                CommandActionInfo info;
                info.shortcut = shortcut;
                info.description = description;
                info.enabled = enabled;
                info.command = command;
                info.arguments = arguments;
                mCommandActionInfo[I.key()] = info;
            }
        }
    }

    mMultipleActionsBehaviour = static_cast<MultipleActionsBehaviour>(getMultipleActionsBehaviour());
}