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

Conflicts:
	src/plugins/perforce/perforceplugin.cpp
This commit is contained in:
mae
2009-01-20 17:10:34 +01:00
252 changed files with 3267 additions and 3035 deletions

View File

@@ -9,7 +9,11 @@ unix {
QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp
QCH_FILE = $$OUT_PWD/doc/qtcreator.qch QCH_FILE = $$OUT_PWD/doc/qtcreator.qch
html_docs.commands =$$QDOC $$PWD/qtcreator.qdocconf unix {
html_docs.commands = $$QDOC $$PWD/qtcreator.qdocconf
} else {
html_docs.commands = \"$$QDOC $$PWD/qtcreator.qdocconf\"
}
html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf
html_docs.files = $$QHP_FILE html_docs.files = $$QHP_FILE

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

BIN
doc/qtcreator-vcs-diff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
doc/qtcreator-vcs-log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
doc/qtcreator-vcs-pane.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -49,8 +49,11 @@
\list \list
\o \l{A Quick Tour of Qt Creator} \o \l{A Quick Tour of Qt Creator}
\o \l{Creating a Project in Qt Creator} \o \l{Creating a Project in Qt Creator}
\o \l{The Code Editor}
\o \l{Build Settings} \o \l{Build Settings}
\o \l{Qt Version Management}
\o \l{Writing a Simple Program with Qt Creator} \o \l{Writing a Simple Program with Qt Creator}
\o \l{Qt Creator and Version Control Systems}
\o \l{Navigating Quickly Around Your Code with Locator} \o \l{Navigating Quickly Around Your Code with Locator}
\o \l{Debugging with Qt Creator} \o \l{Debugging with Qt Creator}
\o \l{Tips and Tricks} \o \l{Tips and Tricks}
@@ -154,21 +157,20 @@
\section1 Session Management in Qt Creator \section1 Session Management in Qt Creator
### screenshot
In Qt Creator, a session is a collection of loaded projects, opened files, In Qt Creator, a session is a collection of loaded projects, opened files,
editor settings, and so on. When you run Qt Creator, you have a default editor settings, and so on. When you run Qt Creator, you have a default
session. You can create a new session using the \gui{Session Manager...}, session. You can create a new session using the \gui{Session Manager...},
available in the \gui{File -> Session} menu. available in the \gui{File -> Session} menu.
\image qtcreator-session-manager.png
To switch between sessions, select \gui{File -> Session}. If you do not To switch between sessions, select \gui{File -> Session}. If you do not
create and select any session, Qt Creator will always use the default create and select any session, Qt Creator will always use the default
session. session.
\omit \image qtcreator-session-menu.png
session management can also store project dependencies, thorbjorn is
currently working on it
\endomit
\section1 Qt Help Integration \section1 Qt Help Integration
@@ -206,10 +208,74 @@
are available to help speed up the process of developing your application. 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 \bold{\{} to another
\bold{\}} , 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 Blocks
\i
\row
\i Commenting or Uncommenting Blocks
\i
\row
\i Switch between Header and Source
\i Use \key{F4}.
\row
\i Increasing and Decreasing Font Size
\i Use \key{Ctrl+Scroll Wheel}
\row
\i Follow Symbols under The Cursor
\i Use \key{F2} and \key{Shift+F2}. This feature works with
namespaces, classes, methods, variables, include statements,
and macros.
\endtable
More:
Collapse
Up/Down/Page Up/Page Down - hold ctrl to prevent the cursor from moving
To switch to an external editor, select \gui{Open in external editor} from
the \gui{Edit -> Advanced} menu.
*/
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-quick-tour.html \previouspage creator-code-editor.html
\page creator-build-settings.html \page creator-build-settings.html
\nextpage creator-creating-project.html \nextpage creator-creating-project.html
@@ -266,8 +332,23 @@
remove the build step. You will still be able to debug applications, but the 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. contents of Qt and STL data types will not be displayed properly.
\section1 Dependencies
\section1 Qt Version Management If you have multiple projects loaded in your session, you can configure
dependencies between them. This will affect the build order of your
projects. To do this, go the the \bold{Dependencies} tab after selecting
the project for which you want to configure the dependencies, and then use
the checkboxes to check which of the other projects is a dependency.
*/
/*!
\contentspage index.html
\previouspage creator-build-settings.html
\page creator-version-management.html
\nextpage creator-creating-project.html
\title Qt Version Management
Qt Creator allows you to use multiple versions of Qt installed on your hard Qt Creator allows you to use multiple versions of Qt installed on your hard
disk and switch between them easily. disk and switch between them easily.
@@ -692,6 +773,136 @@
*/ */
/*!
\contentspage index.html
\previouspage creator-navigation.html
\page creator-version-control.html
\nextpage creator-debugging.html
\title Qt Creator and Version Control Systems
\table
\caption Version control systems supported by Qt Creator
\row
\i \bold{git}
\i \l{http://git-scm.com/}
\row
\i \bold{Subversion}
\i \l{http://subversion.tigris.org/}
\row
\i \bold{Perforce}
\i \l{http://www.perforce.com}
\endtable
\section1 Setup
Qt Creator uses the version control system's command line clients to
access your repositories. To set it up, you must ensure that these command
line clients can be located via the \c{PATH} environment variable. You can
specify the path to the command line client's executable in the settings
pages that can be found under \gui{Options...} in the \gui{Tools} menu.
\section1 Usage
You can find the version control menu entires in a sub-menu of the
\gui{Tools} menu. The version control system displayed here is the system
that manages the current project.
Each version control system adds a pane to the \gui{Application Output}
panes within which it will log the commands it executes, prepended by a
timestamp and the relevant output.
\image qtcreator-vcs-pane.png
\section2 Addings Files
When you create a new file or a new project, the wizards will display page
requesting whether the files should be added to a version control system.
This depends on whether the parent directory or the project is already
under version control and the system supports the concept of adding files,
e.g., \bold{Perforce} and \bold{Subversion}. Alternatively, you can also
add files later on using the version control tool menus.
With \bold{git}, there is no concept of adding files. Instead, all modified
files must be \e{staged} for a commit.
\section2 Viewing Diff Output
All version control systems provide menu options to \e{diff} the current
file or project - comparing with the latest version stored in the
repository and displaying the differences. In Qt Creator, a diff is
displayed in a read-only editor. If the file is accessible, you can double
-click on a selected diff chunk and Qt Creator will open an editor
displaying the file, scrolled to the line in question.
\image qtcreator-vcs-diff.png
\section2 Viewing Versioning History and Change Details
The versioning history of a file can be displayed by selecting the
\gui{Log} (for \bold{git}) or \gui{Filelog} (for \bold{Perforce} and
\bold{Subversion}) option. Typically, the log output will contain the
date, the commit message, and a change or revision identifier. If you
click on the identifier, a description of the change including the diff
will be displayed.
\image qtcreator-vcs-log.png
\image qtcreator-vcs-describe.png
\section2 Annotating Files
Annotation views are obtained by selecting \gui{Annotate} or \gui{Blame}.
This will display the lines of the file prepended by the change identifier
they originate from. Clicking on the change identifier shows a detailed
description of the file.
\section2 Committing Changes
Once you have finished making changes, you can submit them to the version
control system by choosing \gui{Commit} or \gui{Submit}. Qt Creator will
display a commit page containing a text editor, where you can enter your
commit message, and a checkable list of modified files to be included.
When you are done, click \gui{Commit} to start committing. In addition,
there is a \gui{Diff selected} button that brings up a diff view of the
files selected in the file list. Since the commit page is just another
editor, you can go back to it by closing the diff view. Alternatively, you
can view it from the editor combo box showing the \gui{Opened files}.
\image qtcreator-vcs-commit.png
\section2 Menu Entries Specific to git
The git sub-menu contains additional entries:
\table
\row
\i \gui{Stash}
\i Stash local changes prior to executing a \bold{pull}.
\row
\i \gui{Pull}
\i Pull changes from the remote repository. If there are locally
modified files, you will be prompted to stash those changes.
\row
\i \gui{Branches...}
\i Displays the branch dialog showing the local branches at the
top and remote branches at the bottom. To switch to the local
branch, simply double-click on it. Double-clicking on a remote
branch will first create a local branch with the same name that
tracks the remote branch, and then switch to it.
\image qtcreator-vcs-gitbranch.png
\endtable
*/
/*! /*!
\contentspage index.html \contentspage index.html
@@ -1017,8 +1228,8 @@
\bold{Keyboard Shortcuts} \bold{Keyboard Shortcuts}
Qt Creator provides a lot of useful keyboard shortcuts. A complete list can Qt Creator provides a lot of useful keyboard shortcuts. Some useful
be found \l{Keyboard Shortcuts}{here}. shortcuts can be found \l{Keyboard Shortcuts}{here}.
\bold{Running Qt Creator from the Command Line} \bold{Running Qt Creator from the Command Line}
@@ -1065,25 +1276,41 @@
\o Meaning \o Meaning
\row \row
\o System Qt \target glossary-system-qt \o
\raw HTML
System Qt
\endraw
\target glossary-system-qt
\o The version of Qt installed on your system. This is the Qt \o The version of Qt installed on your system. This is the Qt
version for the \c qmake command found in your \c PATH. version for the \c qmake command found in your \c PATH.
\row \row
\o Default Qt \target glossary-default-qt \o
\raw HTML
Default Qt
\endraw
\target glossary-default-qt
\o The version of Qt configured in \gui{Tools -> Options -> Qt 4 \o The version of Qt configured in \gui{Tools -> Options -> Qt 4
-> Default Qt Version}. This is the Qt version used by your -> Default Qt Version}. This is the Qt version used by your
new projects. It defaults to System Qt. new projects. It defaults to System Qt.
\row \row
\o Project Qt \target glossary-project-qt \o
\raw HTML
Project Qt
\endraw
\target glossary-project-qt
\o The version of Qt configured in \gui{Build&Run -> Build \o The version of Qt configured in \gui{Build&Run -> Build
Settings -> Build Configurations}. This is the Qt version that Settings -> Build Configurations}. This is the Qt version that
is actually used by a particular project. It defaults to is actually used by a particular project. It defaults to
Default Qt. Default Qt.
\row \row
\o Shadow Build \target glossary-shadow-build \o
\raw HTML
Shadow Build
\endraw
\target glossary-shadow-build
\o Shadow building means building a project in a separate \o Shadow building means building a project in a separate
directory, the \e{build directory}. The build directory is directory, the \e{build directory}. The build directory is
different from the source directory. One of the benefits of different from the source directory. One of the benefits of

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
workdir=/home/berlin/dev/qt-4.4.3-temp version=4.4.3
destdir=/home/berlin/dev/qt-4.4.3-shipping workdir=/home/berlin/dev/qt-${version}-temp
dir=qt-x11-opensource-src-4.4.3 destdir=/home/berlin/dev/qt-${version}-shipping
dir=qt-x11-opensource-src-${version}
file_tar="${dir}.tar" file_tar="${dir}.tar"
file_tar_gz="${file_tar}.gz" file_tar_gz="${file_tar}.gz"
[ -z ${MAKE} ] && MAKE=make [ -z ${MAKE} ] && MAKE=make
@@ -44,7 +45,7 @@ download() {
mirror=http://wftp.tu-chemnitz.de/pub/Qt/qt/source mirror=http://wftp.tu-chemnitz.de/pub/Qt/qt/source
;; ;;
esac esac
wget "${mirror}/${file}" || die "Download failed" wget "${mirror}/${file_tar_gz}" || die "Download failed"
} }
unpack() { unpack() {
@@ -55,7 +56,7 @@ unpack() {
build() { build() {
( (
cd "${dir}" cd "${dir}" || die "cd failed"
if [ ! -f config.status ] ; then if [ ! -f config.status ] ; then
env -i PATH=${envpath} ./configure \ env -i PATH=${envpath} ./configure \
-prefix "${destdir}" \ -prefix "${destdir}" \
@@ -75,11 +76,44 @@ build() {
ret=$?; [ ${ret} = 0 ] || exit ${ret} ret=$?; [ ${ret} = 0 ] || exit ${ret}
} }
fix_rpath() {
folder=$1
pattern=$2
rpath=$3
(
cd "${destdir}" || die "cd failed"
while read file ; do
echo "Fixing ${file}"
chrpath -r "${rpath}" "${file}" 2>&1 | sed 's/^/\t/'
done < <(find "${folder}" -type f -name "${pattern}")
)
ret=$?; [ ${ret} = 0 ] || exit ${ret}
}
inst() { inst() {
( (
cd "${dir}" cd "${dir}" || die "cd failed"
if [ ! -d "${destdir}" ]; then
mkdir -p "${destdir}" mkdir -p "${destdir}"
env -i "${MAKE}" install || die "make install failed" env -i "${MAKE}" install || die "make install failed"
fi
cd "${destdir}" || die "cd failed"
# Fix files bin/*
fix_rpath bin '*' '$ORIGIN/../lib'
# Fix files lib/*.so
fix_rpath lib '*.so.?.?.?' '$ORIGIN'
fix_rpath lib '*.so.?.?.?.debug' '$ORIGIN'
# Fix files examples/tools/*/*/*.so
fix_rpath examples/tools '*.so' '$ORIGIN/../../../lib'
fix_rpath examples/tools '*.so.debug' '$ORIGIN/../../../lib'
# Fix files plugins/*/*.so
fix_rpath plugins '*.so' '$ORIGIN/../../lib'
fix_rpath plugins '*.so.debug' '$ORIGIN/../../lib'
) )
ret=$?; [ ${ret} = 0 ] || exit ${ret} ret=$?; [ ${ret} = 0 ] || exit ${ret}
} }

View File

@@ -751,6 +751,9 @@ bool Parser::parseCvQualifiers(SpecifierAST *&node)
spec->specifier_token = consumeToken(); spec->specifier_token = consumeToken();
*ast = spec; *ast = spec;
ast = &(*ast)->next; ast = &(*ast)->next;
} else if(LA() == T___ATTRIBUTE__) {
parseAttributeSpecifier(*ast);
ast = &(*ast)->next;
} else { } else {
break; break;
} }

View File

@@ -34,7 +34,6 @@
#ifndef INTERFACE_WRAP_HELPERS_H #ifndef INTERFACE_WRAP_HELPERS_H
#define INTERFACE_WRAP_HELPERS_H #define INTERFACE_WRAP_HELPERS_H
#include <extensionsystem/ExtensionSystemInterfaces>
#include <QtScript/QScriptEngine> #include <QtScript/QScriptEngine>
namespace SharedTools { namespace SharedTools {

View File

@@ -963,7 +963,21 @@ void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken
} else if (iflevel == 0 && !skipping()) { } else if (iflevel == 0 && !skipping()) {
// std::cerr << "*** WARNING #else without #if" << std::endl; // std::cerr << "*** WARNING #else without #if" << std::endl;
} else if (!_true_test[iflevel] && !_skipping[iflevel - 1]) { } else if (!_true_test[iflevel] && !_skipping[iflevel - 1]) {
const Value result = evalExpression(tk.dot(), lastToken, _source);
const char *first = startOfToken(*tk);
const char *last = startOfToken(*lastToken);
MacroExpander expandCondition (env);
QByteArray condition;
condition.reserve(256);
expandCondition(first, last, &condition);
QVector<Token> tokens = tokenize(condition);
const Value result = evalExpression(tokens.constBegin(),
tokens.constEnd() - 1,
condition);
_true_test[iflevel] = ! result.is_zero (); _true_test[iflevel] = ! result.is_zero ();
_skipping[iflevel] = result.is_zero (); _skipping[iflevel] = result.is_zero ();
} else { } else {

View File

@@ -1,39 +0,0 @@
/***************************************************************************
**
** 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"

View File

@@ -35,22 +35,23 @@
#include "bineditor.h" #include "bineditor.h"
#include "bineditorconstants.h" #include "bineditorconstants.h"
#include <QtCore/QFile>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtCore/QFile>
#include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <find/ifindsupport.h> #include <find/ifindsupport.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
#include <utils/linecolumnlabel.h> #include <utils/linecolumnlabel.h>
#include <utils/reloadpromptutils.h> #include <utils/reloadpromptutils.h>
@@ -204,7 +205,7 @@ public:
break; break;
} }
switch (Core::Utils::reloadPrompt(fileName, BinEditorPlugin::core()->mainWindow())) { switch (Core::Utils::reloadPrompt(fileName, Core::ICore::instance()->mainWindow())) {
case Core::Utils::ReloadCurrent: case Core::Utils::ReloadCurrent:
open(fileName); open(fileName);
break; break;
@@ -230,12 +231,15 @@ class BinEditorInterface : public Core::IEditor
{ {
Q_OBJECT Q_OBJECT
public: public:
BinEditorInterface(BinEditor *parent ) : Core::IEditor(parent) { BinEditorInterface(BinEditor *parent)
: Core::IEditor(parent)
{
Core::ICore *core = Core::ICore::instance();
m_editor = parent; m_editor = parent;
m_file = new BinEditorFile(parent); m_file = new BinEditorFile(parent);
m_context << BinEditorPlugin::core()->uniqueIDManager()-> m_context << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR); uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Core::Utils::LineColumnLabel; m_cursorPositionLabel = new Core::Utils::LineColumnLabel;
QHBoxLayout *l = new QHBoxLayout; QHBoxLayout *l = new QHBoxLayout;
@@ -316,7 +320,8 @@ QString BinEditorFactory::kind() const
Core::IFile *BinEditorFactory::open(const QString &fileName) Core::IFile *BinEditorFactory::open(const QString &fileName)
{ {
Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); Core::ICore *core = Core::ICore::instance();
Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0; return iface ? iface->file() : 0;
} }
@@ -336,8 +341,7 @@ QStringList BinEditorFactory::mimeTypes() const
BinEditorPlugin *BinEditorPlugin::m_instance = 0; BinEditorPlugin *BinEditorPlugin::m_instance = 0;
BinEditorPlugin::BinEditorPlugin() : BinEditorPlugin::BinEditorPlugin()
m_core(0)
{ {
m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0; m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0;
m_instance = this; m_instance = this;
@@ -353,16 +357,11 @@ BinEditorPlugin *BinEditorPlugin::instance()
return m_instance; return m_instance;
} }
Core::ICore *BinEditorPlugin::core()
{
return m_instance->m_core;
}
QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title)
{ {
QAction *result = new QAction(title, this); QAction *result = new QAction(title, this);
m_core->actionManager()->registerAction(result, id, m_context); Core::ICore::instance()->actionManager()->registerAction(result, id, m_context);
return result; return result;
} }
@@ -385,7 +384,8 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed())); QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed()));
editor->setEditorInterface(editorInterface); editor->setEditorInterface(editorInterface);
m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR);
if (!m_undoAction) { if (!m_undoAction) {
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO), m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
this, SLOT(undoAction()), this, SLOT(undoAction()),
@@ -415,13 +415,16 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
aggregate->add(editor); aggregate->add(editor);
} }
bool BinEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage)) Q_UNUSED(errorMessage);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage))
return false; return false;
connect(m_core, SIGNAL(contextAboutToChange(Core::IContext *)), connect(core, SIGNAL(contextAboutToChange(Core::IContext *)),
this, SLOT(updateCurrentEditor(Core::IContext *))); this, SLOT(updateCurrentEditor(Core::IContext *)));
addAutoReleasedObject(new BinEditorFactory(this)); addAutoReleasedObject(new BinEditorFactory(this));

View File

@@ -62,7 +62,6 @@ public:
~BinEditorPlugin(); ~BinEditorPlugin();
static BinEditorPlugin *instance(); static BinEditorPlugin *instance();
static Core::ICore *core();
bool initialize(const QStringList &arguments, QString *error_message = 0); bool initialize(const QStringList &arguments, QString *error_message = 0);
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -37,10 +37,11 @@
#include "bookmarksplugin.h" #include "bookmarksplugin.h"
#include "bookmarks_global.h" #include "bookmarks_global.h"
#include <projectexplorer/ProjectExplorerInterfaces>
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -49,6 +50,7 @@
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QContextMenuEvent> #include <QtGui/QContextMenuEvent>
#include <QtGui/QMenu>
#include <QtGui/QPainter> #include <QtGui/QPainter>
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*) Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
@@ -56,6 +58,7 @@ Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
using namespace Bookmarks; using namespace Bookmarks;
using namespace Bookmarks::Internal; using namespace Bookmarks::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Core;
BookmarkDelegate::BookmarkDelegate(QObject *parent) BookmarkDelegate::BookmarkDelegate(QObject *parent)
: QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0) : QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0)
@@ -212,8 +215,7 @@ BookmarkView::BookmarkView(QWidget *parent)
this, SLOT(gotoBookmark(const QModelIndex &))); this, SLOT(gotoBookmark(const QModelIndex &)));
m_bookmarkContext = new BookmarkContext(this); m_bookmarkContext = new BookmarkContext(this);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore::instance()->addContextObject(m_bookmarkContext);
core->addContextObject(m_bookmarkContext);
setItemDelegate(new BookmarkDelegate(this)); setItemDelegate(new BookmarkDelegate(this));
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
@@ -223,8 +225,7 @@ BookmarkView::BookmarkView(QWidget *parent)
BookmarkView::~BookmarkView() BookmarkView::~BookmarkView()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore::instance()->removeContextObject(m_bookmarkContext);
core->removeContextObject(m_bookmarkContext);
} }
void BookmarkView::contextMenuEvent(QContextMenuEvent *event) void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
@@ -244,13 +245,11 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
connect(removeAll, SIGNAL(triggered()), connect(removeAll, SIGNAL(triggered()),
this, SLOT(removeAll())); this, SLOT(removeAll()));
menu.exec(mapToGlobal(event->pos())); menu.exec(mapToGlobal(event->pos()));
} }
void BookmarkView::removeFromContextMenu() void BookmarkView::removeFromContextMenu()
{ {
removeBookmark(m_contextMenuIndex); removeBookmark(m_contextMenuIndex);
} }
@@ -294,7 +293,7 @@ void BookmarkView::gotoBookmark(const QModelIndex &index)
BookmarkContext::BookmarkContext(BookmarkView *widget) BookmarkContext::BookmarkContext(BookmarkView *widget)
: m_bookmarkView(widget) : m_bookmarkView(widget)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
} }
@@ -313,15 +312,14 @@ QWidget *BookmarkContext::widget()
//// ////
BookmarkManager::BookmarkManager() : BookmarkManager::BookmarkManager() :
m_core(BookmarksPlugin::core()),
m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png"))) m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png")))
{ {
m_selectionModel = new QItemSelectionModel(this, this); m_selectionModel = new QItemSelectionModel(this, this);
connect(m_core, SIGNAL(contextChanged(Core::IContext*)), connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)),
this, SLOT(updateActionStatus())); this, SLOT(updateActionStatus()));
ExtensionSystem::PluginManager *pm = m_core->pluginManager(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>(); ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>();
connect(projectExplorer->session(), SIGNAL(sessionLoaded()), connect(projectExplorer->session(), SIGNAL(sessionLoaded()),
@@ -511,7 +509,8 @@ void BookmarkManager::documentPrevNext(bool next)
nextLine = markLine; nextLine = markLine;
} }
m_core->editorManager()->addCurrentPositionToNavigationHistory(true); Core::EditorManager *em = Core::ICore::instance()->editorManager();
em->addCurrentPositionToNavigationHistory(true);
if (next) { if (next) {
if (nextLine == -1) if (nextLine == -1)
editor->gotoLine(firstLine); editor->gotoLine(firstLine);
@@ -523,7 +522,7 @@ void BookmarkManager::documentPrevNext(bool next)
else else
editor->gotoLine(prevLine); editor->gotoLine(prevLine);
} }
m_core->editorManager()->addCurrentPositionToNavigationHistory(); em->addCurrentPositionToNavigationHistory();
} }
void BookmarkManager::next() void BookmarkManager::next()
@@ -555,16 +554,17 @@ void BookmarkManager::prev()
TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
{ {
Core::IEditor *currEditor = m_core->editorManager()->currentEditor(); Core::EditorManager *em = Core::ICore::instance()->editorManager();
Core::IEditor *currEditor = em->currentEditor();
if (!currEditor) if (!currEditor)
return 0; return 0;
return qobject_cast<TextEditor::ITextEditor *>(currEditor); return qobject_cast<TextEditor::ITextEditor *>(currEditor);
} }
/* Returns the current session. */ /* Returns the current session. */
SessionManager* BookmarkManager::sessionManager() const SessionManager *BookmarkManager::sessionManager() const
{ {
ExtensionSystem::PluginManager *pm = m_core->pluginManager(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>(); ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>();
return pe->session(); return pe->session();
} }

View File

@@ -48,7 +48,6 @@ class SessionManager;
} }
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -131,7 +130,6 @@ private:
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap; typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
DirectoryFileBookmarksMap m_bookmarksMap; DirectoryFileBookmarksMap m_bookmarksMap;
Core::ICore *m_core;
QIcon m_bookmarkIcon; QIcon m_bookmarkIcon;

View File

@@ -35,16 +35,17 @@
#include "bookmarkmanager.h" #include "bookmarkmanager.h"
#include "bookmarks_global.h" #include "bookmarks_global.h"
#include <texteditor/texteditorconstants.h>
#include <texteditor/itexteditor.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/itexteditor.h>
#include <texteditor/texteditorconstants.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QMenu> #include <QtGui/QMenu>
@@ -56,7 +57,7 @@ using namespace TextEditor;
BookmarksPlugin *BookmarksPlugin::m_instance = 0; BookmarksPlugin *BookmarksPlugin::m_instance = 0;
BookmarksPlugin::BookmarksPlugin() BookmarksPlugin::BookmarksPlugin()
: m_bookmarkManager(0), m_core(0) : m_bookmarkManager(0)
{ {
m_instance = this; m_instance = this;
} }
@@ -67,13 +68,13 @@ void BookmarksPlugin::extensionsInitialized()
bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = core->actionManager();
QList<int> context = QList<int>() << m_core->uniqueIDManager()-> QList<int> context = QList<int>() << core->uniqueIDManager()->
uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
QList<int> textcontext, globalcontext; QList<int> textcontext, globalcontext;
textcontext << m_core->uniqueIDManager()-> textcontext << core->uniqueIDManager()->
uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
globalcontext << Core::Constants::C_GLOBAL_ID; globalcontext << Core::Constants::C_GLOBAL_ID;
@@ -171,7 +172,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
this, SLOT(bookmarkMarginActionTriggered())); this, SLOT(bookmarkMarginActionTriggered()));
// EditorManager // EditorManager
QObject *editorManager = m_core->editorManager(); QObject *editorManager = core->editorManager();
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*))); this, SLOT(editorAboutToClose(Core::IEditor*)));
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),

