void ActionManagerPrivate::saveSettings() { const IdCmdMap::const_iterator cmdcend = m_idCmdMap.constEnd(); for (IdCmdMap::const_iterator j = m_idCmdMap.constBegin(); j != cmdcend; ++j) { saveSettings(j.value()); } }
void ActionManagerPrivate::setContext(const Context &context) { // here are possibilities for speed optimization if necessary: // let commands (de-)register themselves for contexts // and only update commands that are either in old or new contexts m_context = context; const IdCmdMap::const_iterator cmdcend = m_idCmdMap.constEnd(); for (IdCmdMap::const_iterator it = m_idCmdMap.constBegin(); it != cmdcend; ++it) it.value()->setCurrentContext(m_context); }
Command *ActionManagerPrivate::command(const Id &id) const { const IdCmdMap::const_iterator it = m_idCmdMap.constFind(id); if (it == m_idCmdMap.constEnd()) { if (warnAboutFindFailures) qWarning() << "ActionManagerPrivate::command(): failed to find :" << id.name(); return 0; } return it.value(); }
Command *ActionManagerPrivate::command(int uid) const { const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid); if (it == m_idCmdMap.constEnd()) { if (warnAboutFindFailures) { qWarning() << "ActionManagerPrivate::command(): failed to find :" << UniqueIDManager::instance()->stringForUniqueIdentifier(uid) << '/' << uid; } return 0; } return it.value(); }
void ActionManagerPrivate::saveSettings(QSettings *settings) { settings->beginWriteArray(QLatin1String(settingsGroup)); int count = 0; const IdCmdMap::const_iterator cmdcend = m_idCmdMap.constEnd(); for (IdCmdMap::const_iterator j = m_idCmdMap.constBegin(); j != cmdcend; ++j) { const Id id = j.key(); CommandPrivate *cmd = j.value(); QKeySequence key = cmd->keySequence(); if (key != cmd->defaultKeySequence()) { settings->setArrayIndex(count); settings->setValue(QLatin1String(idKey), id.toString()); settings->setValue(QLatin1String(sequenceKey), key.toString()); count++; } } settings->endArray(); }