Merge commit 'origin/1.3'

This commit is contained in:
con
2009-10-07 19:25:02 +02:00
52 changed files with 565 additions and 388 deletions

9
dist/changes-1.3.0 vendored
View File

@@ -36,6 +36,7 @@ Editing
* Handle block selection in fakevim * Handle block selection in fakevim
* Added Copy full path to the editors combobox * Added Copy full path to the editors combobox
* Added left/right arrow buttons for "Go back/forward" in navigation history * Added left/right arrow buttons for "Go back/forward" in navigation history
* Added smart indentation for pasted text blocks
Project support Project support
* Added support for adding and removing files from a generic Makefile-based * Added support for adding and removing files from a generic Makefile-based
@@ -63,18 +64,24 @@ Debugging
* CDB: Added more types to the dumpers (QSharedPointer, QVector, common * CDB: Added more types to the dumpers (QSharedPointer, QVector, common
QMap/QSet types), dereference reference and pointer parameters QMap/QSet types), dereference reference and pointer parameters
* CDB: Simplified display of STL types in the locals window * CDB: Simplified display of STL types in the locals window
* CDB: Fixed thread handling * CDB: Fixed thread handling, display thread position
* CDB: Added internal dumpers for string types for debuggee crashes * CDB: Added internal dumpers for string types for debuggee crashes
* CDB: Set symbol paths correctly
* Improved QObject dumping, print out QRect/QSize, enumerations and flags * Improved QObject dumping, print out QRect/QSize, enumerations and flags
* Made it possible to use the BinEditor plugin for displaying raw memory * Made it possible to use the BinEditor plugin for displaying raw memory
* Replace disassembler window by a real text editor enabling "mixed" output * Replace disassembler window by a real text editor enabling "mixed" output
* Improved dumper building on options page, run in background
Designer Designer
* Added support for rearranging and floating form editor tools * Added support for rearranging and floating form editor tools
Version control plugins Version control plugins
* Added CVS support * Added CVS support
* Display diff/annotation with correct encoding
* Added "sync" menu item to the Perforce plugin * Added "sync" menu item to the Perforce plugin
* Fixed locking of temporary submit message files on Windows
* Use a single, colored output pane for all version control systems
* Position annotation view of file at current line of editor
Wizards Wizards
* Fixed GUI project and form class wizards to use the same settings. * Fixed GUI project and form class wizards to use the same settings.

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 153 KiB

View File

@@ -171,7 +171,8 @@
to the \gui{Help} mode. To obtain context sensitive help, move your text to the \gui{Help} mode. To obtain context sensitive help, move your text
cursor to a Qt class or function and press \key{F1}. The documentation cursor to a Qt class or function and press \key{F1}. The documentation
will be displayed within a panel on the right, as shown in the screenshot will be displayed within a panel on the right, as shown in the screenshot
below. below. If there is enough vertical space, it will be shown in the
fullscreen help mode.
External Documentation provided by the user can be used to augment or External Documentation provided by the user can be used to augment or
replace the documentation shipped with Qt Creator and Qt. replace the documentation shipped with Qt Creator and Qt.
@@ -417,13 +418,57 @@
not need to manually configure your Qt version. not need to manually configure your Qt version.
Otherwise, you can add your Qt version in Otherwise, you can add your Qt version in
\gui{Tools -> Options... -> Qt Versions}. If you are on the Windows \gui{Tools -> Options... -> Qt Versions} on Windows and Linux or
platform and use MinGW to compile Qt, you need to tell Qt Creator where in \gui{Qt Creator -> Preferences... -> Qt Versions} on Mac OS X.
MinGW is installed. This is done by setting the \gui{MinGW Directory}
under \gui{Tools -> Options... -> Qt4 -> Qt Versions -> MinGw Directory}. The detailed settings depend on your Operating system and on the targeted
If your Qt version is compiled with Microsoft Visual C++'s compiler, Qt tool chain
Creator will automatically set the correct environment variables for
compilation. \table
\row
\i \image qtcreator-qt4-qtversions.png
On Linux and Mac OS X, simply set the \gui{Path to QMake}
to the \c qmake binary of the Qt installation. If a Qt is
found in the \c PATH environment variable, it will show up.
On both platforms, the platforms Gnu Compiler Collection (GCC)
is used to compile Qt. On Mac OS, the GCC compiler is part of XCode.
On Linux, the Intel Compiler (ICC) is supported as a drop-in replacement
for GCC.
\row
\i \image qtcreator-qt4-qtversions-win-mingw.png
If you are on the Windows platform and used MinGW
to compile Qt, you need to additionally tell Qt Creator
where MinGW is installed. This is done by setting the
\gui{MinGW Directory}.
\row
\i \image qtcreator-qt4-qtversions-win-msvc.png
If your Qt version is compiled with Microsoft Visual C++'s
compiler, Qt Creator will automatically set the correct
environment variables for compilation. The \gui{MSVC}
dropdown box indicates the internal Version Number of the
installed Microsoft Visual C++ tool chains:
\list
\o \bold{7.1}: Visual Studio 2003
\o \bold{8.0}: Visual Studio 2005
\o \bold{9.0}: Visual Studio 2008
\endlist
If you are using the \c{Windows SDK for Windows Server 2008}
instead of Visual Studio, it will identify as version 9.0.
\row
\i \image qtcreator-qt4-qtversions-win-symbian.png
If you are using Qt for Symbian and your S60 SDK is registered
with \c devices.exe, Qt Creator will detect the Qt version automatically.
If this does not work, point Creator to \c qmake.exe of Qt for Symbian.
You can add the path to the Metrowerks Compiler (\gui {MWC Directory})
if you want to use to build for the emulator. This requires Carbide 2.0
to be installed. the MWC directory should then point to the directory
of your Carbide installation. However, this not needed for compiling for
the device.
\endtable
\note By default projects are compiled with the \note By default projects are compiled with the
\l{glossary-default-qt}{default Qt version}. You can override this in the \l{glossary-default-qt}{default Qt version}. You can override this in the
@@ -700,6 +745,10 @@
\i \bold{Perforce} \i \bold{Perforce}
\i \l{http://www.perforce.com} \i \l{http://www.perforce.com}
\i Server version 2006.1 and later \i Server version 2006.1 and later
\row
\i \bold{CVS}
\i \l{http://www.cvshome.org}
\i
\endtable \endtable
@@ -867,11 +916,11 @@
\image qtcreator-locator.png \image qtcreator-locator.png
Suppose you would like to open your project's \c{main.cpp} file, click on Suppose you would like to open your project's \c{main.cpp} file, click on
\gui Locator or use \key{Ctrl+K}, type in the file name and then press \gui Locator or use \key{Ctrl+K} (Mac OS X: \key{Cmd+K}), type in the file
\key Return. The file will be opened in the editor. You can also type name and then press \key Return. The file will be opened in the editor.
part of a file name and use the wildcard characters \c{*} and \c{?} to You can also type part of a file name and use the wildcard characters
match \e{any} number of \e{any} characters. A list of all files matching \c{*} and \c{?} to match \e{any} number of \e{any} characters. A list
your criteria will be displayed. of all files matching your criteria will be displayed.
\gui Locator not only allows you to navigate files on disk but also other \gui Locator not only allows you to navigate files on disk but also other
"locations", which are organized with \bold{Filters}. Currently there are "locations", which are organized with \bold{Filters}. Currently there are
@@ -894,8 +943,8 @@
\e prefix. This prefix is usually a single character followed by \e prefix. This prefix is usually a single character followed by
\key{Space}. For example, to jump to the definition of the class \key{Space}. For example, to jump to the definition of the class
\l{http://doc.trolltech.com/qdatastream.html}{QDataStream}, type: \l{http://doc.trolltech.com/qdatastream.html}{QDataStream}, type:
\key{Ctrl+K} to activate \gui Locator. Then type colon (\key{:}) followed \key{Ctrl+K} (Mac OS X: \key{Cmd+K}) to activate \gui Locator.
by \key{Space} and the class name. Then type colon (\key{:}) followed by \key{Space} and the class name.
Below is a full list of \l{http://doc.trolltech.com/qdatastream.html} Below is a full list of \l{http://doc.trolltech.com/qdatastream.html}
@@ -973,6 +1022,8 @@
\note By default, if you press \key{Ctrl+K} and do not use a prefix to \note By default, if you press \key{Ctrl+K} and do not use a prefix to
specify a filter, three filters will be enabled: \c{o}, \c{l}, and \c{a}. specify a filter, three filters will be enabled: \c{o}, \c{l}, and \c{a}.
\note On Mac OS X, use \key{Cmd+K} instead of \key{Ctrl+K}.
*/ */
@@ -1588,7 +1639,8 @@
\bold{Show and Hide the Sidebar} \bold{Show and Hide the Sidebar}
You can show and hide the the sidebar in \gui Edit and \gui Debug mode by You can show and hide the the sidebar in \gui Edit and \gui Debug mode by
clicking on the corresponding icon, or by pressing \key{Alt+0}. clicking on the corresponding icon, or by pressing \key{Alt+0} (Mac OS X:
\key{Cmd+0}).
\bold{Display Signals and Slots} \bold{Display Signals and Slots}
@@ -1676,19 +1728,19 @@
\o F4 \o F4
\row \row
\o Toggle Side Bar \o Toggle Side Bar
\o Alt + 0 \o Alt + 0 / Cmd + 0
\row \row
\o Toggle \gui{Build Issues} pane \o Toggle \gui{Build Issues} pane
\o Alt + 1 \o Alt + 1 / Cmd + 1
\row \row
\o Toggle \gui{Search Results} pane \o Toggle \gui{Search Results} pane
\o Alt + 2 \o Alt + 2 / Cmd + 2
\row \row
\o Toggle \gui{Application Output} pane \o Toggle \gui{Application Output} pane
\o Alt + 3 \o Alt + 3 / Cmd + 3
\row \row
\o Toggle \gui{Compile Output} pane \o Toggle \gui{Compile Output} pane
\o Alt + 4 \o Alt + 4 / Cmd + 4
\endtable \endtable
*/ */

View File

@@ -34,55 +34,6 @@
using namespace CPlusPlus; using namespace CPlusPlus;
FastMacroResolver::FastMacroResolver(TranslationUnit *unit, const Snapshot &snapshot)
: _unit(unit), _snapshot(snapshot)
{
const QString fileName = QString::fromUtf8(unit->fileName(), unit->fileNameLength());
QSet<QString> processed;
updateCache(fileName, &processed);
}
bool FastMacroResolver::isMacro(TranslationUnit *unit, unsigned tokenIndex) const
{
if (unit != _unit){
qWarning() << Q_FUNC_INFO << "unexpected translation unit:" << unit->fileName();
return false;
}
const Token &tk = unit->tokenAt(tokenIndex);
if (tk.isNot(T_IDENTIFIER))
return false;
Identifier *id = tk.identifier;
const QByteArray macroName = QByteArray::fromRawData(id->chars(), id->size());
return _cachedMacros.contains(macroName);
}
void FastMacroResolver::updateCache(const QString &fileName, QSet<QString> *processed)
{
if (processed->contains(fileName))
return;
processed->insert(fileName);
if (Document::Ptr doc = _snapshot.value(fileName)) {
const QList<Macro> definedMacros = doc->definedMacros();
for (int i = definedMacros.size() - 1; i != -1; --i) {
const Macro &macro = definedMacros.at(i);
if (macro.isHidden())
_cachedMacros.remove(macro.name());
else
_cachedMacros.insert(macro.name());
}
foreach (const Document::Include &incl, doc->includes())
updateCache(incl.fileName(), processed);
}
}
FastPreprocessor::FastPreprocessor(const Snapshot &snapshot) FastPreprocessor::FastPreprocessor(const Snapshot &snapshot)
: _snapshot(snapshot), : _snapshot(snapshot),
_preproc(this, &_env) _preproc(this, &_env)

View File

@@ -41,22 +41,6 @@
namespace CPlusPlus { namespace CPlusPlus {
class CPLUSPLUS_EXPORT FastMacroResolver: public MacroResolver
{
public:
FastMacroResolver(TranslationUnit *unit, const Snapshot &snapshot);
virtual bool isMacro(TranslationUnit *unit, unsigned tokenIndex) const;
private:
void updateCache(const QString &fileName, QSet<QString> *processed);
private:
TranslationUnit *_unit;
Snapshot _snapshot;
QSet<QByteArray> _cachedMacros;
};
class CPLUSPLUS_EXPORT FastPreprocessor: public Client class CPLUSPLUS_EXPORT FastPreprocessor: public Client
{ {
Environment _env; Environment _env;

View File

@@ -30,6 +30,7 @@
#include "LookupContext.h" #include "LookupContext.h"
#include "ResolveExpression.h" #include "ResolveExpression.h"
#include "Overview.h" #include "Overview.h"
#include "CppBindings.h"
#include <CoreTypes.h> #include <CoreTypes.h>
#include <Symbols.h> #include <Symbols.h>
@@ -501,6 +502,97 @@ void LookupContext::expand(Scope *scope,
} }
} }
static void visibleClassBindings_helper(ClassBinding *classBinding,
QList<ClassBinding *> *allClassBindings,
QSet<ClassBinding *> *processed)
{
if (! classBinding)
return;
else if (processed->contains(classBinding))
return;
processed->insert(classBinding);
foreach (ClassBinding *baseClassBinding, classBinding->baseClassBindings)
visibleClassBindings_helper(baseClassBinding, allClassBindings, processed);
allClassBindings->append(classBinding);
}
static QList<ClassBinding *> visibleClassBindings(Symbol *symbol, NamespaceBinding *globalNamespace)
{
QList<ClassBinding *> classBindings;
if (! symbol)
return classBindings;
else if (Class *klass = symbol->asClass()) {
QSet<ClassBinding *> processed;
visibleClassBindings_helper(NamespaceBinding::find(klass, globalNamespace),
&classBindings, &processed);
}
return classBindings;
}
Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
NamespaceBinding *globalNamespace)
{
Symbol *canonicalSymbol = LookupContext::canonicalSymbol(symbol);
if (Identifier *symbolId = canonicalSymbol->identifier()) {
if (symbolId && canonicalSymbol->type()->isFunctionType()) {
Class *enclosingClass = canonicalSymbol->scope()->owner()->asClass();
const QList<ClassBinding *> classBindings = visibleClassBindings(enclosingClass, globalNamespace);
foreach (ClassBinding *baseClassBinding, classBindings) {
if (! baseClassBinding)
continue;
foreach (Class *baseClass, baseClassBinding->symbols) {
if (! baseClass)
continue;
for (Symbol *c = baseClass->members()->lookat(symbolId); c; c = c->next()) {
if (! symbolId->isEqualTo(c->identifier()))
continue;
else if (Function *f = c->type()->asFunctionType()) {
if (f->isVirtual())
return LookupContext::canonicalSymbol(f);
}
}
}
}
}
}
return canonicalSymbol;
}
Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates,
NamespaceBinding *globalNamespaceBinding)
{
if (candidates.isEmpty())
return 0;
return canonicalSymbol(candidates.first(), globalNamespaceBinding);
}
Symbol *LookupContext::canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &results,
NamespaceBinding *globalNamespaceBinding)
{
QList<Symbol *> candidates;
QPair<FullySpecifiedType, Symbol *> result;
foreach (result, results)
candidates.append(result.second); // ### not exacly.
return canonicalSymbol(candidates, globalNamespaceBinding);
}
Symbol *LookupContext::canonicalSymbol(Symbol *symbol) Symbol *LookupContext::canonicalSymbol(Symbol *symbol)
{ {
Symbol *canonical = symbol; Symbol *canonical = symbol;
@@ -531,22 +623,3 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol)
return canonical; return canonical;
} }
Symbol *LookupContext::canonicalSymbol(const QList<Symbol *> &candidates)
{
if (candidates.isEmpty())
return 0;
return canonicalSymbol(candidates.first());
}
Symbol *LookupContext::canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &results)
{
QList<Symbol *> candidates;
QPair<FullySpecifiedType, Symbol *> result;
foreach (result, results)
candidates.append(result.second); // ### not exacly.
return canonicalSymbol(candidates);
}