View File

@@ -45,7 +45,6 @@ class QMenu;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -67,7 +66,6 @@ public:
~BookmarksPlugin(); ~BookmarksPlugin();
static BookmarksPlugin *instance() { return m_instance; } static BookmarksPlugin *instance() { return m_instance; }
static Core::ICore *core() { return m_instance->m_core; }
bool initialize(const QStringList &arguments, QString *error_message); bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized(); void extensionsInitialized();
@@ -85,7 +83,6 @@ private slots:
private: private:
static BookmarksPlugin *m_instance; static BookmarksPlugin *m_instance;
BookmarkManager *m_bookmarkManager; BookmarkManager *m_bookmarkManager;
Core::ICore *m_core;
QAction *m_toggleAction; QAction *m_toggleAction;
QAction *m_prevAction; QAction *m_prevAction;

View File

@@ -80,13 +80,14 @@ CMakeProject::~CMakeProject()
// TODO make this function work even if it is reparsing // TODO make this function work even if it is reparsing
void CMakeProject::parseCMakeLists(const QDir &directory) void CMakeProject::parseCMakeLists(const QDir &directory)
{ {
createCbpFile(directory); createCbpFile(buildDirectory(QString()));
QString cbpFile = findCbpFile(directory); QString cbpFile = findCbpFile(buildDirectory(QString()));
CMakeCbpParser cbpparser; CMakeCbpParser cbpparser;
qDebug()<<"Parsing file "<<cbpFile; qDebug()<<"Parsing file "<<cbpFile;
if (cbpparser.parseCbpFile(cbpFile)) { if (cbpparser.parseCbpFile(cbpFile)) {
m_projectName = cbpparser.projectName();
qDebug()<<"Building Tree"; qDebug()<<"Building Tree";
// TODO do a intelligent updating of the tree // TODO do a intelligent updating of the tree
buildTree(m_rootNode, cbpparser.fileList()); buildTree(m_rootNode, cbpparser.fileList());
@@ -152,9 +153,10 @@ void CMakeProject::createCbpFile(const QDir &directory)
// TODO we need to pass on the same paremeters as the cmakestep // TODO we need to pass on the same paremeters as the cmakestep
qDebug()<<"Creating cbp file"; qDebug()<<"Creating cbp file";
directory.mkpath(directory.absolutePath());
QProcess cmake; QProcess cmake;
cmake.setWorkingDirectory(directory.absolutePath()); cmake.setWorkingDirectory(directory.absolutePath());
cmake.start("cmake", QStringList() << "-GCodeBlocks - Unix Makefiles"); cmake.start("cmake", QStringList() << ".." << "-GCodeBlocks - Unix Makefiles");
cmake.waitForFinished(-1); cmake.waitForFinished(-1);
qDebug()<<"cmake output: \n"<<cmake.readAll(); qDebug()<<"cmake output: \n"<<cmake.readAll();
} }
@@ -200,8 +202,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
QString CMakeProject::name() const QString CMakeProject::name() const
{ {
// TODO return m_projectName;
return "";
} }
Core::IFile *CMakeProject::file() const Core::IFile *CMakeProject::file() const
@@ -214,11 +215,6 @@ ProjectExplorer::IProjectManager *CMakeProject::projectManager() const
return m_manager; return m_manager;
} }
QList<Core::IFile *> CMakeProject::dependencies()
{
return QList<Core::IFile *>();
}
QList<ProjectExplorer::Project *> CMakeProject::dependsOn() QList<ProjectExplorer::Project *> CMakeProject::dependsOn()
{ {
return QList<Project *>(); return QList<Project *>();
@@ -240,7 +236,7 @@ QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
{ {
QString buildDirectory = value(buildConfiguration, "buildDirectory").toString(); QString buildDirectory = value(buildConfiguration, "buildDirectory").toString();
if (buildDirectory.isEmpty()) if (buildDirectory.isEmpty())
buildDirectory = QFileInfo(m_fileName).absolutePath(); buildDirectory = QFileInfo(m_fileName).absolutePath() + "/qtcreator-build";
return buildDirectory; return buildDirectory;
} }
@@ -469,6 +465,8 @@ void CMakeCbpParser::parseProject()
readNext(); readNext();
if (isEndElement()) { if (isEndElement()) {
return; return;
} else if (name() == "Option") {
parseOption();
} else if (name() == "Unit") { } else if (name() == "Unit") {
parseUnit(); parseUnit();
} else if (name() == "Build") { } else if (name() == "Build") {
@@ -521,7 +519,7 @@ void CMakeCbpParser::parseTargetOption()
{ {
if (attributes().hasAttribute("output")) if (attributes().hasAttribute("output"))
m_target.executable = attributes().value("output").toString(); m_target.executable = attributes().value("output").toString();
else if (attributes().hasAttribute("type") && attributes().value("type") == "1") else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0"))
m_targetType = true; m_targetType = true;
else if (attributes().hasAttribute("working_dir")) else if (attributes().hasAttribute("working_dir"))
m_target.workingDirectory = attributes().value("working_dir").toString(); m_target.workingDirectory = attributes().value("working_dir").toString();
@@ -537,6 +535,26 @@ void CMakeCbpParser::parseTargetOption()
} }
} }
QString CMakeCbpParser::projectName() const
{
return m_projectName;
}
void CMakeCbpParser::parseOption()
{
if (attributes().hasAttribute("title"))
m_projectName = attributes().value("title").toString();
while (!atEnd()) {
readNext();
if (isEndElement()) {
return;
} else if(isStartElement()) {
parseUnknownElement();
}
}
}
void CMakeCbpParser::parseMakeCommand() void CMakeCbpParser::parseMakeCommand()
{ {
while (!atEnd()) { while (!atEnd()) {

View File

@@ -73,7 +73,6 @@ public:
virtual Core::IFile *file() const; virtual Core::IFile *file() const;
virtual ProjectExplorer::IProjectManager *projectManager() const; virtual ProjectExplorer::IProjectManager *projectManager() const;
virtual QList<Core::IFile *> dependencies(); //NBS TODO remove
virtual QList<ProjectExplorer::Project *> dependsOn(); //NBS TODO implement dependsOn virtual QList<ProjectExplorer::Project *> dependsOn(); //NBS TODO implement dependsOn
virtual bool isApplication() const; virtual bool isApplication() const;
@@ -118,6 +117,7 @@ private:
CMakeManager *m_manager; CMakeManager *m_manager;
QString m_fileName; QString m_fileName;
CMakeFile *m_file; CMakeFile *m_file;
QString m_projectName;
// TODO probably need a CMake specific node structure // TODO probably need a CMake specific node structure
CMakeProjectNode* m_rootNode; CMakeProjectNode* m_rootNode;
@@ -137,10 +137,12 @@ public:
QList<ProjectExplorer::FileNode *> fileList(); QList<ProjectExplorer::FileNode *> fileList();
QStringList includeFiles(); QStringList includeFiles();
QList<CMakeTarget> targets(); QList<CMakeTarget> targets();
QString projectName() const;
private: private:
void parseCodeBlocks_project_file(); void parseCodeBlocks_project_file();
void parseProject(); void parseProject();
void parseBuild(); void parseBuild();
void parseOption();
void parseTarget(); void parseTarget();
void parseTargetOption(); void parseTargetOption();
void parseMakeCommand(); void parseMakeCommand();
@@ -157,6 +159,7 @@ private:
CMakeTarget m_target; CMakeTarget m_target;
bool m_targetType; bool m_targetType;
QList<CMakeTarget> m_targets; QList<CMakeTarget> m_targets;
QString m_projectName;
}; };
class CMakeFile : public Core::IFile class CMakeFile : public Core::IFile

View File

@@ -37,7 +37,6 @@
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -45,7 +44,7 @@ using namespace CMakeProjectManager::Internal;
CMakeManager::CMakeManager() CMakeManager::CMakeManager()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT); m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
} }

View File

@@ -40,7 +40,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -56,7 +56,7 @@ CMakeProjectPlugin::~CMakeProjectPlugin()
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
return false; return false;
addAutoReleasedObject(new CMakeManager()); addAutoReleasedObject(new CMakeManager());

View File

@@ -61,7 +61,7 @@ namespace {
You get the only implementation of this class from the core interface You get the only implementation of this class from the core interface
ICore::actionManager() method, e.g. ICore::actionManager() method, e.g.
\code \code
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager() Core::ICore::instance()->actionManager()
\endcode \endcode
The main reasons for the need of this class is to provide a central place where the user The main reasons for the need of this class is to provide a central place where the user
@@ -80,8 +80,7 @@ namespace {
So to register a globally active action "My Action" So to register a globally active action "My Action"
put the following in your plugin's IPlugin::initialize method: put the following in your plugin's IPlugin::initialize method:
\code \code
Core::ActionManager *am = ExtensionSystem::PluginManager::instance() Core::ActionManager *am = Core::ICore::instance()->actionManager();
->getObject<Core::ICore>()->actionManager();
QAction *myAction = new QAction(tr("My Action"), this); QAction *myAction = new QAction(tr("My Action"), this);
Core::Command *cmd = am->registerAction(myAction, Core::Command *cmd = am->registerAction(myAction,
"myplugin.myaction", "myplugin.myaction",

View File

@@ -38,6 +38,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/ifilewizardextension.h> #include <coreplugin/ifilewizardextension.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/filewizarddialog.h> #include <utils/filewizarddialog.h>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -345,28 +346,19 @@ void WizardEventLoop::rejected()
// ---------------- BaseFileWizardPrivate // ---------------- BaseFileWizardPrivate
struct BaseFileWizardPrivate struct BaseFileWizardPrivate
{ {
explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters &parameters, explicit BaseFileWizardPrivate(const Core::BaseFileWizardParameters &parameters)
Core::ICore *core); : m_parameters(parameters), m_wizardDialog(0)
{}
const Core::BaseFileWizardParameters m_parameters; const Core::BaseFileWizardParameters m_parameters;
QWizard *m_wizardDialog; QWizard *m_wizardDialog;
Core::ICore *m_core;
}; };
Core::BaseFileWizardPrivate::BaseFileWizardPrivate(const BaseFileWizardParameters &parameters,
Core::ICore *core) :
m_parameters(parameters),
m_wizardDialog(0),
m_core(core)
{
}
// ---------------- Wizard // ---------------- Wizard
BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters &parameters, BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent) : QObject *parent) :
IWizard(parent), IWizard(parent),
m_d(new BaseFileWizardPrivate(parameters, core)) m_d(new BaseFileWizardPrivate(parameters))
{ {
} }
@@ -517,13 +509,14 @@ bool BaseFileWizard::postGenerateFiles(const GeneratedFiles &l, QString *errorMe
{ {
// File mode: open the editors in file mode and ensure editor pane // File mode: open the editors in file mode and ensure editor pane
const Core::GeneratedFiles::const_iterator cend = l.constEnd(); const Core::GeneratedFiles::const_iterator cend = l.constEnd();
Core::EditorManager *em = Core::ICore::instance()->editorManager();
for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) { for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
if (!m_d->m_core->editorManager()->openEditor(it->path(), it->editorKind())) { if (!em->openEditor(it->path(), it->editorKind())) {
*errorMessage = tr("Failed to open an editor for %1").arg(it->path()); *errorMessage = tr("Failed to open an editor for %1").arg(it->path());
return false; return false;
} }
} }
m_d->m_core->editorManager()->ensureEditorManagerVisible(); em->ensureEditorManagerVisible();
return true; return true;
} }
@@ -534,7 +527,6 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
if (debugWizard) if (debugWizard)
qDebug() << Q_FUNC_INFO << location << files; qDebug() << Q_FUNC_INFO << location << files;
bool existingFilesFound = false; bool existingFilesFound = false;
bool oddStuffFound = false; bool oddStuffFound = false;
@@ -581,7 +573,7 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
const QString messageFormat = tr("The following files already exist in the directory %1:\n" const QString messageFormat = tr("The following files already exist in the directory %1:\n"
"%2.\nWould you like to overwrite them?"); "%2.\nWould you like to overwrite them?");
const QString message = messageFormat.arg(location).arg(fileNamesMsgPart); const QString message = messageFormat.arg(location).arg(fileNamesMsgPart);
const bool yes = (QMessageBox::question(core()->mainWindow(), const bool yes = (QMessageBox::question(Core::ICore::instance()->mainWindow(),
tr("Existing files"), message, tr("Existing files"), message,
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) QMessageBox::No)
@@ -589,11 +581,6 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(const QString &l
return yes ? OverwriteOk : OverwriteCanceled; return yes ? OverwriteOk : OverwriteCanceled;
} }
Core::ICore *BaseFileWizard::core() const
{
return m_d->m_core;
}
QList<IWizard*> BaseFileWizard::allWizards() QList<IWizard*> BaseFileWizard::allWizards()
{ {
return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>(); return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>();
@@ -636,19 +623,18 @@ QString BaseFileWizard::buildFileName(const QString &path,
QString BaseFileWizard::preferredSuffix(const QString &mimeType) const QString BaseFileWizard::preferredSuffix(const QString &mimeType) const
{ {
const QString rc = m_d->m_core->mimeDatabase()->preferredSuffixByType(mimeType); const QString rc = Core::ICore::instance()->mimeDatabase()->preferredSuffixByType(mimeType);
if (rc.isEmpty()) if (rc.isEmpty())
qWarning("%s: WARNING: Unable to find a preferred suffix for %s.", qWarning("%s: WARNING: Unable to find a preferred suffix for %s.",
Q_FUNC_INFO, mimeType.toUtf8().constData()); Q_FUNC_INFO, mimeType.toUtf8().constData());
return rc; return rc;
} }
// ------------- StandardFileWizard( // ------------- StandardFileWizard
StandardFileWizard::StandardFileWizard(const BaseFileWizardParameters &parameters, StandardFileWizard::StandardFileWizard(const BaseFileWizardParameters &parameters,
Core::ICore *core,
QObject *parent) : QObject *parent) :
BaseFileWizard(parameters, core, parent) BaseFileWizard(parameters, parent)
{ {
} }

View File

@@ -50,7 +50,6 @@ QT_END_NAMESPACE
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
class IFileWizardExtension; class IFileWizardExtension;
@@ -69,7 +68,7 @@ public:
GeneratedFile(); GeneratedFile();
explicit GeneratedFile(const QString &path); explicit GeneratedFile(const QString &path);
GeneratedFile(const GeneratedFile &); GeneratedFile(const GeneratedFile &);
GeneratedFile &operator=(const GeneratedFile&); GeneratedFile &operator=(const GeneratedFile &);
~GeneratedFile(); ~GeneratedFile();
// Full path of the file should be created, or the suggested file name // Full path of the file should be created, or the suggested file name
@@ -107,19 +106,19 @@ public:
void setKind(IWizard::Kind k); void setKind(IWizard::Kind k);
QIcon icon() const; QIcon icon() const;
void setIcon(const QIcon&); void setIcon(const QIcon &icon);
QString description() const; QString description() const;
void setDescription(const QString &); void setDescription(const QString &description);
QString name() const; QString name() const;
void setName(const QString &); void setName(const QString &name);
QString category() const; QString category() const;
void setCategory(const QString &); void setCategory(const QString &category);
QString trCategory() const; QString trCategory() const;
void setTrCategory(const QString &); void setTrCategory(const QString &trCategory);
private: private:
QSharedDataPointer<BaseFileWizardParameterData> m_d; QSharedDataPointer<BaseFileWizardParameterData> m_d;
@@ -172,7 +171,7 @@ public:
protected: protected:
typedef QList<QWizardPage *> WizardPageList; typedef QList<QWizardPage *> WizardPageList;
explicit BaseFileWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent = 0); explicit BaseFileWizard(const BaseFileWizardParameters &parameters, QObject *parent = 0);
// Overwrite to create the wizard dialog on the parent, adding // Overwrite to create the wizard dialog on the parent, adding
// the extension pages. // the extension pages.
@@ -197,8 +196,6 @@ protected:
OverwriteResult promptOverwrite(const QString &location, OverwriteResult promptOverwrite(const QString &location,
const QStringList &files, const QStringList &files,
QString *errorMessage) const; QString *errorMessage) const;
Core::ICore *core() const;
private: private:
BaseFileWizardPrivate *m_d; BaseFileWizardPrivate *m_d;
}; };
@@ -213,7 +210,7 @@ class CORE_EXPORT StandardFileWizard : public BaseFileWizard
Q_OBJECT Q_OBJECT
protected: protected:
explicit StandardFileWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent = 0); explicit StandardFileWizard(const BaseFileWizardParameters &parameters, QObject *parent = 0);
// Implemented to create a Core::Utils::FileWizardDialog // Implemented to create a Core::Utils::FileWizardDialog
virtual QWizard *createWizardDialog(QWidget *parent, virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -33,7 +33,7 @@
#include "baseview.h" #include "baseview.h"
#include <extensionsystem/ExtensionSystemInterfaces> #include <QtGui/QWidget>
using namespace Core; using namespace Core;

View File

@@ -34,8 +34,6 @@
#ifndef CORECONSTANTS_H #ifndef CORECONSTANTS_H
#define CORECONSTANTS_H #define CORECONSTANTS_H
#include <extensionsystem/ExtensionSystemInterfaces>
namespace Core { namespace Core {
namespace Constants { namespace Constants {
@@ -122,6 +120,7 @@ const char * const EXIT = "QtCreator.Exit";
const char * const OPTIONS = "QtCreator.Options"; const char * const OPTIONS = "QtCreator.Options";
const char * const TOGGLE_SIDEBAR = "QtCreator.ToggleSidebar"; const char * const TOGGLE_SIDEBAR = "QtCreator.ToggleSidebar";
const char * const TOGGLE_FULLSCREEN = "QtCreator.ToggleFullScreen";
const char * const MINIMIZE_WINDOW = "QtCreator.MinimizeWindow"; const char * const MINIMIZE_WINDOW = "QtCreator.MinimizeWindow";
const char * const ZOOM_WINDOW = "QtCreator.ZoomWindow"; const char * const ZOOM_WINDOW = "QtCreator.ZoomWindow";
@@ -146,7 +145,7 @@ const char * const ABOUT_WORKBENCH = "QtCreator.AboutWorkbench";
const char * const ABOUT_PLUGINS = "QtCreator.AboutPlugins"; const char * const ABOUT_PLUGINS = "QtCreator.AboutPlugins";
const char * const ABOUT_QT = "QtCreator.AboutQt"; const char * const ABOUT_QT = "QtCreator.AboutQt";
const char * const S_RETURNTOEDITOR = "QtCreator.ReturnToEditor"; const char * const S_RETURNTOEDITOR = "QtCreator.ReturnToEditor";
const char * const OPEN_IN_EXTERNAL_EDITOR = "QtCreattor.OpenInExternalEditor"; const char * const OPEN_IN_EXTERNAL_EDITOR = "QtCreator.OpenInExternalEditor";
// default groups // default groups
const char * const G_DEFAULT_ONE = "QtCreator.Group.Default.One"; const char * const G_DEFAULT_ONE = "QtCreator.Group.Default.One";
@@ -174,11 +173,18 @@ const char * const G_FILE_OTHER = "QtCreator.Group.File.Other";
const char * const G_EDIT_UNDOREDO = "QtCreator.Group.Edit.UndoRedo"; const char * const G_EDIT_UNDOREDO = "QtCreator.Group.Edit.UndoRedo";
const char * const G_EDIT_COPYPASTE = "QtCreator.Group.Edit.CopyPaste"; const char * const G_EDIT_COPYPASTE = "QtCreator.Group.Edit.CopyPaste";
const char * const G_EDIT_SELECTALL = "QtCreator.Group.Edit.SelectAll"; const char * const G_EDIT_SELECTALL = "QtCreator.Group.Edit.SelectAll";
const char * const G_EDIT_FORMAT = "QtCreator.Group.Edit.Format"; const char * const G_EDIT_ADVANCED = "QtCreator.Group.Edit.Advanced";
const char * const G_EDIT_FIND = "QtCreator.Group.Edit.Find"; const char * const G_EDIT_FIND = "QtCreator.Group.Edit.Find";
const char * const G_EDIT_OTHER = "QtCreator.Group.Edit.Other"; const char * const G_EDIT_OTHER = "QtCreator.Group.Edit.Other";
// advanced edit menu groups
const char * const G_EDIT_FORMAT = "QtCreator.Group.Edit.Format";
const char * const G_EDIT_COLLAPSING = "QtCreator.Group.Edit.Collapsing";
const char * const G_EDIT_FONT = "QtCreator.Group.Edit.Font";
const char * const G_EDIT_EDITOR = "QtCreator.Group.Edit.Editor";
// window menu groups // window menu groups
const char * const G_WINDOW_SIZE = "QtCreator.Group.Window.Size"; const char * const G_WINDOW_SIZE = "QtCreator.Group.Window.Size";
const char * const G_WINDOW_PANES = "QtCreator.Group.Window.Panes"; const char * const G_WINDOW_PANES = "QtCreator.Group.Window.Panes";
@@ -188,6 +194,7 @@ const char * const G_WINDOW_NAVIGATE = "QtCreator.Group.Window.Navigate";
const char * const G_WINDOW_NAVIGATE_GROUPS = "QtCreator.Group.Window.Navigate.Groups"; const char * const G_WINDOW_NAVIGATE_GROUPS = "QtCreator.Group.Window.Navigate.Groups";
const char * const G_WINDOW_OTHER = "QtCreator.Group.Window.Other"; const char * const G_WINDOW_OTHER = "QtCreator.Group.Window.Other";
const char * const G_WINDOW_LIST = "QtCreator.Group.Window.List"; const char * const G_WINDOW_LIST = "QtCreator.Group.Window.List";
const char * const G_WINDOW_FULLSCREEN = "QtCreator.Group.Window.Fullscreen";
// help groups (global) // help groups (global)
const char * const G_HELP_HELP = "QtCreator.Group.Help.Help"; const char * const G_HELP_HELP = "QtCreator.Group.Help.Help";

View File

@@ -36,12 +36,21 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
namespace Core {
namespace Internal {
// The Core Singleton
static CoreImpl *m_instance = 0;
} // namespace Internal
} // namespace Core
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
CoreImpl *CoreImpl::m_instance = 0;
CoreImpl *CoreImpl::instance() ICore* ICore::instance()
{ {
return m_instance; return m_instance;
} }
@@ -190,3 +199,4 @@ void CoreImpl::openFiles(const QStringList &arguments)
{ {
m_mainwindow->openFiles(arguments); m_mainwindow->openFiles(arguments);
} }

View File

@@ -45,8 +45,6 @@ class CoreImpl : public ICore
Q_OBJECT Q_OBJECT
public: public:
static CoreImpl *instance();
CoreImpl(MainWindow *mainwindow); CoreImpl(MainWindow *mainwindow);
~CoreImpl() {} ~CoreImpl() {}
@@ -93,8 +91,6 @@ public:
private: private:
MainWindow *m_mainwindow; MainWindow *m_mainwindow;
friend class MainWindow; friend class MainWindow;
static CoreImpl *m_instance;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -39,7 +39,9 @@
#include "modemanager.h" #include "modemanager.h"
#include "fileiconprovider.h" #include "fileiconprovider.h"
#include <QtCore/qplugin.h> #include <extensionsystem/pluginmanager.h>
#include <QtCore/QtPlugin>
#if !defined(QT_NO_WEBKIT) #if !defined(QT_NO_WEBKIT)
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtWebKit/QWebSettings> #include <QtWebKit/QWebSettings>

View File

@@ -34,6 +34,8 @@
#include "settingsdialog.h" #include "settingsdialog.h"
#include "coreimpl.h" #include "coreimpl.h"
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
@@ -58,7 +60,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
QMap<QString, QTreeWidgetItem *> categories; QMap<QString, QTreeWidgetItem *> categories;
QList<IOptionsPage*> pages = QList<IOptionsPage*> pages =
CoreImpl::instance()->pluginManager()->getObjects<IOptionsPage>(); ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>();
int index = 0; int index = 0;
foreach (IOptionsPage *page, pages) { foreach (IOptionsPage *page, pages) {

View File

@@ -53,6 +53,8 @@
#include <coreplugin/baseview.h> #include <coreplugin/baseview.h>
#include <coreplugin/imode.h> #include <coreplugin/imode.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -77,6 +79,11 @@ using namespace Core::Internal;
enum { debugEditorManager=0 }; enum { debugEditorManager=0 };
static inline ExtensionSystem::PluginManager *pluginManager()
{
return ExtensionSystem::PluginManager::instance();
}
//===================EditorManager===================== //===================EditorManager=====================
EditorManagerPlaceHolder *EditorManagerPlaceHolder::m_current = 0; EditorManagerPlaceHolder *EditorManagerPlaceHolder::m_current = 0;
@@ -201,6 +208,16 @@ EditorManagerPrivate::~EditorManagerPrivate()
EditorManager *EditorManager::m_instance = 0; EditorManager *EditorManager::m_instance = 0;
static Command *createSeparator(ActionManager *am, QObject *parent,
const QString &name,
const QList<int> &context)
{
QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true);
Command *cmd = am->registerAction(tmpaction, name, context);
return cmd;
}
EditorManager::EditorManager(ICore *core, QWidget *parent) : EditorManager::EditorManager(ICore *core, QWidget *parent) :
QWidget(parent), QWidget(parent),
m_d(new EditorManagerPrivate(core, parent)) m_d(new EditorManagerPrivate(core, parent))
@@ -338,12 +355,24 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
ActionContainer *medit = am->actionContainer(Constants::M_EDIT); ActionContainer *medit = am->actionContainer(Constants::M_EDIT);
ActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED); ActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED);
medit->addMenu(advancedMenu, Constants::G_EDIT_FORMAT); medit->addMenu(advancedMenu, Constants::G_EDIT_ADVANCED);
advancedMenu->menu()->setTitle(tr("&Advanced")); advancedMenu->menu()->setTitle(tr("&Advanced"));
advancedMenu->appendGroup(Constants::G_EDIT_FORMAT);
advancedMenu->appendGroup(Constants::G_EDIT_COLLAPSING);
advancedMenu->appendGroup(Constants::G_EDIT_FONT);
advancedMenu->appendGroup(Constants::G_EDIT_EDITOR);
// Advanced menu separators
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Collapsing"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_COLLAPSING);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Font"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_FONT);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Editor"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR);
cmd = am->registerAction(m_d->m_openInExternalEditorAction, Constants::OPEN_IN_EXTERNAL_EDITOR, editManagerContext); cmd = am->registerAction(m_d->m_openInExternalEditorAction, Constants::OPEN_IN_EXTERNAL_EDITOR, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+V,Alt+I"))); cmd->setDefaultKeySequence(QKeySequence(tr("Alt+V,Alt+I")));
advancedMenu->addAction(cmd); advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR);
connect(m_d->m_openInExternalEditorAction, SIGNAL(triggered()), this, SLOT(openInExternalEditor())); connect(m_d->m_openInExternalEditorAction, SIGNAL(triggered()), this, SLOT(openInExternalEditor()));
@@ -367,11 +396,12 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
EditorManager::~EditorManager() EditorManager::~EditorManager()
{ {
if (m_d->m_core) { if (m_d->m_core) {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
if (m_d->m_coreListener) { if (m_d->m_coreListener) {
m_d->m_core->pluginManager()->removeObject(m_d->m_coreListener); pm->removeObject(m_d->m_coreListener);
delete m_d->m_coreListener; delete m_d->m_coreListener;
} }
m_d->m_core->pluginManager()->removeObject(m_d->m_openEditorsFactory); pm->removeObject(m_d->m_openEditorsFactory);
delete m_d->m_openEditorsFactory; delete m_d->m_openEditorsFactory;
} }
delete m_d; delete m_d;
@@ -383,10 +413,11 @@ void EditorManager::init()
context << m_d->m_core->uniqueIDManager()->uniqueIdentifier("QtCreator.OpenDocumentsView"); context << m_d->m_core->uniqueIDManager()->uniqueIdentifier("QtCreator.OpenDocumentsView");
m_d->m_coreListener = new EditorClosingCoreListener(this); m_d->m_coreListener = new EditorClosingCoreListener(this);
m_d->m_core->pluginManager()->addObject(m_d->m_coreListener);
pluginManager()->addObject(m_d->m_coreListener);
m_d->m_openEditorsFactory = new OpenEditorsViewFactory(); m_d->m_openEditorsFactory = new OpenEditorsViewFactory();
m_d->m_core->pluginManager()->addObject(m_d->m_openEditorsFactory); pluginManager()->addObject(m_d->m_openEditorsFactory);
} }
QSize EditorManager::minimumSizeHint() const QSize EditorManager::minimumSizeHint() const
@@ -568,7 +599,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
QList<IEditor*> acceptedEditors; QList<IEditor*> acceptedEditors;
//ask all core listeners to check whether the editor can be closed //ask all core listeners to check whether the editor can be closed
const QList<ICoreListener *> listeners = const QList<ICoreListener *> listeners =
m_d->m_core->pluginManager()->getObjects<ICoreListener>(); pluginManager()->getObjects<ICoreListener>();
foreach (IEditor *editor, editorsToClose) { foreach (IEditor *editor, editorsToClose) {
bool editorAccepted = true; bool editorAccepted = true;
foreach (ICoreListener *listener, listeners) { foreach (ICoreListener *listener, listeners) {
@@ -680,7 +711,7 @@ EditorManager::EditorFactoryList
EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) const EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) const
{ {
EditorFactoryList rc; EditorFactoryList rc;
const EditorFactoryList allFactories = m_d->m_core->pluginManager()->getObjects<IEditorFactory>(); const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
mimeTypeFactoryRecursion(m_d->m_core->mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc); mimeTypeFactoryRecursion(m_d->m_core->mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc);
if (debugEditorManager) if (debugEditorManager)
qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc; qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc;
@@ -707,7 +738,7 @@ IEditor *EditorManager::createEditor(const QString &editorKind,
factories = editorFactories(mimeType, true); factories = editorFactories(mimeType, true);
} else { } else {
// Find by editor kind // Find by editor kind
const EditorFactoryList allFactories = m_d->m_core->pluginManager()->getObjects<IEditorFactory>(); const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>();
const EditorFactoryList::const_iterator acend = allFactories.constEnd(); const EditorFactoryList::const_iterator acend = allFactories.constEnd();
for (EditorFactoryList::const_iterator ait = allFactories.constBegin(); ait != acend; ++ait) { for (EditorFactoryList::const_iterator ait = allFactories.constBegin(); ait != acend; ++ait) {
if (editorKind == (*ait)->kind()) { if (editorKind == (*ait)->kind()) {

View File

@@ -80,6 +80,7 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
tl->setMargin(0); tl->setMargin(0);
{ {
m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_editorList->setSizeAdjustPolicy(QComboBox::AdjustToContents);
m_editorList->setMinimumContentsLength(20); m_editorList->setMinimumContentsLength(20);
m_proxyModel.setSourceModel(model()); m_proxyModel.setSourceModel(model());
m_proxyModel.sort(0); m_proxyModel.sort(0);

View File

@@ -51,10 +51,7 @@
You should never create a subclass of this interface. The one and only You should never create a subclass of this interface. The one and only
instance is created by the Core plugin. You can access this instance instance is created by the Core plugin. You can access this instance
from your plugin via the plugin manager, e.g. from your plugin through \c{Core::instance()}.
\code
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
\endcode
\mainclass \mainclass
*/ */

View File

@@ -35,36 +35,30 @@
#define ICORE_H #define ICORE_H
#include "core_global.h" #include "core_global.h"
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QList>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSettings;
class QStatusBar;
class QFocusEvent;
class QMainWindow; class QMainWindow;
class QPrinter; class QPrinter;
class QSettings;
template <class T> class QList;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
// forward declarations
class ActionManager; class ActionManager;
class IFile;
class FileManager;
class MessageManager;
class IEditor;
class UniqueIDManager;
class EditorManager; class EditorManager;
class FileManager;
class IContext;
class IWizard;
class MessageManager;
class MimeDatabase;
class ModeManager;
class ProgressManager; class ProgressManager;
class ScriptManager; class ScriptManager;
class UniqueIDManager;
class VariableManager; class VariableManager;
class IContext;
class VCSManager; class VCSManager;
class ModeManager;
class IWizard;
class MimeDatabase;
class CORE_EXPORT ICore : public QObject class CORE_EXPORT ICore : public QObject
{ {
@@ -74,6 +68,8 @@ public:
ICore() {} ICore() {}
virtual ~ICore() {} virtual ~ICore() {}
static ICore *instance();
virtual QStringList showNewItemDialog(const QString &title, virtual QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation = QString()) = 0; const QString &defaultLocation = QString()) = 0;
@@ -85,7 +81,6 @@ public:
virtual FileManager *fileManager() const = 0; virtual FileManager *fileManager() const = 0;
virtual UniqueIDManager *uniqueIDManager() const = 0; virtual UniqueIDManager *uniqueIDManager() const = 0;
virtual MessageManager *messageManager() const = 0; virtual MessageManager *messageManager() const = 0;
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
virtual EditorManager *editorManager() const = 0; virtual EditorManager *editorManager() const = 0;
virtual ProgressManager *progressManager() const = 0; virtual ProgressManager *progressManager() const = 0;
virtual ScriptManager *scriptManager() const = 0; virtual ScriptManager *scriptManager() const = 0;

View File

@@ -70,22 +70,23 @@
#include "basefilewizard.h" #include "basefilewizard.h"
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/qplugin.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QFileInfo>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QtCore/QFileInfo> #include <QtCore/QtPlugin>
#include <QtGui/QMenu>
#include <QtGui/QToolBar>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QPixmap>
#include <QtGui/QCloseEvent> #include <QtGui/QCloseEvent>
#include <QtGui/QShortcut> #include <QtGui/QMenu>
#include <QtGui/QPixmap>
#include <QtGui/QPrinter> #include <QtGui/QPrinter>
#include <QtGui/QWizard> #include <QtGui/QShortcut>
#include <QtGui/QStatusBar> #include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWizard>
/* /*
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
@@ -142,6 +143,7 @@ MainWindow::MainWindow() :
m_exitAction(0), m_exitAction(0),
m_optionsAction(0), m_optionsAction(0),
m_toggleSideBarAction(0), m_toggleSideBarAction(0),
m_toggleFullScreenAction(0),
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
m_minimizeAction(0), m_minimizeAction(0),
m_zoomAction(0), m_zoomAction(0),
@@ -186,6 +188,7 @@ MainWindow::MainWindow() :
QCoreApplication::setOrganizationName(QLatin1String("Nokia")); QCoreApplication::setOrganizationName(QLatin1String("Nokia"));
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
QString baseName = qApp->style()->objectName(); QString baseName = qApp->style()->objectName();
#ifdef Q_WS_X11
if (baseName == "windows") { if (baseName == "windows") {
// Sometimes we get the standard windows 95 style as a fallback // Sometimes we get the standard windows 95 style as a fallback
// e.g. if we are running on a KDE4 desktop // e.g. if we are running on a KDE4 desktop
@@ -195,18 +198,19 @@ MainWindow::MainWindow() :
else else
baseName = "cleanlooks"; baseName = "cleanlooks";
} }
#endif
qApp->setStyle(new ManhattanStyle(baseName)); qApp->setStyle(new ManhattanStyle(baseName));
statusBar()->setProperty("p_styled", true); statusBar()->setProperty("p_styled", true);
} }
void MainWindow::toggleNavigation() void MainWindow::setSidebarVisible(bool visible)
{ {
if (NavigationWidgetPlaceHolder::current()) { if (NavigationWidgetPlaceHolder::current()) {
if (m_navigationWidget->isSuppressed()) { if (m_navigationWidget->isSuppressed() && visible) {
m_navigationWidget->setShown(true); m_navigationWidget->setShown(true);
m_navigationWidget->setSuppressed(false); m_navigationWidget->setSuppressed(false);
} else { } else {
m_navigationWidget->setShown(!m_navigationWidget->isShown()); m_navigationWidget->setShown(visible);
} }
} }
} }
@@ -398,7 +402,7 @@ void MainWindow::registerDefaultContainers()
medit->appendGroup(Constants::G_EDIT_UNDOREDO); medit->appendGroup(Constants::G_EDIT_UNDOREDO);
medit->appendGroup(Constants::G_EDIT_COPYPASTE); medit->appendGroup(Constants::G_EDIT_COPYPASTE);
medit->appendGroup(Constants::G_EDIT_SELECTALL); medit->appendGroup(Constants::G_EDIT_SELECTALL);
medit->appendGroup(Constants::G_EDIT_FORMAT); medit->appendGroup(Constants::G_EDIT_ADVANCED);
medit->appendGroup(Constants::G_EDIT_FIND); medit->appendGroup(Constants::G_EDIT_FIND);
medit->appendGroup(Constants::G_EDIT_OTHER); medit->appendGroup(Constants::G_EDIT_OTHER);
@@ -428,7 +432,7 @@ void MainWindow::registerDefaultContainers()
ac->appendGroup(Constants::G_HELP_ABOUT); ac->appendGroup(Constants::G_HELP_ABOUT);
} }
static Command *createSeparator(ActionManagerPrivate *am, QObject *parent, static Command *createSeparator(ActionManager *am, QObject *parent,
const QString &name, const QString &name,
const QList<int> &context) const QList<int> &context)
{ {
@@ -445,7 +449,6 @@ void MainWindow::registerDefaultActions()
ActionContainer *medit = am->actionContainer(Constants::M_EDIT); ActionContainer *medit = am->actionContainer(Constants::M_EDIT);
ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS);
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
Q_UNUSED(mwindow)
ActionContainer *mhelp = am->actionContainer(Constants::M_HELP); ActionContainer *mhelp = am->actionContainer(Constants::M_HELP);
// File menu separators // File menu separators
@@ -471,8 +474,8 @@ void MainWindow::registerDefaultActions()
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Find"), m_globalContext); cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Find"), m_globalContext);
medit->addAction(cmd, Constants::G_EDIT_FIND); medit->addAction(cmd, Constants::G_EDIT_FIND);
cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Format"), m_globalContext); cmd = createSeparator(am, this, QLatin1String("QtCreator.Edit.Sep.Advanced"), m_globalContext);
medit->addAction(cmd, Constants::G_EDIT_FORMAT); medit->addAction(cmd, Constants::G_EDIT_ADVANCED);
//Tools menu separators //Tools menu separators
cmd = createSeparator(am, this, QLatin1String("QtCreator.Tools.Sep.Options"), m_globalContext); cmd = createSeparator(am, this, QLatin1String("QtCreator.Tools.Sep.Options"), m_globalContext);
@@ -625,7 +628,7 @@ void MainWindow::registerDefaultActions()
// Toggle Sidebar Action // Toggle Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR), m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
tr("Toggle Sidebar"), this); tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true); m_toggleSideBarAction->setCheckable(true);
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext); cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@@ -633,11 +636,24 @@ void MainWindow::registerDefaultActions()
#else #else
cmd->setDefaultKeySequence(QKeySequence("Alt+0")); cmd->setDefaultKeySequence(QKeySequence("Alt+0"));
#endif #endif
connect(m_toggleSideBarAction, SIGNAL(triggered()), this, SLOT(toggleNavigation())); connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
m_toggleSideBarButton->setDefaultAction(cmd->action()); m_toggleSideBarButton->setDefaultAction(cmd->action());
mwindow->addAction(cmd, Constants::G_WINDOW_PANES); mwindow->addAction(cmd, Constants::G_WINDOW_PANES);
m_toggleSideBarAction->setEnabled(false); m_toggleSideBarAction->setEnabled(false);
#if !defined(Q_OS_MAC)
// Toggle Full Screen
m_toggleFullScreenAction = new QAction(tr("Toggle Fullscreen"), this);
m_toggleFullScreenAction->setCheckable(true);
m_toggleFullScreenAction->setChecked(false);
cmd = am->registerAction(m_toggleFullScreenAction,
Constants::TOGGLE_FULLSCREEN, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+F11"));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)),
this, SLOT(setFullScreen(bool)));
#endif
//About IDE Action //About IDE Action
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
tmpaction = new QAction(tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu tmpaction = new QAction(tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu
@@ -682,8 +698,8 @@ void MainWindow::openFile()
static QList<IFileFactory*> getNonEditorFileFactories() static QList<IFileFactory*> getNonEditorFileFactories()
{ {
const ICore *core = CoreImpl::instance(); const QList<IFileFactory*> allFileFactories =
const QList<IFileFactory*> allFileFactories = core->pluginManager()->getObjects<IFileFactory>(); ExtensionSystem::PluginManager::instance()->getObjects<IFileFactory>();
QList<IFileFactory*> nonEditorFileFactories; QList<IFileFactory*> nonEditorFileFactories;
foreach (IFileFactory *factory, allFileFactories) { foreach (IFileFactory *factory, allFileFactories) {
if (!qobject_cast<IEditorFactory *>(factory)) if (!qobject_cast<IEditorFactory *>(factory))
@@ -914,13 +930,18 @@ void MainWindow::changeEvent(QEvent *e)
qDebug() << "main window activated"; qDebug() << "main window activated";
emit windowActivated(); emit windowActivated();
} }
#ifdef Q_OS_MAC
} else if (e->type() == QEvent::WindowStateChange) { } else if (e->type() == QEvent::WindowStateChange) {
#ifdef Q_OS_MAC
bool minimized = isMinimized(); bool minimized = isMinimized();
if (debugMainWindow) if (debugMainWindow)
qDebug() << "main window state changed to minimized=" << minimized; qDebug() << "main window state changed to minimized=" << minimized;
m_minimizeAction->setEnabled(!minimized); m_minimizeAction->setEnabled(!minimized);
m_zoomAction->setEnabled(!minimized); m_zoomAction->setEnabled(!minimized);
#else
QWindowStateChangeEvent *ev =
static_cast<QWindowStateChangeEvent *>(e);
bool isFullScreen = (ev->oldState() & Qt::WindowFullScreen) != 0;
m_toggleFullScreenAction->setChecked(!isFullScreen);
#endif #endif
} }
} }
@@ -1110,3 +1131,19 @@ QPrinter *MainWindow::printer() const
m_printer = new QPrinter(QPrinter::HighResolution); m_printer = new QPrinter(QPrinter::HighResolution);
return m_printer; return m_printer;
} }
void MainWindow::setFullScreen(bool on)
{
if (bool(windowState() & Qt::WindowFullScreen) == on)
return;
if (on) {
setWindowState(windowState() | Qt::WindowFullScreen);
//statusBar()->hide();
//menuBar()->hide();
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen);
//menuBar()->show();
//statusBar()->show();
}
}

View File

@@ -137,6 +137,7 @@ public slots:
void newFile(); void newFile();
void openFileWith(); void openFileWith();
void exit(); void exit();
void setFullScreen(bool on);
QStringList showNewItemDialog(const QString &title, QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
@@ -157,7 +158,7 @@ private slots:
void aboutQtCreator(); void aboutQtCreator();
void aboutPlugins(); void aboutPlugins();
void updateFocusWidget(QWidget *old, QWidget *now); void updateFocusWidget(QWidget *old, QWidget *now);
void toggleNavigation(); void setSidebarVisible(bool visible);
void destroyVersionDialog(); void destroyVersionDialog();
private: private:
@@ -213,6 +214,7 @@ private:
QAction *m_exitAction; QAction *m_exitAction;
QAction *m_optionsAction; QAction *m_optionsAction;
QAction *m_toggleSideBarAction; QAction *m_toggleSideBarAction;
QAction *m_toggleFullScreenAction;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QAction *m_minimizeAction; QAction *m_minimizeAction;
QAction *m_zoomAction; QAction *m_zoomAction;

View File

@@ -46,6 +46,8 @@
#include <coreplugin/imode.h> #include <coreplugin/imode.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -215,7 +217,7 @@ void ModeManager::currentTabChanged(int index)
// FIXME: This hardcoded context update is required for the Debug and Edit modes, since // FIXME: This hardcoded context update is required for the Debug and Edit modes, since
// they use the editor widget, which is already a context widget so the main window won't // they use the editor widget, which is already a context widget so the main window won't
// go further up the parent tree to find the mode context. // go further up the parent tree to find the mode context.
CoreImpl *core = CoreImpl::instance(); ICore *core = ICore::instance();
foreach (const int context, m_addedContexts) foreach (const int context, m_addedContexts)
core->removeAdditionalContext(context); core->removeAdditionalContext(context);

View File

@@ -39,15 +39,16 @@
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <extensionsystem/ExtensionSystemInterfaces> #include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QToolButton>
#include <QtGui/QToolBar>
#include <QtGui/QResizeEvent> #include <QtGui/QResizeEvent>
#include <QtCore/QDebug> #include <QtGui/QToolBar>
#include <QtCore/QSettings> #include <QtGui/QToolButton>
Q_DECLARE_METATYPE(Core::INavigationWidgetFactory *) Q_DECLARE_METATYPE(Core::INavigationWidgetFactory *)
@@ -315,8 +316,8 @@ void NavigationWidget::objectAdded(QObject * obj)
if (!factory) if (!factory)
return; return;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); ICore *core = ICore::instance();
Core::ActionManager *am = core->actionManager(); ActionManager *am = core->actionManager();
QList<int> navicontext = QList<int>() << core->uniqueIDManager()-> QList<int> navicontext = QList<int>() << core->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE); uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE);
@@ -398,9 +399,8 @@ NavigationSubWidget::~NavigationSubWidget()
void NavigationSubWidget::setCurrentIndex(int index) void NavigationSubWidget::setCurrentIndex(int index)
{ {
// Remove toolbutton // Remove toolbutton
foreach (QWidget *w, m_additionalToolBarWidgets) { foreach (QWidget *w, m_additionalToolBarWidgets)
delete w; delete w;
}
// Remove old Widget // Remove old Widget
delete m_navigationWidget; delete m_navigationWidget;
@@ -465,8 +465,7 @@ void NavigationSubWidget::setFactory(INavigationWidgetFactory *factory)
void NavigationSubWidget::setFactory(const QString &name) void NavigationSubWidget::setFactory(const QString &name)
{ {
for (int i = 0; i < m_navigationComboBox->count(); ++i) for (int i = 0; i < m_navigationComboBox->count(); ++i) {
{
INavigationWidgetFactory *factory = INavigationWidgetFactory *factory =
m_navigationComboBox->itemData(i).value<INavigationWidgetFactory *>(); m_navigationComboBox->itemData(i).value<INavigationWidgetFactory *>();
if (factory->displayName() == name) if (factory->displayName() == name)

View File

@@ -42,12 +42,13 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/editorgroup.h> #include <coreplugin/editormanager/editorgroup.h>
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QFocusEvent> #include <QtGui/QFocusEvent>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QPainter> #include <QtGui/QPainter>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
@@ -393,8 +394,7 @@ void OutputPane::showPage(int idx, bool focus)
if (!OutputPanePlaceHolder::m_current) { if (!OutputPanePlaceHolder::m_current) {
// In this mode we don't have a placeholder // In this mode we don't have a placeholder
// switch to the output mode and switch the page // switch to the output mode and switch the page
ICore *core = m_pluginManager->getObject<ICore>(); ICore::instance()->modeManager()->activateMode(Constants::MODE_OUTPUT);
core->modeManager()->activateMode(Constants::MODE_OUTPUT);
ensurePageVisible(idx); ensurePageVisible(idx);
} else { } else {
// else we make that page visible // else we make that page visible
@@ -409,14 +409,13 @@ void OutputPane::showPage(int idx, bool focus)
void OutputPane::togglePage(bool focus) void OutputPane::togglePage(bool focus)
{ {
int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender())); int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender()));
if(OutputPanePlaceHolder::m_current if (OutputPanePlaceHolder::m_current
&& OutputPanePlaceHolder::m_current->isVisible() && OutputPanePlaceHolder::m_current->isVisible()
&& m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) { && m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) {
slotHide(); slotHide();
} else { } else {
showPage(idx, focus); showPage(idx, focus);
} }
} }
void OutputPane::setCloseable(bool b) void OutputPane::setCloseable(bool b)

View File

@@ -35,7 +35,6 @@
#include "qworkbench_wrapper.h" #include "qworkbench_wrapper.h"
#include "metatypedeclarations.h" #include "metatypedeclarations.h"
#include <extensionsystem/ExtensionSystemInterfaces>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <interface_wrap_helpers.h> #include <interface_wrap_helpers.h>
#include <wrap_helpers.h> #include <wrap_helpers.h>

View File

@@ -40,21 +40,13 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>
#include <extensionsystem/ExtensionSystemInterfaces>
#include <aggregation/aggregate.h> #include <aggregation/aggregate.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QAction>
#include <QtGui/QActionGroup>
#include <QtGui/QComboBox>
#include <QtGui/QDockWidget>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QStackedWidget>
#include <QtGui/QStatusBar> #include <QtGui/QStatusBar>
#include <QtGui/QToolButton>
#include <QtGui/QVBoxLayout>
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;

View File

@@ -38,17 +38,18 @@
#include "splitter.h" #include "splitter.h"
#include "view.h" #include "view.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <texteditor/itexteditor.h> #include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h> #include <coreplugin/messageoutputwindow.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/itexteditor.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QApplication> #include <QtGui/QApplication>
@@ -62,8 +63,6 @@ using namespace CodePaster;
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
Core::ICore *gCoreInstance = NULL;
CodepasterPlugin::CodepasterPlugin() CodepasterPlugin::CodepasterPlugin()
: m_settingsPage(0), m_fetcher(0), m_poster(0) : m_settingsPage(0), m_fetcher(0), m_poster(0)
{ {
@@ -83,11 +82,9 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(error_message); Q_UNUSED(error_message);
gCoreInstance = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create the globalcontext list to register actions accordingly // Create the globalcontext list to register actions accordingly
QList<int> globalcontext; QList<int> globalcontext;
globalcontext << gCoreInstance->uniqueIDManager()-> globalcontext << ICore::instance()->uniqueIDManager()->
uniqueIdentifier(Core::Constants::C_GLOBAL); uniqueIdentifier(Core::Constants::C_GLOBAL);
// Create the settings Page // Create the settings Page
@@ -95,7 +92,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
addObject(m_settingsPage); addObject(m_settingsPage);
//register actions //register actions
Core::ActionManager *actionManager = gCoreInstance->actionManager(); Core::ActionManager *actionManager = ICore::instance()->actionManager();
Core::ActionContainer *toolsContainer = Core::ActionContainer *toolsContainer =
actionManager->actionContainer(Core::Constants::M_TOOLS); actionManager->actionContainer(Core::Constants::M_TOOLS);
@@ -132,7 +129,7 @@ void CodepasterPlugin::post()
{ {
if (m_poster) if (m_poster)
delete m_poster; delete m_poster;
IEditor* editor = gCoreInstance->editorManager()->currentEditor(); IEditor* editor = ICore::instance()->editorManager()->currentEditor();
ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor); ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor);
if (!textEditor) if (!textEditor)
return; return;
@@ -243,7 +240,7 @@ void CustomFetcher::customRequestFinished(int, bool error)
QByteArray data = body(); QByteArray data = body();
if (!m_listWidget) { if (!m_listWidget) {
QString title = QString::fromLatin1("Code Paster: %1").arg(m_id); QString title = QString::fromLatin1("Code Paster: %1").arg(m_id);
gCoreInstance->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR ICore::instance()->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR
, &title, data); , &title, data);
} else { } else {
m_listWidget->clear(); m_listWidget->clear();
@@ -283,7 +280,7 @@ void CustomPoster::customRequestFinished(int, bool error)
if (!error) { if (!error) {
if (m_copy) if (m_copy)
QApplication::clipboard()->setText(pastedUrl()); QApplication::clipboard()->setText(pastedUrl());
gCoreInstance->messageManager()->printToOutputPane(pastedUrl(), m_output); ICore::instance()->messageManager()->printToOutputPane(pastedUrl(), m_output);
} else } else
QMessageBox::warning(0, "Code Paster Error", "Some error occured while posting", QMessageBox::Ok); QMessageBox::warning(0, "Code Paster Error", "Some error occured while posting", QMessageBox::Ok);
#if 0 // Figure out how to access #if 0 // Figure out how to access

View File

@@ -40,8 +40,8 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/icorelistener.h> #include <coreplugin/icorelistener.h>
#include <projectexplorer/ProjectExplorerInterfaces>
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorer.h>
#include <QtCore/QObject> #include <QtCore/QObject>

View File

@@ -34,7 +34,6 @@
#include "settingspage.h" #include "settingspage.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
@@ -46,10 +45,7 @@ using namespace CodePaster;
SettingsPage::SettingsPage() SettingsPage::SettingsPage()
{ {
Core::ICore *coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); m_settings = Core::ICore::instance()->settings();
if (coreIFace)
m_settings = coreIFace->settings();
if (m_settings) { if (m_settings) {
m_settings->beginGroup("CodePaster"); m_settings->beginGroup("CodePaster");
m_username = m_settings->value("UserName", qgetenv("USER")).toString(); m_username = m_settings->value("UserName", qgetenv("USER")).toString();

View File

@@ -42,9 +42,6 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QTextStream> #include <QtCore/QTextStream>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QWizard> #include <QtGui/QWizard>
@@ -124,8 +121,8 @@ CppClassWizardParameters CppClassWizardDialog::parameters() const
// ========= CppClassWizard ========= // ========= CppClassWizard =========
CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters &parameters, CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters &parameters,
Core::ICore *core, QObject *parent) : QObject *parent)
Core::BaseFileWizard(parameters, core, parent) : Core::BaseFileWizard(parameters, parent)
{ {
} }

View File

@@ -40,16 +40,13 @@
#include <QtGui/QWizardPage> #include <QtGui/QWizardPage>
#include <QtGui/QWizard> #include <QtGui/QWizard>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QComboBox;
QT_END_NAMESPACE
namespace Core { namespace Core {
namespace Utils { namespace Utils {
class NewClassWidget;
} class NewClassWidget;
}
} // namespace Utils
} // namespace Core
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {
@@ -75,7 +72,8 @@ private:
}; };
struct CppClassWizardParameters { struct CppClassWizardParameters
{
QString className; QString className;
QString headerFile; QString headerFile;
QString sourceFile; QString sourceFile;
@@ -83,9 +81,10 @@ struct CppClassWizardParameters {
QString path; QString path;
}; };
class CppClassWizardDialog : public QWizard { class CppClassWizardDialog : public QWizard
Q_DISABLE_COPY(CppClassWizardDialog) {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(CppClassWizardDialog)
public: public:
explicit CppClassWizardDialog(const QString &sourceSuffix, explicit CppClassWizardDialog(const QString &sourceSuffix,
const QString &headerSuffix, const QString &headerSuffix,
@@ -104,7 +103,7 @@ class CppClassWizard : public Core::BaseFileWizard
Q_OBJECT Q_OBJECT
public: public:
explicit CppClassWizard(const Core::BaseFileWizardParameters &parameters, explicit CppClassWizard(const Core::BaseFileWizardParameters &parameters,
Core::ICore *core, QObject *parent = 0); QObject *parent = 0);
protected: protected:
virtual QWizard *createWizardDialog(QWidget *parent, virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -58,6 +58,7 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
@@ -65,21 +66,17 @@
#include <texteditor/textblockiterator.h> #include <texteditor/textblockiterator.h>
#include <indenter.h> #include <indenter.h>
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QTime> #include <QtCore/QTime>
#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QKeyEvent> #include <QtGui/QHeaderView>
#include <QtGui/QLayout> #include <QtGui/QLayout>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QShortcut> #include <QtGui/QShortcut>
#include <QtGui/QTextEdit> #include <QtGui/QTextEdit>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QTreeView> #include <QtGui/QTreeView>
#include <QtGui/QHeaderView>
#include <QtGui/QStringListModel>
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace CppEditor::Internal; using namespace CppEditor::Internal;
@@ -142,15 +139,14 @@ QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &contex
CPPEditorEditable::CPPEditorEditable(CPPEditor *editor) CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
: BaseTextEditorEditable(editor) : BaseTextEditorEditable(editor)
{ {
Core::ICore *core = CppPlugin::core(); Core::ICore *core = Core::ICore::instance();
m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
} }
CPPEditor::CPPEditor(QWidget *parent) : CPPEditor::CPPEditor(QWidget *parent)
TextEditor::BaseTextEditor(parent), : TextEditor::BaseTextEditor(parent)
m_core(CppPlugin::core())
{ {
setParenthesesMatchingEnabled(true); setParenthesesMatchingEnabled(true);
setMarksVisible(true); setMarksVisible(true);
@@ -172,7 +168,8 @@ CPPEditor::CPPEditor(QWidget *parent) :
/*ambiguousMember=*/ 0, Qt::WidgetShortcut); /*ambiguousMember=*/ 0, Qt::WidgetShortcut);
#endif #endif
m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); m_modelManager = ExtensionSystem::PluginManager::instance()
->getObject<CppTools::CppModelManagerInterface>();
if (m_modelManager) { if (m_modelManager) {
connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),

View File

@@ -38,10 +38,9 @@
using namespace CppEditor::Internal; using namespace CppEditor::Internal;
CPPEditorActionHandler::CPPEditorActionHandler(Core::ICore *core, CPPEditorActionHandler::CPPEditorActionHandler(const QString &context,
const QString &context,
uint optionalActions) uint optionalActions)
: TextEditor::TextEditorActionHandler(core, context, optionalActions) : TextEditor::TextEditorActionHandler(context, optionalActions)
{ } { }
CPPEditorActionHandler::~CPPEditorActionHandler() CPPEditorActionHandler::~CPPEditorActionHandler()

View File

@@ -44,8 +44,7 @@ class CPPEditorActionHandler : public TextEditor::TextEditorActionHandler
Q_OBJECT Q_OBJECT
public: public:
CPPEditorActionHandler(Core::ICore *core, CPPEditorActionHandler(const QString &context,
const QString &context,
uint optionalActions = None); uint optionalActions = None);
virtual ~CPPEditorActionHandler(); virtual ~CPPEditorActionHandler();

View File

@@ -46,9 +46,8 @@ enum { debugWizard = 0 };
CppFileWizard::CppFileWizard(const BaseFileWizardParameters &parameters, CppFileWizard::CppFileWizard(const BaseFileWizardParameters &parameters,
FileType type, FileType type,
Core::ICore *core,
QObject *parent) : QObject *parent) :
Core::StandardFileWizard(parameters, core, parent), Core::StandardFileWizard(parameters, parent),
m_type(type) m_type(type)
{ {
} }

View File

@@ -48,9 +48,9 @@ class CppFileWizard : public Core::StandardFileWizard
public: public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters; typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
explicit CppFileWizard(const BaseFileWizardParameters &parameters, CppFileWizard(const BaseFileWizardParameters &parameters,
FileType type, FileType type,
Core::ICore *core, QObject *parent = 0); QObject *parent = 0);
protected: protected:
static QString toAlphaNum(const QString &s); static QString toAlphaNum(const QString &s);

View File

@@ -39,6 +39,7 @@
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <debugger/debuggerconstants.h> #include <debugger/debuggerconstants.h>
@@ -55,23 +56,27 @@
#include <cplusplus/TypeOfExpression.h> #include <cplusplus/TypeOfExpression.h>
#include <cplusplus/SimpleLexer.h> #include <cplusplus/SimpleLexer.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QSettings>
#include <QtGui/QToolTip> #include <QtGui/QToolTip>
#include <QtGui/QTextCursor> #include <QtGui/QTextCursor>
#include <QtGui/QTextBlock> #include <QtGui/QTextBlock>
#include <QtHelp/QHelpEngineCore> #include <QtHelp/QHelpEngineCore>
#include <QtCore/QtCore>
using namespace CppEditor::Internal; using namespace CppEditor::Internal;
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace Core;
CppHoverHandler::CppHoverHandler(QObject *parent) CppHoverHandler::CppHoverHandler(QObject *parent)
: QObject(parent) : QObject(parent)
, m_core(CppPlugin::core())
, m_helpEngineNeedsSetup(false) , m_helpEngineNeedsSetup(false)
{ {
m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
QFileInfo fi(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings()->fileName()); ICore *core = ICore::instance();
QFileInfo fi(core->settings()->fileName());
// FIXME shouldn't the help engine create the directory if it doesn't exist? // FIXME shouldn't the help engine create the directory if it doesn't exist?
QDir directory(fi.absolutePath()+"/qtcreator"); QDir directory(fi.absolutePath()+"/qtcreator");
if (!directory.exists()) if (!directory.exists())
@@ -86,7 +91,7 @@ CppHoverHandler::CppHoverHandler(QObject *parent)
m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0; m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0;
// Listen for editor opened events in order to connect to tooltip/helpid requests // Listen for editor opened events in order to connect to tooltip/helpid requests
connect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), connect(core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)),
this, SLOT(editorOpened(Core::IEditor *))); this, SLOT(editorOpened(Core::IEditor *)));
} }
@@ -95,7 +100,7 @@ void CppHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int p
updateHelpIdAndTooltip(editor, pos); updateHelpIdAndTooltip(editor, pos);
} }
void CppHoverHandler::editorOpened(Core::IEditor *editor) void CppHoverHandler::editorOpened(IEditor *editor)
{ {
CPPEditorEditable *cppEditor = qobject_cast<CPPEditorEditable *>(editor); CPPEditorEditable *cppEditor = qobject_cast<CPPEditorEditable *>(editor);
if (!cppEditor) if (!cppEditor)
@@ -113,9 +118,10 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
if (!editor) if (!editor)
return; return;
const int dbgcontext = m_core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER); ICore *core = ICore::instance();
const int dbgcontext = core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER);
if (m_core->hasContext(dbgcontext)) if (core->hasContext(dbgcontext))
return; return;
updateHelpIdAndTooltip(editor, pos); updateHelpIdAndTooltip(editor, pos);

View File

@@ -42,7 +42,6 @@ class QPoint;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
class ICore;
class IEditor; class IEditor;
} }
@@ -74,7 +73,6 @@ private slots:
private: private:
void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos); void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos);
Core::ICore *m_core;
CppTools::CppModelManagerInterface *m_modelManager; CppTools::CppModelManagerInterface *m_modelManager;
QHelpEngineCore *m_helpEngine; QHelpEngineCore *m_helpEngine;
QString m_helpId; QString m_helpId;

View File

@@ -40,6 +40,7 @@
#include "cppfilewizard.h" #include "cppfilewizard.h"
#include "cpphoverhandler.h" #include "cpphoverhandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
@@ -63,7 +64,7 @@ static const char *sourceSuffixKeyC = "CppEditor/SourceSuffix";
using namespace CppEditor::Internal; using namespace CppEditor::Internal;
///////////////////////////////// CppPluginEditorFactory ////////////////////////////////// //////////////////////////// CppPluginEditorFactory /////////////////////////////
CppPluginEditorFactory::CppPluginEditorFactory(CppPlugin *owner) : CppPluginEditorFactory::CppPluginEditorFactory(CppPlugin *owner) :
m_kind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND)), m_kind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND)),
@@ -87,7 +88,7 @@ QString CppPluginEditorFactory::kind() const
Core::IFile *CppPluginEditorFactory::open(const QString &fileName) Core::IFile *CppPluginEditorFactory::open(const QString &fileName)
{ {
Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind());
return iface ? iface->file() : 0; return iface ? iface->file() : 0;
} }
@@ -110,7 +111,6 @@ QStringList CppPluginEditorFactory::mimeTypes() const
CppPlugin *CppPlugin::m_instance = 0; CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() : CppPlugin::CppPlugin() :
m_core(0),
m_actionHandler(0), m_actionHandler(0),
m_factory(0) m_factory(0)
{ {
@@ -130,11 +130,6 @@ CppPlugin *CppPlugin::instance()
return m_instance; return m_instance;
} }
Core::ICore *CppPlugin::core()
{
return m_instance->m_core;
}
void CppPlugin::initializeEditor(CPPEditor *editor) void CppPlugin::initializeEditor(CPPEditor *editor)
{ {
// common actions // common actions
@@ -159,14 +154,13 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
// auto completion // auto completion
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)), connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
TextEditor::Internal::CompletionSupport::instance(core()), SLOT(autoComplete(ITextEditable*, bool))); TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(ITextEditable*, bool)));
} }
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
typedef TextEditor::TextEditorActionHandler TextEditorActionHandler; Core::ICore *core = Core::ICore::instance();
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false; return false;
m_factory = new CppPluginEditorFactory(this); m_factory = new CppPluginEditorFactory(this);
@@ -180,21 +174,21 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
wizardParameters.setTrCategory(tr("C++")); wizardParameters.setTrCategory(tr("C++"));
wizardParameters.setDescription(tr("Creates a new C++ header file.")); wizardParameters.setDescription(tr("Creates a new C++ header file."));
wizardParameters.setName(tr("C++ Header File")); wizardParameters.setName(tr("C++ Header File"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, m_core)); addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
wizardParameters.setDescription(tr("Creates a new C++ source file.")); wizardParameters.setDescription(tr("Creates a new C++ source file."));
wizardParameters.setName(tr("C++ Source File")); wizardParameters.setName(tr("C++ Source File"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, m_core)); addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
wizardParameters.setKind(Core::IWizard::ClassWizard); wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setName(tr("C++ Class")); wizardParameters.setName(tr("C++ Class"));
wizardParameters.setDescription(tr("Creates a header and a source file for a new class.")); wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
addAutoReleasedObject(new CppClassWizard(wizardParameters, m_core)); addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
QList<int> context; QList<int> context;
context << m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = core->actionManager();
am->createMenu(CppEditor::Constants::M_CONTEXT); am->createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd; Core::Command *cmd;
@@ -217,22 +211,21 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd); am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
m_actionHandler = new CPPEditorActionHandler(m_core, m_actionHandler = new CPPEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll); | TextEditor::TextEditorActionHandler::UnCollapseAll);
// Check Suffixes // Check Suffixes
if (const QSettings *settings = m_core->settings()) { if (const QSettings *settings = core->settings()) {
const QString headerSuffixKey = QLatin1String(headerSuffixKeyC); const QString headerSuffixKey = QLatin1String(headerSuffixKeyC);
if (settings->contains(headerSuffixKey)) { if (settings->contains(headerSuffixKey)) {
const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString(); const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString();
if (!headerSuffix.isEmpty()) if (!headerSuffix.isEmpty())
m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix); core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix);
const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString(); const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString();
if (!sourceSuffix.isEmpty()) if (!sourceSuffix.isEmpty())
m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix);
} }
} }
return true; return true;
@@ -245,7 +238,8 @@ void CppPlugin::extensionsInitialized()
void CppPlugin::switchDeclarationDefinition() void CppPlugin::switchDeclarationDefinition()
{ {
CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) { if (editor) {
editor->switchDeclarationDefinition(); editor->switchDeclarationDefinition();
} }
@@ -253,7 +247,8 @@ void CppPlugin::switchDeclarationDefinition()
void CppPlugin::jumpToDefinition() void CppPlugin::jumpToDefinition()
{ {
CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); Core::ICore *core = Core::ICore::instance();
CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget());
if (editor) { if (editor) {
editor->jumpToDefinition(); editor->jumpToDefinition();
} }

View File

@@ -65,7 +65,6 @@ public:
~CppPlugin(); ~CppPlugin();
static CppPlugin *instance(); static CppPlugin *instance();
static Core::ICore *core();
bool initialize(const QStringList &arguments, QString *error_message = 0); bool initialize(const QStringList &arguments, QString *error_message = 0);
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -51,6 +51,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <TranslationUnit.h> #include <TranslationUnit.h>
@@ -69,8 +70,6 @@
#include <QtCore/QMutexLocker> #include <QtCore/QMutexLocker>
#include <QtCore/QTime> #include <QtCore/QTime>
//#include <QtGui/QPlainTextEdit>
using namespace CppTools; using namespace CppTools;
using namespace CppTools::Internal; using namespace CppTools::Internal;
using namespace CPlusPlus; using namespace CPlusPlus;
@@ -434,10 +433,10 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
modified within Workbench. modified within Workbench.
*/ */
CppModelManager::CppModelManager(QObject *parent) : CppModelManager::CppModelManager(QObject *parent)
CppModelManagerInterface(parent), : CppModelManagerInterface(parent)
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>())
{ {
m_core = Core::ICore::instance(); // FIXME
m_dirty = true; m_dirty = true;
m_projectExplorer = ExtensionSystem::PluginManager::instance() m_projectExplorer = ExtensionSystem::PluginManager::instance()

View File

@@ -46,7 +46,7 @@ namespace ProjectExplorer {
namespace CppTools { namespace CppTools {
class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -48,8 +48,9 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -64,10 +65,8 @@ enum { debug = 0 };
CppToolsPlugin *CppToolsPlugin::m_instance = 0; CppToolsPlugin *CppToolsPlugin::m_instance = 0;
CppToolsPlugin::CppToolsPlugin() : CppToolsPlugin::CppToolsPlugin()
m_core(0), : m_context(-1), m_modelManager(0)
m_context(-1),
m_modelManager(0)
{ {
m_instance = this; m_instance = this;
} }
@@ -78,21 +77,23 @@ CppToolsPlugin::~CppToolsPlugin()
m_modelManager = 0; // deleted automatically m_modelManager = 0; // deleted automatically
} }
bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *) bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
Core::ActionManager *am = m_core->actionManager(); Q_UNUSED(error);
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
// Objects // Objects
m_modelManager = new CppModelManager(this); m_modelManager = new CppModelManager(this);
addAutoReleasedObject(m_modelManager); addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager, m_core); m_completion = new CppCodeCompletion(m_modelManager, core);
addAutoReleasedObject(m_completion); addAutoReleasedObject(m_completion);
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager, CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
m_core->editorManager()); core->editorManager());
addAutoReleasedObject(quickOpenFilter); addAutoReleasedObject(quickOpenFilter);
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager())); addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager())); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager()));
addAutoReleasedObject(new CompletionSettingsPage(m_completion)); addAutoReleasedObject(new CompletionSettingsPage(m_completion));
// Menus // Menus
@@ -104,7 +105,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
mtools->addMenu(mcpptools); mtools->addMenu(mcpptools);
// Actions // Actions
m_context = m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
QList<int> context = QList<int>() << m_context; QList<int> context = QList<int>() << m_context;
QAction *switchAction = new QAction(tr("Switch Header/Source"), this); QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
@@ -114,7 +115,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));
// Restore settings // Restore settings
QSettings *settings = m_core->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("CppTools"));
settings->beginGroup(QLatin1String("Completion")); settings->beginGroup(QLatin1String("Completion"));
const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool(); const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool();
@@ -134,7 +135,7 @@ void CppToolsPlugin::extensionsInitialized()
void CppToolsPlugin::shutdown() void CppToolsPlugin::shutdown()
{ {
// Save settings // Save settings
QSettings *settings = m_core->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("CppTools"));
settings->beginGroup(QLatin1String("Completion")); settings->beginGroup(QLatin1String("Completion"));
settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive); settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive);
@@ -146,14 +147,12 @@ void CppToolsPlugin::shutdown()
void CppToolsPlugin::switchHeaderSource() void CppToolsPlugin::switchHeaderSource()
{ {
if (!m_core) Core::EditorManager *editorManager = Core::ICore::instance()->editorManager();
return; Core::IEditor *editor = editorManager->currentEditor();
Core::IEditor *editor = m_core->editorManager()->currentEditor();
QString otherFile = correspondingHeaderOrSource(editor->file()->fileName()); QString otherFile = correspondingHeaderOrSource(editor->file()->fileName());
if (!otherFile.isEmpty()) { if (!otherFile.isEmpty()) {
m_core->editorManager()->openEditor(otherFile); editorManager->openEditor(otherFile);
m_core->editorManager()->ensureEditorManagerVisible(); editorManager->ensureEditorManagerVisible();
} }
} }
@@ -221,7 +220,7 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas
QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) const QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) const
{ {
const Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); const Core::ICore *core = Core::ICore::instance();
const Core::MimeDatabase *mimeDatase = core->mimeDatabase(); const Core::MimeDatabase *mimeDatase = core->mimeDatabase();
ProjectExplorer::ProjectExplorerPlugin *explorer = ProjectExplorer::ProjectExplorerPlugin *explorer =
ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();

View File

@@ -35,17 +35,13 @@
#define CPPTOOLS_H #define CPPTOOLS_H
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/ProjectExplorerInterfaces> #include <projectexplorer/projectexplorer.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFileInfo; class QFileInfo;
class QDir; class QDir;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
@@ -75,7 +71,6 @@ private:
QString correspondingHeaderOrSourceI(const QString &fileName) const; QString correspondingHeaderOrSourceI(const QString &fileName) const;
QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const; QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const;
Core::ICore *m_core;
int m_context; int m_context;
CppModelManager *m_modelManager; CppModelManager *m_modelManager;
CppCodeCompletion *m_completion; CppCodeCompletion *m_completion;

View File

@@ -26,11 +26,11 @@ HEADERS += attachexternaldialog.h \
disassemblerwindow.h \ disassemblerwindow.h \
gdbengine.h \ gdbengine.h \
gdbmi.h \ gdbmi.h \
gdboptionpage.h \
idebuggerengine.h \ idebuggerengine.h \
imports.h \ imports.h \
moduleshandler.h \ moduleshandler.h \
moduleswindow.h \ moduleswindow.h \
outputcollector.h \
procinterrupt.h \ procinterrupt.h \
registerhandler.h \ registerhandler.h \
registerwindow.h \ registerwindow.h \
@@ -55,10 +55,9 @@ SOURCES += attachexternaldialog.cpp \
disassemblerwindow.cpp \ disassemblerwindow.cpp \
gdbengine.cpp \ gdbengine.cpp \
gdbmi.cpp \ gdbmi.cpp \
gdboptionpage.cpp \
gdbengine.h \
moduleshandler.cpp \ moduleshandler.cpp \
moduleswindow.cpp \ moduleswindow.cpp \
outputcollector.cpp \
procinterrupt.cpp \ procinterrupt.cpp \
registerhandler.cpp \ registerhandler.cpp \
registerwindow.cpp \ registerwindow.cpp \

View File

@@ -86,6 +86,18 @@ using namespace Debugger::Constants;
static const QString tooltipIName = "tooltip"; static const QString tooltipIName = "tooltip";
DebuggerSettings::DebuggerSettings()
{
m_autoRun = false;
m_autoQuit = false;
m_skipKnownFrames = false;
m_debugDumpers = false;
m_useToolTips = false;
m_useTerminal = false;
m_useCustomDumpers = true;
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// BreakByFunctionDialog // BreakByFunctionDialog
@@ -322,56 +334,6 @@ void DebuggerManager::init()
m_breakAtMainAction = new QAction(this); m_breakAtMainAction = new QAction(this);
m_breakAtMainAction->setText(tr("Set Breakpoint at Function 'main'")); m_breakAtMainAction->setText(tr("Set Breakpoint at Function 'main'"));
m_debugDumpersAction = new QAction(this);
m_debugDumpersAction->setText(tr("Debug Custom Dumpers"));
m_debugDumpersAction->setToolTip(tr("This is an internal tool to "
"make debugging the Custom Data Dumper code easier. "
"Using this action is in general not needed unless you "
"want do debug Qt Creator itself."));
m_debugDumpersAction->setCheckable(true);
m_skipKnownFramesAction = new QAction(this);
m_skipKnownFramesAction->setText(tr("Skip Known Frames When Stepping"));
m_skipKnownFramesAction->setToolTip(tr("After checking this option"
"'Step Into' combines in certain situations several steps, "
"leading to 'less noisy' debugging. So will, e.g., the atomic "
"reference counting code be skipped, and a single 'Step Into' "
"for a signal emission will end up directly in the slot connected "
"to it"));
m_skipKnownFramesAction->setCheckable(true);
m_useCustomDumpersAction = new QAction(this);
m_useCustomDumpersAction->setText(tr("Use Custom Display for Qt Objects"));
m_useCustomDumpersAction->setToolTip(tr("Checking this will make the debugger "
"try to use code to format certain data (QObject, QString, ...) nicely. "));
m_useCustomDumpersAction->setCheckable(true);
m_useCustomDumpersAction->setChecked(true);
m_useFastStartAction = new QAction(this);
m_useFastStartAction->setText(tr("Fast Debugger Start"));
m_useFastStartAction->setToolTip(tr("Checking this will make the debugger "
"start fast by loading only very few debug symbols on start up. This "
"might lead to situations where breakpoints can not be set properly. "
"So uncheck this option if you experience breakpoint related problems."));
m_useFastStartAction->setCheckable(true);
m_useFastStartAction->setChecked(true);
m_useToolTipsAction = new QAction(this);
m_useToolTipsAction->setText(tr("Use Tooltips While Debugging"));
m_useToolTipsAction->setToolTip(tr("Checking this will make enable "
"tooltips for variable values during debugging. Since this can slow "
"down debugging and does not provide reliable information as it does "
"not use scope information, it is switched off by default."));
m_useToolTipsAction->setCheckable(true);
m_useToolTipsAction->setChecked(false);
// FIXME
m_useFastStartAction->setChecked(false);
m_useFastStartAction->setEnabled(false);
m_dumpLogAction = new QAction(this);
m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
m_watchAction = new QAction(this); m_watchAction = new QAction(this);
m_watchAction->setText(tr("Add to Watch Window")); m_watchAction->setText(tr("Add to Watch Window"));
@@ -416,14 +378,6 @@ void DebuggerManager::init()
connect(m_breakAtMainAction, SIGNAL(triggered()), connect(m_breakAtMainAction, SIGNAL(triggered()),
this, SLOT(breakAtMain())); this, SLOT(breakAtMain()));
connect(m_useFastStartAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_useCustomDumpersAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_skipKnownFramesAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_dumpLogAction, SIGNAL(triggered()),
this, SLOT(dumpLog()));
connect(m_statusTimer, SIGNAL(timeout()), connect(m_statusTimer, SIGNAL(timeout()),
this, SLOT(clearStatusMessage())); this, SLOT(clearStatusMessage()));
@@ -636,9 +590,9 @@ void DebuggerManager::notifyInferiorPidChanged(int pid)
emit inferiorPidChanged(pid); emit inferiorPidChanged(pid);
} }
void DebuggerManager::showApplicationOutput(const QString &prefix, const QString &str) void DebuggerManager::showApplicationOutput(const QString &str)
{ {
emit applicationOutputAvailable(prefix, str); emit applicationOutputAvailable(str);
} }
void DebuggerManager::shutdown() void DebuggerManager::shutdown()
@@ -947,16 +901,6 @@ void DebuggerManager::loadSessionData()
{ {
m_breakHandler->loadSessionData(); m_breakHandler->loadSessionData();
m_watchHandler->loadSessionData(); m_watchHandler->loadSessionData();
QVariant value;
querySessionValue(QLatin1String("UseFastStart"), &value);
m_useFastStartAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseToolTips"), &value);
m_useToolTipsAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
m_skipKnownFramesAction->setChecked(value.toBool());
engine()->loadSessionData(); engine()->loadSessionData();
} }
@@ -964,15 +908,6 @@ void DebuggerManager::saveSessionData()
{ {
m_breakHandler->saveSessionData(); m_breakHandler->saveSessionData();
m_watchHandler->saveSessionData(); m_watchHandler->saveSessionData();
setSessionValue(QLatin1String("UseFastStart"),
m_useFastStartAction->isChecked());
setSessionValue(QLatin1String("UseToolTips"),
m_useToolTipsAction->isChecked());
setSessionValue(QLatin1String("UseCustomDumpers"),
m_useCustomDumpersAction->isChecked());
setSessionValue(QLatin1String("SkipKnownFrames"),
m_skipKnownFramesAction->isChecked());
engine()->saveSessionData(); engine()->saveSessionData();
} }
@@ -1139,22 +1074,22 @@ void DebuggerManager::setBusyCursor(bool busy)
bool DebuggerManager::skipKnownFrames() const bool DebuggerManager::skipKnownFrames() const
{ {
return m_skipKnownFramesAction->isChecked(); return m_settings.m_skipKnownFrames;
} }
bool DebuggerManager::debugDumpers() const bool DebuggerManager::debugDumpers() const
{ {
return m_debugDumpersAction->isChecked(); return m_settings.m_debugDumpers;
} }
bool DebuggerManager::useCustomDumpers() const bool DebuggerManager::useCustomDumpers() const
{ {
return m_useCustomDumpersAction->isChecked(); return m_settings.m_useCustomDumpers;
} }
bool DebuggerManager::useFastStart() const bool DebuggerManager::useFastStart() const
{ {
return 0; // && m_useFastStartAction->isChecked(); return 0; // && m_settings.m_useFastStart;
} }
void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,

