Exemplo n.º 1
0
	QMap<QString, ActionInfo> Poshuku::GetActionInfo () const
	{
		BrowserWidget bw;
		QMap<QString, ActionInfo> result = bw.GetActionInfo ();
		result ["EAImportXbel_"] = ActionInfo (ImportXbel_->text (),
				QKeySequence (), ImportXbel_->icon ());
		result ["EAExportXbel_"] = ActionInfo (ExportXbel_->text (),
				QKeySequence (), ExportXbel_->icon ());
		result ["EACheckFavorites_"] = ActionInfo (CheckFavorites_->text (),
				QKeySequence (), CheckFavorites_->icon ());
		return result;
	}
Exemplo n.º 2
0
	QMap<QString, ActionInfo> Plugin::GetActionInfo () const
	{
		QMap<QString, ActionInfo> result;
		result ["ShowList"] = ActionInfo (ActionGlance_->text (),
				ActionGlance_->shortcut (),
				Proxy_->GetIcon (ActionGlance_->property ("ActionIcon").toString ()));
		return result;
	}
Exemplo n.º 3
0
			QMap<QString, ActionInfo> Plugin::GetActionInfo () const
			{
				QMap<QString, ActionInfo> result;
				result ["TabPPActivator"] = ActionInfo (tr ("Show tab switcher"),
						Dock_->GetActivatorAction ()->shortcut (),
						Dock_->GetActivatorAction ()->icon ());
				return result;
			}
Exemplo n.º 4
0
	QMap<QString, ActionInfo> Plugin::GetActionInfo () const
	{
		QMap<QString, ActionInfo> result;
		const auto& iconName = ShowList_->property ("ActionIcon").toString ();
		result ["ShowList"] = ActionInfo (ShowList_->text (),
				ShowList_->shortcut (),
				Proxy_->GetIconThemeManager ()->GetIcon (iconName));
		return result;
	}
void DefaultExecutionEngine::addAction(AbstractAction* action)
{
    ActionInfo::Info info = ActionInfo::Passiv;
    if ((action->precondition == NULL) || !containsAction(action->precondition)) {
        info = ActionInfo::Active;
        action->precondition = NULL;
        action->onBegin(this);
    }
    actions.push_back(ActionInfo(info, action));
}
Exemplo n.º 6
0
void UnitStateMgr::PushAction(UnitActionId actionId, UnitActionPtr state, UnitActionPriority priority, eActionType restoreable)
{
    ActionInfo* oldInfo = CurrentState();
    UnitActionPriority _priority = oldInfo ? oldInfo->priority : UNIT_ACTION_PRIORITY_IDLE;

    // Only interrupt action, if not drop his below and action lower by priority
    if (oldInfo &&
        oldInfo->HasFlag(ACTION_STATE_ACTIVE) && 
        oldInfo->Id != actionId &&
        _priority < priority)
        oldInfo->Interrupt(this);

    if (_priority > UNIT_ACTION_PRIORITY_IDLE)
    {
        // Some speedup - testing - not need drop Idle/None actions
        DropAction(actionId, priority);
        DropAction(priority);
    }

    bool needInsert = true;

    if (restoreable != ACTION_TYPE_NONRESTOREABLE)
    {
        // Don't replace (only interrupt and reset!) restoreable actions
        UnitActionStorage::iterator itr = m_actions.find(priority);
        if (itr != m_actions.end())
        {
            if (itr->second.Id == actionId)
            {
                itr->second.Reset(this);
                needInsert = false;
            }
        }
    }

    if (needInsert)
        m_actions.insert(UnitActionStorage::value_type(priority,ActionInfo(actionId, state, priority, restoreable)));

    IncreaseCounter(actionId);
/*
    ActionInfo* newInfo = CurrentState();
    if (newInfo && newInfo != oldInfo)
    {
        if (!newInfo->HasFlag(ACTION_STATE_INITIALIZED))
            newInfo->Initialize(this);
    }
*/
}
Exemplo n.º 7
0
bool KAccelBase::insertConnection(KAccelAction *pAction)
{
    if(!pAction->m_pObjSlot || !pAction->m_psMethodSlot)
        return true;

    kdDebug(125) << "KAccelBase::insertConnection( " << pAction << "=\"" << pAction->m_sName
                 << "\"; shortcut = " << pAction->shortcut().toStringInternal() << " )  this = " << this << endl;

    // For each sequence associated with the given action:
    for(uint iSeq = 0; iSeq < pAction->shortcut().count(); iSeq++)
    {
        // Get the first key of the sequence.
        KKeyServer::Variations vars;
        vars.init(pAction->shortcut().seq(iSeq).key(0), !m_bNativeKeys);
        for(uint iVari = 0; iVari < vars.count(); iVari++)
        {
            const KKeyServer::Key &key = vars.key(iVari);

            // if( !key.isNull() ) {
            if(key.sym())
            {
                if(!m_mapKeyToAction.contains(key))
                {
                    // If this is a single-key shortcut,
                    if(pAction->shortcut().seq(iSeq).count() == 1)
                    {
                        m_mapKeyToAction[key] = ActionInfo(pAction, iSeq, iVari);
                        if(connectKey(*pAction, key))
                            pAction->incConnections();
                    }
                    // Else this is a multi-key shortcut,
                    else
                    {
                        m_mapKeyToAction[key] = ActionInfo(0, 0, 0);
                        // Insert into non-unique list if it's not already there.
                        if(m_rgActionsNonUnique.findIndex(pAction) == -1)
                            m_rgActionsNonUnique.append(pAction);
                        if(connectKey(key))
                            pAction->incConnections();
                    }
                }
                else
                {
                    // There is a key conflict.  A full update
                    //  check is necessary.
                    // TODO: make this more efficient where possible.
                    if(m_mapKeyToAction[key].pAction != pAction && m_mapKeyToAction[key].pAction != 0)
                    {
                        kdDebug(125) << "Key conflict with action = " << m_mapKeyToAction[key].pAction->name()
                                     << " key = " << key.key().toStringInternal() << " : call updateConnections()" << endl;
                        return updateConnections();
                    }
                }
            }
        }
    }

    // kdDebug(125) << "\tActions = " << m_rgActions.size() << endl;
    // for( KAccelActions::const_iterator it = m_rgActions.begin(); it != m_rgActions.end(); ++it ) {
    //	kdDebug(125) << "\t" << &(*it) << " '" << (*it).m_sName << "'" << endl;
    //}

    // kdDebug(125) << "\tKeys = " << m_mapKeyToAction.size() << endl;
    // for( KKeyToActionMap::iterator it = m_mapKeyToAction.begin(); it != m_mapKeyToAction.end(); ++it ) {
    //	//kdDebug(125) << "\tKey: " << it.key().toString() << " => '" << (*it)->m_sName << "'" << endl;
    //	kdDebug(125) << "\tKey: " << it.key().toString() << " => '" << *it << "'" << endl;
    //	kdDebug(125) << "\t\t'" << (*it)->m_sName << "'" << endl;
    //}

    return true;
}