本文整理汇总了C++中UserCommand::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ UserCommand::getName方法的具体用法?C++ UserCommand::getName怎么用?C++ UserCommand::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserCommand
的用法示例。
在下文中一共展示了UserCommand::getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onChangeMenu
LRESULT UCPage::onChangeMenu(WORD , WORD , HWND , BOOL& ) {
if(ctrlCommands.GetSelectedCount() == 1) {
int sel = ctrlCommands.GetSelectedIndex();
UserCommand uc;
FavoriteManager::getInstance()->getUserCommand(ctrlCommands.GetItemData(sel), uc);
CommandDlg dlg;
dlg.type = uc.getType();
dlg.ctx = uc.getCtx();
dlg.name = Text::toT(uc.getName());
dlg.command = Text::toT(uc.getCommand());
dlg.to = Text::toT(uc.getTo());
dlg.hub = Text::toT(uc.getHub());
if(dlg.DoModal() == IDOK) {
if(dlg.type == UserCommand::TYPE_SEPARATOR)
ctrlCommands.SetItemText(sel, 0, CTSTRING(SEPARATOR));
else
ctrlCommands.SetItemText(sel, 0, dlg.name.c_str());
ctrlCommands.SetItemText(sel, 1, dlg.command.c_str());
ctrlCommands.SetItemText(sel, 2, dlg.hub.c_str());
uc.setName(Text::fromT(dlg.name));
uc.setCommand(Text::fromT(dlg.command));
uc.setTo(Text::fromT(dlg.to));
uc.setHub(Text::fromT(dlg.hub));
uc.setType(dlg.type);
uc.setCtx(dlg.ctx);
FavoriteManager::getInstance()->updateUserCommand(uc);
}
}
return 0;
}
示例2: addEntry
void UCPage::addEntry(const UserCommand& uc, int pos) {
TStringList lst;
if(uc.getType() == UserCommand::TYPE_SEPARATOR)
lst.push_back(TSTRING(SEPARATOR));
else
lst.push_back(Text::toT(uc.getName()));
lst.push_back(Text::toT(uc.getCommand()));
lst.push_back(Text::toT(uc.getHub()));
ctrlCommands.insert(pos, lst, 0, (LPARAM)uc.getId());
}
示例3: changeUC
void UCModel::changeUC(const QModelIndex &i){
if (!i.isValid())
return;
UCItem *item = reinterpret_cast<UCItem*>(i.internalPointer());
if (!rootItem->childItems.contains(item))
return;
UCDialog ucd(MainWindow::getInstance());
initDlgFromItem(ucd, *item);
if (ucd.exec() == QDialog::Accepted){
UserCommand uc;
FavoriteManager::getInstance()->getUserCommand(item->id, uc);
uc.setName(_tq(ucd.getName()));
uc.setCommand(_tq(ucd.getCmd()));
uc.setHub(_tq(ucd.getHub()));
uc.setType(ucd.getType());
uc.setCtx(ucd.getCtx());
uc.setTo(_tq(ucd.lineEdit_TO->text()));
FavoriteManager::getInstance()->updateUserCommand(uc);
item->name = ((uc.getType() == dcpp::UserCommand::TYPE_SEPARATOR)? tr("Separator") : _q(uc.getName()));
item->comm = _q(uc.getCommand());
item->hub = _q(uc.getHub());
item->id = uc.getId();
item->type = uc.getType();
item->ctx = uc.getCtx();
emit layoutChanged();
}
}
示例4: run_dlgProc
BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
{
initBabyGrid();
initTabs();
fillOutBabyGrid();
_babygrid.display();
goToCenter();
return TRUE;
}
case WM_NOTIFY: {
NMHDR nmh = *((NMHDR*)lParam);
if (nmh.hwndFrom == _hTabCtrl) {
if (nmh.code == TCN_SELCHANGE) {
int index = TabCtrl_GetCurSel(_hTabCtrl);
switch (index) {
case 0:
_currentState = STATE_MENU;
break;
case 1:
_currentState = STATE_MACRO;
break;
case 2:
_currentState = STATE_USER;
break;
case 3:
_currentState = STATE_PLUGIN;
break;
case 4:
_currentState = STATE_SCINTILLA;
break;
}
fillOutBabyGrid();
}
}
break; }
case WM_COMMAND :
{
switch (LOWORD(wParam))
{
case IDCANCEL :
{
::EndDialog(_hSelf, -1);
return TRUE;
}
case IDOK :
{
::EndDialog(_hSelf, 0);
return TRUE;
}
case IDM_BABYGRID_MODIFY :
{
NppParameters *nppParam = NppParameters::getInstance();
int row = _babygrid.getSelectedRow();
switch(_currentState) {
case STATE_MENU: {
//Get CommandShortcut corresponding to row
vector<CommandShortcut> & shortcuts = nppParam->getUserShortcuts();
CommandShortcut csc = shortcuts[row - 1], prevcsc = shortcuts[row - 1];
csc.init(_hInst, _hSelf);
if (csc.doDialog() != -1 && prevcsc != csc) { //shortcut was altered
nppParam->addUserModifiedIndex(row-1);
shortcuts[row - 1] = csc;
_babygrid.setText(row, 2, csc.toString().c_str());
//Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts();
}
break; }
case STATE_MACRO: {
//Get MacroShortcut corresponding to row
vector<MacroShortcut> & shortcuts = nppParam->getMacroList();
MacroShortcut msc = shortcuts[row - 1], prevmsc = shortcuts[row - 1];
msc.init(_hInst, _hSelf);
if (msc.doDialog() != -1 && prevmsc != msc) { //shortcut was altered
shortcuts[row - 1] = msc;
_babygrid.setText(row, 1, msc.getName());
_babygrid.setText(row, 2, msc.toString().c_str());
//Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts();
}
break; }
case STATE_USER: {
//Get UserCommand corresponding to row
vector<UserCommand> & shortcuts = nppParam->getUserCommandList();
UserCommand ucmd = shortcuts[row - 1], prevucmd = shortcuts[row - 1];
ucmd.init(_hInst, _hSelf);
prevucmd = ucmd;
if (ucmd.doDialog() != -1 && prevucmd != ucmd) { //shortcut was altered
shortcuts[row - 1] = ucmd;
_babygrid.setText(row, 1, ucmd.getName());
//.........这里部分代码省略.........
示例5: run_dlgProc
//.........这里部分代码省略.........
int selected_row=getselectedrow();
if(selected_row<0)
break;
index=getitemindex(selected_row);
switch(_currentState) {
case STATE_MENU: {
//Get CommandShortcut corresponding to index
vector<CommandShortcut> & shortcuts = nppParam->getUserShortcuts();
CommandShortcut csc = shortcuts[index], prevcsc = shortcuts[index];
csc.init(_hInst, _hSelf);
csc.set_shortcut_info(_currentState,index);
if (csc.doDialog() != -1 && prevcsc != csc) { //shortcut was altered
generic_string keys=csc.toString();
nppParam->addUserModifiedIndex(index);
shortcuts[index] = csc;
ListView_SetItemText(hlistview,selected_row,2,(LPWSTR)keys.c_str());
update_col_width(keys.c_str(),2);
//Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts();
TCHAR str[255];
if(0<check_in_use(_currentState,index,&csc.getKeyCombo(),nppParam,str,sizeof(str)/sizeof(TCHAR)))
MessageBox(_hSelf,str,L"Duplicates found",MB_OK);
}
break;
}
case STATE_MACRO: {
//Get MacroShortcut corresponding to index
vector<MacroShortcut> & shortcuts = nppParam->getMacroList();
MacroShortcut msc = shortcuts[index], prevmsc = shortcuts[index];
msc.init(_hInst, _hSelf);
msc.set_shortcut_info(_currentState,index);
if (msc.doDialog() != -1 && prevmsc != msc) { //shortcut was altered
generic_string name=msc.getName();
generic_string keys=msc.toString();
shortcuts[index] = msc;
ListView_SetItemText(hlistview,selected_row,1,(LPWSTR)name.c_str());
ListView_SetItemText(hlistview,selected_row,2,(LPWSTR)keys.c_str());
update_col_width(keys.c_str(),2);
//Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts();
TCHAR str[255];
if(0<check_in_use(_currentState,index,&msc.getKeyCombo(),nppParam,str,sizeof(str)/sizeof(TCHAR)))
MessageBox(_hSelf,str,L"Duplicates found",MB_OK);
}
break;
}
case STATE_USER: {
//Get UserCommand corresponding to index
vector<UserCommand> & shortcuts = nppParam->getUserCommandList();
UserCommand ucmd = shortcuts[index], prevucmd = shortcuts[index];
ucmd.init(_hInst, _hSelf);
ucmd.set_shortcut_info(_currentState,index);
prevucmd = ucmd;
if (ucmd.doDialog() != -1 && prevucmd != ucmd) { //shortcut was altered
generic_string name=ucmd.getName();
generic_string keys=ucmd.toString();
shortcuts[index] = ucmd;
ListView_SetItemText(hlistview,selected_row,1,(LPWSTR)name.c_str());
ListView_SetItemText(hlistview,selected_row,2,(LPWSTR)keys.c_str());
update_col_width(name.c_str(),1);
update_col_width(keys.c_str(),2);
//Notify current Accelerator class to update everything
nppParam->getAccelerator()->updateShortcuts();
TCHAR str[255];
if(0<check_in_use(_currentState,index,&ucmd.getKeyCombo(),nppParam,str,sizeof(str)/sizeof(TCHAR)))