View File

@@ -166,9 +166,9 @@ private:
virtual ThreadsHandler *threadsHandler() = 0; virtual ThreadsHandler *threadsHandler() = 0;
virtual WatchHandler *watchHandler() = 0; virtual WatchHandler *watchHandler() = 0;
virtual void showApplicationOutput(const QString &prefix, const QString &data) = 0; virtual void showApplicationOutput(const QString &data) = 0;
virtual QAction *useCustomDumpersAction() const = 0; //virtual QAction *useCustomDumpersAction() const = 0;
virtual QAction *debugDumpersAction() const = 0; //virtual QAction *debugDumpersAction() const = 0;
virtual bool skipKnownFrames() const = 0; virtual bool skipKnownFrames() const = 0;
virtual bool debugDumpers() const = 0; virtual bool debugDumpers() const = 0;
virtual bool useCustomDumpers() const = 0; virtual bool useCustomDumpers() const = 0;
@@ -180,6 +180,31 @@ private:
}; };
//
// DebuggerSettings
//
class DebuggerSettings
{
public:
DebuggerSettings();
public:
QString m_gdbCmd;
QString m_gdbEnv;
bool m_autoRun;
bool m_autoQuit;
bool m_useCustomDumpers;
bool m_skipKnownFrames;
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
bool m_useTerminal;
QString m_scriptFile;
};
// //
// DebuggerManager // DebuggerManager
// //
@@ -196,6 +221,7 @@ public:
IDebuggerManagerAccessForEngines *engineInterface(); IDebuggerManagerAccessForEngines *engineInterface();
QMainWindow *mainWindow() const { return m_mainWindow; } QMainWindow *mainWindow() const { return m_mainWindow; }
QLabel *statusLabel() const { return m_statusLabel; } QLabel *statusLabel() const { return m_statusLabel; }
DebuggerSettings *settings() { return &m_settings; }
enum StartMode { startInternal, startExternal, attachExternal }; enum StartMode { startInternal, startExternal, attachExternal };
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger }; enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
@@ -260,7 +286,7 @@ public slots:
private slots: private slots:
void showDebuggerOutput(const QString &prefix, const QString &msg); void showDebuggerOutput(const QString &prefix, const QString &msg);
void showDebuggerInput(const QString &prefix, const QString &msg); void showDebuggerInput(const QString &prefix, const QString &msg);
void showApplicationOutput(const QString &prefix, const QString &msg); void showApplicationOutput(const QString &data);
void reloadDisassembler(); void reloadDisassembler();
void disassemblerDockToggled(bool on); void disassemblerDockToggled(bool on);
@@ -286,9 +312,9 @@ private:
StackHandler *stackHandler() { return m_stackHandler; } StackHandler *stackHandler() { return m_stackHandler; }
ThreadsHandler *threadsHandler() { return m_threadsHandler; } ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; } WatchHandler *watchHandler() { return m_watchHandler; }
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; } //QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
QAction *useToolTipsAction() const { return m_useToolTipsAction; } //QAction *useToolTipsAction() const { return m_useToolTipsAction; }
QAction *debugDumpersAction() const { return m_debugDumpersAction; } //QAction *debugDumpersAction() const { return m_debugDumpersAction; }
bool skipKnownFrames() const; bool skipKnownFrames() const;
bool debugDumpers() const; bool debugDumpers() const;
bool useCustomDumpers() const; bool useCustomDumpers() const;
@@ -340,8 +366,7 @@ signals:
void setSessionValueRequested(const QString &name, const QVariant &value); void setSessionValueRequested(const QString &name, const QVariant &value);
void configValueRequested(const QString &name, QVariant *value); void configValueRequested(const QString &name, QVariant *value);
void setConfigValueRequested(const QString &name, const QVariant &value); void setConfigValueRequested(const QString &name, const QVariant &value);
void applicationOutputAvailable(const QString &prefix, const QString &msg); void applicationOutputAvailable(const QString &output);
public: public:
// FIXME: make private // FIXME: make private
@@ -406,13 +431,6 @@ private:
QAction *m_sepAction; QAction *m_sepAction;
QAction *m_stepIAction; QAction *m_stepIAction;
QAction *m_nextIAction; QAction *m_nextIAction;
QAction *m_skipKnownFramesAction;
QAction *m_debugDumpersAction;
QAction *m_useCustomDumpersAction;
QAction *m_useFastStartAction;
QAction *m_useToolTipsAction;
QAction *m_dumpLogAction;
QWidget *m_breakWindow; QWidget *m_breakWindow;
QWidget *m_disassemblerWindow; QWidget *m_disassemblerWindow;
@@ -432,9 +450,9 @@ private:
IDebuggerEngine *engine(); IDebuggerEngine *engine();
IDebuggerEngine *m_engine; IDebuggerEngine *m_engine;
DebuggerSettings m_settings;
}; };
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -36,12 +36,14 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "gdboptionpage.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "ui_gdboptionpage.h"
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/basemode.h> #include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -57,6 +59,8 @@
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
@@ -73,6 +77,7 @@
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtGui/QLineEdit>
#include <QtGui/QDockWidget> #include <QtGui/QDockWidget>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QPlainTextEdit> #include <QtGui/QPlainTextEdit>
@@ -80,6 +85,8 @@
#include <QtGui/QTextCursor> #include <QtGui/QTextCursor>
namespace ExtensionSystem { class PluginManager; }
using namespace Core; using namespace Core;
using namespace Debugger::Constants; using namespace Debugger::Constants;
using namespace Debugger::Internal; using namespace Debugger::Internal;
@@ -99,13 +106,7 @@ const char * const JUMP_TO_LINE = "Debugger.JumpToLine";
const char * const TOGGLE_BREAK = "Debugger.ToggleBreak"; const char * const TOGGLE_BREAK = "Debugger.ToggleBreak";
const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction"; const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction";
const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain"; const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain";
const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers";
const char * const ADD_TO_WATCH = "Debugger.AddToWatch"; const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
const char * const USE_FAST_START = "Debugger.UseFastStart";
const char * const USE_TOOL_TIPS = "Debugger.UseToolTips";
const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames";
const char * const DUMP_LOG = "Debugger.DumpLog";
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
const char * const INTERRUPT_KEY = "Shift+F5"; const char * const INTERRUPT_KEY = "Shift+F5";
@@ -143,6 +144,12 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
} // namespace Debugger } // namespace Debugger
///////////////////////////////////////////////////////////////////////
//
// DebugMode
//
///////////////////////////////////////////////////////////////////////
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -159,9 +166,6 @@ public:
void shutdown() {} void shutdown() {}
}; };
} // namespace Internal
} // namespace Debugger
DebugMode::DebugMode(QObject *parent) DebugMode::DebugMode(QObject *parent)
: BaseMode(parent) : BaseMode(parent)
{ {
@@ -177,6 +181,9 @@ DebugMode::~DebugMode()
EditorManager::instance()->setParent(0); EditorManager::instance()->setParent(0);
} }
} // namespace Internal
} // namespace Debugger
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -184,8 +191,10 @@ DebugMode::~DebugMode()
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
class Debugger::Internal::LocationMark namespace Debugger {
: public TextEditor::BaseTextMark namespace Internal {
class LocationMark : public TextEditor::BaseTextMark
{ {
Q_OBJECT Q_OBJECT
@@ -212,6 +221,110 @@ QIcon LocationMark::icon() const
return icon; return icon;
} }
} // namespace Internal
} // namespace Debugger
///////////////////////////////////////////////////////////////////////
//
// GdbOptionPage
//
///////////////////////////////////////////////////////////////////////
namespace Debugger {
namespace Internal {
class GdbOptionPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GdbOptionPage(DebuggerPlugin *plugin) : m_plugin(plugin) {}
// IOptionsPage
QString name() const { return tr("Gdb"); }
QString category() const { return "Debugger"; }
QString trCategory() const { return tr("Debugger"); }
QWidget *createPage(QWidget *parent);
void apply();
void finish() {} // automatically calls "apply"
private:
Ui::GdbOptionPage m_ui;
DebuggerSettings m_settings;
DebuggerPlugin *m_plugin;
};
QWidget *GdbOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_settings = *m_plugin->m_manager->settings();
m_ui.setupUi(w);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.gdbLocationChooser->setPath(m_settings.m_gdbCmd);
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile);
m_ui.environmentEdit->setText(m_settings.m_gdbEnv);
m_ui.autoStartBox->setChecked(m_settings.m_autoRun);
m_ui.autoQuitBox->setChecked(m_settings.m_autoQuit);
m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames);
m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart);
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
m_ui.checkBoxUseTerminal->setChecked(m_settings.m_useTerminal);
#ifndef QT_DEBUG
#if 0
cmd = am->registerAction(m_manager->m_dumpLogAction,
Constants::DUMP_LOG, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
mdebug->addAction(cmd);
#endif
#endif
// FIXME
m_ui.autoStartBox->hide();
m_ui.autoQuitBox->hide();
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
m_ui.checkBoxFastStart->setChecked(false);
m_ui.checkBoxFastStart->hide();
//m_dumpLogAction = new QAction(this);
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
return w;
}
void GdbOptionPage::apply()
{
m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path();
m_settings.m_gdbEnv = m_ui.environmentEdit->text();
m_settings.m_autoRun = m_ui.autoStartBox->isChecked();
m_settings.m_autoQuit = m_ui.autoQuitBox->isChecked();
m_settings.m_scriptFile = m_ui.scriptFileChooser->path();
m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked();
m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked();
m_settings.m_useFastStart = m_ui.checkBoxFastStart->isChecked();
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
m_settings.m_useTerminal = m_ui.checkBoxUseTerminal->isChecked();
*m_plugin->m_manager->settings() = m_settings;
m_plugin->writeSettings();
}
} // namespace Internal
} // namespace Debugger
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -233,7 +346,7 @@ DebuggerPlugin::~DebuggerPlugin()
static QSettings *settings() static QSettings *settings()
{ {
return ExtensionSystem::PluginManager::instance()->getObject<ICore>()->settings(); return ICore::instance()->settings();
} }
void DebuggerPlugin::shutdown() void DebuggerPlugin::shutdown()
@@ -274,7 +387,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
m_pm = ExtensionSystem::PluginManager::instance(); m_pm = ExtensionSystem::PluginManager::instance();
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
QTC_ASSERT(core, return false); QTC_ASSERT(core, return false);
Core::ActionManager *am = core->actionManager(); Core::ActionManager *am = core->actionManager();
@@ -409,34 +522,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep2"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep2"), globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_skipKnownFramesAction,
Constants::SKIP_KNOWN_FRAMES, globalcontext);
mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_useCustomDumpersAction,
Constants::USE_CUSTOM_DUMPERS, globalcontext);
mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_useFastStartAction,
Constants::USE_FAST_START, globalcontext);
mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_useToolTipsAction,
Constants::USE_TOOL_TIPS, globalcontext);
mdebug->addAction(cmd);
#ifdef QT_DEBUG
cmd = am->registerAction(m_manager->m_dumpLogAction,
Constants::DUMP_LOG, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
mdebug->addAction(cmd);
cmd = am->registerAction(m_manager->m_debugDumpersAction,
Constants::DEBUG_DUMPERS, debuggercontext);
mdebug->addAction(cmd);
#endif
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep4"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep4"), globalcontext);
@@ -479,7 +564,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
m_generalOptionPage = 0; m_generalOptionPage = 0;
// FIXME: // FIXME:
m_generalOptionPage = new GdbOptionPage(&theGdbSettings()); m_generalOptionPage = new GdbOptionPage(this);
addObject(m_generalOptionPage); addObject(m_generalOptionPage);
m_locationMark = 0; m_locationMark = 0;
@@ -628,8 +713,7 @@ ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const
/*! Activates the previous mode when the current mode is the debug mode. */ /*! Activates the previous mode when the current mode is the debug mode. */
void DebuggerPlugin::activatePreviousMode() void DebuggerPlugin::activatePreviousMode()
{ {
ICore *core = m_pm->getObject<Core::ICore>(); Core::ModeManager *const modeManager = ICore::instance()->modeManager();
Core::ModeManager *const modeManager = core->modeManager();
if (modeManager->currentMode() == modeManager->mode(Constants::MODE_DEBUG) if (modeManager->currentMode() == modeManager->mode(Constants::MODE_DEBUG)
&& !m_previousMode.isEmpty()) { && !m_previousMode.isEmpty()) {
@@ -640,7 +724,7 @@ void DebuggerPlugin::activatePreviousMode()
void DebuggerPlugin::activateDebugMode() void DebuggerPlugin::activateDebugMode()
{ {
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
Core::ModeManager *modeManager = core->modeManager(); Core::ModeManager *modeManager = core->modeManager();
m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName()); m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName());
modeManager->activateMode(QLatin1String(MODE_DEBUG)); modeManager->activateMode(QLatin1String(MODE_DEBUG));
@@ -648,7 +732,7 @@ void DebuggerPlugin::activateDebugMode()
void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object) void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object)
{ {
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
if (!core || !core->editorManager()) if (!core || !core->editorManager())
return; return;
Core::IEditor *editor = core->editorManager()->currentEditor(); Core::IEditor *editor = core->editorManager()->currentEditor();
@@ -711,7 +795,7 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor, void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
const QPoint &point, int pos) const QPoint &point, int pos)
{ {
if (!m_manager->useToolTipsAction()->isChecked()) if (!m_manager->settings()->m_useToolTips)
return; return;
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget()); QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
@@ -787,7 +871,7 @@ void DebuggerPlugin::gotoLocation(const QString &fileName, int lineNumber,
void DebuggerPlugin::changeStatus(int status) void DebuggerPlugin::changeStatus(int status)
{ {
bool startIsContinue = (status == DebuggerInferiorStopped); bool startIsContinue = (status == DebuggerInferiorStopped);
ICore *core = m_pm->getObject<Core::ICore>(); ICore *core = ICore::instance();
if (startIsContinue) { if (startIsContinue) {
core->addAdditionalContext(m_gdbRunningContext); core->addAdditionalContext(m_gdbRunningContext);
core->updateContext(); core->updateContext();
@@ -799,22 +883,59 @@ void DebuggerPlugin::changeStatus(int status)
void DebuggerPlugin::writeSettings() const void DebuggerPlugin::writeSettings() const
{ {
QSettings *s = settings();
QTC_ASSERT(m_manager, return); QTC_ASSERT(m_manager, return);
QTC_ASSERT(m_manager->mainWindow(), return); QTC_ASSERT(m_manager->mainWindow(), return);
QSettings *s = settings();
DebuggerSettings *m = m_manager->settings();
s->beginGroup(QLatin1String("DebugMode")); s->beginGroup(QLatin1String("DebugMode"));
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState()); s->setValue("State", m_manager->mainWindow()->saveState());
s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked()); s->setValue("Locked", m_toggleLockedAction->isChecked());
s->setValue("Location", m->m_gdbCmd);
s->setValue("Environment", m->m_gdbEnv);
s->setValue("ScriptFile", m->m_scriptFile);
s->setValue("AutoRun", m->m_autoRun);
s->setValue("AutoQuit", m->m_autoQuit);
s->setValue("UseFastStart", m->m_useFastStart);
s->setValue("UseToolTips", m->m_useToolTips);
s->setValue("UseTerminal", m->m_useTerminal);
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
s->setValue("DebugDumpers", m->m_debugDumpers);
s->endGroup(); s->endGroup();
} }
void DebuggerPlugin::readSettings() void DebuggerPlugin::readSettings()
{ {
QSettings *s = settings(); QSettings *s = settings();
DebuggerSettings *m = &m_manager->m_settings;
QString defaultCommand("gdb");
#if defined(Q_OS_WIN32)
defaultCommand.append(".exe");
#endif
QString defaultScript = ICore::instance()->resourcePath() +
QLatin1String("/gdb/qt4macros");
s->beginGroup(QLatin1String("DebugMode")); s->beginGroup(QLatin1String("DebugMode"));
m_manager->mainWindow()->restoreState(s->value(QLatin1String("State"), QByteArray()).toByteArray()); QByteArray ba = s->value("State", QByteArray()).toByteArray();
m_toggleLockedAction->setChecked(s->value(QLatin1String("Locked"), true).toBool()); m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
m->m_scriptFile = s->value("ScriptFile", defaultScript).toString();
m->m_gdbEnv = s->value("Environment", "").toString();
m->m_autoRun = s->value("AutoRun", true).toBool();
m->m_autoQuit = s->value("AutoQuit", true).toBool();
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
m->m_useCustomDumpers = s->value("UseCustomDupers", false).toBool();
m->m_useFastStart = s->value("UseFastStart", false).toBool();
m->m_useToolTips = s->value("UseToolTips", false).toBool();
m->m_useTerminal = s->value("UseTerminal", false).toBool();
s->endGroup(); s->endGroup();
m_manager->mainWindow()->restoreState(ba);
} }
void DebuggerPlugin::focusCurrentEditor(IMode *mode) void DebuggerPlugin::focusCurrentEditor(IMode *mode)

View File

@@ -78,7 +78,6 @@ private slots:
void changeStatus(int status); void changeStatus(int status);
void requestMark(TextEditor::ITextEditor *editor, int lineNumber); void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos); void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos);
void querySessionValue(const QString &name, QVariant *value); void querySessionValue(const QString &name, QVariant *value);
void setSessionValue(const QString &name, const QVariant &value); void setSessionValue(const QString &name, const QVariant &value);
void queryConfigValue(const QString &name, QVariant *value); void queryConfigValue(const QString &name, QVariant *value);
@@ -97,6 +96,7 @@ private:
void writeSettings() const; void writeSettings() const;
friend class DebuggerManager; friend class DebuggerManager;
friend class GdbOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views friend class DebugMode; // FIXME: Just a hack now so that it can access the views
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const; ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;

View File

@@ -108,8 +108,8 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
{ {
connect(m_manager, SIGNAL(debuggingFinished()), connect(m_manager, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished())); this, SLOT(debuggingFinished()));
connect(m_manager, SIGNAL(applicationOutputAvailable(QString, QString)), connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
this, SLOT(slotAddToOutputWindow(QString, QString))); this, SLOT(slotAddToOutputWindowInline(QString)));
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)), connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
this, SLOT(bringApplicationToForeground(qint64))); this, SLOT(bringApplicationToForeground(qint64)));
} }
@@ -138,12 +138,9 @@ void DebuggerRunControl::start()
debuggingFinished(); debuggingFinished();
} }
void DebuggerRunControl::slotAddToOutputWindow(const QString &prefix, const QString &line) void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
{ {
Q_UNUSED(prefix); emit addToOutputWindowInline(this, data);
foreach (const QString &l, line.split('\n'))
emit addToOutputWindow(this, prefix + Qt::escape(l));
//emit addToOutputWindow(this, prefix + Qt::escape(line));
} }
void DebuggerRunControl::stop() void DebuggerRunControl::stop()

