forked from qt-creator/qt-creator
Merge branch 'master' of git://labs.trolltech.com/qt-creator
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <texteditor/fontsettings.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -37,10 +37,10 @@
|
||||
#include "bookmarksplugin.h"
|
||||
#include "bookmarks_global.h"
|
||||
|
||||
#include <projectexplorer/ProjectExplorerInterfaces>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QContextMenuEvent>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -68,7 +68,7 @@ void BookmarksPlugin::extensionsInitialized()
|
||||
bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
{
|
||||
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
Core::ActionManagerInterface *am = m_core->actionManager();
|
||||
Core::ActionManager *am = m_core->actionManager();
|
||||
|
||||
QList<int> context = QList<int>() << m_core->uniqueIDManager()->
|
||||
uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
|
||||
@@ -77,17 +77,17 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||
globalcontext << Core::Constants::C_GLOBAL_ID;
|
||||
|
||||
Core::IActionContainer *mtools =
|
||||
Core::ActionContainer *mtools =
|
||||
am->actionContainer(Core::Constants::M_TOOLS);
|
||||
|
||||
Core::IActionContainer *mbm =
|
||||
Core::ActionContainer *mbm =
|
||||
am->createMenu(QLatin1String(BOOKMARKS_MENU));
|
||||
mbm->menu()->setTitle(tr("&Bookmarks"));
|
||||
mtools->addMenu(mbm);
|
||||
|
||||
//Toggle
|
||||
m_toggleAction = new QAction(tr("Toggle Bookmark"), this);
|
||||
Core::ICommand *cmd =
|
||||
Core::Command *cmd =
|
||||
am->registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext);
|
||||
#ifndef Q_OS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -37,7 +37,9 @@
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -36,9 +36,11 @@
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -31,8 +31,10 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "actioncontainer.h"
|
||||
#include "command.h"
|
||||
#include "actioncontainer_p.h"
|
||||
#include "actionmanager_p.h"
|
||||
|
||||
#include "command_p.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
@@ -48,146 +50,112 @@ Q_DECLARE_METATYPE(Core::Internal::MenuActionContainer*)
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
/*!
|
||||
\class IActionContainer
|
||||
\mainclass
|
||||
\ingroup qwb
|
||||
\inheaderfile iactioncontainer.h
|
||||
|
||||
\brief The class...
|
||||
|
||||
The Action Container interface...
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum IActionContainer::ContainerType
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum IActionContainer::EmptyAction
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual IActionContainer::setEmptyAction(EmptyAction ea)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int IActionContainer::id() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ContainerType IActionContainer::type() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenu *IActionContainer::menu() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QToolBar *IActionContainer::toolBar() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenuBar *IActionContainer::menuBar() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *IActionContainer::insertLocation(const QString &group) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void IActionContainer::appendGroup(const QString &group, bool global)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void IActionContainer::addAction(Core::ICommand *action, const QString &group)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void IActionContainer::addMenu(Core::IActionContainer *menu, const QString &group)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool IActionContainer::update()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual IActionContainer::~IActionContainer()
|
||||
*/
|
||||
|
||||
// ---------- ActionContainer ------------
|
||||
|
||||
/*!
|
||||
\class ActionContainer
|
||||
\ingroup qwb
|
||||
\inheaderfile actioncontainer.h
|
||||
\mainclass
|
||||
|
||||
\brief The ActionContainer class represents a menu or menu bar in Qt Creator.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum ActionContainer::ContainerState
|
||||
\enum ActionContainer::ContainerType
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ActionContainer::ActionContainer(ContainerType type, int id)
|
||||
\enum ActionContainer::EmptyAction
|
||||
*/
|
||||
ActionContainer::ActionContainer(ContainerType type, int id)
|
||||
: m_data(CS_None), m_type(type), m_id(id)
|
||||
{
|
||||
|
||||
}
|
||||
/*!
|
||||
\fn virtual ActionContainer::setEmptyAction(EmptyAction ea)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int ActionContainer::id() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ContainerType ActionContainer::type() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenu *ActionContainer::menu() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QToolBar *ActionContainer::toolBar() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenuBar *ActionContainer::menuBar() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *ActionContainer::insertLocation(const QString &group) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::appendGroup(const QString &group, bool global)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::addAction(Core::Command *action, const QString &group)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool ActionContainer::update()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ActionContainer::~ActionContainer()
|
||||
*/
|
||||
|
||||
// ---------- ActionContainerPrivate ------------
|
||||
|
||||
/*!
|
||||
...
|
||||
\class Core::Internal::ActionContainerPrivate
|
||||
\internal
|
||||
*/
|
||||
void ActionContainer::setEmptyAction(EmptyAction ea)
|
||||
|
||||
ActionContainerPrivate::ActionContainerPrivate(int id)
|
||||
: m_data(CS_None), m_id(id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ActionContainerPrivate::setEmptyAction(EmptyAction ea)
|
||||
{
|
||||
m_data = ((m_data & ~EA_Mask) | ea);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ActionContainer::hasEmptyAction(EmptyAction ea) const
|
||||
bool ActionContainerPrivate::hasEmptyAction(EmptyAction ea) const
|
||||
{
|
||||
return (m_data & EA_Mask) == ea;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::setState(ContainerState state)
|
||||
void ActionContainerPrivate::setState(ContainerState state)
|
||||
{
|
||||
m_data |= state;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ActionContainer::hasState(ContainerState state) const
|
||||
bool ActionContainerPrivate::hasState(ContainerState state) const
|
||||
{
|
||||
return (m_data & state);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::appendGroup(const QString &group, bool global)
|
||||
void ActionContainerPrivate::appendGroup(const QString &group)
|
||||
{
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int gid = idmanager->uniqueIdentifier(group);
|
||||
m_groups << gid;
|
||||
if (global)
|
||||
ActionManager::instance()->registerGlobalGroup(gid, m_id);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QAction *ActionContainer::insertLocation(const QString &group) const
|
||||
QAction *ActionContainerPrivate::insertLocation(const QString &group) const
|
||||
{
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int grpid = idmanager->uniqueIdentifier(group);
|
||||
@@ -196,41 +164,22 @@ QAction *ActionContainer::insertLocation(const QString &group) const
|
||||
return beforeAction(pos, &prevKey);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::insertAction(QAction *before, QAction *action) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::insertMenu(QAction *before, QMenu *menu) = 0
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<ICommand *> ActionContainer::commands() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<IActionContainer *> ActionContainer::subContainers() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::addAction(ICommand *action, const QString &group)
|
||||
void ActionContainerPrivate::addAction(Command *action, const QString &group)
|
||||
{
|
||||
if (!canAddAction(action))
|
||||
return;
|
||||
|
||||
ActionManager *am = ActionManager::instance();
|
||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||
Action *a = static_cast<Action *>(action);
|
||||
if (a->stateFlags() & Command::CS_PreLocation) {
|
||||
if (a->stateFlags() & CommandPrivate::CS_PreLocation) {
|
||||
QList<CommandLocation> locs = a->locations();
|
||||
for (int i=0; i<locs.size(); ++i) {
|
||||
if (IActionContainer *aci = am->actionContainer(locs.at(i).m_container)) {
|
||||
ActionContainer *ac = static_cast<ActionContainer *>(aci);
|
||||
if (ActionContainer *aci = am->actionContainer(locs.at(i).m_container)) {
|
||||
ActionContainerPrivate *ac = static_cast<ActionContainerPrivate *>(aci);
|
||||
ac->addAction(action, locs.at(i).m_position, false);
|
||||
}
|
||||
}
|
||||
a->setStateFlags(a->stateFlags() | Command::CS_Initialized);
|
||||
a->setStateFlags(a->stateFlags() | CommandPrivate::CS_Initialized);
|
||||
} else {
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
|
||||
@@ -243,23 +192,21 @@ void ActionContainer::addAction(ICommand *action, const QString &group)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
|
||||
void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group)
|
||||
{
|
||||
if (!canAddMenu(menu))
|
||||
ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(menu);
|
||||
if (!container->canBeAddedToMenu())
|
||||
return;
|
||||
|
||||
ActionManager *am = ActionManager::instance();
|
||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
|
||||
if (mc->hasState(ActionContainer::CS_PreLocation)) {
|
||||
if (mc->hasState(ActionContainerPrivate::CS_PreLocation)) {
|
||||
CommandLocation loc = mc->location();
|
||||
if (IActionContainer *aci = am->actionContainer(loc.m_container)) {
|
||||
ActionContainer *ac = static_cast<ActionContainer *>(aci);
|
||||
if (ActionContainer *aci = am->actionContainer(loc.m_container)) {
|
||||
ActionContainerPrivate *ac = static_cast<ActionContainerPrivate *>(aci);
|
||||
ac->addMenu(menu, loc.m_position, false);
|
||||
}
|
||||
mc->setState(ActionContainer::CS_Initialized);
|
||||
mc->setState(ActionContainerPrivate::CS_Initialized);
|
||||
} else {
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
|
||||
@@ -272,80 +219,34 @@ void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
int ActionContainer::id() const
|
||||
int ActionContainerPrivate::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
IActionContainer::ContainerType ActionContainer::type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QMenu *ActionContainer::menu() const
|
||||
QMenu *ActionContainerPrivate::menu() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QToolBar *ActionContainer::toolBar() const
|
||||
QMenuBar *ActionContainerPrivate::menuBar() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QMenuBar *ActionContainer::menuBar() const
|
||||
bool ActionContainerPrivate::canAddAction(Command *action) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ActionContainer::canAddAction(ICommand *action) const
|
||||
{
|
||||
if (action->type() != ICommand::CT_OverridableAction)
|
||||
if (action->type() != Command::CT_OverridableAction)
|
||||
return false;
|
||||
|
||||
Command *cmd = static_cast<Command *>(action);
|
||||
if (cmd->stateFlags() & Command::CS_Initialized)
|
||||
CommandPrivate *cmd = static_cast<CommandPrivate *>(action);
|
||||
if (cmd->stateFlags() & CommandPrivate::CS_Initialized)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ActionContainer::canAddMenu(IActionContainer *menu) const
|
||||
{
|
||||
if (menu->type() != IActionContainer::CT_Menu)
|
||||
return false;
|
||||
|
||||
ActionContainer *container = static_cast<ActionContainer *>(menu);
|
||||
if (container->hasState(ActionContainer::CS_Initialized))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
|
||||
void ActionContainerPrivate::addAction(Command *action, int pos, bool setpos)
|
||||
{
|
||||
Action *a = static_cast<Action *>(action);
|
||||
|
||||
@@ -367,10 +268,7 @@ void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
|
||||
insertAction(ba, a->action());
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
|
||||
void ActionContainerPrivate::addMenu(ActionContainer *menu, int pos, bool setpos)
|
||||
{
|
||||
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
|
||||
|
||||
@@ -390,13 +288,9 @@ void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
|
||||
insertMenu(ba, mc->menu());
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
\internal
|
||||
*/
|
||||
QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
|
||||
QAction *ActionContainerPrivate::beforeAction(int pos, int *prevKey) const
|
||||
{
|
||||
ActionManager *am = ActionManager::instance();
|
||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||
|
||||
int baId = -1;
|
||||
|
||||
@@ -415,20 +309,16 @@ QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
|
||||
if (baId == -1)
|
||||
return 0;
|
||||
|
||||
if (ICommand *cmd = am->command(baId))
|
||||
if (Command *cmd = am->command(baId))
|
||||
return cmd->action();
|
||||
if (IActionContainer *container = am->actionContainer(baId))
|
||||
if (ActionContainer *container = am->actionContainer(baId))
|
||||
if (QMenu *menu = container->menu())
|
||||
return menu->menuAction();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
\internal
|
||||
*/
|
||||
int ActionContainer::calcPosition(int pos, int prevKey) const
|
||||
int ActionContainerPrivate::calcPosition(int pos, int prevKey) const
|
||||
{
|
||||
int grp = (pos & 0xFFFF0000);
|
||||
if (prevKey == -1)
|
||||
@@ -445,23 +335,16 @@ int ActionContainer::calcPosition(int pos, int prevKey) const
|
||||
// ---------- MenuActionContainer ------------
|
||||
|
||||
/*!
|
||||
\class MenuActionContainer
|
||||
\ingroup qwb
|
||||
\inheaderfile actioncontainer.h
|
||||
\class Core::Internal::MenuActionContainer
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
MenuActionContainer::MenuActionContainer(int id)
|
||||
: ActionContainer(CT_Menu, id), m_menu(0)
|
||||
: ActionContainerPrivate(id), m_menu(0)
|
||||
{
|
||||
setEmptyAction(EA_Disable);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuActionContainer::setMenu(QMenu *menu)
|
||||
{
|
||||
m_menu = menu;
|
||||
@@ -472,49 +355,31 @@ void MenuActionContainer::setMenu(QMenu *menu)
|
||||
m_menu->menuAction()->setData(v);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QMenu *MenuActionContainer::menu() const
|
||||
{
|
||||
return m_menu;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuActionContainer::insertAction(QAction *before, QAction *action)
|
||||
{
|
||||
m_menu->insertAction(before, action);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||
{
|
||||
m_menu->insertMenu(before, menu);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuActionContainer::setLocation(const CommandLocation &location)
|
||||
{
|
||||
m_location = location;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
CommandLocation MenuActionContainer::location() const
|
||||
{
|
||||
return m_location;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool MenuActionContainer::update()
|
||||
{
|
||||
if (hasEmptyAction(EA_None))
|
||||
@@ -522,7 +387,7 @@ bool MenuActionContainer::update()
|
||||
|
||||
bool hasitems = false;
|
||||
|
||||
foreach (IActionContainer *container, subContainers()) {
|
||||
foreach (ActionContainer *container, subContainers()) {
|
||||
if (container == this) {
|
||||
qWarning() << Q_FUNC_INFO << "container" << (this->menu() ? this->menu()->title() : "") << "contains itself as subcontainer";
|
||||
continue;
|
||||
@@ -533,7 +398,7 @@ bool MenuActionContainer::update()
|
||||
}
|
||||
}
|
||||
if (!hasitems) {
|
||||
foreach (ICommand *command, commands()) {
|
||||
foreach (Command *command, commands()) {
|
||||
if (command->isActive()) {
|
||||
hasitems = true;
|
||||
break;
|
||||
@@ -549,131 +414,48 @@ bool MenuActionContainer::update()
|
||||
return hasitems;
|
||||
}
|
||||
|
||||
// ---------- ToolBarActionContainer ------------
|
||||
|
||||
/*!
|
||||
\class ToolBarActionContainer
|
||||
\ingroup qwb
|
||||
\inheaderfile actioncontainer.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ToolBarActionContainer::ToolBarActionContainer(int id)
|
||||
: ActionContainer(CT_ToolBar, id), m_toolBar(0)
|
||||
bool MenuActionContainer::canBeAddedToMenu() const
|
||||
{
|
||||
setEmptyAction(EA_None);
|
||||
if (hasState(ActionContainerPrivate::CS_Initialized))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ToolBarActionContainer::setToolBar(QToolBar *toolBar)
|
||||
{
|
||||
m_toolBar = toolBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QToolBar *ToolBarActionContainer::toolBar() const
|
||||
{
|
||||
return m_toolBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ToolBarActionContainer::insertAction(QAction *before, QAction *action)
|
||||
{
|
||||
m_toolBar->insertAction(before, action);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ToolBarActionContainer::insertMenu(QAction *, QMenu *)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ToolBarActionContainer::update()
|
||||
{
|
||||
if (hasEmptyAction(EA_None))
|
||||
return true;
|
||||
|
||||
bool hasitems = false;
|
||||
foreach (ICommand *command, commands()) {
|
||||
if (command->isActive()) {
|
||||
hasitems = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasEmptyAction(EA_Hide))
|
||||
m_toolBar->setVisible(hasitems);
|
||||
else if (hasEmptyAction(EA_Disable))
|
||||
m_toolBar->setEnabled(hasitems);
|
||||
|
||||
return hasitems;
|
||||
}
|
||||
|
||||
// ---------- MenuBarActionContainer ------------
|
||||
|
||||
/*!
|
||||
\class MenuBarActionContainer
|
||||
\ingroup qwb
|
||||
\inheaderfile actioncontainer.h
|
||||
\class Core::Internal::MenuBarActionContainer
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
MenuBarActionContainer::MenuBarActionContainer(int id)
|
||||
: ActionContainer(CT_ToolBar, id), m_menuBar(0)
|
||||
: ActionContainerPrivate(id), m_menuBar(0)
|
||||
{
|
||||
setEmptyAction(EA_None);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuBarActionContainer::setMenuBar(QMenuBar *menuBar)
|
||||
{
|
||||
m_menuBar = menuBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QMenuBar *MenuBarActionContainer::menuBar() const
|
||||
{
|
||||
return m_menuBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuBarActionContainer::insertAction(QAction *before, QAction *action)
|
||||
{
|
||||
m_menuBar->insertAction(before, action);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void MenuBarActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||
{
|
||||
m_menuBar->insertMenu(before, menu);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool MenuBarActionContainer::update()
|
||||
{
|
||||
if (hasEmptyAction(EA_None))
|
||||
@@ -695,3 +477,9 @@ bool MenuBarActionContainer::update()
|
||||
|
||||
return hasitems;
|
||||
}
|
||||
|
||||
bool MenuBarActionContainer::canBeAddedToMenu() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -34,123 +34,42 @@
|
||||
#ifndef ACTIONCONTAINER_H
|
||||
#define ACTIONCONTAINER_H
|
||||
|
||||
#include "actionmanager.h"
|
||||
|
||||
#include <coreplugin/actionmanager/iactioncontainer.h>
|
||||
#include <coreplugin/actionmanager/icommand.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class ActionContainer : public Core::IActionContainer
|
||||
class Command;
|
||||
|
||||
class ActionContainer : public QObject
|
||||
{
|
||||
public:
|
||||
enum ContainerState {
|
||||
CS_None = 0x000000,
|
||||
CS_Initialized = 0x010000,
|
||||
CS_PreLocation = 0x020000,
|
||||
CS_UserDefined = 0x040000
|
||||
enum EmptyAction {
|
||||
EA_Mask = 0xFF00,
|
||||
EA_None = 0x0100,
|
||||
EA_Hide = 0x0200,
|
||||
EA_Disable = 0x0300
|
||||
};
|
||||
|
||||
ActionContainer(ContainerType type, int id);
|
||||
virtual void setEmptyAction(EmptyAction ea) = 0;
|
||||
|
||||
virtual int id() const = 0;
|
||||
|
||||
virtual QMenu *menu() const = 0;
|
||||
virtual QMenuBar *menuBar() const = 0;
|
||||
|
||||
virtual QAction *insertLocation(const QString &group) const = 0;
|
||||
virtual void appendGroup(const QString &group) = 0;
|
||||
virtual void addAction(Core::Command *action, const QString &group = QString()) = 0;
|
||||
virtual void addMenu(Core::ActionContainer *menu, const QString &group = QString()) = 0;
|
||||
|
||||
virtual bool update() = 0;
|
||||
virtual ~ActionContainer() {}
|
||||
|
||||
void setEmptyAction(EmptyAction ea);
|
||||
bool hasEmptyAction(EmptyAction ea) const;
|
||||
|
||||
void setState(ContainerState state);
|
||||
bool hasState(ContainerState state) const;
|
||||
|
||||
QAction *insertLocation(const QString &group) const;
|
||||
void appendGroup(const QString &group, bool global = false);
|
||||
void addAction(ICommand *action, const QString &group = QString());
|
||||
void addMenu(IActionContainer *menu, const QString &group = QString());
|
||||
|
||||
int id() const;
|
||||
ContainerType type() const;
|
||||
|
||||
QMenu *menu() const;
|
||||
QToolBar *toolBar() const;
|
||||
QMenuBar *menuBar() const;
|
||||
|
||||
virtual void insertAction(QAction *before, QAction *action) = 0;
|
||||
virtual void insertMenu(QAction *before, QMenu *menu) = 0;
|
||||
|
||||
QList<ICommand *> commands() const { return m_commands; }
|
||||
QList<IActionContainer *> subContainers() const { return m_subContainers; }
|
||||
protected:
|
||||
bool canAddAction(ICommand *action) const;
|
||||
bool canAddMenu(IActionContainer *menu) const;
|
||||
|
||||
void addAction(ICommand *action, int pos, bool setpos);
|
||||
void addMenu(IActionContainer *menu, int pos, bool setpos);
|
||||
|
||||
private:
|
||||
QAction *beforeAction(int pos, int *prevKey) const;
|
||||
int calcPosition(int pos, int prevKey) const;
|
||||
|
||||
QList<int> m_groups;
|
||||
int m_data;
|
||||
ContainerType m_type;
|
||||
int m_id;
|
||||
QMap<int, int> m_posmap;
|
||||
QList<IActionContainer *> m_subContainers;
|
||||
QList<ICommand *> m_commands;
|
||||
};
|
||||
|
||||
class MenuActionContainer : public ActionContainer
|
||||
{
|
||||
public:
|
||||
MenuActionContainer(int id);
|
||||
|
||||
void setMenu(QMenu *menu);
|
||||
QMenu *menu() const;
|
||||
|
||||
void setLocation(const CommandLocation &location);
|
||||
CommandLocation location() const;
|
||||
|
||||
void insertAction(QAction *before, QAction *action);
|
||||
void insertMenu(QAction *before, QMenu *menu);
|
||||
bool update();
|
||||
|
||||
private:
|
||||
QMenu *m_menu;
|
||||
CommandLocation m_location;
|
||||
};
|
||||
|
||||
class ToolBarActionContainer : public ActionContainer
|
||||
{
|
||||
public:
|
||||
ToolBarActionContainer(int id);
|
||||
|
||||
void setToolBar(QToolBar *toolBar);
|
||||
QToolBar *toolBar() const;
|
||||
|
||||
void insertAction(QAction *before, QAction *action);
|
||||
void insertMenu(QAction *before, QMenu *menu);
|
||||
bool update();
|
||||
|
||||
private:
|
||||
QToolBar *m_toolBar;
|
||||
};
|
||||
|
||||
class MenuBarActionContainer : public ActionContainer
|
||||
{
|
||||
public:
|
||||
MenuBarActionContainer(int id);
|
||||
|
||||
void setMenuBar(QMenuBar *menuBar);
|
||||
QMenuBar *menuBar() const;
|
||||
|
||||
void insertAction(QAction *before, QAction *action);
|
||||
void insertMenu(QAction *before, QMenu *menu);
|
||||
bool update();
|
||||
|
||||
private:
|
||||
QMenuBar *m_menuBar;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // ACTIONCONTAINER_H
|
||||
|
||||
142
src/plugins/coreplugin/actionmanager/actioncontainer_p.h
Normal file
142
src/plugins/coreplugin/actionmanager/actioncontainer_p.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ACTIONCONTAINER_P_H
|
||||
#define ACTIONCONTAINER_P_H
|
||||
|
||||
#include "actionmanager_p.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class ActionContainerPrivate : public Core::ActionContainer
|
||||
{
|
||||
public:
|
||||
enum ContainerState {
|
||||
CS_None = 0x000000,
|
||||
CS_Initialized = 0x010000,
|
||||
CS_PreLocation = 0x020000,
|
||||
CS_UserDefined = 0x040000
|
||||
};
|
||||
|
||||
ActionContainerPrivate(int id);
|
||||
virtual ~ActionContainerPrivate() {}
|
||||
|
||||
void setEmptyAction(EmptyAction ea);
|
||||
bool hasEmptyAction(EmptyAction ea) const;
|
||||
|
||||
void setState(ContainerState state);
|
||||
bool hasState(ContainerState state) const;
|
||||
|
||||
QAction *insertLocation(const QString &group) const;
|
||||
void appendGroup(const QString &group);
|
||||
void addAction(Command *action, const QString &group = QString());
|
||||
void addMenu(ActionContainer *menu, const QString &group = QString());
|
||||
|
||||
int id() const;
|
||||
|
||||
QMenu *menu() const;
|
||||
QMenuBar *menuBar() const;
|
||||
|
||||
virtual void insertAction(QAction *before, QAction *action) = 0;
|
||||
virtual void insertMenu(QAction *before, QMenu *menu) = 0;
|
||||
|
||||
QList<Command *> commands() const { return m_commands; }
|
||||
QList<ActionContainer *> subContainers() const { return m_subContainers; }
|
||||
protected:
|
||||
bool canAddAction(Command *action) const;
|
||||
bool canAddMenu(ActionContainer *menu) const;
|
||||
virtual bool canBeAddedToMenu() const = 0;
|
||||
|
||||
void addAction(Command *action, int pos, bool setpos);
|
||||
void addMenu(ActionContainer *menu, int pos, bool setpos);
|
||||
|
||||
private:
|
||||
QAction *beforeAction(int pos, int *prevKey) const;
|
||||
int calcPosition(int pos, int prevKey) const;
|
||||
|
||||
QList<int> m_groups;
|
||||
int m_data;
|
||||
int m_id;
|
||||
QMap<int, int> m_posmap;
|
||||
QList<ActionContainer *> m_subContainers;
|
||||
QList<Command *> m_commands;
|
||||
};
|
||||
|
||||
class MenuActionContainer : public ActionContainerPrivate
|
||||
{
|
||||
public:
|
||||
MenuActionContainer(int id);
|
||||
|
||||
void setMenu(QMenu *menu);
|
||||
QMenu *menu() const;
|
||||
|
||||
void setLocation(const CommandLocation &location);
|
||||
CommandLocation location() const;
|
||||
|
||||
void insertAction(QAction *before, QAction *action);
|
||||
void insertMenu(QAction *before, QMenu *menu);
|
||||
bool update();
|
||||
|
||||
protected:
|
||||
bool canBeAddedToMenu() const;
|
||||
private:
|
||||
QMenu *m_menu;
|
||||
CommandLocation m_location;
|
||||
};
|
||||
|
||||
class MenuBarActionContainer : public ActionContainerPrivate
|
||||
{
|
||||
public:
|
||||
MenuBarActionContainer(int id);
|
||||
|
||||
void setMenuBar(QMenuBar *menuBar);
|
||||
QMenuBar *menuBar() const;
|
||||
|
||||
void insertAction(QAction *before, QAction *action);
|
||||
void insertMenu(QAction *before, QMenu *menu);
|
||||
bool update();
|
||||
|
||||
protected:
|
||||
bool canBeAddedToMenu() const;
|
||||
private:
|
||||
QMenuBar *m_menuBar;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // ACTIONCONTAINER_P_H
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -31,10 +31,10 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "actionmanager.h"
|
||||
#include "actionmanager_p.h"
|
||||
#include "mainwindow.h"
|
||||
#include "actioncontainer.h"
|
||||
#include "command.h"
|
||||
#include "actioncontainer_p.h"
|
||||
#include "command_p.h"
|
||||
#include "uniqueidmanager.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
namespace {
|
||||
@@ -52,115 +51,163 @@ namespace {
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Core::ActionManagerInterface
|
||||
\class Core::ActionManager
|
||||
\mainclass
|
||||
\ingroup qwb
|
||||
\inheaderfile actionmanagerinterface.h
|
||||
|
||||
\brief All actions should be registered in the ActionManager, since this enables the user to
|
||||
e.g. change their shortcuts at a central place.
|
||||
\brief The action manager is responsible for registration of menus and
|
||||
menu items and keyboard shortcuts.
|
||||
|
||||
The ActionManagerInterface is the central bookkeeper of actions and their shortcuts and layout.
|
||||
You get the only implementation of this class from the core interface (ICore::actionManager()).
|
||||
The ActionManager is the central bookkeeper of actions and their shortcuts and layout.
|
||||
You get the only implementation of this class from the core interface
|
||||
ICore::actionManager() method, e.g.
|
||||
\code
|
||||
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager()
|
||||
\endcode
|
||||
|
||||
The main reasons for the need of this class is to provide a central place where the user
|
||||
can specify all his keyboard shortcuts, and to provide a solution for actions that should
|
||||
behave differently in different contexts (like the copy/replace/undo/redo actions).
|
||||
|
||||
All actions that are registered with the same string id (but different context lists)
|
||||
are considered to be overloads of the same command. The action that is visible to the user
|
||||
is the one returned by ICommand::action(). (If you provide yourself a user visible
|
||||
representation of your action be sure to always use ICommand::action() for this.)
|
||||
If this action is invoked by the user, the signal is forwarded to the registered action that
|
||||
is valid for the current context.
|
||||
are considered to be overloads of the same command, represented by an instance
|
||||
of the Command class.
|
||||
The action that is visible to the user is the one returned by Command::action().
|
||||
If you provide yourself a user visible representation of your action you need
|
||||
to use Command::action() for this.
|
||||
When this action is invoked by the user,
|
||||
the signal is forwarded to the registered action that is valid for the current context.
|
||||
|
||||
You use this class also to add items to registered
|
||||
action containers like the applications menu bar. For this you register your action via the
|
||||
So to register a globally active action "My Action"
|
||||
put the following in your plugin's IPlugin::initialize method:
|
||||
\code
|
||||
Core::ActionManager *am = ExtensionSystem::PluginManager::instance()
|
||||
->getObject<Core::ICore>()->actionManager();
|
||||
QAction *myAction = new QAction(tr("My Action"), this);
|
||||
Core::Command *cmd = am->registerAction(myAction,
|
||||
"myplugin.myaction",
|
||||
QList<int>() << C_GLOBAL_ID);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u")));
|
||||
connect(myAction, SIGNAL(triggered()), this, SLOT(performMyAction()));
|
||||
\endcode
|
||||
|
||||
So the \c connect is done to your own QAction instance. If you create e.g.
|
||||
a tool button that should represent the action you add the action
|
||||
from Command::action() to it:
|
||||
\code
|
||||
QToolButton *myButton = new QToolButton(someParentWidget);
|
||||
myButton->setDefaultAction(cmd->action());
|
||||
\endcode
|
||||
|
||||
Also use the ActionManager to add items to registered
|
||||
action containers like the applications menu bar or menus in that menu bar.
|
||||
To do this, you register your action via the
|
||||
registerAction methods, get the action container for a specific id (like specified in
|
||||
Core::Constants) with a call of
|
||||
the Core::Constants namespace) with a call of
|
||||
actionContainer(const QString&) and add your command to this container.
|
||||
|
||||
Guidelines:
|
||||
Following the example adding "My Action" to the "Tools" menu would be done by
|
||||
\code
|
||||
am->actionContainer(Core::M_TOOLS)->addAction(cmd);
|
||||
\endcode
|
||||
|
||||
Important guidelines:
|
||||
\list
|
||||
\o Always register your actions and shortcuts!
|
||||
\o Register your actions and shortcuts during your plugin's IPlugin::initialize
|
||||
or IPlugin::extensionsInitialized methods, otherwise the shortcuts won't appear
|
||||
in the keyboard settings dialog from the beginning.
|
||||
\o When registering an action with cmd=registerAction(action, id, contexts) be sure to connect
|
||||
your own action connect(action, SIGNAL...) but make cmd->action() visible to the user, i.e.
|
||||
widget->addAction(cmd->action()).
|
||||
\o Use this class to add actions to the applications menus
|
||||
\endlist
|
||||
|
||||
\sa Core::ICore, Core::ICommand
|
||||
\sa Core::IActionContainer
|
||||
\sa Core::ICore
|
||||
\sa Core::Command
|
||||
\sa Core::ActionContainer
|
||||
\sa Core::IContext
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual IActionContainer *ActionManagerInterface::createMenu(const QString &id) = 0
|
||||
...
|
||||
\fn ActionContainer *ActionManager::createMenu(const QString &id)
|
||||
\brief Creates a new menu with the given string \a id.
|
||||
|
||||
Returns a new ActionContainer that you can use to get the QMenu instance
|
||||
or to add menu items to the menu. The ActionManager owns
|
||||
the returned ActionContainer.
|
||||
Add your menu to some other menu or a menu bar via the
|
||||
ActionManager::actionContainer and ActionContainer::addMenu methods.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual IActionContainer *ActionManagerInterface::createMenuBar(const QString &id) = 0
|
||||
...
|
||||
\fn ActionContainer *ActionManager::createMenuBar(const QString &id)
|
||||
\brief Creates a new menu bar with the given string \a id.
|
||||
|
||||
Returns a new ActionContainer that you can use to get the QMenuBar instance
|
||||
or to add menus to the menu bar. The ActionManager owns
|
||||
the returned ActionContainer.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ICommand *ActionManagerInterface::registerAction(QAction *action, const QString &id, const QList<int> &context) = 0
|
||||
...
|
||||
\fn Command *ActionManager::registerAction(QAction *action, const QString &id, const QList<int> &context)
|
||||
\brief Makes an \a action known to the system under the specified string \a id.
|
||||
|
||||
Returns a command object that represents the action in the application and is
|
||||
owned by the ActionManager. You can registered several actions with the
|
||||
same \a id as long as the \a context is different. In this case
|
||||
a trigger of the actual action is forwarded to the registered QAction
|
||||
for the currently active context.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ICommand *ActionManagerInterface::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0
|
||||
...
|
||||
\fn Command *ActionManager::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
|
||||
\brief Makes a \a shortcut known to the system under the specified string \a id.
|
||||
|
||||
Returns a command object that represents the shortcut in the application and is
|
||||
owned by the ActionManager. You can registered several shortcuts with the
|
||||
same \a id as long as the \a context is different. In this case
|
||||
a trigger of the actual shortcut is forwarded to the registered QShortcut
|
||||
for the currently active context.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ICommand *ActionManagerInterface::registerAction(QAction *action, const QString &id) = 0
|
||||
...
|
||||
\fn Command *ActionManager::command(const QString &id) const
|
||||
\brief Returns the Command object that is known to the system
|
||||
under the given string \a id.
|
||||
|
||||
\sa ActionManager::registerAction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionManagerInterface::addAction(ICommand *action, const QString &globalGroup) = 0
|
||||
...
|
||||
*/
|
||||
\fn ActionContainer *ActionManager::actionContainer(const QString &id) const
|
||||
\brief Returns the IActionContainter object that is know to the system
|
||||
under the given string \a id.
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionManagerInterface::addMenu(IActionContainer *menu, const QString &globalGroup) = 0
|
||||
...
|
||||
\sa ActionManager::createMenu()
|
||||
\sa ActionManager::createMenuBar()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ICommand *ActionManagerInterface::command(const QString &id) const = 0
|
||||
...
|
||||
\fn ActionManager::ActionManager(QObject *parent)
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual IActionContainer *ActionManagerInterface::actionContainer(const QString &id) const = 0
|
||||
...
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ActionManagerInterface::~ActionManagerInterface()
|
||||
...
|
||||
\fn ActionManager::~ActionManager()
|
||||
\internal
|
||||
*/
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
ActionManager* ActionManager::m_instance = 0;
|
||||
ActionManagerPrivate* ActionManagerPrivate::m_instance = 0;
|
||||
|
||||
/*!
|
||||
\class ActionManager
|
||||
\ingroup qwb
|
||||
\inheaderfile actionmanager.h
|
||||
|
||||
\sa ActionContainer
|
||||
\class ActionManagerPrivate
|
||||
\inheaderfile actionmanager_p.h
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ActionManager::ActionManager(MainWindow *mainWnd, UniqueIDManager *uidmgr) :
|
||||
ActionManagerInterface(mainWnd),
|
||||
ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd, UniqueIDManager *uidmgr) :
|
||||
ActionManager(mainWnd),
|
||||
m_mainWnd(mainWnd)
|
||||
{
|
||||
m_defaultGroups << uidmgr->uniqueIdentifier(Constants::G_DEFAULT_ONE);
|
||||
@@ -170,73 +217,38 @@ ActionManager::ActionManager(MainWindow *mainWnd, UniqueIDManager *uidmgr) :
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ActionManager::~ActionManager()
|
||||
ActionManagerPrivate::~ActionManagerPrivate()
|
||||
{
|
||||
qDeleteAll(m_idCmdMap.values());
|
||||
qDeleteAll(m_idContainerMap.values());
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ActionManager* ActionManager::instance()
|
||||
ActionManagerPrivate* ActionManagerPrivate::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QList<int> ActionManager::defaultGroups() const
|
||||
QList<int> ActionManagerPrivate::defaultGroups() const
|
||||
{
|
||||
return m_defaultGroups;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QList<Command *> ActionManager::commands() const
|
||||
QList<CommandPrivate *> ActionManagerPrivate::commands() const
|
||||
{
|
||||
return m_idCmdMap.values();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QList<ActionContainer *> ActionManager::containers() const
|
||||
QList<ActionContainerPrivate *> ActionManagerPrivate::containers() const
|
||||
{
|
||||
return m_idContainerMap.values();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionManager::registerGlobalGroup(int groupId, int containerId)
|
||||
{
|
||||
if (m_globalgroups.contains(groupId)) {
|
||||
qWarning() << "registerGlobalGroup: Global group "
|
||||
<< m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(groupId)
|
||||
<< " already registered";
|
||||
} else {
|
||||
m_globalgroups.insert(groupId, containerId);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool ActionManager::hasContext(int context) const
|
||||
bool ActionManagerPrivate::hasContext(int context) const
|
||||
{
|
||||
return m_context.contains(context);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionManager::setContext(const QList<int> &context)
|
||||
void ActionManagerPrivate::setContext(const QList<int> &context)
|
||||
{
|
||||
// here are possibilities for speed optimization if necessary:
|
||||
// let commands (de-)register themselves for contexts
|
||||
@@ -251,10 +263,7 @@ void ActionManager::setContext(const QList<int> &context)
|
||||
it.value()->update();
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool ActionManager::hasContext(QList<int> context) const
|
||||
bool ActionManagerPrivate::hasContext(QList<int> context) const
|
||||
{
|
||||
for (int i=0; i<m_context.count(); ++i) {
|
||||
if (context.contains(m_context.at(i)))
|
||||
@@ -263,10 +272,7 @@ bool ActionManager::hasContext(QList<int> context) const
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
IActionContainer *ActionManager::createMenu(const QString &id)
|
||||
ActionContainer *ActionManagerPrivate::createMenu(const QString &id)
|
||||
{
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);
|
||||
@@ -284,10 +290,7 @@ IActionContainer *ActionManager::createMenu(const QString &id)
|
||||
return mc;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
IActionContainer *ActionManager::createMenuBar(const QString &id)
|
||||
ActionContainer *ActionManagerPrivate::createMenuBar(const QString &id)
|
||||
{
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);
|
||||
@@ -305,36 +308,22 @@ IActionContainer *ActionManager::createMenuBar(const QString &id)
|
||||
return mbc;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ICommand *ActionManager::registerAction(QAction *action, const QString &id, const QList<int> &context)
|
||||
Command *ActionManagerPrivate::registerAction(QAction *action, const QString &id, const QList<int> &context)
|
||||
{
|
||||
OverrideableAction *a = 0;
|
||||
ICommand *c = registerOverridableAction(action, id, false);
|
||||
Command *c = registerOverridableAction(action, id, false);
|
||||
a = static_cast<OverrideableAction *>(c);
|
||||
if (a)
|
||||
a->addOverrideAction(action, context);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ICommand *ActionManager::registerAction(QAction *action, const QString &id)
|
||||
{
|
||||
return registerOverridableAction(action, id, true);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
ICommand *ActionManager::registerOverridableAction(QAction *action, const QString &id, bool checkUnique)
|
||||
Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const QString &id, bool checkUnique)
|
||||
{
|
||||
OverrideableAction *a = 0;
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
if (Command *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != ICommand::CT_OverridableAction) {
|
||||
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != Command::CT_OverridableAction) {
|
||||
qWarning() << "registerAction: id" << id << "is registered with a different command type.";
|
||||
return c;
|
||||
}
|
||||
@@ -375,15 +364,12 @@ ICommand *ActionManager::registerOverridableAction(QAction *action, const QStrin
|
||||
return a;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ICommand *ActionManager::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
|
||||
Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
|
||||
{
|
||||
Shortcut *sc = 0;
|
||||
int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
if (Command *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != ICommand::CT_Shortcut) {
|
||||
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != Command::CT_Shortcut) {
|
||||
qWarning() << "registerShortcut: id" << id << "is registered with a different command type.";
|
||||
return c;
|
||||
}
|
||||
@@ -415,98 +401,47 @@ ICommand *ActionManager::registerShortcut(QShortcut *shortcut, const QString &id
|
||||
return sc;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void ActionManager::addAction(Core::ICommand *action, const QString &globalGroup)
|
||||
*/
|
||||
void ActionManager::addAction(ICommand *action, const QString &globalGroup)
|
||||
{
|
||||
const int gid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(globalGroup);
|
||||
if (!m_globalgroups.contains(gid)) {
|
||||
qWarning() << "addAction: Unknown global group " << globalGroup;
|
||||
return;
|
||||
}
|
||||
|
||||
const int cid = m_globalgroups.value(gid);
|
||||
if (IActionContainer *aci = actionContainer(cid)) {
|
||||
aci->addAction(action, globalGroup);
|
||||
} else {
|
||||
qWarning() << "addAction: Cannot find container." << cid << '/' << gid;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void ActionManager::addMenu(Core::IActionContainer *menu, const QString &globalGroup)
|
||||
|
||||
*/
|
||||
void ActionManager::addMenu(IActionContainer *menu, const QString &globalGroup)
|
||||
{
|
||||
const int gid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(globalGroup);
|
||||
if (!m_globalgroups.contains(gid)) {
|
||||
qWarning() << "addAction: Unknown global group " << globalGroup;
|
||||
return;
|
||||
}
|
||||
|
||||
const int cid = m_globalgroups.value(gid);
|
||||
if (IActionContainer *aci = actionContainer(cid)) {
|
||||
aci->addMenu(menu, globalGroup);
|
||||
} else {
|
||||
qWarning() << "addAction: Cannot find container." << cid << '/' << gid;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ICommand *ActionManager::command(const QString &id) const
|
||||
Command *ActionManagerPrivate::command(const QString &id) const
|
||||
{
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid);
|
||||
if (it == m_idCmdMap.constEnd()) {
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManager::command(): failed to find :" << id << '/' << uid;
|
||||
qWarning() << "ActionManagerPrivate::command(): failed to find :" << id << '/' << uid;
|
||||
return 0;
|
||||
}
|
||||
return it.value();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
IActionContainer *ActionManager::actionContainer(const QString &id) const
|
||||
ActionContainer *ActionManagerPrivate::actionContainer(const QString &id) const
|
||||
{
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);
|
||||
if ( it == m_idContainerMap.constEnd()) {
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManager::actionContainer(): failed to find :" << id << '/' << uid;
|
||||
qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << id << '/' << uid;
|
||||
return 0;
|
||||
}
|
||||
return it.value();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
ICommand *ActionManager::command(int uid) const
|
||||
Command *ActionManagerPrivate::command(int uid) const
|
||||
{
|
||||
const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid);
|
||||
if (it == m_idCmdMap.constEnd()) {
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManager::command(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << '/' << uid;
|
||||
qWarning() << "ActionManagerPrivate::command(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << '/' << uid;
|
||||
return 0;
|
||||
}
|
||||
return it.value();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
IActionContainer *ActionManager::actionContainer(int uid) const
|
||||
ActionContainer *ActionManagerPrivate::actionContainer(int uid) const
|
||||
{
|
||||
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid);
|
||||
if (it == m_idContainerMap.constEnd()) {
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManager::actionContainer(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << uid;
|
||||
qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << uid;
|
||||
return 0;
|
||||
}
|
||||
return it.value();
|
||||
@@ -516,10 +451,7 @@ static const char *settingsGroup = "KeyBindings";
|
||||
static const char *idKey = "ID";
|
||||
static const char *sequenceKey = "Keysequence";
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void ActionManager::initialize()
|
||||
void ActionManagerPrivate::initialize()
|
||||
{
|
||||
QSettings *settings = m_mainWnd->settings();
|
||||
const int shortcuts = settings->beginReadArray(QLatin1String(settingsGroup));
|
||||
@@ -529,17 +461,14 @@ void ActionManager::initialize()
|
||||
const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString());
|
||||
const int id = m_mainWnd->uniqueIDManager()->uniqueIdentifier(sid);
|
||||
|
||||
ICommand *cmd = command(id);
|
||||
Command *cmd = command(id);
|
||||
if (cmd)
|
||||
cmd->setKeySequence(key);
|
||||
}
|
||||
settings->endArray();
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void ActionManager::saveSettings(QSettings *settings)
|
||||
void ActionManagerPrivate::saveSettings(QSettings *settings)
|
||||
{
|
||||
settings->beginWriteArray(QLatin1String(settingsGroup));
|
||||
int count = 0;
|
||||
@@ -547,7 +476,7 @@ void ActionManager::saveSettings(QSettings *settings)
|
||||
const IdCmdMap::const_iterator cmdcend = m_idCmdMap.constEnd();
|
||||
for (IdCmdMap::const_iterator j = m_idCmdMap.constBegin(); j != cmdcend; ++j) {
|
||||
const int id = j.key();
|
||||
Command *cmd = j.value();
|
||||
CommandPrivate *cmd = j.value();
|
||||
QKeySequence key = cmd->keySequence();
|
||||
if (key != cmd->defaultKeySequence()) {
|
||||
const QString sid = m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(id);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -34,97 +34,39 @@
|
||||
#ifndef ACTIONMANAGER_H
|
||||
#define ACTIONMANAGER_H
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include "coreplugin/core_global.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QMultiHash>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
class QAction;
|
||||
class QShortcut;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
struct CommandLocation
|
||||
{
|
||||
int m_container;
|
||||
int m_position;
|
||||
};
|
||||
|
||||
namespace Core {
|
||||
|
||||
class UniqueIDManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ActionContainer;
|
||||
class MainWindow;
|
||||
class Command;
|
||||
|
||||
class ActionManager : public Core::ActionManagerInterface
|
||||
class CORE_EXPORT ActionManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActionManager(MainWindow *mainWnd, UniqueIDManager *uidmgr);
|
||||
~ActionManager();
|
||||
ActionManager(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~ActionManager() {}
|
||||
|
||||
void setContext(const QList<int> &context);
|
||||
static ActionManager* instance();
|
||||
virtual ActionContainer *createMenu(const QString &id) = 0;
|
||||
virtual ActionContainer *createMenuBar(const QString &id) = 0;
|
||||
|
||||
void saveSettings(QSettings *settings);
|
||||
QList<int> defaultGroups() const;
|
||||
virtual Command *registerAction(QAction *action, const QString &id, const QList<int> &context) = 0;
|
||||
virtual Command *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0;
|
||||
|
||||
QList<Command *> commands() const;
|
||||
QList<ActionContainer *> containers() const;
|
||||
|
||||
bool hasContext(int context) const;
|
||||
|
||||
ICommand *command(int uid) const;
|
||||
IActionContainer *actionContainer(int uid) const;
|
||||
|
||||
void registerGlobalGroup(int groupId, int containerId);
|
||||
|
||||
void initialize();
|
||||
|
||||
//ActionManager Interface
|
||||
IActionContainer *createMenu(const QString &id);
|
||||
IActionContainer *createMenuBar(const QString &id);
|
||||
|
||||
ICommand *registerAction(QAction *action, const QString &id,
|
||||
const QList<int> &context);
|
||||
ICommand *registerAction(QAction *action, const QString &id);
|
||||
ICommand *registerShortcut(QShortcut *shortcut, const QString &id,
|
||||
const QList<int> &context);
|
||||
|
||||
void addAction(Core::ICommand *action, const QString &globalGroup);
|
||||
void addMenu(Core::IActionContainer *menu, const QString &globalGroup);
|
||||
|
||||
Core::ICommand *command(const QString &id) const;
|
||||
Core::IActionContainer *actionContainer(const QString &id) const;
|
||||
|
||||
private:
|
||||
bool hasContext(QList<int> context) const;
|
||||
ICommand *registerOverridableAction(QAction *action, const QString &id,
|
||||
bool checkUnique);
|
||||
|
||||
static ActionManager* m_instance;
|
||||
QList<int> m_defaultGroups;
|
||||
|
||||
typedef QHash<int, Command *> IdCmdMap;
|
||||
IdCmdMap m_idCmdMap;
|
||||
|
||||
typedef QHash<int, ActionContainer *> IdContainerMap;
|
||||
IdContainerMap m_idContainerMap;
|
||||
|
||||
typedef QMap<int, int> GlobalGroupMap;
|
||||
GlobalGroupMap m_globalgroups;
|
||||
|
||||
QList<int> m_context;
|
||||
|
||||
MainWindow *m_mainWnd;
|
||||
virtual Command *command(const QString &id) const = 0;
|
||||
virtual ActionContainer *actionContainer(const QString &id) const = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // ACTIONMANAGER_H
|
||||
|
||||
124
src/plugins/coreplugin/actionmanager/actionmanager_p.h
Normal file
124
src/plugins/coreplugin/actionmanager/actionmanager_p.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ACTIONMANAGERPRIVATE_H
|
||||
#define ACTIONMANAGERPRIVATE_H
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QMultiHash>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
struct CommandLocation
|
||||
{
|
||||
int m_container;
|
||||
int m_position;
|
||||
};
|
||||
|
||||
namespace Core {
|
||||
|
||||
class UniqueIDManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ActionContainerPrivate;
|
||||
class MainWindow;
|
||||
class CommandPrivate;
|
||||
|
||||
class ActionManagerPrivate : public Core::ActionManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActionManagerPrivate(MainWindow *mainWnd, UniqueIDManager *uidmgr);
|
||||
~ActionManagerPrivate();
|
||||
|
||||
void setContext(const QList<int> &context);
|
||||
static ActionManagerPrivate* instance();
|
||||
|
||||
void saveSettings(QSettings *settings);
|
||||
QList<int> defaultGroups() const;
|
||||
|
||||
QList<CommandPrivate *> commands() const;
|
||||
QList<ActionContainerPrivate *> containers() const;
|
||||
|
||||
bool hasContext(int context) const;
|
||||
|
||||
Command *command(int uid) const;
|
||||
ActionContainer *actionContainer(int uid) const;
|
||||
|
||||
void initialize();
|
||||
|
||||
//ActionManager Interface
|
||||
ActionContainer *createMenu(const QString &id);
|
||||
ActionContainer *createMenuBar(const QString &id);
|
||||
|
||||
Command *registerAction(QAction *action, const QString &id,
|
||||
const QList<int> &context);
|
||||
Command *registerShortcut(QShortcut *shortcut, const QString &id,
|
||||
const QList<int> &context);
|
||||
|
||||
Core::Command *command(const QString &id) const;
|
||||
Core::ActionContainer *actionContainer(const QString &id) const;
|
||||
|
||||
private:
|
||||
bool hasContext(QList<int> context) const;
|
||||
Command *registerOverridableAction(QAction *action, const QString &id,
|
||||
bool checkUnique);
|
||||
|
||||
static ActionManagerPrivate* m_instance;
|
||||
QList<int> m_defaultGroups;
|
||||
|
||||
typedef QHash<int, CommandPrivate *> IdCmdMap;
|
||||
IdCmdMap m_idCmdMap;
|
||||
|
||||
typedef QHash<int, ActionContainerPrivate *> IdContainerMap;
|
||||
IdContainerMap m_idContainerMap;
|
||||
|
||||
// typedef QMap<int, int> GlobalGroupMap;
|
||||
// GlobalGroupMap m_globalgroups;
|
||||
//
|
||||
QList<int> m_context;
|
||||
|
||||
MainWindow *m_mainWnd;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // ACTIONMANAGERPRIVATE_H
|
||||
@@ -1,77 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ACTIONMANAGERINTERFACE_H
|
||||
#define ACTIONMANAGERINTERFACE_H
|
||||
|
||||
#include "coreplugin/core_global.h"
|
||||
|
||||
#include <coreplugin/actionmanager/iactioncontainer.h>
|
||||
#include <coreplugin/actionmanager/icommand.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QShortcut;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class CORE_EXPORT ActionManagerInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ActionManagerInterface(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~ActionManagerInterface() {}
|
||||
|
||||
virtual IActionContainer *createMenu(const QString &id) = 0;
|
||||
virtual IActionContainer *createMenuBar(const QString &id) = 0;
|
||||
|
||||
virtual ICommand *registerAction(QAction *action, const QString &id, const QList<int> &context) = 0;
|
||||
virtual ICommand *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0;
|
||||
|
||||
virtual ICommand *registerAction(QAction *action, const QString &id) = 0;
|
||||
|
||||
virtual void addAction(ICommand *action, const QString &globalGroup) = 0;
|
||||
virtual void addMenu(IActionContainer *menu, const QString &globalGroup) = 0;
|
||||
|
||||
virtual ICommand *command(const QString &id) const = 0;
|
||||
virtual IActionContainer *actionContainer(const QString &id) const = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // ACTIONMANAGERINTERFACE_H
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -35,13 +35,12 @@
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QShortcut>
|
||||
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
|
||||
/*!
|
||||
\class Core::ICommand
|
||||
\class Core::Command
|
||||
\mainclass
|
||||
\ingroup qwb
|
||||
\inheaderfile icommand.h
|
||||
|
||||
\brief The class...
|
||||
|
||||
@@ -49,226 +48,167 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum ICommand::CommandType
|
||||
\enum Command::CommandType
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum ICommand::CommandAttribute
|
||||
\enum Command::CommandAttribute
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void ICommand::setCategory(const QString &name)
|
||||
\fn void Command::setCategory(const QString &name)
|
||||
|
||||
Sets the category to \a name.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ICommand::setDefaultKeySequence(const QKeySequence &key)
|
||||
\fn virtual void Command::setDefaultKeySequence(const QKeySequence &key)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int ICommand::id() const
|
||||
\fn virtual int Command::id() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual CommandType ICommand::type() const
|
||||
\fn virtual CommandType Command::type() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *ICommand::action() const
|
||||
\fn virtual QAction *Command::action() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QShortcut *ICommand::shortcut() const
|
||||
\fn virtual QShortcut *Command::shortcut() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ICommand::setAttribute(CommandAttribute attr)
|
||||
\fn virtual void Command::setAttribute(CommandAttribute attr)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ICommand::removeAttribute(CommandAttribute attr)
|
||||
\fn virtual void Command::removeAttribute(CommandAttribute attr)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool ICommand::hasAttribute(CommandAttribute attr) const
|
||||
\fn virtual bool Command::hasAttribute(CommandAttribute attr) const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool ICommand::isActive() const
|
||||
\fn virtual bool Command::isActive() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ICommand::~ICommand()
|
||||
*/
|
||||
|
||||
using namespace Core::Internal;
|
||||
|
||||
/*!
|
||||
\class Command
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Command::CommandState
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Command::Command(CommandType type, int id)
|
||||
*/
|
||||
Command::Command(CommandType type, int id)
|
||||
: m_type(type), m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual Command::~Command()
|
||||
*/
|
||||
|
||||
using namespace Core::Internal;
|
||||
|
||||
/*!
|
||||
...
|
||||
\class CommandPrivate
|
||||
\inheaderfile command_p.h
|
||||
\internal
|
||||
*/
|
||||
void Command::setStateFlags(int state)
|
||||
|
||||
CommandPrivate::CommandPrivate(CommandType type, int id)
|
||||
: m_type(type), m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
void CommandPrivate::setStateFlags(int state)
|
||||
{
|
||||
m_type |= (state & CS_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
int Command::stateFlags() const
|
||||
int CommandPrivate::stateFlags() const
|
||||
{
|
||||
return (m_type & CS_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QString Command::name() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setCategory(const QString &name)
|
||||
void CommandPrivate::setCategory(const QString &name)
|
||||
{
|
||||
m_category = name;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QString Command::category() const
|
||||
QString CommandPrivate::category() const
|
||||
{
|
||||
if (m_category.isEmpty())
|
||||
return QObject::tr("Other");
|
||||
return m_category;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setDefaultKeySequence(const QKeySequence &key)
|
||||
void CommandPrivate::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
m_defaultKey = key;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QKeySequence Command::defaultKeySequence() const
|
||||
QKeySequence CommandPrivate::defaultKeySequence() const
|
||||
{
|
||||
return m_defaultKey;
|
||||
}
|
||||
|
||||
void Command::setDefaultText(const QString &text)
|
||||
void CommandPrivate::setDefaultText(const QString &text)
|
||||
{
|
||||
m_defaultText = text;
|
||||
}
|
||||
|
||||
QString Command::defaultText() const
|
||||
QString CommandPrivate::defaultText() const
|
||||
{
|
||||
return m_defaultText;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
int Command::id() const
|
||||
int CommandPrivate::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Command::CommandType Command::type() const
|
||||
CommandPrivate::CommandType CommandPrivate::type() const
|
||||
{
|
||||
return (CommandType)(m_type & CT_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QAction *Command::action() const
|
||||
QAction *CommandPrivate::action() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QShortcut *Command::shortcut() const
|
||||
QShortcut *CommandPrivate::shortcut() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setAttribute(CommandAttribute attr)
|
||||
void CommandPrivate::setAttribute(CommandAttribute attr)
|
||||
{
|
||||
m_type |= attr;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::removeAttribute(CommandAttribute attr)
|
||||
void CommandPrivate::removeAttribute(CommandAttribute attr)
|
||||
{
|
||||
m_type &= ~attr;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool Command::hasAttribute(CommandAttribute attr) const
|
||||
bool CommandPrivate::hasAttribute(CommandAttribute attr) const
|
||||
{
|
||||
return (m_type & attr);
|
||||
}
|
||||
|
||||
QString Command::stringWithAppendedShortcut(const QString &str) const
|
||||
QString CommandPrivate::stringWithAppendedShortcut(const QString &str) const
|
||||
{
|
||||
return QString("%1 <span style=\"color: gray; font-size: small\">%2</span>").arg(str).arg(
|
||||
keySequence().toString(QKeySequence::NativeText));
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual bool Command::setCurrentContext(const QList<int> &context) = 0
|
||||
*/
|
||||
|
||||
// ---------- Shortcut ------------
|
||||
|
||||
/*!
|
||||
\class Shortcut
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Shortcut::Shortcut(int id)
|
||||
: Command(CT_Shortcut, id), m_shortcut(0)
|
||||
: CommandPrivate(CT_Shortcut, id), m_shortcut(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -322,7 +262,7 @@ QList<int> Shortcut::context() const
|
||||
void Shortcut::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
setKeySequence(key);
|
||||
Command::setDefaultKeySequence(key);
|
||||
CommandPrivate::setDefaultKeySequence(key);
|
||||
}
|
||||
|
||||
void Shortcut::setKeySequence(const QKeySequence &key)
|
||||
@@ -374,14 +314,13 @@ bool Shortcut::isActive() const
|
||||
/*!
|
||||
\class Action
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Action::Action(CommandType type, int id)
|
||||
: Command(type, id), m_action(0)
|
||||
: CommandPrivate(type, id), m_action(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -439,7 +378,7 @@ QList<CommandLocation> Action::locations() const
|
||||
void Action::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
setKeySequence(key);
|
||||
Command::setDefaultKeySequence(key);
|
||||
CommandPrivate::setDefaultKeySequence(key);
|
||||
}
|
||||
|
||||
void Action::setKeySequence(const QKeySequence &key)
|
||||
@@ -467,7 +406,6 @@ QKeySequence Action::keySequence() const
|
||||
/*!
|
||||
\class OverrideableAction
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -34,146 +34,61 @@
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
|
||||
#include "icommand.h"
|
||||
#include "actionmanager.h"
|
||||
#include <coreplugin/core_global.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMultiMap>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtGui/QKeySequence>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class Command : public Core::ICommand
|
||||
class CORE_EXPORT Command : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum CommandState {
|
||||
CS_PreLocation = 0x020000,
|
||||
CS_LocationChanged = 0x040000,
|
||||
CS_Initialized = 0x080000,
|
||||
CS_Mask = 0xFF0000
|
||||
enum CommandType {
|
||||
CT_Shortcut = 0x0001,
|
||||
CT_OverridableAction = 0x0002,
|
||||
CT_Mask = 0x00FF
|
||||
};
|
||||
|
||||
Command(CommandType type, int id);
|
||||
enum CommandAttribute {
|
||||
CA_Hide = 0x0100,
|
||||
CA_UpdateText = 0x0200,
|
||||
CA_UpdateIcon = 0x0400,
|
||||
CA_NonConfigureable = 0x8000,
|
||||
CA_Mask = 0xFF00
|
||||
};
|
||||
|
||||
virtual void setDefaultKeySequence(const QKeySequence &key) = 0;
|
||||
virtual void setKeySequence(const QKeySequence &key) = 0;
|
||||
virtual QKeySequence defaultKeySequence() const = 0;
|
||||
virtual QKeySequence keySequence() const = 0;
|
||||
virtual void setDefaultText(const QString &text) = 0;
|
||||
virtual QString defaultText() const = 0;
|
||||
|
||||
virtual void setCategory(const QString &name) = 0;
|
||||
|
||||
virtual int id() const = 0;
|
||||
virtual CommandType type() const = 0;
|
||||
|
||||
virtual QAction *action() const = 0;
|
||||
virtual QShortcut *shortcut() const = 0;
|
||||
|
||||
virtual void setAttribute(CommandAttribute attr) = 0;
|
||||
virtual void removeAttribute(CommandAttribute attr) = 0;
|
||||
virtual bool hasAttribute(CommandAttribute attr) const = 0;
|
||||
|
||||
virtual bool isActive() const = 0;
|
||||
|
||||
virtual ~Command() {}
|
||||
|
||||
void setStateFlags(int state);
|
||||
int stateFlags() const;
|
||||
virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
|
||||
|
||||
virtual QString name() const = 0;
|
||||
|
||||
void setCategory(const QString &name);
|
||||
QString category() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
QKeySequence defaultKeySequence() const;
|
||||
|
||||
void setDefaultText(const QString &text);
|
||||
QString defaultText() const;
|
||||
|
||||
int id() const;
|
||||
CommandType type() const;
|
||||
|
||||
QAction *action() const;
|
||||
QShortcut *shortcut() const;
|
||||
|
||||
void setAttribute(CommandAttribute attr);
|
||||
void removeAttribute(CommandAttribute attr);
|
||||
bool hasAttribute(CommandAttribute attr) const;
|
||||
|
||||
virtual bool setCurrentContext(const QList<int> &context) = 0;
|
||||
|
||||
QString stringWithAppendedShortcut(const QString &str) const;
|
||||
|
||||
protected:
|
||||
QString m_category;
|
||||
int m_type;
|
||||
int m_id;
|
||||
QKeySequence m_defaultKey;
|
||||
QString m_defaultText;
|
||||
signals:
|
||||
void keySequenceChanged();
|
||||
};
|
||||
|
||||
class Shortcut : public Command
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Shortcut(int id);
|
||||
|
||||
QString name() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
QKeySequence keySequence() const;
|
||||
|
||||
virtual void setDefaultText(const QString &key);
|
||||
virtual QString defaultText() const;
|
||||
|
||||
void setShortcut(QShortcut *shortcut);
|
||||
QShortcut *shortcut() const;
|
||||
|
||||
void setContext(const QList<int> &context);
|
||||
QList<int> context() const;
|
||||
bool setCurrentContext(const QList<int> &context);
|
||||
|
||||
bool isActive() const;
|
||||
private:
|
||||
QList<int> m_context;
|
||||
QShortcut *m_shortcut;
|
||||
QString m_defaultText;
|
||||
};
|
||||
|
||||
class Action : public Command
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Action(CommandType type, int id);
|
||||
|
||||
QString name() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
QKeySequence keySequence() const;
|
||||
|
||||
virtual void setAction(QAction *action);
|
||||
QAction *action() const;
|
||||
|
||||
void setLocations(const QList<CommandLocation> &locations);
|
||||
QList<CommandLocation> locations() const;
|
||||
|
||||
protected:
|
||||
void updateToolTipWithKeySequence();
|
||||
|
||||
QAction *m_action;
|
||||
QList<CommandLocation> m_locations;
|
||||
QString m_toolTip;
|
||||
};
|
||||
|
||||
class OverrideableAction : public Action
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OverrideableAction(int id);
|
||||
|
||||
void setAction(QAction *action);
|
||||
bool setCurrentContext(const QList<int> &context);
|
||||
void addOverrideAction(QAction *action, const QList<int> &context);
|
||||
bool isActive() const;
|
||||
|
||||
private slots:
|
||||
void actionChanged();
|
||||
|
||||
private:
|
||||
QPointer<QAction> m_currentAction;
|
||||
QList<int> m_context;
|
||||
QMap<int, QPointer<QAction> > m_contextActionMap;
|
||||
bool m_active;
|
||||
bool m_contextInitialized;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // COMMAND_H
|
||||
|
||||
179
src/plugins/coreplugin/actionmanager/command_p.h
Normal file
179
src/plugins/coreplugin/actionmanager/command_p.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef COMMAND_P_H
|
||||
#define COMMAND_P_H
|
||||
|
||||
#include "command.h"
|
||||
#include "actionmanager_p.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMultiMap>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QKeySequence>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class CommandPrivate : public Core::Command
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum CommandState {
|
||||
CS_PreLocation = 0x020000,
|
||||
CS_LocationChanged = 0x040000,
|
||||
CS_Initialized = 0x080000,
|
||||
CS_Mask = 0xFF0000
|
||||
};
|
||||
|
||||
CommandPrivate(CommandType type, int id);
|
||||
virtual ~CommandPrivate() {}
|
||||
|
||||
void setStateFlags(int state);
|
||||
int stateFlags() const;
|
||||
|
||||
virtual QString name() const = 0;
|
||||
|
||||
void setCategory(const QString &name);
|
||||
QString category() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
QKeySequence defaultKeySequence() const;
|
||||
|
||||
void setDefaultText(const QString &text);
|
||||
QString defaultText() const;
|
||||
|
||||
int id() const;
|
||||
CommandType type() const;
|
||||
|
||||
QAction *action() const;
|
||||
QShortcut *shortcut() const;
|
||||
|
||||
void setAttribute(CommandAttribute attr);
|
||||
void removeAttribute(CommandAttribute attr);
|
||||
bool hasAttribute(CommandAttribute attr) const;
|
||||
|
||||
virtual bool setCurrentContext(const QList<int> &context) = 0;
|
||||
|
||||
QString stringWithAppendedShortcut(const QString &str) const;
|
||||
|
||||
protected:
|
||||
QString m_category;
|
||||
int m_type;
|
||||
int m_id;
|
||||
QKeySequence m_defaultKey;
|
||||
QString m_defaultText;
|
||||
};
|
||||
|
||||
class Shortcut : public CommandPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Shortcut(int id);
|
||||
|
||||
QString name() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
QKeySequence keySequence() const;
|
||||
|
||||
virtual void setDefaultText(const QString &key);
|
||||
virtual QString defaultText() const;
|
||||
|
||||
void setShortcut(QShortcut *shortcut);
|
||||
QShortcut *shortcut() const;
|
||||
|
||||
void setContext(const QList<int> &context);
|
||||
QList<int> context() const;
|
||||
bool setCurrentContext(const QList<int> &context);
|
||||
|
||||
bool isActive() const;
|
||||
private:
|
||||
QList<int> m_context;
|
||||
QShortcut *m_shortcut;
|
||||
QString m_defaultText;
|
||||
};
|
||||
|
||||
class Action : public CommandPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Action(CommandType type, int id);
|
||||
|
||||
QString name() const;
|
||||
|
||||
void setDefaultKeySequence(const QKeySequence &key);
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
QKeySequence keySequence() const;
|
||||
|
||||
virtual void setAction(QAction *action);
|
||||
QAction *action() const;
|
||||
|
||||
void setLocations(const QList<CommandLocation> &locations);
|
||||
QList<CommandLocation> locations() const;
|
||||
|
||||
protected:
|
||||
void updateToolTipWithKeySequence();
|
||||
|
||||
QAction *m_action;
|
||||
QList<CommandLocation> m_locations;
|
||||
QString m_toolTip;
|
||||
};
|
||||
|
||||
class OverrideableAction : public Action
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OverrideableAction(int id);
|
||||
|
||||
void setAction(QAction *action);
|
||||
bool setCurrentContext(const QList<int> &context);
|
||||
void addOverrideAction(QAction *action, const QList<int> &context);
|
||||
bool isActive() const;
|
||||
|
||||
private slots:
|
||||
void actionChanged();
|
||||
|
||||
private:
|
||||
QPointer<QAction> m_currentAction;
|
||||
QList<int> m_context;
|
||||
QMap<int, QPointer<QAction> > m_contextActionMap;
|
||||
bool m_active;
|
||||
bool m_contextInitialized;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // COMMAND_P_H
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "coreimpl.h"
|
||||
#include "commandsfile.h"
|
||||
#include "shortcutsettings.h"
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef IACTIONCONTAINER_H
|
||||
#define IACTIONCONTAINER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class ICommand;
|
||||
|
||||
class IActionContainer : public QObject
|
||||
{
|
||||
public:
|
||||
enum ContainerType {
|
||||
CT_Mask = 0xFF,
|
||||
CT_Menu = 0x01,
|
||||
CT_ToolBar = 0x02
|
||||
};
|
||||
|
||||
enum EmptyAction {
|
||||
EA_Mask = 0xFF00,
|
||||
EA_None = 0x0100,
|
||||
EA_Hide = 0x0200,
|
||||
EA_Disable = 0x0300
|
||||
};
|
||||
|
||||
virtual void setEmptyAction(EmptyAction ea) = 0;
|
||||
|
||||
virtual int id() const = 0;
|
||||
virtual ContainerType type() const = 0;
|
||||
|
||||
virtual QMenu *menu() const = 0;
|
||||
virtual QToolBar *toolBar() const = 0;
|
||||
virtual QMenuBar *menuBar() const = 0;
|
||||
|
||||
virtual QAction *insertLocation(const QString &group) const = 0;
|
||||
virtual void appendGroup(const QString &group, bool global = false) = 0;
|
||||
virtual void addAction(Core::ICommand *action, const QString &group = QString()) = 0;
|
||||
virtual void addMenu(Core::IActionContainer *menu, const QString &group = QString()) = 0;
|
||||
|
||||
virtual bool update() = 0;
|
||||
virtual ~IActionContainer() {}
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // IACTIONCONTAINER_H
|
||||
@@ -1,94 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ICOMMAND_H
|
||||
#define ICOMMAND_H
|
||||
|
||||
#include <coreplugin/core_global.h>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtGui/QKeySequence>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class CORE_EXPORT ICommand : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum CommandType {
|
||||
CT_Shortcut = 0x0001,
|
||||
CT_OverridableAction = 0x0002,
|
||||
CT_Mask = 0x00FF
|
||||
};
|
||||
|
||||
enum CommandAttribute {
|
||||
CA_Hide = 0x0100,
|
||||
CA_UpdateText = 0x0200,
|
||||
CA_UpdateIcon = 0x0400,
|
||||
CA_NonConfigureable = 0x8000,
|
||||
CA_Mask = 0xFF00
|
||||
};
|
||||
|
||||
virtual void setDefaultKeySequence(const QKeySequence &key) = 0;
|
||||
virtual void setKeySequence(const QKeySequence &key) = 0;
|
||||
virtual QKeySequence defaultKeySequence() const = 0;
|
||||
virtual QKeySequence keySequence() const = 0;
|
||||
virtual void setDefaultText(const QString &text) = 0;
|
||||
virtual QString defaultText() const = 0;
|
||||
|
||||
virtual void setCategory(const QString &name) = 0;
|
||||
|
||||
virtual int id() const = 0;
|
||||
virtual CommandType type() const = 0;
|
||||
|
||||
virtual QAction *action() const = 0;
|
||||
virtual QShortcut *shortcut() const = 0;
|
||||
|
||||
virtual void setAttribute(CommandAttribute attr) = 0;
|
||||
virtual void removeAttribute(CommandAttribute attr) = 0;
|
||||
virtual bool hasAttribute(CommandAttribute attr) const = 0;
|
||||
|
||||
virtual bool isActive() const = 0;
|
||||
|
||||
virtual ~ICommand() {}
|
||||
|
||||
virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
|
||||
|
||||
signals:
|
||||
void keySequenceChanged();
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // ICOMMAND_H
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -82,38 +82,6 @@ BaseMode::BaseMode(QObject *parent):
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn BaseMode::BaseMode(const QString &name,
|
||||
const char * uniqueModeName,
|
||||
const QIcon &icon,
|
||||
int priority,
|
||||
QWidget *widget,
|
||||
QObject *parent)
|
||||
|
||||
Creates a mode with the given properties.
|
||||
|
||||
\a name
|
||||
\a uniqueModeName
|
||||
\a icon
|
||||
\a priority
|
||||
\a widget
|
||||
\a parent
|
||||
*/
|
||||
BaseMode::BaseMode(const QString &name,
|
||||
const char * uniqueModeName,
|
||||
const QIcon &icon,
|
||||
int priority,
|
||||
QWidget *widget,
|
||||
QObject *parent):
|
||||
IMode(parent),
|
||||
m_name(name),
|
||||
m_icon(icon),
|
||||
m_priority(priority),
|
||||
m_widget(widget),
|
||||
m_uniqueModeName(uniqueModeName)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn BaseMode::~BaseMode()
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -49,12 +49,6 @@ class CORE_EXPORT BaseMode
|
||||
|
||||
public:
|
||||
BaseMode(QObject *parent = 0);
|
||||
BaseMode(const QString &name,
|
||||
const char * uniqueModeName,
|
||||
const QIcon &icon,
|
||||
int priority,
|
||||
QWidget *widget,
|
||||
QObject *parent = 0);
|
||||
~BaseMode();
|
||||
|
||||
// IMode
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "baseview.h"
|
||||
|
||||
#include <extensionsystem/ExtensionSystemInterfaces>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -34,8 +34,6 @@
|
||||
#ifndef CORECONSTANTS_H
|
||||
#define CORECONSTANTS_H
|
||||
|
||||
#include <extensionsystem/ExtensionSystemInterfaces>
|
||||
|
||||
namespace Core {
|
||||
namespace Constants {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -64,7 +64,7 @@ void CoreImpl::showOptionsDialog(const QString &group, const QString &page)
|
||||
m_mainwindow->showOptionsDialog(group, page);
|
||||
}
|
||||
|
||||
ActionManagerInterface *CoreImpl::actionManager() const
|
||||
ActionManager *CoreImpl::actionManager() const
|
||||
{
|
||||
return m_mainwindow->actionManager();
|
||||
}
|
||||
@@ -94,12 +94,12 @@ EditorManager *CoreImpl::editorManager() const
|
||||
return m_mainwindow->editorManager();
|
||||
}
|
||||
|
||||
ProgressManagerInterface *CoreImpl::progressManager() const
|
||||
ProgressManager *CoreImpl::progressManager() const
|
||||
{
|
||||
return m_mainwindow->progressManager();
|
||||
}
|
||||
|
||||
ScriptManagerInterface *CoreImpl::scriptManager() const
|
||||
ScriptManager *CoreImpl::scriptManager() const
|
||||
{
|
||||
return m_mainwindow->scriptManager();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
void showOptionsDialog(const QString &group = QString(),
|
||||
const QString &page = QString());
|
||||
|
||||
ActionManagerInterface *actionManager() const;
|
||||
ActionManager *actionManager() const;
|
||||
FileManager *fileManager() const ;
|
||||
UniqueIDManager *uniqueIDManager() const;
|
||||
MessageManager *messageManager() const;
|
||||
ExtensionSystem::PluginManager *pluginManager() const;
|
||||
EditorManager *editorManager() const;
|
||||
ProgressManagerInterface *progressManager() const;
|
||||
ScriptManagerInterface *scriptManager() const;
|
||||
ProgressManager *progressManager() const;
|
||||
ScriptManager *scriptManager() const;
|
||||
VariableManager *variableManager() const;
|
||||
VCSManager *vcsManager() const;
|
||||
ModeManager *modeManager() const;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -98,12 +98,12 @@ HEADERS += mainwindow.h \
|
||||
editormanager/openeditorswindow.h \
|
||||
editormanager/ieditor.h \
|
||||
editormanager/ieditorfactory.h \
|
||||
actionmanager/iactioncontainer.h \
|
||||
actionmanager/actionmanagerinterface.h \
|
||||
actionmanager/icommand.h \
|
||||
actionmanager/actioncontainer.h \
|
||||
actionmanager/actionmanager.h \
|
||||
actionmanager/command.h \
|
||||
actionmanager/actioncontainer.h \
|
||||
actionmanager/actionmanager_p.h \
|
||||
actionmanager/command_p.h \
|
||||
actionmanager/actioncontainer_p.h \
|
||||
actionmanager/commandsfile.h \
|
||||
dialogs/saveitemsdialog.h \
|
||||
dialogs/newdialog.h \
|
||||
@@ -112,11 +112,11 @@ HEADERS += mainwindow.h \
|
||||
dialogs/openwithdialog.h \
|
||||
dialogs/iwizard.h \
|
||||
dialogs/ioptionspage.h \
|
||||
progressmanager/progressmanager.h \
|
||||
progressmanager/progressmanager_p.h \
|
||||
progressmanager/progressview.h \
|
||||
progressmanager/progresspie.h \
|
||||
progressmanager/futureprogress.h \
|
||||
progressmanager/progressmanagerinterface.h \
|
||||
progressmanager/progressmanager.h \
|
||||
icontext.h \
|
||||
icore.h \
|
||||
ifile.h \
|
||||
@@ -132,8 +132,8 @@ HEADERS += mainwindow.h \
|
||||
versiondialog.h \
|
||||
scriptmanager/metatypedeclarations.h \
|
||||
scriptmanager/qworkbench_wrapper.h \
|
||||
scriptmanager/scriptmanagerinterface.h \
|
||||
scriptmanager/scriptmanager.h \
|
||||
scriptmanager/scriptmanager_p.h \
|
||||
core_global.h \
|
||||
basemode.h \
|
||||
baseview.h \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -54,7 +54,8 @@ public:
|
||||
virtual QString trCategory() const = 0;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent) = 0;
|
||||
virtual void finished(bool accepted) = 0;
|
||||
virtual void apply() = 0;
|
||||
virtual void finish() = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -126,20 +126,22 @@ void SettingsDialog::pageSelected(QTreeWidgetItem *)
|
||||
|
||||
void SettingsDialog::accept()
|
||||
{
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(true);
|
||||
foreach (IOptionsPage *page, m_pages) {
|
||||
page->apply();
|
||||
page->finish();
|
||||
}
|
||||
done(QDialog::Accepted);
|
||||
}
|
||||
|
||||
void SettingsDialog::reject()
|
||||
{
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(false);
|
||||
page->finish();
|
||||
done(QDialog::Rejected);
|
||||
}
|
||||
|
||||
void SettingsDialog::apply()
|
||||
{
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(true);
|
||||
page->apply();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -33,15 +33,15 @@
|
||||
|
||||
#include "shortcutsettings.h"
|
||||
#include "ui_shortcutsettings.h"
|
||||
#include "actionmanager.h"
|
||||
#include "command.h"
|
||||
#include "actionmanager_p.h"
|
||||
#include "command_p.h"
|
||||
#include "coreconstants.h"
|
||||
#include "coreimpl.h"
|
||||
#include "commandsfile.h"
|
||||
#include "filemanager.h"
|
||||
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/icommand.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QShortcut>
|
||||
@@ -120,14 +120,14 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
void ShortcutSettings::finished(bool accepted)
|
||||
void ShortcutSettings::apply()
|
||||
{
|
||||
if (accepted) {
|
||||
foreach (ShortcutItem *item, m_scitems) {
|
||||
item->m_cmd->setKeySequence(item->m_key);
|
||||
}
|
||||
}
|
||||
foreach (ShortcutItem *item, m_scitems)
|
||||
item->m_cmd->setKeySequence(item->m_key);
|
||||
}
|
||||
|
||||
void ShortcutSettings::finish()
|
||||
{
|
||||
qDeleteAll(m_scitems);
|
||||
m_scitems.clear();
|
||||
}
|
||||
@@ -281,14 +281,14 @@ void ShortcutSettings::initialize()
|
||||
{
|
||||
QMap<QString, QTreeWidgetItem *> categories;
|
||||
|
||||
m_am = ActionManager::instance();
|
||||
m_am = ActionManagerPrivate::instance();
|
||||
UniqueIDManager *uidm =
|
||||
CoreImpl::instance()->uniqueIDManager();
|
||||
|
||||
QList<Command *> cmds = m_am->commands();
|
||||
QList<CommandPrivate *> cmds = m_am->commands();
|
||||
for (int i = 0; i < cmds.size(); ++i) {
|
||||
Command *c = cmds.at(i);
|
||||
if (c->hasAttribute(Command::CA_NonConfigureable))
|
||||
CommandPrivate *c = cmds.at(i);
|
||||
if (c->hasAttribute(CommandPrivate::CA_NonConfigureable))
|
||||
continue;
|
||||
if (c->action() && c->action()->isSeparator())
|
||||
continue;
|
||||
@@ -313,7 +313,7 @@ void ShortcutSettings::initialize()
|
||||
item->setText(0, uidm->stringForUniqueIdentifier(c->id()));
|
||||
|
||||
if (c->action()) {
|
||||
QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
||||
QString text = c->hasAttribute(CommandPrivate::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
||||
s->m_key = c->action()->shortcut();
|
||||
item->setText(1, text);
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -47,17 +47,16 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class ICommand;
|
||||
class Command;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ActionManager;
|
||||
class Command;
|
||||
class ActionManagerPrivate;
|
||||
class MainWindow;
|
||||
|
||||
struct ShortcutItem
|
||||
{
|
||||
ICommand *m_cmd;
|
||||
Command *m_cmd;
|
||||
QKeySequence m_key;
|
||||
QTreeWidgetItem *m_item;
|
||||
};
|
||||
@@ -77,7 +76,8 @@ public:
|
||||
QString trCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
||||
|
||||
QList<ShortcutItem *> m_scitems;
|
||||
ActionManager *m_am;
|
||||
ActionManagerPrivate *m_am;
|
||||
int m_key[4], m_keyNum;
|
||||
Ui_ShortcutSettings *m_page;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <coreplugin/baseview.h>
|
||||
#include <coreplugin/imode.h>
|
||||
@@ -207,13 +207,13 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
const QList<int> editManagerContext =
|
||||
QList<int>() << m_d->m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER);
|
||||
|
||||
ActionManagerInterface *am = m_d->m_core->actionManager();
|
||||
IActionContainer *mfile = am->actionContainer(Constants::M_FILE);
|
||||
ActionManager *am = m_d->m_core->actionManager();
|
||||
ActionContainer *mfile = am->actionContainer(Constants::M_FILE);
|
||||
|
||||
//Revert to saved
|
||||
ICommand *cmd = am->registerAction(m_d->m_revertToSavedAction,
|
||||
Command *cmd = am->registerAction(m_d->m_revertToSavedAction,
|
||||
Constants::REVERTTOSAVED, editManagerContext);
|
||||
cmd->setAttribute(ICommand::CA_UpdateText);
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
cmd->setDefaultText(tr("Revert File to Saved"));
|
||||
mfile->addAction(cmd, Constants::G_FILE_SAVE);
|
||||
connect(m_d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved()));
|
||||
@@ -227,7 +227,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
connect(m_d->m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
|
||||
|
||||
//Window Menu
|
||||
IActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
|
||||
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
|
||||
|
||||
//Window menu separators
|
||||
QAction *tmpaction = new QAction(this);
|
||||
@@ -258,7 +258,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
//Close Action
|
||||
cmd = am->registerAction(m_d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W")));
|
||||
cmd->setAttribute(Core::ICommand::CA_UpdateText);
|
||||
cmd->setAttribute(Core::Command::CA_UpdateText);
|
||||
cmd->setDefaultText(m_d->m_closeCurrentEditorAction->text());
|
||||
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
|
||||
connect(m_d->m_closeCurrentEditorAction, SIGNAL(triggered()), this, SLOT(closeEditor()));
|
||||
@@ -315,8 +315,8 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
connect(m_d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory()));
|
||||
|
||||
|
||||
IActionContainer *medit = am->actionContainer(Constants::M_EDIT);
|
||||
IActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED);
|
||||
ActionContainer *medit = am->actionContainer(Constants::M_EDIT);
|
||||
ActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED);
|
||||
medit->addMenu(advancedMenu, Constants::G_EDIT_FORMAT);
|
||||
advancedMenu->menu()->setTitle(tr("&Advanced"));
|
||||
|
||||
@@ -1391,7 +1391,7 @@ void EditorManager::readSettings(QSettings *settings)
|
||||
if (settings->contains(QLatin1String("EditorManager/DocumentStates")))
|
||||
m_d->m_editorStates = settings->value(QLatin1String("EditorManager/DocumentStates"))
|
||||
.value<QMap<QString, QVariant> >();
|
||||
if (settings->contains(QLatin1String("EditorManager/ExternalEditor")))
|
||||
if (settings->contains(QLatin1String("EditorManager/ExternalEditorCommand")))
|
||||
m_d->m_externalEditor = settings->value(QLatin1String("EditorManager/ExternalEditorCommand")).toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -72,9 +72,9 @@ void EditorSplitter::registerActions()
|
||||
const QList<int> editorManagerContext =
|
||||
QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER);
|
||||
|
||||
ActionManagerInterface *am = m_core->actionManager();
|
||||
IActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
|
||||
ICommand *cmd;
|
||||
ActionManager *am = m_core->actionManager();
|
||||
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
|
||||
Command *cmd;
|
||||
|
||||
//Horizontal Action
|
||||
m_horizontalSplitAction = new QAction(tr("Split Left/Right"), this);
|
||||
@@ -98,7 +98,7 @@ void EditorSplitter::registerActions()
|
||||
this, SLOT(unsplit()));
|
||||
|
||||
//Default Layout menu
|
||||
IActionContainer *mLayout = am->createMenu("QtCreator.Menu.Window.Layout");
|
||||
ActionContainer *mLayout = am->createMenu("QtCreator.Menu.Window.Layout");
|
||||
mwindow->addMenu(mLayout, Constants::G_WINDOW_SPLIT);
|
||||
mLayout->menu()->setTitle(tr("Default Splitter Layout"));
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -81,11 +81,8 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
void GeneralSettings::finished(bool accepted)
|
||||
void GeneralSettings::apply()
|
||||
{
|
||||
if (!accepted)
|
||||
return;
|
||||
|
||||
// Apply the new base color if accepted
|
||||
StyleHelper::setBaseColor(m_page->colorButton->color());
|
||||
EditorManager::instance()->setExternalEditor(m_page->externalEditorEdit->text());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -55,7 +55,8 @@ public:
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QWidget* createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish() { }
|
||||
|
||||
private slots:
|
||||
void resetInterfaceColor();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "icore.h"
|
||||
|
||||
/*!
|
||||
@@ -51,7 +84,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ActionManagerInterface *ICore::actionManager() const
|
||||
\fn ActionManager *ICore::actionManager() const
|
||||
\brief Returns the application's action manager.
|
||||
|
||||
The action manager is responsible for registration of menus and
|
||||
@@ -98,7 +131,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ProgressManagerInterface *ICore::progressManager() const
|
||||
\fn ProgressManager *ICore::progressManager() const
|
||||
\brief Returns the application's progress manager.
|
||||
|
||||
Use the progress manager to register a concurrent task to
|
||||
@@ -106,7 +139,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn ScriptManagerInterface *ICore::scriptManager() const
|
||||
\fn ScriptManager *ICore::scriptManager() const
|
||||
\internal
|
||||
*/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
@@ -50,15 +50,15 @@ QT_END_NAMESPACE
|
||||
namespace Core {
|
||||
|
||||
// forward declarations
|
||||
class ActionManagerInterface;
|
||||
class ActionManager;
|
||||
class IFile;
|
||||
class FileManager;
|
||||
class MessageManager;
|
||||
class IEditor;
|
||||
class UniqueIDManager;
|
||||
class EditorManager;
|
||||
class ProgressManagerInterface;
|
||||
class ScriptManagerInterface;
|
||||
class ProgressManager;
|
||||
class ScriptManager;
|
||||
class VariableManager;
|
||||
class IContext;
|
||||
class VCSManager;
|
||||
@@ -81,14 +81,14 @@ public:
|
||||
virtual void showOptionsDialog(const QString &group = QString(),
|
||||
const QString &page = QString()) = 0;
|
||||
|
||||
virtual ActionManagerInterface *actionManager() const = 0;
|
||||
virtual ActionManager *actionManager() const = 0;
|
||||
virtual FileManager *fileManager() const = 0;
|
||||
virtual UniqueIDManager *uniqueIDManager() const = 0;
|
||||
virtual MessageManager *messageManager() const = 0;
|
||||
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
|
||||
virtual EditorManager *editorManager() const = 0;
|
||||
virtual ProgressManagerInterface *progressManager() const = 0;
|
||||
virtual ScriptManagerInterface *scriptManager() const = 0;
|
||||
virtual ProgressManager *progressManager() const = 0;
|
||||
virtual ScriptManager *scriptManager() const = 0;
|
||||
virtual VariableManager *variableManager() const = 0;
|
||||
virtual VCSManager *vcsManager() const = 0;
|
||||
virtual ModeManager *modeManager() const = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user