当前位置: 首页>>代码示例>>C++>>正文


C++ ActionManager类代码示例

本文整理汇总了C++中ActionManager的典型用法代码示例。如果您正苦于以下问题:C++ ActionManager类的具体用法?C++ ActionManager怎么用?C++ ActionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ActionManager类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoAction

static int DoAction(lua_State *L) {
	const char* name = lua_tostring(L, -1);
	ActionManager* actionManager = App::getActionManager();
	actionManager->Do(name);
	lua_pop(L, 1);
	return 0;
}
开发者ID:sunxfancy,项目名称:artist,代码行数:7,代码来源:artistlib.cpp

示例2: foreach

void ModeManager::objectAdded(QObject *obj)
{
    IMode *mode = Aggregation::query<IMode>(obj);
    if (!mode)
        return;

    m_mainWindow->addContextObject(mode);

    // Count the number of modes with a higher priority
    int index = 0;
    foreach (const IMode *m, m_modes)
        if (m->priority() > mode->priority())
            ++index;

    m_modes.insert(index, mode);
    m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->name());

    // Register mode shortcut
    ActionManager *am = m_mainWindow->actionManager();
    const QString shortcutId = QLatin1String("GCS.Mode.") + mode->uniqueModeName();
    QShortcut *shortcut = new QShortcut(m_mainWindow);
    shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->name()));
    Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);

    m_modeShortcuts.insert(index, cmd);
    connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));

    setDefaultKeyshortcuts();

    m_signalMapper->setMapping(shortcut, mode->uniqueModeName());
    connect(shortcut, SIGNAL(activated()), m_signalMapper, SLOT(map()));
}
开发者ID:EATtomatoes,项目名称:TauLabs,代码行数:32,代码来源:modemanager.cpp

示例3: RegisterAction

static int RegisterAction(lua_State *L) {
	const char* name = lua_tostring(L, -2);
	const char* code = lua_tostring(L, -1);
	ActionManager* actionManager = App::getActionManager();
	actionManager->Register(name, code);
	lua_pop(L, 2);
	return 0;
}
开发者ID:sunxfancy,项目名称:artist,代码行数:8,代码来源:artistlib.cpp

示例4: TRACEST

BOOL MenuManager::HandleGeneralCommands(MenuCommandsEnum cmd)
{
	TRACEST(_T("MenuManager::HandleGeneralCommands"), cmd);
	PrgAPI* pAPI = PRGAPI();
	ActionManager* pAM = pAPI->GetActionManager();
	switch (cmd)
	{
	case MENU_Exit:
		AfxGetMainWnd()->PostMessage(WM_QUIT);
		break;
	case MENU_ShowMainWindow:
		pAM->ShowMainWindow();
		break;
	case MENU_ShowMiniPlayer:
		pAPI->GetMiniPlayerDlg(TRUE)->ShowWindow(TRUE);
		break;
	case MENU_HideMiniPlayer:
		{
			CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
			if (pMPDlg)
				pMPDlg->ShowWindow(SW_HIDE);
		}
		break;
	//case MENU_ToggleMiniPlayer:
	//	pAPI->GetActionManager()->ShowMiniPlayer(!pAPI->GetActionManager()->IsMiniPlayerVisible());
	//	break;
	case MENU_ShowAboutDlg:
		pAM->ShowAboutDlg(AfxGetMainWnd());
		break;
	case MENU_ShowHistoryDlg:
		pAM->ShowHistoryDlg(AfxGetMainWnd());
		break;
	case MENU_ShowGamesDlg:
		pAM->ShowGamesDlg(AfxGetMainWnd());
		break;
	case MENU_ShowAdvancedSearch:
		pAPI->GetAdvancedSearchDlg()->ShowWindow(SW_SHOW);
		break;
	case MENU_ShowOptionsDlg:
		pAM->ShowOptionsDlg(AfxGetMainWnd());
		break;
	case MENU_ShowCollectionsDlg:
		pAM->ShowCollectionsDlg(AfxGetMainWnd());
		break;
	case MENU_UpdateLocalCollections:
		pAPI->GetCollectionManager()->RefreshLocalCollections(TRUE, FALSE, TRUE);
		break;
	case MENU_ShowSkinsDialog:
		pAM->ShowSkinsDlg(AfxGetMainWnd());
		break;
	case MENU_ShowLanguagesDialog:
		pAM->ShowLanguagesDlg(AfxGetMainWnd());
		break;
	default:
		return FALSE;
	}
	return TRUE;

}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:59,代码来源:MenuManager.cpp

