Commit 87a253b3 authored by dt's avatar dt
Browse files

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

parents 4e0c418f 9ba5a81e
......@@ -1364,6 +1364,7 @@
Since Qt Creator 1.1, support for \c CMake project files is available.
\section1 Opening CMake Projects
To open a \c CMake project select \gui Open from the \gui File menu and
......@@ -1389,18 +1390,18 @@
depending on your platform. The build errors and warnings are parsed and
displayed in the \gui{Build Issues} output pane.
By default Qt Creator builds the "all" target. You can change which
targets get build in the Project/Build Settings.
By default Qt Creator builds the \e{all} target. You can specify which
targets to build in \gui{Project} mode, under \gui{Build Settings}.
\image qtcreator-cmake-build-settings.png
Currently only one build configuration is supported and the
build directory can't be changed after the initial import. This
limitation will be fixed for the next version.
Qt Creator supports multiple build configurations. Also, the build
directory can be modified after the initial import.
\section1 Running CMake Projects
Qt Creator automatically adds Run Configurations for all the
targets specified in the \c CMake project file.
Qt Creator automatically adds \gui{Run Configurations} for all targets
specified in the \c CMake project file.
Known issues for the current version can be found
\l{Known Issues of Version 1.1.80}{here}.
......
......@@ -51,63 +51,98 @@ using namespace Core::Internal;
\brief The ActionContainer class represents a menu or menu bar in Qt Creator.
*/
/*!
\enum ActionContainer::ContainerType
You don't create instances of this class directly, but instead use the
\l{ActionManager::createMenu()}
and \l{ActionManager::createMenuBar()} methods.
Retrieve existing action containers for an ID with
\l{ActionManager::actionContainer()}.
Within a menu or menu bar you can group menus and items together by defining groups
(the order of the groups is defined by the order of the \l{ActionContainer::appendGroup()} calls), and
adding menus/actions to these groups. If no custom groups are defined, an action container
has three default groups \c{Core::Constants::G_DEFAULT_ONE}, \c{Core::Constants::G_DEFAULT_TWO}
and \c{Core::Constants::G_DEFAULT_THREE}.
You can define if the menu represented by this action container should automatically disable
or hide whenever it only contains disabled items and submenus by setting the corresponding
\l{ActionContainer::setEmptyAction()}{EmptyAction}.
*/
/*!
\enum ActionContainer::EmptyAction
Defines what happens when the represented menu is empty or contains only disabled/invisible items.
\omitvalue EA_Mask
\value EA_None
The menu will still be visible and active.
\value EA_Disable
The menu will be visible but disabled.
\value EA_Hide
The menu will not be visible until the state of the subitems change.
*/
/*!
\fn virtual ActionContainer::setEmptyAction(EmptyAction ea)
*/
/*!
\fn virtual int ActionContainer::id() const
\fn ActionContainer::setEmptyAction(EmptyAction disableOrHide)
Defines if the menu represented by this action container should automatically \a disableOrHide
whenever it only contains disabled items and submenus.
\sa ActionContainer::EmptyAction
*/
/*!
\fn virtual ContainerType ActionContainer::type() const
*/
/*!
\fn virtual QMenu *ActionContainer::menu() const
\fn int ActionContainer::id() const
\internal
*/
/*!
\fn virtual QToolBar *ActionContainer::toolBar() const
\fn QMenu *ActionContainer::menu() const
Returns the QMenu instance that is represented by this action container, or
0 if this action container represents a menu bar.
*/
/*!
\fn virtual QMenuBar *ActionContainer::menuBar() const
\fn QMenuBar *ActionContainer::menuBar() const
Returns the QMenuBar instance that is represented by this action container, or
0 if this action container represents a menu.
*/
/*!
\fn virtual QAction *ActionContainer::insertLocation(const QString &group) const
\fn QAction *ActionContainer::insertLocation(const QString &group) const
Returns an action representing the \a group,
that could be used with \c{QWidget::insertAction}.
*/
/*!
\fn virtual void ActionContainer::appendGroup(const QString &group, bool global)
\fn void ActionContainer::appendGroup(const QString &identifier)
Adds a group with the given \a identifier to the action container. Using groups
you can segment your action container into logical parts and add actions and
menus directly to these parts.
\sa addAction()
\sa addMenu()
*/
/*!
\fn virtual void ActionContainer::addAction(Core::Command *action, const QString &group)
\fn void ActionContainer::addAction(Core::Command *action, const QString &group)
Add the \a action as a menu item to this action container. The action is added as the
last item of the specified \a group.
\sa appendGroup()
\sa addMenu()
*/
/*!
\fn virtual void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
\fn void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
Add the \a menu as a submenu to this action container. The menu is added as the
last item of the specified \a group.
\sa appendGroup()
\sa addAction()
*/
/*!
\fn virtual bool ActionContainer::update()
\fn bool ActionContainer::update()
\internal
*/
/*!
\fn virtual ActionContainer::~ActionContainer()
\fn ActionContainer::~ActionContainer()
\internal
*/
// ---------- ActionContainerPrivate ------------
......
......@@ -64,16 +64,32 @@ namespace {
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)
\section1 Contexts
All actions that are registered with the same string ID (but different context lists)
are considered to be overloads of the same command, represented by an instance
of the Command class.
Exactly only one of the registered actions with the same ID is active at any time.
Which action this is, is defined by the context list that the actions were registered
with:
If the current focus widget was registered via \l{ICore::addContextObject()},
all the contexts returned by its IContext object are active. In addition all
contexts set via \l{ICore::addAdditionalContext()} are active as well. If one
of the actions was registered for one of these active contexts, it is the one
active action, and receives \c triggered and \c toggled signals. Also the
appearance of the visible action for this ID might be adapted to this
active action (depending on the settings of the corresponding \l{Command} object).
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.
So to register a globally active action "My Action"
\section1 Registering Actions
To register a globally active action "My Action"
put the following in your plugin's IPlugin::initialize method:
\code
Core::ActionManager *am = Core::ICore::instance()->actionManager();
......@@ -96,7 +112,7 @@ namespace {
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
registerAction methods, get the action container for a specific ID (like specified in
the Core::Constants namespace) with a call of
actionContainer(const QString&) and add your command to this container.
......@@ -105,15 +121,15 @@ namespace {
am->actionContainer(Core::M_TOOLS)->addAction(cmd);
\endcode
Important guidelines:
\section1 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
\o Register your actions and shortcuts during your plugin's \l{ExtensionSystem::IPlugin::initialize()}
or \l{ExtensionSystem::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 When registering an action with \c{cmd=registerAction(action, id, contexts)} be sure to connect
your own action \c{connect(action, SIGNAL...)} but make \c{cmd->action()} visible to the user, i.e.
\c{widget->addAction(cmd->action())}.
\o Use this class to add actions to the applications menus
\endlist
......
......@@ -37,9 +37,8 @@
\class Core::Command
\mainclass
\brief The class...
\brief The class Command represents an action like a menu item, tool button, or shortcut.
The Command interface...
*/
/*!
......
......@@ -130,6 +130,7 @@ const char * const SAVEASDEFAULT = "QtCreator.SaveAsDefaultLayout";
const char * const RESTOREDEFAULT = "QtCreator.RestoreDefaultLayout";
const char * const CLOSE = "QtCreator.Close";
const char * const CLOSEALL = "QtCreator.CloseAll";
const char * const CLOSEOTHERS = "QtCreator.CloseOthers";
const char * const GOTONEXT = "QtCreator.GotoNext";
const char * const GOTOPREV = "QtCreator.GotoPrevious";
const char * const GOTONEXTINHISTORY = "QtCreator.GotoNextInHistory";
......
......@@ -149,6 +149,7 @@ struct EditorManagerPrivate {
QAction *m_saveAsAction;
QAction *m_closeCurrentEditorAction;
QAction *m_closeAllEditorsAction;
QAction *m_closeOtherEditorsAction;
QAction *m_gotoNextDocHistoryAction;
QAction *m_gotoPreviousDocHistoryAction;
QAction *m_goBackAction;
......@@ -187,6 +188,7 @@ EditorManagerPrivate::EditorManagerPrivate(ICore *core, QWidget *parent) :
m_saveAsAction(new QAction(parent)),
m_closeCurrentEditorAction(new QAction(EditorManager::tr("Close"), parent)),
m_closeAllEditorsAction(new QAction(EditorManager::tr("Close All"), parent)),
m_closeOtherEditorsAction(new QAction(EditorManager::tr("Close Others"), parent)),
m_gotoNextDocHistoryAction(new QAction(EditorManager::tr("Next Document in History"), parent)),
m_gotoPreviousDocHistoryAction(new QAction(EditorManager::tr("Previous Document in History"), parent)),
m_goBackAction(new QAction(EditorManager::tr("Go back"), parent)),
......@@ -292,6 +294,12 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
connect(m_d->m_closeAllEditorsAction, SIGNAL(triggered()), this, SLOT(closeAllEditors()));
//Close All Others Action
cmd = am->registerAction(m_d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext);
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd->setAttribute(Core::Command::CA_UpdateText);
connect(m_d->m_closeOtherEditorsAction, SIGNAL(triggered()), this, SLOT(closeOtherEditors()));
// Goto Previous In History Action
cmd = am->registerAction(m_d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editManagerContext);
#ifdef Q_WS_MAC
......@@ -648,6 +656,16 @@ bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
return closeEditors(openedEditors(), askAboutModifiedEditors);
}
void EditorManager::closeOtherEditors()
{
IEditor *current = currentEditor();
QTC_ASSERT(current, return);
m_d->m_editorModel->removeAllRestoredEditors();
QList<IEditor*> editors = openedEditors();
editors.removeAll(current);
closeEditors(editors, true);
}
bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askAboutModifiedEditors)
{
if (editorsToClose.isEmpty())
......@@ -1331,7 +1349,7 @@ void EditorManager::updateActions()
{
QString fName;
IEditor *curEditor = currentEditor();
int openedCount = openedEditors().count();
int openedCount = openedEditors().count() + m_d->m_editorModel->restoredEditorCount();
if (curEditor) {
if (!curEditor->file()->fileName().isEmpty()) {
QFileInfo fi(curEditor->file()->fileName());
......@@ -1367,6 +1385,8 @@ void EditorManager::updateActions()
m_d->m_closeCurrentEditorAction->setEnabled(curEditor != 0);
m_d->m_closeCurrentEditorAction->setText(tr("Close %1").arg(quotedName));
m_d->m_closeAllEditorsAction->setEnabled(openedCount > 0);
m_d->m_closeOtherEditorsAction->setEnabled(openedCount > 1);
m_d->m_closeOtherEditorsAction->setText((openedCount > 1 ? tr("Close All Except %1").arg(quotedName) : tr("Close Others")));
m_d->m_gotoNextDocHistoryAction->setEnabled(m_d->m_editorHistory.count() > 0);
m_d->m_gotoPreviousDocHistoryAction->setEnabled(m_d->m_editorHistory.count() > 0);
......
......@@ -198,6 +198,7 @@ private slots:
bool saveFile(Core::IEditor *editor = 0);
bool saveFileAs(Core::IEditor *editor = 0);
void closeEditor();
void closeOtherEditors();
void gotoNextDocHistory();
void gotoPreviousDocHistory();
......
......@@ -205,6 +205,17 @@ void EditorModel::removeAllRestoredEditors()
}
}
int EditorModel::restoredEditorCount() const
{
int count = 0;
for (int i = m_editors.count()-1; i >= 0; --i) {
if (!m_editors.at(i).editor) {
++count;
}
}
return count;
}
bool EditorModel::isDuplicate(IEditor *editor) const
{
return m_duplicateEditors.contains(editor);
......
......@@ -89,6 +89,7 @@ public:
void removeEditor(const QModelIndex &index);
void removeAllRestoredEditors();
int restoredEditorCount() const;
void emitDataChanged(IEditor *editor);
QList<IEditor *> editors() const;
......
......@@ -31,6 +31,7 @@
#define GENERALSETTINGS_H
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QPointer>
#include <QtGui/QWidget>
namespace Core {
......@@ -65,7 +66,7 @@ private slots:
private:
Ui::GeneralSettings *m_page;
QWidget *m_dialog;
QPointer<QWidget> m_dialog;
};
} // namespace Internal
......
......@@ -23,4 +23,4 @@ SOURCES += cppplugin.cpp \
cppclasswizard.cpp
RESOURCES += cppeditor.qrc
OTHER_FILES += CppEditor.pluginspec
OTHER_FILES += CppEditor.pluginspec CppEditor.mimetypes.xml
......@@ -41,6 +41,7 @@ const char * const TASK_INDEX = "CppTools.Task.Index";
const char * const C_SOURCE_MIMETYPE = "text/x-csrc";
const char * const C_HEADER_MIMETYPE = "text/x-chdr";
const char * const CPP_SOURCE_MIMETYPE = "text/x-c++src";
const char * const OBJECTIVE_CPP_SOURCE_MIMETYPE = "text/x-objcsrc";
const char * const CPP_HEADER_MIMETYPE = "text/x-c++hdr";
// QSettings keys for use by the "New Class" wizards.
......
......@@ -185,6 +185,7 @@ enum FileType {
HeaderFile,
C_SourceFile,
CPP_SourceFile,
ObjectiveCPP_SourceFile,
UnknownType
};
......@@ -198,6 +199,8 @@ static inline FileType fileType(const Core::MimeDatabase *mimeDatase, const QFi
return C_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))
return CPP_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE))
return ObjectiveCPP_SourceFile;
if (typeName == QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE)
|| typeName == QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))
return HeaderFile;
......@@ -212,11 +215,13 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas
case UnknownType:
break;
case HeaderFile: // Note that C/C++ headers are undistinguishable
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE)).suffixes() +
mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes();
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE)).suffixes()
+ mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)).suffixes()
+ mimeDatase->findByType(QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE)).suffixes();
case C_SourceFile:
return mimeDatase->findByType(QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE)).suffixes();
case CPP_SourceFile:
case ObjectiveCPP_SourceFile:
return mimeDatase->findByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)).suffixes();
}
return QStringList();
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>866</height>
<width>310</width>
<height>224</height>
</rect>
</property>
<property name="windowTitle">
......@@ -22,58 +22,35 @@
</property>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="pidLabel">
<widget class="QLabel" name="channelLabel">
<property name="text">
<string>Attach to Process ID:</string>
<string>Host and Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pidLineEdit"/>
<widget class="QLineEdit" name="channelLineEdit">
<property name="text">
<string>localhost:5115</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="architectureLabel">
<property name="text">
<string>Filter:</string>
<string>Architecture:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="filterWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="filterLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="filterClearToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QComboBox" name="architectureComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="procView">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
......
......@@ -51,7 +51,7 @@
namespace Debugger {
namespace Internal {
namespace Internal {
bool operator<(const ProcData &p1, const ProcData &p2)
{
......@@ -59,7 +59,8 @@ bool operator<(const ProcData &p1, const ProcData &p2)
}
// A filterable process list model
class ProcessListFilterModel : public QSortFilterProxyModel {
class ProcessListFilterModel : public QSortFilterProxyModel
{
public:
explicit ProcessListFilterModel(QObject *parent);
QString processIdAt(const QModelIndex &index) const;
......@@ -69,9 +70,9 @@ private:
QStandardItemModel *m_model;
};
ProcessListFilterModel::ProcessListFilterModel(QObject *parent) :
QSortFilterProxyModel(parent),
m_model(new QStandardItemModel(this))
ProcessListFilterModel::ProcessListFilterModel(QObject *parent)
: QSortFilterProxyModel(parent),
m_model(new QStandardItemModel(this))
{
QStringList columns;
columns << AttachExternalDialog::tr("Process ID")
......@@ -116,6 +117,7 @@ void ProcessListFilterModel::populate(QList<ProcData> processes, const QString &
}
}
///////////////////////////////////////////////////////////////////////
//
// AttachCoreDialog
......@@ -164,9 +166,10 @@ void AttachCoreDialog::setCoreFile(const QString &fileName)
m_ui->coreFileName->setPath(fileName);
}
///////////////////////////////////////////////////////////////////////
//
// process model helpers
// Process model helpers
//
///////////////////////////////////////////////////////////////////////
......@@ -224,11 +227,11 @@ static QList<ProcData> processList()
//
///////////////////////////////////////////////////////////////////////
AttachExternalDialog::AttachExternalDialog(QWidget *parent) :
QDialog(parent),
m_selfPid(QString::number(QCoreApplication::applicationPid())),
m_ui(new Ui::AttachExternalDialog),
m_model(new ProcessListFilterModel(this))
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
: QDialog(parent),
m_selfPid(QString::number(QCoreApplication::applicationPid())),
m_ui(new Ui::AttachExternalDialog),
m_model(new ProcessListFilterModel(this))
{
m_ui->setupUi(this);
okButton()->setDefault(true);
......@@ -292,48 +295,26 @@ int AttachExternalDialog::attachPID() const
void AttachExternalDialog::pidChanged(const QString &pid)
{
okButton()->setEnabled(!pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid);
bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid;;
okButton()->setEnabled(enabled);
}
///////////////////////////////////////////////////////////////////////
//
// AttachRemoteDialog
//
///////////////////////////////////////////////////////////////////////
AttachRemoteDialog::AttachRemoteDialog(QWidget *parent, const QString &pid) :
QDialog(parent),
m_ui(new Ui::AttachRemoteDialog),
m_model(new ProcessListFilterModel(this))
AttachRemoteDialog::AttachRemoteDialog(QWidget *parent)
: QDialog(parent),
m_ui(new Ui::AttachRemoteDialog)
{
m_ui->setupUi(this);
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_defaultPID = pid;
m_ui->procView->setModel(m_model);
m_ui->procView->setSortingEnabled(true);
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
// Do not use activated, will be single click in Oxygen
connect(m_ui->procView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(procSelected(QModelIndex)));
QPushButton *refreshButton = new QPushButton(tr("Refresh"));
connect(refreshButton, SIGNAL(clicked()), this, SLOT(rebuildProcessList()));
m_ui->buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole);
connect(m_ui->pidLineEdit,