View File

@@ -54,9 +54,14 @@ public:
Document::Ptr document(const QString &fileName) const; Document::Ptr document(const QString &fileName) const;
Snapshot snapshot() const; Snapshot snapshot() const;
static Symbol *canonicalSymbol(Symbol *symbol); static Symbol *canonicalSymbol(const QList<Symbol *> &candidates,
static Symbol *canonicalSymbol(const QList<Symbol *> &candidates); NamespaceBinding *globalNamespaceBinding);
static Symbol *canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &candidates); // ### FIXME
static Symbol *canonicalSymbol(Symbol *symbol,
NamespaceBinding *globalNamespaceBinding);
static Symbol *canonicalSymbol(const QList<QPair<FullySpecifiedType, Symbol *> > &candidates,
NamespaceBinding *globalNamespaceBinding);
QList<Symbol *> resolve(Name *name) const QList<Symbol *> resolve(Name *name) const
{ return resolve(name, visibleScopes()); } { return resolve(name, visibleScopes()); }
@@ -126,6 +131,8 @@ public:
QList<Scope *> *expandedScopes) const; QList<Scope *> *expandedScopes) const;
private: private:
static Symbol *canonicalSymbol(Symbol *symbol);
QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q, QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q,
const QList<Scope *> &visibleScopes, const QList<Scope *> &visibleScopes,
ResolveMode mode) const; ResolveMode mode) const;

View File

@@ -58,6 +58,7 @@
#include <cplusplus/MatchingText.h> #include <cplusplus/MatchingText.h>
#include <cplusplus/BackwardsScanner.h> #include <cplusplus/BackwardsScanner.h>
#include <cplusplus/FastPreprocessor.h> #include <cplusplus/FastPreprocessor.h>
#include <cplusplus/CppBindings.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
@@ -838,8 +839,6 @@ CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor,
const QString code = expressionUnderCursor(tc); const QString code = expressionUnderCursor(tc);
// qDebug() << "code:" << code; // qDebug() << "code:" << code;
const QString fileName = const_cast<CPPEditor *>(this)->file()->fileName();
TypeOfExpression typeOfExpression; TypeOfExpression typeOfExpression;
typeOfExpression.setSnapshot(snapshot); typeOfExpression.setSnapshot(snapshot);
@@ -849,7 +848,8 @@ CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor,
lastVisibleSymbol, lastVisibleSymbol,
TypeOfExpression::Preprocess); TypeOfExpression::Preprocess);
Symbol *canonicalSymbol = LookupContext::canonicalSymbol(results); NamespaceBindingPtr glo = bind(doc, snapshot);
Symbol *canonicalSymbol = LookupContext::canonicalSymbol(results, glo.data());
return canonicalSymbol; return canonicalSymbol;
} }
@@ -2090,11 +2090,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
snapshot = source.snapshot; snapshot = source.snapshot;
doc = source.snapshot.documentFromSource(preprocessedCode, source.fileName); doc = source.snapshot.documentFromSource(preprocessedCode, source.fileName);
FastMacroResolver fastMacroResolver(doc->translationUnit(), snapshot);
doc->control()->setMacroResolver(&fastMacroResolver);
doc->check(); doc->check();
doc->control()->setMacroResolver(0);
} }
Control *control = doc->control(); Control *control = doc->control();

View File

@@ -214,6 +214,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
QAction *findUsagesAction = new QAction(tr("Find Usages"), this); QAction *findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context); cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);

View File