View File

@@ -84,7 +84,7 @@ public:
private slots: private slots:
void debuggingFinished(); void debuggingFinished();
void slotAddToOutputWindow(const QString &prefix, const QString &line); void slotAddToOutputWindowInline(const QString &output);
private: private:
DebuggerManager *m_manager; DebuggerManager *m_manager;

View File

@@ -84,19 +84,6 @@ Q_DECLARE_METATYPE(Debugger::Internal::GdbMi);
static const QString tooltipIName = "tooltip"; static const QString tooltipIName = "tooltip";
///////////////////////////////////////////////////////////////////////
//
// GdbSettings
//
///////////////////////////////////////////////////////////////////////
GdbSettings &Debugger::Internal::theGdbSettings()
{
static GdbSettings settings;
return settings;
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// GdbCommandType // GdbCommandType
@@ -265,7 +252,7 @@ void GdbEngine::init()
m_pendingRequests = 0; m_pendingRequests = 0;
m_gdbVersion = 100; m_gdbVersion = 100;
m_shared = 0; m_shared = 0;
qq->debugDumpersAction()->setChecked(false); m_outputCodec = QTextCodec::codecForLocale();
m_oldestAcceptableToken = -1; m_oldestAcceptableToken = -1;
@@ -279,12 +266,9 @@ void GdbEngine::init()
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q, connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
SLOT(exitDebugger())); SLOT(exitDebugger()));
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setDebugDumpers(bool)));
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setCustomDumpersWanted(bool)));
// Output // Output
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
SLOT(readDebugeeOutput(QByteArray)));
connect(this, SIGNAL(gdbResponseAvailable()), connect(this, SIGNAL(gdbResponseAvailable()),
this, SLOT(handleResponse()), Qt::QueuedConnection); this, SLOT(handleResponse()), Qt::QueuedConnection);
@@ -294,8 +278,8 @@ void GdbEngine::init()
connect(this, SIGNAL(gdbInputAvailable(QString,QString)), connect(this, SIGNAL(gdbInputAvailable(QString,QString)),
q, SLOT(showDebuggerInput(QString,QString)), q, SLOT(showDebuggerInput(QString,QString)),
Qt::QueuedConnection); Qt::QueuedConnection);
connect(this, SIGNAL(applicationOutputAvailable(QString,QString)), connect(this, SIGNAL(applicationOutputAvailable(QString)),
q, SLOT(showApplicationOutput(QString,QString)), q, SLOT(showApplicationOutput(QString)),
Qt::QueuedConnection); Qt::QueuedConnection);
} }
@@ -306,7 +290,7 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
case QProcess::FailedToStart: case QProcess::FailedToStart:
msg = QString(tr("The Gdb process failed to start. Either the " msg = QString(tr("The Gdb process failed to start. Either the "
"invoked program '%1' is missing, or you may have insufficient " "invoked program '%1' is missing, or you may have insufficient "
"permissions to invoke the program.")).arg(theGdbSettings().m_gdbCmd); "permissions to invoke the program.")).arg(q->settings()->m_gdbCmd);
break; break;
case QProcess::Crashed: case QProcess::Crashed:
msg = tr("The Gdb process crashed some time after starting " msg = tr("The Gdb process crashed some time after starting "
@@ -374,6 +358,12 @@ static void skipTerminator(const char *&from, const char *to)
skipSpaces(from, to); skipSpaces(from, to);
} }
void GdbEngine::readDebugeeOutput(const QByteArray &data)
{
emit applicationOutputAvailable(m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState));
}
// called asyncronously as response to Gdb stdout output in // called asyncronously as response to Gdb stdout output in
// gdbResponseAvailable() // gdbResponseAvailable()
void GdbEngine::handleResponse() void GdbEngine::handleResponse()
@@ -426,22 +416,6 @@ void GdbEngine::handleResponse()
break; break;
} }
if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
// FIXME: On Linux the application's std::out is merged in here.
// High risk of falsely interpreting this as MI output.
// We assume that we _always_ use tokens, so not finding a token
// is a positive indication for the presence of application output.
QString s;
while (from != to && *from != '\n')
s += *from++;
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
//s += '\n';
m_inbuffer = QByteArray(from, to - from);
emit applicationOutputAvailable("app-stdout: ", s);
continue;
}
// next char decides kind of record // next char decides kind of record
const char c = *from++; const char c = *from++;
//qDebug() << "CODE:" << c; //qDebug() << "CODE:" << c;
@@ -609,8 +583,7 @@ static void fixMac(QByteArray &out)
void GdbEngine::readGdbStandardError() void GdbEngine::readGdbStandardError()
{ {
QByteArray err = m_gdbProc.readAllStandardError(); qWarning() << "Unexpected gdb stderr:" << m_gdbProc.readAllStandardError();
emit applicationOutputAvailable("app-stderr:", err);
} }
void GdbEngine::readGdbStandardOutput() void GdbEngine::readGdbStandardOutput()
@@ -723,7 +696,7 @@ void GdbEngine::sendCommand(const QString &command, int type,
//qDebug() << ""; //qDebug() << "";
if (!command.isEmpty()) { if (!command.isEmpty()) {
//qDebug() << qPrintable(currentTime()) << "RUNNING << cmd.command; //qDebug() << qPrintable(currentTime()) << "RUNNING" << cmd.command;
m_gdbProc.write(cmd.command.toLatin1() + "\r\n"); m_gdbProc.write(cmd.command.toLatin1() + "\r\n");
//emit gdbInputAvailable(QString(), " " + currentTime()); //emit gdbInputAvailable(QString(), " " + currentTime());
emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command); emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command);
@@ -1097,7 +1070,7 @@ void GdbEngine::handleStreamOutput(const QString &data, char code)
// On Windows, the contents seem to depend on the debugger // On Windows, the contents seem to depend on the debugger
// version and/or OS version used. // version and/or OS version used.
if (data.startsWith("warning:")) if (data.startsWith("warning:"))
qq->showApplicationOutput(QString(), data); qq->showApplicationOutput(data);
break; break;
} }
@@ -1503,7 +1476,8 @@ void GdbEngine::exitDebugger()
m_varToType.clear(); m_varToType.clear();
m_dataDumperState = DataDumperUninitialized; m_dataDumperState = DataDumperUninitialized;
m_shared = 0; m_shared = 0;
qq->debugDumpersAction()->setChecked(false); m_outputCollector.shutdown();
//q->settings()->m_debugDumpers = false;
} }
@@ -1525,6 +1499,15 @@ bool GdbEngine::startDebugger()
return false; return false;
} }
if (!m_outputCollector.listen()) {
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
tr("Cannot set up communication with child process: %1")
.arg(m_outputCollector.errorString()));
return false;
}
gdbArgs.prepend(QLatin1String("--tty=") + m_outputCollector.serverName());
//gdbArgs.prepend(QLatin1String("--quiet")); //gdbArgs.prepend(QLatin1String("--quiet"));
gdbArgs.prepend(QLatin1String("mi")); gdbArgs.prepend(QLatin1String("mi"));
gdbArgs.prepend(QLatin1String("-i")); gdbArgs.prepend(QLatin1String("-i"));
@@ -1535,8 +1518,9 @@ bool GdbEngine::startDebugger()
m_gdbProc.setEnvironment(q->m_environment); m_gdbProc.setEnvironment(q->m_environment);
#if 0 #if 0
qDebug() << "Command: " << theGdbSettings().m_gdbCmd; qDebug() << "Command: " << q->settings()->m_gdbCmd;
qDebug() << "WorkingDirectory: " << m_gdbProc.workingDirectory(); qDebug() << "WorkingDirectory: " << m_gdbProc.workingDirectory();
qDebug() << "ScriptFile: " << q->settings()->m_scriptFile;
qDebug() << "Environment: " << m_gdbProc.environment(); qDebug() << "Environment: " << m_gdbProc.environment();
qDebug() << "Arguments: " << gdbArgs; qDebug() << "Arguments: " << gdbArgs;
qDebug() << "BuildDir: " << q->m_buildDir; qDebug() << "BuildDir: " << q->m_buildDir;
@@ -1544,13 +1528,17 @@ bool GdbEngine::startDebugger()
#endif #endif
q->showStatusMessage(tr("Starting Debugger")); q->showStatusMessage(tr("Starting Debugger"));
emit gdbInputAvailable(QString(), theGdbSettings().m_gdbCmd + ' ' + gdbArgs.join(" ")); emit gdbInputAvailable(QString(), q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" "));
m_gdbProc.start(theGdbSettings().m_gdbCmd, gdbArgs); m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs);
m_gdbProc.waitForStarted(); m_gdbProc.waitForStarted();
if (m_gdbProc.state() != QProcess::Running) if (m_gdbProc.state() != QProcess::Running) {
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
tr("Cannot start debugger: %1").arg(m_gdbProc.errorString()));
m_outputCollector.shutdown();
return false; return false;
}
q->showStatusMessage(tr("Gdb Running")); q->showStatusMessage(tr("Gdb Running"));
@@ -1612,6 +1600,22 @@ bool GdbEngine::startDebugger()
"dyld \".*libobjc.*\" all " "dyld \".*libobjc.*\" all "
"dyld \".*CarbonDataFormatters.*\" all"); "dyld \".*CarbonDataFormatters.*\" all");
#endif #endif
QString scriptFileName = q->settings()->m_scriptFile;
if (!scriptFileName.isEmpty()) {
QFile scriptFile(scriptFileName);
if (scriptFile.open(QIODevice::ReadOnly)) {
sendCommand("source " + scriptFileName);
} else {
QMessageBox::warning(q->mainWindow(),
tr("Cannot find debugger initialization script"),
tr("The debugger settings point to a script file at '%1' "
"which is not accessible. If a script file is not needed, "
"consider clearing that entry to avoid this warning. "
).arg(scriptFileName));
}
}
if (q->startMode() == q->attachExternal) { if (q->startMode() == q->attachExternal) {
sendCommand("attach " + QString::number(q->m_attachedPID)); sendCommand("attach " + QString::number(q->m_attachedPID));
} }
@@ -2589,7 +2593,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
return; return;
} }
if (qq->debugDumpersAction()->isChecked()) { if (q->settings()->m_debugDumpers) {
// minimize interference // minimize interference
return; return;
} }
@@ -2909,10 +2913,10 @@ void GdbEngine::setCustomDumpersWanted(bool on)
bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
{ {
if (!qq->useCustomDumpers()) DebuggerSettings *s = q->settings();
if (!s->m_useCustomDumpers)
return false; return false;
if (qq->debugDumpersAction()->isChecked() if (s->m_debugDumpers && qq->stackHandler()->isDebuggingDumpers())
&& qq->stackHandler()->isDebuggingDumpers())
return false; return false;
if (m_dataDumperState != DataDumperAvailable) if (m_dataDumperState != DataDumperAvailable)
return false; return false;
@@ -3001,6 +3005,12 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
//extraArgs[extraArgCount++] = sizeofTypeExpression(data.type); //extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
//extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value"; //extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
} }
} else if (outertype == "std::deque") {
// remove 'std::allocator<...>':
extraArgs[1] = "0";
} else if (outertype == "std::stack") {
// remove 'std::allocator<...>':
extraArgs[1] = "0";
} else if (outertype == "std::map") { } else if (outertype == "std::map") {
// We don't want the comparator and the allocator confuse gdb. // We don't want the comparator and the allocator confuse gdb.
// But we need the offset of the second item in the value pair. // But we need the offset of the second item in the value pair.
@@ -3470,7 +3480,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
#ifdef QT_DEBUG #ifdef QT_DEBUG
// Make debugging of dumers easier // Make debugging of dumers easier
if (qq->debugDumpersAction()->isChecked() if (q->settings()->m_debugDumpers
&& msg.startsWith("The program being debugged stopped while") && msg.startsWith("The program being debugged stopped while")
&& msg.contains("qDumpObjectData440")) { && msg.contains("qDumpObjectData440")) {
// Fake full stop // Fake full stop

View File

@@ -36,6 +36,7 @@
#include "idebuggerengine.h" #include "idebuggerengine.h"
#include "gdbmi.h" #include "gdbmi.h"
#include "outputcollector.h"
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QHash> #include <QtCore/QHash>
@@ -43,6 +44,7 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QPoint> #include <QtCore/QPoint>
#include <QtCore/QTextCodec>
#include <QtCore/QVariant> #include <QtCore/QVariant>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -81,23 +83,6 @@ enum DataDumperState
}; };
class GdbSettings
{
public:
GdbSettings() { m_autoRun = m_autoQuit = false; }
public:
QString m_gdbCmd;
QString m_gdbEnv;
bool m_autoRun;
bool m_autoQuit;
QString m_scriptFile;
QMap<QString, QVariant> m_typeMacros;
};
GdbSettings &theGdbSettings();
class GdbEngine : public IDebuggerEngine class GdbEngine : public IDebuggerEngine
{ {
Q_OBJECT Q_OBJECT
@@ -110,7 +95,7 @@ signals:
void gdbResponseAvailable(); void gdbResponseAvailable();
void gdbInputAvailable(const QString &prefix, const QString &msg); void gdbInputAvailable(const QString &prefix, const QString &msg);
void gdbOutputAvailable(const QString &prefix, const QString &msg); void gdbOutputAvailable(const QString &prefix, const QString &msg);
void applicationOutputAvailable(const QString &prefix, const QString &msg); void applicationOutputAvailable(const QString &output);
private: private:
// //
@@ -190,6 +175,7 @@ private slots:
void gdbProcError(QProcess::ProcessError error); void gdbProcError(QProcess::ProcessError error);
void readGdbStandardOutput(); void readGdbStandardOutput();
void readGdbStandardError(); void readGdbStandardError();
void readDebugeeOutput(const QByteArray &data);
private: private:
int terminationIndex(const QByteArray &buffer, int &length); int terminationIndex(const QByteArray &buffer, int &length);
@@ -207,6 +193,10 @@ private:
void handleQueryPwd(const GdbResultRecord &response); void handleQueryPwd(const GdbResultRecord &response);
void handleQuerySources(const GdbResultRecord &response); void handleQuerySources(const GdbResultRecord &response);
OutputCollector m_outputCollector;
QTextCodec *m_outputCodec;
QTextCodec::ConverterState m_outputCodecState;
QByteArray m_inbuffer; QByteArray m_inbuffer;
QProcess m_gdbProc; QProcess m_gdbProc;

View File

@@ -1,145 +0,0 @@
/***************************************************************************
**
** 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 "gdboptionpage.h"
#include "gdbengine.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtGui/QLineEdit>
#include <QtGui/QFileDialog>
using namespace Debugger::Internal;
GdbOptionPage::GdbOptionPage(GdbSettings *settings)
{
m_pm = ExtensionSystem::PluginManager::instance();
m_settings = settings;
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions");
QString defaultCommand("gdb");
#if defined(Q_OS_WIN32)
defaultCommand.append(".exe");
#endif
QString defaultScript = coreIFace->resourcePath() +
QLatin1String("/gdb/qt4macros");
m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString();
m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString();
m_settings->m_gdbEnv = s->value("Environment", "").toString();
m_settings->m_autoRun = s->value("AutoRun", true).toBool();
m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
s->endGroup();
}
QString GdbOptionPage::name() const
{
return tr("Gdb");
}
QString GdbOptionPage::category() const
{
return "Debugger";
}
QString GdbOptionPage::trCategory() const
{
return tr("Debugger");
}
QWidget *GdbOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd);
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_ui.scriptFileChooser->setPath(m_settings->m_scriptFile);
m_ui.environmentEdit->setText(m_settings->m_gdbEnv);
m_ui.autoStartBox->setChecked(m_settings->m_autoRun);
m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
// FIXME
m_ui.autoStartBox->hide();
m_ui.autoQuitBox->hide();
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
this, SLOT(onGdbLocationChanged()));
connect(m_ui.scriptFileChooser, SIGNAL(changed()),
this, SLOT(onScriptFileChanged()));
return w;
}
void GdbOptionPage::onGdbLocationChanged()
{
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
}
void GdbOptionPage::onScriptFileChanged()
{
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::apply()
{
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
m_settings->m_gdbEnv = m_ui.environmentEdit->text();
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions");
s->setValue("Location", m_settings->m_gdbCmd);
s->setValue("Environment", m_settings->m_gdbEnv);
s->setValue("AutoRun", m_settings->m_autoRun);
s->setValue("AutoQuit", m_settings->m_autoQuit);
s->endGroup();
}

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>433</width> <width>465</width>
<height>233</height> <height>372</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -36,7 +36,7 @@
<widget class="QLineEdit" name="environmentEdit"/> <widget class="QLineEdit" name="environmentEdit"/>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="labelGdbLocaltion"> <widget class="QLabel" name="labelGdbLocation">
<property name="toolTip"> <property name="toolTip">
<string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string> <string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string>
</property> </property>
@@ -74,6 +74,68 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxUseCustomDumpers">
<property name="toolTip">
<string>Checking this will make the debugger try to use code to format certain data (QObject, QString, std::string etc.) nicely.</string>
</property>
<property name="text">
<string>Use custom display for Qt and Standard Library objects</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseTerminal">
<property name="toolTip">
<string>Start debugged process in a separte terminal.</string>
</property>
<property name="text">
<string>Start in terminal</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxFastStart">
<property name="toolTip">
<string>Checking this will make the debugger start fast by loading only very few debug symbols on start up. This might lead to situations where breakpoints can not be set properly. So uncheck this option if you experience breakpoint related problems.</string>
</property>
<property name="text">
<string>Fast debugger start</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>fter checking this option 'Step Into' combines in certain situations several steps, leading to 'less noisy' debugging. So will, e.g., the atomic
reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it.
</string>
</property>
<property name="text">
<string>Skip known frames when stepping</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTips">
<property name="toolTip">
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
</property>
<property name="text">
<string>Use tooltips while debugging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDebugDumpers">
<property name="toolTip">
<string notr="true">This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
</property>
<property name="text">
<string>Debug Custom Dumpers</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="autoStartBox"> <widget class="QCheckBox" name="autoStartBox">
<property name="text"> <property name="text">

View File

@@ -35,7 +35,6 @@
#include "gdbengine.h" #include "gdbengine.h"
#include "imports.h" #include "imports.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QSettings> #include <QtCore/QSettings>
@@ -49,9 +48,7 @@ TypeMacroPage::TypeMacroPage(GdbSettings *settings)
m_pm = ExtensionSystem::PluginManager::instance(); m_pm = ExtensionSystem::PluginManager::instance();
m_settings = settings; m_settings = settings;
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); Core::ICore *coreIFace = ICore::instance();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings(); QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions"); s->beginGroup("GdbOptions");
@@ -164,14 +161,11 @@ void TypeMacroPage::finished(bool accepted)
m_settings->m_typeMacros.insert(item->text(0), data); m_settings->m_typeMacros.insert(item->text(0), data);
} }
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); QSettings *s = ICore::instance()->settings();
if (coreIFace && coreIFace->settings()) {
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions"); s->beginGroup("GdbOptions");
s->setValue("ScriptFile", m_settings->m_scriptFile); s->setValue("ScriptFile", m_settings->m_scriptFile);
s->setValue("TypeMacros", m_settings->m_typeMacros); s->setValue("TypeMacros", m_settings->m_typeMacros);
s->endGroup(); s->endGroup();
}
} }
void TypeMacroPage::onAddButton() void TypeMacroPage::onAddButton()

View File

@@ -0,0 +1,180 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 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 "outputcollector.h"
#ifdef Q_OS_WIN
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#include <QtCore/QCoreApplication>
#else
#include <QtCore/QFile>
#include <QtCore/QSocketNotifier>
#include <QtCore/QTemporaryFile>
#include <QtCore/QVarLengthArray>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#endif
namespace Debugger {
namespace Internal {
OutputCollector::OutputCollector(QObject *parent)
: QObject(parent)
{
#ifdef Q_OS_WIN
m_server = 0;
m_socket = 0;
#endif
}
OutputCollector::~OutputCollector()
{
shutdown();
}
bool OutputCollector::listen()
{
#ifdef Q_OS_WIN
if (m_server)
return m_server->isListening();
m_server = new QLocalServer(this);
connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable()));
return m_server->listen(QLatin1String("creator-") + QCoreApplication::applicationPid()); // XXX how to make that secure?
#else
if (!m_serverPath.isEmpty())
return true;
QByteArray codedServerPath;
forever {
{
QTemporaryFile tf;
if (!tf.open()) {
m_errorString = tr("Cannot create temporary file: %2").arg(tf.errorString());
m_serverPath.clear();
return false;
}
m_serverPath = tf.fileName();
}
// By now the temp file was deleted again
codedServerPath = QFile::encodeName(m_serverPath);
if (!::mkfifo(codedServerPath.constData(), 0600))
break;
if (errno != EEXIST) {
m_errorString = tr("Cannot create FiFo %1: %2").arg(m_serverPath, strerror(errno));
m_serverPath.clear();
return false;
}
}
if ((m_serverFd = ::open(codedServerPath.constData(), O_RDONLY|O_NONBLOCK)) < 0) {
m_errorString = tr("Cannot open FiFo %1: %2").arg(m_serverPath, strerror(errno));
m_serverPath.clear();
return false;
}
m_serverNotifier = new QSocketNotifier(m_serverFd, QSocketNotifier::Read, this);
connect(m_serverNotifier, SIGNAL(activated(int)), SLOT(bytesAvailable()));
return true;
#endif
}
void OutputCollector::shutdown()
{
#ifdef Q_OS_WIN
delete m_server; // Deletes socket as well (QObject parent)
m_server = 0;
m_socket = 0;
#else
if (!m_serverPath.isEmpty()) {
::close(m_serverFd);
::unlink(QFile::encodeName(m_serverPath).constData());
delete m_serverNotifier;
m_serverPath.clear();
}
#endif
}
QString OutputCollector::errorString() const
{
#ifdef Q_OS_WIN
return m_socket ? m_socket->errorString() : m_server->errorString();
#else
return m_errorString;
#endif
}
QString OutputCollector::serverName() const
{
#ifdef Q_OS_WIN
return m_server->fullServerName();
#else
return m_serverPath;
#endif
}
#ifdef Q_OS_WIN
void OutputCollector::newConnectionAvailable()
{
if (m_socket)
return;
m_socket = m_server->nextPendingConnection();
connect(m_socket, SIGNAL(bytesAvailable()), SLOT(bytesAvailable()));
}
#endif
void OutputCollector::bytesAvailable()
{
#ifdef Q_OS_WIN
emit byteDelivery(m_socket->readAll());
#else
size_t nbytes = 0;
if (::ioctl(m_serverFd, FIONREAD, (char *) &nbytes) < 0)
return;
QVarLengthArray<char, 8192> buff(nbytes);
if (::read(m_serverFd, buff.data(), nbytes) != (int)nbytes)
return;
if (nbytes) // Skip EOF notifications
emit byteDelivery(QByteArray::fromRawData(buff.data(), nbytes));
#endif
}
} // namespace Internal
} // namespace Debugger

View File

@@ -2,7 +2,7 @@
** **
** This file is part of Qt Creator ** This file is part of Qt Creator
** **
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** **
** Contact: Qt Software Information (qt-info@nokia.com) ** Contact: Qt Software Information (qt-info@nokia.com)
** **
@@ -31,79 +31,61 @@
** **
***************************************************************************/ ***************************************************************************/
#ifndef GDBOPTIONPAGE_H #ifndef OUTPUT_COLLECTOR_H
#define GDBOPTIONPAGE_H #define OUTPUT_COLLECTOR_H
#include "ui_gdboptionpage.h" #include <QtCore/QByteArray>
#include <QtCore/QObject>
#include <coreplugin/dialogs/ioptionspage.h> QT_BEGIN_NAMESPACE
class QLocalServer;
#include <QtGui/QWidget> class QLocalSocket;
class QSocketNotifier;
namespace ExtensionSystem { class PluginManager; } QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class GdbSettings; ///////////////////////////////////////////////////////////////////////
//
// OutputCollector
//
///////////////////////////////////////////////////////////////////////
class GdbOptionPage : public Core::IOptionsPage class OutputCollector : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
GdbOptionPage(GdbSettings *settings); OutputCollector(QObject *parent = 0);
~OutputCollector();
bool listen();
void shutdown();
QString serverName() const;
QString errorString() const;
QString name() const; signals:
QString category() const; void byteDelivery(const QByteArray &data);
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
public slots:
void onGdbLocationChanged();
void onScriptFileChanged();
private:
ExtensionSystem::PluginManager *m_pm;
Ui::GdbOptionPage m_ui;
GdbSettings *m_settings;
};
#if 0
class TypeMacroPage : public Core::IOptionsPage
{
Q_OBJECT
public:
TypeMacroPage(GdbSettings *settings);
QString name() const;
QString category() const;
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
private slots: private slots:
void onAddButton(); void bytesAvailable();
void onDelButton(); #ifdef Q_OS_WIN
void currentItemChanged(QTreeWidgetItem *item); void newConnectionAvailable();
void updateButtonState(); #endif
private: private:
ExtensionSystem::PluginManager *m_pm; #ifdef Q_OS_WIN
Ui::TypeMacroPage m_ui; QLocalServer *m_server;
QLocalSocket *m_socket;
GdbSettings *m_settings; #else
QWidget *m_widget; QString m_serverPath;
}; int m_serverFd;
QSocketNotifier *m_serverNotifier;
QString m_errorString;
#endif #endif
};
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger
#endif // GDBOPTIONPAGE_H #endif // OUTPUT_COLLECTOR_H

View File

@@ -48,8 +48,8 @@ enum { debugFormClassWizard = 0 };
using namespace Designer; using namespace Designer;
using namespace Designer::Internal; using namespace Designer::Internal;
FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent) : FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent)
Core::BaseFileWizard(parameters, core, parent) : Core::BaseFileWizard(parameters, parent)
{ {
} }

