Commit ca7193d6 authored by dt's avatar dt
Browse files

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

parents 0cf9ffc0 6b86542a
......@@ -49,7 +49,9 @@
\list
\o \l{A Quick Tour of Qt Creator}
\o \l{Creating a Project in Qt Creator}
\o \l{The Code Editor}
\o \l{Build Settings}
\o \l{Qt Version Management}
\o \l{Writing a Simple Program with Qt Creator}
\o \l{Navigating Quickly Around Your Code with Locator}
\o \l{Debugging with Qt Creator}
......@@ -206,10 +208,67 @@
are available to help speed up the process of developing your application.
*/
/*! \contentspage index.html
\previouspage creator-quick-tour.html
\page creator-code-editor.html
\nextpage creator-build-settings.html
\title The Code Editor
### SCREENSHOT of the editor in action
\table
\row
\i Block navigation
\i To navigate between blocks, e.g., from one \c{\{} to another
\c{\c}}, use \key{Ctrl+[} and \key{Ctrl+]}.
\row
\i Block selection
\i To select a current block, use \key{Ctrl+U}. Pressing
\key{Ctrl+U} again extends the selection to the parent block.
To deselect, use \key{Ctrl+Shift+U}.
\row
\i Moving lines up and down
\i
\row
\i Completion
\i
\row
\i Indenting
\i
\row
\i Commenting or Uncommenting
\i
\endtable
More:
Collapse
Up/Down/Page Up/Page Down - hold ctrl to prevent the cursor from moving
F2 and Shift F2 - follows symbols under the cursor (works for namespaces, classes, methods, variables, includes, macros).
F4 - switch header and source
Ctrl + Scroll wheel -- used to quickly change the font size (handy for presentatiaons)
To switch to an external editor, select \gui{Open in external editor} from
the \gui{Edit -> Advanced} menu.
*/
/*!
\contentspage index.html
\previouspage creator-quick-tour.html
\previouspage creator-editor-settings.html
\page creator-build-settings.html
\nextpage creator-creating-project.html
......@@ -266,8 +325,15 @@
remove the build step. You will still be able to debug applications, but the
contents of Qt and STL data types will not be displayed properly.
*/
/*!
\contentspage index.html
\previouspage creator-build-settings.html
\page creator-version-management.html
\nextpage creator-creating-project.html
\section1 Qt Version Management
\title Qt Version Management
Qt Creator allows you to use multiple versions of Qt installed on your hard
disk and switch between them easily.
......
......@@ -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,112 +51,111 @@ using namespace Core;
using namespace Core::Internal;
/*!
\class IActionContainer
\class ActionContainer
\mainclass
\inheaderfile iactioncontainer.h
\brief The IActionContainer class represents a menu or menu bar in Qt Creator.
\brief The ActionContainer class represents a menu or menu bar in Qt Creator.
*/
/*!
\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 ------------
// ---------- ActionContainerPrivate ------------
/*!
\class Core::Internal::ActionContainer
\class Core::Internal::ActionContainerPrivate
\internal
*/
ActionContainer::ActionContainer(int id)
ActionContainerPrivate::ActionContainerPrivate(int id)
: m_data(CS_None), m_id(id)
{
}
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);
......@@ -165,22 +164,22 @@ QAction *ActionContainer::insertLocation(const QString &group) const
return beforeAction(pos, &prevKey);
}
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);
......@@ -193,21 +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)
{
ActionContainer *container = static_cast<ActionContainer *>(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);
......@@ -220,34 +219,34 @@ void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
}
}
int ActionContainer::id() const
int ActionContainerPrivate::id() const
{
return m_id;
}
QMenu *ActionContainer::menu() const
QMenu *ActionContainerPrivate::menu() const
{
return 0;
}
QMenuBar *ActionContainer::menuBar() const
QMenuBar *ActionContainerPrivate::menuBar() const
{
return 0;
}
bool ActionContainer::canAddAction(ICommand *action) const
bool ActionContainerPrivate::canAddAction(Command *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;
}
void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
void ActionContainerPrivate::addAction(Command *action, int pos, bool setpos)
{
Action *a = static_cast<Action *>(action);
......@@ -269,7 +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);
......@@ -289,7 +288,7 @@ void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
insertMenu(ba, mc->menu());
}
QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
QAction *ActionContainerPrivate::beforeAction(int pos, int *prevKey) const
{
ActionManagerPrivate *am = ActionManagerPrivate::instance();
......@@ -310,16 +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;
}
int ActionContainer::calcPosition(int pos, int prevKey) const
int ActionContainerPrivate::calcPosition(int pos, int prevKey) const
{
int grp = (pos & 0xFFFF0000);
if (prevKey == -1)
......@@ -341,7 +340,7 @@ int ActionContainer::calcPosition(int pos, int prevKey) const
*/
MenuActionContainer::MenuActionContainer(int id)
: ActionContainer(id), m_menu(0)
: ActionContainerPrivate(id), m_menu(0)
{
setEmptyAction(EA_Disable);
}
......@@ -388,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;
......@@ -399,7 +398,7 @@ bool MenuActionContainer::update()
}
}
if (!hasitems) {
foreach (ICommand *command, commands()) {
foreach (Command *command, commands()) {
if (command->isActive()) {
hasitems = true;
break;
......@@ -417,7 +416,7 @@ bool MenuActionContainer::update()
bool MenuActionContainer::canBeAddedToMenu() const
{
if (hasState(ActionContainer::CS_Initialized))
if (hasState(ActionContainerPrivate::CS_Initialized))
return false;
return true;
......@@ -432,7 +431,7 @@ bool MenuActionContainer::canBeAddedToMenu() const
*/
MenuBarActionContainer::MenuBarActionContainer(int id)
: ActionContainer(id), m_menuBar(0)
: ActionContainerPrivate(id), m_menuBar(0)
{
setEmptyAction(EA_None);
}
......
......@@ -34,109 +34,42 @@
#ifndef ACTIONCONTAINER_H
#define ACTIONCONTAINER_H
#include "actionmanager_p.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
{
public:
enum ContainerState {
CS_None = 0x000000,
CS_Initialized = 0x010000,
CS_PreLocation = 0x020000,
CS_UserDefined = 0x040000
};
ActionContainer(int id);
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);
void addAction(ICommand *action, const QString &group = QString());
void addMenu(IActionContainer *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<ICommand *> commands() const { return m_commands; }
QList<IActionContainer *> subContainers() const { return m_subContainers; }
protected:
bool canAddAction(ICommand *action) const;
bool canAddMenu(IActionContainer *menu) const;
virtual bool canBeAddedToMenu() const = 0;
class Command;
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;
int m_id;
QMap<int, int> m_posmap;
QList<IActionContainer *> m_subContainers;
QList<ICommand *> m_commands;
};
class MenuActionContainer : public ActionContainer
class ActionContainer : public QObject
{
public:
MenuActionContainer(int id);