@@ -49,6 +49,7 @@
#include <Scope.h> #include <Scope.h>
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <cplusplus/CppBindings.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/ResolveExpression.h> #include <cplusplus/ResolveExpression.h>
#include <cplusplus/Overview.h> #include <cplusplus/Overview.h>
@@ -81,6 +82,11 @@ public:
_snapshot.insert(_doc); _snapshot.insert(_doc);
} }
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding)
{
_globalNamespaceBinding = globalNamespaceBinding;
}
QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast) QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast)
{ {
_references.clear(); _references.clear();
@@ -146,7 +152,8 @@ protected:
bool checkCandidates(const QList<Symbol *> &candidates) const bool checkCandidates(const QList<Symbol *> &candidates) const
{ {
if (Symbol *canonicalSymbol = LookupContext::canonicalSymbol(candidates)) { if (Symbol *canonicalSymbol = LookupContext::canonicalSymbol(candidates, _globalNamespaceBinding.data())) {
#if 0 #if 0
qDebug() << "*** canonical symbol:" << canonicalSymbol->fileName() qDebug() << "*** canonical symbol:" << canonicalSymbol->fileName()
<< canonicalSymbol->line() << canonicalSymbol->column() << canonicalSymbol->line() << canonicalSymbol->column()
@@ -419,6 +426,7 @@ private:
QByteArray _source; QByteArray _source;
Document::Ptr _exprDoc; Document::Ptr _exprDoc;
Semantic _sem; Semantic _sem;
NamespaceBindingPtr _globalNamespaceBinding;
QList<PostfixExpressionAST *> _postfixExpressionStack; QList<PostfixExpressionAST *> _postfixExpressionStack;
QList<QualifiedNameAST *> _qualifiedNameStack; QList<QualifiedNameAST *> _qualifiedNameStack;
QList<int> _references; QList<int> _references;
@@ -456,6 +464,7 @@ QList<int> CppFindReferences::references(Symbol *symbol,
Q_ASSERT(translationUnit != 0); Q_ASSERT(translationUnit != 0);
Process process(doc, snapshot, /*future = */ 0); Process process(doc, snapshot, /*future = */ 0);
process.setGlobalNamespaceBinding(bind(doc, snapshot));
references = process(symbol, id, translationUnit->ast()); references = process(symbol, id, translationUnit->ast());
return references; return references;
@@ -490,7 +499,7 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
files += snapshot.dependsOn(sourceFile); files += snapshot.dependsOn(sourceFile);
} }
qDebug() << "done in:" << tm.elapsed() << "number of files to parse:" << files.size(); //qDebug() << "done in:" << tm.elapsed() << "number of files to parse:" << files.size();
future.setProgressRange(0, files.size()); future.setProgressRange(0, files.size());
@@ -531,13 +540,7 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) { if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
QTime tm; QTime tm;
tm.start(); tm.start();
TranslationUnit *unit = doc->translationUnit();
Control *control = doc->control();
FastMacroResolver fastMacroResolver(unit, snapshot);
control->setMacroResolver(&fastMacroResolver);
doc->parse(); doc->parse();
control->setMacroResolver(0);
//qDebug() << "***" << unit->fileName() << "parsed in:" << tm.elapsed(); //qDebug() << "***" << unit->fileName() << "parsed in:" << tm.elapsed();
@@ -548,6 +551,9 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
tm.start(); tm.start();
Process process(doc, snapshot, &future); Process process(doc, snapshot, &future);
process.setGlobalNamespaceBinding(bind(doc, snapshot));
TranslationUnit *unit = doc->translationUnit();
process(symbol, id, unit->ast()); process(symbol, id, unit->ast());
//qDebug() << "***" << unit->fileName() << "processed in:" << tm.elapsed(); //qDebug() << "***" << unit->fileName() << "processed in:" << tm.elapsed();

View File

@@ -752,7 +752,8 @@ QList<int> CppModelManager::references(CPlusPlus::Symbol *symbol,
CPlusPlus::Document::Ptr doc, CPlusPlus::Document::Ptr doc,
const CPlusPlus::Snapshot &snapshot) const CPlusPlus::Snapshot &snapshot)
{ {
return m_findReferences->references(LookupContext::canonicalSymbol(symbol), doc, snapshot); NamespaceBindingPtr glo = bind(doc, snapshot);
return m_findReferences->references(LookupContext::canonicalSymbol(symbol, glo.data()), doc, snapshot);
} }
void CppModelManager::findUsages(CPlusPlus::Symbol *symbol) void CppModelManager::findUsages(CPlusPlus::Symbol *symbol)

View File

@@ -30,6 +30,7 @@
#include "breakwindow.h" #include "breakwindow.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggermanager.h"
#include "ui_breakcondition.h" #include "ui_breakcondition.h"
#include "ui_breakbyfunction.h" #include "ui_breakbyfunction.h"
@@ -179,6 +180,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
editConditionAction->setEnabled(si.size() > 0); editConditionAction->setEnabled(si.size() > 0);
QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu); QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu);
synchronizeAction->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled());
QModelIndex idx0 = (si.size() ? si.front() : QModelIndex()); QModelIndex idx0 = (si.size() ? si.front() : QModelIndex());
QModelIndex idx2 = idx0.sibling(idx0.row(), 2); QModelIndex idx2 = idx0.sibling(idx0.row(), 2);

View File

@@ -662,13 +662,15 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
} }
foreach (QDockWidget *dockWidget, dockWidgets) { foreach (QDockWidget *dockWidget, dockWidgets) {
if (dockWidget == d->m_outputDock)
d->m_mainWindow->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
else
d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget); d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
dockWidget->show(); dockWidget->show();
} }
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_breakDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_breakDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_modulesDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_modulesDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_outputDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_registerDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_registerDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_threadsDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_threadsDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_sourceFilesDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_sourceFilesDock);
@@ -1684,11 +1686,51 @@ void DebuggerManager::setState(DebuggerState state)
d->m_actions.runToFunctionAction->setEnabled(stopped); d->m_actions.runToFunctionAction->setEnabled(stopped);
d->m_actions.jumpToLineAction->setEnabled(stopped); d->m_actions.jumpToLineAction->setEnabled(stopped);
d->m_actions.nextAction->setEnabled(stopped); d->m_actions.nextAction->setEnabled(stopped);
const bool actionsEnabled = debuggerActionsEnabled();
theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled);
theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled && d->m_engine->isGdbEngine());
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
emit stateChanged(d->m_state); emit stateChanged(d->m_state);
const bool notbusy = state == InferiorStopped const bool notbusy = state == InferiorStopped
|| state == DebuggerNotReady || state == DebuggerNotReady
|| state == InferiorUnrunnable; || state == InferiorUnrunnable;
setBusyCursor(!notbusy); setBusyCursor(!notbusy);
}
bool DebuggerManager::debuggerActionsEnabled() const
{
if (!d->m_engine)
return false;
switch (state()) {
case InferiorPrepared:
case InferiorStarting:
case InferiorRunningRequested:
case InferiorRunning:
case InferiorUnrunnable:
case InferiorStopping:
case InferiorStopped:
return true;
case DebuggerNotReady:
case EngineStarting:
case AdapterStarting:
case AdapterStarted:
case AdapterStartFailed:
case InferiorPreparing:
case InferiorPreparationFailed:
case InferiorStartFailed:
case InferiorStopFailed:
case InferiorShuttingDown:
case InferiorShutDown:
case InferiorShutdownFailed:
case AdapterShuttingDown:
case AdapterShutdownFailed:
break;
}
return false;
} }
QDebug operator<<(QDebug d, DebuggerState state) QDebug operator<<(QDebug d, DebuggerState state)

View File

@@ -175,6 +175,8 @@ public:
void showMessageBox(int icon, const QString &title, const QString &text); void showMessageBox(int icon, const QString &title, const QString &text);
bool debuggerActionsEnabled() const;
static DebuggerManager *instance(); static DebuggerManager *instance();
public slots: public slots:

View File

@@ -155,7 +155,6 @@ public:
m_clearContentsAction = new QAction(this); m_clearContentsAction = new QAction(this);
m_clearContentsAction->setText(tr("Clear contents")); m_clearContentsAction->setText(tr("Clear contents"));
m_clearContentsAction->setEnabled(true); m_clearContentsAction->setEnabled(true);
m_clearContentsAction->setShortcut(Qt::ControlModifier + Qt::Key_R);
connect(m_clearContentsAction, SIGNAL(triggered(bool)), connect(m_clearContentsAction, SIGNAL(triggered(bool)),
parent, SLOT(clearContents())); parent, SLOT(clearContents()));

View File

@@ -257,6 +257,11 @@ void PlainGdbAdapter::shutdown()
m_engine->postCommand(_("kill"), CB(handleKill)); m_engine->postCommand(_("kill"), CB(handleKill));
return; return;
case InferiorShuttingDown:
// FIXME: How can we end up here?
QTC_ASSERT(false, qDebug() << state());
// Fall through.
case InferiorShutDown: case InferiorShutDown:
setState(AdapterShuttingDown); setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); m_engine->postCommand(_("-gdb-exit"), CB(handleExit));

View File

@@ -105,11 +105,15 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
if (index.isValid()) if (index.isValid())
name = model()->data(index).toString(); name = model()->data(index).toString();
QMenu menu; QMenu menu;
const bool enabled = Debugger::DebuggerManager::instance()->debuggerActionsEnabled();
QAction *act0 = new QAction(tr("Update module list"), &menu); QAction *act0 = new QAction(tr("Update module list"), &menu);
QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name), act0->setEnabled(enabled);
&menu); QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name), &menu);
act3->setEnabled(enabled);
QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu); QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu);
act4->setEnabled(enabled);
QAction *act5 = 0; QAction *act5 = 0;
QAction *act6 = 0; QAction *act6 = 0;
QAction *act7 = 0; QAction *act7 = 0;

View File

@@ -177,6 +177,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
} else { } else {
actShowMemory->setText(tr("Open memory editor at %1").arg(address)); actShowMemory->setText(tr("Open memory editor at %1").arg(address));
} }
actShowMemory->setEnabled(m_manager->debuggerActionsEnabled());
menu.addSeparator(); menu.addSeparator();
int base = model()->data(QModelIndex(), RegisterNumberBaseRole).toInt(); int base = model()->data(QModelIndex(), RegisterNumberBaseRole).toInt();