View File

@@ -38,10 +38,6 @@
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
QT_BEGIN_NAMESPACE
class QWizard;
QT_END_NAMESPACE
namespace Designer { namespace Designer {
namespace Internal { namespace Internal {
@@ -55,7 +51,7 @@ class FormClassWizard : public Core::BaseFileWizard
public: public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters; typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
FormClassWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent); FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent);
QString headerSuffix() const; QString headerSuffix() const;
QString sourceSuffix() const; QString sourceSuffix() const;

View File

@@ -42,8 +42,8 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QMessageBox>
#include <QtGui/QAbstractButton> #include <QtGui/QAbstractButton>
#include <QtGui/QMessageBox>
static const char *formClassWizardPageGroupC = "FormClassWizardPage"; static const char *formClassWizardPageGroupC = "FormClassWizardPage";
static const char *translationKeyC = "RetranslationSupport"; static const char *translationKeyC = "RetranslationSupport";
@@ -175,7 +175,7 @@ bool FormClassWizardPage::validatePage()
void FormClassWizardPage::saveSettings() void FormClassWizardPage::saveSettings()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (QSettings *settings = core->settings()) { if (QSettings *settings = core->settings()) {
settings->beginGroup(QLatin1String(formClassWizardPageGroupC)); settings->beginGroup(QLatin1String(formClassWizardPageGroupC));
settings->setValue(QLatin1String(translationKeyC), hasRetranslationSupport()); settings->setValue(QLatin1String(translationKeyC), hasRetranslationSupport());
@@ -189,7 +189,7 @@ void FormClassWizardPage::restoreSettings()
bool retranslationSupport = true; bool retranslationSupport = true;
int embedding = PointerAggregatedUiClass; int embedding = PointerAggregatedUiClass;
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
if (QSettings *settings = core->settings()) { if (QSettings *settings = core->settings()) {
QString key = QLatin1String(formClassWizardPageGroupC); QString key = QLatin1String(formClassWizardPageGroupC);

View File

@@ -34,7 +34,6 @@
#ifndef FORMEDITORFACTORY_H #ifndef FORMEDITORFACTORY_H
#define FORMEDITORFACTORY_H #define FORMEDITORFACTORY_H
#include <extensionsystem/ExtensionSystemInterfaces>
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
#include <QtCore/QStringList> #include <QtCore/QStringList>

View File

@@ -51,7 +51,7 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#ifdef CPP_ENABLED #ifdef CPP_ENABLED
@@ -89,13 +89,16 @@ FormEditorPlugin::~FormEditorPlugin()
// INHERITED FROM ExtensionSystem::Plugin // INHERITED FROM ExtensionSystem::Plugin
// //
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message/* = 0*/) // =0; bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Q_UNUSED(arguments);
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error_message)) Q_UNUSED(error);
Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error))
return false; return false;
if (!initializeTemplates(error_message)) if (!initializeTemplates(error))
return false; return false;
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR)); const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
@@ -107,7 +110,7 @@ bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
// Make sure settings pages and action shortcuts are registered // Make sure settings pages and action shortcuts are registered
FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins); FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
error_message->clear(); error->clear();
return true; return true;
} }
@@ -121,24 +124,23 @@ void FormEditorPlugin::extensionsInitialized()
// //
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
bool FormEditorPlugin::initializeTemplates(QString * /* error_message */) bool FormEditorPlugin::initializeTemplates(QString *error)
{ {
Q_UNUSED(error);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String("Qt")); wizardParameters.setCategory(QLatin1String("Qt"));
wizardParameters.setTrCategory(tr("Qt")); wizardParameters.setTrCategory(tr("Qt"));
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE); const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
wizardParameters.setName(tr("Qt Designer Form")); wizardParameters.setName(tr("Qt Designer Form"));
wizardParameters.setDescription(tr("This creates a new Qt Designer form file.")); wizardParameters.setDescription(tr("This creates a new Qt Designer form file."));
m_formWizard = new FormWizard(wizardParameters, core, this); m_formWizard = new FormWizard(wizardParameters, this);
addObject(m_formWizard); addObject(m_formWizard);
#ifdef CPP_ENABLED #ifdef CPP_ENABLED
wizardParameters.setKind(Core::IWizard::ClassWizard); wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setName(tr("Qt Designer Form Class")); wizardParameters.setName(tr("Qt Designer Form Class"));
wizardParameters.setDescription(tr("This creates a new Qt Designer form class.")); wizardParameters.setDescription(tr("This creates a new Qt Designer form class."));
m_formClassWizard = new FormClassWizard(wizardParameters, core, this); m_formClassWizard = new FormClassWizard(wizardParameters, this);
addObject(m_formClassWizard); addObject(m_formClassWizard);
#endif #endif
return true; return true;