示例5: Point

void Pipe::addPipe(float dt)
{
    SpriteFrameCache *pFrameCache = SpriteFrameCache::getInstance();
    auto pipe_up = Sprite::createWithSpriteFrame(pFrameCache->getSpriteFrameByName("pipe_up.png"));
    pipe_up->setPosition(Point(pipe_up->getContentSize().width/2,pipe_up->getContentSize().height/2));
    auto body_up=PhysicsBody::create();
    auto body_shape_up=PhysicsShapeBox::create(pipe_up->getContentSize());
    body_up->addShape(body_shape_up);
    body_up->setDynamic(false);
    body_up->setGravityEnable(false);
    body_up->setCategoryBitmask(1);
    body_up->setCollisionBitmask(-1);
    body_up->setContactTestBitmask(-1);
    pipe_up->setPhysicsBody(body_up);
    
    //向下管道初始化,这边的THROUGH_HEIGHT是两根管道之间的空隙
    auto pipe_down = Sprite::createWithSpriteFrame(pFrameCache->getSpriteFrameByName("pipe_down.png"));
    pipe_down->setPosition(Point(pipe_down->getContentSize().width/2,pipe_down->getContentSize().height/2+pipe_up->getContentSize().height+THROUGH_HEIGHT));
    auto body_down=PhysicsBody::create();
    auto body_shape_down=PhysicsShapeBox::create(pipe_down->getContentSize());
    body_down->addShape(body_shape_down);
    body_down->setDynamic(false);
    body_down->setGravityEnable(false);
    body_down->setCategoryBitmask(1);
    body_down->setCollisionBitmask(-1);
    body_down->setContactTestBitmask(-1);
    pipe_down->setPhysicsBody(body_down);
    
    //这边的node相当于一个容器把这两个管道封装在一个节点中并设置target
    auto node=Node::create();
    node->addChild(pipe_up,0,PIPE_UP);
    node->addChild(pipe_down,0,PIPE_DOWN);
    node->setAnchorPoint(Point::ANCHOR_BOTTOM_LEFT);
    
    //关于管道Y坐标的设置(就是管道上下长度不一样的处理),大家还是看图例,说不清楚
    //管道是从右边移动到左边,所以PIPE_X的值肯定比游戏的width要大这里设定是300
    int range=rand()%PIPE_RANGE;
    node->setPosition(Point(PIPE_X, PIPE_Y + range));
    
    ActionManager *pActionManager = Director::getInstance()->getActionManager();
    MoveBy *pMoveBy = MoveBy::create(3.2f, Point(-400, 0));
    CallFuncN *pMoveOverCallback = CallFuncN::create(CC_CALLBACK_1(Pipe::moveOverHandle, this));
    ActionInterval *pSeq = Sequence::create(pMoveBy, pMoveOverCallback, nullptr);
    pActionManager->addAction(pSeq, node, false);
    
    this->addChild(node);
    pPipeVector.pushBack(node);
    if (isStart) {
        scheduleUpdate();
        isStart = false;
    }
}
开发者ID:253627764,项目名称:Flappy-Bird,代码行数:52,代码来源:Pipe.cpp

示例6:

QList <QAction *> QmlProfilerTool::profilerContextMenuActions()
{
    QList <QAction *> commonActions;
    ActionManager *manager = ActionManager::instance();
    if (manager) {
        Command *command = manager->command(Constants::QmlProfilerLoadActionId);
        if (command)
            commonActions << command->action();
        command = manager->command(Constants::QmlProfilerSaveActionId);
        if (command)
            commonActions << command->action();
    }
    return commonActions;
}
开发者ID:tomba,项目名称:qt-creator,代码行数:14,代码来源:qmlprofilertool.cpp

示例7: TRACEST