View File

@@ -29,6 +29,7 @@
#include "sourcefileswindow.h" #include "sourcefileswindow.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggermanager.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
@@ -199,6 +200,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu menu; QMenu menu;
QAction *act1 = new QAction(tr("Reload data"), &menu); QAction *act1 = new QAction(tr("Reload data"), &menu);
act1->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled());
//act1->setCheckable(true); //act1->setCheckable(true);
QAction *act2 = 0; QAction *act2 = 0;
if (name.isEmpty()) { if (name.isEmpty()) {

View File

@@ -240,6 +240,7 @@ bool StackHandler::isDebuggingDebuggingHelpers() const
ThreadData::ThreadData(int threadId) : ThreadData::ThreadData(int threadId) :
id(threadId), id(threadId),
address(0),
line(-1) line(-1)
{ {
} }

View File

@@ -113,8 +113,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
} }
menu.addSeparator(); menu.addSeparator();
#if 0 // @TODO: not implemented
menu.addAction(theDebuggerAction(UseToolTipsInStackView)); menu.addAction(theDebuggerAction(UseToolTipsInStackView));
#endif
menu.addAction(theDebuggerAction(UseAddressInStackView)); menu.addAction(theDebuggerAction(UseAddressInStackView));
QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents"));

View File

@@ -237,6 +237,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
individualFormatMenu.addAction(act); individualFormatMenu.addAction(act);
individualFormatActions.append(act); individualFormatActions.append(act);
} }
if (alternativeFormats.isEmpty()) {
typeFormatMenu.setEnabled(false);
individualFormatMenu.setEnabled(false);
}
} else { } else {
typeFormatMenu.setTitle(tr("Change format for type")); typeFormatMenu.setTitle(tr("Change format for type"));
typeFormatMenu.setEnabled(false); typeFormatMenu.setEnabled(false);
@@ -245,16 +249,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
} }
QMenu menu; QMenu menu;
//QAction *actWatchExpressionInWindow
// = theDebuggerAction(WatchExpressionInWindow);
//menu.addAction(actWatchExpressionInWindow);
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item")); QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item"));
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch")); QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch"));
const QString address = model()->data(mi0, AddressRole).toString(); const QString address = model()->data(mi0, AddressRole).toString();
QAction *actWatchKnownMemory = 0; QAction *actWatchKnownMemory = 0;
QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu);; QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu);
actWatchUnknownMemory->setEnabled(m_manager->debuggerActionsEnabled());
if (!address.isEmpty()) if (!address.isEmpty())
actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu); actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu);
menu.addSeparator(); menu.addSeparator();
@@ -270,6 +273,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(actWatchKnownMemory); menu.addAction(actWatchKnownMemory);
menu.addAction(actWatchUnknownMemory); menu.addAction(actWatchUnknownMemory);
menu.addSeparator(); menu.addSeparator();
menu.addAction(theDebuggerAction(RecheckDebuggingHelpers)); menu.addAction(theDebuggerAction(RecheckDebuggingHelpers));
menu.addAction(theDebuggerAction(UseDebuggingHelpers)); menu.addAction(theDebuggerAction(UseDebuggingHelpers));
@@ -277,8 +281,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(theDebuggerAction(UseToolTipsInLocalsView)); menu.addAction(theDebuggerAction(UseToolTipsInLocalsView));
menu.addAction(theDebuggerAction(AutoDerefPointers)); menu.addAction(theDebuggerAction(AutoDerefPointers));
theDebuggerAction(AutoDerefPointers)->
setEnabled(m_manager->currentEngine()->isGdbEngine());
QAction *actAdjustColumnWidths = QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust column widths to contents")); menu.addAction(tr("Adjust column widths to contents"));
QAction *actAlwaysAdjustColumnWidth = QAction *actAlwaysAdjustColumnWidth =

View File

@@ -240,6 +240,11 @@ QString quoteUnprintable(const QString &ba)
return res; return res;
} }
inline QString msgE20MarkNotSet(const QString &text)
{
return FakeVimHandler::tr("E20: Mark '%1' not set").arg(text);
}
class FakeVimHandler::Private class FakeVimHandler::Private
{ {
public: public:
@@ -905,14 +910,12 @@ void FakeVimHandler::Private::updateMiniBuffer()
int linesInDoc = linesInDocument(); int linesInDoc = linesInDocument();
int l = cursorLineInDocument(); int l = cursorLineInDocument();
QString status; QString status;
QString pos = tr("%1,%2").arg(l + 1).arg(cursorColumnInDocument() + 1); const QString pos = QString::fromLatin1("%1,%2").arg(l + 1).arg(cursorColumnInDocument() + 1);
status += tr("%1").arg(pos, -10);
// FIXME: physical "-" logical // FIXME: physical "-" logical
if (linesInDoc != 0) { if (linesInDoc != 0) {
status += tr("%1").arg(l * 100 / linesInDoc, 4); status = FakeVimHandler::tr("%1%2%").arg(pos, -10).arg(l * 100 / linesInDoc, 4);
status += "%";
} else { } else {
status += "All"; status = FakeVimHandler::tr("%1All").arg(pos, -10);
} }
emit q->statusDataChanged(status); emit q->statusDataChanged(status);
} }
@@ -934,7 +937,7 @@ void FakeVimHandler::Private::showBlackMessage(const QString &msg)
void FakeVimHandler::Private::notImplementedYet() void FakeVimHandler::Private::notImplementedYet()
{ {
qDebug() << "Not implemented in FakeVim"; qDebug() << "Not implemented in FakeVim";
showRedMessage(tr("Not implemented in FakeVim")); showRedMessage(FakeVimHandler::tr("Not implemented in FakeVim"));
updateMiniBuffer(); updateMiniBuffer();
} }
@@ -1060,7 +1063,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToFirstNonBlankOnLine(); moveToFirstNonBlankOnLine();
finishMovement(); finishMovement();
} else { } else {
showRedMessage(tr("E20: Mark '%1' not set").arg(text)); showRedMessage(msgE20MarkNotSet(text));
} }
m_subsubmode = NoSubSubMode; m_subsubmode = NoSubSubMode;
} else if (key >= '0' && key <= '9') { } else if (key >= '0' && key <= '9') {
@@ -1802,7 +1805,7 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
if (c == '\'' && !cmd.isEmpty()) { if (c == '\'' && !cmd.isEmpty()) {
int mark = m_marks.value(cmd.at(0).unicode()); int mark = m_marks.value(cmd.at(0).unicode());
if (!mark) { if (!mark) {
showRedMessage(tr("E20: Mark '%1' not set").arg(cmd.at(0))); showRedMessage(msgE20MarkNotSet(cmd.at(0)));
cmd = cmd.mid(1); cmd = cmd.mid(1);
return -1; return -1;
} }
@@ -1821,7 +1824,7 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
int pos = m_marks.value(cmd.at(0).unicode(), -1); int pos = m_marks.value(cmd.at(0).unicode(), -1);
//qDebug() << " MARK: " << cmd.at(0) << pos << lineForPosition(pos); //qDebug() << " MARK: " << cmd.at(0) << pos << lineForPosition(pos);
if (pos == -1) { if (pos == -1) {
showRedMessage(tr("E20: Mark '%1' not set").arg(cmd.at(0))); showRedMessage(msgE20MarkNotSet(cmd.at(0)));
cmd = cmd.mid(1); cmd = cmd.mid(1);
return -1; return -1;
} }
@@ -1935,7 +1938,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
QFile file1(fileName); QFile file1(fileName);
bool exists = file1.exists(); bool exists = file1.exists();
if (exists && !forced && !noArgs) { if (exists && !forced && !noArgs) {
showRedMessage(tr("File '%1' exists (add ! to override)").arg(fileName)); showRedMessage(FakeVimHandler::tr("File '%1' exists (add ! to override)").arg(fileName));
} else if (file1.open(QIODevice::ReadWrite)) { } else if (file1.open(QIODevice::ReadWrite)) {
file1.close(); file1.close();
QTextCursor tc = m_tc; QTextCursor tc = m_tc;
@@ -1955,14 +1958,14 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
QTextStream ts(&file2); QTextStream ts(&file2);
ts << contents; ts << contents;
} else { } else {
showRedMessage(tr("Cannot open file '%1' for writing").arg(fileName)); showRedMessage(FakeVimHandler::tr("Cannot open file '%1' for writing").arg(fileName));
} }
} }
// check result by reading back // check result by reading back
QFile file3(fileName); QFile file3(fileName);
file3.open(QIODevice::ReadOnly); file3.open(QIODevice::ReadOnly);
QByteArray ba = file3.readAll(); QByteArray ba = file3.readAll();
showBlackMessage(tr("\"%1\" %2 %3L, %4C written") showBlackMessage(FakeVimHandler::tr("\"%1\" %2 %3L, %4C written")
.arg(fileName).arg(exists ? " " : " [New] ") .arg(fileName).arg(exists ? " " : " [New] ")
.arg(ba.count('\n')).arg(ba.size())); .arg(ba.count('\n')).arg(ba.size()));
if (quitAll) if (quitAll)
@@ -1970,7 +1973,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
else if (quit) else if (quit)
passUnknownExCommand(forced ? "q!" : "q"); passUnknownExCommand(forced ? "q!" : "q");
} else { } else {
showRedMessage(tr("Cannot open file '%1' for reading").arg(fileName)); showRedMessage(FakeVimHandler::tr("Cannot open file '%1' for reading").arg(fileName));
} }
} else if (cmd.startsWith("r ")) { // :r } else if (cmd.startsWith("r ")) { // :r
m_currentFileName = cmd.mid(2); m_currentFileName = cmd.mid(2);
@@ -1979,7 +1982,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
QTextStream ts(&file); QTextStream ts(&file);
QString data = ts.readAll(); QString data = ts.readAll();
EDITOR(setPlainText(data)); EDITOR(setPlainText(data));
showBlackMessage(tr("\"%1\" %2L, %3C") showBlackMessage(FakeVimHandler::tr("\"%1\" %2L, %3C")
.arg(m_currentFileName).arg(data.count('\n')).arg(data.size())); .arg(m_currentFileName).arg(data.count('\n')).arg(data.size()));
} else if (cmd.startsWith(QLatin1Char('!'))) { } else if (cmd.startsWith(QLatin1Char('!'))) {
selectRange(beginLine, endLine); selectRange(beginLine, endLine);
@@ -1997,13 +2000,13 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
leaveVisualMode(); leaveVisualMode();
setPosition(firstPositionInLine(beginLine)); setPosition(firstPositionInLine(beginLine));
//qDebug() << "FILTER: " << command; //qDebug() << "FILTER: " << command;
showBlackMessage(tr("%n lines filtered", 0, text.count('\n'))); showBlackMessage(FakeVimHandler::tr("%n lines filtered", 0, text.count('\n')));
} else if (cmd.startsWith(QLatin1Char('>'))) { } else if (cmd.startsWith(QLatin1Char('>'))) {
m_anchor = firstPositionInLine(beginLine); m_anchor = firstPositionInLine(beginLine);
setPosition(firstPositionInLine(endLine)); setPosition(firstPositionInLine(endLine));
shiftRegionRight(1); shiftRegionRight(1);
leaveVisualMode(); leaveVisualMode();
showBlackMessage(tr("%n lines >ed %1 time", 0, (endLine - beginLine + 1)).arg(1)); showBlackMessage(FakeVimHandler::tr("%n lines >ed %1 time", 0, (endLine - beginLine + 1)).arg(1));
} else if (cmd == "red" || cmd == "redo") { // :redo } else if (cmd == "red" || cmd == "redo") { // :redo
redo(); redo();
updateMiniBuffer(); updateMiniBuffer();
@@ -2081,7 +2084,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
if (act) if (act)
act->setValue(arg.mid(p + 1)); act->setValue(arg.mid(p + 1));
} else { } else {
showRedMessage(tr("E512: Unknown option: ") + arg); showRedMessage(FakeVimHandler::tr("E512: Unknown option: ") + arg);
} }
updateMiniBuffer(); updateMiniBuffer();
} else if (reHistory.indexIn(cmd) != -1) { // :history } else if (reHistory.indexIn(cmd) != -1) { // :history
@@ -2152,14 +2155,14 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
if (forward) if (forward)
showRedMessage(tr("search hit BOTTOM, continuing at TOP")); showRedMessage(FakeVimHandler::tr("search hit BOTTOM, continuing at TOP"));
else else
showRedMessage(tr("search hit TOP, continuing at BOTTOM")); showRedMessage(FakeVimHandler::tr("search hit TOP, continuing at BOTTOM"));
highlightMatches(needle); highlightMatches(needle);
} else { } else {
highlightMatches(QString()); highlightMatches(QString());
setCursorPosition(origPosition); setCursorPosition(origPosition);
showRedMessage(tr("Pattern not found: ") + needle); showRedMessage(FakeVimHandler::tr("Pattern not found: ") + needle);
} }
} }
} }
@@ -2729,7 +2732,7 @@ void FakeVimHandler::Private::undo()
//beginEditBlock(); //beginEditBlock();
int rev = m_tc.document()->revision(); int rev = m_tc.document()->revision();
if (current == rev) if (current == rev)
showBlackMessage(tr("Already at oldest change")); showBlackMessage(FakeVimHandler::tr("Already at oldest change"));
else else
showBlackMessage(QString()); showBlackMessage(QString());
if (m_undoCursorPosition.contains(rev)) if (m_undoCursorPosition.contains(rev))
@@ -2744,7 +2747,7 @@ void FakeVimHandler::Private::redo()
//beginEditBlock(); //beginEditBlock();
int rev = m_tc.document()->revision(); int rev = m_tc.document()->revision();
if (rev == current) if (rev == current)
showBlackMessage(tr("Already at newest change")); showBlackMessage(FakeVimHandler::tr("Already at newest change"));
else else
showBlackMessage(QString()); showBlackMessage(QString());
if (m_undoCursorPosition.contains(rev)) if (m_undoCursorPosition.contains(rev))