View File

@@ -43,6 +43,7 @@
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtDesigner/QDesignerFormEditorPluginInterface> #include <QtDesigner/QDesignerFormEditorPluginInterface>
@@ -162,7 +163,7 @@ FormEditorW::FormEditorW() :
m_formeditor(QDesignerComponents::createFormEditor(0)), m_formeditor(QDesignerComponents::createFormEditor(0)),
m_integration(0), m_integration(0),
m_fwm(0), m_fwm(0),
m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()), m_core(Core::ICore::instance()),
m_initStage(RegisterPlugins), m_initStage(RegisterPlugins),
m_actionGroupEditMode(0), m_actionGroupEditMode(0),
m_actionPrint(0), m_actionPrint(0),

View File

@@ -34,12 +34,12 @@
#ifndef FORMEDITORW_H #ifndef FORMEDITORW_H
#define FORMEDITORW_H #define FORMEDITORW_H
#include <extensionsystem/ExtensionSystemInterfaces>
#include <QtDesigner/QDesignerFormEditorInterface> #include <QtDesigner/QDesignerFormEditorInterface>
#include <QtCore/QObject>
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QPointer> #include <QtCore/QPointer>
#include <QtCore/QStringList>
#include "designerconstants.h" #include "designerconstants.h"

View File

@@ -36,8 +36,6 @@
#include "formwindoweditor.h" #include "formwindoweditor.h"
#include "designerconstants.h" #include "designerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -46,8 +44,8 @@ enum { debugFormWizard = 0 };
using namespace Designer; using namespace Designer;
using namespace Designer::Internal; using namespace Designer::Internal;
FormWizard::FormWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent) : FormWizard::FormWizard(const BaseFileWizardParameters &parameters, QObject *parent)
Core::BaseFileWizard(parameters, core, parent) : Core::BaseFileWizard(parameters, parent)
{ {
} }
@@ -55,7 +53,7 @@ QWizard *FormWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath, const QString &defaultPath,
const WizardPageList &extensionPages) const const WizardPageList &extensionPages) const
{ {
FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(core(), extensionPages, parent); FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(extensionPages, parent);
wizardDialog->setPath(defaultPath); wizardDialog->setPath(defaultPath);
return wizardDialog; return wizardDialog;
} }

