void MidiMixerWindow::setRewFFwdToAutoRepeat() { // This one didn't work in Classic either. Looking at it as a fresh // problem, it was tricky. The QAction has an objectName() of "rewind" // but the QToolButton associated with that action has no object name at // all. We kind of have to go around our ass to get to our elbow on // this one. // get pointers to the actual actions QAction *rewAction = findAction("playback_pointer_back_bar"); // rewind QAction *ffwAction = findAction("playback_pointer_forward_bar"); // fast forward QWidget* transportToolbar = this->findToolbar("Transport Toolbar"); if (transportToolbar) { // get a list of all the toolbar's children (presumably they're // QToolButtons, but use this kind of thing with caution on customized // QToolBars!) QList<QToolButton *> widgets = transportToolbar->findChildren<QToolButton *>(); // iterate through the entire list of children for (QList<QToolButton *>::iterator i = widgets.begin(); i != widgets.end(); ++i) { // get a pointer to the button's default action QAction *act = (*i)->defaultAction(); // compare pointers, if they match, we've found the button // associated with that action // // we then have to not only setAutoRepeat() on it, but also connect // it up differently from what it got in createAction(), as // determined empirically (bleargh!!) if (act == rewAction) { connect((*i), SIGNAL(clicked()), this, SIGNAL(rewindPlayback())); } else if (act == ffwAction) { connect((*i), SIGNAL(clicked()), this, SIGNAL(fastForwardPlayback())); } else { continue; } // Must have found an button to update (*i)->removeAction(act); (*i)->setAutoRepeat(true); } } }
void EditViewBase::setCheckBoxState(QString actionName, QString toolbarName) { // Use !isHidden() for visibility since ancestors may not be visible // since this is called during the Matrixview constructor. bool view = !findToolbar(toolbarName)->isHidden(); findAction(actionName)->setChecked(view); }
void MainWindow::initialActions() { initialActionsIcons(); initialActionsShortcuts(); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocumentAction())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocumentAction())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveAsDocumentAction())); connect(ui->actionProperties, SIGNAL(triggered()), this, SLOT(propertiesAction())); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeDocumentAction())); connect(ui->actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copyNodeAction())); connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(findAction())); connect(ui->actionFindNext, SIGNAL(triggered()), findWidget, SLOT(FindNext())); connect(ui->actionFindPrevious, SIGNAL(triggered()), findWidget, SLOT(FindPrevious())); // bookmarks connect(ui->actionBookmark, SIGNAL(triggered()), this, SLOT(bookmarkToggled())); connect(ui->actionBookmarkGotoNext, SIGNAL(triggered()), model, SLOT(bookmarkNext())); connect(ui->actionBookmarkGotoPrevious, SIGNAL(triggered()), model, SLOT(bookmarkPrev())); // view connect( ui->actionCollapseAll, SIGNAL(triggered()), this, SLOT(collapseAll()) ); connect( ui->actionExpandAll, SIGNAL(triggered()), this, SLOT(expandAll()) ); // FIXME: it's a temporary ui->actionNew->setVisible( false ); }
void TToolbarEditor::setActiveActions(const QStringList& actions) { active_actions_table->clearContents(); QString action_name; bool ns, fs; int row = 0; for(int i = 0; i < actions.count(); i++) { stringToAction(actions[i], action_name, ns, fs); if (action_name == "separator") { insertSeparator(row, ns, fs); row++; } else { QAction* action = findAction(action_name, *all_actions); if (action) { insertRowFromAction(row, action, ns, fs); row++; } } } if (active_actions_table->rowCount() > 0) { active_actions_table->setCurrentCell(0, COL_DESC); } }
QStringList TToolbarEditor::saveActions() { logger()->debug("saveActions"); QStringList list; for (int row = 0; row < active_actions_table->rowCount(); row++) { QTableWidgetItem* item = active_actions_table->item(row, COL_NAME); if (item) { QString action_name = item->text(); if (action_name.startsWith("separator")) { action_name = "separator"; } QString s = action_name; bool ns = getVis(row, COL_NS); bool fs = getVis(row, COL_FS); if (ns) { if (!fs) { s += "|1|0"; } } else if (fs) { s += "|0|1"; } else { s += "|0|0"; } list << s; if (action_name != "separator") { // Update icon text QAction* action = findAction(action_name, *all_actions); if (action) { item = active_actions_table->item(row, COL_DESC); if (item) { QString action_icon_text = TActionsEditor::actionTextToDescription( item->text(), action_name).trimmed(); if (!action_icon_text.isEmpty()) { QString action_text = TActionsEditor::actionTextToDescription(action->text(), action_name); if (action_text != action_icon_text) { action->setIconText(action_icon_text); action->setProperty("modified", true); logger()->debug("saveActions: updated icon text '" + action_name + "' to '" + action_icon_text + "'"); } else { action_icon_text = TActionsEditor::actionTextToDescription(action->iconText(), action_name); if (action_icon_text != action_text) { action->setIconText(action_text); logger()->debug("saveActions: cleared icon text " + action_name); } } } } } } } } return list; }
int other_translate (const char *trantab, const widechar * inbuf, int *inlen, widechar * outbuf, int *outlen, char *typeform, char *spacing, int *outputPos, int *inputPos, int *cursorPos, int mode) { char transSpec[MAXSTRING]; char *afterColon; int action; strcpy (transSpec, trantab); afterColon = findColon (transSpec); action = findAction (translators, transSpec); switch (action) { case -1: lou_logPrint ("There is no translator called '%s'", transSpec); return 0; case 1: return 1; case 2: return 1; case 3: return 1; default: return 0; } return 0; }
void KMixDockWidget::controlsChange(int changeType) { ControlChangeType::Type type = ControlChangeType::fromInt(changeType); switch (type ) { case ControlChangeType::MasterChanged: // Notify the main window, as it might need to update the visibiliy of the dock icon. // _kmixMainWindow->updateDocking(); // _kmixMainWindow->saveConfig(); refreshVolumeLevels(); { QAction *selectMasterAction = findAction("select_master"); if(selectMasterAction) { // Review #120432 : Guard findAction("select_master"), as it is sometimes 0 on the KF5 build // This is probably not a final solution, but better than a crash. selectMasterAction->setEnabled(Mixer::getGlobalMasterMixer() != 0); } else { kWarning() << "select_master action not found. Cannot enable it in the Systray."; } } break; case ControlChangeType::Volume: refreshVolumeLevels(); break; default: ControlManager::warnUnexpectedChangeType(type, this); } }
bool CSkeletonActionExpDlg::InsertAction(sActionInfo_t& action,bool isInsertToUI) { int index = findAction(action.m_Name); isInsertToUI = m_bHasUI && isInsertToUI; if(index != -1 && isInsertToUI == false) { //::MessageBoxA(::GetActiveWindow(),"相同名字的动作存在","错误",MB_OK); XEVOL_LOG(eXL_ERROR_FALT , L"----------相同名字=%s 动作存在--------------\n" , action.m_Name); return false; } if(index == -1) { index = (int)m_ActionList.size(); m_ActionList.push_back(action); } if(isInsertToUI) { InsertActionToUI(action); } m_OperatedActions.insert( action.m_Name ); return true; }
void CWizDocumentListView::resetPermission() { // disable tags if group documents inside if (isSelectedGroupDocument()) { findAction(WIZACTION_LIST_TAGS)->setEnabled(false); } else { findAction(WIZACTION_LIST_TAGS)->setEnabled(true); } // disable delete if permission is not enough if (!isSelectedAllCanDelete()) { findAction(WIZACTION_LIST_DELETE)->setEnabled(false); } else { findAction(WIZACTION_LIST_DELETE)->setEnabled(true); } }
void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) { QWceMenuAction *action = new QWceMenuAction; action->action = a; action->command = qt_wce_menu_static_cmd_id++; addAction(action, findAction(before)); }
void KMixDockWidget::contextMenuAboutToShow() { // Enable/Disable "Muted" menu item KToggleAction *dockMuteAction = static_cast<KToggleAction*>(findAction("dock_mute")); qDebug() << "DOCK MUTE" << dockMuteAction; if (dockMuteAction) updateDockMuteAction(dockMuteAction); }
/****************************************************************************** * Registers an action with the ActionManager. ******************************************************************************/ void ActionManager::addAction(QAction* action) { OVITO_CHECK_POINTER(action); OVITO_ASSERT_MSG(action->parent() == this || findAction(action->objectName()) == NULL, "ActionManager::addAction()", "There is already an action with the same ID."); // Make it a child of this manager. action->setParent(this); }
void EditViewBase::readOptions() { QAction *a = findAction("options_show_statusbar"); if (a) a->setChecked( ! statusBar()->isHidden() ); // a = findAction("options_show_toolbar"); // if (a) a->setChecked( ! m_toolBar->isHidden()); }
bool CActionManager::cancelActionById(int id) { CAction* currentAction = findAction(id); if (currentAction) { return cancelAction(currentAction); } else { return false; } }
static int checkPgpUsage( INOUT ENVELOPE_INFO *envelopeInfoPtr, IN_ATTRIBUTE const CRYPT_ATTRIBUTE_TYPE envInfo ) { assert( isWritePtr( envelopeInfoPtr, sizeof( ENVELOPE_INFO ) ) ); REQUIRES( envInfo > CRYPT_ENVINFO_FIRST && envInfo < CRYPT_ENVINFO_LAST ); /* The attribute being added isn't context-related, there's nothing PGP-specific to check */ if( envInfo != CRYPT_ENVINFO_PUBLICKEY && \ envInfo != CRYPT_ENVINFO_PRIVATEKEY && \ envInfo != CRYPT_ENVINFO_KEY && \ envInfo != CRYPT_ENVINFO_SESSIONKEY && \ envInfo != CRYPT_ENVINFO_HASH && \ envInfo != CRYPT_ENVINFO_SIGNATURE ) return( CRYPT_OK ); /* PGP doesn't support both PKC and conventional key exchange actions in the same envelope since the session key is encrypted for the PKC action but derived from the password for the conventional action */ if( findAction( envelopeInfoPtr->preActionList, ACTION_KEYEXCHANGE ) != NULL ) return( CRYPT_ERROR_INITED ); /* PGP handles multiple signers by nesting signed data rather than attaching multiple signatures so we can only apply a single signature per envelope */ if( envInfo == CRYPT_ENVINFO_SIGNATURE && \ envelopeInfoPtr->postActionList != NULL ) return( CRYPT_ERROR_INITED ); /* PGP doesn't allow multiple hash algorithms to be used when signing data, a follow-on from the way that nested sigs are handled */ if( envInfo == CRYPT_ENVINFO_HASH && \ envelopeInfoPtr->actionList != NULL ) { /* The one exception to this occurs when we're using a detached signature with an externally-provided hash value and the user has added a signing key before adding the hash, in which case a hash action will have been added automatically when the signing key was added. In this case the presence of an automatically- added hash action is OK since it'll be replaced with the hash value that we're now adding */ if( ( envelopeInfoPtr->flags & ENVELOPE_DETACHED_SIG ) && \ envelopeInfoPtr->actionList->action == ACTION_HASH && \ ( envelopeInfoPtr->actionList->flags & ACTION_ADDEDAUTOMATICALLY ) ) return( CRYPT_OK ); return( CRYPT_ERROR_INITED ); } return( CRYPT_OK ); }
void ListEditView::toggleWidget(QWidget* widget, const QString& toggleActionName) { QAction *toggleAction = findAction(toggleActionName); if (!toggleAction) { RG_DEBUG << "!!! Unknown toggle action : " << toggleActionName << endl; return ; } widget->setVisible(toggleAction->isChecked()); }
void CWizDocumentListView::resetPermission() { CWizDocumentDataArray arrayDocument; QList<QListWidgetItem*> items = selectedItems(); foreach (QListWidgetItem* it, items) { if (CWizDocumentListViewItem* item = dynamic_cast<CWizDocumentListViewItem*>(it)) { arrayDocument.push_back(item->document()); } } bool bGroup = isDocumentsWithGroupDocument(arrayDocument); bool bDeleted = isDocumentsWithDeleted(arrayDocument); bool bCanDelete = isDocumentsAllCanDelete(arrayDocument); // if group documents or deleted documents selected if (bGroup || bDeleted) { findAction(WIZACTION_LIST_TAGS)->setEnabled(false); } else { findAction(WIZACTION_LIST_TAGS)->setEnabled(true); } // deleted user private documents if (!bGroup) { findAction(WIZACTION_LIST_MOVE_DOCUMENT)->setEnabled(true); } else { findAction(WIZACTION_LIST_MOVE_DOCUMENT)->setEnabled(false); } // disable delete if permission is not enough if (!bCanDelete) { findAction(WIZACTION_LIST_DELETE)->setEnabled(false); } else { findAction(WIZACTION_LIST_DELETE)->setEnabled(true); } }
void DefaultExecutionEngine::terminateAction(AbstractAction* action, bool cleanup) { auto it = findAction(action); if ((it == actions.end()) || (it->info == ActionInfo::Removed)) return; if (it->info == ActionInfo::Active) it->action->onEnd(this); it->info = ActionInfo::Removed; generateActionEvent(action, ActionEvent::ActionTerminated); ActionInfo::Info newinfo = ActionInfo::Removed; if (!cleanup) newinfo = (it->action->precondition == NULL) ? ActionInfo::Active : ActionInfo::Passiv; markFollowUps(it->action, newinfo); }
void EditViewBase::slotCompositionStateUpdate() { // update state of 'solo' toggle // QAction *toggleSolo = findAction("toggle_solo"); if (!toggleSolo) return; toggleSolo->setChecked(getDocument()->getComposition().isSolo()); RG_DEBUG << "EditViewBase::slotCompositionStateUpdate(): set solo to " << (toggleSolo->isChecked() ? "true" : "false") << endl; // update the window caption // updateViewCaption(); }
void TToolbarEditor::onRightButtonClicked() { int row = all_actions_list->currentRow(); if (row >= 0) { int dest_row = active_actions_table->currentRow(); if (dest_row < 0) dest_row = 0; QListWidgetItem* item = all_actions_list->item(row); if (item) { QString action_name = item->data(Qt::UserRole).toString(); QAction* action = findAction(action_name, *all_actions); if (action) { insertRowFromAction(dest_row, action, true, true); active_actions_table->setCurrentCell(dest_row, COL_DESC); } } } }
void ToolbarEditor::restoreDefaults() { qDebug("ToolbarEditor::restoreDefaults"); populateList(all_actions_list, all_actions_copy, false); // Create list of actions QList<QAction *> actions; QAction * a = 0; for (int n = 0; n < default_actions.count(); n++) { if (default_actions[n] == "separator") { QAction * sep = new QAction(this); sep->setSeparator(true); actions.push_back(sep); } else { a = findAction(default_actions[n], all_actions_copy); if (a) actions.push_back(a); } } setActiveActions(actions); }
void ToolbarEditor::load(QWidget *w, QStringList l, QList<QAction *> actions_list) { qDebug("ToolbarEditor::load: '%s'", w->objectName().toUtf8().data()); QAction *action; for (int n = 0; n < l.count(); n++) { qDebug("ToolbarEditor::load: loading action %s", l[n].toUtf8().data()); if (l[n] == "separator") { qDebug("ToolbarEditor::load: adding separator"); QAction *sep = new QAction(w); sep->setSeparator(true); w->addAction(sep); } else { action = findAction(l[n], actions_list); if (action) { w->addAction(action); if (action->objectName().endsWith("_menu")) { // If the action is a menu and is in a toolbar, as a toolbutton, change some of its properties QToolBar *toolbar = qobject_cast<QToolBar *>(w); if (toolbar) { QToolButton *button = qobject_cast<QToolButton *>(toolbar->widgetForAction(action)); if (button) { //qDebug("ToolbarEditor::load: action %s is a toolbutton", action->objectName().toUtf8().constData()); button->setPopupMode(QToolButton::InstantPopup); //button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); } } } } else { qWarning("ToolbarEditor::load: action %s not found", l[n].toUtf8().data()); } } } }
bool CSkeletonActionExpDlg::InsertActionToUI(sActionInfo_t& action) { int index = findAction(action.m_Name); if(index != -1 && !m_bHasUI ) { return false; } char buf[23]; sprintf(buf,"%d",index); m_ctrlActionList.InsertItem(index,buf); m_ctrlActionList.SetItemText(index,1,ToAnsi(action.m_Name).c_str() ); sprintf(buf,"%d",action.m_lTime); m_ctrlActionList.SetItemText(index,2,buf); sprintf(buf,"%d",action.m_iFirstFrame); m_ctrlActionList.SetItemText(index,3,buf); sprintf(buf,"%d",action.m_iLastFrame); m_ctrlActionList.SetItemText(index,4,buf); return true; }
void EditViewBase::slotToggleSolo() { QAction *toggleSoloAction = findAction("toggle_solo"); if (!toggleSoloAction) return; bool newSoloState = toggleSoloAction->isChecked(); //RG_DEBUG << "EditViewBase::slotToggleSolo() : solo action is " << (toggleSoloAction->isCheckable() ? "" : "NOT") << " checkable."; //RG_DEBUG << "EditViewBase::slotToggleSolo() : solo = " << newSoloState; emit toggleSolo(newSoloState); if (newSoloState) { getDocument()->getComposition().setSelectedTrack( getCurrentSegment()->getTrack()); getDocument()->getComposition().notifyTrackSelectionChanged( getCurrentSegment()->getTrack()); // Old notification mechanism. emit selectTrack(getCurrentSegment()->getTrack()); } }
void run() { switch (routes[action]) { case LOAD: loadAction(); break; case INSERT: insertAction(); break; case FIND: findAction(); break; case REMOVE: removeAction(); break; case CLEAR: clearAction(); break; case DELETE: deleteAction(); break; case SHOW: showAction(); break; case TEST: testAction(); break; case HELP: helpAction(); break; case REPORT: reportAction(); break; default: usageAction(); break; } }
Action *Keymap::getAction(const char *id) { return findAction(id); }
void Keymap::addAction(Action *action) { if (findAction(action->id)) error("Action with id %s already in KeyMap", action->id); _actions.push_back(action); }
int eWidget::eventHandler(const eWidgetEvent &evt) { switch (evt.type) { case eWidgetEvent::childChangedHelpText: /* emit */ focusChanged(focus); // faked focusChanged Signal to the Statusbar break; case eWidgetEvent::evtAction: if (evt.action == shortcut && isVisible()) (shortcutFocusWidget?shortcutFocusWidget:this)-> event(eWidgetEvent(eWidgetEvent::evtShortcut)); else if (evt.action == &i_focusActions->up) focusNext(focusDirPrev); else if (evt.action == &i_focusActions->down) focusNext(focusDirNext); else if (evt.action == &i_focusActions->left) focusNext(focusDirPrev); else if (evt.action == &i_focusActions->right) focusNext(focusDirNext); else if (evt.action == &i_cursorActions->help) { int wasvisible=state&stateShow; if (wasvisible) hide(); /* emit */ showHelp( &actionHelpList, helpID ); if (wasvisible) show(); } else return 0; return 1; case eWidgetEvent::evtKey: { eActionPrioritySet prio; findAction(prio, *evt.key, this); if (focus && (focus != this)) focus->findAction(prio, *evt.key, focus); for (actionMapList::iterator i = globalActions.begin(); i != globalActions.end(); ++i) { const std::set<eString> &styles=eActionMapList::getInstance()->getCurrentStyles(); for (std::set<eString>::const_iterator si(styles.begin()); si != styles.end(); ++si) (*i)->findAction(prio, *evt.key, 0, *si); } for (eActionPrioritySet::iterator i(prio.begin()); i != prio.end(); ++i) { if (i->first) { if (((eWidget*)i->first)->event(eWidgetEvent(eWidgetEvent::evtAction, i->second))) break; } else { (const_cast<eAction*>(i->second))->handler(); // only useful for global actions break; } } if (focus) { /* Action not found, try to use old Keyhandle */ int c = evt.key->producer->getKeyCompatibleCode(*evt.key); if (c != -1) { if (evt.key->flags & eRCKey::flagBreak) focus->keyUp(c); else focus->keyDown(c); } } return 1; break; } case eWidgetEvent::gotFocus: gotFocus(); break; case eWidgetEvent::lostFocus: lostFocus(); break; case eWidgetEvent::changedSize: case eWidgetEvent::changedFont: case eWidgetEvent::changedPosition: case eWidgetEvent::changedPixmap: invalidate(); break; case eWidgetEvent::evtShortcut: setFocus(this); break; case eWidgetEvent::wantClose: /* if (in_loop==0) eFatal("attempt to close non-execing widget");*/ if (in_loop==1) // nur wenn das ne echte loop ist { in_loop=-1; eApp->exit_loop(); } result=evt.parameter; break; default: break; } return 0; }
bool DefaultExecutionEngine::isActive(AbstractAction* action) const { auto it = findAction(action); return (it != actions.end()) && (it->info == ActionInfo::Active); }
bool DefaultExecutionEngine::containsAction(AbstractAction* action) const { return (findAction(action) != actions.end()); }