BOOL CQuizRunningDlg::DisplayNextQuestion()
{
	TRACEST(_T("CQuizRunningDlg::DisplayNextQuestion"));
	PrgAPI* pAPI = PRGAPI();
	ActionManager* pAM = pAPI->GetActionManager();
	TracksFilter tf;
	tf.Duration.match = NUMM_Over;
	tf.Duration.val = 30;
	FullTrackRecordCollection col;
	if (!pAM->GetRandomTrackCollection(col, tf, 4))
		return FALSE;
	UINT trackLength = 0;
	TCHAR trackPath[MAX_PATH];
	m_correctAnswer = INT((rand() * 4) / RAND_MAX);
	FullTrackRecordSP rec;
	for (int i = 0; i < 4; i++)
	{
		TCHAR txt[1000];
		_sntprintf(txt, 1000, _T("%d. %s - %s"), i + 1, col[i]->artist.name.c_str(),col[i]->track.name.c_str());
		m_pButtons[i + BT_Answer1]->SetWindowText(txt);
		if (m_correctAnswer == i)
		{
			_tcsncpy(trackPath, col[i]->track.location.c_str(), MAX_PATH);
			trackLength = col[i]->track.duration;
		}
		m_pButtons[i + BT_Answer1]->ShowWindow(TRUE);
	}

	m_subTitle.SetWindowText(PRGAPI()->GetString(IDS_RECOGNISESONG));
	if (!m_pPlayer->Play(trackPath))
	{
		TRACE(_T("@1CQuizRunningDlg::DisplayNextQuestion. Cannot play the file '%s'\r\n"), trackPath);
		return FALSE;
	}
	m_pPlayer->Pause();
	trackLength = INT(m_pPlayer->GetMediaLength());
	if (trackLength < 20)
	{
		TRACE(_T("@1CQuizRunningDlg::DisplayNextQuestion. trackLength is %d '%s'\r\n"), trackLength, trackPath);
		return FALSE;
	}
	m_subTitle.SetColor(CLabelEx::COL_Text, RGB(200,200,200));
	UINT startSec = (trackLength - 40) * rand() / RAND_MAX + 20;//Select 20sec in the track after the first 20 sec
	m_pPlayer->SetVolume(95);
	m_pPlayer->SetMediaPos((DOUBLE) startSec);


	return TRUE;
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:49,代码来源:QuizRunningDlg.cpp

示例8: vector3f

	//--------------------------------------------------------------------------------------------------------------------------------------
	void EditCamera::OnActionInput( ActionManager& am )
	{
		//if( am.isTouch() && am.isMove() )
		//{
		//	if( am.isTowPoint() )
		//	{
		//		float d = am.DistanceTowPoint() - am.LastDistanceTowPoint();
		//		this->ZoomInOut( d );
		//		//DEBUGLOG("Camera zoom\n",1);
		//	}
		//	else
		//	{
		//		float xd = -( am.TouchPoint().m_x - am.LastTouchPoint().m_x ) / 2.0;//TouchPoint是(-1,1)区间的
		//		float yd = -( am.TouchPoint().m_y - am.LastTouchPoint().m_y ) / 2.0;
		//		this->Rotate(xd,yd);
		//		//DEBUGLOG("Camera Rotate\n",1);
		//	}
		//}
		{
			vector3f move;
			bool isMove = false;
			float movedis = m_MoveSpeed * Engine::Instance().GetTimeSpan() / 1000.0f;
			if( am.isAction( ActionManager::ACTION_MOVEFORWARD ) )
			{
				isMove = true;
				move += vector3f( 0, 0, -movedis );
			}
			if( am.isAction( ActionManager::ACTION_MOVEBACK ) )
			{
				isMove = true;
				move += vector3f( 0, 0, movedis );
			}
			if( am.isAction( ActionManager::ACTION_MOVELRIGHT ) )
			{
				isMove = true;
				move += vector3f( movedis, 0, 0 );
			}
			if( am.isAction( ActionManager::ACTION_MOVELEFT ) )
			{
				isMove = true;
				move += vector3f( -movedis, 0, 0 );
			}
			if( isMove )
			{
				this->Move( move );
			}
		}
	}
开发者ID:ServerGame,项目名称:Bohge_Engine,代码行数:49,代码来源:Camera.cpp

示例9: foreach

void ModeManager::objectAdded(QObject *obj)
{
    IMode *mode = Aggregation::query<IMode>(obj);
    if (!mode)
        return;

    d->m_mainWindow->addContextObject(mode);

    // Count the number of modes with a higher priority
    int index = 0;
    foreach (const IMode *m, d->m_modes)
        if (m->priority() > mode->priority())
            ++index;

    d->m_modes.insert(index, mode);
    d->m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->displayName());
    d->m_modeStack->setTabEnabled(index, mode->isEnabled());

    // Register mode shortcut
    ActionManager *am = d->m_mainWindow->actionManager();
    const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id();
    QShortcut *shortcut = new QShortcut(d->m_mainWindow);
    shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName()));
    Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL));

    d->m_modeShortcuts.insert(index, cmd);
    connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));
    for (int i = 0; i < d->m_modeShortcuts.size(); ++i) {
        Command *currentCmd = d->m_modeShortcuts.at(i);
        // we need this hack with currentlyHasDefaultSequence
        // because we call setDefaultShortcut multiple times on the same cmd
        // and still expect the current shortcut to change with it
        bool currentlyHasDefaultSequence = (currentCmd->keySequence()
                                            == currentCmd->defaultKeySequence());
#ifdef Q_WS_MAC
        currentCmd->setDefaultKeySequence(QKeySequence(QString("Meta+%1").arg(i+1)));
#else
        currentCmd->setDefaultKeySequence(QKeySequence(QString("Ctrl+%1").arg(i+1)));
#endif
        if (currentlyHasDefaultSequence)
            currentCmd->setKeySequence(currentCmd->defaultKeySequence());
    }

    d->m_signalMapper->setMapping(shortcut, mode->id());
    connect(shortcut, SIGNAL(activated()), d->m_signalMapper, SLOT(map()));
    connect(mode, SIGNAL(enabledStateChanged(bool)),
            this, SLOT(enabledStateChanged()));
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:48,代码来源:modemanager.cpp