View File

@@ -36,15 +36,9 @@
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
QT_BEGIN_NAMESPACE
class QWizard;
QT_END_NAMESPACE
namespace Designer { namespace Designer {
namespace Internal { namespace Internal {
class FormFileWizardDialog;
class FormWizard : public Core::BaseFileWizard class FormWizard : public Core::BaseFileWizard
{ {
Q_DISABLE_COPY(FormWizard) Q_DISABLE_COPY(FormWizard)
@@ -53,7 +47,7 @@ class FormWizard : public Core::BaseFileWizard
public: public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters; typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
explicit FormWizard(const BaseFileWizardParameters &parameters, Core::ICore *core, QObject *parent); FormWizard(const BaseFileWizardParameters &parameters, QObject *parent);
protected: protected:
virtual QWizard *createWizardDialog(QWidget *parent, virtual QWizard *createWizardDialog(QWidget *parent,

View File

@@ -50,12 +50,10 @@ namespace Designer {
namespace Internal { namespace Internal {
// ----------------- FormWizardDialog // ----------------- FormWizardDialog
FormWizardDialog::FormWizardDialog(Core::ICore *core, FormWizardDialog::FormWizardDialog(const WizardPageList &extensionPages,
const WizardPageList &extensionPages, QWidget *parent)
QWidget *parent) : : QWizard(parent),
QWizard(parent), m_formPage(new FormTemplateWizardPagePage)
m_formPage(new FormTemplateWizardPagePage),
m_core(core)
{ {
init(extensionPages); init(extensionPages);
} }
@@ -82,10 +80,9 @@ QString FormWizardDialog::templateContents() const
} }
// ----------------- FormFileWizardDialog // ----------------- FormFileWizardDialog
FormFileWizardDialog::FormFileWizardDialog(Core::ICore *core, FormFileWizardDialog::FormFileWizardDialog(const WizardPageList &extensionPages,
const WizardPageList &extensionPages, QWidget *parent)
QWidget *parent) : : FormWizardDialog(extensionPages, parent),
FormWizardDialog(core, extensionPages, parent),
m_filePage(new Core::Utils::FileWizardPage) m_filePage(new Core::Utils::FileWizardPage)
{ {
setPage(FilePageId, m_filePage); setPage(FilePageId, m_filePage);

View File

@@ -37,10 +37,9 @@
#include <QtGui/QWizard> #include <QtGui/QWizard>
namespace Core { namespace Core {
class ICore; namespace Utils {
namespace Utils {
class FileWizardPage; class FileWizardPage;
} }
} }
namespace Designer { namespace Designer {
@@ -58,8 +57,7 @@ class FormWizardDialog : public QWizard
public: public:
typedef QList<QWizardPage *> WizardPageList; typedef QList<QWizardPage *> WizardPageList;
explicit FormWizardDialog(Core::ICore *core, explicit FormWizardDialog(const WizardPageList &extensionPages,
const WizardPageList &extensionPages,
QWidget *parent = 0); QWidget *parent = 0);
QString templateContents() const; QString templateContents() const;
@@ -68,7 +66,6 @@ private:
void init(const WizardPageList &extensionPages); void init(const WizardPageList &extensionPages);
FormTemplateWizardPagePage *m_formPage; FormTemplateWizardPagePage *m_formPage;
Core::ICore *m_core;
mutable QString m_templateContents; mutable QString m_templateContents;
}; };
@@ -82,8 +79,7 @@ class FormFileWizardDialog : public FormWizardDialog
Q_OBJECT Q_OBJECT
public: public:
explicit FormFileWizardDialog(Core::ICore *core, explicit FormFileWizardDialog(const WizardPageList &extensionPages,
const WizardPageList &extensionPages,
QWidget *parent = 0); QWidget *parent = 0);
QString path() const; QString path() const;

View File

@@ -48,6 +48,7 @@
#include <cplusplus/LookupContext.h> #include <cplusplus/LookupContext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/itexteditable.h> #include <texteditor/itexteditable.h>
@@ -78,8 +79,8 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document
static inline CppTools::CppModelManagerInterface *cppModelManagerInstance() static inline CppTools::CppModelManagerInterface *cppModelManagerInstance()
{ {
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); return ExtensionSystem::PluginManager::instance()
return core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); ->getObject<CppTools::CppModelManagerInterface>();
} }
WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) : WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :

File diff suppressed because it is too large Load Diff

View File

@@ -58,6 +58,7 @@ public slots:
// FIXME: good idea? // FIXME: good idea?
void addWidget(QWidget *widget); void addWidget(QWidget *widget);
void removeWidget(QWidget *widget); void removeWidget(QWidget *widget);
void setCurrentFileName(const QString &fileName);
// This executes an "ex" style command taking context // This executes an "ex" style command taking context
// information from \p widget; // information from \p widget;
@@ -68,10 +69,11 @@ public slots:
signals: signals:
void commandBufferChanged(const QString &msg); void commandBufferChanged(const QString &msg);
void statusDataChanged(const QString &msg); void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg); void extraInformationChanged(QWidget *widget, const QString &msg);
void quitRequested(QWidget *); void quitRequested(QWidget *widget);
void selectionChanged(QWidget *widget, void selectionChanged(QWidget *widget,
const QList<QTextEdit::ExtraSelection> &selection); const QList<QTextEdit::ExtraSelection> &selection);
void writeFile(const QString &fileName, const QString &contents);
private: private:
bool eventFilter(QObject *ob, QEvent *ev); bool eventFilter(QObject *ob, QEvent *ev);

View File

@@ -39,7 +39,9 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/ifile.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
@@ -112,17 +114,19 @@ private slots:
void installHandler(QWidget *widget); void installHandler(QWidget *widget);
void removeHandler(QWidget *widget); void removeHandler(QWidget *widget);
void showCommandBuffer(const QString &contents); void showCommandBuffer(const QString &contents);
void showExtraInformation(const QString &msg); void showExtraInformation(QWidget *, const QString &msg);
void editorOpened(Core::IEditor *); void editorOpened(Core::IEditor *);
void editorAboutToClose(Core::IEditor *); void editorAboutToClose(Core::IEditor *);
void changeSelection(QWidget *widget, void changeSelection(QWidget *widget,
const QList<QTextEdit::ExtraSelection> &selections); const QList<QTextEdit::ExtraSelection> &selections);
void writeFile(const QString &fileName, const QString &contents);
private: private:
FakeVimPlugin *q; FakeVimPlugin *q;
FakeVimHandler *m_handler; FakeVimHandler *m_handler;
QAction *m_installHandlerAction; QAction *m_installHandlerAction;
Core::ICore *m_core; Core::ICore *m_core;
Core::IFile *m_currentFile;
}; };
} // namespace Internal } // namespace Internal
@@ -134,6 +138,7 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin)
m_handler = 0; m_handler = 0;
m_installHandlerAction = 0; m_installHandlerAction = 0;
m_core = 0; m_core = 0;
m_currentFile = 0;
} }
FakeVimPluginPrivate::~FakeVimPluginPrivate() FakeVimPluginPrivate::~FakeVimPluginPrivate()
@@ -153,7 +158,7 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err
m_handler = new FakeVimHandler; m_handler = new FakeVimHandler;
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); m_core = Core::ICore::instance();
QTC_ASSERT(m_core, return false); QTC_ASSERT(m_core, return false);
Core::ActionManager *actionManager = m_core->actionManager(); Core::ActionManager *actionManager = m_core->actionManager();
@@ -172,7 +177,7 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err
ActionContainer *advancedMenu = ActionContainer *advancedMenu =
actionManager->actionContainer(Core::Constants::M_EDIT_ADVANCED); actionManager->actionContainer(Core::Constants::M_EDIT_ADVANCED);
advancedMenu->addAction(cmd); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR);
connect(m_installHandlerAction, SIGNAL(triggered()), connect(m_installHandlerAction, SIGNAL(triggered()),
this, SLOT(installHandler())); this, SLOT(installHandler()));
@@ -195,8 +200,8 @@ void FakeVimPluginPrivate::installHandler()
void FakeVimPluginPrivate::installHandler(QWidget *widget) void FakeVimPluginPrivate::installHandler(QWidget *widget)
{ {
connect(m_handler, SIGNAL(extraInformationChanged(QString)), connect(m_handler, SIGNAL(extraInformationChanged(QWidget *, QString)),
this, SLOT(showExtraInformation(QString))); this, SLOT(showExtraInformation(QWidget *, QString)));
connect(m_handler, SIGNAL(commandBufferChanged(QString)), connect(m_handler, SIGNAL(commandBufferChanged(QString)),
this, SLOT(showCommandBuffer(QString))); this, SLOT(showCommandBuffer(QString)));
connect(m_handler, SIGNAL(quitRequested(QWidget *)), connect(m_handler, SIGNAL(quitRequested(QWidget *)),
@@ -206,6 +211,12 @@ void FakeVimPluginPrivate::installHandler(QWidget *widget)
this, SLOT(changeSelection(QWidget*,QList<QTextEdit::ExtraSelection>))); this, SLOT(changeSelection(QWidget*,QList<QTextEdit::ExtraSelection>)));
m_handler->addWidget(widget); m_handler->addWidget(widget);
TextEditor::BaseTextEditor* editor =
qobject_cast<TextEditor::BaseTextEditor*>(widget);
if (editor) {
m_currentFile = editor->file();
m_handler->setCurrentFileName(editor->file()->fileName());
}
BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(widget); BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(widget);
if (bt) { if (bt) {
@@ -225,12 +236,29 @@ void FakeVimPluginPrivate::installHandler(QWidget *widget)
} }
} }
void FakeVimPluginPrivate::writeFile(const QString &fileName,
const QString &contents)
{
if (m_currentFile && fileName == m_currentFile->fileName()) {
// Handle that as a special case for nicer interaction with core
m_core->fileManager()->blockFileChange(m_currentFile);
m_currentFile->save(fileName);
m_core->fileManager()->unblockFileChange(m_currentFile);
} else {
QFile file(fileName);
file.open(QIODevice::ReadWrite);
{ QTextStream ts(&file); ts << contents; }
file.close();
}
}
void FakeVimPluginPrivate::removeHandler(QWidget *widget) void FakeVimPluginPrivate::removeHandler(QWidget *widget)
{ {
Q_UNUSED(widget); Q_UNUSED(widget);
m_handler->removeWidget(widget); m_handler->removeWidget(widget);
Core::EditorManager::instance()->hideEditorInfoBar( Core::EditorManager::instance()->hideEditorInfoBar(
QLatin1String(Constants::MINI_BUFFER)); QLatin1String(Constants::MINI_BUFFER));
m_currentFile = 0;
} }
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor) void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
@@ -253,9 +281,9 @@ void FakeVimPluginPrivate::showCommandBuffer(const QString &contents)
tr("Quit FakeVim"), m_handler, SLOT(quit())); tr("Quit FakeVim"), m_handler, SLOT(quit()));
} }
void FakeVimPluginPrivate::showExtraInformation(const QString &text) void FakeVimPluginPrivate::showExtraInformation(QWidget *widget, const QString &text)
{ {
QMessageBox::information(0, tr("FakeVim Information"), text); QMessageBox::information(widget, tr("FakeVim Information"), text);
} }
void FakeVimPluginPrivate::changeSelection(QWidget *widget, void FakeVimPluginPrivate::changeSelection(QWidget *widget,

View File

@@ -43,9 +43,11 @@
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtCore/QSettings> #include <QtCore/QSettings>
Q_DECLARE_METATYPE(Find::IFindFilter*) Q_DECLARE_METATYPE(Find::IFindFilter*)
@@ -58,8 +60,7 @@ using namespace Find;
using namespace Find::Internal; using namespace Find::Internal;
FindPlugin::FindPlugin() FindPlugin::FindPlugin()
: m_core(0), : m_currentDocumentFind(0),
m_currentDocumentFind(0),
m_findToolBar(0), m_findToolBar(0),
m_findDialog(0), m_findDialog(0),
m_findCompletionModel(new QStringListModel(this)), m_findCompletionModel(new QStringListModel(this)),
@@ -76,14 +77,14 @@ FindPlugin::~FindPlugin()
bool FindPlugin::initialize(const QStringList &, QString *) bool FindPlugin::initialize(const QStringList &, QString *)
{ {
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = Core::ICore::instance();
setupMenu(); setupMenu();
m_currentDocumentFind = new CurrentDocumentFind(m_core); m_currentDocumentFind = new CurrentDocumentFind(core);
m_findToolBar = new FindToolBar(this, m_currentDocumentFind); m_findToolBar = new FindToolBar(this, m_currentDocumentFind);
m_findDialog = new FindToolWindow(this); m_findDialog = new FindToolWindow(this);
SearchResultWindow *searchResultWindow = new SearchResultWindow(m_core); SearchResultWindow *searchResultWindow = new SearchResultWindow(core);
addAutoReleasedObject(searchResultWindow); addAutoReleasedObject(searchResultWindow);
return true; return true;
} }
@@ -123,10 +124,10 @@ void FindPlugin::openFindFilter()
m_findDialog->open(filter); m_findDialog->open(filter);
} }
void FindPlugin::setupMenu() void FindPlugin::setupMenu()
{ {
Core::ActionManager *am = m_core->actionManager(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND); Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND);
medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); medit->addMenu(mfind, Core::Constants::G_EDIT_FIND);
@@ -149,7 +150,8 @@ void FindPlugin::setupMenu()
void FindPlugin::setupFilterMenuItems() void FindPlugin::setupFilterMenuItems()
{ {
Core::ActionManager *am = m_core->actionManager(); Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
QList<IFindFilter*> findInterfaces = QList<IFindFilter*> findInterfaces =
ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>();
Core::Command *cmd; Core::Command *cmd;
@@ -171,11 +173,6 @@ void FindPlugin::setupFilterMenuItems()
m_findDialog->setFindFilters(findInterfaces); m_findDialog->setFindFilters(findInterfaces);
} }
Core::ICore *FindPlugin::core()
{
return m_core;
}
QTextDocument::FindFlags FindPlugin::findFlags() const QTextDocument::FindFlags FindPlugin::findFlags() const
{ {
return m_findFlags; return m_findFlags;
@@ -216,7 +213,7 @@ bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag)
void FindPlugin::writeSettings() void FindPlugin::writeSettings()
{ {
QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0)); settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0));
settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0)); settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0));
@@ -229,7 +226,7 @@ void FindPlugin::writeSettings()
void FindPlugin::readSettings() void FindPlugin::readSettings()
{ {
QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
bool block = blockSignals(true); bool block = blockSignals(true);
setBackward(settings->value("Backward", false).toBool()); setBackward(settings->value("Backward", false).toBool());

View File

@@ -64,7 +64,6 @@ public:
void extensionsInitialized(); void extensionsInitialized();
void shutdown(); void shutdown();
Core::ICore *core();
QTextDocument::FindFlags findFlags() const; QTextDocument::FindFlags findFlags() const;
void updateFindCompletion(const QString &text); void updateFindCompletion(const QString &text);
void updateReplaceCompletion(const QString &text); void updateReplaceCompletion(const QString &text);
@@ -93,7 +92,6 @@ private:
void readSettings(); void readSettings();
//variables //variables
Core::ICore *m_core;
QHash<IFindFilter *, QAction *> m_filterActions; QHash<IFindFilter *, QAction *> m_filterActions;
CurrentDocumentFind *m_currentDocumentFind; CurrentDocumentFind *m_currentDocumentFind;

View File

@@ -41,16 +41,19 @@
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QPushButton>
#include <QtGui/QMenu>
#include <QtGui/QToolButton>
#include <QtGui/QLineEdit>
#include <QtGui/QKeyEvent>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
#include <QtGui/QPainter>
#include <QtGui/QCompleter> #include <QtGui/QCompleter>
#include <QDebug> #include <QtGui/QKeyEvent>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
#include <QtGui/QPainter>
#include <QtGui/QPushButton>
#include <QtGui/QToolButton>
Q_DECLARE_METATYPE(QStringList) Q_DECLARE_METATYPE(QStringList)
Q_DECLARE_METATYPE(Find::IFindFilter*) Q_DECLARE_METATYPE(Find::IFindFilter*)
@@ -138,7 +141,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
QList<int> globalcontext; QList<int> globalcontext;
globalcontext << Core::Constants::C_GLOBAL_ID; globalcontext << Core::Constants::C_GLOBAL_ID;
Core::ActionManager *am = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager(); Core::ActionManager *am = Core::ICore::instance()->actionManager();
Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND);
Core::Command *cmd; Core::Command *cmd;

View File

@@ -42,7 +42,7 @@ using namespace Find;
using namespace Find::Internal; using namespace Find::Internal;
FindToolWindow::FindToolWindow(FindPlugin *plugin) FindToolWindow::FindToolWindow(FindPlugin *plugin)
: QDialog(plugin->core()->mainWindow()), : QDialog(Core::ICore::instance()->mainWindow()),
m_plugin(plugin), m_plugin(plugin),
m_findCompleter(new QCompleter(this)) m_findCompleter(new QCompleter(this))
{ {
@@ -124,7 +124,7 @@ void FindToolWindow::search()
void FindToolWindow::writeSettings() void FindToolWindow::writeSettings()
{ {
QSettings *settings = m_plugin->core()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
foreach (IFindFilter *filter, m_filters) foreach (IFindFilter *filter, m_filters)
filter->writeSettings(settings); filter->writeSettings(settings);
@@ -133,7 +133,7 @@ void FindToolWindow::writeSettings()
void FindToolWindow::readSettings() void FindToolWindow::readSettings()
{ {
QSettings *settings = m_plugin->core()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("Find"); settings->beginGroup("Find");
foreach (IFindFilter *filter, m_filters) foreach (IFindFilter *filter, m_filters)
filter->readSettings(settings); filter->readSettings(settings);

View File

@@ -97,10 +97,10 @@ static QString formatCommand(const QString &binary, const QStringList &args)
} }
// ---------------- GitClient // ---------------- GitClient
GitClient::GitClient(GitPlugin* plugin, Core::ICore *core) : GitClient::GitClient(GitPlugin* plugin)
m_msgWait(tr("Waiting for data...")), : m_msgWait(tr("Waiting for data...")),
m_plugin(plugin), m_plugin(plugin),
m_core(core) m_core(Core::ICore::instance())
{ {
if (QSettings *s = m_core->settings()) if (QSettings *s = m_core->settings())
m_settings.fromSettings(s); m_settings.fromSettings(s);
@@ -178,7 +178,7 @@ VCSBase::VCSBaseEditor
QTC_ASSERT(rc, return 0); QTC_ASSERT(rc, return 0);
rc->setSource(source); rc->setSource(source);
if (setSourceCodec) if (setSourceCodec)
rc->setCodec(VCSBase::VCSBaseEditor::getCodec(m_core, source)); rc->setCodec(VCSBase::VCSBaseEditor::getCodec(source));
} }
return rc; return rc;
} }

View File

@@ -68,7 +68,7 @@ class GitClient : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit GitClient(GitPlugin *plugin, Core::ICore *core); explicit GitClient(GitPlugin *plugin);
~GitClient(); ~GitClient();
bool managesDirectory(const QString &) const { return false; } bool managesDirectory(const QString &) const { return false; }

View File

@@ -36,6 +36,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QProcess> #include <QtCore/QProcess>
@@ -83,8 +84,7 @@ void GitCommand::execute()
QFuture<void> task = QtConcurrent::run(this, &GitCommand::run); QFuture<void> task = QtConcurrent::run(this, &GitCommand::run);
const QString taskName = QLatin1String("Git ") + m_jobs.front().arguments.at(0); const QString taskName = QLatin1String("Git ") + m_jobs.front().arguments.at(0);
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore::instance()->progressManager()->addTask(task, taskName,
core->progressManager()->addTask(task, taskName,
QLatin1String("Git.action"), QLatin1String("Git.action"),
Core::ProgressManager::CloseOnSuccess); Core::ProgressManager::CloseOnSuccess);
} }

Some files were not shown because too many files have changed in this diff Show More