summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/addressbook-sdk.qdoc36
-rw-r--r--qtcreator.pri8
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros.cpp2
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros_p.h36
-rw-r--r--share/qtcreator/translations/translations.pro1
-rw-r--r--src/libs/cplusplus/ExpressionUnderCursor.cpp1
-rw-r--r--src/libs/cplusplus/ExpressionUnderCursor.h1
-rw-r--r--src/libs/cplusplus/GenTemplateInstance.cpp145
-rw-r--r--src/libs/cplusplus/GenTemplateInstance.h58
-rw-r--r--src/libs/cplusplus/ResolveExpression.cpp171
-rw-r--r--src/libs/cplusplus/cplusplus-lib.pri2
-rw-r--r--src/libs/cplusplus/pp-engine.cpp19
-rw-r--r--src/libs/cplusplus/pp-engine.h5
-rw-r--r--src/libs/cplusplus/pp-scanner.h9
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec1.xml6
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong1.xml6
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong2.xml6
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong3.xml6
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong4.xml6
-rw-r--r--src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong5.xml6
-rw-r--r--src/libs/utils/basevalidatinglineedit.cpp4
-rw-r--r--src/libs/utils/basevalidatinglineedit.h1
-rw-r--r--src/libs/utils/newclasswidget.cpp24
-rw-r--r--src/libs/utils/newclasswidget.h6
-rw-r--r--src/libs/utils/newclasswidget.ui39
-rw-r--r--src/libs/utils/pathchooser.cpp1
-rw-r--r--src/libs/utils/pathchooser.h1
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp12
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.h11
-rw-r--r--src/plugins/coreplugin/messagemanager.cpp11
-rw-r--r--src/plugins/coreplugin/messagemanager.h4
-rw-r--r--src/plugins/cpaster/pastebindotcomsettings.cpp8
-rw-r--r--src/plugins/cppeditor/cppclasswizard.cpp4
-rw-r--r--src/plugins/cppeditor/cppclasswizard.h1
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp3
-rw-r--r--src/plugins/cpptools/cppcodecompletion.cpp3
-rw-r--r--src/plugins/cpptools/cppcodecompletion.h14
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp3
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.h1
-rw-r--r--src/plugins/cpptools/searchsymbols.h2
-rw-r--r--src/plugins/debugger/cdb/cdb.pri2
-rw-r--r--src/plugins/debugger/debuggermanager.cpp1
-rw-r--r--src/plugins/debugger/debuggermanager.h1
-rw-r--r--src/plugins/debugger/gdb/gdb.pri2
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp517
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h17
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.cpp4
-rw-r--r--src/plugins/debugger/gdb/s60debuggerbluetoothstarter.cpp52
-rw-r--r--src/plugins/debugger/gdb/s60debuggerbluetoothstarter.h55
-rw-r--r--src/plugins/debugger/gdb/trkgdbadapter.cpp239
-rw-r--r--src/plugins/debugger/gdb/trkgdbadapter.h25
-rw-r--r--src/plugins/debugger/watchutils.cpp7
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp20
-rw-r--r--src/plugins/help/helpplugin.cpp2
-rw-r--r--src/plugins/qmleditor/QmlEditor.pluginspec1
-rw-r--r--src/plugins/qmleditor/parser/qmljs.g130
-rw-r--r--src/plugins/qmleditor/parser/qmljsast.cpp38
-rw-r--r--src/plugins/qmleditor/parser/qmljsast_p.h38
-rw-r--r--src/plugins/qmleditor/parser/qmljsastfwd_p.h38
-rw-r--r--src/plugins/qmleditor/parser/qmljsastvisitor.cpp44
-rw-r--r--src/plugins/qmleditor/parser/qmljsastvisitor_p.h40
-rw-r--r--src/plugins/qmleditor/parser/qmljsengine_p.cpp40
-rw-r--r--src/plugins/qmleditor/parser/qmljsengine_p.h40
-rw-r--r--src/plugins/qmleditor/parser/qmljsgrammar.cpp32
-rw-r--r--src/plugins/qmleditor/parser/qmljsgrammar_p.h32
-rw-r--r--src/plugins/qmleditor/parser/qmljslexer.cpp71
-rw-r--r--src/plugins/qmleditor/parser/qmljslexer_p.h40
-rw-r--r--src/plugins/qmleditor/parser/qmljsmemorypool_p.h38
-rw-r--r--src/plugins/qmleditor/parser/qmljsnodepool_p.h40
-rw-r--r--src/plugins/qmleditor/parser/qmljsparser.cpp49
-rw-r--r--src/plugins/qmleditor/parser/qmljsparser_p.h38
-rw-r--r--src/plugins/qmleditor/qmleditor.pro1
-rw-r--r--src/plugins/qmleditor/qmleditor_dependencies.pri1
-rw-r--r--src/plugins/qmleditor/qmleditorplugin.cpp24
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp7
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectplugin.cpp1
-rw-r--r--src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp87
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt-s60.pri10
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp189
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h42
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp351
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h97
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devices.cpp67
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devices.h12
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicespreferencepane.cpp9
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp35
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h13
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp53
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.h53
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp51
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h38
-rw-r--r--src/plugins/qt4projectmanager/qtversionmanager.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qtversionmanager.h4
-rw-r--r--src/plugins/qtscripteditor/parser/javascript.g134
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptast.cpp39
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptast_p.h45
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptastfwd_p.h46
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp36
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h47
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptengine_p.h16
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptgrammar.cpp40
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptgrammar_p.h45
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptlexer.cpp47
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptlexer_p.h47
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h52
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptnodepool_p.h53
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptparser.cpp47
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptparser_p.h36
-rw-r--r--src/plugins/qtscripteditor/parser/javascriptvalue.h29
-rw-r--r--src/shared/cplusplus/AST.h1
-rw-r--r--src/shared/cplusplus/LiteralTable.h2
-rw-r--r--src/shared/cplusplus/MemoryPool.cpp13
-rw-r--r--src/shared/cplusplus/MemoryPool.h16
-rw-r--r--src/shared/cplusplus/Parser.cpp55
-rw-r--r--src/shared/cplusplus/Parser.h17
-rw-r--r--src/shared/cplusplus/Symbols.cpp1
-rw-r--r--src/shared/trk/bluetoothlistener.cpp212
-rw-r--r--src/shared/trk/bluetoothlistener.h89
-rw-r--r--src/shared/trk/bluetoothlistener_gui.cpp75
-rw-r--r--src/shared/trk/bluetoothlistener_gui.h58
-rw-r--r--src/shared/trk/communicationstarter.cpp228
-rw-r--r--src/shared/trk/communicationstarter.h125
-rw-r--r--src/shared/trk/launcher.cpp134
-rw-r--r--src/shared/trk/launcher.h19
-rw-r--r--src/shared/trk/trk.pri21
-rw-r--r--src/shared/trk/trkdevice.cpp60
-rw-r--r--src/shared/trk/trkutils.cpp69
-rw-r--r--src/shared/trk/trkutils.h34
-rw-r--r--tests/auto/cplusplus/semantic/tst_semantic.cpp20
-rw-r--r--tests/auto/debugger/tst_gdb.cpp1198
-rw-r--r--tests/manual/cplusplus/main.cpp204
-rwxr-xr-xtests/manual/cplusplus/test-pretty-printer3
-rwxr-xr-xtests/manual/cplusplus/test-rewriter3
-rw-r--r--tests/manual/plain-cplusplus/main.cpp79
-rw-r--r--tests/manual/plain-cplusplus/plain-cplusplus.pro23
-rw-r--r--tests/manual/trklauncher/main.cpp103
-rw-r--r--tests/manual/trklauncher/trklauncher.pro2
138 files changed, 4758 insertions, 2391 deletions
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc
index 7d7734bea7..9737100f25 100644
--- a/doc/addressbook-sdk.qdoc
+++ b/doc/addressbook-sdk.qdoc
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,24 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
/*!
\page tutorials-addressbook-sdk.html
diff --git a/qtcreator.pri b/qtcreator.pri
index 42fb50e36c..f78baa33f0 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -93,11 +93,11 @@ DEFINES += QT_NO_CAST_TO_ASCII
#DEFINES += QT_USE_FAST_CONCATENATION
unix {
- debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
- release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
+ CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
+ CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
- debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared
- release:MOC_DIR = $${OUT_PWD}/.moc/release-shared
+ CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
+ CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
RCC_DIR = $${OUT_PWD}/.rcc
UI_DIR = $${OUT_PWD}/.uic
diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp
index b5283d42e3..ae677bcdb6 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.cpp
+++ b/share/qtcreator/gdbmacros/gdbmacros.cpp
@@ -3120,7 +3120,6 @@ static void qDumpStdMapHelper(QDumper &d)
const char *valueType = d.templateParameters[1];
const void *p = d.data;
qCheckAccess(p);
- p = deref(p);
const int nn = map.size();
if (nn < 0)
@@ -3236,7 +3235,6 @@ static void qDumpStdSetHelper(QDumper &d)
const DummyType &set = *reinterpret_cast<const DummyType*>(d.data);
const void *p = d.data;
qCheckAccess(p);
- p = deref(p);
const int nn = set.size();
if (nn < 0)
diff --git a/share/qtcreator/gdbmacros/gdbmacros_p.h b/share/qtcreator/gdbmacros/gdbmacros_p.h
index fc6b665e9a..88867b02b2 100644
--- a/share/qtcreator/gdbmacros/gdbmacros_p.h
+++ b/share/qtcreator/gdbmacros/gdbmacros_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Qt Assistant of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,24 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
#ifndef GDBMACROS_P_H
#define GDBMACROS_P_H
diff --git a/share/qtcreator/translations/translations.pro b/share/qtcreator/translations/translations.pro
index 46fb224252..5c384ccb7f 100644
--- a/share/qtcreator/translations/translations.pro
+++ b/share/qtcreator/translations/translations.pro
@@ -61,4 +61,5 @@ isEmpty(vcproj) {
qmfiles.files = $$prependAll(LANGUAGES, $$OUT_PWD/qtcreator_,.qm)
qmfiles.path = /share/qtcreator/translations
+qmfiles.CONFIG += no_check_exist
INSTALLS += qmfiles
diff --git a/src/libs/cplusplus/ExpressionUnderCursor.cpp b/src/libs/cplusplus/ExpressionUnderCursor.cpp
index 26a2b3a961..995eeace37 100644
--- a/src/libs/cplusplus/ExpressionUnderCursor.cpp
+++ b/src/libs/cplusplus/ExpressionUnderCursor.cpp
@@ -38,6 +38,7 @@
using namespace CPlusPlus;
ExpressionUnderCursor::ExpressionUnderCursor()
+ : _jumpedComma(false)
{ }
ExpressionUnderCursor::~ExpressionUnderCursor()
diff --git a/src/libs/cplusplus/ExpressionUnderCursor.h b/src/libs/cplusplus/ExpressionUnderCursor.h
index b72f790f97..faf969662b 100644
--- a/src/libs/cplusplus/ExpressionUnderCursor.h
+++ b/src/libs/cplusplus/ExpressionUnderCursor.h
@@ -59,6 +59,7 @@ private:
int previousBlockState(const QTextBlock &block);
bool isAccessToken(const SimpleToken &tk);
+private:
bool _jumpedComma;
};
diff --git a/src/libs/cplusplus/GenTemplateInstance.cpp b/src/libs/cplusplus/GenTemplateInstance.cpp
new file mode 100644
index 0000000000..0755593250
--- /dev/null
+++ b/src/libs/cplusplus/GenTemplateInstance.cpp
@@ -0,0 +1,145 @@
+
+#include "GenTemplateInstance.h"
+#include <Control.h>
+#include <Scope.h>
+#include <Names.h>
+#include <Symbols.h>
+#include <CoreTypes.h>
+#include <QtCore/QVarLengthArray>
+
+using namespace CPlusPlus;
+
+GenTemplateInstance::GenTemplateInstance(Control *control, const Substitution &substitution)
+ : _control(control),
+ _substitution(substitution)
+{ }
+
+FullySpecifiedType GenTemplateInstance::operator()(const FullySpecifiedType &ty)
+{ return subst(ty); }
+
+FullySpecifiedType GenTemplateInstance::subst(Name *name)
+{
+ if (TemplateNameId *t = name->asTemplateNameId()) {
+ QVarLengthArray<FullySpecifiedType, 8> args(t->templateArgumentCount());
+
+ for (unsigned i = 0; i < t->templateArgumentCount(); ++i)
+ args[i] = subst(t->templateArgumentAt(i));
+
+ TemplateNameId *n = _control->templateNameId(t->identifier(),
+ args.data(), args.size());
+
+ return FullySpecifiedType(_control->namedType(n));
+ } else if (name->isQualifiedNameId()) {
+ // ### implement me
+ }
+
+ for (int i = 0; i < _substitution.size(); ++i) {
+ const QPair<Name *, FullySpecifiedType> s = _substitution.at(i);
+ if (name->isEqualTo(s.first))
+ return s.second;
+ }
+
+ return FullySpecifiedType(_control->namedType(name));
+}
+
+FullySpecifiedType GenTemplateInstance::subst(const FullySpecifiedType &ty)
+{
+ FullySpecifiedType previousType = switchType(ty);
+ TypeVisitor::accept(ty.type());
+ return switchType(previousType);
+}
+
+FullySpecifiedType GenTemplateInstance::switchType(const FullySpecifiedType &type)
+{
+ FullySpecifiedType previousType = _type;
+ _type = type;
+ return previousType;
+}
+
+// types
+void GenTemplateInstance::visit(PointerToMemberType * /*ty*/)
+{
+ Q_ASSERT(false);
+}
+
+void GenTemplateInstance::visit(PointerType *ty)
+{
+ FullySpecifiedType elementType = subst(ty->elementType());
+ _type.setType(_control->pointerType(elementType));
+}
+
+void GenTemplateInstance::visit(ReferenceType *ty)
+{
+ FullySpecifiedType elementType = subst(ty->elementType());
+ _type.setType(_control->referenceType(elementType));
+}
+
+void GenTemplateInstance::visit(ArrayType *ty)
+{
+ FullySpecifiedType elementType = subst(ty->elementType());
+ _type.setType(_control->arrayType(elementType, ty->size()));
+}
+
+void GenTemplateInstance::visit(NamedType *ty)
+{
+ Name *name = ty->name();
+ _type.setType(subst(name).type());
+}
+
+void GenTemplateInstance::visit(Function *ty)
+{
+ Name *name = ty->name();
+ FullySpecifiedType returnType = subst(ty->returnType());
+
+ Function *fun = _control->newFunction(0, name);
+ fun->setScope(ty->scope());
+ fun->setConst(ty->isConst());
+ fun->setVolatile(ty->isVolatile());
+ fun->setReturnType(returnType);
+ for (unsigned i = 0; i < ty->argumentCount(); ++i) {
+ Symbol *arg = ty->argumentAt(i);
+ FullySpecifiedType argTy = subst(arg->type());
+ Argument *newArg = _control->newArgument(0, arg->name());
+ newArg->setType(argTy);
+ fun->arguments()->enterSymbol(newArg);
+ }
+ _type.setType(fun);
+}
+
+void GenTemplateInstance::visit(VoidType *)
+{ /* nothing to do*/ }
+
+void GenTemplateInstance::visit(IntegerType *)
+{ /* nothing to do*/ }
+
+void GenTemplateInstance::visit(FloatType *)
+{ /* nothing to do*/ }
+
+void GenTemplateInstance::visit(Namespace *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(Class *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(Enum *)
+{ Q_ASSERT(false); }
+
+// names
+void GenTemplateInstance::visit(NameId *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(TemplateNameId *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(DestructorNameId *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(OperatorNameId *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(ConversionNameId *)
+{ Q_ASSERT(false); }
+
+void GenTemplateInstance::visit(QualifiedNameId *)
+{ Q_ASSERT(false); }
+
diff --git a/src/libs/cplusplus/GenTemplateInstance.h b/src/libs/cplusplus/GenTemplateInstance.h
new file mode 100644
index 0000000000..a4845f8bc3
--- /dev/null
+++ b/src/libs/cplusplus/GenTemplateInstance.h
@@ -0,0 +1,58 @@
+#ifndef GENTEMPLATEINSTANCE_H
+#define GENTEMPLATEINSTANCE_H
+
+#include <TypeVisitor.h>
+#include <NameVisitor.h>
+#include <FullySpecifiedType.h>
+
+#include <QtCore/QList>
+#include <QtCore/QPair>
+
+namespace CPlusPlus {
+
+class CPLUSPLUS_EXPORT GenTemplateInstance: protected TypeVisitor, protected NameVisitor
+{
+public:
+ typedef QList< QPair<Name *, FullySpecifiedType> > Substitution;
+
+public:
+ GenTemplateInstance(Control *control, const Substitution &substitution);
+
+ FullySpecifiedType operator()(const FullySpecifiedType &ty);
+
+protected:
+ FullySpecifiedType subst(Name *name);
+ FullySpecifiedType subst(const FullySpecifiedType &ty);
+
+ FullySpecifiedType switchType(const FullySpecifiedType &type);
+
+ virtual void visit(PointerToMemberType * /*ty*/);
+ virtual void visit(PointerType *ty);
+ virtual void visit(ReferenceType *ty);
+ virtual void visit(ArrayType *ty);
+ virtual void visit(NamedType *ty);
+ virtual void visit(Function *ty);
+ virtual void visit(VoidType *);
+ virtual void visit(IntegerType *);
+ virtual void visit(FloatType *);
+ virtual void visit(Namespace *);
+ virtual void visit(Class *);
+ virtual void visit(Enum *);
+
+ // names
+ virtual void visit(NameId *);
+ virtual void visit(TemplateNameId *);
+ virtual void visit(DestructorNameId *);
+ virtual void visit(OperatorNameId *);
+ virtual void visit(ConversionNameId *);
+ virtual void visit(QualifiedNameId *);
+
+private:
+ Control *_control;
+ FullySpecifiedType _type;
+ const Substitution _substitution;
+};
+
+} // end of namespace CPlusPlus
+
+#endif // GENTEMPLATEINSTANCE_H
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 7c9eedebd5..f89c2c9afd 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -30,6 +30,7 @@
#include "ResolveExpression.h"
#include "LookupContext.h"
#include "Overview.h"
+#include "GenTemplateInstance.h"
#include <Control.h>
#include <AST.h>
@@ -49,151 +50,6 @@ using namespace CPlusPlus;
namespace {
-typedef QList< QPair<Name *, FullySpecifiedType> > Substitution;
-
-class GenerateInstance: protected TypeVisitor, protected NameVisitor
-{
- Control *_control;
- FullySpecifiedType _type;
- const Substitution _substitution;
-
-public:
- GenerateInstance(Control *control, const Substitution &substitution)
- : _control(control),
- _substitution(substitution)
- { }
-
- FullySpecifiedType operator()(const FullySpecifiedType &ty)
- { return subst(ty); }
-
-protected:
- FullySpecifiedType subst(Name *name)
- {
- if (TemplateNameId *t = name->asTemplateNameId()) {
- QVarLengthArray<FullySpecifiedType, 8> args(t->templateArgumentCount());
-
- for (unsigned i = 0; i < t->templateArgumentCount(); ++i)
- args[i] = subst(t->templateArgumentAt(i));
-
- TemplateNameId *n = _control->templateNameId(t->identifier(),
- args.data(), args.size());
-
- return FullySpecifiedType(_control->namedType(n));
- } else if (name->isQualifiedNameId()) {
- // ### implement me
- }
-
- for (int i = 0; i < _substitution.size(); ++i) {
- const QPair<Name *, FullySpecifiedType> s = _substitution.at(i);
- if (name->isEqualTo(s.first))
- return s.second;
- }
-
- return FullySpecifiedType(_control->namedType(name));
- }
-
- FullySpecifiedType subst(const FullySpecifiedType &ty)
- {
- FullySpecifiedType previousType = switchType(ty);
- TypeVisitor::accept(ty.type());
- return switchType(previousType);
- }
-
- FullySpecifiedType switchType(const FullySpecifiedType &type)
- {
- FullySpecifiedType previousType = _type;
- _type = type;
- return previousType;
- }
-
- // types
- virtual void visit(PointerToMemberType * /*ty*/)
- {
- Q_ASSERT(false);
- }
-
- virtual void visit(PointerType *ty)
- {
- FullySpecifiedType elementType = subst(ty->elementType());
- _type.setType(_control->pointerType(elementType));
- }
-
- virtual void visit(ReferenceType *ty)
- {
- FullySpecifiedType elementType = subst(ty->elementType());
- _type.setType(_control->referenceType(elementType));
- }
-
- virtual void visit(ArrayType *ty)
- {
- FullySpecifiedType elementType = subst(ty->elementType());
- _type.setType(_control->arrayType(elementType, ty->size()));
- }
-
- virtual void visit(NamedType *ty)
- {
- Name *name = ty->name();
- _type.setType(subst(name).type());
- }
-
- virtual void visit(Function *ty)
- {
- Name *name = ty->name();
- FullySpecifiedType returnType = subst(ty->returnType());
-
- Function *fun = _control->newFunction(0, name);
- fun->setScope(ty->scope());
- fun->setConst(ty->isConst());
- fun->setVolatile(ty->isVolatile());
- fun->setReturnType(returnType);
- for (unsigned i = 0; i < ty->argumentCount(); ++i) {
- Symbol *arg = ty->argumentAt(i);
- FullySpecifiedType argTy = subst(arg->type());
- Argument *newArg = _control->newArgument(0, arg->name());
- newArg->setType(argTy);
- fun->arguments()->enterSymbol(newArg);
- }
- _type.setType(fun);
- }
-
- virtual void visit(VoidType *)
- { /* nothing to do*/ }
-
- virtual void visit(IntegerType *)
- { /* nothing to do*/ }
-
- virtual void visit(FloatType *)
- { /* nothing to do*/ }
-
- virtual void visit(Namespace *)
- { Q_ASSERT(false); }
-
- virtual void visit(Class *)
- { Q_ASSERT(false); }
-
- virtual void visit(Enum *)
- { Q_ASSERT(false); }
-
- // names
- virtual void visit(NameId *)
- { Q_ASSERT(false); }
-
- virtual void visit(TemplateNameId *)
- { Q_ASSERT(false); }
-
- virtual void visit(DestructorNameId *)
- { Q_ASSERT(false); }
-
- virtual void visit(OperatorNameId *)
- { Q_ASSERT(false); }
-
- virtual void visit(ConversionNameId *)
- { Q_ASSERT(false); }
-
- virtual void visit(QualifiedNameId *)
- { Q_ASSERT(false); }
-};
-
template <typename _Tp>
static QList<_Tp> removeDuplicates(const QList<_Tp> &results)
{
@@ -286,9 +142,14 @@ bool ResolveExpression::visit(ConditionAST *)
return false;
}
-bool ResolveExpression::visit(ConditionalExpressionAST *)
+bool ResolveExpression::visit(ConditionalExpressionAST *ast)
{
- // nothing to do.
+ if (ast->left_expression)
+ accept(ast->left_expression);
+
+ else if (ast->right_expression)
+ accept(ast->right_expression);
+
return false;
}
@@ -300,7 +161,8 @@ bool ResolveExpression::visit(CppCastExpressionAST *ast)
bool ResolveExpression::visit(DeleteExpressionAST *)
{
- // nothing to do.
+ FullySpecifiedType ty(control()->voidType());
+ addResult(ty);
return false;
}
@@ -310,8 +172,15 @@ bool ResolveExpression::visit(ArrayInitializerAST *)
return false;
}
-bool ResolveExpression::visit(NewExpressionAST *)
+bool ResolveExpression::visit(NewExpressionAST *ast)
{
+ if (ast->new_type_id) {
+ Scope *scope = _context.expressionDocument()->globalSymbols();
+ FullySpecifiedType ty = sem.check(ast->new_type_id->type_specifier, scope);
+ ty = sem.check(ast->new_type_id->ptr_operators, ty, scope);
+ FullySpecifiedType ptrTy(control()->pointerType(ty));
+ addResult(ptrTy);
+ }
// nothing to do.
return false;
}
@@ -836,7 +705,7 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
unqualifiedNameId = q->unqualifiedNameId();
if (TemplateNameId *templId = unqualifiedNameId->asTemplateNameId()) {
- Substitution subst;
+ GenTemplateInstance::Substitution subst;
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
@@ -846,7 +715,7 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
templArgTy));
}
- GenerateInstance inst(control(), subst);
+ GenTemplateInstance inst(control(), subst);
ty = inst(ty);
}
diff --git a/src/libs/cplusplus/cplusplus-lib.pri b/src/libs/cplusplus/cplusplus-lib.pri
index 34caa520a8..812dbe0c9a 100644
--- a/src/libs/cplusplus/cplusplus-lib.pri
+++ b/src/libs/cplusplus/cplusplus-lib.pri
@@ -32,6 +32,7 @@ HEADERS += \
$$PWD/LookupContext.h \
$$PWD/CppBindings.h \
$$PWD/ASTParent.h \
+ $$PWD/GenTemplateInstance.h \
$$PWD/CheckUndefinedSymbols.h \
$$PWD/PreprocessorClient.h \
$$PWD/PreprocessorEnvironment.h \
@@ -54,6 +55,7 @@ SOURCES += \
$$PWD/LookupContext.cpp \
$$PWD/CppBindings.cpp \
$$PWD/ASTParent.cpp \
+ $$PWD/GenTemplateInstance.cpp \
$$PWD/CheckUndefinedSymbols.cpp \
$$PWD/PreprocessorClient.cpp \
$$PWD/PreprocessorEnvironment.cpp \
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 5ce662b998..c2bb068bce 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -545,6 +545,9 @@ Preprocessor::Preprocessor(Client *client, Environment *env)
: client(client),
env(env),
_expand(env),
+ _skipping(MAX_LEVEL),
+ _trueTest(MAX_LEVEL),
+ _dot(_tokens.end()),
_result(0),
_markGeneratedTokens(false),
_expandMacros(true)
@@ -1268,7 +1271,7 @@ void Preprocessor::processIf(TokenIterator firstToken, TokenIterator lastToken)
tokens.constEnd() - 1,
condition);
- _true_test[iflevel] = ! result.is_zero ();
+ _trueTest[iflevel] = ! result.is_zero ();
_skipping[iflevel] = result.is_zero ();
}
}
@@ -1282,7 +1285,7 @@ void Preprocessor::processElse(TokenIterator firstToken, TokenIterator lastToken
} else if (iflevel > 0 && _skipping[iflevel - 1]) {
_skipping[iflevel] = true;
} else {
- _skipping[iflevel] = _true_test[iflevel];
+ _skipping[iflevel] = _trueTest[iflevel];
}
}
@@ -1296,7 +1299,7 @@ void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken
// std::cerr << "*** WARNING: " << __FILE__ << __LINE__ << std::endl;
} else if (iflevel == 0 && !skipping()) {
// std::cerr << "*** WARNING #else without #if" << std::endl;
- } else if (!_true_test[iflevel] && !_skipping[iflevel - 1]) {
+ } else if (!_trueTest[iflevel] && !_skipping[iflevel - 1]) {
const char *first = startOfToken(*tk);
const char *last = startOfToken(*lastToken);
@@ -1312,7 +1315,7 @@ void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken
tokens.constEnd() - 1,
condition);
- _true_test[iflevel] = ! result.is_zero ();
+ _trueTest[iflevel] = ! result.is_zero ();
_skipping[iflevel] = result.is_zero ();
} else {
_skipping[iflevel] = true;
@@ -1325,7 +1328,7 @@ void Preprocessor::processEndif(TokenIterator, TokenIterator)
// std::cerr << "*** WARNING #endif without #if" << std::endl;
} else {
_skipping[iflevel] = false;
- _true_test[iflevel] = false;
+ _trueTest[iflevel] = false;
--iflevel;
}
@@ -1347,7 +1350,7 @@ void Preprocessor::processIfdef(bool checkUndefined,
if (checkUndefined)
value = ! value;
- _true_test[iflevel] = value;
+ _trueTest[iflevel] = value;
_skipping [iflevel] = ! value;
}
}
@@ -1373,7 +1376,7 @@ void Preprocessor::resetIfLevel ()
{
iflevel = 0;
_skipping[iflevel] = false;
- _true_test[iflevel] = false;
+ _trueTest[iflevel] = false;
}
Preprocessor::PP_DIRECTIVE_TYPE Preprocessor::classifyDirective(const QByteArray &directive) const
@@ -1431,7 +1434,7 @@ bool Preprocessor::testIfLevel()
{
const bool result = !_skipping[iflevel++];
_skipping[iflevel] = _skipping[iflevel - 1];
- _true_test[iflevel] = false;
+ _trueTest[iflevel] = false;
return result;
}
diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h
index 5203f7db0e..596a223e05 100644
--- a/src/libs/cplusplus/pp-engine.h
+++ b/src/libs/cplusplus/pp-engine.h
@@ -54,6 +54,7 @@
#include <Token.h>
#include <QVector>
+#include <QBitArray>
namespace CPlusPlus {
@@ -177,8 +178,8 @@ private:
Environment *env;
MacroExpander _expand;
- bool _skipping[MAX_LEVEL]; // ### move in state
- bool _true_test[MAX_LEVEL]; // ### move in state
+ QBitArray _skipping; // ### move in state
+ QBitArray _trueTest; // ### move in state
int iflevel; // ### move in state
QList<State> _savedStates;
diff --git a/src/libs/cplusplus/pp-scanner.h b/src/libs/cplusplus/pp-scanner.h
index 16baa57c37..a7e0051460 100644
--- a/src/libs/cplusplus/pp-scanner.h
+++ b/src/libs/cplusplus/pp-scanner.h
@@ -54,6 +54,8 @@ namespace CPlusPlus {
struct pp_skip_blanks
{
int lines;
+
+ pp_skip_blanks(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -61,6 +63,7 @@ struct pp_skip_whitespaces
{
int lines;
+ pp_skip_whitespaces(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -68,6 +71,7 @@ struct pp_skip_comment_or_divop
{
int lines;
+ pp_skip_comment_or_divop(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -75,6 +79,7 @@ struct pp_skip_identifier
{
int lines;
+ pp_skip_identifier(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -82,6 +87,7 @@ struct pp_skip_number
{
int lines;
+ pp_skip_number(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -89,6 +95,7 @@ struct pp_skip_string_literal
{
int lines;
+ pp_skip_string_literal(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -96,6 +103,7 @@ struct pp_skip_char_literal
{
int lines;
+ pp_skip_char_literal(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
@@ -108,6 +116,7 @@ struct pp_skip_argument
pp_skip_comment_or_divop skip_comment_or_divop;
int lines;
+ pp_skip_argument(): lines(0) {}
const char *operator () (const char *first, const char *last);
};
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec1.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec1.xml
index 31cebf4414..994f330bbe 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec1.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec1.xml
@@ -1,6 +1,6 @@
<plugin name="test" version="1.0.1" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.noki.com</url>
<dependencyList>
<dependency name="SomeOtherPlugin" version="2.3.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong1.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong1.xml
index e6fe956c98..ffcb61241e 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong1.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong1.xml
@@ -1,6 +1,6 @@
<something name="test" version="1.0.1" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="SomeOtherPlugin" version="2.3.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong2.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong2.xml
index 200a1fd1ac..917acf78ad 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong2.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong2.xml
@@ -1,6 +1,6 @@
<plugin version="1.0.1" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="SomeOtherPlugin" version="2.3.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong3.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong3.xml
index 13bbdb09a8..d79ab4492b 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong3.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong3.xml
@@ -1,6 +1,6 @@
<plugin name="test" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="SomeOtherPlugin" version="2.3.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong4.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong4.xml
index b904f90138..849f165f9c 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong4.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong4.xml
@@ -1,6 +1,6 @@
<plugin name="test" version="1.0.1" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.nokia.com</url>
<dependencyList>
<dependency version="2.3.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong5.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong5.xml
index 1c110d1eea..03936fd88c 100644
--- a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong5.xml
+++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/spec_wrong5.xml
@@ -1,6 +1,6 @@
<plugin name="test" version="1.0.1" compatVersion="1.0.0">
- <vendor>Trolltech</vendor>
- <copyright>(C) 2007 Trolltech ASA</copyright>
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2007 Nokia Corporation</copyright>
<license>
This is a default license bla
blubbblubb
@@ -10,7 +10,7 @@ end of terms
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
- <url>http://www.trolltech.com</url>
+ <url>http://qt.nokia.com</url>
<dependencyList>
<dependency name="SomeOtherPlugin" version="2.3aa.0_2"/>
<dependency name="EvenOther" version="1.0.0"/>
diff --git a/src/libs/utils/basevalidatinglineedit.cpp b/src/libs/utils/basevalidatinglineedit.cpp
index c70aa59e1f..255c9e6a34 100644
--- a/src/libs/utils/basevalidatinglineedit.cpp
+++ b/src/libs/utils/basevalidatinglineedit.cpp
@@ -138,8 +138,10 @@ void BaseValidatingLineEdit::slotChanged(const QString &t)
m_bd->m_state = newState;
m_bd->m_firstChange = false;
setTextColor(this, newState == Invalid ? m_bd->m_errorTextColor : m_bd->m_okTextColor);
- if (validHasChanged)
+ if (validHasChanged) {
+ emit validChanged(newState == Valid);
emit validChanged();
+ }
}
}
diff --git a/src/libs/utils/basevalidatinglineedit.h b/src/libs/utils/basevalidatinglineedit.h
index 77031bbd96..5773d4f745 100644
--- a/src/libs/utils/basevalidatinglineedit.h
+++ b/src/libs/utils/basevalidatinglineedit.h
@@ -81,6 +81,7 @@ public:
signals:
void validChanged();
+ void validChanged(bool validState);
void validReturnPressed();
protected:
diff --git a/src/libs/utils/newclasswidget.cpp b/src/libs/utils/newclasswidget.cpp
index 42265a062e..b3378281a9 100644
--- a/src/libs/utils/newclasswidget.cpp
+++ b/src/libs/utils/newclasswidget.cpp
@@ -57,6 +57,7 @@ struct NewClassWidgetPrivate {
bool m_baseClassInputVisible;
bool m_formInputVisible;
bool m_pathInputVisible;
+ bool m_qobjectCheckBoxVisible;
bool m_formInputCheckable;
};
@@ -69,7 +70,9 @@ NewClassWidgetPrivate:: NewClassWidgetPrivate() :
m_baseClassInputVisible(true),
m_formInputVisible(true),
m_pathInputVisible(true),
+ m_qobjectCheckBoxVisible(false),
m_formInputCheckable(false)
+
{
}
@@ -169,6 +172,17 @@ void NewClassWidget::setBaseClassInputVisible(bool visible)
m_d->m_ui.baseClassComboBox->setVisible(visible);
}
+void NewClassWidget::setQObjectCheckBoxVisible(bool visible)
+{
+ m_d->m_qobjectCheckBoxVisible = visible;
+ m_d->m_ui.qobjectCheckBox->setVisible(visible);
+}
+
+bool NewClassWidget::isQObjectCheckBoxVisible() const
+{
+ return m_d->m_qobjectCheckBoxVisible;
+}
+
void NewClassWidget::setBaseClassEditable(bool editable)
{
m_d->m_ui.baseClassComboBox->setEditable(editable);
@@ -356,6 +370,16 @@ void NewClassWidget::setAllowDirectories(bool v)
}
}
+bool NewClassWidget::inheritsQObject() const
+{
+ return m_d->m_ui.qobjectCheckBox->isChecked();
+}
+
+void NewClassWidget::setInheritsQObject(bool v)
+{
+ m_d->m_ui.qobjectCheckBox->setChecked(v);
+}
+
bool NewClassWidget::lowerCaseFiles() const
{
return m_d->m_ui.classLineEdit->lowerCaseFileName();
diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h
index 52d03720a8..1a43877761 100644
--- a/src/libs/utils/newclasswidget.h
+++ b/src/libs/utils/newclasswidget.h
@@ -57,6 +57,7 @@ class QTCREATOR_UTILS_EXPORT NewClassWidget : public QWidget
Q_PROPERTY(bool baseClassEditable READ isBaseClassEditable WRITE setBaseClassEditable DESIGNABLE false)
Q_PROPERTY(bool formInputVisible READ isFormInputVisible WRITE setFormInputVisible DESIGNABLE true)
Q_PROPERTY(bool pathInputVisible READ isPathInputVisible WRITE setPathInputVisible DESIGNABLE true)
+ Q_PROPERTY(bool qobjectCheckBoxVisible READ isQObjectCheckBoxVisible WRITE setQObjectCheckBoxVisible DESIGNABLE true)
Q_PROPERTY(QString className READ className WRITE setClassName DESIGNABLE true)
Q_PROPERTY(QString baseClassName READ baseClassName WRITE setBaseClassName DESIGNABLE true)
Q_PROPERTY(QString sourceFileName READ sourceFileName DESIGNABLE false)
@@ -70,6 +71,7 @@ class QTCREATOR_UTILS_EXPORT NewClassWidget : public QWidget
Q_PROPERTY(bool formInputCheckable READ formInputCheckable WRITE setFormInputCheckable DESIGNABLE true)
Q_PROPERTY(bool formInputChecked READ formInputChecked WRITE setFormInputChecked DESIGNABLE true)
Q_PROPERTY(bool allowDirectories READ allowDirectories WRITE setAllowDirectories)
+ Q_PROPERTY(bool inheritsQObject READ inheritsQObject WRITE setInheritsQObject)
Q_PROPERTY(bool lowerCaseFiles READ lowerCaseFiles WRITE setLowerCaseFiles)
// Utility "USER" property for wizards containing file names.
Q_PROPERTY(QStringList files READ files DESIGNABLE false USER true)
@@ -82,6 +84,7 @@ public:
bool isBaseClassEditable() const;
bool isFormInputVisible() const;
bool isPathInputVisible() const;
+ bool isQObjectCheckBoxVisible() const;
bool formInputCheckable() const;
bool formInputChecked() const;
@@ -95,6 +98,7 @@ public:
QString sourceExtension() const;
QString headerExtension() const;
QString formExtension() const;
+ bool inheritsQObject() const;
bool allowDirectories() const;
bool lowerCaseFiles() const;
@@ -114,6 +118,7 @@ public slots:
void setPathInputVisible(bool visible);
void setFormInputCheckable(bool v);
void setFormInputChecked(bool v);
+ void setQObjectCheckBoxVisible(bool v);
/**
* The name passed into the new class widget will be reformatted to be a
@@ -126,6 +131,7 @@ public slots:
void setSourceExtension(const QString &e);
void setHeaderExtension(const QString &e);
void setFormExtension(const QString &e);
+ void setInheritsQObject(bool v);
void setAllowDirectories(bool v);
void setLowerCaseFiles(bool v);
diff --git a/src/libs/utils/newclasswidget.ui b/src/libs/utils/newclasswidget.ui
index 76a093a76f..bb2e465cc0 100644
--- a/src/libs/utils/newclasswidget.ui
+++ b/src/libs/utils/newclasswidget.ui
@@ -2,6 +2,14 @@
<ui version="4.0">
<class>Utils::NewClassWidget</class>
<widget class="QWidget" name="Utils::NewClassWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>213</width>
+ <height>190</height>
+ </rect>
+ </property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
@@ -36,7 +44,7 @@
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -52,7 +60,7 @@
</property>
</spacer>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -68,60 +76,67 @@
</property>
</spacer>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="headerLabel">
<property name="text">
<string>Header file:</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Source file:</string>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="generateFormLabel">
<property name="text">
<string>Generate form:</string>
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="7" column="0">
<widget class="QLabel" name="formLabel">
<property name="text">
<string>Form file:</string>
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="7" column="1">
<widget class="Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/>
</item>
- <item row="7" column="0">
+ <item row="8" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="8" column="1">
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
</item>
- <item row="5" column="1">
+ <item row="6" column="1">
<widget class="QCheckBox" name="generateFormCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="qobjectCheckBox">
+ <property name="text">
+ <string>Inherits QObject</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index c550ecbc39..76e4247931 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -108,6 +108,7 @@ PathChooser::PathChooser(QWidget *parent) :
connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString)));
connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
+ connect(m_d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool)));
connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
m_d->m_lineEdit->setMinimumWidth(200);
diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h
index ee3e6eaf40..d974e90d03 100644
--- a/src/libs/utils/pathchooser.h
+++ b/src/libs/utils/pathchooser.h
@@ -99,6 +99,7 @@ private:
signals:
void validChanged();
+ void validChanged(bool validState);
void changed(const QString &text);
void editingFinished();
void beforeBrowsing();
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
index 0939a1c43f..f9526756e7 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
@@ -435,9 +435,10 @@ void CMakeRunPage::runCMake()
m_output->clear();
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
- m_cmakeProcess = cmakeManager->createXmlFile(arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
+ m_cmakeProcess = new QProcess();
connect(m_cmakeProcess, SIGNAL(readyRead()), this, SLOT(cmakeReadyRead()));
connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished()));
+ cmakeManager->createXmlFile(m_cmakeProcess, arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
} else {
m_runCMake->setEnabled(true);
m_argumentsLineEdit->setEnabled(true);
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index fbab5af5d8..d0b683c8b3 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -99,7 +99,7 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
// we probably want the process instead of this function
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
// sounds like a plan
-QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory, const ProjectExplorer::Environment &env, const QString &generator)
+void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory, const ProjectExplorer::Environment &env, const QString &generator)
{
// We create a cbp file, only if we didn't find a cbp file in the base directory
// Yet that can still override cbp files in subdirectories
@@ -111,14 +111,12 @@ QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QStrin
// TODO we need to pass on the same paremeters as the cmakestep
QString buildDirectoryPath = buildDirectory.absolutePath();
buildDirectory.mkpath(buildDirectoryPath);
- QProcess *cmake = new QProcess;
- cmake->setWorkingDirectory(buildDirectoryPath);
- cmake->setProcessChannelMode(QProcess::MergedChannels);
- cmake->setEnvironment(env.toStringList());
+ proc->setWorkingDirectory(buildDirectoryPath);
+ proc->setProcessChannelMode(QProcess::MergedChannels);
+ proc->setEnvironment(env.toStringList());
const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ? QString(QLatin1Char('.')) : sourceDirectory;
- cmake->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
- return cmake;
+ proc->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
}
QString CMakeManager::findCbpFile(const QDir &directory)
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
index a33055235a..2c8a3ee3fc 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
@@ -63,11 +63,12 @@ public:
void setCMakeExecutable(const QString &executable);
- QProcess* createXmlFile(const QStringList &arguments,
- const QString &sourceDirectory,
- const QDir &buildDirectory,
- const ProjectExplorer::Environment &env,
- const QString &generator);
+ void createXmlFile(QProcess *process,
+ const QStringList &arguments,
+ const QString &sourceDirectory,
+ const QDir &buildDirectory,
+ const ProjectExplorer::Environment &env,
+ const QString &generator);
bool hasCodeBlocksMsvcGenerator() const;
static QString findCbpFile(const QDir &);
diff --git a/src/plugins/coreplugin/messagemanager.cpp b/src/plugins/coreplugin/messagemanager.cpp
index 6252d119d4..7ff9cee01c 100644
--- a/src/plugins/coreplugin/messagemanager.cpp
+++ b/src/plugins/coreplugin/messagemanager.cpp
@@ -82,3 +82,14 @@ void MessageManager::printToOutputPane(const QString &text, bool bringToForegrou
m_messageOutputWindow->popup(false);
m_messageOutputWindow->append(text);
}
+
+void MessageManager::printToOutputPanePopup(const QString &text)
+{
+ printToOutputPane(text, true);
+}
+
+void MessageManager::printToOutputPane(const QString &text)
+{
+ printToOutputPane(text, false);
+}
+
diff --git a/src/plugins/coreplugin/messagemanager.h b/src/plugins/coreplugin/messagemanager.h
index 664269cda6..4191145cd8 100644
--- a/src/plugins/coreplugin/messagemanager.h
+++ b/src/plugins/coreplugin/messagemanager.h
@@ -55,7 +55,9 @@ public:
void showOutputPane();
public slots:
- void printToOutputPane(const QString &text, bool bringToForeground = true);
+ void printToOutputPane(const QString &text, bool bringToForeground);
+ void printToOutputPanePopup(const QString &text); // pops up
+ void printToOutputPane(const QString &text);
private:
Internal::MessageOutputWindow *m_messageOutputWindow;
diff --git a/src/plugins/cpaster/pastebindotcomsettings.cpp b/src/plugins/cpaster/pastebindotcomsettings.cpp
index 6205facfdb..3823524c0b 100644
--- a/src/plugins/cpaster/pastebindotcomsettings.cpp
+++ b/src/plugins/cpaster/pastebindotcomsettings.cpp
@@ -65,11 +65,11 @@ QString PasteBinDotComSettings::trCategory() const
QWidget *PasteBinDotComSettings::createPage(QWidget *parent)
{
- Ui_PasteBinComSettingsWidget* ui = new Ui_PasteBinComSettingsWidget;
+ Ui_PasteBinComSettingsWidget ui;
QWidget *w = new QWidget(parent);
- ui->setupUi(w);
- ui->lineEdit->setText(hostPrefix());
- connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(serverChanged(QString)));
+ ui.setupUi(w);
+ ui.lineEdit->setText(hostPrefix());
+ connect(ui.lineEdit, SIGNAL(textChanged(QString)), this, SLOT(serverChanged(QString)));
return w;
}
diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp
index 1c994c6ebc..02ce50a5e1 100644
--- a/src/plugins/cppeditor/cppclasswizard.cpp
+++ b/src/plugins/cppeditor/cppclasswizard.cpp
@@ -74,6 +74,7 @@ ClassNamePage::ClassNamePage(QWidget *parent) :
m_newClassWidget->setFormInputVisible(false);
m_newClassWidget->setNamespacesEnabled(true);
m_newClassWidget->setAllowDirectories(true);
+ m_newClassWidget->setBaseClassInputVisible(true);
connect(m_newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
@@ -154,6 +155,7 @@ CppClassWizardParameters CppClassWizardDialog::parameters() const
rc.sourceFile = ncw->sourceFileName();
rc.baseClass = ncw->baseClassName();
rc.path = ncw->path();
+ rc.inheritsQObject = ncw->inheritsQObject();
return rc;
}
@@ -253,6 +255,8 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par
else
headerStr << "\n";
headerStr << namespaceIndent << "{\n";
+ if (params.inheritsQObject)
+ headerStr << namespaceIndent << "Q_OBJECT\n";
headerStr << namespaceIndent << "public:\n"
<< namespaceIndent << indent << unqualifiedClassName << "();\n";
headerStr << namespaceIndent << "};\n";
diff --git a/src/plugins/cppeditor/cppclasswizard.h b/src/plugins/cppeditor/cppclasswizard.h
index 1bc26d1b56..0d2f2ae11f 100644
--- a/src/plugins/cppeditor/cppclasswizard.h
+++ b/src/plugins/cppeditor/cppclasswizard.h
@@ -74,6 +74,7 @@ struct CppClassWizardParameters
QString sourceFile;
QString baseClass;
QString path;
+ bool inheritsQObject;
};
class CppClassWizardDialog : public QWizard
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index 508eec2854..ff671da25a 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -337,7 +337,8 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
firstType = resolve(firstType, typeOfExpression.lookupContext(),
&resolvedSymbol, &resolvedName);
- if (resolvedSymbol && resolvedSymbol->scope()->isClassScope()) {
+ if (resolvedSymbol && resolvedSymbol->scope()
+ && resolvedSymbol->scope()->isClassScope()) {
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
if (Identifier *id = enclosingClass->identifier()) {
if (id->isEqualTo(resolvedSymbol->identifier()))
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp
index edaafcc890..5cea0c14c9 100644
--- a/src/plugins/cpptools/cppcodecompletion.cpp
+++ b/src/plugins/cpptools/cppcodecompletion.cpp
@@ -510,8 +510,11 @@ void CppQuickFixCollector::cleanup()
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
: ICompletionCollector(manager),
m_manager(manager),
+ m_editor(0),
+ m_startPosition(-1),
m_caseSensitivity(Qt::CaseSensitive),
m_autoInsertBrackets(true),
+ m_partialCompletionEnabled(true),
m_forcedCompletion(false),
m_completionOperator(T_EOF_SYMBOL),
m_objcEnabled(true)
diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h
index 56cf85150e..7f710d0e32 100644
--- a/src/plugins/cpptools/cppcodecompletion.h
+++ b/src/plugins/cpptools/cppcodecompletion.h
@@ -149,28 +149,26 @@ private:
int findStartOfName(int pos = -1) const;
- QList<TextEditor::CompletionItem> m_completions;
+private:
+ bool objcKeywordsWanted() const;
+ CppModelManager *m_manager;
TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started
- CppModelManager *m_manager;
Qt::CaseSensitivity m_caseSensitivity;
bool m_autoInsertBrackets;
bool m_partialCompletionEnabled;
-
bool m_forcedCompletion;
+ unsigned m_completionOperator;
+ bool m_objcEnabled;
CPlusPlus::Icons m_icons;
CPlusPlus::Overview overview;
CPlusPlus::TypeOfExpression typeOfExpression;
-
- unsigned m_completionOperator;
-
QPointer<FunctionArgumentWidget> m_functionArgumentWidget;
- bool objcKeywordsWanted() const;
- bool m_objcEnabled;
+ QList<TextEditor::CompletionItem> m_completions;
};
} // namespace Internal
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index db9e984b1a..90811aad5a 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -165,7 +165,8 @@ class CheckDocument: protected ASTVisitor
public:
CheckDocument(Document::Ptr doc, Snapshot snapshot)
- : ASTVisitor(doc->control()), _doc(doc), _snapshot(snapshot)
+ : ASTVisitor(doc->control()), _doc(doc), _snapshot(snapshot),
+ _line(0), _column(0)
{ }
QList<QuickFixOperationPtr> operator()(QTextCursor tc)
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.h b/src/plugins/cpptools/cpptoolseditorsupport.h
index d788ebbb28..86f5867493 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.h
+++ b/src/plugins/cpptools/cpptoolseditorsupport.h
@@ -89,7 +89,6 @@ protected:
QTextCursor moveAtEndOfToken(unsigned index) const;
private:
- CPlusPlus::AST *_node;
CPlusPlus::Document::Ptr _doc;
CPlusPlus::Snapshot _snapshot;
QTextCursor _textCursor;
diff --git a/src/plugins/cpptools/searchsymbols.h b/src/plugins/cpptools/searchsymbols.h
index 10ceeae373..69df0bdc67 100644
--- a/src/plugins/cpptools/searchsymbols.h
+++ b/src/plugins/cpptools/searchsymbols.h
@@ -51,6 +51,8 @@ struct ModelItemInfo
enum ItemType { Enum, Class, Method, Declaration };
ModelItemInfo()
+ : type(Declaration),
+ line(0)
{ }
ModelItemInfo(const QString &symbolName,
diff --git a/src/plugins/debugger/cdb/cdb.pri b/src/plugins/debugger/cdb/cdb.pri
index ca08a11bb6..34a89b7042 100644
--- a/src/plugins/debugger/cdb/cdb.pri
+++ b/src/plugins/debugger/cdb/cdb.pri
@@ -5,7 +5,7 @@ win32 {
contains(QMAKE_CXX, cl) {
CDB_PATH=$$(CDB_PATH)
-isEmpty($$CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk"
+isEmpty(CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk"
!exists($$CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x86)/sdk"
!exists($$CDB_PATH):CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x64)/sdk"
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index f4b4ed0385..48d2f418a9 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -216,6 +216,7 @@ static const char *stateName(int s)
DebuggerStartParameters::DebuggerStartParameters()
: attachPID(-1),
useTerminal(false),
+ remoteChannelType(-1),
toolChainType(ProjectExplorer::ToolChain::UNKNOWN),
startMode(NoStartMode)
{}
diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h
index 7272584754..ff40707d7d 100644
--- a/src/plugins/debugger/debuggermanager.h
+++ b/src/plugins/debugger/debuggermanager.h
@@ -113,6 +113,7 @@ public:
QString crashParameter; // for AttachCrashedExternal
// for remote debugging
QString remoteChannel;
+ int remoteChannelType;
QString remoteArchitecture;
QString symbolFileName;
QString serverStartScript;
diff --git a/src/plugins/debugger/gdb/gdb.pri b/src/plugins/debugger/gdb/gdb.pri
index e7763cecb6..19f453ba7d 100644
--- a/src/plugins/debugger/gdb/gdb.pri
+++ b/src/plugins/debugger/gdb/gdb.pri
@@ -19,6 +19,7 @@ HEADERS += \
$$PWD/termgdbadapter.h \
$$PWD/remotegdbadapter.h \
$$PWD/trkgdbadapter.h \
+ $$PWD/s60debuggerbluetoothstarter.h
SOURCES += \
$$PWD/gdbmi.cpp \
@@ -34,6 +35,7 @@ SOURCES += \
$$PWD/termgdbadapter.cpp \
$$PWD/remotegdbadapter.cpp \
$$PWD/trkgdbadapter.cpp \
+ $$PWD/s60debuggerbluetoothstarter.cpp
FORMS += $$PWD/gdboptionspage.ui \
$$PWD/trkoptionswidget.ui
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index c1881fb298..a0ac59ca73 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -225,7 +225,9 @@ QMainWindow *GdbEngine::mainWindow() const
GdbEngine::~GdbEngine()
{
// prevent sending error messages afterwards
+ disconnect(&m_gdbProc);
delete m_gdbAdapter;
+ m_gdbAdapter = 0;
}
void GdbEngine::connectAdapter()
@@ -250,13 +252,15 @@ void GdbEngine::initializeVariables()
m_debuggingHelperState = DebuggingHelperUninitialized;
m_gdbVersion = 100;
m_gdbBuildVersion = -1;
+ m_isMacGdb = false;
m_isSynchroneous = false;
m_fullToShortName.clear();
m_shortToFullName.clear();
m_varToType.clear();
- m_modulesListOutdated = true;
+ m_modulesListOutdated = m_sourcesListOutdated = true;
+ m_sourcesListUpdating = false;
m_oldestAcceptableToken = -1;
m_outputCodec = QTextCodec::codecForLocale();
m_pendingRequests = 0;
@@ -416,12 +420,14 @@ void GdbEngine::handleResponse(const QByteArray &buff)
QByteArray id = result.findChild("id").data();
if (!id.isEmpty())
showStatusMessage(tr("Library %1 loaded.").arg(_(id)));
+ m_modulesListOutdated = m_sourcesListOutdated = true;
} else if (asyncClass == "library-unloaded") {
// Archer has 'id="/usr/lib/libdrm.so.2",
// target-name="/usr/lib/libdrm.so.2",
// host-name="/usr/lib/libdrm.so.2"
QByteArray id = result.findChild("id").data();
showStatusMessage(tr("Library %1 unloaded.").arg(_(id)));
+ m_modulesListOutdated = m_sourcesListOutdated = true;
} else if (asyncClass == "thread-group-created") {
// Archer has "{id="28902"}"
QByteArray id = result.findChild("id").data();
@@ -450,6 +456,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
#if defined(Q_OS_MAC)
} else if (asyncClass == "shlibs-updated") {
// MAC announces updated libs
+ m_modulesListOutdated = m_sourcesListOutdated = true;
} else if (asyncClass == "shlibs-added") {
// MAC announces added libs
// {shlib-info={num="2", name="libmathCommon.A_debug.dylib",
@@ -457,6 +464,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
// state="Y", path="/usr/lib/system/libmathCommon.A_debug.dylib",
// description="/usr/lib/system/libmathCommon.A_debug.dylib",
// loaded_addr="0x7f000", slide="0x7f000", prefix=""}}
+ m_modulesListOutdated = m_sourcesListOutdated = true;
#endif
} else {
qDebug() << "IGNORED ASYNC OUTPUT"
@@ -488,12 +496,14 @@ void GdbEngine::handleResponse(const QByteArray &buff)
}
// Show some messages to give the impression something happens.
- if (data.startsWith("Reading symbols from "))
+ if (data.startsWith("Reading symbols from ")) {
showStatusMessage(tr("Reading %1...").arg(_(data.mid(21))), 1000);
- if (data.endsWith('\n'))
- data.chop(1);
- if (data.startsWith("[New ") || data.startsWith("[Thread "))
+ m_modulesListOutdated = m_sourcesListOutdated = true;
+ } else if (data.startsWith("[New ") || data.startsWith("[Thread ")) {
+ if (data.endsWith('\n'))
+ data.chop(1);
showStatusMessage(_(data), 1000);
+ }
break;
}
@@ -561,7 +571,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
m_pendingLogStreamOutput.clear();
m_pendingConsoleStreamOutput.clear();
- handleResultRecord(response);
+ handleResultRecord(&response);
break;
}
default: {
@@ -608,18 +618,12 @@ void GdbEngine::readGdbStandardOutput()
void GdbEngine::interruptInferior()
{
- QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
-
- if (state() == DebuggerNotReady) {
- debugMessage(_("TRYING TO INTERRUPT INFERIOR WITHOUT RUNNING GDB"));
- shutdown();
- return;
- }
+ QTC_ASSERT(state() == InferiorRunning, qDebug() << state(); return);
setState(InferiorStopping);
showStatusMessage(tr("Stop requested..."), 5000);
- debugMessage(_("TRYING TO INTERUPT INFERIOR"));
+ debugMessage(_("TRYING TO INTERRUPT INFERIOR"));
m_gdbAdapter->interruptInferior();
}
@@ -695,17 +699,19 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
<< "LEAVES PENDING AT:" << m_pendingRequests << cmd.command);
}
- if (cmd.flags & NeedsStop) {
+ if ((cmd.flags & NeedsStop) || !m_commandsToRunOnTemporaryBreak.isEmpty()) {
if (state() == InferiorStopped
|| state() == InferiorStarting || state() == AdapterStarted) {
// Can be safely sent now.
flushCommand(cmd);
} else {
// Queue the commands that we cannot send at once.
- showStatusMessage(tr("Stopping temporarily."), 1000);
debugMessage(_("QUEUING COMMAND ") + cmd.command);
m_commandsToRunOnTemporaryBreak.append(cmd);
- interruptInferior();
+ if (state() != InferiorStopping) {
+ showStatusMessage(tr("Stopping temporarily."), 1000);
+ interruptInferior(); // FIXME: race condition between gdb and kill()
+ }
}
} else if (!cmd.command.isEmpty()) {
flushCommand(cmd);
@@ -732,13 +738,13 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
m_gdbAdapter->write(cmd.command.toLatin1() + "\r\n");
}
-void GdbEngine::handleResultRecord(const GdbResponse &response)
+void GdbEngine::handleResultRecord(GdbResponse *response)
{
//qDebug() << "TOKEN:" << response.token
// << " ACCEPTABLE:" << m_oldestAcceptableToken;
//qDebug() << "\nRESULT" << response.token << response.toString();
- int token = response.token;
+ int token = response->token;
if (token == -1)
return;
@@ -749,8 +755,8 @@ void GdbEngine::handleResultRecord(const GdbResponse &response)
// Ideally, this code should not be present at all.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token));
- if (response.resultClass == GdbResultError) {
- QByteArray msg = response.data.findChild("msg").data();
+ if (response->resultClass == GdbResultError) {
+ QByteArray msg = response->data.findChild("msg").data();
if (msg == "Cannot find new threads: generic error") {
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with
@@ -787,26 +793,25 @@ void GdbEngine::handleResultRecord(const GdbResponse &response)
.arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.));
}
- if (response.token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
+ if (response->token < m_oldestAcceptableToken && (cmd.flags & Discardable)) {
//debugMessage(_("### SKIPPING OLD RESULT") + response.toString());
return;
}
- GdbResponse responseWithCookie = response;
- responseWithCookie.cookie = cmd.cookie;
+ response->cookie = cmd.cookie;
- if (response.resultClass != GdbResultError &&
- response.resultClass != ((cmd.flags & RunRequest) ? GdbResultRunning :
- (cmd.flags & ExitRequest) ? GdbResultExit :
- GdbResultDone)) {
- QString rsp = _(GdbResponse::stringFromResultClass(response.resultClass));
+ if (response->resultClass != GdbResultError &&
+ response->resultClass != ((cmd.flags & RunRequest) ? GdbResultRunning :
+ (cmd.flags & ExitRequest) ? GdbResultExit :
+ GdbResultDone)) {
+ QString rsp = _(GdbResponse::stringFromResultClass(response->resultClass));
qWarning() << "UNEXPECTED RESPONSE " << rsp << " TO COMMAND" << cmd.command << " AT " __FILE__ ":" STRINGIFY(__LINE__);
debugMessage(_("UNEXPECTED RESPONSE %1 TO COMMAND %2").arg(rsp).arg(cmd.command));
} else {
if (cmd.callback)
- (this->*cmd.callback)(responseWithCookie);
+ (this->*cmd.callback)(*response);
else if (cmd.adapterCallback)
- (m_gdbAdapter->*cmd.adapterCallback)(responseWithCookie);
+ (m_gdbAdapter->*cmd.adapterCallback)(*response);
}
if (cmd.flags & RebuildModel) {
@@ -864,6 +869,7 @@ void GdbEngine::updateAll()
void GdbEngine::handleQuerySources(const GdbResponse &response)
{
+ m_sourcesListUpdating = false;
if (response.resultClass == GdbResultDone) {
QMap<QString, QString> oldShortToFull = m_shortToFullName;
m_shortToFullName.clear();
@@ -874,13 +880,15 @@ void GdbEngine::handleQuerySources(const GdbResponse &response)
foreach (const GdbMi &item, files.children()) {
QString fileName = QString::fromLocal8Bit(item.findChild("file").data());
GdbMi fullName = item.findChild("fullname");
- QString full = QString::fromLocal8Bit(fullName.data());
- #ifdef Q_OS_WIN
- full = QDir::cleanPath(full);
- #endif
- if (fullName.isValid() && QFileInfo(full).isReadable()) {
- m_shortToFullName[fileName] = full;
- m_fullToShortName[full] = fileName;
+ if (fullName.isValid()) {
+ QString full = QString::fromLocal8Bit(fullName.data());
+ if (QFileInfo(full).isReadable()) {
+ #ifdef Q_OS_WIN
+ full = QDir::cleanPath(full);
+ #endif
+ m_shortToFullName[fileName] = full;
+ m_fullToShortName[full] = fileName;
+ }
}
}
if (m_shortToFullName != oldShortToFull)
@@ -939,21 +947,6 @@ static bool isExitedReason(const QByteArray &reason)
|| reason == "exited"; // inferior exited
}
-static bool isStoppedReason(const QByteArray &reason)
-{
- return reason == "function-finished" // -exec-finish
- || reason == "signal-received" // handled as "isExitedReason"
- || reason == "breakpoint-hit" // -exec-continue
- || reason == "end-stepping-range" // -exec-next, -exec-step
- || reason == "location-reached" // -exec-until
- || reason == "access-watchpoint-trigger"
- || reason == "read-watchpoint-trigger"
- #ifdef Q_OS_MAC
- || reason.isEmpty()
- #endif
- ;
-}
-
#if 0
void GdbEngine::handleAqcuiredInferior()
{
@@ -1054,8 +1047,28 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
}
setState(InferiorStopped);
+#ifdef Q_OS_LINUX
+ // For some reason, attaching to a stopped process causes *two* stops
+ // when trying to continue (kernel 2.6.24-23-ubuntu).
+ // Interestingly enough, on MacOSX no signal is delivered at all.
+ if (reason == "signal-received"
+ && data.findChild("signal-name").data() == "SIGSTOP") {
+ GdbMi frameData = data.findChild("frame");
+ if (frameData.findChild("func").data() == "_start"
+ && frameData.findChild("from").data() == "/lib/ld-linux.so.2") {
+ continueInferiorInternal();
+ return;
+ }
+ }
+#endif
+
+#if 0
+ // The related code (handleAqcuiredInferior()) is disabled as well.
+ // When re-enabling, try something to avoid spurious source list updates
+ // due to unrelated no-reason stops.
const QByteArray &msg = data.findChild("consolestreamoutput").data();
if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
+ m_modulesListOutdated = m_sourcesListOutdated = true;
if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) {
QString dataStr = _(data.toString());
debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
@@ -1066,9 +1079,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
showStatusMessage(tr("Loading %1...").arg(dataStr));
return;
}
- m_modulesListOutdated = true;
// fall through
}
+#endif
// seen on XP after removing a breakpoint while running
// >945*stopped,reason="signal-received",signal-name="SIGTRAP",
@@ -1087,9 +1100,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
if (reason == "end-stepping-range" || reason == "function-finished") {
GdbMi frame = data.findChild("frame");
//debugMessage(frame.toString());
- m_currentFrame = _(frame.findChild("addr").data() + '%' +
- frame.findChild("func").data() + '%');
-
QString funcName = _(frame.findChild("func").data());
QString fileName = QString::fromLocal8Bit(frame.findChild("file").data());
if (isLeavableFunction(funcName, fileName)) {
@@ -1111,47 +1121,24 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
}
}
- if (isStoppedReason(reason) || reason.isEmpty()) {
- if (initHelpers && m_debuggingHelperState != DebuggingHelperUninitialized)
+ if (initHelpers && m_debuggingHelperState != DebuggingHelperUninitialized)
+ initHelpers = false;
+ // Don't load helpers on stops triggered by signals unless it's
+ // an intentional trap.
+ if (initHelpers && reason == "signal-received") {
+ QByteArray name = data.findChild("signal-name").data();
+ if (name != STOP_SIGNAL
+ && (startParameters().startMode != StartRemote
+ || name != CROSS_STOP_SIGNAL))
initHelpers = false;
- // Don't load helpers on stops triggered by signals unless it's
- // an intentional trap.
- if (initHelpers && reason == "signal-received") {
- QByteArray name = data.findChild("signal-name").data();
- if (name != STOP_SIGNAL
- && (startParameters().startMode != StartRemote
- || name != CROSS_STOP_SIGNAL))
- initHelpers = false;
- }
-
- if (initHelpers) {
- tryLoadDebuggingHelpers();
- QVariant var = QVariant::fromValue<GdbMi>(data);
- postCommand(_("p 4"), CB(handleStop1), var); // dummy
- } else {
- handleStop1(data);
- }
- return;
}
-
- debugMessage(_("STOPPED FOR UNKNOWN REASON: " + data.toString()));
- // Ignore it. Will be handled with full response later in the
- // JumpToLine or RunToFunction handlers
-#if 1
- // FIXME: remove this special case as soon as there's a real
- // reason given when the temporary breakpoint is hit.
- // right now we get:
- // 14*stopped,thread-id="1",frame={addr="0x0000000000403ce4",
- // func="foo",args=[{name="str",value="@0x7fff0f450460"}],
- // file="main.cpp",fullname="/tmp/g/main.cpp",line="37"}
- //
- // MAC yields sometimes:
- // >3661*stopped,time={wallclock="0.00658",user="0.00142",
- // system="0.00136",start="1218810678.805432",end="1218810678.812011"}
- showStatusMessage(tr("Run to Function finished. Stopped."));
- StackFrame f = parseStackFrame(data.findChild("frame"), 0);
- gotoLocation(f, true);
-#endif
+ if (initHelpers) {
+ tryLoadDebuggingHelpers();
+ QVariant var = QVariant::fromValue<GdbMi>(data);
+ postCommand(_("p 4"), CB(handleStop1), var); // dummy
+ } else {
+ handleStop1(data);
+ }
}
void GdbEngine::handleStop1(const GdbResponse &response)
@@ -1161,39 +1148,18 @@ void GdbEngine::handleStop1(const GdbResponse &response)
void GdbEngine::handleStop1(const GdbMi &data)
{
+ if (m_modulesListOutdated)
+ reloadModules(); // This is for display only
+ if (m_sourcesListOutdated)
+ reloadSourceFiles(); // This needs to be done before fullName() may need it
QByteArray reason = data.findChild("reason").data();
- if (m_modulesListOutdated) {
- reloadModules();
- m_modulesListOutdated = false;
- }
- // Need another round trip
if (reason == "breakpoint-hit") {
showStatusMessage(tr("Stopped at breakpoint."));
- GdbMi frame = data.findChild("frame");
//debugMessage(_("HIT BREAKPOINT: " + frame.toString()));
- m_currentFrame = _(frame.findChild("addr").data() + '%' +
- frame.findChild("func").data() + '%');
-
- if (theDebuggerAction(ListSourceFiles)->value().toBool())
- reloadSourceFiles();
postCommand(_("-break-list"), CB(handleBreakList));
QVariant var = QVariant::fromValue<GdbMi>(data);
postCommand(_("p 2"), CB(handleStop2), var); // dummy
} else {
-#ifdef Q_OS_LINUX
- // For some reason, attaching to a stopped process causes *two* stops
- // when trying to continue (kernel 2.6.24-23-ubuntu).
- // Interestingly enough, on MacOSX no signal is delivered at all.
- if (reason == "signal-received"
- && data.findChild("signal-name").data() == "SIGSTOP") {
- GdbMi frameData = data.findChild("frame");
- if (frameData.findChild("func").data() == "_start"
- && frameData.findChild("from").data() == "/lib/ld-linux.so.2") {
- continueInferiorInternal();
- return;
- }
- }
-#endif
if (reason == "signal-received"
&& theDebuggerBoolSetting(UseMessageBoxForSignals)) {
QByteArray name = data.findChild("signal-name").data();
@@ -1229,18 +1195,10 @@ void GdbEngine::handleStop2(const GdbResponse &response)
void GdbEngine::handleStop2(const GdbMi &data)
{
- // Sometimes we get some interesting extra information. Grab it.
const GdbMi gdbmiFrame = data.findChild("frame");
- GdbMi shortName = gdbmiFrame.findChild("file");
- GdbMi fullName = gdbmiFrame.findChild("fullname");
- if (shortName.isValid() && fullName.isValid()) {
- QString file = QFile::decodeName(shortName.data());
- QString full = QFile::decodeName(fullName.data());
- if (file != full) {
- m_shortToFullName[file] = full;
- m_fullToShortName[full] = file;
- }
- }
+
+ m_currentFrame = _(gdbmiFrame.findChild("addr").data() + '%' +
+ gdbmiFrame.findChild("func").data() + '%');
// Quick shot: Jump to stack frame #0.
StackFrame frame;
@@ -1277,10 +1235,12 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
if (response.resultClass == GdbResultDone) {
m_gdbVersion = 100;
m_gdbBuildVersion = -1;
+ m_isMacGdb = false;
QString msg = QString::fromLocal8Bit(response.data.findChild("consolestreamoutput").data());
QRegExp supported(_("GNU gdb(.*) (\\d+)\\.(\\d+)(\\.(\\d+))?(-(\\d+))?"));
if (supported.indexIn(msg) == -1) {
debugMessage(_("UNSUPPORTED GDB VERSION ") + msg);
+#if 0
QStringList list = msg.split(_c('\n'));
while (list.size() > 2)
list.removeLast();
@@ -1297,13 +1257,15 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
#else
//showMessageBox(QMessageBox::Information, tr("Warning"), msg);
#endif
+#endif
} else {
m_gdbVersion = 10000 * supported.cap(2).toInt()
+ 100 * supported.cap(3).toInt()
+ 1 * supported.cap(5).toInt();
m_gdbBuildVersion = supported.cap(7).toInt();
- debugMessage(_("GDB VERSION: %1, BUILD: %2 ").arg(m_gdbVersion)
- .arg(m_gdbBuildVersion));
+ m_isMacGdb = msg.contains(__("Apple version"));
+ debugMessage(_("GDB VERSION: %1, BUILD: %2%3").arg(m_gdbVersion)
+ .arg(m_gdbBuildVersion).arg(_(m_isMacGdb ? " (APPLE)" : "")));
}
//qDebug () << "VERSION 3:" << m_gdbVersion << m_gdbBuildVersion;
}
@@ -1345,6 +1307,8 @@ QString GdbEngine::fullName(const QString &fileName)
{
if (fileName.isEmpty())
return QString();
+ QTC_ASSERT(!m_sourcesListOutdated, /* */)
+ QTC_ASSERT(!m_sourcesListUpdating, /* */)
QString full = m_shortToFullName.value(fileName, QString());
//debugMessage(_("RESOLVING: ") + fileName + " " + full);
if (!full.isEmpty())
@@ -1362,21 +1326,6 @@ QString GdbEngine::fullName(const QString &fileName)
return full;
}
-QString GdbEngine::fullName(const QStringList &candidates)
-{
- QString full;
- foreach (const QString &fileName, candidates) {
- full = fullName(fileName);
- if (!full.isEmpty())
- return full;
- }
- foreach (const QString &fileName, candidates) {
- if (!fileName.isEmpty())
- return fileName;
- }
- return full;
-}
-
void GdbEngine::shutdown()
{
debugMessage(_("INITIATE GDBENGINE SHUTDOWN"));
@@ -1392,7 +1341,11 @@ void GdbEngine::shutdown()
// fall-through
case AdapterStartFailed: // Adapter "did something", but it did not help
// FIXME set some timeout?
- postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleGdbExit));
+ if (m_gdbProc.state() == QProcess::Running) {
+ postCommand(_("-gdb-exit"), GdbEngine::ExitRequest, CB(handleGdbExit));
+ } else {
+ setState(DebuggerNotReady);
+ }
break;
case InferiorRunningRequested:
case InferiorRunning:
@@ -1541,7 +1494,8 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
void GdbEngine::continueInferiorInternal()
{
- QTC_ASSERT(state() == InferiorStopped, qDebug() << state());
+ QTC_ASSERT(state() == InferiorStopped || state() == InferiorStarting,
+ qDebug() << state());
setState(InferiorRunningRequested);
postCommand(_("-exec-continue"), RunRequest, CB(handleExecContinue));
}
@@ -1605,8 +1559,7 @@ void GdbEngine::nextExec()
#if 1
postCommand(_("-exec-next"), RunRequest, CB(handleExecContinue));
#else
- postCommand(_("tbreak %1:%2").arg(QFileInfo(lastFile).fileName())
- .arg(lastLine + 1));
+ postCommand(_("tbreak \"%2\":%1").arg(lastLine + 1).arg(breakLocation(lastFile)));
postCommand(_("-exec-continue"), RunRequest, CB(handleExecContinue));
#endif
}
@@ -1630,7 +1583,8 @@ void GdbEngine::runToLineExec(const QString &fileName, int lineNumber)
setTokenBarrier();
setState(InferiorRunningRequested);
showStatusMessage(tr("Run to line %1 requested...").arg(lineNumber), 5000);
- postCommand(_("-exec-until %1:%2").arg(fileName).arg(lineNumber));
+ postCommand(_("-exec-until \"%2\":%1").arg(lineNumber).arg(breakLocation(fileName)),
+ RunRequest, CB(handleExecContinue));
}
void GdbEngine::runToFunctionExec(const QString &functionName)
@@ -1651,12 +1605,12 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
frame.file = fileName;
frame.line = lineNumber;
#if 1
- // not available everywhere?
- //sendCliCommand(_("tbreak ") + fileName + ':' + QString::number(lineNumber));
- postCommand(_("-break-insert -t ") + fileName + _c(':') + QString::number(lineNumber));
- postCommand(_("jump ") + fileName + _c(':') + QString::number(lineNumber));
+ QString loc = breakLocation(fileName);
+ postCommand(_("tbreak \"%2\":%1").arg(lineNumber).arg(loc));
+ setState(InferiorRunningRequested);
+ postCommand(_("jump \"%2\":%1").arg(lineNumber).arg(loc), RunRequest);
// will produce something like
- // &"jump /home/apoenitz/dev/work/test1/test1.cpp:242"
+ // &"jump \"/home/apoenitz/dev/work/test1/test1.cpp\":242"
// ~"Continuing at 0x4058f3."
// ~"run1 (argc=1, argv=0x7fffbf1f5538) at test1.cpp:242"
// ~"242\t x *= 2;"
@@ -1667,7 +1621,8 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
#else
gotoLocation(frame, true);
setBreakpoint(fileName, lineNumber);
- postCommand(_("jump ") + fileName + ':' + QString::number(lineNumber));
+ setState(InferiorRunningRequested);
+ postCommand(_("jump ") + fileName + ':' + QString::number(lineNumber), RunRequest);
#endif
}
@@ -1724,7 +1679,7 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
data->bpMultiple = false;
data->bpEnabled = true;
data->bpCondition.clear();
- QStringList files;
+ QByteArray file, fullName;
foreach (const GdbMi &child, bkpt.children()) {
if (child.hasName("number")) {
data->bpNumber = _(child.data());
@@ -1738,13 +1693,9 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
else
data->bpAddress = _(child.data());
} else if (child.hasName("file")) {
- files.append(QFile::decodeName(child.data()));
+ file = child.data();
} else if (child.hasName("fullname")) {
- QString fullName = QFile::decodeName(child.data());
- #ifdef Q_OS_WIN
- fullName = QDir::cleanPath(fullName);
- #endif
- files.prepend(fullName);
+ fullName = child.data();
} else if (child.hasName("line")) {
data->bpLineNumber = _(child.data());
if (child.data().toInt())
@@ -1758,17 +1709,8 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
data->bpEnabled = (child.data() == "y");
} else if (child.hasName("pending")) {
data->pending = true;
- int pos = child.data().lastIndexOf(':');
- if (pos > 0) {
- data->bpLineNumber = _(child.data().mid(pos + 1));
- data->markerLineNumber = child.data().mid(pos + 1).toInt();
- QString file = QString::fromLocal8Bit(child.data().left(pos));
- if (file.startsWith(_c('"')) && file.endsWith(_c('"')))
- file = file.mid(1, file.size() - 2);
- files.prepend(file);
- } else {
- files.prepend(QString::fromLocal8Bit(child.data()));
- }
+ // Any content here would be interesting only if we did accept
+ // spontaneously appearing breakpoints (user using gdb commands).
} else if (child.hasName("at")) {
// Happens with (e.g.?) gdb 6.4 symbianelf
QByteArray ba = child.data();
@@ -1782,11 +1724,30 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
//else if (child.hasName("ignore"))
// data->bpIgnoreCount = child.data();
- QString name = fullName(files);
- if (data->bpFileName.isEmpty())
- data->bpFileName = name;
- if (data->markerFileName.isEmpty())
- data->markerFileName = name;
+ QString name;
+ if (!fullName.isEmpty()) {
+ name = QFile::decodeName(fullName);
+ #ifdef Q_OS_WIN
+ name = QDir::cleanPath(name);
+ #endif
+ if (data->markerFileName.isEmpty())
+ data->markerFileName = name;
+ } else {
+ name = QFile::decodeName(file);
+ // Use fullName() once we have a mapping which is more complete than gdb's own ...
+ // No point in assigning markerFileName for now.
+ }
+ data->bpFileName = name;
+}
+
+QString GdbEngine::breakLocation(const QString &file) const
+{
+ QTC_ASSERT(!m_sourcesListOutdated, /* */)
+ QTC_ASSERT(!m_sourcesListUpdating, /* */)
+ QString where = m_fullToShortName.value(file);
+ if (where.isEmpty())
+ return QFileInfo(file).fileName();
+ return where;
}
void GdbEngine::sendInsertBreakpoint(int index)
@@ -1794,37 +1755,25 @@ void GdbEngine::sendInsertBreakpoint(int index)
const BreakpointData *data = manager()->breakHandler()->at(index);
QString where;
if (data->funcName.isEmpty()) {
- if (data->useFullPath) {
- where = data->fileName;
- } else {
- QFileInfo fi(data->fileName);
- where = fi.fileName();
- }
+ where = data->useFullPath ? data->fileName : breakLocation(data->fileName);
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
- where = _("\"\\\"%1\\\":%2\"")
- .arg(GdbMi::escapeCString(where)).arg(data->lineNumber);
+ where = _("\"\\\"%2\\\":%1\"").arg(data->lineNumber).arg(GdbMi::escapeCString(where));
} else {
where = data->funcName;
}
// set up fallback in case of pending breakpoints which aren't handled
// by the MI interface
-#if defined(Q_OS_WIN)
- QString cmd = _("-break-insert ");
- //if (!data->condition.isEmpty())
- // cmd += "-c " + data->condition + " ";
-#elif defined(Q_OS_MAC)
- QString cmd = _("-break-insert -l -1 ");
- //if (!data->condition.isEmpty())
- // cmd += "-c " + data->condition + " ";
-#else
- QString cmd = _("-break-insert -f ");
- if (m_gdbAdapter->isTrkAdapter())
+ QString cmd;
+ if (m_isMacGdb)
+ cmd = _("-break-insert -l -1 -f ");
+ else if (m_gdbVersion >= 60800) // Probably some earlier version would work as well ...
+ cmd = _("-break-insert -f ");
+ else
cmd = _("-break-insert ");
//if (!data->condition.isEmpty())
- // cmd += _("-c ") + data->condition + ' ';
-#endif
+ // cmd += _("-c ") + data->condition + _c(' ');
cmd += where;
gdbOutputAvailable(LogStatus, _("Current state: %1").arg(state()));
postCommand(cmd, NeedsStop, CB(handleBreakInsert), index);
@@ -1947,20 +1896,11 @@ void GdbEngine::handleBreakInsert(const GdbResponse &response)
attemptBreakpointSynchronization();
handler->updateMarkers();
} else {
- const BreakpointData *data = handler->at(index);
- // Note that it is perfectly correct that the file name is put
- // in quotes but not escaped. GDB simply is like that.
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
- QFileInfo fi(data->fileName);
- QString where = _c('"') + fi.fileName() + _("\":")
- + data->lineNumber;
-#else
- QString where = _c('"') + data->fileName + _("\":")
- + data->lineNumber;
- // Should not happen with -break-insert -f. gdb older than 6.8?
- QTC_ASSERT(false, /**/);
-#endif
- postCommand(_("break ") + where, CB(handleBreakInsert1), index);
+ if (m_gdbVersion < 60800 && !m_isMacGdb) {
+ // This gdb version doesn't "do" pending breakpoints.
+ } else {
+ QTC_ASSERT(false, /**/);
+ }
}
}
@@ -2041,8 +1981,32 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
handler->updateMarkers();
}
+void GdbEngine::attemptBreakpointSynchronization2(const GdbResponse &)
+{
+ attemptBreakpointSynchronization();
+}
+
void GdbEngine::attemptBreakpointSynchronization()
{
+ switch (state()) {
+ case InferiorStarting:
+ case InferiorRunningRequested:
+ case InferiorRunning:
+ case InferiorStopping:
+ case InferiorStopped:
+ break;
+ default:
+ //qDebug() << "attempted breakpoint sync in state" << state();
+ return;
+ }
+
+ // For best results, we rely on an up-to-date fullname mapping.
+ if (m_sourcesListOutdated) {
+ reloadSourceFiles();
+ postCommand(_("p 5"), CB(attemptBreakpointSynchronization2));
+ return;
+ }
+
BreakHandler *handler = manager()->breakHandler();
foreach (BreakpointData *data, handler->takeDisabledBreakpoints()) {
@@ -2095,15 +2059,6 @@ void GdbEngine::attemptBreakpointSynchronization()
}
}
}
-
- for (int index = 0; index != handler->size(); ++index) {
- // happens sometimes on Mac. Brush over symptoms
- BreakpointData *data = handler->at(index);
- if (data->markerFileName.startsWith(__("../"))) {
- data->markerFileName = fullName(data->markerFileName);
- handler->updateMarkers();
- }
- }
}
@@ -2162,6 +2117,7 @@ QList<Symbol> GdbEngine::moduleSymbols(const QString &moduleName)
void GdbEngine::reloadModules()
{
+ m_modulesListOutdated = false;
postCommand(_("info shared"), CB(handleModulesList));
}
@@ -2175,15 +2131,21 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
QTextStream ts(&data, QIODevice::ReadOnly);
while (!ts.atEnd()) {
QString line = ts.readLine();
- if (!line.startsWith(__("0x")))
- continue;
Module module;
QString symbolsRead;
QTextStream ts(&line, QIODevice::ReadOnly);
- ts >> module.startAddress >> module.endAddress >> symbolsRead;
- module.moduleName = ts.readLine().trimmed();
- module.symbolsRead = (symbolsRead == __("Yes"));
- modules.append(module);
+ if (line.startsWith(__("0x"))) {
+ ts >> module.startAddress >> module.endAddress >> symbolsRead;
+ module.moduleName = ts.readLine().trimmed();
+ module.symbolsRead = (symbolsRead == __("Yes"));
+ modules.append(module);
+ } else if (line.trimmed().startsWith(__("No"))) {
+ // gdb 6.4 symbianelf
+ ts >> symbolsRead;
+ QTC_ASSERT(symbolsRead == __("No"), continue);
+ module.moduleName = ts.readLine().trimmed();
+ modules.append(module);
+ }
}
if (modules.isEmpty()) {
// Mac has^done,shlib-info={num="1",name="dyld",kind="-",
@@ -2214,7 +2176,9 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
void GdbEngine::reloadSourceFiles()
{
- postCommand(_("-file-list-exec-source-files"), CB(handleQuerySources));
+ m_sourcesListUpdating = true;
+ m_sourcesListOutdated = false;
+ postCommand(_("-file-list-exec-source-files"), NeedsStop, CB(handleQuerySources));
}
@@ -2274,12 +2238,11 @@ void GdbEngine::reloadStack(bool forceGotoLocation)
StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level)
{
//qDebug() << "HANDLING FRAME:" << frameMi.toString();
- QStringList files;
- files.append(QFile::decodeName(frameMi.findChild("fullname").data()));
- files.append(QFile::decodeName(frameMi.findChild("file").data()));
StackFrame frame;
frame.level = level;
- frame.file = fullName(files);
+ // We might want to fall back to "file" once we have a mapping which
+ // is more complete than gdb's own ...
+ frame.file = QFile::decodeName(frameMi.findChild("fullname").data());
frame.function = _(frameMi.findChild("func").data());
frame.from = _(frameMi.findChild("from").data());
frame.line = frameMi.findChild("line").data().toInt();
@@ -2289,11 +2252,7 @@ StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level)
void GdbEngine::handleStackListFrames(const GdbResponse &response)
{
- #if defined(Q_OS_MAC)
- bool handleIt = true;
- #else
- bool handleIt = response.resultClass == GdbResultDone;
- #endif
+ bool handleIt = (m_isMacGdb || response.resultClass == GdbResultDone);
if (!handleIt) {
// That always happens on symbian gdb with
// ^error,data={msg="Previous frame identical to this frame (corrupt stack?)"
@@ -2328,7 +2287,10 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
// Immediately leave bogus frames.
if (targetFrame == -1 && isBogus) {
- postCommand(_("-exec-finish"));
+ setTokenBarrier();
+ setState(InferiorRunningRequested);
+ postCommand(_("-exec-finish"), RunRequest, CB(handleExecContinue));
+ showStatusMessage(tr("Jumping out of bogus frame..."), 1000);
return;
}
#endif
@@ -2361,15 +2323,11 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
if (targetFrame == -1)
targetFrame = 0;
- #ifdef Q_OS_MAC
// Mac gdb does not add the location to the "stopped" message,
// so the early gotoLocation() was not triggered. Force it here.
- bool jump = true;
- #else
// For targetFrame == 0 we already issued a 'gotoLocation'
// when reading the *stopped message.
- bool jump = targetFrame != 0;
- #endif
+ bool jump = (m_isMacGdb || targetFrame != 0);
manager()->stackHandler()->setCurrentIndex(targetFrame);
if (jump || cookie.gotoLocation) {
@@ -2510,12 +2468,9 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
bool GdbEngine::supportsThreads() const
{
-#ifdef Q_OS_MAC
- return true;
-#endif
// FSF gdb 6.3 crashes happily on -thread-list-ids. So don't use it.
// The test below is a semi-random pick, 6.8 works fine
- return m_gdbVersion > 60500;
+ return m_isMacGdb || m_gdbVersion > 60500;
}
@@ -3458,7 +3413,7 @@ void GdbEngine::handleStackFrame1(const GdbResponse &response)
//qDebug() << "FIRST CHUNK: " << out;
m_firstChunk = out;
} else {
- QTC_ASSERT(false, /**/);
+ QTC_ASSERT(false, qDebug() << response.toString());
}
}
@@ -3578,16 +3533,17 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."}}
// We do not want these at all. Current hypotheses is that those
// "spurious" locals have _two_ "exp" field. Try to filter them:
-#ifdef Q_OS_MAC
- int numExps = 0;
- foreach (const GdbMi &child, item.children())
- numExps += int(child.name() == "exp");
- if (numExps > 1)
- return WatchData();
- QByteArray name = item.findChild("exp").data();
-#else
- QByteArray name = item.findChild("name").data();
-#endif
+ QByteArray name;
+ if (m_isMacGdb) {
+ int numExps = 0;
+ foreach (const GdbMi &child, item.children())
+ numExps += int(child.name() == "exp");
+ if (numExps > 1)
+ return WatchData();
+ name = item.findChild("exp").data();
+ } else {
+ name = item.findChild("name").data();
+ }
const QMap<QByteArray, int>::iterator it = seen->find(name);
if (it != seen->end()) {
const int n = it.value();
@@ -3886,10 +3842,8 @@ void GdbEngine::tryLoadDebuggingHelpers()
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup));
//postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
- m_debuggingHelperState = DebuggingHelperLoadTried;
#else
//postCommand(_("p dlopen"));
- QString flag = QString::number(RTLD_NOW);
postCommand(_("sharedlibrary libc")); // for malloc
postCommand(_("sharedlibrary libdl")); // for dlopen
postCommand(_("call (void*)dlopen(\"") + GdbMi::escapeCString(dlopenLib)
@@ -4080,14 +4034,14 @@ QString GdbEngine::parseDisassembler(const GdbMi &lines)
foreach (const GdbMi &child, lines.children()) {
if (child.hasName("src_and_asm_line")) {
// mixed mode
- int line = child.findChild("line").data().toInt();
- QString fileName = QFile::decodeName(child.findChild("file").data());
if (!fileLoaded) {
+ QString fileName = QFile::decodeName(child.findChild("file").data());
QFile file(fullName(fileName));
file.open(QIODevice::ReadOnly);
fileContents = file.readAll().split('\n');
fileLoaded = true;
}
+ int line = child.findChild("line").data().toInt();
if (line >= 0 && line < fileContents.size())
ba += " " + fileContents.at(line) + '\n';
GdbMi insn = child.findChild("line_asm_insn");
@@ -4174,7 +4128,7 @@ void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker)
// Starting up & shutting down
//
-bool GdbEngine::startGdb(const QStringList &args, const QString &gdb)
+bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QString &settingsIdHint)
{
debugMessage(_("STARTING GDB ") + gdb);
@@ -4190,7 +4144,8 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb)
m_gdbProc.start(location, gdbArgs);
if (!m_gdbProc.waitForStarted()) {
- handleAdapterStartFailed(m_gdbProc.errorString());
+ const QString msg = tr("Unable to start gdb '%1': %2").arg(gdb, m_gdbProc.errorString());
+ handleAdapterStartFailed(msg, settingsIdHint);
return false;
}
@@ -4241,7 +4196,6 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb)
// /build/buildd/gdb-6.8/gdb/valops.c:2069: internal-error:
postCommand(_("set overload-resolution off"));
//postCommand(_("set demangle-style none"));
-
// From the docs:
// Stop means reenter debugger if this signal happens (implies print).
// Print means print a message if this signal happens.
@@ -4261,9 +4215,9 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb)
postCommand(_("set width 0"));
postCommand(_("set height 0"));
- #ifdef Q_OS_MAC
- postCommand(_("-gdb-set inferior-auto-start-cfm off"));
- postCommand(_("-gdb-set sharedLibrary load-rules "
+ if (m_isMacGdb) {
+ postCommand(_("-gdb-set inferior-auto-start-cfm off"));
+ postCommand(_("-gdb-set sharedLibrary load-rules "
"dyld \".*libSystem.*\" all "
"dyld \".*libauto.*\" all "
"dyld \".*AppKit.*\" all "
@@ -4272,7 +4226,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb)
"dyld \".*CFDataFormatters.*\" all "
"dyld \".*libobjc.*\" all "
"dyld \".*CarbonDataFormatters.*\" all"));
- #endif
+ }
QString scriptFileName = theDebuggerStringSetting(GdbScriptFile);
if (!scriptFileName.isEmpty()) {
@@ -4313,6 +4267,8 @@ void GdbEngine::handleGdbError(QProcess::ProcessError error)
void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
{
debugMessage(_("GDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
+ if (!m_gdbAdapter)
+ return;
if (state() == EngineShuttingDown) {
m_gdbAdapter->shutdown();
} else if (state() != AdapterStartFailed) {
@@ -4330,9 +4286,14 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, const QString &sett
{
setState(AdapterStartFailed);
debugMessage(_("ADAPTER START FAILED"));
- Core::ICore::instance()->showWarningWithOptions(
- tr("Adapter start failed"), msg, QString(),
- _(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY), settingsIdHint);
+ const QString title = tr("Adapter start failed");
+ if (settingsIdHint.isEmpty()) {
+ Core::ICore::instance()->showWarningWithOptions(title, msg);
+ } else {
+ Core::ICore::instance()->showWarningWithOptions(title, msg, QString(),
+ _(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY),
+ settingsIdHint);
+ }
shutdown();
}
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index a891a55747..786ac7696a 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -126,7 +126,9 @@ private: ////////// Gdb Process Management //////////
AbstractGdbAdapter *createAdapter(const DebuggerStartParametersPtr &dp);
void connectAdapter();
- bool startGdb(const QStringList &args = QStringList(), const QString &gdb = QString());
+ bool startGdb(const QStringList &args = QStringList(),
+ const QString &gdb = QString(),
+ const QString &settingsIdHint = QString());
void startInferiorPhase2();
void handleInferiorShutdown(const GdbResponse &response);
@@ -246,7 +248,7 @@ private: ////////// Gdb Output, State & Capability Handling //////////
void handleResponse(const QByteArray &buff);
void handleStopResponse(const GdbMi &data);
- void handleResultRecord(const GdbResponse &response);
+ void handleResultRecord(GdbResponse *response);
void handleStop1(const GdbResponse &response);
void handleStop1(const GdbMi &data);
void handleStop2(const GdbResponse &response);
@@ -260,13 +262,16 @@ private: ////////// Gdb Output, State & Capability Handling //////////
void handleShowVersion(const GdbResponse &response);
void handleIsSynchroneous(const GdbResponse &response);
- int m_gdbVersion; // 6.8.0 is 680
+ int m_gdbVersion; // 6.8.0 is 60800
int m_gdbBuildVersion; // MAC only?
+ bool m_isMacGdb;
bool m_isSynchroneous; // Can act synchroneously?
private: ////////// Inferior Management //////////
+ // This should be always the last call in a function.
Q_SLOT virtual void attemptBreakpointSynchronization();
+ void attemptBreakpointSynchronization2(const GdbResponse &);
virtual void stepExec();
virtual void stepOutExec();
@@ -310,6 +315,7 @@ private: ////////// View & Data Stuff //////////
void extractDataFromInfoBreak(const QString &output, BreakpointData *data);
void breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt);
void sendInsertBreakpoint(int index);
+ QString breakLocation(const QString &file) const;
//
// Modules specific stuff
@@ -349,13 +355,14 @@ private: ////////// View & Data Stuff //////////
void handleQuerySources(const GdbResponse &response);
QString fullName(const QString &fileName);
- // get one usable name out of these, try full names first
- QString fullName(const QStringList &candidates);
// awful hack to keep track of used files
QMap<QString, QString> m_shortToFullName;
QMap<QString, QString> m_fullToShortName;
+ bool m_sourcesListOutdated;
+ bool m_sourcesListUpdating;
+
//
// Stack specific stuff
//
diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp
index 226bfb7283..b030e44977 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.cpp
+++ b/src/plugins/debugger/gdb/gdboptionspage.cpp
@@ -51,6 +51,9 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(GdbEnvironment),
m_ui.environmentEdit);
+#if 1
+ m_ui.groupBoxPluginDebugging->hide();
+#else // The related code (handleAqcuiredInferior()) is disabled as well.
m_group.insert(theDebuggerAction(AllPluginBreakpoints),
m_ui.radioButtonAllPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpoints),
@@ -59,6 +62,7 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui.radioButtonNoPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpointsPattern),
m_ui.lineEditSelectedPluginBreakpointsPattern);
+#endif
m_ui.lineEditSelectedPluginBreakpointsPattern->
setEnabled(theDebuggerAction(SelectedPluginBreakpoints)->value().toBool());
diff --git a/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.cpp b/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.cpp
new file mode 100644
index 0000000000..8dcfa4b904
--- /dev/null
+++ b/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.cpp
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "s60debuggerbluetoothstarter.h"
+#include "bluetoothlistener.h"
+#include "debuggermanager.h"
+
+namespace Debugger {
+namespace Internal {
+
+S60DebuggerBluetoothStarter::S60DebuggerBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent) :
+ trk::AbstractBluetoothStarter(trkDevice, parent)
+{
+}
+
+trk::BluetoothListener *S60DebuggerBluetoothStarter::createListener()
+{
+ DebuggerManager *dm = DebuggerManager::instance();
+ trk::BluetoothListener *rc = new trk::BluetoothListener(dm);
+ rc->setMode(trk::BluetoothListener::Listen);
+ connect(rc, SIGNAL(message(QString)), dm, SLOT(showDebuggerOutput(QString)));
+ return rc;
+}
+
+} // namespace Internal
+} // namespace Debugger
diff --git a/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.h b/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.h
new file mode 100644
index 0000000000..226e00072a
--- /dev/null
+++ b/src/plugins/debugger/gdb/s60debuggerbluetoothstarter.h
@@ -0,0 +1,55 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef S60DEBUGGERBLUETOOTHSTARTER_H
+#define S60DEBUGGERBLUETOOTHSTARTER_H
+
+#include "communicationstarter.h"
+
+namespace Debugger {
+namespace Internal {
+
+/* S60DebuggerBluetoothStarter: Creates a listener in 'Listen' mode
+ * parented on the Debugger manager which outputs to the debugger window.
+ * Note: This is a "last resort" starter, normally, the run configuration
+ * should have already started a listener. */
+
+class S60DebuggerBluetoothStarter : public trk::AbstractBluetoothStarter
+{
+public:
+ explicit S60DebuggerBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0);
+
+protected:
+ virtual trk::BluetoothListener *createListener();
+};
+
+} // namespace Internal
+} // namespace Debugger
+
+#endif // S60DEBUGGERBLUETOOTHSTARTER_H
diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp
index c62a31b967..e954396c30 100644
--- a/src/plugins/debugger/gdb/trkgdbadapter.cpp
+++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp
@@ -30,6 +30,8 @@
#include "trkgdbadapter.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
+#include "s60debuggerbluetoothstarter.h"
+#include "bluetoothlistener_gui.h"
#include "debuggerstringutils.h"
#ifndef STANDALONE_RUNNER
@@ -191,11 +193,12 @@ void Snapshot::insertMemory(const MemoryRange &range, const QByteArray &ba)
TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) :
AbstractGdbAdapter(engine),
m_options(options),
+ m_overrideTrkDeviceType(-1),
m_running(false),
+ m_trkDevice(new trk::TrkDevice),
m_gdbAckMode(true),
m_verbose(2),
- m_bufferedMemoryRead(true),
- m_waitCount(0)
+ m_bufferedMemoryRead(true)
{
m_gdbServer = 0;
m_gdbConnection = 0;
@@ -206,28 +209,15 @@ TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) :
#endif
m_gdbServerName = _("127.0.0.1:%1").arg(2222 + portOffset);
- connect(&m_rfcommProc, SIGNAL(readyReadStandardError()),
- this, SLOT(handleRfcommReadyReadStandardError()));
- connect(&m_rfcommProc, SIGNAL(readyReadStandardOutput()),
- this, SLOT(handleRfcommReadyReadStandardOutput()));
- connect(&m_rfcommProc, SIGNAL(error(QProcess::ProcessError)),
- this, SLOT(handleRfcommError(QProcess::ProcessError)));
- connect(&m_rfcommProc, SIGNAL(finished(int, QProcess::ExitStatus)),
- this, SLOT(handleRfcommFinished(int, QProcess::ExitStatus)));
- connect(&m_rfcommProc, SIGNAL(started()),
- this, SLOT(handleRfcommStarted()));
- connect(&m_rfcommProc, SIGNAL(stateChanged(QProcess::ProcessState)),
- this, SLOT(handleRfcommStateChanged(QProcess::ProcessState)));
-
- connect(&m_trkDevice, SIGNAL(messageReceived(trk::TrkResult)),
+ connect(m_trkDevice.data(), SIGNAL(messageReceived(trk::TrkResult)),
this, SLOT(handleTrkResult(trk::TrkResult)));
- connect(&m_trkDevice, SIGNAL(error(QString)),
+ connect(m_trkDevice.data(), SIGNAL(error(QString)),
this, SLOT(handleTrkError(QString)));
- m_trkDevice.setVerbose(m_verbose);
- m_trkDevice.setSerialFrame(m_options->mode != TrkOptions::BlueTooth);
+ m_trkDevice->setVerbose(m_verbose);
+ m_trkDevice->setSerialFrame(effectiveTrkDeviceType() != TrkOptions::BlueTooth);
- connect(&m_trkDevice, SIGNAL(logMessage(QString)),
+ connect(m_trkDevice.data(), SIGNAL(logMessage(QString)),
this, SLOT(trkLogMessage(QString)));
}
@@ -237,16 +227,6 @@ TrkGdbAdapter::~TrkGdbAdapter()
logMessage("Shutting down.\n");
}
-QString TrkGdbAdapter::overrideTrkDevice() const
-{
- return m_overrideTrkDevice;
-}
-
-void TrkGdbAdapter::setOverrideTrkDevice(const QString &d)
-{
- m_overrideTrkDevice = d;
-}
-
QString TrkGdbAdapter::effectiveTrkDevice() const
{
if (!m_overrideTrkDevice.isEmpty())
@@ -256,6 +236,13 @@ QString TrkGdbAdapter::effectiveTrkDevice() const
return m_options->serialPort;
}
+int TrkGdbAdapter::effectiveTrkDeviceType() const
+{
+ if (m_overrideTrkDeviceType >= 0)
+ return m_overrideTrkDeviceType;
+ return m_options->mode;
+}
+
void TrkGdbAdapter::trkLogMessage(const QString &msg)
{
logMessage("TRK " + msg);
@@ -389,44 +376,6 @@ void TrkGdbAdapter::slotEmitDelayedInferiorStartFailed()
emit inferiorStartFailed(m_adapterFailMessage);
}
-void TrkGdbAdapter::waitForTrkConnect()
-{
- QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
- QString errorMessage;
- const QString device = effectiveTrkDevice();
- if (!m_trkDevice.open(device, &errorMessage)) {
- logMessage(_("Waiting on %1 (%2)").arg(device, errorMessage));
- if (errorMessage.contains(_("ermission denied"))) {
- static int direction = 0;
- direction = (direction + 1) % 4;
- showStatusMessage(_("Please start TRK on your device! %1")
- .arg(QChar("/-\\|"[direction])));
- }
- // Do not loop forever
- if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 60 : 5)) {
- QTimer::singleShot(1000, this, SLOT(waitForTrkConnect()));
- } else {
- QString msg = _("Failed to connect to %1 after "
- "%2 attempts").arg(device).arg(m_waitCount);
- logMessage(msg);
- emit adapterStartFailed(msg, TrkOptionsPage::settingsId());
- }
- return;
- }
-
- m_trkDevice.sendTrkInitialPing();
- sendTrkMessage(0x02); // Disconnect, as trk might be still connected
- sendTrkMessage(0x01); // Connect
- sendTrkMessage(0x05, TrkCB(handleSupportMask));
- sendTrkMessage(0x06, TrkCB(handleCpuType));
- sendTrkMessage(0x04, TrkCB(handleTrkVersions)); // Versions
- //sendTrkMessage(0x09); // Unrecognized command
- //sendTrkMessage(0x4a, 0,
- // "10 " + formatString("C:\\data\\usingdlls.sisx")); // Open File
- //sendTrkMessage(0x4B, 0, "00 00 00 01 73 1C 3A C8"); // Close File
-
- emit adapterStarted();
-}
void TrkGdbAdapter::logMessage(const QString &msg)
{
@@ -802,10 +751,29 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
else if (cmd == "qfDllInfo") {
- // happens with gdb 6.4.50.20060226-cvs / CodeSourcery
- // never made it into FSF gdb?
+ // That's the _first_ query package.
+ // Happens with gdb 6.4.50.20060226-cvs / CodeSourcery.
+ // Never made it into FSF gdb that got qXfer:libraries:read instead.
+ // http://sourceware.org/ml/gdb/2007-05/msg00038.html
+ // Name=hexname,TextSeg=textaddr[,DataSeg=dataaddr]
sendGdbServerAck();
- sendGdbServerMessage("", "FIXME: nothing?");
+ QByteArray response = "m";
+ // FIXME: Limit packet length by using qsDllInfo packages?
+ for (int i = 0; i != m_session.libraries.size(); ++i) {
+ if (i)
+ response += ';';
+ const Library &lib = m_session.libraries.at(i);
+ response += "Name=" + lib.name.toHex()
+ + ",TextSeg=" + hexNumber(lib.codeseg)
+ + ",DataSeg=" + hexNumber(lib.dataseg);
+ }
+ sendGdbServerMessage(response, "library information transfered");
+ }
+
+ else if (cmd == "qsDllInfo") {
+ // That's a following query package
+ sendGdbServerAck();
+ sendGdbServerMessage("l", "library information transfer finished");
}
else if (cmd == "qPacketInfo") {
@@ -964,13 +932,13 @@ i */
void TrkGdbAdapter::sendTrkMessage(byte code, TrkCallback callback,
const QByteArray &data, const QVariant &cookie)
{
- m_trkDevice.sendTrkMessage(code, callback, data, cookie);
+ m_trkDevice->sendTrkMessage(code, callback, data, cookie);
}
void TrkGdbAdapter::sendTrkAck(byte token)
{
//logMessage(QString("SENDING ACKNOWLEDGEMENT FOR TOKEN %1").arg(int(token)));
- m_trkDevice.sendTrkAck(token);
+ m_trkDevice->sendTrkAck(token);
}
void TrkGdbAdapter::handleTrkError(const QString &msg)
@@ -1069,7 +1037,10 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
// With CS gdb 6.4 we get a non-standard $qfDllInfo#7f+ request
// afterwards, so don't use it for now.
//sendGdbServerMessage("T05library:;");
- sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE");
+ sendGdbServerMessage("T05load:Name=" + lib.name.toHex()
+ + ",TextSeg=" + hexNumber(lib.codeseg)
+ + ",DataSeg=" + hexNumber(lib.dataseg) + ';');
+ //sendTrkMessage(0x18, TrkCallback(), trkContinueMessage(), "CONTINUE");
break;
}
case 0xa1: { // NotifyDeleted
@@ -1475,7 +1446,7 @@ void TrkGdbAdapter::handleSupportMask(const TrkResult &result)
logMessage("SUPPORTED: " + str);
}
-void TrkGdbAdapter::handleTrkVersions(const TrkResult &result)
+void TrkGdbAdapter::handleTrkVersionsStartGdb(const TrkResult &result)
{
QString logMsg;
QTextStream str(&logMsg);
@@ -1487,6 +1458,13 @@ void TrkGdbAdapter::handleTrkVersions(const TrkResult &result)
<< '.' << int(result.data.at(4));
}
logMessage(logMsg);
+ QStringList gdbArgs;
+ gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
+ if (!m_engine->startGdb(gdbArgs, m_options->gdb, TrkOptionsPage::settingsId())) {
+ cleanup();
+ return;
+ }
+ emit adapterStarted();
}
void TrkGdbAdapter::handleDisconnect(const TrkResult & /*result*/)
@@ -1510,8 +1488,6 @@ void TrkGdbAdapter::readMemory(uint addr, uint len, bool buffered)
void TrkGdbAdapter::interruptInferior()
{
- QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
- logMessage("TRYING TO INTERRUPT INFERIOR");
sendTrkMessage(0x1a, TrkCallback(), trkInterruptMessage(), "Interrupting...");
}
@@ -1519,7 +1495,8 @@ void TrkGdbAdapter::startAdapter()
{
// Retrieve parameters
const DebuggerStartParameters &parameters = startParameters();
- setOverrideTrkDevice(parameters.remoteChannel);
+ m_overrideTrkDevice = parameters.remoteChannel;
+ m_overrideTrkDeviceType = parameters.remoteChannelType;
m_remoteExecutable = parameters.executable;
m_symbolFile = parameters.symbolFileName;
// FIXME: testing hack, remove!
@@ -1534,29 +1511,32 @@ void TrkGdbAdapter::startAdapter()
setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
- if (m_options->mode == TrkOptions::BlueTooth) {
- const QString device = effectiveTrkDevice();
- const QString blueToothListener = QLatin1String("rfcomm");
- QStringList blueToothListenerArguments;
- blueToothListenerArguments.append(_("-r"));
- blueToothListenerArguments.append(_("listen"));
- blueToothListenerArguments.append(m_options->blueToothDevice);
- blueToothListenerArguments.append(_("1"));
- logMessage(_("### Starting BlueTooth listener %1 on %2: %3 %4")
- .arg(blueToothListener).arg(device).arg(blueToothListener)
- .arg(blueToothListenerArguments.join(" ")));
- m_rfcommProc.start(blueToothListener, blueToothListenerArguments);
- m_rfcommProc.waitForStarted();
- if (m_rfcommProc.state() != QProcess::Running) {
- QString msg = _("Failed to start BlueTooth "
- "listener %1 on %2: %3\n");
- msg = msg.arg(blueToothListener, device, m_rfcommProc.errorString());
- msg += QString::fromLocal8Bit(m_rfcommProc.readAllStandardError());
- emit adapterStartFailed(msg, TrkOptionsPage::settingsId());
+ m_trkDevice->setSerialFrame(effectiveTrkDeviceType() != TrkOptions::BlueTooth);
+ // Prompt the user for a bluetooth connection
+ const QString device = effectiveTrkDevice();
+ QString message;
+ if (effectiveTrkDeviceType() == TrkOptions::BlueTooth) {
+ S60DebuggerBluetoothStarter starter(m_trkDevice);
+ starter.setDevice(device);
+ const trk::StartBluetoothGuiResult src = trk::startBluetoothGui(starter, 0, &message);
+ switch (src) {
+ case trk::BluetoothGuiConnected:
+ break;
+ case trk::BluetoothGuiCanceled:
+ emit adapterStartFailed(message, QString());
+ return;
+ case trk::BluetoothGuiError:
+ emit adapterStartFailed(message, TrkOptionsPage::settingsId());
+ return;
+ };
+ } else {
+ if (!m_trkDevice->isOpen() && !m_trkDevice->open(device, &message)) {
+ message = tr("Failed to connect to %1: %2\nCheck whether TRK is running.").arg(device).arg(message);
+ logMessage(message);
+ emit adapterStartFailed(message, TrkOptionsPage::settingsId());
return;
}
}
- m_waitCount = 0;
QTC_ASSERT(m_gdbServer == 0, delete m_gdbServer);
QTC_ASSERT(m_gdbConnection == 0, m_gdbConnection = 0);
@@ -1576,14 +1556,12 @@ void TrkGdbAdapter::startAdapter()
connect(m_gdbServer, SIGNAL(newConnection()),
this, SLOT(handleGdbConnection()));
- QStringList gdbArgs;
- gdbArgs.append(QLatin1String("--nx")); // Do not read .gdbinit file
- if (!m_engine->startGdb(gdbArgs, m_options->gdb)) {
- cleanup();
- return;
- }
-
- waitForTrkConnect();
+ m_trkDevice->sendTrkInitialPing();
+ sendTrkMessage(0x02); // Disconnect, as trk might be still connected
+ sendTrkMessage(0x01); // Connect
+ sendTrkMessage(0x05, TrkCB(handleSupportMask));
+ sendTrkMessage(0x06, TrkCB(handleCpuType));
+ sendTrkMessage(0x04, TrkCB(handleTrkVersionsStartGdb)); // Versions
}
void TrkGdbAdapter::startInferior()
@@ -1620,11 +1598,11 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result)
m_session.tid = extractInt(data + 5);
m_session.codeseg = extractInt(data + 9);
m_session.dataseg = extractInt(data + 13);
+ const QString startMsg = tr("Process started, PID: 0x%1, thread id: 0x%2, code segment: 0x%3, data segment: 0x%4.")
+ .arg(m_session.pid, 0, 16).arg(m_session.tid, 0, 16)
+ .arg(m_session.codeseg, 0, 16).arg(m_session.dataseg, 0, 16);
- logMessage("PID: " + hexxNumber(m_session.pid));
- logMessage("TID: " + hexxNumber(m_session.tid));
- logMessage("COD: " + hexxNumber(m_session.codeseg));
- logMessage("DAT: " + hexxNumber(m_session.dataseg));
+ logMessage(startMsg);
const QString fileName = m_symbolFile;
if (m_symbolFile.isEmpty()) {
@@ -1656,45 +1634,6 @@ void TrkGdbAdapter::startInferiorPhase2()
}
//
-// Rfcomm process handling
-//
-
-void TrkGdbAdapter::handleRfcommReadyReadStandardError()
-{
- QByteArray ba = m_rfcommProc.readAllStandardError();
- logMessage(QString("RFCONN stderr: %1").arg(_(ba)));
-}
-
-void TrkGdbAdapter::handleRfcommReadyReadStandardOutput()
-{
- QByteArray ba = m_rfcommProc.readAllStandardOutput();
- logMessage(QString("RFCONN stdout: %1").arg(_(ba)));
-}
-
-
-void TrkGdbAdapter::handleRfcommError(QProcess::ProcessError error)
-{
- logMessage(QString("RFCOMM: Process Error %1: %2")
- .arg(error).arg(m_rfcommProc.errorString()));
-}
-
-void TrkGdbAdapter::handleRfcommFinished(int exitCode, QProcess::ExitStatus exitStatus)
-{
- logMessage(QString("RFCOMM: ProcessFinished %1 %2")
- .arg(exitCode).arg(exitStatus));
-}
-
-void TrkGdbAdapter::handleRfcommStarted()
-{
- logMessage(QString("RFCOMM: Process Started"));
-}
-
-void TrkGdbAdapter::handleRfcommStateChanged(QProcess::ProcessState newState)
-{
- logMessage(QString("RFCOMM: Process State %1").arg(newState));
-}
-
-//
// AbstractGdbAdapter interface implementation
//
@@ -1919,7 +1858,7 @@ void TrkGdbAdapter::handleDirectStep3(const TrkResult &result)
void TrkGdbAdapter::cleanup()
{
- m_trkDevice.close();
+ m_trkDevice->close();
delete m_gdbServer;
m_gdbServer = 0;
}
diff --git a/src/plugins/debugger/gdb/trkgdbadapter.h b/src/plugins/debugger/gdb/trkgdbadapter.h
index 9bc68b4309..a4e01f3258 100644
--- a/src/plugins/debugger/gdb/trkgdbadapter.h
+++ b/src/plugins/debugger/gdb/trkgdbadapter.h
@@ -43,10 +43,12 @@
#include <QtCore/QQueue>
#include <QtCore/QString>
#include <QtCore/QStringList>
+#include <QtCore/QSharedPointer>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
+
namespace Debugger {
namespace Internal {
@@ -142,20 +144,16 @@ public:
void setBufferedMemoryRead(bool b) { m_bufferedMemoryRead = b; }
trk::Session &session() { return m_session; }
- // Set a device (from the project) to override the settings.
- QString overrideTrkDevice() const;
- void setOverrideTrkDevice(const QString &);
-
signals:
void output(const QString &msg);
private:
const TrkOptionsPtr m_options;
QString m_overrideTrkDevice;
+ int m_overrideTrkDeviceType;
QString m_gdbServerName; // 127.0.0.1:(2222+uid)
- QProcess m_rfcommProc;
bool m_running;
public:
@@ -179,7 +177,6 @@ private:
void emitDelayedInferiorStartFailed(const QString &msg);
Q_SLOT void slotEmitDelayedInferiorStartFailed();
- Q_SLOT void waitForTrkConnect();
void handleTargetRemote(const GdbResponse &response);
//
@@ -201,7 +198,7 @@ private:
void handleSignalContinue(const TrkResult &result);
void handleStop(const TrkResult &result);
void handleSupportMask(const TrkResult &result);
- void handleTrkVersions(const TrkResult &result);
+ void handleTrkVersionsStartGdb(const TrkResult &result);
void handleDisconnect(const TrkResult &result);
void handleDeleteProcess(const TrkResult &result);
void handleDeleteProcess2(const TrkResult &result);
@@ -251,7 +248,7 @@ private:
QByteArray trkDeleteProcessMessage();
QByteArray trkInterruptMessage();
- trk::TrkDevice m_trkDevice;
+ QSharedPointer<trk::TrkDevice> m_trkDevice;
QString m_adapterFailMessage;
//
@@ -291,17 +288,8 @@ private:
QHash<int, GdbCommand> m_gdbCookieForToken;
- //
- // Rfcomm
- //
- Q_SLOT void handleRfcommReadyReadStandardError();
- Q_SLOT void handleRfcommReadyReadStandardOutput();
- Q_SLOT void handleRfcommError(QProcess::ProcessError error);
- Q_SLOT void handleRfcommFinished(int exitCode, QProcess::ExitStatus exitStatus);
- Q_SLOT void handleRfcommStarted();
- Q_SLOT void handleRfcommStateChanged(QProcess::ProcessState newState);
-
QString effectiveTrkDevice() const;
+ int effectiveTrkDeviceType() const;
// Debuggee state
trk::Session m_session; // global-ish data (process id, target information)
@@ -310,7 +298,6 @@ private:
QString m_symbolFile;
int m_verbose;
bool m_bufferedMemoryRead;
- int m_waitCount;
};
} // namespace Internal
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index 55e03207bd..3e18cd43f7 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -636,6 +636,12 @@ QString decodeData(const QByteArray &ba, int encoding)
case 5: { // base64 encoded 8 bit data, without quotes (see 1)
return quoteUnprintableLatin1(QByteArray::fromBase64(ba));
}
+ case 6: { // %02x encoded 8 bit data
+ const QChar doubleQuote(QLatin1Char('"'));
+ const QByteArray decodedBa = QByteArray::fromHex(ba);
+ //qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
+ return doubleQuote + QString::fromLatin1(decodedBa) + doubleQuote;
+ }
case 7: { // %04x encoded 16 bit data
const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba);
@@ -644,6 +650,7 @@ QString decodeData(const QByteArray &ba, int encoding)
(decodedBa.data()), decodedBa.size() / 2) + doubleQuote;
}
}
+ qDebug() << "ENCODING ERROR: " << encoding;
return QCoreApplication::translate("Debugger", "<Encoding error>");
}
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index abec06d97e..8d99049488 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -78,6 +78,10 @@
#include <climits>
+// FIXME: Restrict this as soon the availableUndoSteps has been merged to Qt
+//#if QT_VERSION < 0x040600
+#define availableUndoSteps revision
+//#endif
//#define DEBUG_KEY 1
#if DEBUG_KEY
@@ -88,7 +92,7 @@
//#define DEBUG_UNDO 1
#if DEBUG_UNDO
-# define UNDO_DEBUG(s) qDebug() << << m_tc.document()->revision() << s
+# define UNDO_DEBUG(s) qDebug() << << m_tc.document()->availableUndoSteps() << s
#else
# define UNDO_DEBUG(s)
#endif
@@ -661,7 +665,7 @@ void FakeVimHandler::Private::restoreWidget()
EventResult FakeVimHandler::Private::handleKey(int key, int unmodified,
const QString &text)
{
- m_undoCursorPosition[m_tc.document()->revision()] = m_tc.position();
+ m_undoCursorPosition[m_tc.document()->availableUndoSteps()] = m_tc.position();
//qDebug() << "KEY: " << key << text << "POS: " << m_tc.position();
if (m_mode == InsertMode)
return handleInsertMode(key, unmodified, text);
@@ -1574,6 +1578,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else if (key == 'Z') {
m_submode = CapitalZSubMode;
} else if (key == '~' && !atEndOfLine()) {
+ beginEditBlock();
setAnchor();
moveRight(qMin(count(), rightDist()));
QString str = selectedText();
@@ -1583,6 +1588,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
str[i] = c.isUpper() ? c.toLower() : c.toUpper();
}
m_tc.insertText(str);
+ endEditBlock();
} else if (key == Key_PageDown || key == control('f')) {
moveDown(count() * (linesOnScreen() - 2) - cursorLineOnScreen());
scrollToLineInDocument(cursorLineInDocument());
@@ -2726,30 +2732,32 @@ QWidget *FakeVimHandler::Private::editor() const
void FakeVimHandler::Private::undo()
{
- int current = m_tc.document()->revision();
+ int current = m_tc.document()->availableUndoSteps();
//endEditBlock();
EDITOR(undo());
//beginEditBlock();
- int rev = m_tc.document()->revision();
+ int rev = m_tc.document()->availableUndoSteps();
if (current == rev)
showBlackMessage(FakeVimHandler::tr("Already at oldest change"));
else
showBlackMessage(QString());
+
if (m_undoCursorPosition.contains(rev))
m_tc.setPosition(m_undoCursorPosition[rev]);
}
void FakeVimHandler::Private::redo()
{
- int current = m_tc.document()->revision();
+ int current = m_tc.document()->availableUndoSteps();
//endEditBlock();
EDITOR(redo());
//beginEditBlock();
- int rev = m_tc.document()->revision();
+ int rev = m_tc.document()->availableUndoSteps();
if (rev == current)
showBlackMessage(FakeVimHandler::tr("Already at newest change"));
else
showBlackMessage(QString());
+
if (m_undoCursorPosition.contains(rev))
m_tc.setPosition(m_undoCursorPosition[rev]);
}
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index b738231541..a5aed6fe1f 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -618,7 +618,7 @@ void HelpPlugin::extensionsInitialized()
+ QLatin1String("../../share/doc/qtcreator/qtcreator.qch"));
#endif
if (!hc.registerDocumentation(qchFileName))
- qDebug() << hc.error();
+ qDebug() << qPrintable(hc.error());
needsSetup = true;
}
diff --git a/src/plugins/qmleditor/QmlEditor.pluginspec b/src/plugins/qmleditor/QmlEditor.pluginspec
index 5c30283018..7b1a91c8ce 100644
--- a/src/plugins/qmleditor/QmlEditor.pluginspec
+++ b/src/plugins/qmleditor/QmlEditor.pluginspec
@@ -21,5 +21,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependencyList>
<dependency name="Core" version="1.3.80"/>
<dependency name="TextEditor" version="1.3.80"/>
+ <dependency name="Help" version="1.3.80"/>
</dependencyList>
</plugin>
diff --git a/src/plugins/qmleditor/parser/qmljs.g b/src/plugins/qmleditor/parser/qmljs.g
index 8531ed5107..eb9a8abcfd 100644
--- a/src/plugins/qmleditor/parser/qmljs.g
+++ b/src/plugins/qmleditor/parser/qmljs.g
@@ -1,20 +1,18 @@
----------------------------------------------------------------------------
--
--- This file is part of Qt Creator
+-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+-- Contact: Qt Software Information (qt-info@nokia.com)
--
--- Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+-- This file is part of the QtDeclarative module of the Qt Toolkit.
--
--- Contact: Nokia Corporation (qt-info@nokia.com)
---
--- Commercial Usage
---
--- Licensees holding valid Qt Commercial licenses may use this file in
--- accordance with the Qt Commercial License Agreement provided with the
--- Software or, alternatively, in accordance with the terms contained in
--- a written agreement between you and Nokia.
+-- $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 either Technology Preview License Agreement or the
+-- Beta Release License Agreement.
--
-- 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
@@ -22,8 +20,25 @@
-- 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.0, included in the file LGPL_EXCEPTION.txt in this
+-- package.
+--
+-- GNU General Public License Usage
+-- Alternatively, this file may be used under the terms of the GNU
+-- General Public License version 3.0 as published by the Free Software
+-- Foundation and appearing in the file LICENSE.GPL included in the
+-- packaging of this file. Please review the following information to
+-- ensure the GNU General Public License version 3.0 requirements will be
+-- met: http://www.gnu.org/copyleft/gpl.html.
+--
-- If you are unsure which license is appropriate for your use, please
--- contact the sales department at http://qt.nokia.com/contact.
+-- contact the sales department at qt-sales@nokia.com.
+-- $QT_END_LICENSE$
+--
+-- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+-- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
--
----------------------------------------------------------------------------
@@ -85,23 +100,21 @@
%start TopLevel
/.
-/**************************************************************************
-**
-** This file is part of Qt Creator
+/****************************************************************************
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -109,12 +122,27 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#include <QtCore/QtDebug>
+#include <QtGui/QApplication>
#include <string.h>
@@ -126,23 +154,21 @@
./
/:
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+/****************************************************************************
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Commercial Usage
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -150,10 +176,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
//
// W A R N I N G
@@ -2920,7 +2960,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = QString::fromUtf8("Missing `;'");
+ //const QString msg = qApp->translate("QmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -2945,7 +2985,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -2973,7 +3013,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -2996,7 +3036,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -3009,7 +3049,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
}
- const QString msg = QString::fromUtf8("Syntax error");
+ const QString msg = qApp->translate("QmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/plugins/qmleditor/parser/qmljsast.cpp b/src/plugins/qmleditor/parser/qmljsast.cpp
index ec199e80ae..4c45bc89d9 100644
--- a/src/plugins/qmleditor/parser/qmljsast.cpp
+++ b/src/plugins/qmleditor/parser/qmljsast.cpp
@@ -1,20 +1,18 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#include "qmljsast_p.h"
#include "qmljsastvisitor_p.h"
diff --git a/src/plugins/qmleditor/parser/qmljsast_p.h b/src/plugins/qmleditor/parser/qmljsast_p.h
index 94a26096ee..ef8a66bd94 100644
--- a/src/plugins/qmleditor/parser/qmljsast_p.h
+++ b/src/plugins/qmleditor/parser/qmljsast_p.h
@@ -1,20 +1,18 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSAST_P_H
#define QMLJSAST_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsastfwd_p.h b/src/plugins/qmleditor/parser/qmljsastfwd_p.h
index dd164e9e3c..fcb97ad870 100644
--- a/src/plugins/qmleditor/parser/qmljsastfwd_p.h
+++ b/src/plugins/qmleditor/parser/qmljsastfwd_p.h
@@ -1,20 +1,18 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSAST_FWD_P_H
#define QMLJSAST_FWD_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp b/src/plugins/qmleditor/parser/qmljsastvisitor.cpp
index 6a0d55a4f1..642bcee26b 100644
--- a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp
+++ b/src/plugins/qmleditor/parser/qmljsastvisitor.cpp
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,14 +20,28 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#include "qmljsastvisitor_p.h"
-QT_QML_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
@@ -43,4 +55,4 @@ Visitor::~Visitor()
} } // namespace QmlJS::AST
-QT_QML_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/src/plugins/qmleditor/parser/qmljsastvisitor_p.h b/src/plugins/qmleditor/parser/qmljsastvisitor_p.h
index 09714ee0a0..eea492a057 100644
--- a/src/plugins/qmleditor/parser/qmljsastvisitor_p.h
+++ b/src/plugins/qmleditor/parser/qmljsastvisitor_p.h
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSASTVISITOR_P_H
#define QMLJSASTVISITOR_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsengine_p.cpp b/src/plugins/qmleditor/parser/qmljsengine_p.cpp
index 6e7a45a506..32068c0320 100644
--- a/src/plugins/qmleditor/parser/qmljsengine_p.cpp
+++ b/src/plugins/qmleditor/parser/qmljsengine_p.cpp
@@ -1,20 +1,18 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#include "qmljsglobal_p.h"
#include "qmljsengine_p.h"
@@ -152,7 +164,7 @@ double integerFromString(const char *buf, int size, int radix)
double integerFromString(const QString &str, int radix)
{
- QByteArray ba = str.trimmed().toUtf8();
+ QByteArray ba = str.trimmed().toLatin1();
return integerFromString(ba.constData(), ba.size(), radix);
}
diff --git a/src/plugins/qmleditor/parser/qmljsengine_p.h b/src/plugins/qmleditor/parser/qmljsengine_p.h
index 98e71c8879..8627a99024 100644
--- a/src/plugins/qmleditor/parser/qmljsengine_p.h
+++ b/src/plugins/qmleditor/parser/qmljsengine_p.h
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSENGINE_P_H
#define QMLJSENGINE_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsgrammar.cpp b/src/plugins/qmleditor/parser/qmljsgrammar.cpp
index 67f14032fa..da3ce2a077 100644
--- a/src/plugins/qmleditor/parser/qmljsgrammar.cpp
+++ b/src/plugins/qmleditor/parser/qmljsgrammar.cpp
@@ -2,8 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -11,8 +10,8 @@
** 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.
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,20 +21,21 @@
** 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.
-**
-**
-**
-**
-**
-**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljsgrammar_p.h b/src/plugins/qmleditor/parser/qmljsgrammar_p.h
index 7de77c03a0..b297f81cff 100644
--- a/src/plugins/qmleditor/parser/qmljsgrammar_p.h
+++ b/src/plugins/qmleditor/parser/qmljsgrammar_p.h
@@ -2,8 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -11,8 +10,8 @@
** 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.
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,20 +21,21 @@
** 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.
-**
-**
-**
-**
-**
-**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/plugins/qmleditor/parser/qmljslexer.cpp b/src/plugins/qmleditor/parser/qmljslexer.cpp
index a52ea7c089..2c03c21497 100644
--- a/src/plugins/qmleditor/parser/qmljslexer.cpp
+++ b/src/plugins/qmleditor/parser/qmljslexer.cpp
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,6 +48,8 @@
#include "qmljslexer_p.h"
#include "qmljsgrammar_p.h"
+#include <QtGui/qapplication.h>
+
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
@@ -536,7 +550,7 @@ int Lexer::lex()
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = QLatin1String("Illegal character");
+ errmsg = qApp->translate("QmlParser", "Illegal character");
}
}
break;
@@ -550,7 +564,7 @@ int Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = QLatin1String("Unclosed string at end of line");
+ errmsg = qApp->translate("QmlParser", "Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -576,7 +590,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = QLatin1String("Illegal escape squence");
+ errmsg = qApp->translate("QmlParser", "Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -622,7 +636,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = QLatin1String("Illegal unicode escape sequence");
+ errmsg = qApp->translate("QmlParser", "Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -648,7 +662,7 @@ int Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = QLatin1String("Unclosed comment at end of file");
+ errmsg = qApp->translate("QmlParser", "Unclosed comment at end of file");
driver->addComment(startpos, tokenLength(), startlineno, startcolumn);
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
@@ -735,7 +749,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = QLatin1String("Illegal syntax for exponential number");
+ errmsg = qApp->translate("QmlParser", "Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -761,7 +775,7 @@ int Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = QLatin1String("Identifier cannot start with numeric literal");
+ errmsg = qApp->translate("QmlParser", "Identifier cannot start with numeric literal");
}
// terminate string
@@ -855,11 +869,16 @@ bool Lexer::isLineTerminator() const
bool Lexer::isIdentLetter(ushort c)
{
- /* TODO: allow other legitimate unicode chars */
- return ((c >= 'a' && c <= 'z')
+ // ASCII-biased, since all reserved words are ASCII, aand hence the
+ // bulk of content to be parsed.
+ if ((c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| c == '$'
- || c == '_');
+ || c == '_')
+ return true;
+ if (c < 128)
+ return false;
+ return QChar(c).isLetterOrNumber();
}
bool Lexer::isDecimalDigit(ushort c)
@@ -1087,7 +1106,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = QLatin1String("Unterminated regular expression literal");
+ errmsg = qApp->translate("QmlParser", "Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -1111,7 +1130,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(current)) {
int flag = Ecma::RegExp::flagFromChar(current);
if (flag == 0) {
- errmsg = QString::fromLatin1("Invalid regular expression flag '%0'")
+ errmsg = qApp->translate("QmlParser", "Invalid regular expression flag '%0'")
.arg(QChar(current));
return false;
}
diff --git a/src/plugins/qmleditor/parser/qmljslexer_p.h b/src/plugins/qmleditor/parser/qmljslexer_p.h
index 1be466c3e6..50f7c4b279 100644
--- a/src/plugins/qmleditor/parser/qmljslexer_p.h
+++ b/src/plugins/qmleditor/parser/qmljslexer_p.h
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSLEXER_P_H
#define QMLJSLEXER_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsmemorypool_p.h b/src/plugins/qmleditor/parser/qmljsmemorypool_p.h
index 4b79f174fb..70e7737112 100644
--- a/src/plugins/qmleditor/parser/qmljsmemorypool_p.h
+++ b/src/plugins/qmleditor/parser/qmljsmemorypool_p.h
@@ -1,20 +1,18 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSMEMORYPOOL_P_H
#define QMLJSMEMORYPOOL_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsnodepool_p.h b/src/plugins/qmleditor/parser/qmljsnodepool_p.h
index ba0c3678ef..dfe3bac465 100644
--- a/src/plugins/qmleditor/parser/qmljsnodepool_p.h
+++ b/src/plugins/qmleditor/parser/qmljsnodepool_p.h
@@ -1,20 +1,18 @@
-/**************************************************************************
+/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtDeclarative module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -22,10 +20,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#ifndef QMLJSNODEPOOL_P_H
#define QMLJSNODEPOOL_P_H
diff --git a/src/plugins/qmleditor/parser/qmljsparser.cpp b/src/plugins/qmleditor/parser/qmljsparser.cpp
index f5fab00f4c..402aaeb395 100644
--- a/src/plugins/qmleditor/parser/qmljsparser.cpp
+++ b/src/plugins/qmleditor/parser/qmljsparser.cpp
@@ -2,21 +2,19 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -24,12 +22,27 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
#include <QtCore/QtDebug>
+#include <QtGui/QApplication>
#include <string.h>
@@ -1711,7 +1724,7 @@ case 337: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = QString::fromUtf8("Missing `;'");
+ //const QString msg = qApp->translate("QmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1736,7 +1749,7 @@ case 337: {
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1764,7 +1777,7 @@ case 337: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1787,7 +1800,7 @@ case 337: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1800,7 +1813,7 @@ case 337: {
}
}
- const QString msg = QString::fromUtf8("Syntax error");
+ const QString msg = qApp->translate("QmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/plugins/qmleditor/parser/qmljsparser_p.h b/src/plugins/qmleditor/parser/qmljsparser_p.h
index 7ee69a57d5..b35bec32b3 100644
--- a/src/plugins/qmleditor/parser/qmljsparser_p.h
+++ b/src/plugins/qmleditor/parser/qmljsparser_p.h
@@ -2,21 +2,19 @@
/****************************************************************************
**
-** This file is part of Qt Creator
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** This file is part of the QtScript module of the Qt Toolkit.
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** 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
@@ -24,10 +22,24 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
-**************************************************************************/
+****************************************************************************/
//
// W A R N I N G
diff --git a/src/plugins/qmleditor/qmleditor.pro b/src/plugins/qmleditor/qmleditor.pro
index 3dfa9367bc..8f71e4ffc6 100644
--- a/src/plugins/qmleditor/qmleditor.pro
+++ b/src/plugins/qmleditor/qmleditor.pro
@@ -46,3 +46,4 @@ SOURCES += qmleditor.cpp \
qmlsymbol.cpp \
qmlfilewizard.cpp
RESOURCES += qmleditor.qrc
+OTHER_FILES += QmlEditor.pluginspec
diff --git a/src/plugins/qmleditor/qmleditor_dependencies.pri b/src/plugins/qmleditor/qmleditor_dependencies.pri
index 6163cfc764..885ef8bc1e 100644
--- a/src/plugins/qmleditor/qmleditor_dependencies.pri
+++ b/src/plugins/qmleditor/qmleditor_dependencies.pri
@@ -1,5 +1,6 @@
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
+include(../../plugins/help/help.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
include(../../shared/indenter/indenter.pri)
diff --git a/src/plugins/qmleditor/qmleditorplugin.cpp b/src/plugins/qmleditor/qmleditorplugin.cpp
index 466fef432c..e0bfedc94d 100644
--- a/src/plugins/qmleditor/qmleditorplugin.cpp
+++ b/src/plugins/qmleditor/qmleditorplugin.cpp
@@ -51,11 +51,14 @@
#include <texteditor/textfilewizard.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/completionsupport.h>
+#include <help/helpplugin.h>
#include <utils/qtcassert.h>
#include <QtCore/QtPlugin>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
+#include <QtCore/QDir>
+#include <QtCore/QCoreApplication>
#include <QtGui/QAction>
using namespace QmlEditor;
@@ -132,6 +135,27 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
void QmlEditorPlugin::extensionsInitialized()
{
+ //
+ // Explicitly register qml.qch if located in creator directory.
+ //
+ // This is only needed for the creator-qml package, were we
+ // want to ship the documentation without a qt development version.
+ //
+
+ ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
+ Help::HelpManager *helpManager = pluginManager->getObject<Help::HelpManager>();
+
+ Q_ASSERT(helpManager);
+
+ const QString qmlHelpFile =
+ QDir::cleanPath(QCoreApplication::applicationDirPath()
+#if defined(Q_OS_MAC)
+ + QLatin1String("/../Resources/doc/qml.qch"));
+#else
+ + QLatin1String("../../share/doc/qtcreator/qml.qch"));
+#endif
+
+ helpManager->registerDocumentation(QStringList(qmlHelpFile));
}
void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::ScriptEditor *editor)
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 4e891641d1..43707de1ad 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -338,7 +338,12 @@ QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro)
{
setName(tr("QML Viewer"));
- m_qmlViewer = Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer"));
+ // append creator/bin dir to search path (only useful for special creator-qml package)
+ const QString searchPath = QString(qgetenv("PATH"))
+ + Utils::SynchronousProcess::pathSeparator()
+ + QCoreApplication::applicationDirPath()
+;
+ m_qmlViewer = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
}
QmlRunConfiguration::~QmlRunConfiguration()
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
index 836db091a9..5d21971a35 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
@@ -42,7 +42,6 @@
#include <texteditor/texteditoractionhandler.h>
#include <QtCore/QtPlugin>
-#include <QtCore/QDebug>
using namespace QmlProjectManager;
using namespace QmlProjectManager::Internal;
diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
index dca4ab1193..a85023a240 100644
--- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
+++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
@@ -33,6 +33,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
+#include <utils/pathchooser.h>
+
#include <extensionsystem/pluginmanager.h>
#include <help/helpplugin.h>
@@ -42,8 +44,12 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
+#include <QtCore/QSettings>
#include <QtCore/QXmlStreamReader>
+#include <QtGui/QDialogButtonBox>
#include <QtGui/QFont>
+#include <QtGui/QMessageBox>
+#include <QtGui/QPushButton>
namespace Qt4ProjectManager {
namespace Internal {
@@ -159,17 +165,92 @@ void GettingStartedWelcomePageWidget::slotEnableExampleButton(int index)
ui->openExampleButton->setEnabled(!fileName.isEmpty());
}
+namespace {
+void copyRecursive(const QDir& from, const QDir& to, const QString& dir)
+{
+ QDir dest(to);
+ dest.mkdir(dir);
+ dest.cd(dir);
+ QDir src(from);
+ src.cd(dir);
+ foreach(const QFileInfo& roFile, src.entryInfoList(QDir::Files)) {
+ QFile::copy(roFile.absoluteFilePath(), dest.absolutePath() + '/' + roFile.fileName());
+ }
+ foreach(const QString& roDir, src.entryList(QDir::NoDotAndDotDot|QDir::Dirs)) {
+ copyRecursive(src, dest, QDir(roDir).dirName());
+ }
+}
+} // namespace
+
void GettingStartedWelcomePageWidget::slotOpenExample()
{
QComboBox *box = ui->examplesComboBox;
QString proFile = box->itemData(box->currentIndex(), Qt::UserRole).toString();
QString helpFile = box->itemData(box->currentIndex(), Qt::UserRole + 1).toString();
QStringList files;
- QFileInfo fi(proFile);
- QString tryFile = fi.path() + "/main.cpp";
+ QFileInfo proFileInfo(proFile);
+ // If the Qt is a distro Qt on Linux, it will not be writable, hence compilation will fail
+ if (!proFileInfo.isWritable())
+ {
+ QDialog d;
+ QGridLayout *lay = new QGridLayout(&d);
+ QLabel *descrLbl = new QLabel;
+ d.setWindowTitle(tr("Copy Project to writable Location?"));
+ descrLbl->setTextFormat(Qt::RichText);
+ descrLbl->setWordWrap(true);
+ descrLbl->setText(tr("<p>The project you are about to open is located in the "
+ "write-protected location:</p><blockquote>%1</blockquote>"
+ "<p>Please select a writable location below and click \"Copy Project and Open\" "
+ "to open a modifiable copy of the project or click \"Keep Project and Open\" "
+ "to open the project in location.</p><p><b>Note:</b> You will not "
+ "be able to alter or compile your project in the current location.</p>")
+ .arg(QDir::toNativeSeparators(proFileInfo.dir().absolutePath())));
+ lay->addWidget(descrLbl, 0, 0, 1, 2);
+ QLabel *txt = new QLabel(tr("&Location:"));
+ Utils::PathChooser *chooser = new Utils::PathChooser;
+ txt->setBuddy(chooser);
+ chooser->setExpectedKind(Utils::PathChooser::Directory);
+ QSettings *settings = Core::ICore::instance()->settings();
+ chooser->setPath(settings->value(
+ QString::fromLatin1("General/ProjectsFallbackRoot"), QDir::homePath()).toString());
+ lay->addWidget(txt, 1, 0);
+ lay->addWidget(chooser, 1, 1);
+ QDialogButtonBox *bb = new QDialogButtonBox;
+ connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
+ connect(bb, SIGNAL(rejected()), &d, SLOT(reject()));
+ QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole);
+ copyBtn->setDefault(true);
+ bb->addButton(tr("&Keep Project and Open"), QDialogButtonBox::RejectRole);
+ lay->addWidget(bb, 2, 0, 1, 2);
+ connect(chooser, SIGNAL(validChanged(bool)), copyBtn, SLOT(setEnabled(bool)));
+ if (d.exec() == QDialog::Accepted) {
+ QString exampleDirName = proFileInfo.dir().dirName();
+ QString toDir = chooser->path();
+ settings->setValue(QString::fromLatin1("General/ProjectsFallbackRoot"), toDir);
+ QDir toDirWithExamplesDir(toDir);
+ if (toDirWithExamplesDir.cd(exampleDirName)) {
+ toDirWithExamplesDir.cdUp(); // step out, just to not be in the way
+ QMessageBox::warning(topLevelWidget(), tr("Warning"),
+ tr("The specified location already exists. "
+ "Please specify a valid location."),
+ QMessageBox::Ok, QMessageBox::NoButton);
+ return;
+ } else {
+ QDir from = proFileInfo.dir();
+ from.cdUp();
+ copyRecursive(from, toDir, exampleDirName);
+ // set vars to new location
+ proFileInfo = QFileInfo(toDir + '/'+ exampleDirName + '/' + proFileInfo.fileName());
+ proFile = proFileInfo.absoluteFilePath();
+ }
+ }
+ }
+
+
+ QString tryFile = proFileInfo.path() + "/main.cpp";
files << proFile;
if(!QFile::exists(tryFile))
- tryFile = fi.path() + '/' + fi.baseName() + ".cpp";
+ tryFile = proFileInfo.path() + '/' + proFileInfo.baseName() + ".cpp";
if(QFile::exists(tryFile))
files << tryFile;
Core::ICore::instance()->openFiles(files);
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
index d666321692..c1f2e85765 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
+++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
@@ -8,8 +8,11 @@
$$PWD/gccetoolchain.cpp \
$$PWD/s60emulatorrunconfiguration.cpp \
$$PWD/s60devicerunconfiguration.cpp \
+ $$PWD/s60devicerunconfigurationwidget.cpp \
$$PWD/serialdevicelister.cpp \
- $$PWD/rvcttoolchain.cpp
+ $$PWD/rvcttoolchain.cpp \
+ $$PWD/s60runconfigbluetoothstarter.cpp
+
HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h \
@@ -17,8 +20,11 @@
$$PWD/gccetoolchain.h \
$$PWD/s60emulatorrunconfiguration.h \
$$PWD/s60devicerunconfiguration.h \
+ $$PWD/s60devicerunconfigurationwidget.h \
$$PWD/serialdevicelister.h \
- $$PWD/rvcttoolchain.h
+ $$PWD/rvcttoolchain.h \
+ $$PWD/s60runconfigbluetoothstarter.h
+
FORMS += $$PWD/s60devicespreferencepane.ui
OTHER_FILES += $$PWD/qt-s60-todo.txt
include(../../../shared/trk/trk.pri)||error("could not include trk.pri")
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index 43606da69f..d547c3b6d8 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -28,12 +28,14 @@
**************************************************************************/
#include "s60devicerunconfiguration.h"
-
+#include "s60devicerunconfigurationwidget.h"
#include "qt4project.h"
#include "qtversionmanager.h"
#include "profilereader.h"
#include "s60manager.h"
#include "s60devices.h"
+#include "s60runconfigbluetoothstarter.h"
+#include "bluetoothlistener_gui.h"
#include "serialdevicelister.h"
#include <coreplugin/icore.h>
@@ -48,11 +50,6 @@
#include <debugger/debuggermanager.h>
-#include <QtGui/QRadioButton>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QComboBox>
-
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
@@ -65,12 +62,19 @@ static QString lsFile(const QString &f)
str << fi.size() << ' ' << fi.lastModified().toString(Qt::ISODate) << ' ' << QDir::toNativeSeparators(fi.absoluteFilePath());
return rc;
}
+
// ======== S60DeviceRunConfiguration
S60DeviceRunConfiguration::S60DeviceRunConfiguration(Project *project, const QString &proFilePath)
: RunConfiguration(project),
m_proFilePath(proFilePath),
m_cachedTargetInformationValid(false),
- m_serialPortName("COM5"),
+#ifdef Q_OS_WIN
+ m_serialPortName(QLatin1String("COM5")),
+ m_communicationType(SerialPortCommunication),
+#else
+ m_serialPortName(QLatin1String(SerialDeviceLister::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
+ m_communicationType(BlueToothCommunication),
+#endif
m_signingMode(SignSelf)
{
if (!m_proFilePath.isEmpty())
@@ -120,6 +124,7 @@ void S60DeviceRunConfiguration::save(PersistentSettingsWriter &writer) const
writer.saveValue("CustomSignaturePath", m_customSignaturePath);
writer.saveValue("CustomKeyPath", m_customKeyPath);
writer.saveValue("SerialPortName", m_serialPortName);
+ writer.saveValue("CommunicationType", m_communicationType);
RunConfiguration::save(writer);
}
@@ -132,6 +137,7 @@ void S60DeviceRunConfiguration::restore(const PersistentSettingsReader &reader)
m_customSignaturePath = reader.restoreValue("CustomSignaturePath").toString();
m_customKeyPath = reader.restoreValue("CustomKeyPath").toString();
m_serialPortName = reader.restoreValue("SerialPortName").toString().trimmed();
+ m_communicationType = reader.restoreValue("CommunicationType").toInt();
}
QString S60DeviceRunConfiguration::serialPortName() const
@@ -144,6 +150,16 @@ void S60DeviceRunConfiguration::setSerialPortName(const QString &name)
m_serialPortName = name.trimmed();
}
+int S60DeviceRunConfiguration::communicationType() const
+{
+ return m_communicationType;
+}
+
+void S60DeviceRunConfiguration::setCommunicationType(int t)
+{
+ m_communicationType = t;
+}
+
QString S60DeviceRunConfiguration::targetName() const
{
const_cast<S60DeviceRunConfiguration *>(this)->updateTarget();
@@ -313,139 +329,6 @@ void S60DeviceRunConfiguration::invalidateCachedTargetInformation()
emit targetInformationChanged();
}
-// ======== S60DeviceRunConfigurationWidget
-
-S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
- S60DeviceRunConfiguration *runConfiguration,
- QWidget *parent)
- : QWidget(parent),
- m_runConfiguration(runConfiguration)
-{
- QVBoxLayout *mainBoxLayout = new QVBoxLayout();
- mainBoxLayout->setMargin(0);
- setLayout(mainBoxLayout);
- QFormLayout *formLayout = new QFormLayout();
- formLayout->setMargin(0);
- mainBoxLayout->addLayout(formLayout);
-
- QLabel *nameLabel = new QLabel(tr("Name:"));
- m_nameLineEdit = new QLineEdit(m_runConfiguration->name());
- nameLabel->setBuddy(m_nameLineEdit);
- formLayout->addRow(nameLabel, m_nameLineEdit);
-
- m_sisxFileLabel = new QLabel(m_runConfiguration->basePackageFilePath() + ".sisx");
- formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
-
- m_serialPorts = new QComboBox;
- updateSerialDevices();
- connect(S60Manager::instance()->serialDeviceLister(), SIGNAL(updated()),
- this, SLOT(updateSerialDevices()));
- connect(m_serialPorts, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
- formLayout->addRow(tr("Device on Serial Port:"), m_serialPorts);
-
- QWidget *signatureWidget = new QWidget();
- QVBoxLayout *layout = new QVBoxLayout();
- signatureWidget->setLayout(layout);
- mainBoxLayout->addWidget(signatureWidget);
- QRadioButton *selfSign = new QRadioButton(tr("Self-signed certificate"));
- QHBoxLayout *customHBox = new QHBoxLayout();
- customHBox->setMargin(0);
- QVBoxLayout *radioLayout = new QVBoxLayout();
- QRadioButton *customSignature = new QRadioButton();
- radioLayout->addWidget(customSignature);
- radioLayout->addStretch(10);
- customHBox->addLayout(radioLayout);
- QFormLayout *customLayout = new QFormLayout();
- customLayout->setMargin(0);
- customLayout->setLabelAlignment(Qt::AlignRight);
- Utils::PathChooser *signaturePath = new Utils::PathChooser();
- signaturePath->setExpectedKind(Utils::PathChooser::File);
- signaturePath->setPromptDialogTitle(tr("Choose certificate file (.cer)"));
- customLayout->addRow(new QLabel(tr("Custom certificate:")), signaturePath);
- Utils::PathChooser *keyPath = new Utils::PathChooser();
- keyPath->setExpectedKind(Utils::PathChooser::File);
- keyPath->setPromptDialogTitle(tr("Choose key file (.key / .pem)"));
- customLayout->addRow(new QLabel(tr("Key file:")), keyPath);
- customHBox->addLayout(customLayout);
- customHBox->addStretch(10);
- layout->addWidget(selfSign);
- layout->addLayout(customHBox);
- layout->addStretch(10);
-
- switch (m_runConfiguration->signingMode()) {
- case S60DeviceRunConfiguration::SignSelf:
- selfSign->setChecked(true);
- break;
- case S60DeviceRunConfiguration::SignCustom:
- customSignature->setChecked(true);
- break;
- }
-
- signaturePath->setPath(m_runConfiguration->customSignaturePath());
- keyPath->setPath(m_runConfiguration->customKeyPath());
-
- connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
- this, SLOT(nameEdited(QString)));
- connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
- this, SLOT(updateTargetInformation()));
- connect(selfSign, SIGNAL(toggled(bool)), this, SLOT(selfSignToggled(bool)));
- connect(customSignature, SIGNAL(toggled(bool)), this, SLOT(customSignatureToggled(bool)));
- connect(signaturePath, SIGNAL(changed(QString)), this, SLOT(signaturePathChanged(QString)));
- connect(keyPath, SIGNAL(changed(QString)), this, SLOT(keyPathChanged(QString)));
-}
-
-void S60DeviceRunConfigurationWidget::updateSerialDevices()
-{
- m_serialPorts->clear();
- QString runConfigurationPortName = m_runConfiguration->serialPortName();
- QList<SerialDeviceLister::SerialDevice> serialDevices = S60Manager::instance()->serialDeviceLister()->serialDevices();
- for (int i = 0; i < serialDevices.size(); ++i) {
- const SerialDeviceLister::SerialDevice &device = serialDevices.at(i);
- m_serialPorts->addItem(device.friendlyName, device.portName);
- if (device.portName == runConfigurationPortName)
- m_serialPorts->setCurrentIndex(i);
- }
- QString selectedPortName = m_serialPorts->itemData(m_serialPorts->currentIndex()).toString();
- if (m_serialPorts->count() > 0 && runConfigurationPortName != selectedPortName)
- m_runConfiguration->setSerialPortName(selectedPortName);
-}
-
-void S60DeviceRunConfigurationWidget::nameEdited(const QString &text)
-{
- m_runConfiguration->setName(text);
-}
-
-void S60DeviceRunConfigurationWidget::updateTargetInformation()
-{
- m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + ".sisx");
-}
-
-void S60DeviceRunConfigurationWidget::setSerialPort(int index)
-{
- m_runConfiguration->setSerialPortName(m_serialPorts->itemData(index).toString());
-}
-
-void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
-{
- if (toggle)
- m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignSelf);
-}
-
-void S60DeviceRunConfigurationWidget::customSignatureToggled(bool toggle)
-{
- if (toggle)
- m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignCustom);
-}
-
-void S60DeviceRunConfigurationWidget::signaturePathChanged(const QString &path)
-{
- m_runConfiguration->setCustomSignaturePath(path);
-}
-
-void S60DeviceRunConfigurationWidget::keyPathChanged(const QString &path)
-{
- m_runConfiguration->setCustomKeyPath(path);
-}
// ======== S60DeviceRunConfigurationFactory
@@ -532,6 +415,7 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(const QSharedPointer<RunConfigu
m_serialPortName = s60runConfig->serialPortName();
m_serialPortFriendlyName = S60Manager::instance()->serialDeviceLister()->friendlyNameForPort(m_serialPortName);
+ m_communicationType = s60runConfig->communicationType();
m_targetName = s60runConfig->targetName();
m_baseFileName = s60runConfig->basePackageFilePath();
m_symbianPlatform = s60runConfig->symbianPlatform();
@@ -551,6 +435,14 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(const QSharedPointer<RunConfigu
m_packageFile = QFileInfo(m_packageFilePath).fileName();
}
+S60DeviceRunControlBase::~S60DeviceRunControlBase()
+{
+ if (m_launcher) {
+ m_launcher->deleteLater();
+ m_launcher = 0;
+ }
+}
+
void S60DeviceRunControlBase::start()
{
emit started();
@@ -681,6 +573,7 @@ void S60DeviceRunControlBase::signsisProcessFinished()
//TODO sisx destination and file path user definable
m_launcher->setTrkServerName(m_serialPortName);
+ m_launcher->setSerialFrame(m_communicationType == SerialPortCommunication);
const QString copySrc(m_baseFileName + ".sisx");
const QString copyDst = QString("C:\\Data\\%1.sisx").arg(QFileInfo(m_baseFileName).fileName());
const QString runFileName = QString("C:\\sys\\bin\\%1.exe").arg(m_targetName);
@@ -689,6 +582,21 @@ void S60DeviceRunControlBase::signsisProcessFinished()
initLauncher(runFileName, m_launcher);
emit addToOutputWindow(this, tr("Package: %1\nDeploying application to '%2'...").arg(lsFile(copySrc), m_serialPortFriendlyName));
QString errorMessage;
+ // Prompt the user to start up the Blue tooth connection
+ if (m_communicationType == BlueToothCommunication) {
+ S60RunConfigBluetoothStarter starter(m_launcher->trkDevice());
+ switch (trk::startBluetoothGui(starter, 0, &errorMessage)) {
+ case trk::BluetoothGuiConnected:
+ break;
+ case trk::BluetoothGuiCanceled:
+ case trk::BluetoothGuiError:
+ delete m_launcher;
+ m_launcher = 0;
+ error(this, errorMessage);
+ emit finished();
+ return;
+ };
+ }
if (!m_launcher->startServer(&errorMessage)) {
delete m_launcher;
m_launcher = 0;
@@ -828,6 +736,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(const QSharedPointer<ProjectE
Qt::QueuedConnection);
m_startParams->remoteChannel = rc->serialPortName();
+ m_startParams->remoteChannelType = rc->communicationType();
m_startParams->startMode = Debugger::StartInternal;
m_startParams->toolChainType = rc->toolChainType();
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
index 775804cb20..444e8855f6 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
@@ -35,16 +35,8 @@
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/toolchain.h>
-#include <QtGui/QWidget>
-
#include <QtCore/QProcess>
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QLineEdit;
-class QComboBox;
-QT_END_NAMESPACE
-
namespace Debugger {
class DebuggerStartParameters;
}
@@ -72,6 +64,10 @@ public:
QString serialPortName() const;
void setSerialPortName(const QString &name);
+ // See SerialDeviceListener
+ int communicationType() const;
+ void setCommunicationType(int t);
+
QString targetName() const;
QString basePackageFilePath() const;
QString symbianPlatform() const;
@@ -106,35 +102,12 @@ private:
QString m_packageTemplateFileName;
bool m_cachedTargetInformationValid;
QString m_serialPortName;
- SigningMode m_signingMode;
+ int m_communicationType;
+ SigningMode m_signingMode;
QString m_customSignaturePath;
QString m_customKeyPath;
};
-class S60DeviceRunConfigurationWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit S60DeviceRunConfigurationWidget(S60DeviceRunConfiguration *runConfiguration,
- QWidget *parent = 0);
-
-private slots:
- void nameEdited(const QString &text);
- void updateTargetInformation();
- void updateSerialDevices();
- void setSerialPort(int index);
- void selfSignToggled(bool toggle);
- void customSignatureToggled(bool toggle);
- void signaturePathChanged(const QString &path);
- void keyPathChanged(const QString &path);
-
-private:
- S60DeviceRunConfiguration *m_runConfiguration;
- QComboBox *m_serialPorts;
- QLineEdit *m_nameLineEdit;
- QLabel *m_sisxFileLabel;
-};
-
class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
Q_OBJECT
@@ -156,7 +129,7 @@ class S60DeviceRunControlBase : public ProjectExplorer::RunControl
Q_OBJECT
public:
explicit S60DeviceRunControlBase(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
- ~S60DeviceRunControlBase() {}
+ ~S60DeviceRunControlBase();
virtual void start();
virtual void stop();
virtual bool isRunning() const;
@@ -195,6 +168,7 @@ private:
QString m_serialPortName;
QString m_serialPortFriendlyName;
+ int m_communicationType;
QString m_targetName;
QString m_baseFileName;
QString m_symbianPlatform;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp
new file mode 100644
index 0000000000..0b1554b1ba
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp
@@ -0,0 +1,351 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "s60devicerunconfigurationwidget.h"
+#include "s60devicerunconfiguration.h"
+#include "s60runconfigbluetoothstarter.h"
+#include "bluetoothlistener_gui.h"
+#include "s60manager.h"
+#include "launcher.h"
+#include "bluetoothlistener.h"
+#include "bluetoothlistener_gui.h"
+#include "serialdevicelister.h"
+
+#include <utils/detailswidget.h>
+#include <utils/qtcassert.h>
+#include <utils/pathchooser.h>
+
+#include <QtCore/QTimer>
+#include <QtGui/QRadioButton>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+#include <QtGui/QComboBox>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QFormLayout>
+#include <QtGui/QToolButton>
+#include <QtGui/QStyle>
+#include <QtGui/QApplication>
+#include <QtGui/QSpacerItem>
+
+Q_DECLARE_METATYPE(Qt4ProjectManager::Internal::CommunicationDevice)
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
+ S60DeviceRunConfiguration *runConfiguration,
+ QWidget *parent)
+ : QWidget(parent),
+ m_runConfiguration(runConfiguration),
+ m_detailsWidget(new Utils::DetailsWidget),
+ m_serialPortsCombo(new QComboBox),
+ m_nameLineEdit(new QLineEdit(m_runConfiguration->name())),
+ m_sisxFileLabel(new QLabel(m_runConfiguration->basePackageFilePath() + QLatin1String(".sisx"))),
+ m_deviceInfoButton(new QToolButton),
+ m_deviceInfoDescriptionLabel(new QLabel(tr("Device:"))),
+ m_deviceInfoLabel(new QLabel),
+ m_infoTimeOutTimer(0)
+{
+ QVBoxLayout *mainBoxLayout = new QVBoxLayout();
+ mainBoxLayout->setMargin(0);
+ setLayout(mainBoxLayout);
+ mainBoxLayout->addWidget(m_detailsWidget);
+ QWidget *detailsContainer = new QWidget;
+ m_detailsWidget->setWidget(detailsContainer);
+
+ QVBoxLayout *detailsBoxLayout = new QVBoxLayout();
+ detailsBoxLayout->setMargin(0);
+ detailsContainer->setLayout(detailsBoxLayout);
+
+ QFormLayout *formLayout = new QFormLayout();
+ formLayout->setMargin(0);
+ detailsBoxLayout->addLayout(formLayout);
+ // Name control
+ QLabel *nameLabel = new QLabel(tr("Name:"));
+ nameLabel->setBuddy(m_nameLineEdit);
+ formLayout->addRow(nameLabel, m_nameLineEdit);
+ formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
+
+ updateSerialDevices();
+ connect(S60Manager::instance()->serialDeviceLister(), SIGNAL(updated()),
+ this, SLOT(updateSerialDevices()));
+ // Serial devices control
+ connect(m_serialPortsCombo, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
+ QHBoxLayout *serialPortHBoxLayout = new QHBoxLayout;
+ serialPortHBoxLayout->addWidget(m_serialPortsCombo);
+ serialPortHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
+
+ formLayout->addRow(tr("Device on Serial Port:"), serialPortHBoxLayout);
+
+ // Device Info with button. Widgets are enabled in above call to updateSerialDevices()
+ QHBoxLayout *infoHBoxLayout = new QHBoxLayout;
+ m_deviceInfoLabel->setWordWrap(true);
+ m_deviceInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ infoHBoxLayout->addWidget(m_deviceInfoLabel);
+ infoHBoxLayout->addWidget(m_deviceInfoButton);
+ m_deviceInfoButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation));
+ m_deviceInfoButton->setToolTip(tr("Queries the device for information"));
+ connect(m_deviceInfoButton, SIGNAL(clicked()), this, SLOT(updateDeviceInfo()));
+ formLayout->addRow(m_deviceInfoDescriptionLabel, infoHBoxLayout);
+
+ // Signature/certificate stuff.
+ QWidget *signatureWidget = new QWidget();
+ QVBoxLayout *layout = new QVBoxLayout();
+ signatureWidget->setLayout(layout);
+ detailsBoxLayout->addWidget(signatureWidget);
+ QRadioButton *selfSign = new QRadioButton(tr("Self-signed certificate"));
+ QHBoxLayout *customHBox = new QHBoxLayout();
+ customHBox->setMargin(0);
+ QVBoxLayout *radioLayout = new QVBoxLayout();
+ QRadioButton *customSignature = new QRadioButton();
+ radioLayout->addWidget(customSignature);
+ radioLayout->addStretch(10);
+ customHBox->addLayout(radioLayout);
+ QFormLayout *customLayout = new QFormLayout();
+ customLayout->setMargin(0);
+ customLayout->setLabelAlignment(Qt::AlignRight);
+ Utils::PathChooser *signaturePath = new Utils::PathChooser();
+ signaturePath->setExpectedKind(Utils::PathChooser::File);
+ signaturePath->setPromptDialogTitle(tr("Choose certificate file (.cer)"));
+ customLayout->addRow(new QLabel(tr("Custom certificate:")), signaturePath);
+ Utils::PathChooser *keyPath = new Utils::PathChooser();
+ keyPath->setExpectedKind(Utils::PathChooser::File);
+ keyPath->setPromptDialogTitle(tr("Choose key file (.key / .pem)"));
+ customLayout->addRow(new QLabel(tr("Key file:")), keyPath);
+ customHBox->addLayout(customLayout);
+ customHBox->addStretch(10);
+ layout->addWidget(selfSign);
+ layout->addLayout(customHBox);
+ layout->addStretch(10);
+
+ switch (m_runConfiguration->signingMode()) {
+ case S60DeviceRunConfiguration::SignSelf:
+ selfSign->setChecked(true);
+ break;
+ case S60DeviceRunConfiguration::SignCustom:
+ customSignature->setChecked(true);
+ break;
+ }
+
+ signaturePath->setPath(m_runConfiguration->customSignaturePath());
+ keyPath->setPath(m_runConfiguration->customKeyPath());
+
+ connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
+ this, SLOT(nameEdited(QString)));
+ connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
+ this, SLOT(updateTargetInformation()));
+ connect(selfSign, SIGNAL(toggled(bool)), this, SLOT(selfSignToggled(bool)));
+ connect(customSignature, SIGNAL(toggled(bool)), this, SLOT(customSignatureToggled(bool)));
+ connect(signaturePath, SIGNAL(changed(QString)), this, SLOT(signaturePathChanged(QString)));
+ connect(keyPath, SIGNAL(changed(QString)), this, SLOT(keyPathChanged(QString)));
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::updateSerialDevices()
+{
+ m_serialPortsCombo->clear();
+ clearDeviceInfo();
+ const QString previousRunConfigurationPortName = m_runConfiguration->serialPortName();
+ const QList<CommunicationDevice> devices = S60Manager::instance()->serialDeviceLister()->communicationDevices();
+ int newIndex = -1;
+ for (int i = 0; i < devices.size(); ++i) {
+ const CommunicationDevice &device = devices.at(i);
+ m_serialPortsCombo->addItem(device.friendlyName, qVariantFromValue(device));
+ if (device.portName == previousRunConfigurationPortName)
+ newIndex = i;
+ }
+ // Set new index: prefer to keep old or set to 0, if available.
+ if (newIndex == -1 && !devices.empty())
+ newIndex = 0;
+ m_serialPortsCombo->setCurrentIndex(newIndex);
+ if (newIndex == -1) {
+ m_deviceInfoButton->setEnabled(false);
+ m_runConfiguration->setSerialPortName(QString());
+ } else {
+ m_deviceInfoButton->setEnabled(true);
+ const QString newPortName = device(newIndex).portName;
+ if (newPortName != previousRunConfigurationPortName)
+ m_runConfiguration->setSerialPortName(newPortName);
+ }
+}
+
+CommunicationDevice S60DeviceRunConfigurationWidget::device(int i) const
+{
+ if (i >= 0) {
+ const QVariant data = m_serialPortsCombo->itemData(i);
+ if (qVariantCanConvert<Qt4ProjectManager::Internal::CommunicationDevice>(data))
+ return qVariantValue<Qt4ProjectManager::Internal::CommunicationDevice>(data);
+ }
+ return CommunicationDevice(SerialPortCommunication);
+}
+
+CommunicationDevice S60DeviceRunConfigurationWidget::currentDevice() const
+{
+ return device(m_serialPortsCombo->currentIndex());
+}
+
+void S60DeviceRunConfigurationWidget::nameEdited(const QString &text)
+{
+ m_runConfiguration->setName(text);
+}
+
+void S60DeviceRunConfigurationWidget::updateTargetInformation()
+{
+ m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + QLatin1String(".sisx"));
+}
+
+void S60DeviceRunConfigurationWidget::setSerialPort(int index)
+{
+ const CommunicationDevice d = device(index);
+ m_runConfiguration->setSerialPortName(d.portName);
+ m_runConfiguration->setCommunicationType(d.type);
+ m_deviceInfoButton->setEnabled(index >= 0);
+ clearDeviceInfo();
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
+{
+ if (toggle)
+ m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignSelf);
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::customSignatureToggled(bool toggle)
+{
+ if (toggle)
+ m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignCustom);
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::signaturePathChanged(const QString &path)
+{
+ m_runConfiguration->setCustomSignaturePath(path);
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::keyPathChanged(const QString &path)
+{
+ m_runConfiguration->setCustomKeyPath(path);
+ updateSummary();
+}
+
+void S60DeviceRunConfigurationWidget::updateSummary()
+{
+ //: Summary text of S60 device run configuration
+ const QString device = m_serialPortsCombo->currentIndex() != -1 ?
+ m_serialPortsCombo->currentText() :
+ tr("<No Device>");
+ const QString signature = m_runConfiguration->signingMode() == S60DeviceRunConfiguration::SignCustom ?
+ tr("(custom certificate)") :
+ tr("(self-signed certificate)");
+ m_detailsWidget->setSummaryText(tr("Summary: Run on '%1' %2").arg(device, signature));
+}
+
+void S60DeviceRunConfigurationWidget::clearDeviceInfo()
+{
+ // Restore text & color
+ m_deviceInfoLabel->clear();
+ m_deviceInfoLabel->setStyleSheet(QString());
+}
+
+void S60DeviceRunConfigurationWidget::setDeviceInfoLabel(const QString &message, bool isError)
+{
+ m_deviceInfoLabel->setStyleSheet(isError ?
+ QString(QLatin1String("background-color: red;")) :
+ QString());
+ m_deviceInfoLabel->setText(message);
+ m_deviceInfoLabel->adjustSize();
+}
+
+void S60DeviceRunConfigurationWidget::updateDeviceInfo()
+{
+ QString message;
+ setDeviceInfoLabel(tr("Connecting..."));
+ const bool ok = getDeviceInfo(&message);
+ setDeviceInfoLabel(message, !ok);
+}
+
+bool S60DeviceRunConfigurationWidget::getDeviceInfo(QString *message)
+{
+ message->clear();
+ // Do a launcher run with the ping protocol. Instantiate launcher on heap
+ // as not to introduce delays when destructing a device with timeout
+ trk::Launcher *launcher = new trk::Launcher(trk::Launcher::ActionPingOnly, QSharedPointer<trk::TrkDevice>(), this);
+ const CommunicationDevice commDev = currentDevice();
+ launcher->setSerialFrame(commDev.type == SerialPortCommunication);
+ launcher->setTrkServerName(commDev.portName);
+ // Prompt the user to start
+ if (commDev.type == BlueToothCommunication) {
+ S60RunConfigBluetoothStarter starter(launcher->trkDevice());
+ starter.setDevice(launcher->trkServerName());
+ const trk::StartBluetoothGuiResult src = trk::startBluetoothGui(starter, this, message);
+ switch (src) {
+ case trk::BluetoothGuiConnected:
+ break;
+ case trk::BluetoothGuiCanceled:
+ launcher->deleteLater();
+ return true;
+ case trk::BluetoothGuiError:
+ launcher->deleteLater();
+ return false;
+ };
+ }
+ if (!launcher->startServer(message)) {
+ launcher->deleteLater();
+ return false;
+ }
+ // Set up event loop in the foreground with a timer to quit in case of timeout.
+ QEventLoop eventLoop;
+ if (!m_infoTimeOutTimer) {
+ m_infoTimeOutTimer = new QTimer(this);
+ m_infoTimeOutTimer->setInterval(3000);
+ m_infoTimeOutTimer->setSingleShot(true);
+ }
+ connect(m_infoTimeOutTimer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+ connect(launcher, SIGNAL(finished()), &eventLoop, SLOT(quit()));
+ // Go!
+ QApplication::setOverrideCursor(Qt::BusyCursor);
+ m_infoTimeOutTimer->start();
+ eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
+ m_infoTimeOutTimer->disconnect();
+ QApplication::restoreOverrideCursor();
+ // Anything received?
+ *message = launcher->deviceDescription();
+ launcher->deleteLater();
+ if (message->isEmpty()) {
+ *message = tr("A timeout occurred while querying the device. Check whether Trk is running");
+ return false;
+ }
+ return true;
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h
new file mode 100644
index 0000000000..1863f5d5e5
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h
@@ -0,0 +1,97 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef S60DEVICERUNCONFIGURATIONWIDGET_H
+#define S60DEVICERUNCONFIGURATIONWIDGET_H
+
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+class QLabel;
+class QTimer;
+class QLineEdit;
+class QComboBox;
+class QToolButton;
+QT_END_NAMESPACE
+
+namespace Utils {
+ class DetailsWidget;
+}
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+struct CommunicationDevice;
+class S60DeviceRunConfiguration;
+
+/* Configuration widget for S60 devices on serial ports that are
+ * provided by the SerialDeviceLister class. Has an info/test
+ * button connecting to the device and showing info. */
+class S60DeviceRunConfigurationWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit S60DeviceRunConfigurationWidget(S60DeviceRunConfiguration *runConfiguration,
+ QWidget *parent = 0);
+
+private slots:
+ void nameEdited(const QString &text);
+ void updateTargetInformation();
+ void updateSerialDevices();
+ void setSerialPort(int index);
+ void selfSignToggled(bool toggle);
+ void customSignatureToggled(bool toggle);
+ void signaturePathChanged(const QString &path);
+ void keyPathChanged(const QString &path);
+ void updateSummary();
+ void updateDeviceInfo();
+ void clearDeviceInfo();
+
+private:
+ inline CommunicationDevice device(int i) const;
+ inline CommunicationDevice currentDevice() const;
+
+ bool getDeviceInfo(QString *message);
+ void setDeviceInfoLabel(const QString &message, bool isError = false);
+
+ S60DeviceRunConfiguration *m_runConfiguration;
+ Utils::DetailsWidget *m_detailsWidget;
+ QComboBox *m_serialPortsCombo;
+ QLineEdit *m_nameLineEdit;
+ QLabel *m_sisxFileLabel;
+ QToolButton *m_deviceInfoButton;
+ QLabel *m_deviceInfoDescriptionLabel;
+ QLabel *m_deviceInfoLabel;
+ QTimer *m_infoTimeOutTimer;
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // S60DEVICERUNCONFIGURATIONWIDGET_H
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp
index 08343e58d5..a9aa6dceb5 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp
@@ -31,8 +31,11 @@
#include <QtCore/QSettings>
#include <QtCore/QXmlStreamReader>
+#include <QtCore/QTextStream>
#include <QtCore/QFile>
#include <QtCore/QDir>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
namespace {
const char * const SYMBIAN_SDKS_KEY = "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs";
@@ -47,17 +50,58 @@ namespace {
const char * const DEVICE_TOOLSROOT = "toolsroot";
}
-using namespace Qt4ProjectManager::Internal;
+namespace Qt4ProjectManager {
+namespace Internal {
+
+S60Devices::Device::Device() :
+ isDefault(false)
+{
+}
+
+QString S60Devices::Device::toHtml() const
+{
+ QString rc;
+ QTextStream str(&rc);
+ str << "<html><body><table>"
+ << "<tr><td><b>" << QCoreApplication::translate("Qt4ProjectManager::Internal::S60Devices::Device", "Id:")
+ << "</b></td><td>" << id << "</td></tr>"
+ << "<tr><td><b>" << QCoreApplication::translate("Qt4ProjectManager::Internal::S60Devices::Device", "Name:")
+ << "</b></td><td>" << name << "</td></tr>"
+ << "<tr><td><b>" << QCoreApplication::translate("Qt4ProjectManager::Internal::S60Devices::Device", "EPOC:")
+ << "</b></td><td>" << epocRoot << "</td></tr>"
+ << "<tr><td><b>" << QCoreApplication::translate("Qt4ProjectManager::Internal::S60Devices::Device", "Tools:")
+ << "</b></td><td>" << toolsRoot << "</td></tr>"
+ << "<tr><td><b>" << QCoreApplication::translate("Qt4ProjectManager::Internal::S60Devices::Device", "Qt:")
+ << "</b></td><td>" << qt << "</td></tr>";
+ return rc;
+}
S60Devices::S60Devices(QObject *parent)
: QObject(parent)
{
}
+bool S60Devices::readLinux()
+{
+ m_errorString = QLatin1String("not implemented.");
+ return false;
+}
+
bool S60Devices::read()
{
m_devices.clear();
- m_errorString = QString();
+ m_errorString.clear();
+#ifdef Q_OS_WIN
+ return readWin();
+#else
+ return readLinux();
+#endif
+}
+
+// Windows EPOC
+
+bool S60Devices::readWin()
+{
// Check the windows registry via QSettings for devices.xml path
QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat);
QString devicesXmlPath = settings.value(SYMBIAN_PATH_KEY).toString();
@@ -180,3 +224,22 @@ QString S60Devices::cleanedRootPath(const QString &deviceRoot)
}
return path;
}
+
+QDebug operator<<(QDebug db, const S60Devices::Device &d)
+{
+ QDebug nospace = db.nospace();
+ nospace << "id='" << d.id << "' name='" << d.name << "' default="
+ << d.isDefault << " Epoc='" << d.epocRoot << "' tools='"
+ << d.toolsRoot << "' Qt='" << d.qt << '\'';
+ return db;
+}
+
+QDebug operator<<(QDebug dbg, const S60Devices &d)
+{
+ foreach(const S60Devices::Device &device, d.devices())
+ dbg << device;
+ return dbg;
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.h b/src/plugins/qt4projectmanager/qt-s60/s60devices.h
index cb57aac8a1..839fd32967 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devices.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.h
@@ -34,6 +34,10 @@
#include <QtCore/QString>
#include <QtCore/QList>
+QT_BEGIN_NAMESPACE
+class QDebug;
+QT_END_NAMESPACE
+
namespace Qt4ProjectManager {
namespace Internal {
@@ -42,6 +46,9 @@ class S60Devices : public QObject
Q_OBJECT
public:
struct Device {
+ Device();
+ QString toHtml() const;
+
QString id;
QString name;
bool isDefault;
@@ -62,10 +69,15 @@ signals:
void qtVersionsChanged();
private:
+ bool readLinux();
+ bool readWin();
QString m_errorString;
QList<Device> m_devices;
};
+QDebug operator<<(QDebug dbg, const S60Devices::Device &d);
+QDebug operator<<(QDebug dbg, const S60Devices &d);
+
} // namespace Internal
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicespreferencepane.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicespreferencepane.cpp
index f9a4f216e2..81023915f0 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicespreferencepane.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicespreferencepane.cpp
@@ -64,8 +64,13 @@ void S60DevicesWidget::updateDevicesList()
QList<S60Devices::Device> devices = m_devices->devices();
m_ui->list->clear();
foreach (const S60Devices::Device &device, devices) {
- m_ui->list->addTopLevelItem(new QTreeWidgetItem(QStringList() << device.epocRoot
- << (device.qt.isEmpty()?tr("No Qt installed"):device.qt)));
+ QStringList columns;
+ columns << device.epocRoot << (device.qt.isEmpty()?tr("No Qt installed"):device.qt);
+ QTreeWidgetItem *item = new QTreeWidgetItem(columns);
+ const QString tooltip = device.toHtml();
+ item->setToolTip(0, tooltip);
+ item->setToolTip(1, tooltip);
+ m_ui->list->addTopLevelItem(item);
}
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
index aeabbebc24..b1c65fa0e9 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
@@ -38,10 +38,14 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <utils/qtcassert.h>
+#include <utils/detailswidget.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/persistentsettings.h>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
@@ -175,24 +179,34 @@ void S60EmulatorRunConfiguration::invalidateCachedTargetInformation()
S60EmulatorRunConfigurationWidget::S60EmulatorRunConfigurationWidget(S60EmulatorRunConfiguration *runConfiguration,
QWidget *parent)
: QWidget(parent),
- m_runConfiguration(runConfiguration)
+ m_runConfiguration(runConfiguration),
+ m_detailsWidget(new Utils::DetailsWidget),
+ m_nameLineEdit(new QLineEdit(m_runConfiguration->name())),
+ m_executableLabel(new QLabel(m_runConfiguration->executable()))
{
- QFormLayout *toplayout = new QFormLayout();
- toplayout->setMargin(0);
- setLayout(toplayout);
+ QVBoxLayout *mainBoxLayout = new QVBoxLayout();
+ mainBoxLayout->setMargin(0);
+ setLayout(mainBoxLayout);
+ mainBoxLayout->addWidget(m_detailsWidget);
+ QWidget *detailsContainer = new QWidget;
+ m_detailsWidget->setWidget(detailsContainer);
+
+ QFormLayout *detailsFormLayout = new QFormLayout();
+ detailsFormLayout->setMargin(0);
+ detailsContainer->setLayout(detailsFormLayout);
QLabel *nameLabel = new QLabel(tr("Name:"));
- m_nameLineEdit = new QLineEdit(m_runConfiguration->name());
+
nameLabel->setBuddy(m_nameLineEdit);
- toplayout->addRow(nameLabel, m_nameLineEdit);
+ detailsFormLayout->addRow(nameLabel, m_nameLineEdit);
- m_executableLabel = new QLabel(m_runConfiguration->executable());
- toplayout->addRow(tr("Executable:"), m_executableLabel);
+ detailsFormLayout->addRow(tr("Executable:"), m_executableLabel);
connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(nameEdited(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
this, SLOT(updateTargetInformation()));
+ updateSummary();
}
void S60EmulatorRunConfigurationWidget::nameEdited(const QString &text)
@@ -205,6 +219,11 @@ void S60EmulatorRunConfigurationWidget::updateTargetInformation()
m_executableLabel->setText(m_runConfiguration->executable());
}
+void S60EmulatorRunConfigurationWidget::updateSummary()
+{
+ m_detailsWidget->setSummaryText(tr("Summary: Run %1 in emulator").arg(m_runConfiguration->executable()));
+}
+
// ======== S60EmulatorRunConfigurationFactory
S60EmulatorRunConfigurationFactory::S60EmulatorRunConfigurationFactory(QObject *parent)
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h
index 1682478d95..8ba0aeded4 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h
@@ -34,8 +34,15 @@
#include <projectexplorer/applicationlauncher.h>
#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
+
+QT_BEGIN_NAMESPACE
+class QLabel;
+class QLineEdit;
+QT_END_NAMESPACE
+
+namespace Utils {
+ class DetailsWidget;
+}
namespace Qt4ProjectManager {
namespace Internal {
@@ -79,9 +86,11 @@ public:
private slots:
void nameEdited(const QString &text);
void updateTargetInformation();
+ void updateSummary();
private:
S60EmulatorRunConfiguration *m_runConfiguration;
+ Utils::DetailsWidget *m_detailsWidget;
QLineEdit *m_nameLineEdit;
QLabel *m_executableLabel;
};
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp
new file mode 100644
index 0000000000..1481dcacbc
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp
@@ -0,0 +1,53 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "s60runconfigbluetoothstarter.h"
+#include "bluetoothlistener.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/messagemanager.h>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+S60RunConfigBluetoothStarter::S60RunConfigBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent) :
+ trk::AbstractBluetoothStarter(trkDevice, parent)
+{
+}
+
+trk::BluetoothListener *S60RunConfigBluetoothStarter::createListener()
+{
+ Core::ICore *core = Core::ICore::instance();
+ trk::BluetoothListener *rc = new trk::BluetoothListener(core);
+ rc->setMode(trk::BluetoothListener::Listen);
+ connect(rc, SIGNAL(message(QString)), core->messageManager(), SLOT(printToOutputPane(QString)));
+ return rc;
+}
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.h b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.h
new file mode 100644
index 0000000000..0da8817b32
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.h
@@ -0,0 +1,53 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef S60RUNCONFIGBLUETOOTHSTARTER_H
+#define S60RUNCONFIGBLUETOOTHSTARTER_H
+
+#include "communicationstarter.h"
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+/* S60RunConfigBluetoothStarter: Creates a listener in 'Listen' mode
+ * parented on the Qt Creator core which outputs to the message manager. */
+
+class S60RunConfigBluetoothStarter : public trk::AbstractBluetoothStarter
+{
+public:
+ explicit S60RunConfigBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0);
+
+protected:
+ virtual trk::BluetoothListener *createListener();
+};
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
+
+#endif // S60RUNCONFIGBLUETOOTHSTARTER_H
diff --git a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp b/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp
index a1a0b7b859..35e2b64254 100644
--- a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp
@@ -31,6 +31,7 @@
#include <QtCore/QSettings>
#include <QtCore/QStringList>
+#include <QtCore/QFileInfo>
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#include <QtDebug>
@@ -42,6 +43,17 @@ namespace {
const char * const USBSER = "Services/usbser/Enum";
}
+const char *SerialDeviceLister::linuxBlueToothDeviceRootC = "/dev/rfcomm";
+
+CommunicationDevice::CommunicationDevice(DeviceCommunicationType t,
+ const QString &p,
+ const QString &f) :
+ portName(p),
+ friendlyName(f),
+ type(t)
+{
+}
+
SerialDeviceLister::SerialDeviceLister(QObject *parent)
: QObject(parent),
m_initialized(false)
@@ -53,18 +65,18 @@ SerialDeviceLister::~SerialDeviceLister()
{
}
-QList<SerialDeviceLister::SerialDevice> SerialDeviceLister::serialDevices() const
+QList<CommunicationDevice> SerialDeviceLister::communicationDevices() const
{
if (!m_initialized) {
updateSilently();
m_initialized = true;
}
- return m_devices;
+ return m_devices2;
}
QString SerialDeviceLister::friendlyNameForPort(const QString &port) const
{
- foreach (const SerialDevice &device, m_devices) {
+ foreach (const CommunicationDevice &device, m_devices2) {
if (device.portName == port)
return device.friendlyName;
}
@@ -79,19 +91,44 @@ void SerialDeviceLister::update()
void SerialDeviceLister::updateSilently() const
{
- m_devices.clear();
+ m_devices2 = serialPorts() + blueToothDevices();
+}
+
+QList<CommunicationDevice> SerialDeviceLister::serialPorts() const
+{
+ QList<CommunicationDevice> rc;
#ifdef Q_OS_WIN32
QSettings registry(REGKEY_CURRENT_CONTROL_SET, QSettings::NativeFormat);
- int count = registry.value(QString::fromLatin1("%1/Count").arg(USBSER)).toInt();
+ const int count = registry.value(QString::fromLatin1("%1/Count").arg(USBSER)).toInt();
for (int i = 0; i < count; ++i) {
QString driver = registry.value(QString::fromLatin1("%1/%2").arg(USBSER).arg(i)).toString();
if (driver.contains("JAVACOMM")) {
driver.replace('\\', '/');
- SerialDeviceLister::SerialDevice device;
+ CommunicationDevice device(SerialPortCommunication);
device.friendlyName = registry.value(QString::fromLatin1("Enum/%1/FriendlyName").arg(driver)).toString();
device.portName = registry.value(QString::fromLatin1("Enum/%1/Device Parameters/PortName").arg(driver)).toString();
- m_devices.append(device);
+ rc.append(device);
+ }
+ }
+#endif
+ return rc;
+}
+
+QList<CommunicationDevice> SerialDeviceLister::blueToothDevices() const
+{
+ QList<CommunicationDevice> rc;
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+ // Bluetooth devices are created on connection. List the existing ones
+ // or at least the first one.
+ const QString prefix = QLatin1String(linuxBlueToothDeviceRootC);
+ const QString friendlyFormat = QLatin1String("Bluetooth device (%1)");
+ for (int d = 0; d < 4; d++) {
+ CommunicationDevice device(BlueToothCommunication, prefix + QString::number(d));
+ if (d == 0 || QFileInfo(device.portName).exists()) {
+ device.friendlyName = friendlyFormat.arg(device.portName);
+ rc.push_back(device);
}
}
#endif
+ return rc;
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h b/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h
index f2f71842c6..b1fb65507c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h
+++ b/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h
@@ -30,32 +30,36 @@
#ifndef SERIALDEVICELISTER_H
#define SERIALDEVICELISTER_H
-#include <QtCore/QAbstractEventDispatcher>
-#include <QtCore/QList>
#include <QtCore/QObject>
-#include <QtCore/QString>
-
-//#ifdef Q_OS_WIN32
-//#include <windows.h>
-//#include <dbt.h>
-//#endif
namespace Qt4ProjectManager {
namespace Internal {
+enum DeviceCommunicationType {
+ SerialPortCommunication = 0,
+ BlueToothCommunication = 1
+};
+
+struct CommunicationDevice {
+ explicit CommunicationDevice(DeviceCommunicationType type = SerialPortCommunication,
+ const QString &portName = QString(),
+ const QString &friendlyName = QString());
+ QString portName;
+ QString friendlyName;
+ DeviceCommunicationType type;
+};
+
class SerialDeviceLister : public QObject
{
Q_OBJECT
public:
+ static const char *linuxBlueToothDeviceRootC;
- struct SerialDevice {
- QString portName;
- QString friendlyName;
- };
-
- SerialDeviceLister(QObject *parent = 0);
+ explicit SerialDeviceLister(QObject *parent = 0);
~SerialDeviceLister();
- QList<SerialDevice> serialDevices() const;
+
+ QList<CommunicationDevice> communicationDevices() const;
+
QString friendlyNameForPort(const QString &port) const;
public slots:
@@ -66,9 +70,11 @@ signals:
private:
void updateSilently() const;
+ QList<CommunicationDevice> serialPorts() const;
+ QList<CommunicationDevice> blueToothDevices() const;
mutable bool m_initialized;
- mutable QList<SerialDevice> m_devices;
+ mutable QList<CommunicationDevice> m_devices2;
};
} // Internal
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp
index 38639719eb..ac2f0cfe94 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.cpp
+++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp
@@ -293,7 +293,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
foreach (QString newVersion, newVersionsList) {
QStringList newVersionData = newVersion.split('=');
if (newVersionData.count()>=2) {
- if (QDir(newVersionData[1]).exists()) {
+ if (QFile::exists(newVersionData[1])) {
QtVersion *version = new QtVersion(newVersionData[0], newVersionData[1], m_idcount++ );
if (newVersionData.count() >= 3)
version->setMingwDirectory(newVersionData[2]);
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h
index 3b8b81fb04..cb26e49c13 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.h
+++ b/src/plugins/qt4projectmanager/qtversionmanager.h
@@ -52,12 +52,12 @@ class QtVersion
{
friend class QtVersionManager;
public:
- QtVersion(const QString &name, const QString &path,
+ QtVersion(const QString &name, const QString &qmakeCommand,
bool isAutodetected = false, const QString &autodetectionSource = QString());
QtVersion(const QString &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
- QtVersion(const QString &name, const QString &path, int id,
+ QtVersion(const QString &name, const QString &qmakeCommand, int id,
bool isAutodetected = false, const QString &autodetectionSource = QString());
QtVersion();
~QtVersion();
diff --git a/src/plugins/qtscripteditor/parser/javascript.g b/src/plugins/qtscripteditor/parser/javascript.g
index e75ee1cf7e..927175edc4 100644
--- a/src/plugins/qtscripteditor/parser/javascript.g
+++ b/src/plugins/qtscripteditor/parser/javascript.g
@@ -1,18 +1,20 @@
-----------------------------------------------------------------------------
+---------------------------------------------------------------------------
+--
+-- This file is part of Qt Creator
+--
+-- Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
--
--- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-- Contact: Nokia Corporation (qt-info@nokia.com)
--
--- This file is part of the QtScript module of the Qt Toolkit.
+-- Commercial Usage
--
--- $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 either Technology Preview License Agreement or the
--- Beta Release License Agreement.
+-- Licensees holding valid Qt Commercial licenses may use this file in
+-- accordance with the Qt Commercial License Agreement provided with the
+-- Software or, alternatively, in accordance with the terms contained in
+-- a written agreement between you and Nokia.
--
-- 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
@@ -20,27 +22,10 @@
-- 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.0, included in the file LGPL_EXCEPTION.txt in this
--- package.
---
--- GNU General Public License Usage
--- Alternatively, this file may be used under the terms of the GNU
--- General Public License version 3.0 as published by the Free Software
--- Foundation and appearing in the file LICENSE.GPL included in the
--- packaging of this file. Please review the following information to
--- ensure the GNU General Public License version 3.0 requirements will be
--- met: http://www.gnu.org/copyleft/gpl.html.
---
-- If you are unsure which license is appropriate for your use, please
-- contact the sales department at http://qt.nokia.com/contact.
--- $QT_END_LICENSE$
--
--- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
--- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
---
-----------------------------------------------------------------------------
+---------------------------------------------------------------------------
%parser JavaScriptGrammar
%decl javascriptparser_p.h
@@ -82,21 +67,23 @@
%start Program
/.
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -104,37 +91,25 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#include <QtCore/QtDebug>
-
+**************************************************************************/
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+#include <QtCore/QtDebug>
#include <string.h>
-
-
#include "javascriptengine_p.h"
-
-
-
-
#include "javascriptlexer_p.h"
#include "javascriptast_p.h"
#include "javascriptnodepool_p.h"
@@ -149,21 +124,23 @@
./
/:
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -171,24 +148,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
//
// W A R N I N G
@@ -210,9 +173,6 @@
#define JAVASCRIPTPARSER_P_H
#include "javascriptgrammar_p.h"
-
-
-
#include "javascriptastfwd_p.h"
#include <QtCore/QList>
diff --git a/src/plugins/qtscripteditor/parser/javascriptast.cpp b/src/plugins/qtscripteditor/parser/javascriptast.cpp
index 19c9e0af43..d109d09e4a 100644
--- a/src/plugins/qtscripteditor/parser/javascriptast.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptast.cpp
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,29 +22,12 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
#include "javascriptast_p.h"
-
-
-
#include "javascriptastvisitor_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/qtscripteditor/parser/javascriptast_p.h b/src/plugins/qtscripteditor/parser/javascriptast_p.h
index 0aaaeb332c..eb12f899cf 100644
--- a/src/plugins/qtscripteditor/parser/javascriptast_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptast_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,27 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#ifndef JAVASCRIPTAST_P_H
-#define JAVASCRIPTAST_P_H
+**************************************************************************/
//
// W A R N I N G
@@ -53,10 +38,10 @@
// We mean it.
//
-#include <QtCore/QString>
-
-
+#ifndef JAVASCRIPTAST_P_H
+#define JAVASCRIPTAST_P_H
+#include <QtCore/QString>
#include "javascriptastvisitor_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h b/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h
index 27a24bf743..2c3a5955b9 100644
--- a/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptastfwd_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,29 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#ifndef JAVASCRIPTAST_FWD_P_H
-#define JAVASCRIPTAST_FWD_P_H
-
-#include <QtCore/qglobal.h>
+**************************************************************************/
//
// W A R N I N G
@@ -55,6 +38,11 @@
// We mean it.
//
+#ifndef JAVASCRIPTAST_FWD_P_H
+#define JAVASCRIPTAST_FWD_P_H
+
+#include <QtCore/qglobal.h>
+
QT_BEGIN_NAMESPACE
namespace JavaScript { namespace AST {
diff --git a/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp b/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp
index 5fbfc53d47..47e1ba4225 100644
--- a/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptastvisitor.cpp
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,24 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
#include "javascriptastvisitor_p.h"
diff --git a/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h b/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h
index aa924bc24c..df6f8bd6a7 100644
--- a/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptastvisitor_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,24 +22,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
#ifndef JAVASCRIPTASTVISITOR_P_H
#define JAVASCRIPTASTVISITOR_P_H
diff --git a/src/plugins/qtscripteditor/parser/javascriptengine_p.h b/src/plugins/qtscripteditor/parser/javascriptengine_p.h
index 42418741a7..15232f288d 100644
--- a/src/plugins/qtscripteditor/parser/javascriptengine_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptengine_p.h
@@ -27,6 +27,22 @@
**
**************************************************************************/
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
#ifndef JAVASCRIPTENGINE_P_H
#define JAVASCRIPTENGINE_P_H
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
index aaa8cd092b..aca84c8b2e 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
@@ -1,20 +1,21 @@
// This file was generated by qlalr - DO NOT EDIT!
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** 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 QtCore module of the Qt Toolkit.
+** Commercial Usage
**
-** $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.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -22,23 +23,10 @@
** 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$
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
**
-****************************************************************************/
+**************************************************************************/
#include "javascriptgrammar_p.h"
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
index 3126ed08cf..ed797cfa60 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
@@ -1,20 +1,20 @@
-// This file was generated by qlalr - DO NOT EDIT!
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** 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 QtCore module of the Qt Toolkit.
+** Commercial Usage
**
-** $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.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -22,30 +22,17 @@
** 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$
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
**
-****************************************************************************/
+**************************************************************************/
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
diff --git a/src/plugins/qtscripteditor/parser/javascriptlexer.cpp b/src/plugins/qtscripteditor/parser/javascriptlexer.cpp
index 51fa3ebfb1..6f0220d4fc 100644
--- a/src/plugins/qtscripteditor/parser/javascriptlexer.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptlexer.cpp
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,37 +22,12 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+**************************************************************************/
#include "javascriptengine_p.h"
-
-
-
-
-
-
-
#include "javascriptlexer_p.h"
#include "javascriptgrammar_p.h"
diff --git a/src/plugins/qtscripteditor/parser/javascriptlexer_p.h b/src/plugins/qtscripteditor/parser/javascriptlexer_p.h
index d6d5f7f819..406620bb3e 100644
--- a/src/plugins/qtscripteditor/parser/javascriptlexer_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptlexer_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,27 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#ifndef JAVASCRIPTLEXER_P_H
-#define JAVASCRIPTLEXER_P_H
+**************************************************************************/
//
// W A R N I N G
@@ -53,6 +38,14 @@
// We mean it.
//
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+#ifndef JAVASCRIPTLEXER_P_H
+#define JAVASCRIPTLEXER_P_H
+
#include <QtCore/QString>
diff --git a/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h b/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h
index 429b74def7..c58e2dc90e 100644
--- a/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptmemorypool_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,24 +22,26 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
#ifndef JAVASCRIPTMEMORYPOOL_P_H
#define JAVASCRIPTMEMORYPOOL_P_H
diff --git a/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h b/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h
index d974ff0178..1b7242e29c 100644
--- a/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptnodepool_p.h
@@ -1,18 +1,20 @@
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -20,27 +22,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
-
-#ifndef JAVASCRIPTNODEPOOL_P_H
-#define JAVASCRIPTNODEPOOL_P_H
+**************************************************************************/
//
// W A R N I N G
@@ -53,6 +38,14 @@
// We mean it.
//
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+#ifndef JAVASCRIPTNODEPOOL_P_H
+#define JAVASCRIPTNODEPOOL_P_H
+
#include <QtCore/QHash>
#include <QtCore/QString>
@@ -116,17 +109,11 @@ public:
inline QString fileName() const { return m_fileName; }
inline JavaScriptEnginePrivate *engine() const { return m_engine; }
-#ifndef J_SCRIPT_NO_EVENT_NOTIFY
- inline qint64 id() const { return m_id; }
-#endif
private:
QHash<AST::Node*, Code*> m_codeCache;
QString m_fileName;
JavaScriptEnginePrivate *m_engine;
-#ifndef J_SCRIPT_NO_EVENT_NOTIFY
- qint64 m_id;
-#endif
private:
Q_DISABLE_COPY(NodePool)
diff --git a/src/plugins/qtscripteditor/parser/javascriptparser.cpp b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
index b63a9fbe93..295969a11d 100644
--- a/src/plugins/qtscripteditor/parser/javascriptparser.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
@@ -1,20 +1,20 @@
-// This file was generated by qlalr - DO NOT EDIT!
-
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -22,37 +22,14 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
#include <QtCore/QtDebug>
-
-
-
#include <string.h>
-
-
#include "javascriptengine_p.h"
-
-
-
-
#include "javascriptlexer_p.h"
#include "javascriptast_p.h"
#include "javascriptnodepool_p.h"
diff --git a/src/plugins/qtscripteditor/parser/javascriptparser_p.h b/src/plugins/qtscripteditor/parser/javascriptparser_p.h
index d6929710e1..29c54927d6 100644
--- a/src/plugins/qtscripteditor/parser/javascriptparser_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptparser_p.h
@@ -1,20 +1,22 @@
// This file was generated by qlalr - DO NOT EDIT!
-/****************************************************************************
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtScript module of the Qt Toolkit.
+** Commercial Usage
**
-** $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 either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
**
** 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
@@ -22,24 +24,10 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-****************************************************************************/
+**************************************************************************/
//
// W A R N I N G
diff --git a/src/plugins/qtscripteditor/parser/javascriptvalue.h b/src/plugins/qtscripteditor/parser/javascriptvalue.h
index c68b817b9f..715cedf3c4 100644
--- a/src/plugins/qtscripteditor/parser/javascriptvalue.h
+++ b/src/plugins/qtscripteditor/parser/javascriptvalue.h
@@ -1,3 +1,32 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
#ifndef JAVASCRIPTVALUE_H
#define JAVASCRIPTVALUE_H
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index 05a78b0832..6dced425a7 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -64,6 +64,7 @@ class List: public Managed
public:
List()
+ : value(_Tp()), next(0)
{ }
_Tp value;
diff --git a/src/shared/cplusplus/LiteralTable.h b/src/shared/cplusplus/LiteralTable.h
index 29de643002..52816a5682 100644
--- a/src/shared/cplusplus/LiteralTable.h
+++ b/src/shared/cplusplus/LiteralTable.h
@@ -175,8 +175,6 @@ protected:
}
protected:
- MemoryPool *_pool;
-
_Literal **_literals;
int _allocatedLiterals;
int _literalCount;
diff --git a/src/shared/cplusplus/MemoryPool.cpp b/src/shared/cplusplus/MemoryPool.cpp
index 2002a65435..1453c62cd6 100644
--- a/src/shared/cplusplus/MemoryPool.cpp
+++ b/src/shared/cplusplus/MemoryPool.cpp
@@ -110,6 +110,19 @@ void *MemoryPool::allocate_helper(size_t size)
return addr;
}
+MemoryPool::State MemoryPool::state() const
+{ return State(ptr, _blockCount); }
+
+void MemoryPool::rewind(const State &state)
+{
+ if (_blockCount == state.blockCount && state.ptr < ptr) {
+ if (_initializeAllocatedMemory)
+ memset(state.ptr, '\0', ptr - state.ptr);
+
+ ptr = state.ptr;
+ }
+}
+
Managed::Managed()
{ }
diff --git a/src/shared/cplusplus/MemoryPool.h b/src/shared/cplusplus/MemoryPool.h
index e0f1ff8701..5b6fae925f 100644
--- a/src/shared/cplusplus/MemoryPool.h
+++ b/src/shared/cplusplus/MemoryPool.h
@@ -79,6 +79,22 @@ public:
return allocate_helper(size);
}
+ struct State
+ {
+ char *ptr;
+ char *end;
+ int blockCount;
+
+ inline bool isValid() const
+ { return ptr != 0; }
+
+ inline State(char *ptr = 0, int blockCount = 0)
+ : ptr(ptr), blockCount(blockCount) {}
+ };
+
+ State state() const;
+ void rewind(const State &state);
+
private:
void *allocate_helper(size_t size);
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index 8f3bd549ce..835b2c11c8 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -88,6 +88,30 @@ int DebugRule::depth = 0;
# define DEBUG_THIS_RULE() do {} while (0)
#endif
+class Parser::Rewind
+{
+ Parser *_parser;
+ MemoryPool::State _state;
+
+public:
+ inline Rewind(Parser *parser)
+ : _parser(parser) {}
+
+ inline void operator()(unsigned tokenIndex)
+ { rewind(tokenIndex); }
+
+ inline void mark()
+ { _state = _parser->_pool->state(); }
+
+ inline void rewind(unsigned tokenIndex)
+ {
+ _parser->rewind(tokenIndex);
+
+ if (_state.isValid())
+ _parser->_pool->rewind(_state);
+ }
+};
+
Parser::Parser(TranslationUnit *unit)
: _translationUnit(unit),
_control(_translationUnit->control()),
@@ -302,6 +326,9 @@ bool Parser::parseClassOrNamespaceName(NameAST *&node)
bool Parser::parseTemplateId(NameAST *&node)
{
DEBUG_THIS_RULE();
+
+ const unsigned start = cursor();
+
if (LA() == T_IDENTIFIER && LA(2) == T_LESS) {
TemplateIdAST *ast = new (_pool) TemplateIdAST;
ast->identifier_token = consumeToken();
@@ -315,6 +342,9 @@ bool Parser::parseTemplateId(NameAST *&node)
}
}
}
+
+ rewind(start);
+
return false;
}
@@ -660,8 +690,27 @@ bool Parser::parseOperatorFunctionId(NameAST *&node)
return true;
}
+Parser::TemplateArgumentListEntry *Parser::templateArgumentListEntry(unsigned tokenIndex)
+{
+ for (unsigned i = 0; i < _templateArgumentList.size(); ++i) {
+ TemplateArgumentListEntry *entry = &_templateArgumentList[i];
+ if (entry->index == tokenIndex)
+ return entry;
+ }
+
+ return 0;
+}
+
bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
{
+ if (TemplateArgumentListEntry *entry = templateArgumentListEntry(cursor())) {
+ rewind(entry->cursor);
+ node = entry->ast;
+ return entry->ast != 0;
+ }
+
+ unsigned start = cursor();
+
DEBUG_THIS_RULE();
TemplateArgumentListAST **template_argument_ptr = &node;
ExpressionAST *template_argument = 0;
@@ -679,8 +728,13 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
template_argument_ptr = &(*template_argument_ptr)->next;
}
}
+
+ _templateArgumentList.push_back(TemplateArgumentListEntry(start, cursor(), node));
return true;
}
+
+ _templateArgumentList.push_back(TemplateArgumentListEntry(start, cursor(), 0));
+
return false;
}
@@ -4541,6 +4595,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
last->next = new (_pool) ObjCSynthesizedPropertyListAST;
last = last->next;
+ last->synthesized_property = new (_pool) ObjCSynthesizedPropertyAST;
match(T_IDENTIFIER, &(last->synthesized_property->property_identifier));
if (LA() == T_EQUAL) {
diff --git a/src/shared/cplusplus/Parser.h b/src/shared/cplusplus/Parser.h
index 3ca3371d81..d9ccf6ab49 100644
--- a/src/shared/cplusplus/Parser.h
+++ b/src/shared/cplusplus/Parser.h
@@ -54,7 +54,6 @@
#include "Token.h"
#include "TranslationUnit.h"
-
namespace CPlusPlus {
class CPLUSPLUS_EXPORT Parser
@@ -287,6 +286,17 @@ private:
inline void rewind(unsigned cursor)
{ _tokenIndex = cursor; }
+ struct TemplateArgumentListEntry {
+ unsigned index;
+ unsigned cursor;
+ TemplateArgumentListAST *ast;
+
+ TemplateArgumentListEntry(unsigned index = 0, unsigned cursor = 0, TemplateArgumentListAST *ast = 0)
+ : index(index), cursor(cursor), ast(ast) {}
+ };
+
+ TemplateArgumentListEntry *templateArgumentListEntry(unsigned tokenIndex);
+
private:
TranslationUnit *_translationUnit;
Control *_control;
@@ -298,6 +308,11 @@ private:
bool _inFunctionBody: 1;
bool _inObjCImplementationContext: 1;
+ Array<TemplateArgumentListEntry> _templateArgumentList;
+
+ class Rewind;
+ friend class Rewind;
+
private:
Parser(const Parser& source);
void operator =(const Parser& source);
diff --git a/src/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp
index aa15735410..8ddaf3ef5d 100644
--- a/src/shared/cplusplus/Symbols.cpp
+++ b/src/shared/cplusplus/Symbols.cpp
@@ -589,6 +589,7 @@ void ObjCBaseProtocol::visitSymbol0(SymbolVisitor *visitor)
ObjCClass::ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name):
ScopedSymbol(translationUnit, sourceLocation, name),
+ _isInterface(false),
_categoryName(0),
_baseClass(0)
{
diff --git a/src/shared/trk/bluetoothlistener.cpp b/src/shared/trk/bluetoothlistener.cpp
new file mode 100644
index 0000000000..1f5ccbe51b
--- /dev/null
+++ b/src/shared/trk/bluetoothlistener.cpp
@@ -0,0 +1,212 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "bluetoothlistener.h"
+#include "trkdevice.h"
+
+#include <QtCore/QDebug>
+
+#ifdef Q_OS_UNIX
+# include <unistd.h>
+# include <signal.h>
+#else
+# include <windows.h>
+#endif
+
+// Process id helpers.
+#ifdef Q_OS_WIN
+inline DWORD processId(const QProcess &p)
+{
+ if (const Q_PID processInfoStruct = p.pid())
+ return processInfoStruct->dwProcessId;
+ return 0;
+}
+#else
+inline Q_PID processId(const QProcess &p)
+{
+ return p.pid();
+}
+#endif
+
+
+enum { debug = 0 };
+
+namespace trk {
+
+struct BluetoothListenerPrivate {
+ BluetoothListenerPrivate();
+ QString device;
+ QProcess process;
+#ifdef Q_OS_WIN
+ DWORD pid;
+#else
+ Q_PID pid;
+#endif
+ bool printConsoleMessages;
+ BluetoothListener::Mode mode;
+};
+
+BluetoothListenerPrivate::BluetoothListenerPrivate() :
+ pid(0),
+ printConsoleMessages(false),
+ mode(BluetoothListener::Listen)
+{
+}
+
+BluetoothListener::BluetoothListener(QObject *parent) :
+ QObject(parent),
+ d(new BluetoothListenerPrivate)
+{
+ d->process.setProcessChannelMode(QProcess::MergedChannels);
+
+ connect(&d->process, SIGNAL(readyReadStandardError()),
+ this, SLOT(slotStdError()));
+ connect(&d->process, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(slotStdOutput()));
+ connect(&d->process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(slotProcessFinished(int,QProcess::ExitStatus)));
+ connect(&d->process, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(slotProcessError(QProcess::ProcessError)));
+}
+
+BluetoothListener::~BluetoothListener()
+{
+ const int trc = terminateProcess();
+ if (debug)
+ qDebug() << "~BluetoothListener: terminated" << trc;
+ delete d;
+}
+
+BluetoothListener::Mode BluetoothListener::mode() const
+{
+ return d->mode;
+}
+
+void BluetoothListener::setMode(Mode m)
+{
+ d->mode = m;
+}
+
+bool BluetoothListener::printConsoleMessages() const
+{
+ return d->printConsoleMessages;
+}
+
+void BluetoothListener::setPrintConsoleMessages(bool p)
+{
+ d->printConsoleMessages = p;
+}
+
+int BluetoothListener::terminateProcess()
+{
+ enum { TimeOutMS = 200 };
+ if (debug)
+ qDebug() << "terminateProcess" << d->process.pid() << d->process.state();
+ if (d->process.state() == QProcess::NotRunning)
+ return -1;
+ emitMessage(tr("%1: Stopping listener %2...").arg(d->device).arg(processId(d->process)));
+ // When listening, the process should terminate by itself after closing the connection
+ if (mode() == Listen && d->process.waitForFinished(TimeOutMS))
+ return 0;
+#ifdef Q_OS_UNIX
+ kill(d->process.pid(), SIGHUP); // Listens for SIGHUP
+ if (d->process.waitForFinished(TimeOutMS))
+ return 1;
+#endif
+ d->process.terminate();
+ if (d->process.waitForFinished(TimeOutMS))
+ return 2;
+ d->process.kill();
+ return 3;
+}
+
+bool BluetoothListener::start(const QString &device, QString *errorMessage)
+{
+ if (d->process.state() != QProcess::NotRunning) {
+ *errorMessage = QLatin1String("Internal error: Still running.");
+ return false;
+ }
+ d->device = device;
+ const QString binary = QLatin1String("rfcomm");
+ QStringList arguments;
+ arguments << QLatin1String("-r")
+ << (d->mode == Listen ? QLatin1String("listen") : QLatin1String("watch"))
+ << device << QString(QLatin1Char('1'));
+ if (debug)
+ qDebug() << binary << arguments;
+ emitMessage(tr("%1: Starting Bluetooth listener %2...").arg(device, binary));
+ d->pid = 0;
+ d->process.start(binary, arguments);
+ if (!d->process.waitForStarted()) {
+ *errorMessage = tr("Unable to run '%1': %2").arg(binary, d->process.errorString());
+ return false;
+ }
+ d->pid = processId(d->process); // Forgets it after crash/termination
+ emitMessage(tr("%1: Bluetooth listener running (%2).").arg(device).arg(processId(d->process)));
+ return true;
+}
+
+void BluetoothListener::slotStdOutput()
+{
+ emitMessage(QString::fromLocal8Bit(d->process.readAllStandardOutput()));
+}
+
+void BluetoothListener::emitMessage(const QString &m)
+{
+ if (d->printConsoleMessages || debug)
+ qDebug("%s\n", qPrintable(m));
+ emit message(m);
+}
+
+void BluetoothListener::slotStdError()
+{
+ emitMessage(QString::fromLocal8Bit(d->process.readAllStandardError()));
+}
+
+void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state)
+{
+ switch (state) {
+ case QProcess::NormalExit:
+ emitMessage(tr("%1: Process %2 terminated with exit code %3.")
+ .arg(d->device).arg(d->pid).arg(ex));
+ break;
+ case QProcess::CrashExit:
+ emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid));
+ break;
+ }
+ emit terminated();
+}
+
+void BluetoothListener::slotProcessError(QProcess::ProcessError error)
+{
+ emitMessage(tr("%1: Process error %2: %3")
+ .arg(d->device).arg(error).arg(d->process.errorString()));
+}
+
+} // namespace trk
diff --git a/src/shared/trk/bluetoothlistener.h b/src/shared/trk/bluetoothlistener.h
new file mode 100644
index 0000000000..a20ba30753
--- /dev/null
+++ b/src/shared/trk/bluetoothlistener.h
@@ -0,0 +1,89 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef BLUETOOTHLISTENER_H
+#define BLUETOOTHLISTENER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QProcess>
+
+namespace trk {
+struct BluetoothListenerPrivate;
+
+/* BluetoothListener: Starts a helper process watching connections on a
+ * Bluetooth device, Linux only:
+ * The rfcomm command is used. It process can be started in the background
+ * while connection attempts (TrkDevice::open()) are made in the foreground. */
+
+class BluetoothListener : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BluetoothListener)
+public:
+ // The Mode property must be set before calling start().
+ enum Mode {
+ Listen, /* Terminate after client closed (read: Trk app
+ * on the phone terminated or disconnected).*/
+ Watch // Keep running, watch for next connection from client
+ };
+
+ explicit BluetoothListener(QObject *parent = 0);
+ virtual ~BluetoothListener();
+
+ Mode mode() const;
+ void setMode(Mode m);
+
+ bool start(const QString &device, QString *errorMessage);
+
+ // Print messages on the console.
+ bool printConsoleMessages() const;
+ void setPrintConsoleMessages(bool p);
+
+signals:
+ void terminated();
+ void message(const QString &);
+
+public slots:
+ void emitMessage(const QString &m); // accessed by starter
+
+private slots:
+ void slotStdOutput();
+ void slotStdError();
+ void slotProcessFinished(int, QProcess::ExitStatus);
+ void slotProcessError(QProcess::ProcessError error);
+
+private:
+ int terminateProcess();
+
+ BluetoothListenerPrivate *d;
+};
+
+} // namespace trk
+
+#endif // BLUETOOTHLISTENER_H
diff --git a/src/shared/trk/bluetoothlistener_gui.cpp b/src/shared/trk/bluetoothlistener_gui.cpp
new file mode 100644
index 0000000000..ee21c82a7c
--- /dev/null
+++ b/src/shared/trk/bluetoothlistener_gui.cpp
@@ -0,0 +1,75 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "bluetoothlistener_gui.h"
+#include "bluetoothlistener.h"
+#include "communicationstarter.h"
+
+#include <QtGui/QMessageBox>
+#include <QtGui/QPushButton>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+namespace trk {
+
+StartBluetoothGuiResult
+ startBluetoothGui(AbstractBluetoothStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage)
+{
+ errorMessage->clear();
+ switch (starter.start()) {
+ case AbstractBluetoothStarter::Started:
+ break;
+ case AbstractBluetoothStarter::ConnectionSucceeded:
+ return BluetoothGuiConnected;
+ case AbstractBluetoothStarter::StartError:
+ *errorMessage = starter.errorString();
+ return BluetoothGuiError;
+ }
+ // Run the starter with the event loop of a message box, close it
+ // with the finished signals.
+ const QString title = QCoreApplication::translate("trk::startBluetoothGui", "Waiting for Bluetooth Connection");
+ const QString message = QCoreApplication::translate("trk::startBluetoothGui", "Connecting to %1...").arg(starter.device());
+ QMessageBox messageBox(QMessageBox::Information, title, message, QMessageBox::Cancel, msgBoxParent);
+ QObject::connect(&starter, SIGNAL(connected()), &messageBox, SLOT(close()));
+ QObject::connect(&starter, SIGNAL(timeout()), &messageBox, SLOT(close()));
+ messageBox.exec();
+ // Only starter.state() is reliable here.
+ if (starter.state() == AbstractBluetoothStarter::Running) {
+ *errorMessage = QCoreApplication::translate("trk::startBluetoothGui", "Connection on %1 canceled.").arg(starter.device());
+ return BluetoothGuiCanceled;
+ }
+ if (starter.state() != AbstractBluetoothStarter::Connected) {
+ *errorMessage = starter.errorString();
+ return BluetoothGuiError;
+ }
+ return BluetoothGuiConnected;
+}
+} // namespace trk
diff --git a/src/shared/trk/bluetoothlistener_gui.h b/src/shared/trk/bluetoothlistener_gui.h
new file mode 100644
index 0000000000..2a7c57e291
--- /dev/null
+++ b/src/shared/trk/bluetoothlistener_gui.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef BLUETOOTHLISTENER_GUI_H
+#define BLUETOOTHLISTENER_GUI_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+
+namespace trk {
+ class AbstractBluetoothStarter;
+
+ /* startBluetoothGui(): Prompt the user to start a Bluetooth
+ * connection with a message box he can cancel. Pass in
+ * the starter with device and parameters set up. */
+
+ enum StartBluetoothGuiResult {
+ BluetoothGuiConnected,
+ BluetoothGuiCanceled,
+ BluetoothGuiError
+ };
+
+ StartBluetoothGuiResult
+ startBluetoothGui(AbstractBluetoothStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage);
+} // namespace trk
+
+#endif // BLUETOOTHLISTENER_GUI_H
diff --git a/src/shared/trk/communicationstarter.cpp b/src/shared/trk/communicationstarter.cpp
new file mode 100644
index 0000000000..58a954cd26
--- /dev/null
+++ b/src/shared/trk/communicationstarter.cpp
@@ -0,0 +1,228 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "communicationstarter.h"
+#include "bluetoothlistener.h"
+#include "trkdevice.h"
+
+#include <QtCore/QTimer>
+#include <QtCore/QEventLoop>
+
+namespace trk {
+// --------------- AbstractBluetoothStarter
+struct AbstractBluetoothStarterPrivate {
+ explicit AbstractBluetoothStarterPrivate(const AbstractBluetoothStarter::TrkDevicePtr &d);
+
+ const AbstractBluetoothStarter::TrkDevicePtr trkDevice;
+ BluetoothListener *listener;
+ QTimer *timer;
+ int intervalMS;
+ int attempts;
+ int n;
+ QString device;
+ QString errorString;
+ AbstractBluetoothStarter::State state;
+};
+
+AbstractBluetoothStarterPrivate::AbstractBluetoothStarterPrivate(const AbstractBluetoothStarter::TrkDevicePtr &d) :
+
+ trkDevice(d),
+ listener(0),
+ timer(0),
+ intervalMS(1000),
+ attempts(-1),
+ n(0),
+ device(QLatin1String("/dev/rfcomm0")),
+ state(AbstractBluetoothStarter::TimedOut)
+{
+}
+
+AbstractBluetoothStarter::AbstractBluetoothStarter(const TrkDevicePtr &trkDevice, QObject *parent) :
+ QObject(parent),
+ d(new AbstractBluetoothStarterPrivate(trkDevice))
+{
+}
+
+AbstractBluetoothStarter::~AbstractBluetoothStarter()
+{
+ stopTimer();
+ delete d;
+}
+
+void AbstractBluetoothStarter::stopTimer()
+{
+ if (d->timer && d->timer->isActive())
+ d->timer->stop();
+}
+
+AbstractBluetoothStarter::StartResult AbstractBluetoothStarter::start()
+{
+ if (state() == Running) {
+ d->errorString = QLatin1String("Internal error, attempt to re-start AbstractBluetoothStarter.\n");
+ return StartError;
+ }
+ // Before we instantiate timers, and such, try to open the device,
+ // which should succeed if another listener is already running in
+ // 'Watch' mode
+ if (d->trkDevice->open(d->device , &(d->errorString)))
+ return ConnectionSucceeded;
+ // Fire up the listener
+ d->n = 0;
+ d->listener = createListener();
+ if (!d->listener->start(d->device, &(d->errorString)))
+ return StartError;
+ // Start timer
+ if (!d->timer) {
+ d->timer = new QTimer;
+ connect(d->timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
+ }
+ d->timer->setInterval(d->intervalMS);
+ d->timer->setSingleShot(false);
+ d->timer->start();
+ d->state = Running;
+ return Started;
+}
+
+AbstractBluetoothStarter::State AbstractBluetoothStarter::state() const
+{
+ return d->state;
+}
+
+int AbstractBluetoothStarter::intervalMS() const
+{
+ return d->intervalMS;
+}
+
+void AbstractBluetoothStarter::setIntervalMS(int i)
+{
+ d->intervalMS = i;
+ if (d->timer)
+ d->timer->setInterval(i);
+}
+
+int AbstractBluetoothStarter::attempts() const
+{
+ return d->attempts;
+}
+
+void AbstractBluetoothStarter::setAttempts(int a)
+{
+ d->attempts = a;
+}
+
+QString AbstractBluetoothStarter::device() const
+{
+ return d->device;
+}
+
+void AbstractBluetoothStarter::setDevice(const QString &dv)
+{
+ d->device = dv;
+}
+
+QString AbstractBluetoothStarter::errorString() const
+{
+ return d->errorString;
+}
+
+void AbstractBluetoothStarter::slotTimer()
+{
+ ++d->n;
+ // Check for timeout
+ if (d->attempts >= 0 && d->n >= d->attempts) {
+ stopTimer();
+ d->errorString = tr("%1: timed out after %n attempts using an interval of %2ms.", 0, d->n)
+ .arg(d->device).arg(d->intervalMS);
+ d->state = TimedOut;
+ emit timeout();
+ } else {
+ // Attempt n to connect?
+ if (d->trkDevice->open(d->device , &(d->errorString))) {
+ stopTimer();
+ const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->device).arg(d->n);
+ d->listener->emitMessage(msg);
+ d->state = Connected;
+ emit connected();
+ } else {
+ const QString msg = tr("%1: Connection attempt %2 failed: %3 (retrying)...")
+ .arg(d->device).arg(d->n).arg(d->errorString);
+ d->listener->emitMessage(msg);
+ }
+ }
+}
+
+// -------- ConsoleBluetoothStarter
+ConsoleBluetoothStarter::ConsoleBluetoothStarter(const TrkDevicePtr &trkDevice,
+ QObject *listenerParent,
+ QObject *parent) :
+AbstractBluetoothStarter(trkDevice, parent),
+m_listenerParent(listenerParent)
+{
+}
+
+BluetoothListener *ConsoleBluetoothStarter::createListener()
+{
+ BluetoothListener *rc = new BluetoothListener(m_listenerParent);
+ rc->setMode(BluetoothListener::Listen);
+ rc->setPrintConsoleMessages(true);
+ return rc;
+}
+
+bool ConsoleBluetoothStarter::startBluetooth(const TrkDevicePtr &trkDevice,
+ QObject *listenerParent,
+ const QString &device,
+ int attempts,
+ QString *errorMessage)
+{
+ // Set up a console starter to print to stdout.
+ ConsoleBluetoothStarter starter(trkDevice, listenerParent);
+ starter.setDevice(device);
+ starter.setAttempts(attempts);
+ switch (starter.start()) {
+ case Started:
+ break;
+ case ConnectionSucceeded:
+ return true;
+ case StartError:
+ *errorMessage = starter.errorString();
+ return false;
+ }
+ // Run the starter with an event loop. @ToDo: Implement
+ // some asynchronous keypress read to cancel.
+ QEventLoop eventLoop;
+ connect(&starter, SIGNAL(connected()), &eventLoop, SLOT(quit()));
+ connect(&starter, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+ eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
+ if (starter.state() != AbstractBluetoothStarter::Connected) {
+ *errorMessage = starter.errorString();
+ return false;
+ }
+ return true;
+}
+} // namespace trk
diff --git a/src/shared/trk/communicationstarter.h b/src/shared/trk/communicationstarter.h
new file mode 100644
index 0000000000..e90578dc17
--- /dev/null
+++ b/src/shared/trk/communicationstarter.h
@@ -0,0 +1,125 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef COMMUNICATIONSTARTER_H
+#define COMMUNICATIONSTARTER_H
+
+#include <QtCore/QSharedPointer>
+#include <QtCore/QObject>
+
+namespace trk {
+class TrkDevice;
+class BluetoothListener;
+struct AbstractBluetoothStarterPrivate;
+
+/* AbstractBluetoothStarter: Repeatedly tries to open a trk device
+ * until a connection succeeds, allowing to do something else in the
+ * foreground (local event loop or asynchronous operation).
+ * Note that in case a Listener is already running in watch mode, it might
+ * also happen that connection succeeds immediately.
+ * Implementations must provide a factory function that creates and sets up the
+ * listener (mode, message connection, etc). */
+
+class AbstractBluetoothStarter : public QObject {
+ Q_OBJECT
+ Q_DISABLE_COPY(AbstractBluetoothStarter)
+public:
+ typedef QSharedPointer<TrkDevice> TrkDevicePtr;
+
+ enum State { Running, Connected, TimedOut };
+
+ virtual ~AbstractBluetoothStarter();
+
+ int intervalMS() const;
+ void setIntervalMS(int i);
+
+ int attempts() const;
+ void setAttempts(int a);
+
+ QString device() const;
+ void setDevice(const QString &);
+
+ State state() const;
+ QString errorString() const;
+
+ enum StartResult {
+ Started, // Starter is now running.
+ ConnectionSucceeded, /* Initial connection attempt succeeded,
+ * no need to keep running. */
+ StartError // Error occurred during start.
+ };
+
+ StartResult start();
+
+signals:
+ void connected();
+ void timeout();
+
+private slots:
+ void slotTimer();
+
+protected:
+ explicit AbstractBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0);
+ // Overwrite to create and parametrize the listener.
+ virtual BluetoothListener *createListener() = 0;
+
+private:
+ inline void stopTimer();
+
+ AbstractBluetoothStarterPrivate *d;
+};
+
+/* ConsoleBluetoothStarter: Convenience class for console processes. Creates a
+ * listener in "Listen" mode with the messages redirected to standard output. */
+
+class ConsoleBluetoothStarter : public AbstractBluetoothStarter {
+ Q_OBJECT
+ Q_DISABLE_COPY(ConsoleBluetoothStarter)
+public:
+
+ static bool startBluetooth(const TrkDevicePtr& trkDevice,
+ QObject *listenerParent,
+ const QString &device,
+ int attempts,
+ QString *errorMessage);
+
+protected:
+ virtual BluetoothListener *createListener();
+
+private:
+ explicit ConsoleBluetoothStarter(const TrkDevicePtr& trkDevice,
+ QObject *listenerParent,
+ QObject *parent = 0);
+
+ QObject *m_listenerParent;
+};
+
+} // namespace trk
+
+#endif // COMMUNICATIONSTARTER_H
diff --git a/src/shared/trk/launcher.cpp b/src/shared/trk/launcher.cpp
index 08af4a2153..f066ab4864 100644
--- a/src/shared/trk/launcher.cpp
+++ b/src/shared/trk/launcher.cpp
@@ -30,6 +30,7 @@
#include "launcher.h"
#include "trkutils.h"
#include "trkdevice.h"
+#include "bluetoothlistener.h"
#include <QtCore/QTimer>
#include <QtCore/QDateTime>
@@ -50,8 +51,9 @@ struct LauncherPrivate {
int position;
};
- LauncherPrivate();
- TrkDevice m_device;
+ explicit LauncherPrivate(const TrkDevicePtr &d);
+
+ TrkDevicePtr m_device;
QString m_trkServerName;
QByteArray m_trkReadBuffer;
@@ -65,20 +67,28 @@ struct LauncherPrivate {
int m_verbose;
Launcher::Actions m_startupActions;
bool m_connected;
+ bool m_closeDevice;
};
-LauncherPrivate::LauncherPrivate() :
+LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) :
+ m_device(d),
m_verbose(0),
- m_connected(false)
+ m_connected(false),
+ m_closeDevice(true)
{
+ if (m_device.isNull())
+ m_device = TrkDevicePtr(new TrkDevice);
}
-Launcher::Launcher(Actions startupActions) :
- d(new LauncherPrivate)
+Launcher::Launcher(Actions startupActions,
+ const TrkDevicePtr &dev,
+ QObject *parent) :
+ QObject(parent),
+ d(new LauncherPrivate(dev))
{
d->m_startupActions = startupActions;
- connect(&d->m_device, SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
- connect(this, SIGNAL(finished()), &d->m_device, SLOT(close()));
+ connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
+ connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
}
Launcher::~Launcher()
@@ -97,6 +107,16 @@ void Launcher::setTrkServerName(const QString &name)
d->m_trkServerName = name;
}
+QString Launcher::trkServerName() const
+{
+ return d->m_trkServerName;
+}
+
+TrkDevicePtr Launcher::trkDevice() const
+{
+ return d->m_device;
+}
+
void Launcher::setFileName(const QString &name)
{
d->m_fileName = name;
@@ -115,16 +135,28 @@ void Launcher::setInstallFileName(const QString &name)
void Launcher::setSerialFrame(bool b)
{
- d->m_device.setSerialFrame(b);
+ d->m_device->setSerialFrame(b);
}
bool Launcher::serialFrame() const
{
- return d->m_device.serialFrame();
+ return d->m_device->serialFrame();
+}
+
+
+bool Launcher::closeDevice() const
+{
+ return d->m_closeDevice;
+}
+
+void Launcher::setCloseDevice(bool c)
+{
+ d->m_closeDevice = c;
}
bool Launcher::startServer(QString *errorMessage)
{
+ errorMessage->clear();
if (d->m_verbose) {
const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Package=%3 Remote Package=%4 Install file=%5")
.arg(d->m_trkServerName, d->m_fileName, d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName);
@@ -147,15 +179,21 @@ bool Launcher::startServer(QString *errorMessage)
qWarning("No remote executable given for running.");
return false;
}
- if (!d->m_device.open(d->m_trkServerName, errorMessage))
+ if (!d->m_device->isOpen() && !d->m_device->open(d->m_trkServerName, errorMessage))
return false;
- d->m_device.sendTrkInitialPing();
- d->m_device.sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected
- d->m_device.sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask));
- d->m_device.sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType));
- d->m_device.sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion));
+ if (d->m_closeDevice) {
+ connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
+ } else {
+ disconnect(this, SIGNAL(finished()), d->m_device.data(), 0);
+ }
+
+ d->m_device->sendTrkInitialPing();
+ d->m_device->sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected
+ d->m_device->sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask));
+ d->m_device->sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType));
+ d->m_device->sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion));
if (d->m_startupActions != ActionPingOnly)
- d->m_device.sendTrkMessage(TrkConnect, TrkCallback(this, &Launcher::handleConnect));
+ d->m_device->sendTrkMessage(TrkConnect, TrkCallback(this, &Launcher::handleConnect));
return true;
}
@@ -177,7 +215,7 @@ void Launcher::handleConnect(const TrkResult &result)
void Launcher::setVerbose(int v)
{
d->m_verbose = v;
- d->m_device.setVerbose(v);
+ d->m_device->setVerbose(v);
}
void Launcher::logMessage(const QString &msg)
@@ -192,7 +230,7 @@ void Launcher::terminate()
QByteArray ba;
appendShort(&ba, 0x0000, TargetByteOrder);
appendInt(&ba, d->m_session.pid, TargetByteOrder);
- d->m_device.sendTrkMessage(TrkDeleteItem, TrkCallback(this, &Launcher::handleRemoteProcessKilled), ba);
+ d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(this, &Launcher::handleRemoteProcessKilled), ba);
} else if (d->m_connected) {
if (d->m_copyState.copyFileHandle)
closeRemoteFile(true);
@@ -234,17 +272,17 @@ void Launcher::handleResult(const TrkResult &result)
// uint pid = extractInt(data + 4); // ProcessID: 4 bytes;
// uint tid = extractInt(data + 8); // ThreadID: 4 bytes
//logMessage(prefix << " ADDR: " << addr << " PID: " << pid << " TID: " << tid);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
case TrkNotifyException: { // Notify Exception (obsolete)
logMessage(prefix + "NOTE: EXCEPTION " + str);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
case TrkNotifyInternalError: { //
logMessage(prefix + "NOTE: INTERNAL ERROR: " + str);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
@@ -277,8 +315,8 @@ void Launcher::handleResult(const TrkResult &result)
break;
QByteArray ba;
ba.append(result.data.mid(2, 8));
- d->m_device.sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
- //d->m_device.sendTrkAck(result.token)
+ d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
+ //d->m_device->sendTrkAck(result.token)
break;
}
case TrkNotifyDeleted: { // NotifyDeleted
@@ -288,7 +326,7 @@ void Launcher::handleResult(const TrkResult &result)
logMessage(QString::fromLatin1("%1 %2 UNLOAD: %3").
arg(QString::fromAscii(prefix)).arg(itemType ? QLatin1String("LIB") : QLatin1String("PROCESS")).
arg(name));
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
if (itemType == 0 // process
&& result.data.size() >= 10
&& d->m_session.pid == extractInt(result.data.data() + 6)) {
@@ -298,17 +336,17 @@ void Launcher::handleResult(const TrkResult &result)
}
case TrkNotifyProcessorStarted: { // NotifyProcessorStarted
logMessage(prefix + "NOTE: PROCESSOR STARTED: " + str);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
case TrkNotifyProcessorStandBy: { // NotifyProcessorStandby
logMessage(prefix + "NOTE: PROCESSOR STANDBY: " + str);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
case TrkNotifyProcessorReset: { // NotifyProcessorReset
logMessage(prefix + "NOTE: PROCESSOR RESET: " + str);
- d->m_device.sendTrkAck(result.token);
+ d->m_device->sendTrkAck(result.token);
break;
}
default: {
@@ -318,6 +356,11 @@ void Launcher::handleResult(const TrkResult &result)
}
}
+QString Launcher::deviceDescription(unsigned verbose) const
+{
+ return d->m_session.deviceDescription(verbose);
+}
+
void Launcher::handleTrkVersion(const TrkResult &result)
{
if (result.errorCode() || result.data.size() < 5) {
@@ -325,19 +368,13 @@ void Launcher::handleTrkVersion(const TrkResult &result)
emit finished();
return;
}
- const int trkMajor = result.data.at(1);
- const int trkMinor = result.data.at(2);
- const int protocolMajor = result.data.at(3);
- const int protocolMinor = result.data.at(4);
+ d->m_session.trkAppVersion.trkMajor = result.data.at(1);
+ d->m_session.trkAppVersion.trkMinor = result.data.at(2);
+ d->m_session.trkAppVersion.protocolMajor = result.data.at(3);
+ d->m_session.trkAppVersion.protocolMinor = result.data.at(4);
// Ping mode: Log & Terminate
if (d->m_startupActions == ActionPingOnly) {
- QString msg;
- QTextStream(&msg) << "CPU: " << d->m_session.cpuMajor << '.' << d->m_session.cpuMinor << ' '
- << (d->m_session.bigEndian ? "big endian" : "little endian")
- << " type size: " << d->m_session.defaultTypeSize
- << " float size: " << d->m_session.fpTypeSize
- << " Trk: v" << trkMajor << '.' << trkMinor << " Protocol: " << protocolMajor << '.' << protocolMinor;
- qWarning("%s", qPrintable(msg));
+ qWarning("%s", qPrintable(deviceDescription()));
emit finished();
}
}
@@ -384,7 +421,7 @@ void Launcher::continueCopying(uint lastCopiedBlockSize)
QByteArray ba;
appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false);
- d->m_device.sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba);
+ d->m_device->sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba);
} else {
closeRemoteFile();
}
@@ -395,7 +432,7 @@ void Launcher::closeRemoteFile(bool failed)
QByteArray ba;
appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
appendInt(&ba, QDateTime::currentDateTime().toTime_t(), TargetByteOrder);
- d->m_device.sendTrkMessage(TrkCloseFile,
+ d->m_device->sendTrkMessage(TrkCloseFile,
failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied),
ba);
d->m_copyState.data.reset();
@@ -458,7 +495,7 @@ void Launcher::handleCreateProcess(const TrkResult &result)
QByteArray ba;
appendInt(&ba, d->m_session.pid);
appendInt(&ba, d->m_session.tid);
- d->m_device.sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
+ d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
}
void Launcher::handleWaitForFinished(const TrkResult &result)
@@ -496,7 +533,7 @@ void Launcher::cleanUp()
appendByte(&ba, 0x00);
appendByte(&ba, 0x00);
appendInt(&ba, d->m_session.pid);
- d->m_device.sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process");
+ d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process");
//---TRK------------------------------------------------------
// Command: 0x80 Acknowledge
@@ -540,7 +577,7 @@ void Launcher::cleanUp()
void Launcher::disconnectTrk()
{
- d->m_device.sendTrkMessage(TrkDisconnect, TrkCallback(this, &Launcher::handleWaitForFinished));
+ d->m_device->sendTrkMessage(TrkDisconnect, TrkCallback(this, &Launcher::handleWaitForFinished));
}
void Launcher::copyFileToRemote()
@@ -549,7 +586,7 @@ void Launcher::copyFileToRemote()
QByteArray ba;
appendByte(&ba, 0x10);
appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false);
- d->m_device.sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba);
+ d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba);
}
void Launcher::installRemotePackageSilently()
@@ -558,7 +595,7 @@ void Launcher::installRemotePackageSilently()
QByteArray ba;
appendByte(&ba, 'C');
appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
- d->m_device.sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
+ d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
}
void Launcher::handleInstallPackageFinished(const TrkResult &result)
@@ -586,7 +623,6 @@ void Launcher::startInferiorIfNeeded()
appendByte(&ba, 0); // create new process
appendByte(&ba, 0); // ?
appendString(&ba, d->m_fileName.toLocal8Bit(), TargetByteOrder);
- d->m_device.sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), ba); // Create Item
-}
-
+ d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), ba); // Create Item
}
+} // namespace trk
diff --git a/src/shared/trk/launcher.h b/src/shared/trk/launcher.h
index a216b79fcb..2c4881de6d 100644
--- a/src/shared/trk/launcher.h
+++ b/src/shared/trk/launcher.h
@@ -29,8 +29,11 @@
#ifndef LAUNCHER_H
#define LAUNCHER_H
+#include "trkdevice.h"
+
#include <QtCore/QObject>
#include <QtCore/QVariant>
+#include <QtCore/QSharedPointer>
namespace trk {
@@ -38,9 +41,12 @@ struct TrkResult;
struct TrkMessage;
struct LauncherPrivate;
+typedef QSharedPointer<TrkDevice> TrkDevicePtr;
+
class Launcher : public QObject
{
Q_OBJECT
+ Q_DISABLE_COPY(Launcher)
public:
typedef void (Launcher::*TrkCallBack)(const TrkResult &);
@@ -55,10 +61,13 @@ public:
ActionCopyInstallRun = ActionCopy | ActionInstall | ActionRun
};
- Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly);
+ explicit Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly,
+ const TrkDevicePtr &trkDevice = TrkDevicePtr(),
+ QObject *parent = 0);
~Launcher();
void addStartupActions(trk::Launcher::Actions startupActions);
void setTrkServerName(const QString &name);
+ QString trkServerName() const;
void setFileName(const QString &name);
void setCopyFileName(const QString &srcName, const QString &dstName);
void setInstallFileName(const QString &name);
@@ -66,6 +75,14 @@ public:
void setVerbose(int v);
void setSerialFrame(bool b);
bool serialFrame() const;
+ // Close device or leave it open
+ bool closeDevice() const;
+ void setCloseDevice(bool c);
+
+ TrkDevicePtr trkDevice() const;
+
+ // becomes valid after successful execution of ActionPingOnly
+ QString deviceDescription(unsigned verbose = 0u) const;
signals:
void copyingStarted();
diff --git a/src/shared/trk/trk.pri b/src/shared/trk/trk.pri
index 1564e4684d..5b0e067b15 100644
--- a/src/shared/trk/trk.pri
+++ b/src/shared/trk/trk.pri
@@ -1,13 +1,22 @@
INCLUDEPATH *= $$PWD
# Input
-HEADERS += \
- $$PWD/callback.h \
+HEADERS += $$PWD/callback.h \
$$PWD/trkutils.h \
$$PWD/trkdevice.h \
- $$PWD/launcher.h
+ $$PWD/launcher.h \
+ $$PWD/bluetoothlistener.h \
+ $$PWD/communicationstarter.h
-SOURCES += \
- $$PWD/trkutils.cpp \
+SOURCES += $$PWD/trkutils.cpp \
$$PWD/trkdevice.cpp \
- $$PWD/launcher.cpp
+ $$PWD/launcher.cpp \
+ $$PWD/bluetoothlistener.cpp \
+ $$PWD/communicationstarter.cpp
+
+contains(QT, gui) {
+ HEADERS += $$PWD/bluetoothlistener_gui.h
+ SOURCES += $$PWD/bluetoothlistener_gui.cpp
+} else {
+ message(Trk: Console ...)
+}
diff --git a/src/shared/trk/trkdevice.cpp b/src/shared/trk/trkdevice.cpp
index a303ba1c2d..a76cff79c2 100644
--- a/src/shared/trk/trkdevice.cpp
+++ b/src/shared/trk/trkdevice.cpp
@@ -436,15 +436,52 @@ void WriterThread::terminate()
}
#ifdef Q_OS_WIN
-static inline bool overlappedSyncWrite(HANDLE file, const char *data,
+
+static inline QString msgTerminated(int size)
+{
+ return QString::fromLatin1("Terminated with %1 bytes pending.").arg(size);
+}
+
+// Interruptible synchronous write function.
+static inline bool overlappedSyncWrite(HANDLE file,
+ const bool &terminateFlag,
+ const char *data,
DWORD size, DWORD *charsWritten,
- OVERLAPPED *overlapped)
+ OVERLAPPED *overlapped,
+ QString *errorMessage)
{
if (WriteFile(file, data, size, charsWritten, overlapped))
return true;
- if (GetLastError() != ERROR_IO_PENDING)
+ const DWORD writeError = GetLastError();
+ if (writeError != ERROR_IO_PENDING) {
+ *errorMessage = QString::fromLatin1("WriteFile failed: %1").arg(winErrorMessage(writeError));
+ return false;
+ }
+ // Wait for written or thread terminated
+ const DWORD timeoutMS = 200;
+ const unsigned maxAttempts = 20;
+ DWORD wr = WaitForSingleObject(overlapped->hEvent, timeoutMS);
+ for (unsigned n = 0; wr == WAIT_TIMEOUT && n < maxAttempts && !terminateFlag;
+ wr = WaitForSingleObject(overlapped->hEvent, timeoutMS), n++);
+ if (terminateFlag) {
+ *errorMessage = msgTerminated(size);
+ return false;
+ }
+ switch (wr) {
+ case WAIT_OBJECT_0:
+ break;
+ case WAIT_TIMEOUT:
+ *errorMessage = QString::fromLatin1("Write timed out.");
+ return false;
+ default:
+ *errorMessage = QString::fromLatin1("Error while waiting for WriteFile results: %1").arg(winErrorMessage(GetLastError()));
+ return false;
+ }
+ if (!GetOverlappedResult(file, overlapped, charsWritten, TRUE)) {
+ *errorMessage = QString::fromLatin1("Error writing %1 bytes: %2").arg(size).arg(winErrorMessage(GetLastError()));
return false;
- return GetOverlappedResult(file, overlapped, charsWritten, TRUE);
+ }
+ return true;
}
#endif
@@ -453,8 +490,7 @@ bool WriterThread::write(const QByteArray &data, QString *errorMessage)
QMutexLocker locker(&m_context->mutex);
#ifdef Q_OS_WIN
DWORD charsWritten;
- if (!overlappedSyncWrite(m_context->device, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped)) {
- *errorMessage = QString::fromLatin1("Error writing data: %1").arg(winErrorMessage(GetLastError()));
+ if (!overlappedSyncWrite(m_context->device, m_terminate, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped, errorMessage)) {
return false;
}
FlushFileBuffers(m_context->device);
@@ -473,8 +509,10 @@ bool WriterThread::trkWriteRawMessage(const TrkMessage &msg)
const QByteArray ba = frameMessage(msg.code, msg.token, msg.data, m_context->serialFrame);
QString errorMessage;
const bool rc = write(ba, &errorMessage);
- if (!rc)
+ if (!rc) {
+ qWarning("%s\n", qPrintable(errorMessage));
emit error(errorMessage);
+ }
return rc;
}
@@ -844,7 +882,7 @@ TrkDevice::~TrkDevice()
bool TrkDevice::open(const QString &port, QString *errorMessage)
{
if (d->verbose)
- qDebug() << "Opening" << port << "is open: " << isOpen();
+ qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame();
close();
#ifdef Q_OS_WIN
d->deviceContext->device = CreateFile(port.toStdWString().c_str(),
@@ -917,8 +955,10 @@ void TrkDevice::close()
{
if (!isOpen())
return;
- d->readerThread->terminate();
- d->writerThread->terminate();
+ if (d->readerThread)
+ d->readerThread->terminate();
+ if (d->writerThread)
+ d->writerThread->terminate();
#ifdef Q_OS_WIN
CloseHandle(d->deviceContext->device);
d->deviceContext->device = INVALID_HANDLE_VALUE;
diff --git a/src/shared/trk/trkutils.cpp b/src/shared/trk/trkutils.cpp
index 463415e7c2..93df393799 100644
--- a/src/shared/trk/trkutils.cpp
+++ b/src/shared/trk/trkutils.cpp
@@ -36,6 +36,75 @@
namespace trk {
+TrkAppVersion::TrkAppVersion()
+{
+ reset();
+}
+
+void TrkAppVersion::reset()
+{
+ trkMajor = trkMinor= protocolMajor = protocolMinor = 0;
+}
+
+Session::Session()
+{
+ reset();
+}
+
+void Session::reset()
+{
+ cpuMajor = 0;
+ cpuMinor = 0;
+ bigEndian = 0;
+ defaultTypeSize = 0;
+ fpTypeSize = 0;
+ extended1TypeSize = 0;
+ extended2TypeSize = 0;
+ pid = 0;
+ tid = 0;
+ codeseg = 0;
+ dataseg = 0;
+
+ currentThread = 0;
+ libraries.clear();
+ trkAppVersion.reset();
+}
+
+inline void formatCpu(QTextStream &str,int major, int minor)
+{
+ str << "CPU: v" << major << '.' << minor;
+ switch (major) {
+ case 0x04:
+ str << " ARM";
+ break;
+ }
+ switch (minor) {
+ case 0x00:
+ str << " 920T";
+ break;
+ }
+ }
+
+QString Session::deviceDescription(unsigned verbose) const
+{
+ QString msg;
+ if (cpuMajor) {
+ QTextStream str(&msg);
+ formatCpu(str, cpuMajor, cpuMinor);
+ str << ", " << (bigEndian ? "big endian" : "little endian");
+ if (verbose) {
+ if (defaultTypeSize)
+ str << ", type size: " << defaultTypeSize;
+ if (fpTypeSize)
+ str << ", float size: " << fpTypeSize;
+ }
+ str << ", Trk: v" << trkAppVersion.trkMajor << '.' << trkAppVersion.trkMinor
+ << " Protocol: v" << trkAppVersion.protocolMajor << '.' << trkAppVersion.protocolMinor;
+ }
+ return msg;
+}
+
+
// FIXME: Use the QByteArray based version below?
QString stringFromByte(byte c)
{
diff --git a/src/shared/trk/trkutils.h b/src/shared/trk/trkutils.h
index e8388356c5..aec86a1730 100644
--- a/src/shared/trk/trkutils.h
+++ b/src/shared/trk/trkutils.h
@@ -97,31 +97,26 @@ struct Library
{
Library() {}
- QString name;
+ QByteArray name;
uint codeseg;
uint dataseg;
};
+struct TrkAppVersion {
+ TrkAppVersion();
+ void reset();
+
+ int trkMajor;
+ int trkMinor;
+ int protocolMajor;
+ int protocolMinor;
+};
+
struct Session
{
- Session() { reset(); }
-
- void reset() {
- cpuMajor = 0;
- cpuMinor = 0;
- bigEndian = 0;
- defaultTypeSize = 0;
- fpTypeSize = 0;
- extended1TypeSize = 0;
- extended2TypeSize = 0;
- pid = 0;
- tid = 0;
- codeseg = 0;
- dataseg = 0;
-
- currentThread = 0;
- libraries.clear();
- }
+ Session();
+ void reset();
+ QString deviceDescription(unsigned verbose) const;
// Trk feedback
byte cpuMajor;
@@ -131,6 +126,7 @@ struct Session
byte fpTypeSize;
byte extended1TypeSize;
byte extended2TypeSize;
+ TrkAppVersion trkAppVersion;
uint pid;
uint tid;
uint codeseg;
diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp
index 3df6573ccd..bf113873fe 100644
--- a/tests/auto/cplusplus/semantic/tst_semantic.cpp
+++ b/tests/auto/cplusplus/semantic/tst_semantic.cpp
@@ -100,6 +100,7 @@ private slots:
void typedef_3();
void const_1();
void const_2();
+ void pointer_to_function_1();
};
void tst_Semantic::function_declaration_1()
@@ -367,5 +368,24 @@ void tst_Semantic::const_2()
QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType());
}
+void tst_Semantic::pointer_to_function_1()
+{
+ QSharedPointer<Document> doc = document("void (*QtSomething)();");
+ QCOMPARE(doc->errorCount, 0U);
+ QCOMPARE(doc->globals->symbolCount(), 1U);
+
+ Declaration *decl = doc->globals->symbolAt(0)->asDeclaration();
+ QVERIFY(decl);
+
+ PointerType *ptrTy = decl->type()->asPointerType();
+ QVERIFY(ptrTy);
+
+ Function *funTy = ptrTy->elementType()->asFunctionType();
+ QVERIFY(funTy);
+
+ QVERIFY(funTy->scope());
+ QCOMPARE(funTy->scope(), decl->scope());
+}
+
QTEST_APPLESS_MAIN(tst_Semantic)
#include "tst_semantic.moc"
diff --git a/tests/auto/debugger/tst_gdb.cpp b/tests/auto/debugger/tst_gdb.cpp
index 433b11f819..f40b0756c7 100644
--- a/tests/auto/debugger/tst_gdb.cpp
+++ b/tests/auto/debugger/tst_gdb.cpp
@@ -1,4 +1,6 @@
+//bool checkUninitialized = true;
+bool checkUninitialized = false;
//#define DO_DEBUG 1
#include <QtCore/QThread>
@@ -45,6 +47,46 @@ using namespace Debugger;
using namespace Debugger::Internal;
+class Foo
+{
+public:
+ Foo(int i = 0)
+ : a(i), b(2)
+ {}
+
+ ~Foo()
+ {
+ }
+ void doit()
+ {
+ static QObject ob;
+ m["1"] = "2";
+ h[&ob] = m.begin();
+
+ a += 1;
+ --b;
+ //s += 'x';
+ }
+
+
+ struct Bar {
+ Bar() : ob(0) {}
+ QObject *ob;
+ };
+
+public:
+ int a, b;
+ char x[6];
+
+private:
+ //QString s;
+ typedef QMap<QString, QString> Map;
+ Map m;
+ QHash<QObject *, Map::iterator> h;
+};
+
+
+
/////////////////////////////////////////////////////////////////////////
//
// Helper stuff
@@ -135,18 +177,28 @@ signals:
void writeToGdb(const QByteArray &ba);
private slots:
+ void dumpArray();
void dumpMisc();
+ void dumpFoo();
+ void dumpQByteArray();
+ void dumpQChar();
+ void dumpQList_char_star();
+ void dumpQList_char();
void dumpQList_int();
+ void dumpQList_QString();
+ void dumpQList_QString3();
+ void dumpQList_Int3();
+ void dumpQStack();
void dumpQString();
void dumpQStringList();
+ void dumpQWeakPointer();
+ void dumpQVector();
public slots:
void dumperCompatibility();
#if 0
void dumpQAbstractItemAndModelIndex();
void dumpQAbstractItemModel();
- void dumpQByteArray();
- void dumpQChar();
void dumpQDateTime();
void dumpQDir();
void dumpQFile();
@@ -156,10 +208,6 @@ public slots:
void dumpQImage();
void dumpQImageData();
void dumpQLinkedList();
- void dumpQList_char();
- void dumpQList_QString();
- void dumpQList_QString3();
- void dumpQList_Int3();
void dumpQLocale();
void dumpQMap();
void dumpQMapNode();
@@ -178,7 +226,6 @@ public slots:
void dumpQVariant_QString();
void dumpQVariant_QStringList();
void dumpStdVector();
- void dumpQWeakPointer();
#endif
private:
@@ -398,6 +445,357 @@ void getMapNodeParams(size_t &nodeSize, size_t &valOffset)
}
#endif
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Gdb Thread
+//
+/////////////////////////////////////////////////////////////////////////
+
+Thread::Thread(tst_Gdb *test)
+{
+ moveToThread(this);
+ m_test = test;
+ m_proc = 0;
+ m_proc = new QProcess;
+ m_proc->moveToThread(this);
+ qDebug() << "\nTHREAD CREATED" << getpid() << gettid();
+ connect(m_test, SIGNAL(writeToGdb(QByteArray)),
+ this, SLOT(writeToGdbRequested(QByteArray)));
+ connect(m_proc, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(handleGdbError(QProcess::ProcessError)));
+ connect(m_proc, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(handleGdbFinished(int, QProcess::ExitStatus)));
+ connect(m_proc, SIGNAL(started()),
+ this, SLOT(handleGdbStarted()));
+ connect(m_proc, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(readStandardOutput()));
+ connect(m_proc, SIGNAL(readyReadStandardError()),
+ this, SLOT(readStandardError()));
+ start();
+}
+
+void Thread::handleGdbError(QProcess::ProcessError error)
+{
+ qDebug() << "GDB ERROR: " << error;
+ //this->exit();
+}
+
+void Thread::handleGdbFinished(int code, QProcess::ExitStatus st)
+{
+ qDebug() << "GDB FINISHED: " << code << st;
+ //m_waitCondition.wakeAll();
+ //this->exit();
+ throw 42;
+}
+
+void Thread::readStandardOutput()
+{
+ QByteArray ba = m_proc->readAllStandardOutput();
+ DEBUG("THREAD GDB OUT: " << ba);
+ // =library-loaded...
+ if (ba.startsWith("="))
+ return;
+ if (ba.startsWith("*stopped")) {
+ m_lastStopped = ba;
+ //qDebug() << "THREAD GDB OUT: " << ba;
+ if (!ba.contains("func=\"main\"")) {
+ int pos1 = ba.indexOf(",line=\"") + 7;
+ int pos2 = ba.indexOf("\"", pos1);
+ m_line = ba.mid(pos1, pos2 - pos1).toInt();
+ DEBUG(" LINE 1: " << m_line);
+ }
+ }
+
+ // The "call" is always aborted with a message like:
+ // "~"2321\t /* A */ QString s;\n" "
+ // "&"The program being debugged stopped while in a function called ..."
+ // "^error,msg="The program being debugged stopped ..."
+ // Extract the "2321" from this
+ static QByteArray lastText;
+ if (ba.startsWith("~")) {
+ lastText = ba;
+ if (ba.size() > 8
+ && (ba.at(2) < 'a' || ba.at(2) > 'z')
+ && (ba.at(2) < '0' || ba.at(2) > '9')
+ && !ba.startsWith("~\"Breakpoint ")
+ && !ba.startsWith("~\" at ")
+ && !ba.startsWith("~\" locals=")
+ && !ba.startsWith("~\"XXX:")) {
+ QByteArray ba1 = ba.mid(2, ba.size() - 6);
+ if (ba1.startsWith(" File "))
+ ba1 = ba1.replace(2, ba1.indexOf(','), "");
+ qWarning() << "OUT: " << ba1;
+ }
+ }
+ if (ba.startsWith("&\"The program being debugged")) {
+ int pos1 = 2;
+ int pos2 = lastText.indexOf("\\", pos1);
+ m_line = lastText.mid(pos1, pos2 - pos1).toInt();
+ DEBUG(" LINE 2: " << m_line);
+ }
+ if (ba.startsWith("^error,msg=")) {
+ if (!ba.startsWith("^error,msg=\"The program being debugged stopped"))
+ qWarning() << "ERROR: " << ba.mid(1, ba.size() - 3);
+ }
+
+ if (ba.startsWith("~\"XXX: ")) {
+ QByteArray ba1 = ba.mid(7, ba.size() - 11);
+ qWarning() << "MESSAGE: " << ba.mid(7, ba.size() - 12);
+ }
+ if (!ba.contains("locals={iname="))
+ return;
+ //m_output += ba;
+ ba = ba.mid(2, ba.size() - 4);
+ ba = ba.replace("\\\"", "\"");
+ m_output = ba;
+ m_waitCondition.wakeAll();
+}
+
+void Thread::readStandardError()
+{
+ QByteArray ba = m_proc->readAllStandardOutput();
+ qDebug() << "THREAD GDB ERR: " << ba;
+}
+
+void Thread::handleGdbStarted()
+{
+ //qDebug() << "\n\nGDB STARTED" << getpid() << gettid() << "\n\n";
+}
+
+void Thread::run()
+{
+ //qDebug() << "\nTHREAD RUN" << getpid() << gettid();
+ m_proc->start("./gdb -i mi --args ./tst_gdb run");
+ m_proc->waitForStarted();
+ m_proc->write("break main\n");
+ m_proc->write("run\n");
+ m_proc->write("handle SIGSTOP stop pass\n");
+ //qDebug() << "\nTHREAD RUNNING";
+ exec();
+}
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Test Class Framework Implementation
+//
+/////////////////////////////////////////////////////////////////////////
+
+tst_Gdb::tst_Gdb()
+ : m_thread(this)
+{
+ // FIXME: Wait until gdb proc is running.
+ QTest::qWait(600);
+
+ QFile file("tst_gdb.cpp");
+ Q_ASSERT(file.open(QIODevice::ReadOnly));
+ QByteArray funcName;
+ const QByteArrayList bal = file.readAll().split('\n');
+ Q_ASSERT(bal.size() > 100);
+ for (int i = 0; i != bal.size(); ++i) {
+ const QByteArray &ba = bal.at(i);
+ if (ba.startsWith("void dump")) {
+ int pos = ba.indexOf('(');
+ funcName = ba.mid(5, pos - 5) + '@';
+ } else if (ba.startsWith(" /*")) {
+ int pos = ba.indexOf('*', 7);
+ m_lineForLabel[funcName + ba.mid(7, pos - 8)] = i + 1;
+ }
+ }
+}
+
+void tst_Gdb::prepare(const QByteArray &function)
+{
+ m_function = function;
+ writeToGdb("b " + function);
+ writeToGdb("call " + function + "()");
+}
+
+static bool isJoker(const QByteArray &ba)
+{
+ return ba.endsWith("'-'") || ba.contains("'-'}");
+}
+
+void tst_Gdb::run(const QByteArray &label, const QByteArray &expected0,
+ const QByteArray &expanded, bool fancy)
+{
+ //qDebug() << "\nABOUT TO RUN TEST: " << expanded;
+ qWarning() << label << "...";
+ writeToGdb("bb " + QByteArray::number(int(fancy)) + " " + expanded);
+ m_mutex.lock();
+ m_waitCondition.wait(&m_mutex);
+ QByteArray ba = m_thread.m_output;
+ m_mutex.unlock();
+ //GdbMi locals;
+ //locals.fromString("{" + ba + "}");
+ QByteArray received = ba.replace("\"", "'");
+ //qDebug() << "OUTPUT: " << ba << "\n\n";
+ //qDebug() << "OUTPUT: " << locals.toString() << "\n\n";
+
+ QByteArray actual = received.trimmed();
+ if (actual.endsWith("\\n"))
+ actual.chop(2);
+ QByteArray expected = "locals={iname='local',name='Locals',value=' ',type=' ',"
+ "children=[" + expected0 + "]}";
+ int line = m_thread.m_line;
+
+ QByteArrayList l1 = actual.split(',');
+ QByteArrayList l2 = expected.split(',');
+
+ bool ok = l1.size() == l2.size();
+ if (ok) {
+ for (int i = 0 ; i < l1.size(); ++i) {
+ // Use "-" as joker.
+ if (l1.at(i) != l2.at(i) && !isJoker(l2.at(i)))
+ ok = false;
+ }
+ } else {
+ qWarning() << "!= size: " << l1.size() << l2.size();
+ }
+
+ if (!ok) {
+ int i = 0;
+ for ( ; i < l1.size() && i < l2.size(); ++i) {
+ if (l1.at(i) == l2.at(i) || isJoker(l2.at(i))) {
+ qWarning() << "== " << l1.at(i);
+ } else {
+ //qWarning() << "!= " << l1.at(i).right(30) << l2.at(i).right(30);
+ qWarning() << "!= " << l1.at(i) << l2.at(i);
+ ok = false;
+ }
+ }
+ for ( ; i < l2.size(); ++i)
+ qWarning() << "!= " << "-----" << l2.at(i);
+ for ( ; i < l1.size(); ++i)
+ qWarning() << "!= " << l1.at(i) << "-----";
+ if (l1.size() != l2.size()) {
+ ok = false;
+ qWarning() << "!= size: " << l1.size() << l2.size();
+ }
+ qWarning() << "RECEIVED: " << received;
+ }
+ QCOMPARE(ok, true);
+ //qWarning() << "LINE: " << line << "ACT/EXP" << m_function + '@' + label;
+ //QCOMPARE(actual, expected);
+
+
+ int expline = m_lineForLabel.value(m_function + '@' + label);
+ int actline = line;
+ if (actline != expline) {
+ qWarning() << "LAST STOPPED: " << m_thread.m_lastStopped;
+ }
+ QCOMPARE(actline, expline);
+}
+
+void tst_Gdb::next(int n)
+{
+ for (int i = 0; i != n; ++i)
+ writeToGdb("next");
+}
+
+void tst_Gdb::cleanupTestCase()
+{
+ writeToGdb("kill");
+ writeToGdb("quit");
+ //m_thread.m_proc->waitForFinished();
+}
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Dumper Tests
+//
+/////////////////////////////////////////////////////////////////////////
+
+///////////////////////////// Foo structure /////////////////////////////////
+
+void dumpFoo()
+{
+ /* A */ Foo f;
+ /* B */ f.doit();
+ /* D */ (void) 0;
+}
+
+void tst_Gdb::dumpFoo()
+{
+ prepare("dumpFoo");
+ next();
+ run("B","{iname='local.f',addr='-',name='f',type='Foo',"
+ "value='-',numchild='5'}", "", 0);
+ run("B","{iname='local.f',addr='-',name='f',type='Foo',"
+ "value='-',numchild='5',children=["
+ "{iname='local.f.a',name='a',type='int',value='0',numchild='0'},"
+ "{iname='local.f.b',name='b',type='int',value='2',numchild='0'},"
+ "{iname='local.f.x',name='x',type='char [6]',"
+ "value='{...}',numchild='1'},"
+ "{iname='local.f.m',name='m',type='"NS"QMap<"NS"QString, "NS"QString>',"
+ "value='{...}',numchild='1'},"
+ "{iname='local.f.h',name='h',type='"NS"QHash<"NS"QObject*, "
+ ""NS"QMap<"NS"QString, "NS"QString>::iterator>',"
+ "value='{...}',numchild='1'}]}",
+ "local.f", 0);
+}
+
+
+///////////////////////////// Array ///////////////////////////////////////
+
+void dumpArray_char()
+{
+ /* A */ const char s[] = "XYZ";
+ /* B */ (void) &s; }
+
+void dumpArray_int()
+{
+ /* A */ int s[] = {1, 2, 3};
+ /* B */ (void) s; }
+
+void tst_Gdb::dumpArray()
+{
+ prepare("dumpArray_char");
+ next();
+ // FIXME: numchild should be '4', not '1'
+ run("B","{iname='local.s',addr='-',name='s',type='char [4]',"
+ "value='-',numchild='1'}", "");
+ run("B","{iname='local.s',addr='-',name='s',type='char [4]',"
+ "value='-',numchild='1',childtype='char',childnumchild='0',"
+ "children=[{value='88 'X''},{value='89 'Y''},{value='90 'Z''},"
+ "{value='0 '\\\\000''}]}",
+ "local.s");
+
+ prepare("dumpArray_int");
+ next();
+ // FIXME: numchild should be '3', not '1'
+ run("B","{iname='local.s',addr='-',name='s',type='int [3]',"
+ "value='-',numchild='1'}", "");
+ run("B","{iname='local.s',addr='-',name='s',type='int [3]',"
+ "value='-',numchild='1',childtype='int',childnumchild='0',"
+ "children=[{value='1'},{value='2'},{value='3'}]}",
+ "local.s");
+}
+
+
+///////////////////////////// Misc stuff /////////////////////////////////
+
+void dumpMisc()
+{
+ /* A */ int *s = new int(1);
+ /* B */ *s += 1;
+ /* D */ (void) 0;
+}
+
+void tst_Gdb::dumpMisc()
+{
+ prepare("dumpMisc");
+ next();
+ run("B","{iname='local.s',addr='-',name='s',type='int *',"
+ "value='-',numchild='1'}", "", 0);
+ run("B","{iname='local.s',addr='-',name='s',type='int *',"
+ "value='-',numchild='1',children=[{iname='local.s.*',"
+ "name='*s',type='int',value='1',numchild='0'}]}", "local.s", 0);
+}
+
#if 0
void tst_Gdb::dumpQAbstractItemHelper(QModelIndex &index)
{
@@ -649,81 +1047,93 @@ void tst_Gdb::dumpQAbstractItemModel()
model2.appendRow(QList<QStandardItem *>() << &item3 << &item4);
dumpQAbstractItemModelHelper(model);
}
+#endif
-void tst_Gdb::dumpQByteArray()
+void dumpQByteArrayTest()
{
- // Case 1: Empty object.
- QByteArray ba;
- testDumper("value='',valueencoded='1',type='"NS"QByteArray',numchild='0',"
- "childtype='char',childnumchild='0',children=[]",
- &ba, NS"QByteArray", true);
-
- // Case 2: One element.
- ba.append('a');
- testDumper("value='YQ==',valueencoded='1',type='"NS"QByteArray',numchild='1',"
- "childtype='char',childnumchild='0',children=[{value='61 (97 'a')'}]",
- &ba, NS"QByteArray", true);
-
- // Case 3: Two elements.
- ba.append('b');
- testDumper("value='YWI=',valueencoded='1',type='"NS"QByteArray',numchild='2',"
- "childtype='char',childnumchild='0',children=["
- "{value='61 (97 'a')'},{value='62 (98 'b')'}]",
- &ba, NS"QByteArray", true);
-
- // Case 4: > 100 elements.
- ba = QByteArray(101, 'a');
- QByteArray children;
- for (int i = 0; i < 101; i++)
- children.append("{value='61 (97 'a')'},");
- children.chop(1);
- testDumper(QByteArray("value='YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh"
- "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh"
- "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== <size: 101, cut...>',"
- "valueencoded='1',type='"NS"QByteArray',numchild='101',"
- "childtype='char',childnumchild='0',children=[%]") << children,
- &ba, NS"QByteArray", true);
-
- // Case 5: Regular and special characters and the replacement character.
- ba = QByteArray("abc\a\n\r\e\'\"?");
- testDumper("value='YWJjBwoNGyciPw==',valueencoded='1',type='"NS"QByteArray',"
- "numchild='10',childtype='char',childnumchild='0',children=["
- "{value='61 (97 'a')'},{value='62 (98 'b')'},"
- "{value='63 (99 'c')'},{value='07 (7 '?')'},"
- "{value='0a (10 '?')'},{value='0d (13 '?')'},"
- "{value='1b (27 '?')'},{value='27 (39 '?')'},"
- "{value='22 (34 '?')'},{value='3f (63 '?')'}]",
- &ba, NS"QByteArray", true);
+ /* A */ QByteArray ba; // Empty object.
+ /* B */ ba.append('a'); // One element.
+ /* C */ ba.append('b'); // Two elements.
+ /* D */ ba = QByteArray(101, 'a'); // > 100 elements.
+ /* E */ ba = QByteArray("abc\a\n\r\e\'\"?"); // Mixed.
+ /* F */ (void) 0;
}
+void tst_Gdb::dumpQByteArray()
+{
+ prepare("dumpQByteArrayTest");
+ if (1 || checkUninitialized)
+ run("A","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='',numchild='0'}");
+ next();
+ run("C","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='61',numchild='1'}");
+ next();
+ run("D","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='6162',numchild='2'}");
+ next();
+ run("E","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='616161616161616161616161616161616161"
+ "616161616161616161616161616161616161616161616161616161616161"
+ "616161616161616161616161616161616161616161616161616161616161"
+ "6161616161616161616161616161616161616161616161',numchild='101'}");
+ next();
+ run("F","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='616263070a0d1b27223f',numchild='10'}");
+ run("F","{iname='local.ba',addr='-',name='ba',type='"NS"QByteArray',"
+ "valueencoded='6',value='616263070a0d1b27223f',numchild='10',"
+ "childtype='char',childnumchild='0',"
+ "children=[{value='97 'a''},{value='98 'b''},"
+ "{value='99 'c''},{value='7 '\\\\a''},"
+ "{value='10 '\\\\n''},{value='13 '\\\\r''},"
+ "{value='27 '\\\\033''},{value='39 '\\\\'''},"
+ "{value='34 ''''},{value='63 '?''}]}",
+ "local.ba");
+}
+
+void dumpQCharTest()
+{
+ /* A */ QChar c('X'); // Printable ASCII character.
+ /* B */ c = QChar(0x600); // Printable non-ASCII character.
+ /* C */ c = QChar::fromAscii('\a'); // Non-printable ASCII character.
+ /* D */ c = QChar(0x9f); // Non-printable non-ASCII character.
+ /* E */ c = QChar::fromAscii('?'); // The replacement character.
+ /* F */ (void) 0; }
+
void tst_Gdb::dumpQChar()
{
+ prepare("dumpQCharTest");
+ next();
+
// Case 1: Printable ASCII character.
- QChar c('X');
- testDumper("value=''X', ucs=88',numchild='0'",
- &c, NS"QChar", false);
+ run("B","{iname='local.c',addr='-',name='c',type='"NS"QChar',"
+ "value=''X', ucs=88',numchild='0'}");
+ next();
// Case 2: Printable non-ASCII character.
- c = QChar(0x600);
- testDumper("value=''?', ucs=1536',numchild='0'",
- &c, NS"QChar", false);
+ run("C","{iname='local.c',addr='-',name='c',type='"NS"QChar',"
+ "value=''?', ucs=1536',numchild='0'}");
+ next();
// Case 3: Non-printable ASCII character.
- c = QChar::fromAscii('\a');
- testDumper("value=''?', ucs=7',numchild='0'",
- &c, NS"QChar", false);
+ run("D","{iname='local.c',addr='-',name='c',type='"NS"QChar',"
+ "value=''?', ucs=7',numchild='0'}");
+ next();
// Case 4: Non-printable non-ASCII character.
- c = QChar(0x9f);
- testDumper("value=''?', ucs=159',numchild='0'",
- &c, NS"QChar", false);
+ run("E","{iname='local.c',addr='-',name='c',type='"NS"QChar',"
+ "value=''?', ucs=159',numchild='0'}");
+ next();
// Case 5: Printable ASCII Character that looks like the replacement character.
- c = QChar::fromAscii('?');
- testDumper("value=''?', ucs=63',numchild='0'",
- &c, NS"QChar", false);
+ run("F","{iname='local.c',addr='-',name='c',type='"NS"QChar',"
+ "value=''?', ucs=63',numchild='0'}");
}
+#if 0
void tst_Gdb::dumpQDateTimeHelper(const QDateTime &d)
{
QByteArray value;
@@ -1160,36 +1570,6 @@ void tst_Gdb::dumpQLinkedList()
}
#endif
-void tst_Gdb::dumpQList_Int3()
-{
- QList<Int3> i3list;
- testDumper("value='<0 items>',valuedisabled='true',numchild='0',"
- "internal='0',children=[]",
- &i3list, NS"QList", true, "Int3");
- i3list.append(Int3());
- i3list.append(Int3());
- testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
- "internal='0',childtype='Int3',children=["
- "{addr='" + str(&i3list.at(0)) + "'},"
- "{addr='" + str(&i3list.at(1)) + "'}]",
- &i3list, NS"QList", true, "Int3");
-}
-
-void tst_Gdb::dumpQList_QString3()
-{
- QList<QString3> s3list;
- testDumper("value='<0 items>',valuedisabled='true',numchild='0',"
- "internal='0',children=[]",
- &s3list, NS"QList", true, "QString3");
- s3list.append(QString3());
- s3list.append(QString3());
- testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
- "internal='0',childtype='QString3',children=["
- "{addr='" + str(&s3list.at(0)) + "'},"
- "{addr='" + str(&s3list.at(1)) + "'}]",
- &s3list, NS"QList", true, "QString3");
-}
-
void tst_Gdb::dumpQLocaleHelper(QLocale &loc)
{
QByteArray expected = QByteArray("value='%',type='$T',numchild='8',"
@@ -2061,19 +2441,102 @@ void tst_Gdb::dumpQWeakPointerHelper(QWeakPointer<T> &ptr)
testDumper(expected, &ptr, NS"QWeakPointer", true, typeToString<T>());
}
#endif
+#endif // #if 0
+
+///////////////////////////// QWeakPointer /////////////////////////////////
+
+#if QT_VERSION >= 0x040500
+void dumpQWeakPointer_11()
+{
+ // Case 1: Simple type.
+ // Case 1.1: Null pointer.
+ /* A */ QSharedPointer<int> sp;
+ /* */ QWeakPointer<int> wp = sp.toWeakRef();
+ /* B */ (void) 0;
+}
+
+void dumpQWeakPointer_12()
+{
+ // Case 1.2: Weak pointer is unique.
+ /* A */ QSharedPointer<int> sp(new int(99));
+ /* */ QWeakPointer<int> wp = sp.toWeakRef();
+ /* B */ (void) 0;
+}
+
+void dumpQWeakPointer_13()
+{
+ // Case 1.3: There are other weak pointers.
+ /* A */ QSharedPointer<int> sp(new int(99));
+ /* */ QWeakPointer<int> wp = sp.toWeakRef();
+ /* B */ (void) 0;
+}
+
+void dumpQWeakPointer_14()
+{
+ // Case 1.4: There are other strong shared pointers as well.
+ /* A */ QSharedPointer<int> sp(new int(99));
+ /* */ QSharedPointer<int> sp2(sp);
+ /* B */ (void) 0;
+}
+
+void dumpQWeakPointer_2()
+{
+ // Case 2: Composite type.
+ /* A */ QSharedPointer<QString> sp(new QString("Test"));
+ /* */ QWeakPointer<QString> wp = sp.toWeakRef();
+ /* B */ (void) 0;
+}
+#endif
void tst_Gdb::dumpQWeakPointer()
{
#if QT_VERSION >= 0x040500
- // Case 1: Simple type.
+
+return;
// Case 1.1: Null pointer.
- QSharedPointer<int> spNull;
- QWeakPointer<int> wp = spNull.toWeakRef();
- testDumper("value='<null>',valuedisabled='true',numchild='0'",
- &wp, NS"QWeakPointer", true, "int");
+ prepare("dumpQWeakPointer_11");
+ if (checkUninitialized)
+ run("A","{iname='local.sp',addr='-',name='sp',"
+ "type='"NS"QSharedPointer<int>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.sp',addr='-',name='sp',"
+ "type='"NS"QSharedPointer<int>',value='<0 items>',numchild='1'}");
+
+/*
+ //,numchild='1',children=[{name='data',addr='").
+ append(ptrToBa(data)).append("',type='").append(typeToString<T>()).
+ append("',value='").append(dataStr).append("'},{name='weakref',value='").
+ append(valToString(*weakRefPtr)).append("',type='int',addr='").
+ append(ptrToBa(weakRefPtr)).append("',numchild='0'},{name='strongref',value='").
+ append(valToString(*strongRefPtr)).append("',type='int',addr='").
+ append(ptrToBa(strongRefPtr)).append("',numchild='0'}]");
// Case 1.2: Weak pointer is unique.
+void tst_Gdb::dumpQWeakPointerHelper(QWeakPointer<T> &ptr)
+{
+ typedef QtSharedPointer::ExternalRefCountData Data;
+ const size_t dataOffset = 0;
+ const Data *d = *reinterpret_cast<const Data **>(
+ reinterpret_cast<const char **>(&ptr) + dataOffset);
+ const int *weakRefPtr = reinterpret_cast<const int *>(&d->weakref);
+ const int *strongRefPtr = reinterpret_cast<const int *>(&d->strongref);
+ T *data = ptr.toStrongRef().data();
+ const QString dataStr = valToString(*data);
+ QByteArray expected("value='");
+ if (isSimpleType<T>())
+ expected.append(dataStr);
+ expected.append("',valuedisabled='true',numchild='1',children=[{name='data',addr='").
+ append(ptrToBa(data)).append("',type='").append(typeToString<T>()).
+ append("',value='").append(dataStr).append("'},{name='weakref',value='").
+ append(valToString(*weakRefPtr)).append("',type='int',addr='").
+ append(ptrToBa(weakRefPtr)).append("',numchild='0'},{name='strongref',value='").
+ append(valToString(*strongRefPtr)).append("',type='int',addr='").
+ append(ptrToBa(strongRefPtr)).append("',numchild='0'}]");
+ testDumper(expected, &ptr, NS"QWeakPointer", true, typeToString<T>());
+}
+
+
QSharedPointer<int> sp(new int(99));
wp = sp.toWeakRef();
dumpQWeakPointerHelper(wp);
@@ -2090,333 +2553,253 @@ void tst_Gdb::dumpQWeakPointer()
QSharedPointer<QString> spS(new QString("Test"));
QWeakPointer<QString> wpS = spS.toWeakRef();
dumpQWeakPointerHelper(wpS);
+*/
#endif
}
-#endif // #if 0
+///////////////////////////// QList<int> /////////////////////////////////
-/////////////////////////////////////////////////////////////////////////
-//
-// Gdb Thread
-//
-/////////////////////////////////////////////////////////////////////////
-
-Thread::Thread(tst_Gdb *test)
-{
- moveToThread(this);
- m_test = test;
- m_proc = 0;
- m_proc = new QProcess;
- m_proc->moveToThread(this);
- qDebug() << "\nTHREAD CREATED" << getpid() << gettid();
- connect(m_test, SIGNAL(writeToGdb(QByteArray)),
- this, SLOT(writeToGdbRequested(QByteArray)));
- connect(m_proc, SIGNAL(error(QProcess::ProcessError)),
- this, SLOT(handleGdbError(QProcess::ProcessError)));
- connect(m_proc, SIGNAL(finished(int, QProcess::ExitStatus)),
- this, SLOT(handleGdbFinished(int, QProcess::ExitStatus)));
- connect(m_proc, SIGNAL(started()),
- this, SLOT(handleGdbStarted()));
- connect(m_proc, SIGNAL(readyReadStandardOutput()),
- this, SLOT(readStandardOutput()));
- connect(m_proc, SIGNAL(readyReadStandardError()),
- this, SLOT(readStandardError()));
- start();
-}
-
-void Thread::handleGdbError(QProcess::ProcessError error)
+void dumpQList_int()
{
- qDebug() << "GDB ERROR: " << error;
- //this->exit();
+ /* A */ QList<int> list;
+ /* B */ list.append(1);
+ /* C */ list.append(2);
+ /* D */ (void) 0;
}
-void Thread::handleGdbFinished(int code, QProcess::ExitStatus st)
+void tst_Gdb::dumpQList_int()
{
- qDebug() << "GDB FINISHED: " << code << st;
- //m_waitCondition.wakeAll();
- //this->exit();
- throw 42;
+ prepare("dumpQList_int");
+ if (checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<0 items>',numchild='0'}");
+ next();
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<1 items>',numchild='1',"
+ "childtype='int',childnumchild='0',children=["
+ "{value='1'}]}", "local.list");
+ next();
+ run("D","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<2 items>',numchild='2'}");
+ run("D","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<int>',value='<2 items>',numchild='2',"
+ "childtype='int',childnumchild='0',children=["
+ "{value='1'},{value='2'}]}", "local.list");
}
-void Thread::readStandardOutput()
-{
- QByteArray ba = m_proc->readAllStandardOutput();
- DEBUG("THREAD GDB OUT: " << ba);
- // =library-loaded...
- if (ba.startsWith("="))
- return;
- if (ba.startsWith("*stopped")) {
- m_lastStopped = ba;
- //qDebug() << "THREAD GDB OUT: " << ba;
- if (!ba.contains("func=\"main\"")) {
- int pos1 = ba.indexOf(",line=\"") + 7;
- int pos2 = ba.indexOf("\"", pos1);
- m_line = ba.mid(pos1, pos2 - pos1).toInt();
- DEBUG(" LINE 1: " << m_line);
- }
- }
-
- // The "call" is always aborted with a message like:
- // "~"2321\t /* A */ QString s;\n" "
- // "&"The program being debugged stopped while in a function called ..."
- // "^error,msg="The program being debugged stopped ..."
- // Extract the "2321" from this
- static QByteArray lastText;
- if (ba.startsWith("~"))
- lastText = ba;
- if (ba.startsWith("&\"The program being debugged")) {
- int pos1 = 2;
- int pos2 = lastText.indexOf("\\", pos1);
- m_line = lastText.mid(pos1, pos2 - pos1).toInt();
- DEBUG(" LINE 2: " << m_line);
- }
- if (ba.startsWith("~\"XXX: ")) {
- QByteArray ba1 = ba.mid(7, ba.size() - 11);
- qWarning() << "MESSAGE: " << ba.mid(7, ba.size() - 12);
- }
- if (!ba.contains("locals={iname="))
- return;
- //m_output += ba;
- ba = ba.mid(2, ba.size() - 4);
- ba = ba.replace("\\\"", "\"");
- m_output = ba;
- m_waitCondition.wakeAll();
-}
+///////////////////////////// QList<char> /////////////////////////////////
-void Thread::readStandardError()
+void dumpQList_char()
{
- QByteArray ba = m_proc->readAllStandardOutput();
- qDebug() << "THREAD GDB ERR: " << ba;
+ /* A */ QList<char> list;
+ /* B */ list.append('a');
+ /* C */ (void) 0;
}
-void Thread::handleGdbStarted()
+void tst_Gdb::dumpQList_char()
{
- //qDebug() << "\n\nGDB STARTED" << getpid() << gettid() << "\n\n";
+ prepare("dumpQList_char");
+ if (checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char>',value='<0 items>',numchild='0'}");
+ next();
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char>',value='<1 items>',numchild='1',"
+ "childtype='char',childnumchild='0',children=["
+ "{value='97 'a''}]}", "local.list");
}
-void Thread::run()
-{
- //qDebug() << "\nTHREAD RUN" << getpid() << gettid();
- m_proc->start("./gdb -i mi --args ./tst_gdb run");
- m_proc->waitForStarted();
- m_proc->write("break main\n");
- m_proc->write("run\n");
- m_proc->write("handle SIGSTOP stop pass\n");
- //qDebug() << "\nTHREAD RUNNING";
- exec();
-}
+///////////////////////////// QList<const char *> /////////////////////////////////
-/////////////////////////////////////////////////////////////////////////
-//
-// Test Class Framework Implementation
-//
-/////////////////////////////////////////////////////////////////////////
-
-tst_Gdb::tst_Gdb()
- : m_thread(this)
+void dumpQList_char_star()
{
- // FIXME: Wait until gdb proc is running.
- QTest::qWait(600);
-
- QFile file("tst_gdb.cpp");
- Q_ASSERT(file.open(QIODevice::ReadOnly));
- QByteArray funcName;
- const QByteArrayList bal = file.readAll().split('\n');
- Q_ASSERT(bal.size() > 100);
- for (int i = 0; i != bal.size(); ++i) {
- const QByteArray &ba = bal.at(i);
- if (ba.startsWith("void dump")) {
- int pos = ba.indexOf('(');
- funcName = ba.mid(5, pos - 5) + '@';
- } else if (ba.startsWith(" /*")) {
- int pos = ba.indexOf('*', 7);
- m_lineForLabel[funcName + ba.mid(7, pos - 8)] = i + 1;
- }
- }
+ /* A */ QList<const char *> list;
+ /* B */ list.append("a");
+ /* C */ list.append(0);
+ /* D */ list.append("bc");
+ /* E */ (void) 0;
}
-
-void tst_Gdb::prepare(const QByteArray &function)
+void tst_Gdb::dumpQList_char_star()
{
- m_function = function;
- writeToGdb("b " + function);
- writeToGdb("call " + function + "()");
+ prepare("dumpQList_char_star");
+ if (checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char const*>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char const*>',value='<0 items>',numchild='0'}");
+ next();
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char const*>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char const*>',value='<1 items>',numchild='1',"
+ "childtype='const char *',childnumchild='1',children=["
+ "{valueencoded='6',value='61',numchild='0'}]}", "local.list");
+ next();
+ next();
+ run("E","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<char const*>',value='<3 items>',numchild='3',"
+ "childtype='const char *',childnumchild='1',children=["
+ "{valueencoded='6',value='61',numchild='0'},"
+ "{value='0x0',numchild='0'},"
+ "{valueencoded='6',value='6263',numchild='0'}]}", "local.list");
}
-void tst_Gdb::run(const QByteArray &label, const QByteArray &expected0,
- const QByteArray &expanded, bool fancy)
-{
- //qDebug() << "\nABOUT TO RUN TEST: " << expanded;
- writeToGdb("bb " + QByteArray::number(int(fancy)) + " " + expanded);
- m_mutex.lock();
- m_waitCondition.wait(&m_mutex);
- QByteArray ba = m_thread.m_output;
- m_mutex.unlock();
- //GdbMi locals;
- //locals.fromString("{" + ba + "}");
- QByteArray received = ba.replace("\"", "'");
- //qDebug() << "OUTPUT: " << ba << "\n\n";
- //qDebug() << "OUTPUT: " << locals.toString() << "\n\n";
-
- QByteArray actual____ = received.trimmed();
- QByteArray expected = "locals={iname='local',name='Locals',value=' ',type=' ',"
- "children=[" + expected0 + "]}";
- int line = m_thread.m_line;
- QByteArrayList l1 = actual____.split(',');
- QByteArrayList l2 = expected.split(',');
+///////////////////////////// QList<QString> /////////////////////////////////////
- bool ok = l1.size() == l2.size();
- if (ok) {
- for (int i = 0 ; i < l1.size(); ++i) {
- // Use "-" as joker.
- if (l1.at(i) != l2.at(i) && !l2.at(i).endsWith("'-'"))
- ok = false;
- }
- }
-
- if (!ok) {
- int i = 0;
- for ( ; i < l1.size() && i < l2.size(); ++i) {
- if (l1.at(i) == l2.at(i) || l2.at(i).endsWith("'-'")) {
- qWarning() << "== " << l1.at(i);
- } else {
- //qWarning() << "!= " << l1.at(i).right(30) << l2.at(i).right(30);
- qWarning() << "!= " << l1.at(i) << l2.at(i);
- ok = false;
- }
- }
- for ( ; i < l2.size(); ++i)
- qWarning() << "!= " << "-----" << l2.at(i);
- for ( ; i < l1.size(); ++i)
- qWarning() << "!= " << l1.at(i) << "-----";
- if (l1.size() != l2.size()) {
- ok = false;
- qWarning() << "!= size: " << l1.size() << l2.size();
- }
- qWarning() << "RECEIVED: " << received;
- }
- QCOMPARE(ok, true);
- qWarning() << "LINE: " << line << "ACT/EXP" << m_function + '@' + label;
- //QCOMPARE(actual____, expected);
-
-
- int expline = m_lineForLabel.value(m_function + '@' + label);
- int actline = line;
- if (actline != expline) {
- qWarning() << "LAST STOPPED: " << m_thread.m_lastStopped;
- }
- QCOMPARE(actline, expline);
-}
-
-void tst_Gdb::next(int n)
+void dumpQList_QString()
{
- for (int i = 0; i != n; ++i)
- writeToGdb("next");
+ /* A */ QList<QString> list;
+ /* B */ list.append("Hallo");
+ /* C */ (void) 0;
}
-void tst_Gdb::cleanupTestCase()
+void tst_Gdb::dumpQList_QString()
{
- writeToGdb("kill");
- writeToGdb("quit");
- //m_thread.m_proc->waitForFinished();
+ prepare("dumpQList_QString");
+ if (0 && checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<"NS"QString>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<"NS"QString>',value='<0 items>',numchild='0'}");
+ next();
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<"NS"QString>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<"NS"QString>',value='<1 items>',numchild='1',"
+ "childtype='"NS"QString',childnumchild='0',children=["
+ "{valueencoded='7',value='480061006c006c006f00'}]}", "local.list");
}
-/////////////////////////////////////////////////////////////////////////
-//
-// Dumper Tests
-//
-/////////////////////////////////////////////////////////////////////////
+///////////////////////////// QList<QString3> ///////////////////////////////////
-void dumpQList_int()
+void dumpQList_QString3()
{
- /* A */ QList<int> ilist;
- /* B */ ilist.append(1);
- /* C */ ilist.append(2);
- /* D */ (void) 0;
+ /* A */ QList<QString3> list;
+ /* B */ list.append(QString3());
+ /* C */ (void) 0;
}
-void tst_Gdb::dumpQList_int()
+void tst_Gdb::dumpQList_QString3()
{
- prepare("dumpQList_int");
- run("A","{iname='local.ilist',addr='-',name='ilist',"
- "type='"NS"QList<int>',value='<not in scope>',numchild='0'}");
+ prepare("dumpQList_QString3");
+ if (checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<QString3>',value='<not in scope>',numchild='0'}");
next();
- run("B","{iname='local.ilist',addr='-',name='ilist',"
- "type='"NS"QList<int>',value='<0 items>',numchild='0'}");
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<QString3>',value='<0 items>',numchild='0'}");
next();
- run("C","{iname='local.ilist',addr='-',name='ilist',"
- "type='"NS"QList<int>',value='<1 items>',numchild='1'}");
- //run("C","{iname='local.ilist',addr='-',name='ilist',"
- // "type='"NS"QList<int>',value='<1 items>',numchild='1',"
- // "childtype='int',childnumchild='0',children=["
- // "{value='1'}]}", "local.ilist");
-/*
- next();
- run("D","{iname='local.ilist',addr='-',name='ilist',"
- "type='"NS"QList<int>',value='<2 items>',numchild='2',"
- "childtype='int',childnumchild='0'}");
- run("D","{iname='local.ilist',addr='-',name='ilist',"
- "type='"NS"QList<int>',value='<2 items>',numchild='2',"
- "childtype='int',childnumchild='0',children=["
- "{addr='-',value='1'},{addr='-',value='2'}]}", "local.ilist");
-*/
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<QString3>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<QString3>',value='<1 items>',numchild='1',"
+ "childtype='QString3',children=["
+ "{value='{...}',numchild='3'}]}", "local.list");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<QString3>',value='<1 items>',numchild='1',"
+ "childtype='QString3',children=[{value='{...}',numchild='3',children=["
+ "{iname='local.list.0.s1',name='s1',type='"NS"QString',"
+ "valueencoded='7',value='6100',numchild='0'},"
+ "{iname='local.list.0.s2',name='s2',type='"NS"QString',"
+ "valueencoded='7',value='6200',numchild='0'},"
+ "{iname='local.list.0.s3',name='s3',type='"NS"QString',"
+ "valueencoded='7',value='6300',numchild='0'}]}]}",
+ "local.list,local.list.0");
}
-/*
-void tst_Gdb::dumpQList_char()
-{
- QList<char> clist;
- testDumper("value='<0 items>',valuedisabled='true',numchild='0',"
- "internal='1',children=[]",
- &clist, NS"QList", true, "char");
- clist.append('a');
- clist.append('b');
- testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
- "internal='1',childtype='char',childnumchild='0',children=["
- "{addr='" + str(&clist.at(0)) + "',value=''a', ascii=97'},"
- "{addr='" + str(&clist.at(1)) + "',value=''b', ascii=98'}]",
- &clist, NS"QList", true, "char");
-}
-void tst_Gdb::dumpQList_QString()
+///////////////////////////// QList<Int3> /////////////////////////////////////
+
+void dumpQList_Int3()
{
- QList<QString> slist;
- testDumper("value='<0 items>',valuedisabled='true',numchild='0',"
- "internal='1',children=[]",
- &slist, NS"QList", true, NS"QString");
- slist.append("a");
- slist.append("b");
- testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
- "internal='1',childtype='"NS"QString',childnumchild='0',children=["
- "{addr='" + str(&slist.at(0)) + "',value='YQA=',valueencoded='2'},"
- "{addr='" + str(&slist.at(1)) + "',value='YgA=',valueencoded='2'}]",
- &slist, NS"QList", true, NS"QString");
+ /* A */ QList<Int3> list;
+ /* B */ list.append(Int3());
+ /* C */ (void) 0;
}
-*/
-void dumpMisc()
+void tst_Gdb::dumpQList_Int3()
{
- /* A */ int *s = new int(1);
- /* B */ *s += 1;
- /* D */ (void) s;
+ prepare("dumpQList_Int3");
+ if (checkUninitialized)
+ run("A","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<Int3>',value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<Int3>',value='<0 items>',numchild='0'}");
+ next();
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<Int3>',value='<1 items>',numchild='1'}");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<Int3>',value='<1 items>',numchild='1',"
+ "childtype='Int3',children=[{value='{...}',numchild='3'}]}",
+ "local.list");
+ run("C","{iname='local.list',addr='-',name='list',"
+ "type='"NS"QList<Int3>',value='<1 items>',numchild='1',"
+ "childtype='Int3',children=[{value='{...}',numchild='3',children=["
+ "{iname='local.list.0.i1',name='i1',type='int',value='42',numchild='0'},"
+ "{iname='local.list.0.i2',name='i2',type='int',value='43',numchild='0'},"
+ "{iname='local.list.0.i3',name='i3',type='int',value='44',numchild='0'}]}]}",
+ "local.list,local.list.0");
+}
+
+///////////////////////////// QVector /////////////////////////////////
+
+void dumpQStack()
+{
+ /* A */ QStack<int> v;
+ /* B */ v.append(3);
+ /* C */ v.append(2);
+ /* D */ (void) 0;
}
-void tst_Gdb::dumpMisc()
+void tst_Gdb::dumpQStack()
{
- prepare("dumpMisc");
+ prepare("dumpQStack");
+ if (checkUninitialized)
+ run("A","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<not in scope>',numchild='0'}");
next();
- run("B","{iname='local.s',addr='-',name='s',type='int *',"
- "value='-',numchild='1'}", "", 0);
- run("B","{iname='local.s',addr='-',name='s',type='int *',"
- "value='-',numchild='1',children=[{iname='local.s.*',"
- "name='*s',type='int',value='1',numchild='0'}]}", "local.s", 0);
+ run("B","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<0 items>',numchild='0'}");
+ run("B","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<0 items>',numchild='0',children=[]}", "local.v");
+ next();
+ run("C","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<1 items>',numchild='1'}");
+ run("C","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<1 items>',numchild='1',childtype='int',"
+ "childnumchild='0',children=[{value='3'}]}", // rounding...
+ "local.v");
+ next();
+ run("D","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<2 items>',numchild='2'}");
+ run("D","{iname='local.v',addr='-',name='v',type='"NS"QStack<int>',"
+ "value='<2 items>',numchild='2',childtype='int',"
+ "childnumchild='0',children=[{value='3'},{value='2'}]}",
+ "local.v");
}
-void dumpQStringTest()
+
+///////////////////////////// QString /////////////////////////////////////
+
+void dumpQString()
{
/* A */ QString s;
/* B */ s = "hallo";
@@ -2426,18 +2809,27 @@ void dumpQStringTest()
void tst_Gdb::dumpQString()
{
- prepare("dumpQStringTest");
- run("A","{iname='local.s',addr='-',name='s',type='"NS"QString',"
- "value='<not in scope>',numchild='0'}");
+ prepare("dumpQString");
+ if (checkUninitialized)
+ run("A","{iname='local.s',addr='-',name='s',type='"NS"QString',"
+ "value='<not in scope>',numchild='0'}");
next();
run("B","{iname='local.s',addr='-',name='s',type='"NS"QString',"
"valueencoded='7',value='',numchild='0'}", "local.s");
- // Plain C:
+ // Plain C style dumping:
run("B","{iname='local.s',addr='-',name='s',type='"NS"QString',"
"value='{...}',numchild='5'}", "", 0);
run("B","{iname='local.s',addr='-',name='s',type='"NS"QString',"
- "value='{...}',numchild='5',children=[]}", "local.s", 0);
-return;
+ "value='{...}',numchild='5',children=["
+ "{iname='local.s.d',name='d',type='"NS"QString::Data *',"
+ "value='-',numchild='1'}]}", "local.s", 0);
+ run("B","{iname='local.s',addr='-',name='s',type='"NS"QString',"
+ "value='{...}',numchild='5',"
+ "children=[{iname='local.s.d',name='d',"
+ "type='"NS"QString::Data *',value='-',numchild='1',"
+ "children=[{iname='local.s.d.*',name='*d',"
+ "type='"NS"QString::Data',value='{...}',numchild='11'}]}]}",
+ "local.s,local.s.d", 0);
next();
run("C","{iname='local.s',addr='-',name='s',type='"NS"QString',"
"valueencoded='7',value='680061006c006c006f00',numchild='0'}");
@@ -2446,7 +2838,10 @@ return;
"valueencoded='7',value='680061006c006c006f007800',numchild='0'}");
}
-void dumpQStringListTest()
+
+///////////////////////////// QStringList /////////////////////////////////
+
+void dumpQStringList()
{
/* A */ QStringList s;
/* B */ s.append("hello");
@@ -2456,9 +2851,10 @@ void dumpQStringListTest()
void tst_Gdb::dumpQStringList()
{
- prepare("dumpQStringListTest");
- //run("A","{iname='local.s',addr='-',name='s',type='"NS"QStringList',"
- // "value='<not in scope>',numchild='0'}");
+ prepare("dumpQStringList");
+ if (checkUninitialized)
+ run("A","{iname='local.s',addr='-',name='s',type='"NS"QStringList',"
+ "value='<not in scope>',numchild='0'}");
next();
run("B","{iname='local.s',addr='-',name='s',type='"NS"QStringList',"
"value='<0 items>',numchild='0'}");
@@ -2472,7 +2868,6 @@ void tst_Gdb::dumpQStringList()
"childnumchild='0',children=[{valueencoded='7',"
"value='680065006c006c006f00'}]}",
"local.s");
-return;
next();
run("D","{iname='local.s',addr='-',name='s',type='"NS"QStringList',"
"value='<2 items>',numchild='2'}");
@@ -2485,6 +2880,43 @@ return;
}
+///////////////////////////// QVector /////////////////////////////////
+
+void dumpQVector()
+{
+ /* A */ QVector<double> v;
+ /* B */ v.append(3.14);
+ /* C */ v.append(2.81);
+ /* D */ (void) 0;
+}
+
+void tst_Gdb::dumpQVector()
+{
+ prepare("dumpQVector");
+ if (checkUninitialized)
+ run("A","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<not in scope>',numchild='0'}");
+ next();
+ run("B","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<0 items>',numchild='0'}");
+ run("B","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<0 items>',numchild='0',children=[]}", "local.v");
+ next();
+ run("C","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<1 items>',numchild='1'}");
+ run("C","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<1 items>',numchild='1',childtype='double',"
+ "childnumchild='0',children=[{value='-'}]}", // rounding...
+ "local.v");
+ next();
+ run("D","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<2 items>',numchild='2'}");
+ run("D","{iname='local.v',addr='-',name='v',type='"NS"QVector<double>',"
+ "value='<2 items>',numchild='2',childtype='double',"
+ "childnumchild='0',children=[{value='-'},{value='-'}]}",
+ "local.v");
+}
+
/////////////////////////////////////////////////////////////////////////
//
// Main
diff --git a/tests/manual/cplusplus/main.cpp b/tests/manual/cplusplus/main.cpp
index cc69cb1681..63efc8b985 100644
--- a/tests/manual/cplusplus/main.cpp
+++ b/tests/manual/cplusplus/main.cpp
@@ -33,7 +33,6 @@
#include <Scope.h>
#include <Semantic.h>
#include <TranslationUnit.h>
-#include <PrettyPrinter.h>
#include <Literals.h>
#include <Symbols.h>
#include <Names.h>
@@ -52,171 +51,7 @@
#include <iostream>
#include <sstream>
-CPLUSPLUS_USE_NAMESPACE
-
-class Rewrite
-{
- QMultiMap<unsigned, QByteArray> _insertBefore;
- QMultiMap<unsigned, QByteArray> _insertAfter;
- QSet<unsigned> _removed;
-
-public:
- void remove(unsigned index)
- { remove(index, index + 1); }
-
- void remove(unsigned first, unsigned last)
- {
- Q_ASSERT(first < last);
-
- for (; first != last; ++first)
- _removed.insert(first);
- }
-
- void insertTextBefore(unsigned index, const QByteArray &text)
- { _insertBefore.insert(index, text); }
-
- void insertTextAfter(unsigned index, const QByteArray &text)
- { _insertAfter.insert(index, text); }
-
- void rewrite(const TranslationUnit *unit,
- const QByteArray &contents,
- QByteArray *out)
- {
- _source = contents;
- const char *source = contents.constData();
- unsigned previousTokenEndPosition = 0;
- for (unsigned i = 0; i < unit->tokenCount(); ++i) {
- const Token &tk = unit->tokenAt(i);
-
- if (previousTokenEndPosition != tk.begin()) {
- Q_ASSERT(previousTokenEndPosition < tk.begin());
- out->append(source + previousTokenEndPosition,
- tk.begin() - previousTokenEndPosition);
- }
-
- QMultiMap<unsigned, QByteArray>::const_iterator it;
-
- it = _insertBefore.constFind(i);
- for (; it != _insertBefore.constEnd() && it.key() == i; ++it) {
- out->append(it.value());
- }
-
- if (! _removed.contains(i))
- out->append(source + tk.begin(), tk.f.length);
-
- it = _insertAfter.constFind(i);
- for (; it != _insertAfter.constEnd() && it.key() == i; ++it) {
- out->append(it.value());
- }
-
- previousTokenEndPosition = tk.end();
- }
- }
-
-protected:
- QByteArray _source;
-};
-
-class SimpleRefactor: protected ASTVisitor, Rewrite {
-public:
- SimpleRefactor(Control *control)
- : ASTVisitor(control)
- { }
-
- void operator()(const TranslationUnit *unit,
- const QByteArray &source,
- QByteArray *out)
- {
- accept(unit->ast());
- rewrite(unit, source, out);
- }
-
-protected:
- bool isEnumOrTypedefEnum(SpecifierAST *spec) {
- if (! spec)
- return false;
- if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) {
- if (tokenKind(simpleSpec->specifier_token) == T_TYPEDEF)
- return isEnumOrTypedefEnum(spec->next);
- }
- return spec->asEnumSpecifier() != 0;
- }
- virtual bool visit(SimpleDeclarationAST *ast) {
- if (isEnumOrTypedefEnum(ast->decl_specifier_seq)) {
- //remove(ast->firstToken(), ast->lastToken());
- insertTextBefore(ast->firstToken(), "/* #REF# removed ");
- insertTextAfter(ast->lastToken() - 1, "*/");
- return true;
- }
- return true;
- }
-
- virtual bool visit(AccessDeclarationAST *ast)
- {
- if (tokenKind(ast->access_specifier_token) == T_PRIVATE) {
- // change visibility from `private' to `public'.
- remove(ast->access_specifier_token);
- insertTextAfter(ast->access_specifier_token, "public /* #REF# private->public */");
- }
- return true;
- }
-
- virtual bool visit(FunctionDefinitionAST *ast)
- {
- bool isInline = false;
- for (SpecifierAST *spec = ast->decl_specifier_seq; spec; spec = spec->next) {
- if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) {
- if (tokenKind(simpleSpec->specifier_token) == T_INLINE) {
- isInline = true;
- break;
- }
- }
- }
-
- // force the `inline' specifier.
- if (! isInline)
- insertTextBefore(ast->firstToken(), "inline /* #REF# made inline */ ");
-
- return true;
- }
-
- virtual bool visit(ClassSpecifierAST *ast)
- {
- // export/import the class using the macro MY_EXPORT.
- if (ast->name)
- insertTextBefore(ast->name->firstToken(), "MY_EXPORT ");
-
- // add QObject to the base clause.
- if (ast->colon_token)
- insertTextAfter(ast->colon_token, " public QObject,");
- else if (ast->lbrace_token)
- insertTextBefore(ast->lbrace_token, ": public QObject ");
-
- // mark the class as Q_OBJECT.
- if (ast->lbrace_token)
- insertTextAfter(ast->lbrace_token, " Q_OBJECT\n");
-
- for (DeclarationListAST *it = ast->member_specifiers; it; it = it->next) {
- accept(it->declaration);
- }
-
- return false;
- }
-
- virtual bool visit(CppCastExpressionAST *ast)
- {
- // Replace the C++ cast expression (e.g. static_cast<foo>(a)) with
- // the one generated by the pretty printer.
- std::ostringstream o;
- PrettyPrinter pp(control(), o);
- pp(ast, _source);
- remove(ast->firstToken(), ast->lastToken());
- const std::string str = o.str();
- insertTextBefore(ast->firstToken(), str.c_str());
- insertTextBefore(ast->firstToken(), "/* #REF# beautiful cast */ ");
- return false;
- }
-};
+using namespace CPlusPlus;
class CloneCG: protected ASTVisitor
{
@@ -260,11 +95,9 @@ public:
"#include \"AST.h\"\n"
"#include \"ASTVisitor.h\"\n"
"\n"
- "CPLUSPLUS_BEGIN_NAMESPACE\n" << std::endl;
+ "using namespace CPlusPlus;\n" << std::endl;
accept(ast);
-
- std::cout << "CPLUSPLUS_END_NAMESPACE" << std::endl;
}
protected:
@@ -415,14 +248,12 @@ public:
"\n"
"#include \"AST.h\"\n"
"\n"
- "CPLUSPLUS_BEGIN_NAMESPACE\n" << std::endl;
+ "using namespace CPlusPlus;\n" << std::endl;
SearchListNodes listNodes(control());
_listNodes = listNodes(ast);
accept(ast);
-
- std::cout << "CPLUSPLUS_END_NAMESPACE" << std::endl;
}
protected:
@@ -513,23 +344,15 @@ int main(int argc, char *argv[])
const QString appName = args.first();
args.removeFirst();
- bool test_rewriter = false;
- bool test_pretty_printer = false;
-
- foreach (QString arg, args) {
- if (arg == QLatin1String("--test-rewriter"))
- test_rewriter = true;
- else if (arg == QLatin1String("--test-pretty-printer"))
- test_pretty_printer = true;
- else if (arg == QLatin1String("--help")) {
+ foreach (const QString &arg, args) {
+ if (arg == QLatin1String("--help")) {
const QFileInfo appInfo(appName);
const QByteArray appFileName = QFile::encodeName(appInfo.fileName());
printf("Usage: %s [options]\n"
- " --help Display this information\n"
- " --test-rewriter Test the tree rewriter\n"
- " --test-pretty-printer Test the pretty printer\n",
+ " --help Display this information\n",
appFileName.constData());
+
return EXIT_SUCCESS;
}
}
@@ -558,18 +381,5 @@ int main(int argc, char *argv[])
sem.check(decl->declaration, globalNamespace->members());
}
- // test the rewriter
- if (test_rewriter) {
- QByteArray out;
- SimpleRefactor refactor(&control);
- refactor(&unit, source, &out);
- printf("%s\n", out.constData());
- } else if (test_pretty_printer) {
- MemoryPool pool2;
- TranslationUnitAST *other = unit.ast()->clone(&pool2)->asTranslationUnit();
- PrettyPrinter pp(&control, std::cout);
- pp(other, source);
- }
-
return EXIT_SUCCESS;
}
diff --git a/tests/manual/cplusplus/test-pretty-printer b/tests/manual/cplusplus/test-pretty-printer
deleted file mode 100755
index 7403721300..0000000000
--- a/tests/manual/cplusplus/test-pretty-printer
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-me=$(dirname $0)
-${CPP-gcc} -xc++ -E -include $me/conf.c++ $* | $me/cplusplus0 --test-pretty-printer
diff --git a/tests/manual/cplusplus/test-rewriter b/tests/manual/cplusplus/test-rewriter
deleted file mode 100755
index c0494257c8..0000000000
--- a/tests/manual/cplusplus/test-rewriter
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-me=$(dirname $0)
-${CPP-gcc} -xc++ -E -include $me/conf.c++ $* | $me/cplusplus0 --test-rewriter
diff --git a/tests/manual/plain-cplusplus/main.cpp b/tests/manual/plain-cplusplus/main.cpp
new file mode 100644
index 0000000000..e975897d21
--- /dev/null
+++ b/tests/manual/plain-cplusplus/main.cpp
@@ -0,0 +1,79 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include <AST.h>
+#include <ASTVisitor.h>
+#include <Control.h>
+#include <Scope.h>
+#include <Semantic.h>
+#include <TranslationUnit.h>
+#include <Literals.h>
+#include <Symbols.h>
+#include <Names.h>
+#include <CoreTypes.h>
+
+#include <string>
+#include <cstdlib>
+#include <cstdlib>
+
+using namespace CPlusPlus;
+
+int main(int argc, char *argv[])
+{
+ std::string cmdline;
+ cmdline += "gcc -E -xc++ -U__BLOCKS__";
+
+ for (int i = 1; i < argc; ++i) {
+ cmdline += ' ';
+ cmdline += argv[i];
+ }
+
+ enum { BLOCK_SIZE = 4 * 1024};
+ char block[BLOCK_SIZE];
+
+ std::string source;
+
+ if (FILE *fp = popen(cmdline.c_str(), "r")) {
+ while (size_t sz = fread(block, 1, BLOCK_SIZE, fp))
+ source.append(block, sz);
+
+ pclose(fp);
+
+ } else {
+ fprintf(stderr, "c++: No such file or directory\n");
+ return EXIT_FAILURE;
+ }
+
+ Control control;
+ TranslationUnit unit(&control, control.findOrInsertStringLiteral("<stdin>"));
+ unit.setSource(source.c_str(), source.size());
+ unit.parse();
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/manual/plain-cplusplus/plain-cplusplus.pro b/tests/manual/plain-cplusplus/plain-cplusplus.pro
new file mode 100644
index 0000000000..d77e233f86
--- /dev/null
+++ b/tests/manual/plain-cplusplus/plain-cplusplus.pro
@@ -0,0 +1,23 @@
+QT -= core gui
+TARGET = plain-c++
+
+macx {
+ CONFIG -= app_bundle
+ release:LIBS += -Wl,-exported_symbol -Wl,_main
+}
+
+include(../../../src/shared/cplusplus/cplusplus.pri)
+
+# Input
+SOURCES += main.cpp
+
+unix {
+ debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
+ release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
+
+ debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared
+ release:MOC_DIR = $${OUT_PWD}/.moc/release-shared
+
+ RCC_DIR = $${OUT_PWD}/.rcc/
+ UI_DIR = $${OUT_PWD}/.uic/
+}
diff --git a/tests/manual/trklauncher/main.cpp b/tests/manual/trklauncher/main.cpp
index 65031e7cc5..3533663217 100644
--- a/tests/manual/trklauncher/main.cpp
+++ b/tests/manual/trklauncher/main.cpp
@@ -1,13 +1,19 @@
#include "launcher.h"
+#include "communicationstarter.h"
#include <QtCore/QCoreApplication>
+#include <QtCore/QSharedPointer>
#include <QtCore/QDebug>
#include <QtCore/QStringList>
static const char *usageC =
-"\nUsage: %1 <trk_port_name> [-v] [-i remote_sis_file | -I local_sis_file remote_sis_file] [<remote_executable_name>]\n"
+"\n"
+"Usage: %1 [options] <trk_port_name>\n"
+" %1 [options] -i <trk_port_name> remote_sis_file\n"
+" %1 [options] -I local_sis_file remote_sis_file] [<remote_executable_name>]\n"
"\nOptions:\n -v verbose\n"
- " -f turn serial message frame off\n\n"
+ " -b Prompt for Bluetooth connect (Linux only)\n"
+ " -f turn serial message frame off (Bluetooth)\n"
"\nPing:\n"
"%1 COM5\n"
"\nRemote launch:\n"
@@ -27,74 +33,94 @@ static void usage()
qWarning("%s", qPrintable(msg));
}
-static bool parseArguments(const QStringList &arguments, trk::Launcher &launcher)
+typedef QSharedPointer<trk::Launcher> TrkLauncherPtr;
+
+// Parse arguments, return pointer or a null none.
+
+static inline TrkLauncherPtr createLauncher(trk::Launcher::Actions actions,
+ const QString &serverName,
+ bool serialFrame,
+ int verbosity)
+{
+ TrkLauncherPtr launcher(new trk::Launcher(actions));
+ launcher->setTrkServerName(serverName);
+ launcher->setSerialFrame(serialFrame);
+ launcher->setVerbose(verbosity);
+ return launcher;
+}
+
+static TrkLauncherPtr parseArguments(const QStringList &arguments, bool *bluetooth)
{
// Parse away options
bool install = false;
bool customInstall = false;
+ bool serialFrame = true;
const int argCount = arguments.size();
int verbosity = 0;
+ *bluetooth = false;
+ trk::Launcher::Actions actions = trk::Launcher::ActionPingOnly;
int a = 1;
for ( ; a < argCount; a++) {
const QString option = arguments.at(a);
if (!option.startsWith(QLatin1Char('-')))
break;
if (option.size() != 2)
- return false;
+ return TrkLauncherPtr();
switch (option.at(1).toAscii()) {
case 'v':
verbosity++;
break;
case 'f':
- launcher.setSerialFrame(false);
- break;verbosity++;
+ serialFrame = false;
+ break;
+ case 'b':
+ *bluetooth = true;
+ break;
case 'i':
install = true;
- launcher.addStartupActions(trk::Launcher::ActionInstall);
+ actions = trk::Launcher::ActionInstall;
break;
case 'I':
customInstall = true;
- launcher.addStartupActions(trk::Launcher::ActionCopyInstall);
+ actions = trk::Launcher::ActionCopyInstall;
break;
default:
- return false;
+ return TrkLauncherPtr();
}
}
-
- launcher.setVerbose(verbosity);
// Evaluate arguments
const int remainingArgsCount = argCount - a;
- if (remainingArgsCount == 1 && !install && !customInstall) {
- launcher.setTrkServerName(arguments.at(a)); // ping
- return true;
+ if (remainingArgsCount == 1 && !install && !customInstall) { // Ping
+ return createLauncher(actions, arguments.at(a), serialFrame, verbosity);
}
if (remainingArgsCount == 2 && !install && !customInstall) {
// remote exec
- launcher.addStartupActions(trk::Launcher::ActionRun);
- launcher.setTrkServerName(arguments.at(a));
- launcher.setFileName(arguments.at(a + 1));
- return true;
+ TrkLauncherPtr launcher = createLauncher(actions, arguments.at(a), serialFrame, verbosity);
+ launcher->addStartupActions(trk::Launcher::ActionRun);
+ launcher->setFileName(arguments.at(a + 1));
+ return launcher;
}
if ((remainingArgsCount == 3 || remainingArgsCount == 2) && install && !customInstall) {
- launcher.setTrkServerName(arguments.at(a)); // ping
- launcher.setInstallFileName(arguments.at(a + 1));
+ TrkLauncherPtr launcher = createLauncher(actions, arguments.at(a), serialFrame, verbosity);
+ launcher->setInstallFileName(arguments.at(a + 1));
if (remainingArgsCount == 3) {
- launcher.addStartupActions(trk::Launcher::ActionRun);
- launcher.setFileName(arguments.at(a + 2));
+ launcher->addStartupActions(trk::Launcher::ActionRun);
+ launcher->setFileName(arguments.at(a + 2));
}
- return true;
+ return launcher;
}
if ((remainingArgsCount == 4 || remainingArgsCount == 3) && !install && customInstall) {
- launcher.setTrkServerName(arguments.at(a)); // ping
- launcher.setCopyFileName(arguments.at(a + 1), arguments.at(a + 2));
- launcher.setInstallFileName(arguments.at(a + 2));
+ TrkLauncherPtr launcher = createLauncher(actions, arguments.at(a), serialFrame, verbosity);
+ launcher->setTrkServerName(arguments.at(a)); // ping
+ launcher->setCopyFileName(arguments.at(a + 1), arguments.at(a + 2));
+ launcher->setInstallFileName(arguments.at(a + 2));
if (remainingArgsCount == 4) {
- launcher.addStartupActions(trk::Launcher::ActionRun);
- launcher.setFileName(arguments.at(a + 3));
+ launcher->addStartupActions(trk::Launcher::ActionRun);
+ launcher->setFileName(arguments.at(a + 3));
}
- return true;
+ return launcher;
}
- return false;
+ return TrkLauncherPtr();
}
int main(int argc, char *argv[])
@@ -103,14 +129,23 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName(QLatin1String("trklauncher"));
QCoreApplication::setOrganizationName(QLatin1String("Nokia"));
- trk::Launcher launcher;
- if (!parseArguments(app.arguments(), launcher)) {
+ bool bluetooth;
+ const TrkLauncherPtr launcher = parseArguments(app.arguments(), &bluetooth);
+ if (launcher.isNull()) {
usage();
return 1;
}
- QObject::connect(&launcher, SIGNAL(finished()), &app, SLOT(quit()));
+ QObject::connect(launcher.data(), SIGNAL(finished()), &app, SLOT(quit()));
+ // BLuetooth: Open with prompt
QString errorMessage;
- if (launcher.startServer(&errorMessage))
+ if (bluetooth && !trk::ConsoleBluetoothStarter::startBluetooth(launcher->trkDevice(),
+ launcher.data(),
+ launcher->trkServerName(),
+ 30, &errorMessage)) {
+ qWarning("%s\n", qPrintable(errorMessage));
+ return -1;
+ }
+ if (launcher->startServer(&errorMessage))
return app.exec();
qWarning("%s\n", qPrintable(errorMessage));
return 4;
diff --git a/tests/manual/trklauncher/trklauncher.pro b/tests/manual/trklauncher/trklauncher.pro
index 73e7f7d781..943afde4ad 100644
--- a/tests/manual/trklauncher/trklauncher.pro
+++ b/tests/manual/trklauncher/trklauncher.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
QT = core
+CONFIG += console
include(../../../src/shared/trk/trk.pri)
-win32:CONFIG += console
SOURCES += main.cpp