示例10: GetFirstSelectedItemPosition

void CHistTracksListCtrl::ExecuteTracks(BOOL enqueue)
{
	FullTrackRecordCollection col;
	POSITION pos = GetFirstSelectedItemPosition();
	while (pos)
		GetFullTrackRecordCollectionByItemID(col, GetNextSelectedItem(pos), 1);
	if (!col.empty())
	{
		ActionManager* am = PRGAPI()->GetActionManager();
		MediaPlayer* mp = PRGAPI()->GetMediaPlayer();
		if (enqueue)
			am->Enqueue(mp, col);
		else
			am->Play(mp, col);
	}

}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:17,代码来源:HistTracksListCtrl.cpp

示例11: setupToolbar

void TreeView::setupToolbar()
{
	ActionManager *ac = Controller::create()->getActionManager();
	toolbar = new QToolBar();

	addRowAction = ac->getGlobalAction(Actions::ADD_NODE);
	toolbar->addAction(addRowAction);
	connect(addRowAction, SIGNAL(triggered()), this, SLOT(addRow()));

	addChildAction = ac->getGlobalAction(Actions::ADD_SUBNODE);
	toolbar->addAction(addChildAction);
	connect(addChildAction, SIGNAL(triggered()), this, SLOT(addChild()));

	removeAction = ac->getGlobalAction(Actions::REMOVE_NODE);
	toolbar->addAction(removeAction);
	connect(removeAction, SIGNAL(triggered()), questionFrame, SLOT(show()));

	toolbar->addSeparator();

	propertyAction = ac->getGlobalAction(Actions::SHOW_NODE_PROPERTIES);
	toolbar->addAction(propertyAction);
	connect(propertyAction, SIGNAL(triggered()), Controller::create()->getNodePropertyWidget(), SLOT(show()));

	welcomeAction = ac->getGlobalAction(Actions::SHOW_WELCOMEVIEW);
	toolbar->addAction(welcomeAction);
	connect(welcomeAction, SIGNAL(triggered(bool)), this, SLOT(showWelcomeView()));
}
开发者ID:munglaub,项目名称:silence,代码行数:27,代码来源:treeview.cpp

示例12: OnActionInput

	//--------------------------------------------------------------------------------------------------------------------------------------
	void TrackballCamera::OnActionInput( ActionManager& am )
	{
		if( am.isTouch() && am.isMove() )
		{
			if( am.isTowPoint() )
			{
				float d = am.DistanceTowPoint() - am.LastDistanceTowPoint();
				this->ZoomInOut( d );
				//DEBUGLOG("Camera zoom\n",1);
			}
			else
			{
				float xd = -( am.TouchPoint().m_x - am.LastTouchPoint().m_x ) / 2.0;//TouchPoint是(-1,1)区间的
				float yd = -( am.TouchPoint().m_y - am.LastTouchPoint().m_y ) / 2.0;
				this->Rotate(xd,yd);
				//DEBUGLOG("Camera Rotate\n",1);
			}
		}
	}
