ActionContainer *ActionManagerPrivate::actionContainer(const Id &id) const
{
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
    if (it == m_idContainerMap.constEnd()) {
        if (warnAboutFindFailures)
            qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :"
                       << id.name();
        return 0;
    }
    return it.value();
}
示例#2
0
ActionContainer *ActionManagerPrivate::actionContainer(int uid) const
{
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);

    if (it == m_idContainerMap.constEnd()) {
        if (warnAboutFindFailures) {
            qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << UniqueIDManager::instance()->stringForUniqueIdentifier(uid) << uid;
        }
        return 0;
    }
    return it.value();
}
示例#3
0
void ActionManagerPrivate::setContext(const QList<int> &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);
    }

    const IdContainerMap::const_iterator acend = m_idContainerMap.constEnd();
    for (IdContainerMap::const_iterator it = m_idContainerMap.constBegin(); it != acend; ++it) {
        it.value()->update();
    }
}
ActionContainer *ActionManagerPrivate::createMenuBar(const Id &id)
{
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
    if (it !=  m_idContainerMap.constEnd())
        return it.value();

    QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X)
    mb->setObjectName(id.toString());

    MenuBarActionContainer *mbc = new MenuBarActionContainer(id);
    mbc->setMenuBar(mb);

    m_idContainerMap.insert(id, mbc);
    connect(mbc, SIGNAL(destroyed()), this, SLOT(containerDestroyed()));

    return mbc;
}
ActionContainer *ActionManagerPrivate::createMenu(const Id &id)
{
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
    if (it !=  m_idContainerMap.constEnd())
        return it.value();

    QMenu *m = new QMenu(m_mainWnd);
    m->setObjectName(QLatin1String(id.name()));

    MenuActionContainer *mc = new MenuActionContainer(id);
    mc->setMenu(m);

    m_idContainerMap.insert(id, mc);
    connect(mc, SIGNAL(destroyed()), this, SLOT(containerDestroyed()));

    return mc;
}
示例#6
0
ActionContainer *ActionManagerPrivate::createMenuBar(const QString &id)
{
    const int uid = UniqueIDManager::instance()->uniqueIdentifier(id);
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);

    if (it != m_idContainerMap.constEnd()) {
        return it.value();
    }

    QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X)
    mb->setObjectName(id);

    MenuBarActionContainer *mbc = new MenuBarActionContainer(uid);
    mbc->setMenuBar(mb);

    m_idContainerMap.insert(uid, mbc);

    return mbc;
}
示例#7
0
ActionContainer *ActionManagerPrivate::createMenu(const QString &id)
{
    const int uid = UniqueIDManager::instance()->uniqueIdentifier(id);
    const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);

    if (it != m_idContainerMap.constEnd()) {
        return it.value();
    }

    QMenu *m = new QMenu(m_mainWnd);
    m->setObjectName(id);

    MenuActionContainer *mc = new MenuActionContainer(uid);
    mc->setMenu(m);

    m_idContainerMap.insert(uid, mc);

    return mc;
}