View File

@@ -59,6 +59,7 @@ public:
QMap<QString, QVariant> toMap() const; QMap<QString, QVariant> toMap() const;
void setValuesFromMap(QMap<QString, QVariant> map); void setValuesFromMap(QMap<QString, QVariant> map);
private: private:
void setName(const QString &name); void setName(const QString &name);

View File

@@ -104,6 +104,18 @@ void Project::moveCleanStepUp(int position)
m_cleanSteps.insert(position - 1, bs); m_cleanSteps.insert(position - 1, bs);
} }
QString Project::makeUnique(const QString &preferedName, const QStringList &usedNames)
{
if (!usedNames.contains(preferedName))
return preferedName;
int i = 2;
QString tryName = preferedName + QString::number(i);
while (usedNames.contains(tryName))
tryName = preferedName + QString::number(++i);
return tryName;
}
void Project::addBuildConfiguration(BuildConfiguration *configuration) void Project::addBuildConfiguration(BuildConfiguration *configuration)
{ {
QStringList buildConfigurationNames; QStringList buildConfigurationNames;
@@ -112,12 +124,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
// Check that the internal name is not taken and use a different one otherwise // Check that the internal name is not taken and use a different one otherwise
QString configurationName = configuration->name(); QString configurationName = configuration->name();
if (buildConfigurationNames.contains(configurationName)) { configurationName = makeUnique(configurationName, buildConfigurationNames);
int i = 2;
while (buildConfigurationNames.contains(configurationName + QString::number(i)))
++i;
configurationName += QString::number(i);
}
configuration->setName(configurationName); configuration->setName(configurationName);
// Check that we don't have a configuration with the same displayName // Check that we don't have a configuration with the same displayName
@@ -125,12 +132,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
QStringList displayNames; QStringList displayNames;
foreach (const BuildConfiguration *bc, m_buildConfigurationValues) foreach (const BuildConfiguration *bc, m_buildConfigurationValues)
displayNames << bc->displayName(); displayNames << bc->displayName();
if (displayNames.contains(configurationDisplayName)) { configurationDisplayName = makeUnique(configurationDisplayName, displayNames);
int i = 2;
while (displayNames.contains(configurationDisplayName + QString::number(i)))
++i;
configurationDisplayName += QString::number(i);
}
configuration->setDisplayName(configurationDisplayName); configuration->setDisplayName(configurationDisplayName);
// add it // add it
@@ -511,19 +513,18 @@ EditorConfiguration *Project::editorConfiguration() const
void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName) void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName)
{ {
if (configuration->displayName() == displayName)
return;
QString dn = displayName;
QStringList displayNames; QStringList displayNames;
foreach (BuildConfiguration *bc, m_buildConfigurationValues) { foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
if (bc != configuration) if (bc != configuration)
displayNames << bc->displayName(); displayNames << bc->displayName();
} }
if (displayNames.contains(displayName)) { dn = makeUnique(displayName, displayNames);
int i = 2;
while (displayNames.contains(displayName + QString::number(i)))
++i;
configuration->setDisplayName(displayName + QString::number(i));
} else {
configuration->setDisplayName(displayName); configuration->setDisplayName(displayName);
}
emit buildConfigurationDisplayNameChanged(configuration->name()); emit buildConfigurationDisplayNameChanged(configuration->name());
} }

View File

@@ -183,6 +183,7 @@ protected:
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader); virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
private: private:
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
QList<BuildStep *> m_buildSteps; QList<BuildStep *> m_buildSteps;
QList<BuildStep *> m_cleanSteps; QList<BuildStep *> m_cleanSteps;
QMap<QString, QVariant> m_values; QMap<QString, QVariant> m_values;

View File