开发者ID:ServerGame,项目名称:Bohge_Engine,代码行数:20,代码来源:Camera.cpp

示例13: registerActions

void VcsManager::registerActions()
{
    ActionManager *manager = ActionManager::instance();

    ActionContainer* mVcs = manager->createMenu("VCS");

    manager->actionContainer(Constants::MENU_BAR)->addMenu(mVcs, Constants::M_VCS);

    QAction* commitChanges = new QAction("Commit changes...");
    manager->registerAction(commitChanges);

    QAction* updateProject = new QAction("Update project...");
    manager->registerAction(updateProject);


    QAction* createPatch = new QAction("Create Patch...");
    manager->registerAction(updateProject);

    QAction* applyPatch = new QAction("Apply Patch...");
    manager->registerAction(applyPatch);


}
开发者ID:intelligide,项目名称:UnicornEdit,代码行数:23,代码来源:VcsManager.cpp

示例14: m_editorList

/*!
  Mimic the look of the text editor toolbar as defined in e.g. EditorView::EditorView
  */
EditorToolBar::EditorToolBar(QWidget *parent) :
        Utils::StyledBar(parent),
        m_editorList(new QComboBox(this)),
        m_closeButton(new QToolButton),
        m_lockButton(new QToolButton),

        m_goBackAction(new QAction(QIcon(QLatin1String(":/help/images/previous.png")), EditorManager::tr("Go Back"), parent)),
        m_goForwardAction(new QAction(QIcon(QLatin1String(":/help/images/next.png")), EditorManager::tr("Go Forward"), parent)),

        m_activeToolBar(0),
        m_toolBarPlaceholder(new QWidget),
        m_defaultToolBar(new QWidget(this)),
        m_isStandalone(false)
{
    QHBoxLayout *toolBarLayout = new QHBoxLayout(this);
    toolBarLayout->setMargin(0);
    toolBarLayout->setSpacing(0);
    toolBarLayout->addWidget(m_defaultToolBar);
    m_toolBarPlaceholder->setLayout(toolBarLayout);
    m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    m_defaultToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    m_activeToolBar = m_defaultToolBar;

    m_editorsListModel = EditorManager::instance()->openedEditorsModel();
    connect(m_goBackAction, SIGNAL(triggered()), this, SIGNAL(goBackClicked()));
    connect(m_goForwardAction, SIGNAL(triggered()), this, SIGNAL(goForwardClicked()));

    m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_editorList->setMinimumContentsLength(20);
    m_editorList->setModel(m_editorsListModel);
    m_editorList->setMaxVisibleItems(40);
    m_editorList->setContextMenuPolicy(Qt::CustomContextMenu);

    m_lockButton->setAutoRaise(true);
    m_lockButton->setProperty("type", QLatin1String("dockbutton"));
    m_lockButton->setVisible(false);

    m_closeButton->setAutoRaise(true);
    m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
    m_closeButton->setProperty("type", QLatin1String("dockbutton"));
    m_closeButton->setEnabled(false);

    m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    m_backButton = new QToolButton(this);
    m_backButton->setDefaultAction(m_goBackAction);

    m_forwardButton= new QToolButton(this);
    m_forwardButton->setDefaultAction(m_goForwardAction);

    QHBoxLayout *toplayout = new QHBoxLayout(this);
    toplayout->setSpacing(0);
    toplayout->setMargin(0);
    toplayout->addWidget(m_backButton);
    toplayout->addWidget(m_forwardButton);
    toplayout->addWidget(m_editorList);
    toplayout->addWidget(m_toolBarPlaceholder, 1); // Custom toolbar stretches
    toplayout->addWidget(m_lockButton);
    toplayout->addWidget(m_closeButton);

    setLayout(toplayout);

    // this signal is disconnected for standalone toolbars and replaced with
    // a private slot connection
    connect(m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int)));

    connect(m_editorList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint)));
    connect(m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable()));
    connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeView()), Qt::QueuedConnection);

    ActionManager *am = ICore::instance()->actionManager();
    connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()),
            this, SLOT(updateActionShortcuts()));
    connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()),
            this, SLOT(updateActionShortcuts()));
    connect(am->command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()),
            this, SLOT(updateActionShortcuts()));

}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:83,代码来源:editortoolbar.cpp


注:本文中的ActionManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。