Commit 73f9b175 authored by Kavindra Palaraja's avatar Kavindra Palaraja
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 7b42be96 653b8142
......@@ -751,6 +751,9 @@ bool Parser::parseCvQualifiers(SpecifierAST *&node)
spec->specifier_token = consumeToken();
*ast = spec;
ast = &(*ast)->next;
} else if(LA() == T___ATTRIBUTE__) {
parseAttributeSpecifier(*ast);
ast = &(*ast)->next;
} else {
break;
}
......
......@@ -34,7 +34,6 @@
#ifndef INTERFACE_WRAP_HELPERS_H
#define INTERFACE_WRAP_HELPERS_H
#include <extensionsystem/ExtensionSystemInterfaces>
#include <QtScript/QScriptEngine>
namespace SharedTools {
......
/***************************************************************************
**
** 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 "extensionsystem/pluginmanager.h"
#include "extensionsystem/pluginspec.h"
#include "extensionsystem/iplugin.h"
#include "extensionsystem/pluginview.h"
#include "extensionsystem/pluginerrorview.h"
#include "extensionsystem/plugindetailsview.h"
......@@ -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*)
......
......@@ -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")));
......
......@@ -31,10 +31,10 @@
**
***************************************************************************/
#include "actioncontainer.h"
#include "actioncontainer_p.h"
#include "actionmanager_p.h"
#include "command.h"
#include "command_p.h"
#include "coreimpl.h"
#include "coreconstants.h"
......@@ -51,143 +51,111 @@ using namespace Core;
using namespace Core::Internal;
/*!
\class IActionContainer
\class ActionContainer
\mainclass
\ingroup qwb
\inheaderfile iactioncontainer.h
\brief The class...
\brief The ActionContainer class represents a menu or menu bar in Qt Creator.
The Action Container interface...
*/
/*!
\enum IActionContainer::ContainerType
\enum ActionContainer::ContainerType
*/
/*!
\enum IActionContainer::EmptyAction
\enum ActionContainer::EmptyAction
*/
/*!
\fn virtual IActionContainer::setEmptyAction(EmptyAction ea)
\fn virtual ActionContainer::setEmptyAction(EmptyAction ea)
*/
/*!
\fn virtual int IActionContainer::id() const
\fn virtual int ActionContainer::id() const
*/
/*!
\fn virtual ContainerType IActionContainer::type() const
\fn virtual ContainerType ActionContainer::type() const
*/
/*!
\fn virtual QMenu *IActionContainer::menu() const
\fn virtual QMenu *ActionContainer::menu() const
*/
/*!
\fn virtual QToolBar *IActionContainer::toolBar() const
\fn virtual QToolBar *ActionContainer::toolBar() const
*/
/*!
\fn virtual QMenuBar *IActionContainer::menuBar() const
\fn virtual QMenuBar *ActionContainer::menuBar() const
*/
/*!
\fn virtual QAction *IActionContainer::insertLocation(const QString &group) const
\fn virtual QAction *ActionContainer::insertLocation(const QString &group) const
*/
/*!
\fn virtual void IActionContainer::appendGroup(const QString &group, bool global)
\fn virtual void ActionContainer::appendGroup(const QString &group, bool global)
*/
/*!
\fn virtual void IActionContainer::addAction(Core::ICommand *action, const QString &group)
\fn virtual void ActionContainer::addAction(Core::Command *action, const QString &group)
*/
/*!
\fn virtual void IActionContainer::addMenu(Core::IActionContainer *menu, const QString &group)
\fn virtual void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
*/
/*!
\fn virtual bool IActionContainer::update()
\fn virtual bool ActionContainer::update()
*/
/*!
\fn virtual IActionContainer::~IActionContainer()
\fn virtual ActionContainer::~ActionContainer()
*/
// ---------- ActionContainer ------------
/*!
\class ActionContainer
\ingroup qwb
\inheaderfile actioncontainer.h
*/
// ---------- ActionContainerPrivate ------------
/*!
\enum ActionContainer::ContainerState
\class Core::Internal::ActionContainerPrivate
\internal
*/
/*!
\fn ActionContainer::ActionContainer(ContainerType type, int id)
*/
ActionContainer::ActionContainer(ContainerType type, int id)
: m_data(CS_None), m_type(type), m_id(id)
ActionContainerPrivate::ActionContainerPrivate(int id)
: m_data(CS_None), m_id(id)
{
}
/*!
\fn virtual ActionContainer::~ActionContainer()
*/
/*!
...
*/
void ActionContainer::setEmptyAction(EmptyAction ea)
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)
void ActionContainerPrivate::appendGroup(const QString &group)
{
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
int gid = idmanager->uniqueIdentifier(group);
m_groups << gid;
}
/*!
...
*/
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;
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;
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
{
return 0;
}
/*!
...
*/
QToolBar *ActionContainer::toolBar() const
QMenu *ActionContainerPrivate::menu() const
{
return 0;
}
/*!
...
*/
QMenuBar *ActionContainer::menuBar() const
QMenuBar *ActionContainerPrivate::menuBar() const
{
return 0;
}
/*!
...
*/
bool ActionContainer::canAddAction(ICommand *action) const
{
if (action->type() != ICommand::CT_OverridableAction)
return false;
Command *cmd = static_cast<Command *>(action);
if (cmd->stateFlags() & Command::CS_Initialized)
return false;
return true;
}
/*!
...
*/
bool ActionContainer::canAddMenu(IActionContainer *menu) const
bool ActionContainerPrivate::canAddAction(Command *action) const
{
if (menu->type() != IActionContainer::CT_Menu)
if (action->type() != Command::CT_OverridableAction)
return false;
ActionContainer *container = static_cast<ActionContainer *>(menu);
if (container->hasState(ActionContainer::CS_Initialized))
CommandPrivate *cmd = static_cast<CommandPrivate *>(action);
if (cmd->stateFlags() & CommandPrivate::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,11 +288,7 @@ 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
{
ActionManagerPrivate *am = ActionManagerPrivate::instance();
......@@ -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
*/
/*!