@@ -662,15 +662,26 @@ public:
/// ///
ProjectWindow::ProjectWindow(QWidget *parent) ProjectWindow::ProjectWindow(QWidget *parent)
: QWidget(parent), m_currentItemChanged(false) : QWidget(parent)
{ {
m_projectExplorer = ProjectExplorerPlugin::instance(); ProjectExplorer::SessionManager *session = ProjectExplorerPlugin::instance()->session();
m_session = m_projectExplorer->session();
m_panelsWidget = new PanelsWidget(this); m_panelsWidget = new PanelsWidget(this);
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget); m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget);
m_panelsWidget->addWidget(tr("Active Build and Run Configurations"), m_activeConfigurationWidget);
m_spacerBetween = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout(m_spacerBetween);
vbox->setMargin(0);
m_spacerBetween->setLayout(vbox);
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
vbox->addWidget(new OnePixelBlackLine(m_spacerBetween));
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
m_panelsWidget->addWidget(m_spacerBetween);
m_projectChooser = new QWidget(m_panelsWidget); m_projectChooser = new QWidget(m_panelsWidget);
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser); QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
hbox->setMargin(0); hbox->setMargin(0);
@@ -687,18 +698,6 @@ ProjectWindow::ProjectWindow(QWidget *parent)
label, SLOT(setProject(ProjectExplorer::Project*))); label, SLOT(setProject(ProjectExplorer::Project*)));
hbox->addWidget(changeProject); hbox->addWidget(changeProject);
m_panelsWidget->addWidget(tr("Active Build and Run Configurations"), m_activeConfigurationWidget);
m_spacerBetween = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout(m_spacerBetween);
vbox->setMargin(0);
m_spacerBetween->setLayout(vbox);
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
vbox->addWidget(new OnePixelBlackLine(m_spacerBetween));
vbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
m_panelsWidget->addWidget(m_spacerBetween);
m_panelsWidget->addWidget(m_projectChooser); m_panelsWidget->addWidget(m_projectChooser);
QVBoxLayout *topLevelLayout = new QVBoxLayout(this); QVBoxLayout *topLevelLayout = new QVBoxLayout(this);
@@ -708,17 +707,52 @@ ProjectWindow::ProjectWindow(QWidget *parent)
topLevelLayout->addWidget(m_panelsWidget); topLevelLayout->addWidget(m_panelsWidget);
m_noprojectLabel = new QLabel(this);
m_noprojectLabel->setText(tr("No project loaded."));
{
QFont f = m_noprojectLabel->font();
f.setPointSizeF(f.pointSizeF() * 1.4);
f.setBold(true);
m_noprojectLabel->setFont(f);
}
m_noprojectLabel->setMargin(10);
m_noprojectLabel->setAlignment(Qt::AlignTop);
topLevelLayout->addWidget(m_noprojectLabel);
bool noProjects = session->projects().isEmpty();
m_panelsWidget->setVisible(!noProjects);
m_noprojectLabel->setVisible(noProjects);
connect(changeProject, SIGNAL(projectChanged(ProjectExplorer::Project*)), connect(changeProject, SIGNAL(projectChanged(ProjectExplorer::Project*)),
this, SLOT(showProperties(ProjectExplorer::Project*))); this, SLOT(showProperties(ProjectExplorer::Project*)));
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus())); connect(session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus())); connect(session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(projectAdded()));
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(projectRemoved()));
} }
ProjectWindow::~ProjectWindow() ProjectWindow::~ProjectWindow()
{ {
} }
void ProjectWindow::projectAdded()
{
m_panelsWidget->setVisible(true);
m_noprojectLabel->setVisible(false);
}
void ProjectWindow::projectRemoved()
{
if (ProjectExplorerPlugin::instance()->session()->projects().isEmpty()) {
m_panelsWidget->setVisible(false);
m_noprojectLabel->setVisible(true);
}
}
void ProjectWindow::restoreStatus() void ProjectWindow::restoreStatus()
{ {
// TODO // TODO
@@ -758,12 +792,3 @@ void ProjectWindow::showProperties(Project *project)
} }
} }
} }
Project *ProjectWindow::findProject(const QString &path) const
{
QList<Project*> projects = m_session->projects();
foreach (Project* project, projects)
if (QFileInfo(project->file()->fileName()).filePath() == path)
return project;
return 0;
}

View File

@@ -180,19 +180,17 @@ private slots:
void showProperties(ProjectExplorer::Project *project); void showProperties(ProjectExplorer::Project *project);
void restoreStatus(); void restoreStatus();
void saveStatus(); void saveStatus();
void projectAdded();
void projectRemoved();
private: private:
void updateRunConfigurationsComboBox(); void updateRunConfigurationsComboBox();
SessionManager *m_session;
ProjectExplorerPlugin *m_projectExplorer;
ActiveConfigurationWidget *m_activeConfigurationWidget; ActiveConfigurationWidget *m_activeConfigurationWidget;
QWidget *m_spacerBetween; QWidget *m_spacerBetween;
QWidget *m_projectChooser; QWidget *m_projectChooser;
QLabel *m_noprojectLabel;
PanelsWidget *m_panelsWidget; PanelsWidget *m_panelsWidget;
Project *findProject(const QString &path) const;
bool m_currentItemChanged;
}; };

View File

