forked from qt-creator/qt-creator
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
This commit is contained in:
246
doc/coding-style.qdoc
Normal file
246
doc/coding-style.qdoc
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
\contentpage{index.html}{Qt Creator}
|
||||||
|
\page coding-style.html
|
||||||
|
|
||||||
|
\title Qt Creator Coding Rules
|
||||||
|
|
||||||
|
THIS IS PRELIMINARY.
|
||||||
|
|
||||||
|
\section1 Introduction
|
||||||
|
|
||||||
|
The aim of this section is to serve as a guide for the developers, to aid us
|
||||||
|
to build understandable and maintainable code, to create less confusion and
|
||||||
|
surprises when working on Qt Creator.
|
||||||
|
|
||||||
|
As usual: Rules are not set in stone. If there's a good reason to break one,
|
||||||
|
do it, preferably after making sure that there are others agreeing.
|
||||||
|
|
||||||
|
This document is incomplete.
|
||||||
|
|
||||||
|
In general, if you want to contribute to the main source, we expect at least
|
||||||
|
that you:
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\o The most important rule first: KISS (keep it simple ...): always
|
||||||
|
use a simple implementation in favor of a more complicated one.
|
||||||
|
This eases maintenance a lot.
|
||||||
|
\o Write good C++ code: Readable, well commented when necessary,
|
||||||
|
and taking advantage of the OO model. Follow the \l{Formatting} guidelines.
|
||||||
|
There are also certain \l{Code Constructs} that we try to follow.
|
||||||
|
\o Adapt the code to the structures already existing in Qt Creator, or in
|
||||||
|
the case that you have better ideas, discuss them with other developers
|
||||||
|
before writing the code.
|
||||||
|
\o Take advantage of Qt. Don't re-invent the wheel. Think about what parts
|
||||||
|
of your code are generic enough that they might be incorporated into
|
||||||
|
Qt proper.
|
||||||
|
\o Document interfaces. Right now we use qdoc, but changing to doxygen
|
||||||
|
is being considered.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section1 Submitting Code
|
||||||
|
|
||||||
|
It is implicitly understood that all patches contributed to The Qt Creator
|
||||||
|
Project are made under under the Gnu General Public License, version 2 or later
|
||||||
|
and
|
||||||
|
|
||||||
|
If you have a problem with that, don't contribute code.
|
||||||
|
|
||||||
|
Also please don't just pop up out of the blue with a huge patch (or
|
||||||
|
small) that changes something substantial in Qt Creator. Always discuss your
|
||||||
|
ideas with the other developers on mailing list first.
|
||||||
|
|
||||||
|
When you create the patch, please use git or use "diff -up" since we find
|
||||||
|
that a lot easier to read than the other diff formats. Also please do not
|
||||||
|
send patches that implements or fixes several different things; several
|
||||||
|
patches is a much better option.
|
||||||
|
|
||||||
|
We also require you to provide a commit message entry with every patch,
|
||||||
|
this describes in detail what the patch is doing.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section1 Code Constructs
|
||||||
|
|
||||||
|
We have several guidelines on code constructs, some of these exist to
|
||||||
|
make the code faster, others to make the code clearer. Yet others
|
||||||
|
exist to allow us to take advantage of the strong type checking
|
||||||
|
in C++.
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\o Declaration of variables should wait as long as possible. The rule
|
||||||
|
is: "Don't declare it until you need it." In C++ there are a lot of
|
||||||
|
user defined types, and these can very often be expensive to
|
||||||
|
initialize. This rule connects to the next rule too.
|
||||||
|
|
||||||
|
\o Make the scope of a variable as small as possible.
|
||||||
|
|
||||||
|
\o Prefer preincrement to postincrement whenever possible.
|
||||||
|
Preincrement has potential of being faster than postincrement. Just
|
||||||
|
think about the obvious implementations of pre/post-increment. This
|
||||||
|
rule applies to decrement too.
|
||||||
|
|
||||||
|
\code
|
||||||
|
++T;
|
||||||
|
--U;
|
||||||
|
-NOT-
|
||||||
|
T++; // not used in Qt Creator
|
||||||
|
U--; // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\o Try to minimize evaluation of the same code over and over. This is
|
||||||
|
aimed especially at loops.
|
||||||
|
|
||||||
|
\code
|
||||||
|
|
||||||
|
Container::iterator end = large.end();
|
||||||
|
for (Container::iterator it = large.begin(); it != end; ++it) {
|
||||||
|
...;
|
||||||
|
}
|
||||||
|
-NOT-
|
||||||
|
for (Container::iterator it = large.begin();
|
||||||
|
it != large.end(); ++it) {
|
||||||
|
...;
|
||||||
|
}
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section1 Formatting
|
||||||
|
|
||||||
|
\section2 Declarations
|
||||||
|
|
||||||
|
Only one declaration on each line.
|
||||||
|
\code
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
-NOT-
|
||||||
|
int a, b; // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
This is especially important when initialization is done at the same
|
||||||
|
time.
|
||||||
|
\code
|
||||||
|
QString a = "Joe";
|
||||||
|
QString b = "Foo";
|
||||||
|
-NOT-
|
||||||
|
QString a = "Joe", b = "Foo"; // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
[Note that 'QString a = "Joe"' is formally calling a copy constructor
|
||||||
|
on a temporary constructed from a string literal and therefore has the
|
||||||
|
potential of being more expensive then direct construction by
|
||||||
|
'QString a("joe")'. However the compiler is allowed to elide the copy
|
||||||
|
(even if it had side effects), and modern compilers typically do so.
|
||||||
|
Given these equal costs, Qt Creator code favours the '=' idiom as it is in
|
||||||
|
line with the traditional C-style initialization, _and_ cannot be
|
||||||
|
mistaken as function declaration, _and_ reduces the level of nested
|
||||||
|
parantheses in more initializations.]
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Pointers and references
|
||||||
|
|
||||||
|
\code
|
||||||
|
char *p = "flop";
|
||||||
|
char &c = *p;
|
||||||
|
-NOT-
|
||||||
|
char* p = "flop"; // not used in Qt Creator
|
||||||
|
char & c = *p; // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
This is simply in line with the official Qt guide lines.
|
||||||
|
|
||||||
|
Also note that we will have:
|
||||||
|
\code
|
||||||
|
const char *p;
|
||||||
|
-NOT-
|
||||||
|
char const * p; // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
Using a plain 0 for Null pointer constants is always correct and least effort
|
||||||
|
to type. So:
|
||||||
|
\code
|
||||||
|
void *p = 0;
|
||||||
|
-NOT-
|
||||||
|
void *p = NULL; // not used in Qt Creator
|
||||||
|
-NOT-
|
||||||
|
void *p = '\0'; // not used in Qt Creator
|
||||||
|
-NOT-
|
||||||
|
void *p = 42 - 7 * 6; // also not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
Note: As an exception, imported third party code as well as code
|
||||||
|
interfacing the "native" APIs (src/support/os_*) can use NULL.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Operator names and parentheses
|
||||||
|
\code
|
||||||
|
operator==(type)
|
||||||
|
-NOT-
|
||||||
|
operator == (type) // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The == is part of the function name, separating it makes the
|
||||||
|
declaration look like an expression.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Function names and parentheses
|
||||||
|
\code
|
||||||
|
void mangle()
|
||||||
|
-NOT-
|
||||||
|
void mangle () // not used in Qt Creator
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Naming rules
|
||||||
|
|
||||||
|
Simply follow the style of Qt proper. As examples:
|
||||||
|
\list
|
||||||
|
\o Use descriptive but simple and short names. Do not abbreviate.
|
||||||
|
|
||||||
|
\o Class names are capitalized, and function names lowercased.
|
||||||
|
Enums are named like Classes, values are in lower-case.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Formatting
|
||||||
|
|
||||||
|
Adapt the formatting of your code to the one used in the
|
||||||
|
other parts of Qt Creator. In case there is different formatting for
|
||||||
|
the same construct, use the one used more often.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Declarations
|
||||||
|
|
||||||
|
- Use this order for the access sections of your class: public,
|
||||||
|
protected, private. The public section is interesting for every
|
||||||
|
user of the class. The private section is only of interest for the
|
||||||
|
implementors of the class (you). [Obviously not true since this is
|
||||||
|
for developers, and we do not want one developer only to be able to
|
||||||
|
read and understand the implementation of class internals. Lgb]
|
||||||
|
|
||||||
|
- Avoid declaring global objects in the declaration file of the class.
|
||||||
|
If the same variable is used for all objects, use a static member.
|
||||||
|
|
||||||
|
- Avoid global or static variables.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 File headers
|
||||||
|
|
||||||
|
If you create a new file, the top of the file should include a
|
||||||
|
header comment equal to the one found in other source files of Qt Creator.
|
||||||
|
|
||||||
|
\section2 Documentation
|
||||||
|
|
||||||
|
The documentation is generated from source and header files.
|
||||||
|
You document for the other developers, not for yourself.
|
||||||
|
In the header you should document interfaces, i.e. what the function does,
|
||||||
|
not the implementation.
|
||||||
|
In the .cpp files you document the implementation if the implementation
|
||||||
|
in non-obvious.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
\o \inlineimage qtcreator.png
|
\o \inlineimage qtcreator.png
|
||||||
\o Qt Creator includes a wide range of useful features. Among them are:
|
\o Qt Creator includes a wide range of useful features. Among them are:
|
||||||
\list 1
|
\list 1
|
||||||
|
\o \bold{Smart Code Editor}: The code editor provides syntax
|
||||||
|
highlighting as well as code completion.
|
||||||
\o \bold{Qt4 Project Generating Wizard}: This wizard allows the user
|
\o \bold{Qt4 Project Generating Wizard}: This wizard allows the user
|
||||||
to generate a project for a console application, a GUI application,
|
to generate a project for a console application, a GUI application,
|
||||||
or a C++ library.
|
or a C++ library.
|
||||||
@@ -48,7 +50,7 @@
|
|||||||
\o \l{Creating a Project in Qt Creator}
|
\o \l{Creating a Project in Qt Creator}
|
||||||
\o \l{Build Settings}
|
\o \l{Build Settings}
|
||||||
\o \l{Writing a Simple Program with Qt Creator}
|
\o \l{Writing a Simple Program with Qt Creator}
|
||||||
\o \l{Quick Navigation}
|
\o \l{Navigating Quickly Around Your Code}
|
||||||
\o \l{Debugging with Qt Creator}
|
\o \l{Debugging with Qt Creator}
|
||||||
\o \l{Tips and Tricks}
|
\o \l{Tips and Tricks}
|
||||||
\o \l{Glossary}
|
\o \l{Glossary}
|
||||||
@@ -64,86 +66,85 @@
|
|||||||
|
|
||||||
\title A Quick Tour Around Qt Creator
|
\title A Quick Tour Around Qt Creator
|
||||||
|
|
||||||
The labeled screenshot below shows some of the components of Qt Creator,
|
The labeled screenshot below shows some of the components of Qt Creator, in
|
||||||
in \gui Edit mode.
|
\gui Edit mode.
|
||||||
|
|
||||||
\image qtcreator-breakdown.png
|
\image qtcreator-breakdown.png
|
||||||
|
|
||||||
\section1 The Mode Selectors
|
\section1 The Mode Selectors
|
||||||
|
|
||||||
When working in Qt Creator, you can be in one of five modes: \bold Project,
|
When working in Qt Creator, you can be in one of six modes: \bold Welcome,
|
||||||
\bold Edit, \bold Debug, \bold Help, and \bold Output.
|
\bold Edit, \bold Debug, \bold Projects, \bold Help, and \bold Output.
|
||||||
|
|
||||||
Mode selectors allow you to quickly switch between tasks: Editing,
|
Mode selectors allow you to quickly switch between tasks: Editing, browsing
|
||||||
browsing the Qt manual, setting up the build environment, etc. You can
|
the Qt Creator manual, setting up the build environment, etc. You can
|
||||||
activate a mode by either clicking on its mode selector, or using the
|
activate a mode by either clicking on its mode selector, or using the
|
||||||
\l{keyboard-shortcuts}{corresponding shortcut}. Certain actions also
|
\l{keyboard-shortcuts}{corresponding shortcut}. Certain actions also
|
||||||
trigger a mode change, e.g., \gui{Debug}/\gui{Start Debugging} will switch
|
trigger a mode change, e.g., \gui{Debug}/\gui{Start Debugging} will switch
|
||||||
to the \gui Debug mode.
|
to the \gui Debug mode.
|
||||||
|
|
||||||
|
|
||||||
\list
|
\list
|
||||||
|
|
||||||
\o \gui{Welcome Mode} - Displays a welcome screen allowing you to quickly
|
\o \gui{Welcome Mode} - Displays a welcome screen allowing you to quickly
|
||||||
load recent sessions or individual projects. This is the first mode
|
load recent sessions or individual projects. This is the mode you will see
|
||||||
displayed if Qt Creator is run without command line switches.
|
if Qt Creator is run without command line switches.
|
||||||
|
|
||||||
\o \gui{Edit Mode} - You can edit both project and source files here. An
|
\o \gui{Edit Mode} - Lets you edit both project and source files. A sidebar
|
||||||
optional sidebar on the left provides different views to navigate between
|
on the left provides different views to navigate between files.
|
||||||
files.
|
|
||||||
|
|
||||||
\o \gui{Debug Mode} - Provides various ways to inspect the state of the
|
\o \gui{Debug Mode} - Provides various ways to inspect the state of the
|
||||||
program while debugging. See \l{qtcreator-debugging}{Debugging With Qt
|
program while debugging. See \l{qtcreator-debugging}{Debugging With Qt
|
||||||
Creator} for a hands-on description of the mode.
|
Creator} for a hands-on description of how to use this mode.
|
||||||
|
|
||||||
\o \gui{Build & Run Mode} - Lets you configure how projects can be built
|
\o \gui{Projects Mode} - Lets you configure how projects can be built and
|
||||||
and executed. Under the list of projects, there are tabs to configure the
|
executed. Under the list of projects, there are tabs to configure the
|
||||||
build and run settings.
|
build, run, and editor settings.
|
||||||
|
|
||||||
\o \gui{Help Mode} - Shows any documentation registered by Qt Assistant,
|
\o \gui{Help Mode} - Shows any documentation registered by Qt Assistant,
|
||||||
such as the Qt library and Qt Creator documentation.
|
such as the Qt library and Qt Creator documentation.
|
||||||
|
|
||||||
\o \gui{Output Mode} - Lets you examine various logs in detail, for example
|
\o \gui{Output Mode} - Lets you examine various data in detail, for example
|
||||||
the task list, the compiler and application output. Some of these logs can
|
build issues as well as compile and application output. This information
|
||||||
also be viewed in the output panes.
|
is also available in the output panes.
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
\section1 The Output Panes
|
\section1 The Output Panes
|
||||||
|
|
||||||
The task pane in Qt Creator can display one out of four different panes:
|
The task pane in Qt Creator can display one of four different panes:
|
||||||
Task List, Search Results, Application Output, and Compile Output. These
|
\gui{Build Issues}, \gui{Search Results}, \gui{Application Output}, and
|
||||||
panes are available in all modes.
|
\gui{Compile}. These panes are available in all modes.
|
||||||
|
|
||||||
\section2 Task List
|
\section2 Build Issues
|
||||||
|
|
||||||
The Task List provides a list of important tasks such as error messages
|
The {Build Issues} pane provides a list of issues, e.g., error messages or
|
||||||
that need to be fixed. It filters out irrelevant output from the compiler
|
warnings that need to be fixed. It filters out irrelevant output from the
|
||||||
and collects them in the form of tasks.
|
compiler and collects them in an organized way.
|
||||||
|
|
||||||
\image qtcreator-task-list.png
|
\image qtcreator-build-issues.png
|
||||||
|
|
||||||
\section2 Search Results
|
\section2 Search Results
|
||||||
|
|
||||||
The Search Results pane displays the results for global searches such as
|
The \gui{Search Results} pane displays the results for global searches such
|
||||||
searching within a current document, files on disk, or all projects.
|
as searching within a current document, files on disk, or all projects. In
|
||||||
In the screenshot below, we searched for all occurrences of \c{textfinder}
|
the screenshot below, we searched for all occurrences of \c{textfinder}
|
||||||
within the "/TextFinder" folder.
|
within the \c{"/TextFinder"} folder.
|
||||||
|
|
||||||
\image qtcreator-search-pane.png
|
\image qtcreator-search-pane.png
|
||||||
|
|
||||||
\section2 Application Output
|
\section2 Application Output
|
||||||
|
|
||||||
This pane displays the status of the program when it is executed, as
|
The \gui{Application Output} pane displays the status of the program when
|
||||||
well as debug output, for example, output from qDebug().
|
it is executed and debug output, e.g., output from qDebug().
|
||||||
|
|
||||||
\image qtcreator-application-output.png
|
\image qtcreator-application-output.png
|
||||||
|
|
||||||
\section2 Compile Output
|
\section2 Compile
|
||||||
|
|
||||||
The Compile Output provides all the output from the compiler. In other
|
The \gui{Compile} pane provides all the output from the compiler. In other
|
||||||
words, it is a more verbose version of the Task List.
|
words, it is a more verbose version of information displayed in the
|
||||||
|
\gui{Build Issues}
|
||||||
|
|
||||||
\image qtcreator-compile-pane.png
|
\image qtcreator-compile-pane.png
|
||||||
|
|
||||||
@@ -521,7 +522,7 @@
|
|||||||
\page creator-navigation.html
|
\page creator-navigation.html
|
||||||
\nextpage creator-debugging.html
|
\nextpage creator-debugging.html
|
||||||
|
|
||||||
\title Quick Navigation
|
\title Navigating Quickly Around Your Code
|
||||||
|
|
||||||
With Qt Creator, navigating to different locations in your project or on
|
With Qt Creator, navigating to different locations in your project or on
|
||||||
your disk, such as files, classes and methods, is trivial using the input
|
your disk, such as files, classes and methods, is trivial using the input
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ static const char *HELP_OPTION4 = "--help";
|
|||||||
static const char *VERSION_OPTION = "-version";
|
static const char *VERSION_OPTION = "-version";
|
||||||
static const char *CLIENT_OPTION = "-client";
|
static const char *CLIENT_OPTION = "-client";
|
||||||
|
|
||||||
typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
||||||
|
|
||||||
// Helpers for displaying messages. Note that there is no console on Windows.
|
// Helpers for displaying messages. Note that there is no console on Windows.
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <TranslationUnit.h>
|
#include <TranslationUnit.h>
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <cplusplus/ResolveExpression.h>
|
#include <cplusplus/ResolveExpression.h>
|
||||||
|
#include <cplusplus/pp.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
@@ -53,9 +54,13 @@ void TypeOfExpression::setDocuments(const QMap<QString, Document::Ptr> &document
|
|||||||
|
|
||||||
QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,
|
QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,
|
||||||
Document::Ptr document,
|
Document::Ptr document,
|
||||||
Symbol *lastVisibleSymbol)
|
Symbol *lastVisibleSymbol,
|
||||||
|
PreprocessMode mode)
|
||||||
{
|
{
|
||||||
Document::Ptr expressionDoc = documentForExpression(expression);
|
QString code = expression;
|
||||||
|
if (mode == Preprocess)
|
||||||
|
code = preprocessedExpression(expression, m_documents, document);
|
||||||
|
Document::Ptr expressionDoc = documentForExpression(code);
|
||||||
m_ast = extractExpressionAST(expressionDoc);
|
m_ast = extractExpressionAST(expressionDoc);
|
||||||
|
|
||||||
m_lookupContext = LookupContext(lastVisibleSymbol, expressionDoc,
|
m_lookupContext = LookupContext(lastVisibleSymbol, expressionDoc,
|
||||||
@@ -97,3 +102,34 @@ Document::Ptr TypeOfExpression::documentForExpression(const QString &expression)
|
|||||||
doc->parse(Document::ParseExpression);
|
doc->parse(Document::ParseExpression);
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TypeOfExpression::processEnvironment(QMap<QString, Document::Ptr> documents,
|
||||||
|
Document::Ptr doc, Environment *env,
|
||||||
|
QSet<QString> *processed) const
|
||||||
|
{
|
||||||
|
if (processed->contains(doc->fileName()))
|
||||||
|
return;
|
||||||
|
processed->insert(doc->fileName());
|
||||||
|
foreach (const Document::Include &incl, doc->includes()) {
|
||||||
|
processEnvironment(documents,
|
||||||
|
documents.value(incl.fileName()),
|
||||||
|
env, processed);
|
||||||
|
}
|
||||||
|
foreach (const Macro ¯o, doc->definedMacros())
|
||||||
|
env->bind(macro);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TypeOfExpression::preprocessedExpression(const QString &expression,
|
||||||
|
QMap<QString, Document::Ptr> documents,
|
||||||
|
Document::Ptr thisDocument) const
|
||||||
|
{
|
||||||
|
Environment env;
|
||||||
|
QSet<QString> processed;
|
||||||
|
processEnvironment(documents, thisDocument,
|
||||||
|
&env, &processed);
|
||||||
|
const QByteArray code = expression.toUtf8();
|
||||||
|
pp preproc(0, env);
|
||||||
|
QByteArray preprocessedCode;
|
||||||
|
preproc("<expression>", code, &preprocessedCode);
|
||||||
|
return QString::fromUtf8(preprocessedCode);
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,6 +43,9 @@
|
|||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
|
class Environment;
|
||||||
|
class Macro;
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT TypeOfExpression
|
class CPLUSPLUS_EXPORT TypeOfExpression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -60,6 +63,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setDocuments(const QMap<QString, Document::Ptr> &documents);
|
void setDocuments(const QMap<QString, Document::Ptr> &documents);
|
||||||
|
|
||||||
|
enum PreprocessMode {
|
||||||
|
NoPreprocess,
|
||||||
|
Preprocess
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of possible fully specified types associated with the
|
* Returns a list of possible fully specified types associated with the
|
||||||
* given expression.
|
* given expression.
|
||||||
@@ -73,7 +81,8 @@ public:
|
|||||||
* @param lastVisibleSymbol The last visible symbol in the document.
|
* @param lastVisibleSymbol The last visible symbol in the document.
|
||||||
*/
|
*/
|
||||||
QList<Result> operator()(const QString &expression, Document::Ptr document,
|
QList<Result> operator()(const QString &expression, Document::Ptr document,
|
||||||
Symbol *lastVisibleSymbol);
|
Symbol *lastVisibleSymbol,
|
||||||
|
PreprocessMode mode = NoPreprocess);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the AST of the last evaluated expression.
|
* Returns the AST of the last evaluated expression.
|
||||||
@@ -91,6 +100,14 @@ private:
|
|||||||
ExpressionAST *extractExpressionAST(Document::Ptr doc) const;
|
ExpressionAST *extractExpressionAST(Document::Ptr doc) const;
|
||||||
Document::Ptr documentForExpression(const QString &expression) const;
|
Document::Ptr documentForExpression(const QString &expression) const;
|
||||||
|
|
||||||
|
void processEnvironment(QMap<QString, CPlusPlus::Document::Ptr> documents,
|
||||||
|
CPlusPlus::Document::Ptr doc, CPlusPlus::Environment *env,
|
||||||
|
QSet<QString> *processed) const;
|
||||||
|
|
||||||
|
QString preprocessedExpression(const QString &expression,
|
||||||
|
QMap<QString, CPlusPlus::Document::Ptr> documents,
|
||||||
|
CPlusPlus::Document::Ptr thisDocument) const;
|
||||||
|
|
||||||
QMap<QString, Document::Ptr> m_documents;
|
QMap<QString, Document::Ptr> m_documents;
|
||||||
ExpressionAST *m_ast;
|
ExpressionAST *m_ast;
|
||||||
LookupContext m_lookupContext;
|
LookupContext m_lookupContext;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ bool OptionsParser::checkForNoLoadOption()
|
|||||||
"The plugin '%1' does not exist.").arg(m_currentArg);
|
"The plugin '%1' does not exist.").arg(m_currentArg);
|
||||||
m_hasError = true;
|
m_hasError = true;
|
||||||
} else {
|
} else {
|
||||||
m_pmPrivate->pluginSpecs.remove(spec);
|
m_pmPrivate->pluginSpecs.removeAll(spec);
|
||||||
delete spec;
|
delete spec;
|
||||||
m_isDependencyRefreshNeeded = true;
|
m_isDependencyRefreshNeeded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <QTest>
|
#include <QTest>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
||||||
|
|
||||||
enum { debugLeaks = 0 };
|
enum { debugLeaks = 0 };
|
||||||
|
|
||||||
@@ -162,6 +162,11 @@ enum { debugLeaks = 0 };
|
|||||||
using namespace ExtensionSystem;
|
using namespace ExtensionSystem;
|
||||||
using namespace ExtensionSystem::Internal;
|
using namespace ExtensionSystem::Internal;
|
||||||
|
|
||||||
|
static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
|
||||||
|
{
|
||||||
|
return one->name() < two->name();
|
||||||
|
}
|
||||||
|
|
||||||
PluginManager *PluginManager::m_instance = 0;
|
PluginManager *PluginManager::m_instance = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -306,7 +311,7 @@ QStringList PluginManager::arguments() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QSet<PluginSpec *> PluginManager::plugins() const
|
\fn QList<PluginSpec *> PluginManager::plugins() const
|
||||||
List of all plugin specifications that have been found in the plugin search paths.
|
List of all plugin specifications that have been found in the plugin search paths.
|
||||||
This list is valid directly after the setPluginPaths() call.
|
This list is valid directly after the setPluginPaths() call.
|
||||||
The plugin specifications contain the information from the plugins' xml description files
|
The plugin specifications contain the information from the plugins' xml description files
|
||||||
@@ -315,7 +320,7 @@ QStringList PluginManager::arguments() const
|
|||||||
|
|
||||||
\sa setPluginPaths()
|
\sa setPluginPaths()
|
||||||
*/
|
*/
|
||||||
QSet<PluginSpec *> PluginManager::plugins() const
|
QList<PluginSpec *> PluginManager::plugins() const
|
||||||
{
|
{
|
||||||
return d->pluginSpecs;
|
return d->pluginSpecs;
|
||||||
}
|
}
|
||||||
@@ -703,9 +708,11 @@ void PluginManagerPrivate::readPluginPaths()
|
|||||||
foreach (const QString &specFile, specFiles) {
|
foreach (const QString &specFile, specFiles) {
|
||||||
PluginSpec *spec = new PluginSpec;
|
PluginSpec *spec = new PluginSpec;
|
||||||
spec->d->read(specFile);
|
spec->d->read(specFile);
|
||||||
pluginSpecs.insert(spec);
|
pluginSpecs.append(spec);
|
||||||
}
|
}
|
||||||
resolveDependencies();
|
resolveDependencies();
|
||||||
|
// ensure deterministic plugin load order by sorting
|
||||||
|
qSort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
|
||||||
emit q->pluginsChanged();
|
emit q->pluginsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
QStringList pluginPaths() const;
|
QStringList pluginPaths() const;
|
||||||
void setPluginPaths(const QStringList &paths);
|
void setPluginPaths(const QStringList &paths);
|
||||||
QSet<PluginSpec *> plugins() const;
|
QList<PluginSpec *> plugins() const;
|
||||||
void setFileExtension(const QString &extension);
|
void setFileExtension(const QString &extension);
|
||||||
QString fileExtension() const;
|
QString fileExtension() const;
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
|
void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
|
||||||
void resolveDependencies();
|
void resolveDependencies();
|
||||||
|
|
||||||
QSet<PluginSpec *> pluginSpecs;
|
QList<PluginSpec *> pluginSpecs;
|
||||||
QList<PluginSpec *> testSpecs;
|
QList<PluginSpec *> testSpecs;
|
||||||
QStringList pluginPaths;
|
QStringList pluginPaths;
|
||||||
QString extension;
|
QString extension;
|
||||||
|
|||||||
@@ -693,10 +693,10 @@ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &ve
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
|
\fn bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
|
bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
||||||
{
|
{
|
||||||
if (hasError)
|
if (hasError)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
bool read(const QString &fileName);
|
bool read(const QString &fileName);
|
||||||
bool provides(const QString &pluginName, const QString &version) const;
|
bool provides(const QString &pluginName, const QString &version) const;
|
||||||
bool resolveDependencies(const QSet<PluginSpec *> &specs);
|
bool resolveDependencies(const QList<PluginSpec *> &specs);
|
||||||
bool loadLibrary();
|
bool loadLibrary();
|
||||||
bool initializePlugin();
|
bool initializePlugin();
|
||||||
bool initializeExtensions();
|
bool initializeExtensions();
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ void CPPEditor::jumpToDefinition()
|
|||||||
unsigned lineno = tc.blockNumber() + 1;
|
unsigned lineno = tc.blockNumber() + 1;
|
||||||
foreach (const Document::Include &incl, doc->includes()) {
|
foreach (const Document::Include &incl, doc->includes()) {
|
||||||
if (incl.line() == lineno) {
|
if (incl.line() == lineno) {
|
||||||
if (TextEditor::BaseTextEditor::openEditorAt(incl.fileName(), 0, 0))
|
if (openCppEditorAt(incl.fileName(), 0, 0))
|
||||||
return; // done
|
return; // done
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ void CPPEditor::jumpToDefinition()
|
|||||||
QList<Symbol *> candidates = context.resolve(namedType->name());
|
QList<Symbol *> candidates = context.resolve(namedType->name());
|
||||||
if (!candidates.isEmpty()) {
|
if (!candidates.isEmpty()) {
|
||||||
Symbol *s = candidates.takeFirst();
|
Symbol *s = candidates.takeFirst();
|
||||||
openEditorAt(s->fileName(), s->line(), s->column());
|
openCppEditorAt(s->fileName(), s->line(), s->column());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -534,7 +534,7 @@ void CPPEditor::jumpToDefinition()
|
|||||||
if (use.contains(endOfName - 1)) {
|
if (use.contains(endOfName - 1)) {
|
||||||
const Macro ¯o = use.macro();
|
const Macro ¯o = use.macro();
|
||||||
const QString fileName = QString::fromUtf8(macro.fileName);
|
const QString fileName = QString::fromUtf8(macro.fileName);
|
||||||
if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
|
if (openCppEditorAt(fileName, macro.line, 0))
|
||||||
return; // done
|
return; // done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -837,8 +837,15 @@ int CPPEditor::endOfNameUnderCursor()
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName,
|
||||||
|
int line, int column)
|
||||||
|
{
|
||||||
|
return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column,
|
||||||
|
Constants::C_CPPEDITOR);
|
||||||
|
}
|
||||||
|
|
||||||
bool CPPEditor::openEditorAt(Symbol *s)
|
bool CPPEditor::openEditorAt(Symbol *s)
|
||||||
{
|
{
|
||||||
const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
|
const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
|
||||||
return TextEditor::BaseTextEditor::openEditorAt(fileName, s->line(), s->column());
|
return openCppEditorAt(fileName, s->line(), s->column());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,9 @@ private:
|
|||||||
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
||||||
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
||||||
|
|
||||||
|
TextEditor::ITextEditor *openCppEditorAt(const QString &fileName, int line,
|
||||||
|
int column = 0);
|
||||||
|
|
||||||
int previousBlockState(QTextBlock block) const;
|
int previousBlockState(QTextBlock block) const;
|
||||||
QTextCursor moveToPreviousToken(QTextCursor::MoveMode mode) const;
|
QTextCursor moveToPreviousToken(QTextCursor::MoveMode mode) const;
|
||||||
QTextCursor moveToNextToken(QTextCursor::MoveMode mode) const;
|
QTextCursor moveToNextToken(QTextCursor::MoveMode mode) const;
|
||||||
|
|||||||
@@ -439,7 +439,8 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
|
|
||||||
typeOfExpression.setDocuments(m_manager->documents());
|
typeOfExpression.setDocuments(m_manager->documents());
|
||||||
|
|
||||||
QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol);
|
QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol,
|
||||||
|
TypeOfExpression::Preprocess);
|
||||||
LookupContext context = typeOfExpression.lookupContext();
|
LookupContext context = typeOfExpression.lookupContext();
|
||||||
|
|
||||||
if (!typeOfExpression.expressionAST() && (! m_completionOperator ||
|
if (!typeOfExpression.expressionAST() && (! m_completionOperator ||
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ SOURCES += attachexternaldialog.cpp \
|
|||||||
gdbengine.cpp \
|
gdbengine.cpp \
|
||||||
gdbmi.cpp \
|
gdbmi.cpp \
|
||||||
gdboptionpage.cpp \
|
gdboptionpage.cpp \
|
||||||
gdbtypemacros.cpp \
|
|
||||||
gdbengine.h \
|
gdbengine.h \
|
||||||
moduleshandler.cpp \
|
moduleshandler.cpp \
|
||||||
moduleswindow.cpp \
|
moduleswindow.cpp \
|
||||||
@@ -79,7 +78,6 @@ FORMS += attachexternaldialog.ui \
|
|||||||
breakcondition.ui \
|
breakcondition.ui \
|
||||||
mode.ui \
|
mode.ui \
|
||||||
gdboptionpage.ui \
|
gdboptionpage.ui \
|
||||||
gdbtypemacros.ui \
|
|
||||||
startexternaldialog.ui \
|
startexternaldialog.ui \
|
||||||
|
|
||||||
RESOURCES += debugger.qrc
|
RESOURCES += debugger.qrc
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ DebuggerPlugin::DebuggerPlugin()
|
|||||||
{
|
{
|
||||||
m_pm = 0;
|
m_pm = 0;
|
||||||
m_generalOptionPage = 0;
|
m_generalOptionPage = 0;
|
||||||
m_typeMacroPage = 0;
|
|
||||||
m_locationMark = 0;
|
m_locationMark = 0;
|
||||||
m_manager = 0;
|
m_manager = 0;
|
||||||
}
|
}
|
||||||
@@ -202,7 +201,6 @@ void DebuggerPlugin::shutdown()
|
|||||||
//qDebug() << "DebuggerPlugin::~DebuggerPlugin";
|
//qDebug() << "DebuggerPlugin::~DebuggerPlugin";
|
||||||
removeObject(m_debugMode);
|
removeObject(m_debugMode);
|
||||||
removeObject(m_generalOptionPage);
|
removeObject(m_generalOptionPage);
|
||||||
removeObject(m_typeMacroPage);
|
|
||||||
|
|
||||||
// FIXME: when using the line below, BreakWindow etc gets deleted twice.
|
// FIXME: when using the line below, BreakWindow etc gets deleted twice.
|
||||||
// so better leak for now...
|
// so better leak for now...
|
||||||
@@ -212,9 +210,6 @@ void DebuggerPlugin::shutdown()
|
|||||||
delete m_generalOptionPage;
|
delete m_generalOptionPage;
|
||||||
m_generalOptionPage = 0;
|
m_generalOptionPage = 0;
|
||||||
|
|
||||||
delete m_typeMacroPage;
|
|
||||||
m_typeMacroPage = 0;
|
|
||||||
|
|
||||||
delete m_locationMark;
|
delete m_locationMark;
|
||||||
m_locationMark = 0;
|
m_locationMark = 0;
|
||||||
|
|
||||||
@@ -409,13 +404,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
mdebug->addAction(cmd);
|
mdebug->addAction(cmd);
|
||||||
|
|
||||||
m_generalOptionPage = 0;
|
m_generalOptionPage = 0;
|
||||||
m_typeMacroPage = 0;
|
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
m_generalOptionPage = new GdbOptionPage(&theGdbSettings());
|
m_generalOptionPage = new GdbOptionPage(&theGdbSettings());
|
||||||
addObject(m_generalOptionPage);
|
addObject(m_generalOptionPage);
|
||||||
m_typeMacroPage = new TypeMacroPage(&theGdbSettings());
|
|
||||||
addObject(m_typeMacroPage);
|
|
||||||
|
|
||||||
m_locationMark = 0;
|
m_locationMark = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ namespace Internal {
|
|||||||
class DebuggerManager;
|
class DebuggerManager;
|
||||||
class DebugMode;
|
class DebugMode;
|
||||||
class GdbOptionPage;
|
class GdbOptionPage;
|
||||||
class TypeMacroPage;
|
|
||||||
class LocationMark;
|
class LocationMark;
|
||||||
|
|
||||||
class DebuggerPlugin : public ExtensionSystem::IPlugin
|
class DebuggerPlugin : public ExtensionSystem::IPlugin
|
||||||
@@ -103,7 +102,6 @@ private:
|
|||||||
|
|
||||||
ExtensionSystem::PluginManager *m_pm;
|
ExtensionSystem::PluginManager *m_pm;
|
||||||
GdbOptionPage *m_generalOptionPage;
|
GdbOptionPage *m_generalOptionPage;
|
||||||
TypeMacroPage *m_typeMacroPage;
|
|
||||||
|
|
||||||
QString m_previousMode;
|
QString m_previousMode;
|
||||||
LocationMark *m_locationMark;
|
LocationMark *m_locationMark;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ enum DataDumperState
|
|||||||
DataDumperUnavailable,
|
DataDumperUnavailable,
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: Move to extra file?
|
|
||||||
class GdbSettings
|
class GdbSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ GdbOptionPage::GdbOptionPage(GdbSettings *settings)
|
|||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
defaultCommand.append(".exe");
|
defaultCommand.append(".exe");
|
||||||
#endif
|
#endif
|
||||||
|
QString defaultScript = coreIFace->resourcePath() +
|
||||||
|
QLatin1String("/gdb/qt4macros");
|
||||||
|
|
||||||
m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString();
|
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_gdbEnv = s->value("Environment", "").toString();
|
||||||
m_settings->m_autoRun = s->value("AutoRun", true).toBool();
|
m_settings->m_autoRun = s->value("AutoRun", true).toBool();
|
||||||
m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
|
m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
|
||||||
@@ -72,36 +76,56 @@ QString GdbOptionPage::name() const
|
|||||||
|
|
||||||
QString GdbOptionPage::category() const
|
QString GdbOptionPage::category() const
|
||||||
{
|
{
|
||||||
return "Debugger|Gdb";
|
return "Debugger";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GdbOptionPage::trCategory() const
|
QString GdbOptionPage::trCategory() const
|
||||||
{
|
{
|
||||||
return tr("Debugger|Gdb");
|
return tr("Debugger");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *GdbOptionPage::createPage(QWidget *parent)
|
QWidget *GdbOptionPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
QWidget *w = new QWidget(parent);
|
QWidget *w = new QWidget(parent);
|
||||||
m_ui.setupUi(w);
|
m_ui.setupUi(w);
|
||||||
m_ui.gdbEdit->setText(m_settings->m_gdbCmd);
|
m_ui.gdbLocationEdit->setText(m_settings->m_gdbCmd);
|
||||||
m_ui.envEdit->setText(m_settings->m_gdbEnv);
|
m_ui.environmentEdit->setText(m_settings->m_gdbEnv);
|
||||||
m_ui.autoStartBox->setChecked(m_settings->m_autoRun);
|
m_ui.autoStartBox->setChecked(m_settings->m_autoRun);
|
||||||
m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
|
m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
|
||||||
connect(m_ui.pushButtonBrowse, SIGNAL(clicked()),
|
m_ui.gdbStartupScriptEdit->setText(m_settings->m_scriptFile);
|
||||||
this, SLOT(browse()));
|
|
||||||
|
// FIXME
|
||||||
|
m_ui.autoStartBox->hide();
|
||||||
|
m_ui.autoQuitBox->hide();
|
||||||
|
m_ui.environmentEdit->hide();
|
||||||
|
m_ui.labelEnvironment->hide();
|
||||||
|
|
||||||
|
connect(m_ui.browseForGdbButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(browseForGdb()));
|
||||||
|
connect(m_ui.browseForScriptButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(browseForScript()));
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbOptionPage::browse()
|
void GdbOptionPage::browseForGdb()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse,
|
QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton,
|
||||||
"Browse for gdb executable");
|
"Browse for gdb executable");
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
m_settings->m_gdbCmd = fileName;
|
m_settings->m_gdbCmd = fileName;
|
||||||
m_ui.gdbEdit->setText(fileName);
|
m_ui.gdbLocationEdit->setText(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbOptionPage::browseForScript()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton,
|
||||||
|
"Browse for gdb startup script");
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
return;
|
||||||
|
m_settings->m_scriptFile = fileName;
|
||||||
|
m_ui.gdbStartupScriptEdit->setText(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbOptionPage::finished(bool accepted)
|
void GdbOptionPage::finished(bool accepted)
|
||||||
@@ -109,10 +133,11 @@ void GdbOptionPage::finished(bool accepted)
|
|||||||
if (!accepted)
|
if (!accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_settings->m_gdbCmd = m_ui.gdbEdit->text();
|
m_settings->m_gdbCmd = m_ui.gdbLocationEdit->text();
|
||||||
m_settings->m_gdbEnv = m_ui.envEdit->text();
|
m_settings->m_gdbEnv = m_ui.environmentEdit->text();
|
||||||
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
|
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
|
||||||
m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
|
m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
|
||||||
|
m_settings->m_scriptFile = m_ui.gdbStartupScriptEdit->text();
|
||||||
|
|
||||||
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
|
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
|
||||||
if (!coreIFace || !coreIFace->settings())
|
if (!coreIFace || !coreIFace->settings())
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#define GDBOPTIONPAGE_H
|
#define GDBOPTIONPAGE_H
|
||||||
|
|
||||||
#include "ui_gdboptionpage.h"
|
#include "ui_gdboptionpage.h"
|
||||||
#include "ui_gdbtypemacros.h"
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
@@ -63,7 +62,8 @@ public:
|
|||||||
void finished(bool accepted);
|
void finished(bool accepted);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void browse();
|
void browseForGdb();
|
||||||
|
void browseForScript();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExtensionSystem::PluginManager *m_pm;
|
ExtensionSystem::PluginManager *m_pm;
|
||||||
@@ -72,6 +72,7 @@ private:
|
|||||||
GdbSettings *m_settings;
|
GdbSettings *m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
class TypeMacroPage : public Core::IOptionsPage
|
class TypeMacroPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -87,7 +88,6 @@ public:
|
|||||||
void finished(bool accepted);
|
void finished(bool accepted);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onScriptButton();
|
|
||||||
void onAddButton();
|
void onAddButton();
|
||||||
void onDelButton();
|
void onDelButton();
|
||||||
void currentItemChanged(QTreeWidgetItem *item);
|
void currentItemChanged(QTreeWidgetItem *item);
|
||||||
@@ -100,6 +100,7 @@ private:
|
|||||||
GdbSettings *m_settings;
|
GdbSettings *m_settings;
|
||||||
QWidget *m_widget;
|
QWidget *m_widget;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>433</width>
|
<width>433</width>
|
||||||
<height>216</height>
|
<height>233</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Gdb Debug Options</string>
|
<string>Locations</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
@@ -33,33 +33,36 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="gdbEdit"/>
|
<widget class="QLineEdit" name="gdbLocationEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" colspan="2">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="envEdit"/>
|
<widget class="QLineEdit" name="environmentEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="labelGdbLocaltion">
|
||||||
|
<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>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gdb Location:</string>
|
<string>Gdb Location:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>gdbEdit</cstring>
|
<cstring>gdbLocationEdit</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="labelEnvironment">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Environment:</string>
|
<string>Environment:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>envEdit</cstring>
|
<cstring>environmentEdit</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="pushButtonBrowse">
|
<widget class="QPushButton" name="browseForGdbButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -72,6 +75,36 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="gdbStartupScriptEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QToolButton" name="browseForScriptButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>21</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../coreplugin/core.qrc">
|
||||||
|
<normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelGdbStartupScript">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gdb Startup Script:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
|
|||||||
|
|
||||||
m_widget = new QWidget(parent);
|
m_widget = new QWidget(parent);
|
||||||
m_ui.setupUi(m_widget);
|
m_ui.setupUi(m_widget);
|
||||||
|
m_ui.scriptFile->setPromptDialogTitle(tr("Select Gdb Script"));
|
||||||
|
m_ui.scriptFile->setExpectedKind(Core::Utils::PathChooser::File);
|
||||||
|
|
||||||
connect(m_ui.addButton, SIGNAL(clicked()),
|
connect(m_ui.addButton, SIGNAL(clicked()),
|
||||||
this, SLOT(onAddButton()));
|
this, SLOT(onAddButton()));
|
||||||
@@ -116,8 +118,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
|
|||||||
connect(m_ui.delButton, SIGNAL(clicked()),
|
connect(m_ui.delButton, SIGNAL(clicked()),
|
||||||
this, SLOT(onDelButton()));
|
this, SLOT(onDelButton()));
|
||||||
|
|
||||||
connect(m_ui.scriptButton, SIGNAL(clicked()),
|
connect(m_ui.scriptFile, SIGNAL(validChanged()),
|
||||||
this, SLOT(onScriptButton()));
|
this, SLOT(updateButtonState()));
|
||||||
|
|
||||||
connect(m_ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
connect(m_ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||||
this, SLOT(currentItemChanged(QTreeWidgetItem *)));
|
this, SLOT(currentItemChanged(QTreeWidgetItem *)));
|
||||||
@@ -139,7 +141,7 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.scriptEdit->setText(m_settings->m_scriptFile);
|
m_ui.scriptFile->setPath(m_settings->m_scriptFile);
|
||||||
|
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
|
|
||||||
@@ -152,7 +154,7 @@ void TypeMacroPage::finished(bool accepted)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_settings->m_typeMacros.clear();
|
m_settings->m_typeMacros.clear();
|
||||||
m_settings->m_scriptFile = m_ui.scriptEdit->text();
|
m_settings->m_scriptFile = m_ui.scriptFile->path();
|
||||||
|
|
||||||
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
|
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
|
||||||
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
|
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
|
||||||
@@ -172,13 +174,6 @@ void TypeMacroPage::finished(bool accepted)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeMacroPage::onScriptButton()
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(m_widget, tr("Select Gdb Script"));
|
|
||||||
m_ui.scriptEdit->setText(fileName);
|
|
||||||
updateButtonState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TypeMacroPage::onAddButton()
|
void TypeMacroPage::onAddButton()
|
||||||
{
|
{
|
||||||
if (m_ui.typeEdit->text().isEmpty() || m_ui.macroEdit->text().isEmpty())
|
if (m_ui.typeEdit->text().isEmpty() || m_ui.macroEdit->text().isEmpty())
|
||||||
|
|||||||
@@ -1,146 +1,115 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<author></author>
|
<ui version="4.0">
|
||||||
<comment></comment>
|
|
||||||
<exportmacro></exportmacro>
|
|
||||||
<class>TypeMacroPage</class>
|
<class>TypeMacroPage</class>
|
||||||
<widget class="QWidget" name="TypeMacroPage" >
|
<widget class="QWidget" name="TypeMacroPage">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>519</width>
|
<width>519</width>
|
||||||
<height>238</height>
|
<height>263</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="margin">
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
|
||||||
<property name="title" >
|
|
||||||
<string>Script File</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" >
|
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="scriptEdit" />
|
<layout class="QGridLayout">
|
||||||
</item>
|
<property name="margin">
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="scriptButton" >
|
|
||||||
<property name="minimumSize" >
|
|
||||||
<size>
|
|
||||||
<width>21</width>
|
|
||||||
<height>23</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" >
|
|
||||||
<property name="margin" >
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" colspan="2" >
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QTreeWidget" name="treeWidget" >
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
<property name="rootIsDecorated" >
|
<property name="rootIsDecorated">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Type</string>
|
<string>Type</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Macro</string>
|
<string>Macro</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2">
|
||||||
<widget class="QToolButton" name="addButton" >
|
<widget class="QToolButton" name="addButton">
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>+</string>
|
<string>+</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/newitem.png</iconset>
|
<iconset>
|
||||||
|
<normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Macro Name:</string>
|
<string>Macro Name:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Parse as:</string>
|
<string>Parse as:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="macroEdit" />
|
<widget class="QLineEdit" name="macroEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" >
|
<item row="0" column="2">
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="delButton" >
|
<widget class="QToolButton" name="delButton">
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/delete.png</iconset>
|
<iconset>
|
||||||
|
<normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
@@ -150,25 +119,25 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="typeEdit" />
|
<widget class="QLineEdit" name="typeEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Type:</string>
|
<string>Type:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" >
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="parseAsBox" >
|
<widget class="QComboBox" name="parseAsBox">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>ASCII (char *)</string>
|
<string>ASCII (char *)</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Unicode (short)</string>
|
<string>Unicode (short)</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -178,9 +147,8 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction></pixmapfunction>
|
|
||||||
<resources>
|
<resources>
|
||||||
<include location="gdbdebugger.qrc" />
|
<include location="gdbdebugger.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ QString SettingsPage::name() const
|
|||||||
return tr("General");
|
return tr("General");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPage::category() const
|
QString SettingsPage::category() const
|
||||||
{
|
{
|
||||||
return QLatin1String("Git");
|
return QLatin1String("Git");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,12 +128,13 @@ protected:
|
|||||||
|
|
||||||
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
|
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
|
||||||
int line,
|
int line,
|
||||||
int column)
|
int column,
|
||||||
|
const QString &editorKind)
|
||||||
{
|
{
|
||||||
Core::EditorManager *editorManager =
|
Core::EditorManager *editorManager =
|
||||||
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
|
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
|
||||||
editorManager->addCurrentPositionToNavigationHistory(true);
|
editorManager->addCurrentPositionToNavigationHistory(true);
|
||||||
Core::IEditor *editor = editorManager->openEditor(fileName, QString(), true);
|
Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true);
|
||||||
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||||
if (texteditor) {
|
if (texteditor) {
|
||||||
texteditor->gotoLine(line, column);
|
texteditor->gotoLine(line, column);
|
||||||
|
|||||||
@@ -230,7 +230,8 @@ public:
|
|||||||
BaseTextEditor(QWidget *parent);
|
BaseTextEditor(QWidget *parent);
|
||||||
~BaseTextEditor();
|
~BaseTextEditor();
|
||||||
|
|
||||||
static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0);
|
static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
||||||
|
const QString &editorKind = QString());
|
||||||
|
|
||||||
// EditorInterface
|
// EditorInterface
|
||||||
Core::IFile * file();
|
Core::IFile * file();
|
||||||
|
|||||||
Reference in New Issue
Block a user