@@ -215,6 +215,15 @@ QStringList GettingStartedWelcomePageWidget::tipsOfTheDay()
#else #else
tr("Alt", "Shortcut key"); tr("Alt", "Shortcut key");
#endif #endif
QString ctrlShortcut =
#ifdef Q_WS_MAC
tr("Cmd", "Shortcut key");
#else
tr("Ctrl", "Shortcut key");
#endif
tips.append(tr("You can switch between Qt Creator's modes using <tt>Ctrl+number</tt>:<ul>" tips.append(tr("You can switch between Qt Creator's modes using <tt>Ctrl+number</tt>:<ul>"
"<li>1 - Welcome</li><li>2 - Edit</li><li>3 - Debug</li><li>4 - Projects</li><li>5 - Help</li>" "<li>1 - Welcome</li><li>2 - Edit</li><li>3 - Debug</li><li>4 - Projects</li><li>5 - Help</li>"
"<li></li><li>6 - Output</li></ul>")); "<li></li><li>6 - Output</li></ul>"));
@@ -236,7 +245,7 @@ QStringList GettingStartedWelcomePageWidget::tipsOfTheDay()
"<ul><li>1 - Build Issues</li><li>2 - Search Results</li><li>3 - Application Output</li>" "<ul><li>1 - Build Issues</li><li>2 - Search Results</li><li>3 - Application Output</li>"
"<li>4 - Compile Output</li></ul>").arg(altShortcut)); "<li>4 - Compile Output</li></ul>").arg(altShortcut));
tips.append(tr("You can quickly search methods, classes, help and more using the " tips.append(tr("You can quickly search methods, classes, help and more using the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-navigation.html\">Locator bar</a> (<tt>Ctrl+K</tt>).")); "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-navigation.html\">Locator bar</a> (<tt>%1+K</tt>).").arg(ctrlShortcut));
tips.append(tr("You can add custom build steps in the " tips.append(tr("You can add custom build steps in the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>.")); "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>."));
tips.append(tr("Within a session, you can add " tips.append(tr("Within a session, you can add "

View File

@@ -156,6 +156,24 @@ QString S60DeviceRunConfiguration::basePackageFilePath() const
return m_baseFileName; return m_baseFileName;
} }
QString S60DeviceRunConfiguration::symbianPlatform() const
{
const_cast<S60DeviceRunConfiguration *>(this)->updateTarget();
return m_platform;
}
QString S60DeviceRunConfiguration::symbianTarget() const
{
const_cast<S60DeviceRunConfiguration *>(this)->updateTarget();
return m_target;
}
QString S60DeviceRunConfiguration::packageTemplateFileName() const
{
const_cast<S60DeviceRunConfiguration *>(this)->updateTarget();
return m_packageTemplateFileName;
}
S60DeviceRunConfiguration::SigningMode S60DeviceRunConfiguration::signingMode() const S60DeviceRunConfiguration::SigningMode S60DeviceRunConfiguration::signingMode() const
{ {
return m_signingMode; return m_signingMode;
@@ -194,48 +212,17 @@ QString S60DeviceRunConfiguration::packageFileName() const
return rc; return rc;
} }
/* Grep the pkg file for \code
; Executable and default resource files
"/S60/devices/S60_3rd_FP2_SDK_v1.1/epoc32/release/gcce/udeb/foo.exe" - "!:\sys\bin\foo.exe"
\endcode */
static QString localExecutableFromPkgFile(const QString &pkgFileName, QString *errorMessage)
{
QFile pkgFile(pkgFileName);
if (!pkgFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
*errorMessage = S60DeviceRunConfiguration::tr("Cannot open %1: %2").arg(pkgFileName, pkgFile.errorString());
return QString();
}
// "<SDK>/foo.exe" - "!:\device_bin\foo.exe"
const QRegExp exePattern = QRegExp(QLatin1String("^\"([^\"]+\\.exe)\" +-.*$"));
Q_ASSERT(exePattern.isValid());
foreach(const QString &line, QString::fromLocal8Bit(pkgFile.readAll()).split(QLatin1Char('\n'))) {
if (exePattern.exactMatch(line)) {
QString rc = exePattern.cap(1);
#ifdef Q_OS_WIN
// Sometimes, the drive letter is missing. Use that of the pkg file
if (rc.at(0) == QLatin1Char('/'))
rc.insert(0, pkgFileName.left(2));
#endif
return rc;
}
}
*errorMessage = S60DeviceRunConfiguration::tr("Unable to find the executable in the package file %1.").arg(pkgFileName);
return QString();
}
QString S60DeviceRunConfiguration::localExecutableFileName() const QString S60DeviceRunConfiguration::localExecutableFileName() const
{ {
const QString pkg = packageFileName(); Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
if (!pkg.isEmpty()) { S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(
QString errorMessage; qt4project->qtVersion(qt4project->activeBuildConfiguration()));
const QString rc = localExecutableFromPkgFile(pkg, &errorMessage);
if (rc.isEmpty()) QString localExecutable = device.epocRoot;
qWarning("%s\n", qPrintable(errorMessage)); localExecutable += QString::fromLatin1("/epoc32/release/%1/%2/%3.exe")
return rc; .arg(symbianPlatform()).arg(symbianTarget()).arg(targetName());
} qDebug() << localExecutable;
return QString(); return QDir::toNativeSeparators(localExecutable);
} }
void S60DeviceRunConfiguration::updateTarget() void S60DeviceRunConfiguration::updateTarget()
@@ -300,16 +287,21 @@ void S60DeviceRunConfiguration::updateTarget()
m_targetName = QFileInfo(m_proFilePath).baseName(); m_targetName = QFileInfo(m_proFilePath).baseName();
m_baseFileName = QDir::cleanPath(m_workingDir + QLatin1Char('/') + m_targetName); m_baseFileName = QDir::cleanPath(m_workingDir + QLatin1Char('/') + m_targetName);
m_packageTemplateFileName = QDir::cleanPath(
m_workingDir + QLatin1Char('/') + m_targetName + QLatin1String("_template.pkg"));
if (pro->toolChainType(pro->activeBuildConfiguration()) == ToolChain::GCCE) ToolChain::ToolChainType toolchain = pro->toolChainType(pro->activeBuildConfiguration());
m_baseFileName += "_gcce"; if (toolchain == ToolChain::GCCE)
m_platform = QLatin1String("gcce");
else if (toolchain == ToolChain::RVCT_ARMV5)
m_platform = QLatin1String("armv5");
else else
m_baseFileName += "_armv5"; m_platform = QLatin1String("armv6");
if (projectBuildConfiguration & QtVersion::DebugBuild) if (projectBuildConfiguration & QtVersion::DebugBuild)
m_baseFileName += "_udeb"; m_target = QLatin1String("udeb");
else else
m_baseFileName += "_urel"; m_target = QLatin1String("urel");
m_baseFileName += QLatin1Char('_') + m_platform + QLatin1Char('_') + m_target;
delete reader; delete reader;
m_cachedTargetInformationValid = true; m_cachedTargetInformationValid = true;
emit targetInformationChanged(); emit targetInformationChanged();
@@ -323,7 +315,8 @@ void S60DeviceRunConfiguration::invalidateCachedTargetInformation()
// ======== S60DeviceRunConfigurationWidget // ======== S60DeviceRunConfigurationWidget
S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunConfiguration *runConfiguration, S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
S60DeviceRunConfiguration *runConfiguration,
QWidget *parent) QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_runConfiguration(runConfiguration) m_runConfiguration(runConfiguration)
@@ -345,7 +338,8 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunCon
m_serialPorts = new QComboBox; m_serialPorts = new QComboBox;
updateSerialDevices(); updateSerialDevices();
connect(S60Manager::instance()->serialDeviceLister(), SIGNAL(updated()), this, SLOT(updateSerialDevices())); connect(S60Manager::instance()->serialDeviceLister(), SIGNAL(updated()),
this, SLOT(updateSerialDevices()));
connect(m_serialPorts, SIGNAL(activated(int)), this, SLOT(setSerialPort(int))); connect(m_serialPorts, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
formLayout->addRow(tr("Device on Serial Port:"), m_serialPorts); formLayout->addRow(tr("Device on Serial Port:"), m_serialPorts);
@@ -540,6 +534,9 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(const QSharedPointer<RunConfigu
m_serialPortFriendlyName = S60Manager::instance()->serialDeviceLister()->friendlyNameForPort(m_serialPortName); m_serialPortFriendlyName = S60Manager::instance()->serialDeviceLister()->friendlyNameForPort(m_serialPortName);
m_targetName = s60runConfig->targetName(); m_targetName = s60runConfig->targetName();
m_baseFileName = s60runConfig->basePackageFilePath(); m_baseFileName = s60runConfig->basePackageFilePath();
m_symbianPlatform = s60runConfig->symbianPlatform();
m_symbianTarget = s60runConfig->symbianTarget();
m_packageTemplateFile = s60runConfig->packageTemplateFileName();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath(); m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA"); m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA");
m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom); m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom);
@@ -550,7 +547,8 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(const QSharedPointer<RunConfigu
+ "/epoc32/tools"; + "/epoc32/tools";
m_executableFileName = lsFile(s60runConfig->localExecutableFileName()); m_executableFileName = lsFile(s60runConfig->localExecutableFileName());
m_makesisTool = m_toolsDirectory + "/makesis.exe"; m_makesisTool = m_toolsDirectory + "/makesis.exe";
m_packageFile = QFileInfo(s60runConfig->packageFileName()).fileName(); m_packageFilePath = s60runConfig->packageFileName();
m_packageFile = QFileInfo(m_packageFilePath).fileName();
} }
void S60DeviceRunControlBase::start() void S60DeviceRunControlBase::start()
@@ -560,7 +558,8 @@ void S60DeviceRunControlBase::start()
emit addToOutputWindow(this, tr("Creating %1.sisx ...").arg(QDir::toNativeSeparators(m_baseFileName))); emit addToOutputWindow(this, tr("Creating %1.sisx ...").arg(QDir::toNativeSeparators(m_baseFileName)));
emit addToOutputWindow(this, tr("Executable file: %1").arg(m_executableFileName)); emit addToOutputWindow(this, tr("Executable file: %1").arg(m_executableFileName));
if (!createPackageFileFromTemplate())
return;
m_makesis->setWorkingDirectory(m_workingDirectory); m_makesis->setWorkingDirectory(m_workingDirectory);
emit addToOutputWindow(this, tr("%1 %2").arg(QDir::toNativeSeparators(m_makesisTool), m_packageFile)); emit addToOutputWindow(this, tr("%1 %2").arg(QDir::toNativeSeparators(m_makesisTool), m_packageFile));
m_makesis->start(m_makesisTool, QStringList(m_packageFile), QIODevice::ReadOnly); m_makesis->start(m_makesisTool, QStringList(m_packageFile), QIODevice::ReadOnly);
@@ -593,6 +592,29 @@ void S60DeviceRunControlBase::readStandardOutput()
emit addToOutputWindowInline(this, QString::fromLocal8Bit(data.constData(), data.length())); emit addToOutputWindowInline(this, QString::fromLocal8Bit(data.constData(), data.length()));
} }
bool S60DeviceRunControlBase::createPackageFileFromTemplate()
{
QFile packageTemplate(m_packageTemplateFile);
if (!packageTemplate.open(QIODevice::ReadOnly)) {
error(this, tr("Could not read template package file '%1'").arg(QDir::toNativeSeparators(m_packageTemplateFile)));
emit finished();
return false;
}
QString contents = packageTemplate.readAll();
packageTemplate.close();
contents.replace(QLatin1String("$(PLATFORM)"), m_symbianPlatform);
contents.replace(QLatin1String("$(TARGET)"), m_symbianTarget);
QFile packageFile(m_packageFilePath);
if (!packageFile.open(QIODevice::WriteOnly)) {
error(this, tr("Could not write package file '%1'").arg(QDir::toNativeSeparators(m_packageFilePath)));
emit finished();
return false;
}
packageFile.write(contents.toLocal8Bit());
packageFile.close();
return true;
}
void S60DeviceRunControlBase::makesisProcessFailed() void S60DeviceRunControlBase::makesisProcessFailed()
{ {
processFailed("makesis.exe", m_makesis->error()); processFailed("makesis.exe", m_makesis->error());
@@ -605,13 +627,13 @@ void S60DeviceRunControlBase::makesisProcessFinished()
emit finished(); emit finished();
return; return;
} }
QString signsisTool = m_toolsDirectory + "/signsis.exe"; QString signsisTool = m_toolsDirectory + QLatin1String("/signsis.exe");
QString sisFile = QFileInfo(m_baseFileName + ".sis").fileName(); QString sisFile = QFileInfo(m_baseFileName + QLatin1String(".sis")).fileName();
QString sisxFile = QFileInfo(m_baseFileName + ".sisx").fileName(); QString sisxFile = QFileInfo(m_baseFileName + QLatin1String(".sisx")).fileName();
QString signature = (m_useCustomSignature ? m_customSignaturePath QString signature = (m_useCustomSignature ? m_customSignaturePath
: m_qtDir + "/selfsigned.cer"); : m_qtDir + QLatin1String("/src/s60installs/selfsigned.cer"));
QString key = (m_useCustomSignature ? m_customKeyPath QString key = (m_useCustomSignature ? m_customKeyPath
: m_qtDir + "/selfsigned.key"); : m_qtDir + QLatin1String("/src/s60installs/selfsigned.key"));
QStringList arguments; QStringList arguments;
arguments << sisFile arguments << sisFile
<< sisxFile << QDir::toNativeSeparators(signature) << sisxFile << QDir::toNativeSeparators(signature)

View File

@@ -74,6 +74,9 @@ public:
void setSerialPortName(const QString &name); void setSerialPortName(const QString &name);
QString targetName() const; QString targetName() const;
QString basePackageFilePath() const; QString basePackageFilePath() const;
QString symbianPlatform() const;
QString symbianTarget() const;
QString packageTemplateFileName() const;
SigningMode signingMode() const; SigningMode signingMode() const;
void setSigningMode(SigningMode mode); void setSigningMode(SigningMode mode);
QString customSignaturePath() const; QString customSignaturePath() const;
@@ -97,7 +100,10 @@ private:
QString m_proFilePath; QString m_proFilePath;
QString m_targetName; QString m_targetName;
QString m_platform;
QString m_target;
QString m_baseFileName; QString m_baseFileName;
QString m_packageTemplateFileName;
bool m_cachedTargetInformationValid; bool m_cachedTargetInformationValid;
QString m_serialPortName; QString m_serialPortName;
SigningMode m_signingMode; SigningMode m_signingMode;
@@ -180,10 +186,16 @@ private slots:
void launcherFinished(); void launcherFinished();
private: private:
bool createPackageFileFromTemplate();
QString m_serialPortName; QString m_serialPortName;
QString m_serialPortFriendlyName; QString m_serialPortFriendlyName;
QString m_targetName; QString m_targetName;
QString m_baseFileName; QString m_baseFileName;
QString m_symbianPlatform;
QString m_symbianTarget;
QString m_packageTemplateFile;
QString m_packageFilePath;
QString m_workingDirectory; QString m_workingDirectory;
QString m_toolsDirectory; QString m_toolsDirectory;
QString m_executableFileName; QString m_executableFileName;

View File

@@ -300,6 +300,11 @@ void QtOptionsPageWidget::addQtDir()
m_ui->defaultCombo->addItem(newVersion->name()); m_ui->defaultCombo->addItem(newVersion->name());
m_ui->nameEdit->setFocus(); m_ui->nameEdit->setFocus();
m_ui->nameEdit->selectAll(); m_ui->nameEdit->selectAll();
if (!m_versions.at(m_defaultVersion)->isValid()) {
m_defaultVersion = m_versions.count() - 1;
m_ui->defaultCombo->setCurrentIndex(m_versions.count() - 1);
}
} }
void QtOptionsPageWidget::removeQtDir() void QtOptionsPageWidget::removeQtDir()

View File

@@ -169,7 +169,7 @@ p, li { white-space: pre-wrap; }
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="pathLabel"> <widget class="QLabel" name="pathLabel">
<property name="text"> <property name="text">
<string>Path to QMake:</string> <string>QMake Location:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -1,16 +0,0 @@
s/#include "qscriptcontext_p.h"//g
s/#include "qscriptcontext.h"//g
s/#include "qscriptengine.h"//g
s/#include "qscriptmember_p.h"//g
s/#include "qscriptobject_p.h"//g
s/#include "qscriptvalueimpl_p.h"//g
s/#ifndef QT_NO_SCRIPT//g
s,#endif // QT_NO_SCRIPT,,g
s/QScript/JavaScript/g
s/QSCRIPT/JAVASCRIPT/g
s/qscript/javascript/g
s/Q_SCRIPT/J_SCRIPT/g
s/qsreal/qjsreal/g

View File

@@ -1,49 +0,0 @@
#!/bin/sh
me=$(dirname $0)
rm -f javascript.g
rm -f javascriptast.cpp
rm -f javascriptast_p.h
rm -f javascriptastfwd_p.h
rm -f javascriptastvisitor.cpp
rm -f javascriptastvisitor_p.h
rm -f javascriptlexer.cpp
rm -f javascriptlexer_p.h
rm -f javascriptmemorypool_p.h
rm -f javascriptnodepool_p.h
rm -f javascriptgrammar_p.h
rm -f javascriptgrammar.cpp
rm -f javascriptparser_p.h
rm -f javascriptparser.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscript.g > javascript.g
sed -f $me/cmd.sed $QTDIR/src/script/qscriptast.cpp > javascriptast.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptast_p.h > javascriptast_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastfwd_p.h > javascriptastfwd_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor.cpp > javascriptastvisitor.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor_p.h > javascriptastvisitor_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer_p.h > javascriptlexer_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer.cpp > javascriptlexer.cpp
sed -f $me/cmd.sed $QTDIR/src/script/qscriptmemorypool_p.h > javascriptmemorypool_p.h
sed -f $me/cmd.sed $QTDIR/src/script/qscriptnodepool_p.h > javascriptnodepool_p.h
qlalr --troll --no-lines --no-debug $me/javascript.g
chmod ugo-w javascript.g
chmod ugo-w javascriptast.cpp
chmod ugo-w javascriptast_p.h
chmod ugo-w javascriptastfwd_p.h
chmod ugo-w javascriptastvisitor.cpp
chmod ugo-w javascriptastvisitor_p.h
chmod ugo-w javascriptlexer_p.h
chmod ugo-w javascriptlexer.cpp
chmod ugo-w javascriptmemorypool_p.h
chmod ugo-w javascriptnodepool_p.h
chmod ugo-w javascriptgrammar_p.h
chmod ugo-w javascriptgrammar.cpp
chmod ugo-w javascriptparser_p.h
chmod ugo-w javascriptparser.cpp

View File

@@ -1,4 +1,45 @@
// This file was generated by qlalr - DO NOT EDIT! // This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "javascriptgrammar_p.h" #include "javascriptgrammar_p.h"
const char *const JavaScriptGrammar::spell [] = { const char *const JavaScriptGrammar::spell [] = {

View File

@@ -2,13 +2,41 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
** **
** This file is part of the $MODULE$ of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
** **
** $TROLLTECH_DUAL_LICENSE$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
** **
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** GNU Lesser General Public License Usage
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1122,7 +1122,7 @@ case 266: {
token_buffer[1].dval = yylval = lexer->dval(); token_buffer[1].dval = yylval = lexer->dval();
token_buffer[1].loc = yylloc = location(lexer); token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) { if (token_buffer[0].token != -1 && t_action(errorState, yytoken)) {
QString msg = QString::fromUtf8("Removed token"); QString msg = QString::fromUtf8("Removed token");
if (const char *tokenSpell = spell[token_buffer[0].token]) { if (const char *tokenSpell = spell[token_buffer[0].token]) {
msg += QLatin1String(": `"); msg += QLatin1String(": `");

View File

@@ -40,7 +40,7 @@ static const char * const showWrapColumnKey = "ShowWrapColumn";
static const char * const wrapColumnKey = "WrapColumn"; static const char * const wrapColumnKey = "WrapColumn";
static const char * const visualizeWhitespaceKey = "VisualizeWhitespace"; static const char * const visualizeWhitespaceKey = "VisualizeWhitespace";
static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers"; static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers";
static const char * const highlightCurrentLineKey = "HighlightCurrentLineKeyV2"; static const char * const highlightCurrentLineKey = "HighlightCurrentLineKey";
static const char * const highlightBlocksKey = "HighlightBlocksKey"; static const char * const highlightBlocksKey = "HighlightBlocksKey";
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey"; static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
static const char * const mouseNavigationKey = "MouseNavigation"; static const char * const mouseNavigationKey = "MouseNavigation";
@@ -56,7 +56,7 @@ DisplaySettings::DisplaySettings() :
m_wrapColumn(80), m_wrapColumn(80),
m_visualizeWhitespace(false), m_visualizeWhitespace(false),
m_displayFoldingMarkers(true), m_displayFoldingMarkers(true),
m_highlightCurrentLine(false), m_highlightCurrentLine(true),
m_highlightBlocks(false), m_highlightBlocks(false),
m_animateMatchingParentheses(true), m_animateMatchingParentheses(true),
m_mouseNavigation(true), m_mouseNavigation(true),

View File

@@ -251,7 +251,6 @@ void TextEditorActionHandler::createActions()
m_selectBlockDownAction= new QAction(tr("Select Block Down"), this); m_selectBlockDownAction= new QAction(tr("Select Block Down"), this);
command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId); command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown())); connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS);

View File

@@ -83,7 +83,6 @@ class Semantic;
class Control; class Control;
class MemoryPool; class MemoryPool;
class DiagnosticClient; class DiagnosticClient;
class MacroResolver;
class Identifier; class Identifier;
class Literal; class Literal;

View File

@@ -59,11 +59,6 @@
CPLUSPLUS_BEGIN_NAMESPACE CPLUSPLUS_BEGIN_NAMESPACE
MacroResolver::MacroResolver()
{ }
MacroResolver::~MacroResolver()
{ }
template <typename _Iterator> template <typename _Iterator>
static void delete_map_entries(_Iterator first, _Iterator last) static void delete_map_entries(_Iterator first, _Iterator last)
@@ -93,8 +88,7 @@ public:
Data(Control *control) Data(Control *control)
: control(control), : control(control),
translationUnit(0), translationUnit(0),
diagnosticClient(0), diagnosticClient(0)
macroResolver(0)
{ } { }
~Data() ~Data()
@@ -539,7 +533,6 @@ public:
Control *control; Control *control;
TranslationUnit *translationUnit; TranslationUnit *translationUnit;
DiagnosticClient *diagnosticClient; DiagnosticClient *diagnosticClient;
MacroResolver *macroResolver;
LiteralTable<Identifier> identifiers; LiteralTable<Identifier> identifiers;
LiteralTable<StringLiteral> stringLiterals; LiteralTable<StringLiteral> stringLiterals;
LiteralTable<NumericLiteral> numericLiterals; LiteralTable<NumericLiteral> numericLiterals;
@@ -602,12 +595,6 @@ TranslationUnit *Control::switchTranslationUnit(TranslationUnit *unit)
return previousTranslationUnit; return previousTranslationUnit;
} }
MacroResolver *Control::macroResolver() const
{ return d->macroResolver; }
void Control::setMacroResolver(MacroResolver *macroResolver)
{ d->macroResolver = macroResolver; }
DiagnosticClient *Control::diagnosticClient() const DiagnosticClient *Control::diagnosticClient() const
{ return d->diagnosticClient; } { return d->diagnosticClient; }

View File

@@ -55,18 +55,6 @@
CPLUSPLUS_BEGIN_HEADER CPLUSPLUS_BEGIN_HEADER
CPLUSPLUS_BEGIN_NAMESPACE CPLUSPLUS_BEGIN_NAMESPACE
class CPLUSPLUS_EXPORT MacroResolver
{
MacroResolver(const MacroResolver &other);
void operator = (const MacroResolver &other);
public:
MacroResolver();
virtual ~MacroResolver();
virtual bool isMacro(TranslationUnit *unit, unsigned tokenIndex) const = 0;
};
class CPLUSPLUS_EXPORT Control class CPLUSPLUS_EXPORT Control
{ {
public: public:
@@ -76,9 +64,6 @@ public:
TranslationUnit *translationUnit() const; TranslationUnit *translationUnit() const;
TranslationUnit *switchTranslationUnit(TranslationUnit *unit); TranslationUnit *switchTranslationUnit(TranslationUnit *unit);
MacroResolver *macroResolver() const;
void setMacroResolver(MacroResolver *macroResolver);
DiagnosticClient *diagnosticClient() const; DiagnosticClient *diagnosticClient() const;
void setDiagnosticClient(DiagnosticClient *diagnosticClient); void setDiagnosticClient(DiagnosticClient *diagnosticClient);

View File

@@ -244,14 +244,6 @@ void Parser::match(int kind, unsigned *token)
} }
} }
bool Parser::isMacro(unsigned tokenIndex) const
{
if (MacroResolver *r = _control->macroResolver())
return r->isMacro(_translationUnit, tokenIndex);
return false;
}
bool Parser::parseClassOrNamespaceName(NameAST *&node) bool Parser::parseClassOrNamespaceName(NameAST *&node)
{ {
if (LA() == T_IDENTIFIER) { if (LA() == T_IDENTIFIER) {
@@ -2561,10 +2553,6 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierAST *&node)
bool Parser::parseSimpleDeclaration(DeclarationAST *&node, bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
bool acceptStructDeclarator) bool acceptStructDeclarator)
{ {
if (LA() == T_IDENTIFIER && isMacro(cursor())) {
// printf("***** found macro reference `%s'\n", tok().identifier->chars());
}
unsigned qt_invokable_token = 0; unsigned qt_invokable_token = 0;
if (acceptStructDeclarator && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT)) if (acceptStructDeclarator && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT))
qt_invokable_token = consumeToken(); qt_invokable_token = consumeToken();

View File

@@ -286,8 +286,6 @@ private:
inline void rewind(unsigned cursor) inline void rewind(unsigned cursor)
{ _tokenIndex = cursor; } { _tokenIndex = cursor; }
bool isMacro(unsigned tokenIndex) const;
private: private:
TranslationUnit *_translationUnit; TranslationUnit *_translationUnit;
Control *_control; Control *_control;