summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-07 12:26:59 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-07-07 12:26:59 +0200
commit1f3896e8af6f4417588b65f0fa68759277ab6dac (patch)
treec50d91f341daaf6e2bee4eab606344ce1c73f68d /src/plugins
parentfdb0876e9c0e56f721f7bae1cc5eeb220f03c165 (diff)
parent600127e8758122501cd4f14b394bfc8e5f95872b (diff)
downloadqt-creator-1f3896e8af6f4417588b65f0fa68759277ab6dac.tar.gz
Merge remote-tracking branch 'origin/2.3'
Conflicts: share/qtcreator/dumper/bridge.py src/plugins/debugger/gdb/gdbengine.cpp src/plugins/remotelinux/remotelinuxapplicationrunner.cpp Change-Id: I444f797723d5879ea08c5c0e1f31158d271d4f41
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/analyzerbase/analyzerbase.pro2
-rw-r--r--src/plugins/analyzerbase/analyzerconstants.h21
-rw-r--r--src/plugins/analyzerbase/analyzermanager.cpp651
-rw-r--r--src/plugins/analyzerbase/analyzermanager.h48
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.cpp50
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrol.h14
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrolfactory.cpp149
-rw-r--r--src/plugins/analyzerbase/analyzersettings.cpp1
-rw-r--r--src/plugins/analyzerbase/analyzerstartparameters.h11
-rw-r--r--src/plugins/analyzerbase/analyzerutils.cpp7
-rw-r--r--src/plugins/analyzerbase/analyzerutils.h2
-rw-r--r--src/plugins/analyzerbase/ianalyzerengine.cpp20
-rw-r--r--src/plugins/analyzerbase/ianalyzerengine.h33
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.cpp28
-rw-r--r--src/plugins/analyzerbase/ianalyzertool.h49
-rw-r--r--src/plugins/analyzerbase/startremotedialog.cpp4
-rw-r--r--src/plugins/analyzerbase/startremotedialog.h12
-rw-r--r--src/plugins/coreplugin/generalsettings.ui6
-rw-r--r--src/plugins/coreplugin/infobar.cpp2
-rw-r--r--src/plugins/coreplugin/infobar.h2
-rw-r--r--src/plugins/coreplugin/multifeedrssmodel.cpp32
-rw-r--r--src/plugins/coreplugin/multifeedrssmodel.h32
-rw-r--r--src/plugins/coreplugin/networkaccessmanager.cpp32
-rw-r--r--src/plugins/coreplugin/networkaccessmanager.h32
-rw-r--r--src/plugins/coreplugin/outputpane.cpp18
-rw-r--r--src/plugins/coreplugin/outputpane.h2
-rw-r--r--src/plugins/coreplugin/outputpanemanager.cpp13
-rw-r--r--src/plugins/coreplugin/outputpanemanager.h2
-rw-r--r--src/plugins/coreplugin/variablechooser.cpp3
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp25
-rw-r--r--src/plugins/cpptools/cppcodeformatter.h2
-rw-r--r--src/plugins/cpptools/cppcodestylepreferences.cpp32
-rw-r--r--src/plugins/cpptools/cppcodestylepreferences.h32
-rw-r--r--src/plugins/cpptools/cppcodestylesettings.cpp32
-rw-r--r--src/plugins/cpptools/cppcodestylesettings.h32
-rw-r--r--src/plugins/cpptools/cppcodestylesettingsfactory.cpp32
-rw-r--r--src/plugins/cpptools/cppcodestylesettingsfactory.h32
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.cpp32
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.h32
-rw-r--r--src/plugins/cpptools/cpptoolssettings.cpp32
-rw-r--r--src/plugins/cpptools/cpptoolssettings.h29
-rw-r--r--src/plugins/debugger/breakpoint.cpp17
-rw-r--r--src/plugins/debugger/breakpoint.h2
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp152
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h11
-rw-r--r--src/plugins/debugger/cdb/cdbparsehelpers.cpp14
-rw-r--r--src/plugins/debugger/cdb/cdbparsehelpers.h2
-rw-r--r--src/plugins/debugger/debuggerconstants.h4
-rw-r--r--src/plugins/debugger/debuggerengine.cpp3
-rw-r--r--src/plugins/debugger/debuggerengine.h2
-rw-r--r--src/plugins/debugger/debuggersourcepathmappingwidget.cpp4
-rw-r--r--src/plugins/debugger/disassembleragent.cpp103
-rw-r--r--src/plugins/debugger/disassembleragent.h3
-rw-r--r--src/plugins/debugger/disassemblerlines.cpp16
-rw-r--r--src/plugins/debugger/disassemblerlines.h3
-rw-r--r--src/plugins/debugger/gdb/abstractplaingdbadapter.cpp2
-rw-r--r--src/plugins/debugger/gdb/classicgdbengine.cpp5
-rw-r--r--src/plugins/debugger/gdb/coregdbadapter.cpp8
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp87
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h6
-rw-r--r--src/plugins/debugger/gdb/gdbmi.cpp13
-rw-r--r--src/plugins/debugger/gdb/gdbmi.h3
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.ui2
-rw-r--r--src/plugins/debugger/gdb/pythongdbengine.cpp2
-rw-r--r--src/plugins/debugger/gdb/remotegdbprocess.cpp3
-rw-r--r--src/plugins/debugger/stackwindow.cpp2
-rw-r--r--src/plugins/debugger/watchwindow.cpp2
-rw-r--r--src/plugins/designer/qt_private/abstractnewformwidget_p.h2
-rw-r--r--src/plugins/designer/qt_private/abstractoptionspage_p.h2
-rw-r--r--src/plugins/designer/qt_private/abstractsettings_p.h2
-rw-r--r--src/plugins/designer/qt_private/formwindowbase_p.h2
-rw-r--r--src/plugins/designer/qt_private/iconloader_p.h2
-rw-r--r--src/plugins/designer/qt_private/pluginmanager_p.h2
-rw-r--r--src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h2
-rw-r--r--src/plugins/designer/qt_private/qdesigner_integration_p.h2
-rw-r--r--src/plugins/designer/qt_private/qsimpleresource_p.h2
-rw-r--r--src/plugins/designer/qt_private/qtresourcemodel_p.h2
-rw-r--r--src/plugins/designer/qt_private/shared_enums_p.h2
-rw-r--r--src/plugins/designer/qt_private/shared_global_p.h2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectfileseditor.cpp2
-rw-r--r--src/plugins/genericprojectmanager/selectablefilesmodel.cpp24
-rw-r--r--src/plugins/genericprojectmanager/selectablefilesmodel.h3
-rw-r--r--src/plugins/git/branchadddialog.cpp32
-rw-r--r--src/plugins/git/branchadddialog.h32
-rw-r--r--src/plugins/locator/locatorplugin.cpp16
-rw-r--r--src/plugins/locator/locatorplugin.h2
-rw-r--r--src/plugins/locator/locatorwidget.cpp6
-rw-r--r--src/plugins/locator/locatorwidget.h2
-rw-r--r--src/plugins/projectexplorer/clangparser.cpp2
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.cpp32
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.h32
-rw-r--r--src/plugins/projectexplorer/gccparser.cpp20
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp6
-rw-r--r--src/plugins/projectexplorer/gnumakeparser.cpp2
-rw-r--r--src/plugins/projectexplorer/ldparser.cpp4
-rw-r--r--src/plugins/projectexplorer/linuxiccparser.cpp4
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp2
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.cpp14
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.h1
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp4
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.h2
-rw-r--r--src/plugins/projectexplorer/task.cpp5
-rw-r--r--src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h1
-rw-r--r--src/plugins/qmldesigner/components/formeditor/anchortool.cpp4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/anchortool.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/dragtool.cpp9
-rw-r--r--src/plugins/qmldesigner/components/formeditor/dragtool.h1
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp28
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.h3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/itemcreatortool.h3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp67
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movemanipulator.h4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movetool.cpp5
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movetool.h3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/resizetool.cpp12
-rw-r--r--src/plugins/qmldesigner/components/formeditor/resizetool.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/selectiontool.cpp5
-rw-r--r--src/plugins/qmldesigner/components/formeditor/selectiontool.h2
-rw-r--r--src/plugins/qmldesigner/components/integration/componentview.cpp2
-rw-r--r--src/plugins/qmldesigner/components/integration/componentview.h2
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp5
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h2
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp2
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp5
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h2
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp1
-rw-r--r--src/plugins/qmldesigner/components/logger/logger.cpp2
-rw-r--r--src/plugins/qmldesigner/components/logger/logger.h2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h2
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml32
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h2
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateslist.qml32
-rw-r--r--src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp2
-rw-r--r--src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h2
-rw-r--r--src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/include/abstractview.h5
-rw-r--r--src/plugins/qmldesigner/designercore/include/anchorline.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/bytearraymodifier.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/model.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/modificationgroupexception.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h12
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeanchors.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeinstanceview.h9
-rw-r--r--src/plugins/qmldesigner/designercore/include/objectpropertybinding.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/propertybinding.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlmodelview.h1
-rw-r--r--src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/rewriterview.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/stylemanager.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/widgetqueryview.h2
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp11
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h1
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp55
-rw-r--r--src/plugins/qmldesigner/designercore/model/abstractview.cpp12
-rw-r--r--src/plugins/qmldesigner/designercore/model/anchorline.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/copyhelper.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/copyhelper.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/model.cpp68
-rw-r--r--src/plugins/qmldesigner/designercore/model/model_p.h3
-rw-r--r--src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp32
-rw-r--r--src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h32
-rw-r--r--src/plugins/qmldesigner/designercore/model/modelrewriter.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/modelrewriter.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp32
-rw-r--r--src/plugins/qmldesigner/designercore/model/nodeanchors.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/parsedqml.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/parsedqml.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/paster.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/paster.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/propertybinding.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp7
-rw-r--r--src/plugins/qmldesigner/designercore/model/rewriterview.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/model/viewlogger.cpp7
-rw-r--r--src/plugins/qmldesigner/designercore/model/viewlogger.h2
-rw-r--r--src/plugins/qmldesigner/designercore/preview/stylemanager.cpp2
-rw-r--r--src/plugins/qmldesigner/qmlcontextpane.cpp2
-rw-r--r--src/plugins/qmldesigner/qmlcontextpane.h2
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/gridview.qml38
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/listview.qml34
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/pathview.qml34
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/text.qml32
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/textedit.qml32
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/source/textinput.qml32
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp4
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp32
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingsfactory.h32
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.cpp32
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.h32
-rw-r--r--src/plugins/qmljstools/qmljstoolssettings.cpp32
-rw-r--r--src/plugins/qmljstools/qmljstoolssettings.h29
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h47
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h79
-rw-r--r--src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp31
-rw-r--r--src/plugins/qmlprofiler/codaqmlprofilerrunner.h25
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.cpp25
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.h25
-rw-r--r--src/plugins/qmlprofiler/qml/Detail.qml25
-rw-r--r--src/plugins/qmlprofiler/qml/Label.qml25
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.js2
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml46
-rw-r--r--src/plugins/qmlprofiler/qml/RangeDetails.qml25
-rw-r--r--src/plugins/qmlprofiler/qml/RangeMover.qml25
-rw-r--r--src/plugins/qmlprofiler/qml/TimeDisplay.qml34
-rw-r--r--src/plugins/qmlprofiler/qml/analyzer_category_small.pngbin705 -> 0 bytes
-rw-r--r--src/plugins/qmlprofiler/qml/qml.qrc5
-rw-r--r--src/plugins/qmlprofiler/qml/range.pngbin442 -> 0 bytes
-rw-r--r--src/plugins/qmlprofiler/qml/recordOff.pngbin0 -> 589 bytes
-rw-r--r--src/plugins/qmlprofiler/qml/recordOn.pngbin0 -> 632 bytes
-rw-r--r--src/plugins/qmlprofiler/qml/toolbarbg.pngbin817 -> 0 bytes
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.pro17
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler_global.h25
-rw-r--r--src/plugins/qmlprofiler/qmlprofilercalleeview.cpp292
-rw-r--r--src/plugins/qmlprofiler/qmlprofilercalleeview.h71
-rw-r--r--src/plugins/qmlprofiler/qmlprofilercallerview.cpp288
-rw-r--r--src/plugins/qmlprofiler/qmlprofilercallerview.h71
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerconstants.h25
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.cpp99
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerengine.h30
-rw-r--r--src/plugins/qmlprofiler/qmlprofilereventtypes.h (renamed from src/plugins/valgrind/valgrind_global.h)28
-rw-r--r--src/plugins/qmlprofiler/qmlprofilereventview.cpp543
-rw-r--r--src/plugins/qmlprofiler/qmlprofilereventview.h160
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp99
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.h36
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp158
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h (renamed from src/plugins/analyzerbase/analyzerruncontrolfactory.h)30
-rw-r--r--src/plugins/qmlprofiler/qmlprofilersummaryview.cpp283
-rw-r--r--src/plugins/qmlprofiler/qmlprofilersummaryview.h80
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp193
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h42
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceclient.cpp37
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceclient.h47
-rw-r--r--src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp118
-rw-r--r--src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h69
-rw-r--r--src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp29
-rw-r--r--src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h25
-rw-r--r--src/plugins/qmlprofiler/timelineview.cpp25
-rw-r--r--src/plugins/qmlprofiler/timelineview.h25
-rw-r--r--src/plugins/qmlprofiler/tracewindow.cpp45
-rw-r--r--src/plugins/qmlprofiler/tracewindow.h27
-rw-r--r--src/plugins/qt4projectmanager/applicationlauncher.h2
-rw-r--r--src/plugins/qt4projectmanager/qmakeparser.cpp8
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/abldparser.cpp6
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp4
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp6
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp29
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h29
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp6
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp29
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.h3
-rw-r--r--src/plugins/qtestlib/qtestlibplugin.cpp2
-rw-r--r--src/plugins/qtestlib/qtestlibplugin.h2
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.cpp53
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.h56
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.h4
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp591
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepagewidget.h120
-rw-r--r--src/plugins/qtsupport/qtoptionspage.cpp80
-rw-r--r--src/plugins/qtsupport/qtoptionspage.h10
-rw-r--r--src/plugins/qtsupport/qtversioninfo.ui2
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp4
-rw-r--r--src/plugins/regexp/regexpplugin.cpp2
-rw-r--r--src/plugins/regexp/regexpplugin.h2
-rw-r--r--src/plugins/regexp/regexpwindow.cpp2
-rw-r--r--src/plugins/regexp/regexpwindow.h2
-rw-r--r--src/plugins/regexp/settings.cpp2
-rw-r--r--src/plugins/regexp/settings.h2
-rw-r--r--src/plugins/remotelinux/abstractmaemodeploystep.cpp3
-rw-r--r--src/plugins/remotelinux/maemodeployconfigurationwidget.cpp1
-rw-r--r--src/plugins/remotelinux/maemodeploystepfactory.cpp3
-rw-r--r--src/plugins/remotelinux/maemodeviceconfigwizard.cpp21
-rw-r--r--src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui34
-rw-r--r--src/plugins/remotelinux/maemoglobal.cpp87
-rw-r--r--src/plugins/remotelinux/maemoglobal.h7
-rw-r--r--src/plugins/remotelinux/maemoinstalltosysrootstep.cpp6
-rw-r--r--src/plugins/remotelinux/maemopackagecreationfactory.cpp2
-rw-r--r--src/plugins/remotelinux/maemopackagecreationstep.cpp6
-rw-r--r--src/plugins/remotelinux/maemopublisherfremantlefree.cpp4
-rw-r--r--src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp2
-rw-r--r--src/plugins/remotelinux/maemousedportsgatherer.cpp8
-rw-r--r--src/plugins/remotelinux/publickeydeploymentdialog.cpp2
-rw-r--r--src/plugins/remotelinux/qt4maemodeployconfiguration.cpp10
-rw-r--r--src/plugins/remotelinux/qt4maemotarget.cpp8
-rw-r--r--src/plugins/remotelinux/remotelinux.pro2
-rw-r--r--src/plugins/remotelinux/remotelinuxapplicationrunner.cpp3
-rw-r--r--src/plugins/remotelinux/remotelinuxdebugsupport.cpp8
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp2
-rw-r--r--src/plugins/texteditor/codestylepreferencesmanager.cpp32
-rw-r--r--src/plugins/texteditor/codestylepreferencesmanager.h32
-rw-r--r--src/plugins/texteditor/fallbackselectorwidget.cpp32
-rw-r--r--src/plugins/texteditor/fallbackselectorwidget.h32
-rw-r--r--src/plugins/texteditor/icodestylepreferencesfactory.cpp32
-rw-r--r--src/plugins/texteditor/icodestylepreferencesfactory.h32
-rw-r--r--src/plugins/texteditor/ifallbackpreferences.cpp32
-rw-r--r--src/plugins/texteditor/ifallbackpreferences.h32
-rw-r--r--src/plugins/texteditor/tabpreferences.cpp32
-rw-r--r--src/plugins/texteditor/tabpreferences.h32
-rw-r--r--src/plugins/texteditor/tabpreferenceswidget.cpp32
-rw-r--r--src/plugins/texteditor/tabpreferenceswidget.h32
-rw-r--r--src/plugins/texteditor/tabsettingswidget.cpp32
-rw-r--r--src/plugins/texteditor/tabsettingswidget.h32
-rw-r--r--src/plugins/valgrind/callgrindengine.cpp16
-rw-r--r--src/plugins/valgrind/callgrindengine.h13
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp189
-rw-r--r--src/plugins/valgrind/callgrindtool.h13
-rw-r--r--src/plugins/valgrind/memcheckengine.cpp6
-rw-r--r--src/plugins/valgrind/memcheckengine.h5
-rw-r--r--src/plugins/valgrind/memchecktool.cpp71
-rw-r--r--src/plugins/valgrind/memchecktool.h17
-rw-r--r--src/plugins/valgrind/valgrind.pro11
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp31
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h54
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp239
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h97
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp277
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h116
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp145
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h103
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp123
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h86
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp365
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h105
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp335
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h161
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h82
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp140
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h96
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp118
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h68
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp377
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h146
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp679
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindparser.h84
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp169
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h89
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp136
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h86
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp84
-rw-r--r--src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h72
-rw-r--r--src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp234
-rw-r--r--src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h79
-rw-r--r--src/plugins/valgrind/valgrind/valgrind.pri63
-rw-r--r--src/plugins/valgrind/valgrind/valgrindprocess.cpp370
-rw-r--r--src/plugins/valgrind/valgrind/valgrindprocess.h170
-rw-r--r--src/plugins/valgrind/valgrind/valgrindrunner.cpp258
-rw-r--r--src/plugins/valgrind/valgrind/valgrindrunner.h104
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp111
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h72
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/error.cpp266
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/error.h150
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp300
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h110
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp164
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/frame.h82
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp88
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h54
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp753
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/parser.h91
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp161
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/stack.h87
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp238
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h91
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/status.cpp107
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/status.h75
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp243
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/suppression.h115
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp156
-rw-r--r--src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h91
-rw-r--r--src/plugins/valgrind/valgrind_dependencies.pri1
-rw-r--r--src/plugins/valgrind/valgrindengine.cpp8
-rw-r--r--src/plugins/valgrind/valgrindengine.h13
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp179
-rw-r--r--src/plugins/valgrind/valgrindplugin.h5
-rw-r--r--src/plugins/valgrind/valgrindsettings.h4
-rw-r--r--src/plugins/welcome/images/center_frame_header.pngbin8499 -> 11650 bytes
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp18
395 files changed, 14691 insertions, 4209 deletions
diff --git a/src/plugins/analyzerbase/analyzerbase.pro b/src/plugins/analyzerbase/analyzerbase.pro
index ad33056b15..e42ee34fa8 100644
--- a/src/plugins/analyzerbase/analyzerbase.pro
+++ b/src/plugins/analyzerbase/analyzerbase.pro
@@ -15,7 +15,6 @@ SOURCES += \
ianalyzertool.cpp \
analyzerplugin.cpp \
analyzerruncontrol.cpp \
- analyzerruncontrolfactory.cpp \
analyzermanager.cpp \
analyzersettings.cpp \
analyzeroptionspage.cpp \
@@ -30,7 +29,6 @@ HEADERS += \
analyzerconstants.h \
analyzerplugin.h \
analyzerruncontrol.h \
- analyzerruncontrolfactory.h \
analyzermanager.h \
analyzersettings.h \
analyzerstartparameters.h \
diff --git a/src/plugins/analyzerbase/analyzerconstants.h b/src/plugins/analyzerbase/analyzerconstants.h
index 883f77b9cf..23f15e7b80 100644
--- a/src/plugins/analyzerbase/analyzerconstants.h
+++ b/src/plugins/analyzerbase/analyzerconstants.h
@@ -39,16 +39,22 @@
namespace Analyzer {
-enum AnalyzerStartMode
+// Special values for currently used modes.
+// Their meaning is interpreted by the individual tools.
+// FIXME: The plan is to remove this entirely from the
+// public interface and let the tools handle that internally.
+
+enum StartMode
{
- StartLocal,
- StartRemote
+ StartLocal = -1,
+ StartRemote = -2,
+ StartQml = -3
};
namespace Constants {
// modes and their priorities
-const char * const MODE_ANALYZE = "Analyzer.Mode.Analyze";
+const char * const MODE_ANALYZE = "Mode.Analyze";
const int P_MODE_ANALYZE = 76;
// context
@@ -61,6 +67,10 @@ const char * const START = "Analyzer.Start";
const char * const STARTREMOTE = "Analyzer.StartRemote";
const char * const STOP = "Analyzer.Stop";
+const char * const G_ANALYZER_CONTROL = "Menu.Group.Analyzer.Control";
+const char * const G_ANALYZER_TOOLS = "Menu.Group.Analyzer.Tools";
+const char * const G_ANALYZER_REMOTE_TOOLS = "Menu.Group.Analyzer.RemoteTools";
+
// options dialog
const char * const ANALYZER_SETTINGS_CATEGORY = "T.Analyzer";
const char * const ANALYZER_SETTINGS_TR_CATEGORY =
@@ -76,9 +86,6 @@ const char * const ANALYZER_CONTROL_STOP_ICON =
const char * const ANALYZERTASK_ID = "Analyzer.TaskId";
-// private
-const char * const ANALYZER_DUMMYWIDGET_ID = "Analyzer.DummyWidget";
-
} // namespace Constants
} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
index 8553afab86..cdf4e5d167 100644
--- a/src/plugins/analyzerbase/analyzermanager.cpp
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -37,12 +37,10 @@
#include "analyzerconstants.h"
#include "analyzerplugin.h"
#include "analyzerruncontrol.h"
-#include "analyzerruncontrolfactory.h"
#include "analyzeroptionspage.h"
#include "analyzerstartparameters.h"
#include "analyzerutils.h"
#include "ianalyzertool.h"
-#include "startremotedialog.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/findplaceholder.h>
@@ -76,8 +74,6 @@
#include <utils/statuslabel.h>
#include <utils/ssh/sshconnection.h>
-#include <cmakeprojectmanager/cmakeprojectconstants.h>
-
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include <QtGui/QHBoxLayout>
@@ -98,18 +94,20 @@
#include <QtGui/QPushButton>
using namespace Core;
-using namespace Analyzer;
using namespace Analyzer::Internal;
+using namespace ProjectExplorer;
namespace Analyzer {
namespace Internal {
-const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
-const char G_ANALYZER_TOOLS[] = "Menu.Group.Analyzer.Tools";
-const char G_ANALYZER_REMOTE_TOOLS[] = "Menu.Group.Analyzer.RemoteTools";
+const char LAST_ACTIVE_TOOL[] = "Analyzer.Plugin.LastActiveTool";
const char INITIAL_DOCK_AREA[] = "initial_dock_area";
-// AnalyzerMode ////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//
+// AnalyzerMode
+//
+////////////////////////////////////////////////////////////////////
class AnalyzerMode : public Core::IMode
{
@@ -142,7 +140,6 @@ public:
};
} // namespace Internal
-} // namespace Analyzer
////////////////////////////////////////////////////////////////////
//
@@ -150,7 +147,7 @@ public:
//
////////////////////////////////////////////////////////////////////
-class AnalyzerManager::AnalyzerManagerPrivate : public QObject
+class AnalyzerManagerPrivate : public QObject
{
Q_OBJECT
@@ -169,60 +166,52 @@ public:
void delayedInit();
void setupActions();
- QWidget *createModeContents();
- QWidget *createModeMainWindow();
+ void createModeMainWindow();
bool showPromptDialog(const QString &title, const QString &text,
const QString &stopButtonText, const QString &cancelButtonText) const;
- void addDock(Qt::DockWidgetArea area, QDockWidget *dockWidget);
- void startAction(int tool);
- void addTool(IAnalyzerTool *tool);
- void addToolAction(IAnalyzerTool *tool, bool local);
- int indexOf(IAnalyzerTool *tool) const;
- int indexOf(QAction *action) const;
- IAnalyzerTool *toolAt(int idx) const;
+ void activateDock(Qt::DockWidgetArea area, QDockWidget *dockWidget);
+ void deactivateDock(QDockWidget *dockWidget);
+ void addTool(IAnalyzerTool *tool, const StartModes &modes);
+ void selectSavedTool();
+ void selectTool(IAnalyzerTool *tool, StartMode mode);
+ void handleToolStarted();
+ void handleToolFinished();
+ void saveToolSettings(IAnalyzerTool *tool, StartMode mode);
+ void loadToolSettings(IAnalyzerTool *tool);
+ QAction *actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode);
+
+ // Convenience.
+ void startLocalTool(IAnalyzerTool *tool, StartMode mode);
public slots:
- void startAction() { startAction(m_currentIndex); }
- void startToolRemote();
- void stopTool();
-
- void handleToolFinished();
- void selectAction();
- void selectAction(int);
- void selectAction(QAction *);
+ void startTool();
+ void selectToolboxAction(int);
+ void selectMenuAction();
void modeChanged(Core::IMode *mode);
- void runControlCreated(Analyzer::AnalyzerRunControl *);
void resetLayout();
- void saveToolSettings(Analyzer::IAnalyzerTool *tool);
- void loadToolSettings(Analyzer::IAnalyzerTool *tool);
void updateRunActions();
- void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
public:
- struct ToolData {
- IAnalyzerTool *tool;
- QAction *action;
- bool local;
- };
-
AnalyzerManager *q;
AnalyzerMode *m_mode;
- AnalyzerRunControlFactory *m_runControlFactory;
- ProjectExplorer::RunControl *m_currentRunControl;
+ bool m_isRunning;
Utils::FancyMainWindow *m_mainWindow;
- int m_currentIndex;
- QList<ToolData> m_actions;
+ IAnalyzerTool *m_currentTool;
+ StartMode m_currentMode;
+ QHash<QAction *, IAnalyzerTool *> m_toolFromAction;
+ QHash<QAction *, StartMode> m_modeFromAction;
QList<IAnalyzerTool *> m_tools;
+ QList<QAction *> m_actions;
QAction *m_startAction;
QAction *m_stopAction;
ActionContainer *m_menu;
QComboBox *m_toolBox;
- QStackedWidget *m_controlsWidget;
- ActionContainer *m_viewsMenu;
+ QStackedWidget *m_controlsStackWidget;
Utils::StatusLabel *m_statusLabel;
typedef QMap<IAnalyzerTool *, FancyMainWindowSettings> MainWindowSettingsMap;
- QMap<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets;
+ QHash<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets;
+ QHash<IAnalyzerTool *, QWidget *> m_controlsWidgetFromTool;
MainWindowSettingsMap m_defaultSettings;
// list of dock widgets to prevent memory leak
@@ -230,42 +219,35 @@ public:
QList<DockPtr> m_dockWidgets;
bool m_restartOnStop;
- bool m_initialized;
};
-AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
+AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
q(qq),
m_mode(0),
- m_runControlFactory(0),
- m_currentRunControl(0),
+ m_isRunning(false),
m_mainWindow(0),
- m_currentIndex(-1),
+ m_currentTool(0),
+ m_currentMode(),
m_startAction(0),
m_stopAction(0),
m_menu(0),
m_toolBox(new QComboBox),
- m_controlsWidget(new QStackedWidget),
- m_viewsMenu(0),
+ m_controlsStackWidget(new QStackedWidget),
m_statusLabel(new Utils::StatusLabel),
- m_restartOnStop(false),
- m_initialized(false)
+ m_restartOnStop(false)
{
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
- connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectAction(int)));
-
- m_runControlFactory = new AnalyzerRunControlFactory();
- registerRunControlFactory(m_runControlFactory);
+ connect(m_toolBox, SIGNAL(activated(int)), SLOT(selectToolboxAction(int)));
setupActions();
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*)));
- ProjectExplorer::ProjectExplorerPlugin *pe =
- ProjectExplorer::ProjectExplorerPlugin::instance();
+ ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
connect(pe, SIGNAL(updateRunActions()), SLOT(updateRunActions()));
}
-AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
+AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
{
// as we have to setParent(0) on dock widget that are not selected,
// we keep track of all and make sure we don't leak any
@@ -275,15 +257,7 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
}
}
-void AnalyzerManager::AnalyzerManagerPrivate::registerRunControlFactory
- (ProjectExplorer::IRunControlFactory *factory)
-{
- AnalyzerPlugin::instance()->addAutoReleasedObject(factory);
- connect(factory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl*)),
- this, SLOT(runControlCreated(Analyzer::AnalyzerRunControl*)));
-}
-
-void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
+void AnalyzerManagerPrivate::setupActions()
{
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
@@ -295,8 +269,9 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
m_menu->menu()->setTitle(tr("&Analyze"));
m_menu->menu()->setEnabled(true);
- m_menu->appendGroup(G_ANALYZER_TOOLS);
- m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS);
+ m_menu->appendGroup(Constants::G_ANALYZER_CONTROL);
+ m_menu->appendGroup(Constants::G_ANALYZER_TOOLS);
+ m_menu->appendGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
Core::ActionContainer *menubar =
am->actionContainer(Core::Constants::MENU_BAR);
@@ -307,52 +282,52 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
m_startAction = new QAction(tr("Start"), m_menu);
m_startAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_START_ICON));
command = am->registerAction(m_startAction, Constants::START, globalcontext);
- connect(m_startAction, SIGNAL(triggered()), this, SLOT(startAction()));
+ connect(m_startAction, SIGNAL(triggered()), this, SLOT(startTool()));
m_stopAction = new QAction(tr("Stop"), m_menu);
m_stopAction->setEnabled(false);
m_stopAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_STOP_ICON));
command = am->registerAction(m_stopAction, Constants::STOP, globalcontext);
- connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopTool()));
+ m_menu->addAction(command, Constants::G_ANALYZER_CONTROL);
- QAction *separatorAction = new QAction(m_menu);
- separatorAction->setSeparator(true);
- command = am->registerAction(separatorAction,
- "Menu.Action.Analyzer.Tools.Separator", globalcontext);
- m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS);
+ QAction *separatorAction1 = new QAction(m_menu);
+ separatorAction1->setSeparator(true);
+ command = am->registerAction(separatorAction1,
+ "Menu.Action.Analyzer.Tools.Separator1", globalcontext);
+ m_menu->addAction(command, Constants::G_ANALYZER_TOOLS);
- m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
+ QAction *separatorAction2 = new QAction(m_menu);
+ separatorAction2->setSeparator(true);
+ command = am->registerAction(separatorAction2,
+ "Menu.Action.Analyzer.Tools.Separator2", globalcontext);
+ m_menu->addAction(command, Constants::G_ANALYZER_REMOTE_TOOLS);
}
-void AnalyzerManager::AnalyzerManagerPrivate::delayedInit()
+void AnalyzerManagerPrivate::delayedInit()
{
- if (m_initialized)
+ if (m_mode)
return;
m_mode = new AnalyzerMode(q);
- m_mode->setWidget(createModeContents());
- AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode);
-
- m_initialized = true;
-}
+ createModeMainWindow();
-QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeContents()
-{
- // right-side window with editor, output etc.
+ // Right-side window with editor, output etc.
MiniSplitter *mainWindowSplitter = new MiniSplitter;
- mainWindowSplitter->addWidget(createModeMainWindow());
+ mainWindowSplitter->addWidget(m_mainWindow);
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(m_mode, mainWindowSplitter));
mainWindowSplitter->setStretchFactor(0, 10);
mainWindowSplitter->setStretchFactor(1, 0);
mainWindowSplitter->setOrientation(Qt::Vertical);
- // navigation + right-side window
+ // Navigation + right-side window.
MiniSplitter *splitter = new MiniSplitter;
splitter->addWidget(new NavigationWidgetPlaceHolder(m_mode));
splitter->addWidget(mainWindowSplitter);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
- return splitter;
+ m_mode->setWidget(splitter);
+
+ AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode);
}
static QToolButton *toolButton(QAction *action)
@@ -362,14 +337,13 @@ static QToolButton *toolButton(QAction *action)
return button;
}
-QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
+void AnalyzerManagerPrivate::createModeMainWindow()
{
m_mainWindow = new Utils::FancyMainWindow();
m_mainWindow->setObjectName(QLatin1String("AnalyzerManagerMainWindow"));
m_mainWindow->setDocumentMode(true);
m_mainWindow->setDockNestingEnabled(true);
- m_mainWindow->setDockActionsVisible(ModeManager::instance()->currentMode()->id() ==
- Constants::MODE_ANALYZE);
+ m_mainWindow->setDockActionsVisible(false);
connect(m_mainWindow, SIGNAL(resetLayout()), SLOT(resetLayout()));
QBoxLayout *editorHolderLayout = new QVBoxLayout;
@@ -396,7 +370,7 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
analyzeToolBarLayout->addWidget(toolButton(m_stopAction));
analyzeToolBarLayout->addWidget(new Utils::StyledSeparator);
analyzeToolBarLayout->addWidget(m_toolBox);
- analyzeToolBarLayout->addWidget(m_controlsWidget);
+ analyzeToolBarLayout->addWidget(m_controlsStackWidget);
analyzeToolBarLayout->addWidget(m_statusLabel);
analyzeToolBarLayout->addStretch();
@@ -421,12 +395,9 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
centralLayout->addWidget(documentAndRightPane);
centralLayout->setStretch(0, 1);
centralLayout->setStretch(1, 0);
-
- return m_mainWindow;
}
-void AnalyzerManager::AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area,
- QDockWidget *dockWidget)
+void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget *dockWidget)
{
dockWidget->setParent(m_mainWindow);
m_mainWindow->addDockWidget(area, dockWidget);
@@ -436,32 +407,44 @@ void AnalyzerManager::AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area,
ActionManager *am = ICore::instance()->actionManager();
QAction *toggleViewAction = dockWidget->toggleViewAction();
toggleViewAction->setText(dockWidget->windowTitle());
- Command *cmd = am->registerAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName()),
- globalContext);
+ Command *cmd = am->registerAction(toggleViewAction,
+ QString("Analyzer." + dockWidget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide);
- m_viewsMenu->addAction(cmd);
+
+ ActionContainer *viewsMenu =
+ am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
+ viewsMenu->addAction(cmd);
+}
+
+void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget)
+{
+ ActionManager *am = ICore::instance()->actionManager();
+ QAction *toggleViewAction = dockWidget->toggleViewAction();
+ am->unregisterAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName()));
+ m_mainWindow->removeDockWidget(dockWidget);
+ dockWidget->hide();
+ // Prevent saveState storing the data of the wrong children.
+ dockWidget->setParent(0);
}
bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
- ProjectExplorer::BuildConfiguration::BuildType buildType)
+ BuildConfiguration::BuildType buildType)
{
if (toolMode == IAnalyzerTool::AnyMode)
return true;
- if (buildType == ProjectExplorer::BuildConfiguration::Unknown)
+ if (buildType == BuildConfiguration::Unknown)
return true;
- if (buildType == ProjectExplorer::BuildConfiguration::Debug
+ if (buildType == BuildConfiguration::Debug
&& toolMode == IAnalyzerTool::DebugMode)
return true;
- if (buildType == ProjectExplorer::BuildConfiguration::Release
+ if (buildType == BuildConfiguration::Release
&& toolMode == IAnalyzerTool::ReleaseMode)
return true;
return false;
}
-bool AnalyzerManager::AnalyzerManagerPrivate::showPromptDialog(const QString &title,
- const QString &text,
- const QString &stopButtonText,
- const QString &cancelButtonText) const
+bool AnalyzerManagerPrivate::showPromptDialog(const QString &title, const QString &text,
+ const QString &stopButtonText, const QString &cancelButtonText) const
{
Utils::CheckableMessageBox messageBox(Core::ICore::instance()->mainWindow());
messageBox.setWindowTitle(title);
@@ -477,52 +460,27 @@ bool AnalyzerManager::AnalyzerManagerPrivate::showPromptDialog(const QString &ti
return messageBox.clickedStandardButton() == QDialogButtonBox::Yes;
}
-void AnalyzerManager::AnalyzerManagerPrivate::startToolRemote()
-{
- StartRemoteDialog dlg;
- if (dlg.exec() != QDialog::Accepted)
- return;
-
- AnalyzerStartParameters sp;
- sp.connParams = dlg.sshParams();
- sp.debuggee = dlg.executable();
- sp.debuggeeArgs = dlg.arguments();
- sp.displayName = dlg.executable();
- sp.startMode = StartRemote;
- sp.workingDirectory = dlg.workingDirectory();
-
- AnalyzerRunControl *runControl = m_runControlFactory->create(sp, 0);
-
- QTC_ASSERT(runControl, return);
- ProjectExplorer::ProjectExplorerPlugin::instance()
- ->startRunControl(runControl, Constants::MODE_ANALYZE);
-}
-
-void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index)
+void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode)
{
+ int index = m_tools.indexOf(tool);
QTC_ASSERT(index >= 0, return);
- QTC_ASSERT(index < m_actions.size(), return);
- QTC_ASSERT(index == m_currentIndex, return);
+ QTC_ASSERT(index < m_tools.size(), return);
+ QTC_ASSERT(tool == m_currentTool, return);
- if (!m_actions.at(index).local) {
- startToolRemote();
- return;
- }
-
- // make sure mode is shown
+ // Make sure mode is shown.
q->showMode();
- ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+ ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
- ProjectExplorer::Project *pro = pe->startupProject();
- const ProjectExplorer::RunConfiguration *runConfig = 0;
- ProjectExplorer::BuildConfiguration::BuildType buildType = ProjectExplorer::BuildConfiguration::Unknown;
+ Project *pro = pe->startupProject();
+ const RunConfiguration *runConfig = 0;
+ BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
if (pro) {
- if (const ProjectExplorer::Target *target = pro->activeTarget()) {
+ if (const Target *target = pro->activeTarget()) {
runConfig = target->activeRunConfiguration();
// Build configuration is 0 for QML projects.
- if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration())
+ if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration())
buildType = buildConfig->buildType();
}
}
@@ -530,12 +488,12 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index)
return;
// Check if there already is an analyzer run.
- if (m_currentRunControl) {
+ if (m_isRunning) {
// ask if user wants to restart the analyzer
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. "
"You have to quit the Analyzer before being able to run another instance."
"<center/><center>Force it to quit?</center></body></html>")
- .arg(m_currentRunControl->displayName());
+ .arg(m_currentTool->displayName());
bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg,
tr("Stop Active Run"), tr("Keep Running"));
if (!stopRequested)
@@ -543,37 +501,47 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index)
// user selected to stop the active run. stop it, activate restart on stop
m_restartOnStop = true;
- stopTool();
+ q->stopTool();
return;
}
- IAnalyzerTool *tool = toolAt(index);
- IAnalyzerTool::ToolMode toolMode = tool->mode();
+ IAnalyzerTool::ToolMode toolMode = tool->toolMode();
// Check the project for whether the build config is in the correct mode
// if not, notify the user and urge him to use the correct mode.
if (!buildTypeAccepted(toolMode, buildType)) {
- const QString &toolName = tool->displayName();
- const QString &toolMode = IAnalyzerTool::modeString(tool->mode());
- const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release");
+ const QString toolName = tool->displayName();
+ const QString currentMode =
+ buildType == BuildConfiguration::Debug ? tr("Debug") : tr("Release");
QSettings *settings = Core::ICore::instance()->settings();
- const QString configKey = QLatin1String(Constants::MODE_ANALYZE) + QLatin1Char('/') + QLatin1String("AnalyzeCorrectMode");
+ const QString configKey = QLatin1String("Analyzer.AnalyzeCorrectMode");
int ret;
if (settings->contains(configKey)) {
ret = settings->value(configKey, QDialog::Accepted).toInt();
} else {
+ QString toolModeString;
+ switch (toolMode) {
+ case IAnalyzerTool::DebugMode:
+ toolModeString = tr("Debug");
+ case IAnalyzerTool::ReleaseMode:
+ toolModeString = tr("Release");
+ case IAnalyzerTool::AnyMode:
+ break;
+ }
const QString title = tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode);
- const QString message = tr("<html><head/><body><p>You are trying to run the tool '%1' on an application in %2 mode. "
- "The tool is designed to be used in %3 mode.</p><p>"
- "Do you want to continue and run it in %2 mode?</p></body></html>").
- arg(toolName).arg(currentMode).arg(toolMode);
+ const QString message = tr("<html><head/><body><p>You are trying "
+ "to run the tool \"%1\" on an application in %2 mode. "
+ "The tool is designed to be used in %3 mode.</p><p>"
+ "Do you want to continue and run it in %2 mode?</p></body></html>")
+ .arg(toolName).arg(currentMode).arg(toolModeString);
const QString checkBoxText = tr("&Do not ask again");
bool checkBoxSetting = false;
const QDialogButtonBox::StandardButton button =
- Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), title, message, checkBoxText,
- &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel,
- QDialogButtonBox::Cancel);
+ Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(),
+ title, message, checkBoxText,
+ &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel,
+ QDialogButtonBox::Cancel);
ret = button == QDialogButtonBox::Yes ? QDialog::Accepted : QDialog::Rejected;
if (checkBoxSetting && ret == QDialog::Accepted)
@@ -583,173 +551,154 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index)
return;
}
- pe->runProject(pro, Constants::MODE_ANALYZE);
-
+ m_isRunning = true;
+ pe->runProject(pro, tool->id());
updateRunActions();
}
-
-void AnalyzerManager::AnalyzerManagerPrivate::stopTool()
+void AnalyzerManagerPrivate::startTool()
{
- if (m_currentRunControl)
- return;
-
- // be sure to call handleToolFinished only once, and only when the engine is really finished
- if (m_currentRunControl->stop() == ProjectExplorer::RunControl::StoppedSynchronously)
- handleToolFinished();
- // else: wait for the finished() signal to trigger handleToolFinished()
+ m_currentTool->startTool(m_currentMode);
}
-void AnalyzerManager::AnalyzerManagerPrivate::modeChanged(IMode *mode)
+void AnalyzerManagerPrivate::modeChanged(IMode *mode)
{
- if (!m_mainWindow)
- return;
- const bool makeVisible = mode->id() == Constants::MODE_ANALYZE;
- if (!makeVisible)
- return;
- m_mainWindow->setDockActionsVisible(makeVisible);
-}
-
-void AnalyzerManager::AnalyzerManagerPrivate::selectAction(int idx)
-{
- QTC_ASSERT(idx >= 0, return);
- if (m_currentIndex == idx)
- return;
-
- if (m_currentIndex != -1) {
- IAnalyzerTool *oldTool = toolAt(m_currentIndex);
- saveToolSettings(oldTool);
-
- ActionManager *am = ICore::instance()->actionManager();
-
- foreach (QDockWidget *widget, m_toolWidgets.value(oldTool)) {
- QAction *toggleViewAction = widget->toggleViewAction();
- am->unregisterAction(toggleViewAction,
- QString("Analyzer." + widget->objectName()));
- m_mainWindow->removeDockWidget(widget);
- ///NOTE: QMainWindow (and FancyMainWindow) just look at
- /// @c findChildren<QDockWidget*>()
- ///if we don't do this, all kind of havoc might happen, including:
- ///- improper saveState/restoreState
- ///- improper list of qdockwidgets in popup menu
- ///- ...
- widget->setParent(0);
- }
- oldTool->toolDeselected();
- }
-
- m_currentIndex = idx;
-
- m_toolBox->setCurrentIndex(idx);
- m_controlsWidget->setCurrentIndex(idx);
-
- IAnalyzerTool *newTool = toolAt(idx);
-
- const bool firstTime = !m_defaultSettings.contains(newTool);
- if (firstTime) {
- newTool->initializeDockWidgets();
- m_defaultSettings.insert(newTool, m_mainWindow->saveSettings());
+ if (mode && mode == m_mode) {
+ m_mainWindow->setDockActionsVisible(true);
+ static bool firstTime = true;
+ if (firstTime)
+ selectSavedTool();
+ firstTime = false;
+ updateRunActions();
} else {
- foreach (QDockWidget *widget, m_toolWidgets.value(newTool))
- addDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
+ m_mainWindow->setDockActionsVisible(false);
}
-
- loadToolSettings(newTool);
- updateRunActions();
}
-void AnalyzerManager::AnalyzerManagerPrivate::selectAction()
+QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode)
{
- selectAction(qobject_cast<QAction *>(sender()));
+ foreach (QAction *action, m_actions)
+ if (m_toolFromAction.value(action) == tool && m_modeFromAction[action] == mode)
+ return action;
+ QTC_ASSERT(false, /**/);
+ return 0;
}
-void AnalyzerManager::AnalyzerManagerPrivate::selectAction(QAction *action)
+void AnalyzerManagerPrivate::selectSavedTool()
{
- selectAction(indexOf(action));
+ const QSettings *settings = Core::ICore::instance()->settings();
+ const QByteArray lastActiveAction =
+ settings->value(QLatin1String(LAST_ACTIVE_TOOL), QString()).toByteArray();
+ foreach (QAction *action, m_actions) {
+ IAnalyzerTool *tool = m_toolFromAction.value(action);
+ StartMode mode = m_modeFromAction.value(action);
+ if (tool->actionId(mode) == lastActiveAction) {
+ selectTool(tool, mode);
+ break;
+ }
+ }
}
-int AnalyzerManager::AnalyzerManagerPrivate::indexOf(QAction *action) const
+void AnalyzerManagerPrivate::selectMenuAction()
{
- for (int i = 0; i != m_actions.size(); ++i)
- if (m_actions.at(i).action == action)
- return i;
- return -1;
+ QAction *action = qobject_cast<QAction *>(sender());
+ QTC_ASSERT(action, return);
+ IAnalyzerTool *tool = m_toolFromAction.value(action);
+ StartMode mode = m_modeFromAction.value(action);
+ selectTool(tool, mode);
+ tool->startTool(mode);
}
-int AnalyzerManager::AnalyzerManagerPrivate::indexOf(IAnalyzerTool *tool) const
+void AnalyzerManagerPrivate::selectToolboxAction(int index)
{
- for (int i = 0; i != m_actions.size(); ++i)
- if (toolAt(i) == tool)
- return i;
- return -1;
+ QAction *action = m_actions[index];
+ selectTool(m_toolFromAction.value(action), m_modeFromAction.value(action));
}
-IAnalyzerTool *AnalyzerManager::AnalyzerManagerPrivate::toolAt(int idx) const
+void AnalyzerManagerPrivate::selectTool(IAnalyzerTool *tool, StartMode mode)
{
- QTC_ASSERT(idx >= 0, return 0);
- QTC_ASSERT(idx < m_actions.size(), return 0);
- return m_actions.at(idx).tool;
-}
+ if (m_currentTool == tool && m_currentMode == mode)
+ return;
-void AnalyzerManager::AnalyzerManagerPrivate::addToolAction(IAnalyzerTool *tool, bool local)
-{
- ActionManager *am = Core::ICore::instance()->actionManager();
+ QAction *action = actionFromToolAndMode(tool, mode);
+ const int actionIndex = m_actions.indexOf(action);
+ QTC_ASSERT(actionIndex >= 0, return);
- QString actionId = QString("Action.Analyzer.Tools.%1").arg(m_actions.size());
- QString displayName = tool->displayName() + (local ? QString() : tr(" (Remote)"));
- QAction *action = new QAction(displayName, 0);
+ // Clean up old tool.
+ if (m_currentTool) {
+ saveToolSettings(m_currentTool, m_currentMode);
+ foreach (QDockWidget *widget, m_toolWidgets.value(m_currentTool))
+ deactivateDock(widget);
+ m_currentTool->toolDeselected();
+ }
- ToolData data;
- data.tool = tool;
- data.local = local;
- data.action = action;
- m_actions.append(data);
+ // Now change the tool.
+ m_currentTool = tool;
+ m_currentMode = mode;
+
+ if (!m_defaultSettings.contains(tool)) {
+ QWidget *widget = tool->createWidgets();
+ QTC_ASSERT(widget, /**/);
+ m_defaultSettings.insert(tool, m_mainWindow->saveSettings());
+ QTC_ASSERT(!m_controlsWidgetFromTool.contains(tool), /**/);
+ m_controlsWidgetFromTool[tool] = widget;
+ m_controlsStackWidget->addWidget(widget);
+ }
+ foreach (QDockWidget *widget, m_toolWidgets.value(tool))
+ activateDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
- Core::Command *command = am->registerAction(action, actionId,
- Core::Context(Core::Constants::C_GLOBAL));
- m_menu->addAction(command, local ? G_ANALYZER_TOOLS : G_ANALYZER_REMOTE_TOOLS);
- connect(action, SIGNAL(triggered()), SLOT(selectAction()));
+ loadToolSettings(tool);
- const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
- m_toolBox->addItem(displayName);
- m_toolBox->blockSignals(blocked);
- m_toolBox->setEnabled(true);
+ QTC_ASSERT(m_controlsWidgetFromTool.contains(tool), /**/);
+ m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(tool));
+ m_toolBox->setCurrentIndex(actionIndex);
+
+ updateRunActions();
}
-void AnalyzerManager::AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool)
+void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &modes)
{
- delayedInit(); // be sure that there is a valid IMode instance
+ delayedInit(); // Make sure that there is a valid IMode instance.
+
+ const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
+ ActionManager *am = Core::ICore::instance()->actionManager();
+ foreach (StartMode mode, modes) {
+ QString actionName = tool->actionName(mode);
+ QString menuGroup = tool->menuGroup(mode);
+ QString actionId = tool->actionId(mode);
+ QAction *action = new QAction(actionName, 0);
+ Core::Command *command = am->registerAction(action, actionId,
+ Core::Context(Core::Constants::C_GLOBAL));
+ m_menu->addAction(command, menuGroup);
+ m_actions.append(action);
+ m_toolFromAction[action] = tool;
+ m_modeFromAction[action] = mode;
+ m_toolBox->addItem(actionName);
+ m_toolBox->blockSignals(blocked);
+ connect(action, SIGNAL(triggered()), SLOT(selectMenuAction()));
+ }
m_tools.append(tool);
- if (tool->canRunLocally())
- addToolAction(tool, true);
- if (tool->canRunRemotely())
- addToolAction(tool, false);
- // Populate controls widget.
- QWidget *controlWidget = tool->createControlWidget(); // might be 0
- m_controlsWidget->addWidget(controlWidget
- ? controlWidget : AnalyzerUtils::createDummyWidget());
- tool->initialize();
+ m_toolBox->setEnabled(true);
}
-void AnalyzerManager::AnalyzerManagerPrivate::runControlCreated(AnalyzerRunControl *rc)
+void AnalyzerManagerPrivate::handleToolStarted()
{
- QTC_ASSERT(!m_currentRunControl, /**/);
- m_currentRunControl = rc;
- connect(rc, SIGNAL(finished()), this, SLOT(handleToolFinished()));
+ m_isRunning = true; // FIXME: Make less global.
+ updateRunActions();
}
-void AnalyzerManager::AnalyzerManagerPrivate::handleToolFinished()
+void AnalyzerManagerPrivate::handleToolFinished()
{
- m_currentRunControl = 0;
+ m_isRunning = false;
updateRunActions();
if (m_restartOnStop) {
- startAction(m_currentIndex);
+ m_currentTool->startTool(m_currentMode);
m_restartOnStop = false;
}
}
-void AnalyzerManager::AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool)
+void AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool)
{
QTC_ASSERT(m_mainWindow, return);
QSettings *settings = Core::ICore::instance()->settings();
@@ -759,7 +708,7 @@ void AnalyzerManager::AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *to
settings->endGroup();
}
-void AnalyzerManager::AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool)
+void AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool, StartMode mode)
{
if (!tool)
return; // no active tool, do nothing
@@ -770,31 +719,38 @@ void AnalyzerManager::AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *to
m_mainWindow->saveSettings(settings);
settings->setValue("ToolSettingsSaved", true);
settings->endGroup();
- settings->setValue(QLatin1String(lastActiveToolC), tool->id());
+ settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), tool->actionId(mode));
}
-void AnalyzerManager::AnalyzerManagerPrivate::updateRunActions()
+void AnalyzerManagerPrivate::updateRunActions()
{
- ProjectExplorer::ProjectExplorerPlugin *pe =
- ProjectExplorer::ProjectExplorerPlugin::instance();
- ProjectExplorer::Project *project = pe->startupProject();
+ static bool previousRunning = true;
+ static IAnalyzerTool *previousTool = 0;
+ if (previousRunning == m_isRunning && previousTool == m_currentTool)
+ return;
+ previousTool = m_currentTool;
+ previousRunning = m_isRunning;
+
+ ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
+ Project *project = pe->startupProject();
- bool startEnabled = !m_currentRunControl
- && pe->canRun(project, Constants::MODE_ANALYZE)
- && m_currentIndex >= 0;
+ bool startEnabled = !m_isRunning
+ && m_currentTool && pe->canRun(project, m_currentTool->id());
QString disabledReason;
- if (m_currentRunControl)
+ if (m_isRunning)
disabledReason = tr("An analysis is still in progress.");
- else if (m_currentIndex == -1)
+ else if (!m_currentTool)
disabledReason = tr("No analyzer tool selected.");
else
- disabledReason = pe->cannotRunReason(project, Constants::MODE_ANALYZE);
+ disabledReason = pe->cannotRunReason(project, m_currentTool->id());
m_startAction->setEnabled(startEnabled);
m_startAction->setToolTip(disabledReason);
- m_toolBox->setEnabled(!m_currentRunControl);
- m_stopAction->setEnabled(m_currentRunControl);
+ m_toolBox->setEnabled(!m_isRunning);
+ m_stopAction->setEnabled(m_isRunning);
+ foreach (QAction *action, m_actions)
+ action->setEnabled(!m_isRunning);
}
////////////////////////////////////////////////////////////////////
@@ -822,85 +778,57 @@ void AnalyzerManager::extensionsInitialized()
if (d->m_tools.isEmpty())
return;
- const QSettings *settings = Core::ICore::instance()->settings();
- const QString lastActiveToolId =
- settings->value(QLatin1String(lastActiveToolC), QString()).toString();
- int lastAction = 0;
-
- foreach (IAnalyzerTool *tool, d->m_tools) {
+ foreach (IAnalyzerTool *tool, d->m_tools)
tool->extensionsInitialized();
- if (tool->id() == lastActiveToolId)
- lastAction = d->indexOf(tool);
- }
-
- d->selectAction(lastAction);
}
void AnalyzerManager::shutdown()
{
- d->saveToolSettings(d->m_actions[d->m_currentIndex].tool);
+ d->saveToolSettings(d->m_currentTool, d->m_currentMode);
}
-AnalyzerManager *AnalyzerManager::instance()
+void AnalyzerManager::addTool(IAnalyzerTool *tool, const StartModes &modes)
{
- return m_instance;
-}
-
-void AnalyzerManager::registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory)
-{
- d->registerRunControlFactory(factory);
-}
-
-void AnalyzerManager::addTool(IAnalyzerTool *tool)
-{
- d->addTool(tool);
+ m_instance->d->addTool(tool, modes);
}
QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title,
QWidget *widget, Qt::DockWidgetArea area)
{
- QTC_ASSERT(!widget->objectName().isEmpty(), return 0;);
-
+ QTC_ASSERT(!widget->objectName().isEmpty(), return 0);
+ AnalyzerManagerPrivate *d = m_instance->d;
QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget);
dockWidget->setProperty(INITIAL_DOCK_AREA, int(area));
d->m_dockWidgets.append(AnalyzerManagerPrivate::DockPtr(dockWidget));
dockWidget->setWindowTitle(title);
d->m_toolWidgets[tool].push_back(dockWidget);
- d->addDock(area, dockWidget);
return dockWidget;
}
-IAnalyzerEngine *AnalyzerManager::createEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
+void AnalyzerManager::selectTool(IAnalyzerTool *tool, StartMode mode)
{
- IAnalyzerTool *tool = d->toolAt(d->m_currentIndex);
- QTC_ASSERT(tool, return 0);
- return tool->createEngine(sp, runConfiguration);
+ m_instance->d->selectTool(tool, mode);
}
-void AnalyzerManager::selectTool(IAnalyzerTool *tool)
+void AnalyzerManager::startTool(IAnalyzerTool *tool, StartMode mode)
{
- d->selectAction(d->indexOf(tool));
+ QTC_ASSERT(tool == m_instance->d->m_currentTool, return);
+ tool->startTool(mode);
}
-void AnalyzerManager::startTool(IAnalyzerTool *tool)
+Utils::FancyMainWindow *AnalyzerManager::mainWindow()
{
- d->startAction(d->indexOf(tool));
+ return m_instance->d->m_mainWindow;
}
-Utils::FancyMainWindow *AnalyzerManager::mainWindow() const
+void AnalyzerManagerPrivate::resetLayout()
{
- return d->m_mainWindow;
-}
-
-void AnalyzerManager::AnalyzerManagerPrivate::resetLayout()
-{
- m_mainWindow->restoreSettings(m_defaultSettings.value(toolAt(m_currentIndex)));
+ m_mainWindow->restoreSettings(m_defaultSettings.value(m_currentTool));
}
void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS)
{
- d->m_statusLabel->showStatusMessage(message, timeoutMS);
+ m_instance->d->m_statusLabel->showStatusMessage(message, timeoutMS);
}
void AnalyzerManager::showPermanentStatusMessage(const QString &message)
@@ -922,13 +850,44 @@ QString AnalyzerManager::msgToolFinished(const QString &name, int issuesFound)
void AnalyzerManager::showMode()
{
- if (d->m_mode)
- ModeManager::instance()->activateMode(d->m_mode->id());
+ if (m_instance->d->m_mode)
+ ModeManager::instance()->activateMode(m_instance->d->m_mode->id());
}
void AnalyzerManager::stopTool()
{
- d->stopTool();
+ stopAction()->trigger();
}
+void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode)
+{
+ m_instance->d->startLocalTool(tool, mode);
+}
+
+QAction *AnalyzerManager::stopAction()
+{
+ return m_instance->d->m_stopAction;
+}
+
+void AnalyzerManager::handleToolStarted()
+{
+ m_instance->d->handleToolStarted();
+}
+
+void AnalyzerManager::handleToolFinished()
+{
+ m_instance->d->handleToolFinished();
+}
+
+IAnalyzerTool *AnalyzerManager::toolFromId(const QByteArray &id)
+{
+ foreach (IAnalyzerTool *tool, m_instance->d->m_tools)
+ if (id.startsWith(tool->id()))
+ return tool;
+ QTC_ASSERT(false, qDebug() << "NO ANAYLYZER TOOL FOUND FOR ID" << id);
+ return 0;
+}
+
+} // namespace Analyzer
+
#include "analyzermanager.moc"
diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h
index a46ce59cb1..42700cac90 100644
--- a/src/plugins/analyzerbase/analyzermanager.h
+++ b/src/plugins/analyzerbase/analyzermanager.h
@@ -36,6 +36,7 @@
#define ANALYZERMANAGER_H
#include "analyzerbase_global.h"
+#include "analyzerconstants.h"
#include "projectexplorer/runconfiguration.h"
#include <QtCore/QObject>
@@ -48,14 +49,12 @@ namespace Utils {
class FancyMainWindow;
}
-namespace ProjectExplorer {
-class RunConfiguration;
-}
-
namespace Analyzer {
+
+typedef QList<StartMode> StartModes;
+
class IAnalyzerTool;
-class IAnalyzerEngine;
-class AnalyzerStartParameters;
+class AnalyzerManagerPrivate;
class ANALYZER_EXPORT AnalyzerManager : public QObject
{
@@ -65,40 +64,39 @@ public:
explicit AnalyzerManager(QObject *parent = 0);
~AnalyzerManager();
- static AnalyzerManager *instance();
- void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
-
void extensionsInitialized();
void shutdown();
- /**
- * Register a tool and initialize it.
- */
- void addTool(Analyzer::IAnalyzerTool *tool);
+ // Register a tool and initialize it.
+ static void addTool(IAnalyzerTool *tool, const StartModes &mode);
+ static IAnalyzerTool *toolFromId(const QByteArray &id);
+ static StartMode modeFromId(const QByteArray &id);
// Dockwidgets are registered to the main window.
- QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
+ static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
QWidget *widget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
- Utils::FancyMainWindow *mainWindow() const;
+ static Utils::FancyMainWindow *mainWindow();
+
+ static void showMode();
+ static void selectTool(IAnalyzerTool *tool, StartMode mode);
+ static void startTool(IAnalyzerTool *tool, StartMode mode);
+ static void stopTool();
- void showMode();
- void selectTool(IAnalyzerTool *tool);
- void startTool(IAnalyzerTool *tool);
- void stopTool();
+ // Convenience functions.
+ static void startLocalTool(IAnalyzerTool *tool, StartMode mode);
static QString msgToolStarted(const QString &name);
static QString msgToolFinished(const QString &name, int issuesFound);
- IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
+ static void showStatusMessage(const QString &message, int timeoutMS = 10000);
+ static void showPermanentStatusMessage(const QString &message);
-public slots:
- void showStatusMessage(const QString &message, int timeoutMS = 10000);
- void showPermanentStatusMessage(const QString &message);
+ static void handleToolStarted();
+ static void handleToolFinished();
+ static QAction *stopAction();
private:
- class AnalyzerManagerPrivate;
friend class AnalyzerManagerPrivate;
AnalyzerManagerPrivate *const d;
};
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.cpp b/src/plugins/analyzerbase/analyzerruncontrol.cpp
index 920c62ef10..889b2a911b 100644
--- a/src/plugins/analyzerbase/analyzerruncontrol.cpp
+++ b/src/plugins/analyzerbase/analyzerruncontrol.cpp
@@ -48,9 +48,15 @@
#include <QtCore/QDebug>
-using namespace Analyzer;
+using namespace ProjectExplorer;
-// AnalyzerRunControl::Private ///////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//
+// AnalyzerRunControl::Private
+//
+//////////////////////////////////////////////////////////////////////////
+
+namespace Analyzer {
class AnalyzerRunControl::Private
{
@@ -66,13 +72,18 @@ AnalyzerRunControl::Private::Private()
{}
-// AnalyzerRunControl ////////////////////////////////////////////////////
-AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
- RunConfiguration *runConfiguration)
- : RunControl(runConfiguration, Constants::MODE_ANALYZE),
+//////////////////////////////////////////////////////////////////////////
+//
+// AnalyzerRunControl
+//
+//////////////////////////////////////////////////////////////////////////
+
+AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
+ const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
+ : RunControl(runConfiguration, tool->id()),
d(new Private)
{
- d->m_engine = AnalyzerManager::instance()->createEngine(sp, runConfiguration);
+ d->m_engine = tool->createEngine(sp, runConfiguration);
if (!d->m_engine)
return;
@@ -83,6 +94,7 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
connect(d->m_engine, SIGNAL(finished()),
SLOT(engineFinished()));
+ connect(this, SIGNAL(finished()), SLOT(runControlFinished()), Qt::QueuedConnection);
}
AnalyzerRunControl::~AnalyzerRunControl()
@@ -92,6 +104,7 @@ AnalyzerRunControl::~AnalyzerRunControl()
delete d->m_engine;
d->m_engine = 0;
+ delete d;
}
void AnalyzerRunControl::start()
@@ -103,7 +116,7 @@ void AnalyzerRunControl::start()
// clear about-to-be-outdated tasks
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
+ TaskHub *hub = pm->getObject<TaskHub>();
hub->clearTasks(Constants::ANALYZERTASK_ID);
d->m_isRunning = true;
@@ -111,7 +124,7 @@ void AnalyzerRunControl::start()
d->m_engine->start();
}
-ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop()
+RunControl::StopResult AnalyzerRunControl::stop()
{
if (!d->m_engine || !d->m_isRunning)
return StoppedSynchronously;
@@ -121,12 +134,23 @@ ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop()
return AsynchronousStop;
}
+void AnalyzerRunControl::stopIt()
+{
+ if (stop() == RunControl::StoppedSynchronously)
+ AnalyzerManager::handleToolFinished();
+}
+
void AnalyzerRunControl::engineFinished()
{
d->m_isRunning = false;
emit finished();
}
+void AnalyzerRunControl::runControlFinished()
+{
+ AnalyzerManager::handleToolFinished();
+}
+
bool AnalyzerRunControl::isRunning() const
{
return d->m_isRunning;
@@ -149,12 +173,12 @@ void AnalyzerRunControl::receiveOutput(const QString &text, Utils::OutputFormat
appendMessage(text, format);
}
-void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,
+void AnalyzerRunControl::addTask(Task::TaskType type, const QString &description,
const QString &file, int line)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
- hub->addTask(ProjectExplorer::Task(type, description, file, line, Constants::ANALYZERTASK_ID));
+ TaskHub *hub = pm->getObject<TaskHub>();
+ hub->addTask(Task(type, description, file, line, Constants::ANALYZERTASK_ID));
///FIXME: get a better API for this into Qt Creator
QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>();
@@ -165,3 +189,5 @@ void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QSt
}
}
}
+
+} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/analyzerruncontrol.h b/src/plugins/analyzerbase/analyzerruncontrol.h
index 59a2a2e720..ff320a4e2b 100644
--- a/src/plugins/analyzerbase/analyzerruncontrol.h
+++ b/src/plugins/analyzerbase/analyzerruncontrol.h
@@ -45,18 +45,18 @@
namespace Analyzer {
class AnalyzerStartParameters;
+class IAnalyzerTool;
-class ANALYZER_EXPORT AnalyzerRunControl: public ProjectExplorer::RunControl
+class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
{
Q_OBJECT
public:
- typedef ProjectExplorer::RunConfiguration RunConfiguration;
- // the constructor is likely to gain more arguments later
- explicit AnalyzerRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration);
+ AnalyzerRunControl(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration);
~AnalyzerRunControl();
- // pure virtuals from ProjectExplorer::RunControl
+ // ProjectExplorer::RunControl
void start();
StopResult stop();
bool isRunning() const;
@@ -64,16 +64,18 @@ public:
QIcon icon() const;
private slots:
+ void stopIt();
void receiveOutput(const QString &, Utils::OutputFormat format);
void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
const QString &file, int line);
void engineFinished();
+ void runControlFinished();
private:
class Private;
- QScopedPointer<Private> d;
+ Private *d;
};
} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
deleted file mode 100644
index 3e7efb81e8..0000000000
--- a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "analyzerruncontrolfactory.h"
-#include "analyzerruncontrol.h"
-#include "analyzerconstants.h"
-#include "analyzerrunconfigwidget.h"
-#include "analyzersettings.h"
-#include "analyzerstartparameters.h"
-
-#include <utils/qtcassert.h>
-
-#include <projectexplorer/applicationrunconfiguration.h>
-
-#include <remotelinux/linuxdeviceconfiguration.h>
-#include <remotelinux/remotelinuxrunconfiguration.h>
-
-#include <QtCore/QDebug>
-
-using namespace Analyzer;
-using namespace Analyzer::Internal;
-
-AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
-{
- AnalyzerStartParameters sp;
- QTC_ASSERT(runConfiguration, return sp);
- ProjectExplorer::LocalApplicationRunConfiguration *rc =
- qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
- QTC_ASSERT(rc, return sp);
-
- sp.startMode = StartLocal;
- sp.environment = rc->environment();
- sp.workingDirectory = rc->workingDirectory();
- sp.debuggee = rc->executable();
- sp.debuggeeArgs = rc->commandLineArguments();
- sp.displayName = rc->displayName();
- sp.connParams.host = QLatin1String("localhost");
- sp.connParams.port = rc->qmlDebugServerPort();
- return sp;
-}
-
-AnalyzerStartParameters remoteLinuxStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
-{
- AnalyzerStartParameters sp;
- RemoteLinux::RemoteLinuxRunConfiguration * const rc
- = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
- QTC_ASSERT(rc, return sp);
-
- sp.debuggee = rc->remoteExecutableFilePath();
- sp.debuggeeArgs = rc->arguments();
- sp.connParams = rc->deviceConfig()->sshParameters();
- sp.analyzerCmdPrefix = rc->commandPrefix();
- sp.startMode = StartRemote;
- sp.displayName = rc->displayName();
- return sp;
-}
-
-
-// AnalyzerRunControlFactory ////////////////////////////////////////////////////
-AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
- : IRunControlFactory(parent)
-{
-}
-
-bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
-{
- return runConfiguration->isEnabled() && mode == Constants::MODE_ANALYZE;
-}
-
-ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
- const QString &mode)
-{
- QTC_ASSERT(canRun(runConfiguration, mode), return 0);
-
- AnalyzerStartParameters sp;
- if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
- sp = localStartParameters(runConfiguration);
- } else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
- sp = remoteLinuxStartParameters(runConfiguration);
- } else {
- // might be S60DeviceRunfiguration, or something else ...
- sp.startMode = StartRemote;
- }
-
- return create(sp, runConfiguration);
-}
-
-AnalyzerRunControl *AnalyzerRunControlFactory::create(const AnalyzerStartParameters &sp,
- RunConfiguration *runConfiguration)
-{
- AnalyzerRunControl *rc = new AnalyzerRunControl(sp, runConfiguration);
- emit runControlCreated(rc);
- return rc;
-}
-
-QString AnalyzerRunControlFactory::displayName() const
-{
- return tr("Analyzer");
-}
-
-ProjectExplorer::IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect()
-{
- return new AnalyzerProjectSettings;
-}
-
-ProjectExplorer::RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration
- *runConfiguration)
-{
- ProjectExplorer::LocalApplicationRunConfiguration *localRc =
- qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration);
- if (!localRc)
- return 0;
- AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
- if (!settings)
- return 0;
-
- AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
- ret->setRunConfiguration(runConfiguration);
- return ret;
-}
diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp
index fa00ab55d0..89fa68b1c2 100644
--- a/src/plugins/analyzerbase/analyzersettings.cpp
+++ b/src/plugins/analyzerbase/analyzersettings.cpp
@@ -40,7 +40,6 @@
#include "analyzeroptionspage.h"
#include <coreplugin/icore.h>
-#include <valgrind/xmlprotocol/error.h>
#include <utils/qtcassert.h>
#include <QtCore/QSettings>
diff --git a/src/plugins/analyzerbase/analyzerstartparameters.h b/src/plugins/analyzerbase/analyzerstartparameters.h
index a867108c42..5265e7099f 100644
--- a/src/plugins/analyzerbase/analyzerstartparameters.h
+++ b/src/plugins/analyzerbase/analyzerstartparameters.h
@@ -50,19 +50,16 @@ class ANALYZER_EXPORT AnalyzerStartParameters
{
public:
AnalyzerStartParameters()
- : startMode(StartLocal)
- , connParams(Utils::SshConnectionParameters::NoProxy)
- { }
+ : connParams(Utils::SshConnectionParameters::NoProxy)
+ {}
- AnalyzerStartMode startMode;
+ StartMode startMode;
Utils::SshConnectionParameters connParams;
+ QByteArray toolId;
QString debuggee;
QString debuggeeArgs;
QString analyzerCmdPrefix;
- QString remoteMountPoint;
- QString localMountDir;
- QString remoteSourcesDir;
QString displayName;
Utils::Environment environment;
QString workingDirectory;
diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp
index 532a3c559f..83107e8312 100644
--- a/src/plugins/analyzerbase/analyzerutils.cpp
+++ b/src/plugins/analyzerbase/analyzerutils.cpp
@@ -116,10 +116,3 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate.
return lookupItem.declaration();
}
-
-QWidget *AnalyzerUtils::createDummyWidget()
-{
- QWidget *widget = new QWidget;
- widget->setProperty(Constants::ANALYZER_DUMMYWIDGET_ID, QVariant(true));
- return widget;
-}
diff --git a/src/plugins/analyzerbase/analyzerutils.h b/src/plugins/analyzerbase/analyzerutils.h
index cece97438f..61f6b8a98d 100644
--- a/src/plugins/analyzerbase/analyzerutils.h
+++ b/src/plugins/analyzerbase/analyzerutils.h
@@ -46,8 +46,6 @@ class Symbol;
namespace AnalyzerUtils
{
ANALYZER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor();
-
- ANALYZER_EXPORT QWidget *createDummyWidget();
}
#endif // ANALYZERUTILS_H
diff --git a/src/plugins/analyzerbase/ianalyzerengine.cpp b/src/plugins/analyzerbase/ianalyzerengine.cpp
index 1da091d93c..91da9d098f 100644
--- a/src/plugins/analyzerbase/ianalyzerengine.cpp
+++ b/src/plugins/analyzerbase/ianalyzerengine.cpp
@@ -36,21 +36,19 @@
namespace Analyzer {
-IAnalyzerEngine::IAnalyzerEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : m_runConfig(runConfiguration)
- , m_sp(sp)
+IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
{
+ m_runConfig = runConfiguration;
+ m_sp = sp;
+ m_tool = tool;
}
-ProjectExplorer::RunConfiguration *IAnalyzerEngine::runConfiguration() const
+IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool,
+ ProjectExplorer::RunConfiguration *runConfiguration)
{
- return m_runConfig;
-}
-
-AnalyzerStartParameters IAnalyzerEngine::startParameters() const
-{
- return m_sp;
+ m_runConfig = runConfiguration;
+ m_tool = tool;
}
} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/ianalyzerengine.h b/src/plugins/analyzerbase/ianalyzerengine.h
index d8a9bd8895..29c2d0f0b8 100644
--- a/src/plugins/analyzerbase/ianalyzerengine.h
+++ b/src/plugins/analyzerbase/ianalyzerengine.h
@@ -51,6 +51,8 @@ class RunConfiguration;
namespace Analyzer {
+class IAnalyzerTool;
+
/**
* An IAnalyzerEngine instance handles the launch of an analyzation tool.
*
@@ -61,40 +63,47 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject
Q_OBJECT
public:
- explicit IAnalyzerEngine(const AnalyzerStartParameters &sp,
+ IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
+ IAnalyzerEngine(IAnalyzerTool *tool,
+ ProjectExplorer::RunConfiguration *runConfiguration);
- /// start analyzation process
+ /// Start analyzation process.
virtual void start() = 0;
- /// trigger async stop of the analyzation process
+ /// Trigger async stop of the analyzation process.
virtual void stop() = 0;
- /// controller actions
+ /// Controller actions.
virtual bool canPause() const { return false; }
virtual void pause() {}
virtual void unpause() {}
- /// the active run configuration for this engine, might be zero
- ProjectExplorer::RunConfiguration *runConfiguration() const;
+ /// The active run configuration for this engine, might be zero.
+ ProjectExplorer::RunConfiguration *runConfiguration() const { return m_runConfig; }
+
+ /// The start parameters for this engine.
+ const AnalyzerStartParameters &startParameters() const { return m_sp; }
- /// the start parameters for this engine
- AnalyzerStartParameters startParameters() const;
+ /// The tool this engine is associated with.
+ IAnalyzerTool *tool() const { return m_tool; }
+ StartMode mode() const { return m_sp.startMode; }
signals:
- /// should be emitted when the debuggee outputted something
+ /// Should be emitted when the debuggee outputted something.
void outputReceived(const QString &, Utils::OutputFormat format);
- /// can be emitted when you want to show a task, e.g. to display an error
+ /// Can be emitted when you want to show a task, e.g. to display an error.
void taskToBeAdded(ProjectExplorer::Task::TaskType type, const QString &description,
const QString &file, int line);
- /// must be emitted when the engine finished
+ /// Must be emitted when the engine finished.
void finished();
- /// must be emitted when the engine is starting
+ /// Must be emitted when the engine is starting.
void starting(const Analyzer::IAnalyzerEngine *);
private:
ProjectExplorer::RunConfiguration *m_runConfig;
AnalyzerStartParameters m_sp;
+ IAnalyzerTool *m_tool;
};
} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp
index 600d18f844..f0dce04541 100644
--- a/src/plugins/analyzerbase/ianalyzertool.cpp
+++ b/src/plugins/analyzerbase/ianalyzertool.cpp
@@ -33,6 +33,7 @@
**************************************************************************/
#include "ianalyzertool.h"
+#include "analyzermanager.h"
namespace Analyzer {
@@ -40,26 +41,27 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent)
: QObject(parent)
{}
-QString IAnalyzerTool::modeString(ToolMode mode)
+QByteArray IAnalyzerTool::defaultMenuGroup(StartMode mode)
{
- switch (mode) {
- case IAnalyzerTool::DebugMode:
- return tr("Debug");
- case IAnalyzerTool::ReleaseMode:
- return tr("Release");
- case IAnalyzerTool::AnyMode:
- break;
- }
- return QString();
+ if (mode == StartRemote)
+ return Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS;
+ return Analyzer::Constants::G_ANALYZER_TOOLS;
}
-void IAnalyzerTool::initializeDockWidgets()
+QByteArray IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
{
+ QByteArray id = tool->id();
+ if (mode == StartRemote)
+ return "Action." + id + ".RemoteStart." + QByteArray::number(mode);
+ return "Action." + id + ".LocalStart." + QByteArray::number(mode);
}
-QWidget *IAnalyzerTool::createControlWidget()
+QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mode)
{
- return 0;
+ QString base = tool->displayName();
+ if (mode == StartRemote)
+ return base + tr(" (Remote)");
+ return base;
}
} // namespace Analyzer
diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h
index 0e77b82199..8b7e489ad8 100644
--- a/src/plugins/analyzerbase/ianalyzertool.h
+++ b/src/plugins/analyzerbase/ianalyzertool.h
@@ -36,6 +36,7 @@
#define IANALYZERTOOL_H
#include "analyzerbase_global.h"
+#include "analyzerconstants.h"
#include <QtCore/QObject>
@@ -49,8 +50,12 @@ class AnalyzerStartParameters;
class IAnalyzerOutputPaneAdapter;
class IAnalyzerEngine;
+
/**
* This class represents an analyzation tool, e.g. "Valgrind Memcheck".
+ *
+ * Each tool can run in different run modes. The modes are specific to the mode.
+ *
* @code
* bool YourPlugin::initialize(const QStringList &arguments, QString *errorString)
* {
@@ -67,16 +72,25 @@ public:
explicit IAnalyzerTool(QObject *parent = 0);
/// Returns a unique ID for this tool.
- virtual QString id() const = 0;
+ virtual QByteArray id() const = 0;
/// Returns a short user readable display name for this tool.
virtual QString displayName() const = 0;
/// Returns a user readable description name for this tool.
virtual QString description() const = 0;
+ /// Returns an id for the start action.
+ virtual QByteArray actionId(StartMode mode) const
+ { return defaultActionId(this, mode); }
+ /// Returns the menu group the start action should go to.
+ virtual QByteArray menuGroup(StartMode mode) const
+ { return defaultMenuGroup(mode); }
+ /// Returns a short user readable action name for this tool.
+ virtual QString actionName(StartMode mode) const
+ { return defaultActionName(this, mode); }
/**
* The mode in which this tool should preferably be run
*
- * The memcheckt tool, for example, requires debug symbols, hence DebugMode
+ * The memcheck tool, for example, requires debug symbols, hence DebugMode
* is preferred. On the other hand, callgrind should look at optimized code,
* hence ReleaseMode.
*/
@@ -85,38 +99,27 @@ public:
ReleaseMode,
AnyMode
};
- virtual ToolMode mode() const = 0;
+ virtual ToolMode toolMode() const = 0;
- static QString modeString(ToolMode mode);
+ /// Convenience implementation.
+ static QByteArray defaultMenuGroup(StartMode mode);
+ static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode);
+ static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode);
- /**
- * The implementation should setup widgets for the output pane here and
- * optionally add dock widgets in the analyzation mode if wanted.
- */
- virtual void initialize() = 0;
/// This gets called after all analyzation tools where initialized.
virtual void extensionsInitialized() = 0;
- /**
- * This is called to add all dock widgets if tool becomes active first time.
- * \sa AnalzyerManager::createDockWidget
- */
- virtual void initializeDockWidgets();
-
- /// Returns a control widget which will be shown
- /// in the output pane when this tool is selected.
- virtual QWidget *createControlWidget();
+ /// Creates all widgets used by the tool.
+ /// Returns a control widget which will be shown in the status bar when
+ /// this tool is selected. Must be non-zero.
+ virtual QWidget *createWidgets() = 0;
/// Returns a new engine for the given start parameters.
/// Called each time the tool is launched.
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
- /// Returns true when this tool can be run on the loca machine.
- virtual bool canRunLocally() const = 0;
-
- /// Returns true when this tool can be run on a remote machine.
- virtual bool canRunRemotely() const = 0;
+ virtual void startTool(StartMode mode) = 0;
/// Called when tools gets selected.
virtual void toolSelected() const {}
diff --git a/src/plugins/analyzerbase/startremotedialog.cpp b/src/plugins/analyzerbase/startremotedialog.cpp
index cfb2859576..2fdec91bea 100644
--- a/src/plugins/analyzerbase/startremotedialog.cpp
+++ b/src/plugins/analyzerbase/startremotedialog.cpp
@@ -40,8 +40,8 @@
namespace Analyzer {
-StartRemoteDialog::StartRemoteDialog(QWidget *parent, Qt::WindowFlags f)
- : QDialog(parent, f)
+StartRemoteDialog::StartRemoteDialog(QWidget *parent)
+ : QDialog(parent)
, m_ui(new Ui::StartRemoteDialog)
{
m_ui->setupUi(this);
diff --git a/src/plugins/analyzerbase/startremotedialog.h b/src/plugins/analyzerbase/startremotedialog.h
index 24f32b775f..258d45554f 100644
--- a/src/plugins/analyzerbase/startremotedialog.h
+++ b/src/plugins/analyzerbase/startremotedialog.h
@@ -33,12 +33,11 @@
#ifndef STARTREMOTEDIALOG_H
#define STARTREMOTEDIALOG_H
-#include <QtGui/QDialog>
+#include "analyzerbase_global.h"
#include <utils/ssh/sshconnection.h>
-QT_BEGIN_NAMESPACE
-QT_END_NAMESPACE
+#include <QtGui/QDialog>
namespace Analyzer {
@@ -46,11 +45,12 @@ namespace Ui {
class StartRemoteDialog;
}
-class StartRemoteDialog : public QDialog {
+class ANALYZER_EXPORT StartRemoteDialog : public QDialog
+{
Q_OBJECT
public:
- explicit StartRemoteDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
+ explicit StartRemoteDialog(QWidget *parent = 0);
virtual ~StartRemoteDialog();
Utils::SshConnectionParameters sshParams() const;
@@ -66,6 +66,6 @@ private:
Ui::StartRemoteDialog *m_ui;
};
-}
+} // namespace Analyzer
#endif // STARTREMOTEDIALOG_H
diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui
index 82398e3e19..960d05b098 100644
--- a/src/plugins/coreplugin/generalsettings.ui
+++ b/src/plugins/coreplugin/generalsettings.ui
@@ -78,7 +78,7 @@
<item>
<widget class="QPushButton" name="resetButton">
<property name="toolTip">
- <string>Reset to default.</string>
+ <string comment="Color">Reset to default.</string>
</property>
<property name="text">
<string>Reset</string>
@@ -196,7 +196,7 @@
<item row="0" column="2">
<widget class="QPushButton" name="resetTerminalButton">
<property name="toolTip">
- <string>Reset to default.</string>
+ <string comment="Terminal">Reset to default.</string>
</property>
<property name="text">
<string>Reset</string>
@@ -206,7 +206,7 @@
<item row="1" column="2">
<widget class="QPushButton" name="resetFileBrowserButton">
<property name="toolTip">
- <string>Reset to default.</string>
+ <string comment="File Browser">Reset to default.</string>
</property>
<property name="text">
<string>Reset</string>
diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp
index 29d15a02fe..bf107416bf 100644
--- a/src/plugins/coreplugin/infobar.cpp
+++ b/src/plugins/coreplugin/infobar.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h
index af8e12395b..0d8e63249a 100644
--- a/src/plugins/coreplugin/infobar.h
+++ b/src/plugins/coreplugin/infobar.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/coreplugin/multifeedrssmodel.cpp b/src/plugins/coreplugin/multifeedrssmodel.cpp
index 66fe94822c..64b3ad2eeb 100644
--- a/src/plugins/coreplugin/multifeedrssmodel.cpp
+++ b/src/plugins/coreplugin/multifeedrssmodel.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "multifeedrssmodel.h"
#include <QtCore/QTimer>
diff --git a/src/plugins/coreplugin/multifeedrssmodel.h b/src/plugins/coreplugin/multifeedrssmodel.h
index 1d0d0363a8..a6a125565b 100644
--- a/src/plugins/coreplugin/multifeedrssmodel.h
+++ b/src/plugins/coreplugin/multifeedrssmodel.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef MULTIFEEDRSSMODEL_H
#define MULTIFEEDRSSMODEL_H
diff --git a/src/plugins/coreplugin/networkaccessmanager.cpp b/src/plugins/coreplugin/networkaccessmanager.cpp
index 8297e94e13..88dec43e00 100644
--- a/src/plugins/coreplugin/networkaccessmanager.cpp
+++ b/src/plugins/coreplugin/networkaccessmanager.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "networkaccessmanager.h"
#include <QtCore/QLocale>
diff --git a/src/plugins/coreplugin/networkaccessmanager.h b/src/plugins/coreplugin/networkaccessmanager.h
index cd4a8aa60e..a45ad3fa32 100644
--- a/src/plugins/coreplugin/networkaccessmanager.h
+++ b/src/plugins/coreplugin/networkaccessmanager.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "core_global.h"
#include <QtCore/QUrl>
diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp
index 782c5ed029..aee055b9bc 100644
--- a/src/plugins/coreplugin/outputpane.cpp
+++ b/src/plugins/coreplugin/outputpane.cpp
@@ -48,12 +48,12 @@ struct OutputPanePlaceHolderPrivate {
Core::IMode *m_mode;
QSplitter *m_splitter;
- bool m_closeable;
+ int m_lastNonMaxSize;
static OutputPanePlaceHolder* m_current;
};
OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(Core::IMode *mode, QSplitter *parent) :
- m_mode(mode), m_splitter(parent), m_closeable(true)
+ m_mode(mode), m_splitter(parent), m_lastNonMaxSize(0)
{
}
@@ -85,16 +85,6 @@ OutputPanePlaceHolder::~OutputPanePlaceHolder()
}
}
-void OutputPanePlaceHolder::setCloseable(bool b)
-{
- d->m_closeable = b;
-}
-
-bool OutputPanePlaceHolder::closeable()
-{
- return d->m_closeable;
-}
-
void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
{
if (d->m_current == this) {
@@ -110,7 +100,6 @@ void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode)
layout()->addWidget(om);
om->show();
om->updateStatusButtons(isVisible());
- om->setCloseable(d->m_closeable);
}
}
@@ -125,6 +114,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize)
QList<int> sizes = d->m_splitter->sizes();
if (maximize) {
+ d->m_lastNonMaxSize = sizes[idx];
int sum = 0;
foreach(int s, sizes)
sum += s;
@@ -133,7 +123,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize)
}
sizes[idx] = sum - (sizes.count()-1) * 32;
} else {
- int target = sizeHint().height();
+ int target = d->m_lastNonMaxSize > 0 ? d->m_lastNonMaxSize : sizeHint().height();
int space = sizes[idx] - target;
if (space > 0) {
for (int i = 0; i < sizes.count(); ++i) {
diff --git a/src/plugins/coreplugin/outputpane.h b/src/plugins/coreplugin/outputpane.h
index 69b7af71af..1de9343a5a 100644
--- a/src/plugins/coreplugin/outputpane.h
+++ b/src/plugins/coreplugin/outputpane.h
@@ -60,8 +60,6 @@ public:
explicit OutputPanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0);
~OutputPanePlaceHolder();
- void setCloseable(bool b);
- bool closeable();
static OutputPanePlaceHolder *getCurrent();
static bool isCurrentVisible();
diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp
index 561e6020dc..a7e1279166 100644
--- a/src/plugins/coreplugin/outputpanemanager.cpp
+++ b/src/plugins/coreplugin/outputpanemanager.cpp
@@ -349,8 +349,7 @@ void OutputPaneManager::buttonTriggered()
int idx = it.key();
if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx &&
- OutputPanePlaceHolder::isCurrentVisible()
- && OutputPanePlaceHolder::getCurrent()->closeable()) {
+ OutputPanePlaceHolder::isCurrentVisible()) {
// we should toggle and the page is already visible and we are actually closeable
slotHide();
} else {
@@ -464,16 +463,6 @@ void OutputPaneManager::togglePage(bool focus)
}
}
-void OutputPaneManager::setCloseable(bool b)
-{
- m_closeButton->setVisible(b);
-}
-
-bool OutputPaneManager::closeable()
-{
- return m_closeButton->isVisibleTo(m_closeButton->parentWidget());
-}
-
void OutputPaneManager::focusInEvent(QFocusEvent *e)
{
if (m_outputWidgetPane->currentWidget())
diff --git a/src/plugins/coreplugin/outputpanemanager.h b/src/plugins/coreplugin/outputpanemanager.h
index f71985d9cb..921e21dd12 100644
--- a/src/plugins/coreplugin/outputpanemanager.h
+++ b/src/plugins/coreplugin/outputpanemanager.h
@@ -62,8 +62,6 @@ class OutputPaneManager : public QWidget
public:
void init();
static OutputPaneManager *instance();
- void setCloseable(bool b);
- bool closeable();
QWidget *buttonsWidget();
void updateStatusButtons(bool visible);
diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp
index ec8e45f3d5..09528d0654 100644
--- a/src/plugins/coreplugin/variablechooser.cpp
+++ b/src/plugins/coreplugin/variablechooser.cpp
@@ -52,6 +52,7 @@ VariableChooser::VariableChooser(QWidget *parent) :
ui->variableList->setAttribute(Qt::WA_MacShowFocusRect, false);
ui->variableDescription->setAttribute(Qt::WA_MacSmallSize);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
+ setFocusPolicy(Qt::StrongFocus);
setFocusProxy(ui->variableList);
VariableManager *vm = VariableManager::instance();
@@ -155,6 +156,8 @@ void VariableChooser::updatePositionAndShow()
move(parentCenter.x() - width()/2, parentCenter.y() - height()/2);
}
show();
+ raise();
+ activateWindow();
}
void VariableChooser::handleItemActivated(QListWidgetItem *item)
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 4a355f6ffb..41e70725f7 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -1058,6 +1058,14 @@ int QtStyleCodeFormatter::loadLexerState(const QTextBlock &block) const
return BaseTextDocumentLayout::lexerState(block);
}
+void QtStyleCodeFormatter::addContinuationIndent(int *paddingDepth) const
+{
+ if (*paddingDepth == 0)
+ *paddingDepth = 2*m_tabSettings.m_indentSize;
+ else
+ *paddingDepth += m_tabSettings.m_indentSize;
+}
+
void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const
{
const State &parentState = state();
@@ -1094,12 +1102,8 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
case template_param:
if (!lastToken)
*paddingDepth = nextTokenPosition-*indentDepth;
- else {
- if (*paddingDepth == 0)
- *paddingDepth = 2*m_tabSettings.m_indentSize;
- else
- *paddingDepth += m_tabSettings.m_indentSize;
- }
+ else
+ addContinuationIndent(paddingDepth);
break;
case statement_with_condition:
@@ -1140,17 +1144,18 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
case arglist_open:
case condition_paren_open:
+ case member_init_paren_open:
if (!lastToken)
*paddingDepth = nextTokenPosition-*indentDepth;
else
- *paddingDepth += m_tabSettings.m_indentSize;
+ addContinuationIndent(paddingDepth);
break;
case ternary_op:
if (!lastToken)
*paddingDepth = spaceOrNextTokenPosition-*indentDepth;
else
- *paddingDepth += m_tabSettings.m_indentSize;
+ addContinuationIndent(paddingDepth);
break;
case stream_op:
@@ -1175,10 +1180,6 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
*paddingDepth += 2; // savedIndentDepth is the position of ':'
break;
- case member_init_paren_open:
- *paddingDepth += m_tabSettings.m_indentSize;
- break;
-
case case_cont:
if (m_styleSettings.indentStatementsRelativeToSwitchLabels)
*indentDepth += m_tabSettings.m_indentSize;
diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h
index 21f06135a8..dae19a2e24 100644
--- a/src/plugins/cpptools/cppcodeformatter.h
+++ b/src/plugins/cpptools/cppcodeformatter.h
@@ -278,6 +278,8 @@ protected:
static bool shouldClearPaddingOnEnter(int state);
private:
+ void addContinuationIndent(int *paddingDepth) const;
+
TextEditor::TabSettings m_tabSettings;
CppCodeStyleSettings m_styleSettings;
};
diff --git a/src/plugins/cpptools/cppcodestylepreferences.cpp b/src/plugins/cpptools/cppcodestylepreferences.cpp
index 981216c5b2..5e3e27a8aa 100644
--- a/src/plugins/cpptools/cppcodestylepreferences.cpp
+++ b/src/plugins/cpptools/cppcodestylepreferences.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "cppcodestylepreferences.h"
using namespace CppTools;
diff --git a/src/plugins/cpptools/cppcodestylepreferences.h b/src/plugins/cpptools/cppcodestylepreferences.h
index 991e15f017..022d623e5f 100644
--- a/src/plugins/cpptools/cppcodestylepreferences.h
+++ b/src/plugins/cpptools/cppcodestylepreferences.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CPPCODESTYLEPREFERENCES_H
#define CPPCODESTYLEPREFERENCES_H
diff --git a/src/plugins/cpptools/cppcodestylesettings.cpp b/src/plugins/cpptools/cppcodestylesettings.cpp
index 13a06e2633..40efe1254c 100644
--- a/src/plugins/cpptools/cppcodestylesettings.cpp
+++ b/src/plugins/cpptools/cppcodestylesettings.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "cppcodestylesettings.h"
#include <utils/settingsutils.h>
diff --git a/src/plugins/cpptools/cppcodestylesettings.h b/src/plugins/cpptools/cppcodestylesettings.h
index 320c99471f..ea934814b4 100644
--- a/src/plugins/cpptools/cppcodestylesettings.h
+++ b/src/plugins/cpptools/cppcodestylesettings.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CPPCODESTYLESETTINGS_H
#define CPPCODESTYLESETTINGS_H
diff --git a/src/plugins/cpptools/cppcodestylesettingsfactory.cpp b/src/plugins/cpptools/cppcodestylesettingsfactory.cpp
index b794ace895..dc2e3ab0b3 100644
--- a/src/plugins/cpptools/cppcodestylesettingsfactory.cpp
+++ b/src/plugins/cpptools/cppcodestylesettingsfactory.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "cppcodestylesettingsfactory.h"
#include "cppcodestylesettings.h"
#include "cppcodestylesettingspage.h"
diff --git a/src/plugins/cpptools/cppcodestylesettingsfactory.h b/src/plugins/cpptools/cppcodestylesettingsfactory.h
index 53681d6dd0..85c59d55ea 100644
--- a/src/plugins/cpptools/cppcodestylesettingsfactory.h
+++ b/src/plugins/cpptools/cppcodestylesettingsfactory.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CPPCODESTYLESETTINGSFACTORY_H
#define CPPCODESTYLESETTINGSFACTORY_H
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp
index 6bb2013efc..426d3da5d2 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.cpp
+++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "cppcodestylesettingspage.h"
#include "cppcodestylepreferences.h"
#include "ui_cppcodestylesettingspage.h"
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.h b/src/plugins/cpptools/cppcodestylesettingspage.h
index b632f1cccc..dce545eede 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.h
+++ b/src/plugins/cpptools/cppcodestylesettingspage.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CPPCODESTYLESETTINGSPAGE_H
#define CPPCODESTYLESETTINGSPAGE_H
diff --git a/src/plugins/cpptools/cpptoolssettings.cpp b/src/plugins/cpptools/cpptoolssettings.cpp
index c203b9e582..4160801161 100644
--- a/src/plugins/cpptools/cpptoolssettings.cpp
+++ b/src/plugins/cpptools/cpptoolssettings.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "cpptoolssettings.h"
#include "cpptoolsconstants.h"
#include "cppcodestylepreferences.h"
diff --git a/src/plugins/cpptools/cpptoolssettings.h b/src/plugins/cpptools/cpptoolssettings.h
index 48712012af..cc0004bd7d 100644
--- a/src/plugins/cpptools/cpptoolssettings.h
+++ b/src/plugins/cpptools/cpptoolssettings.h
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index c8285f3f42..4d1f9c5be7 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -36,6 +36,7 @@
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
+#include <QtCore/QFileInfo>
namespace Debugger {
namespace Internal {
@@ -51,6 +52,9 @@ namespace Internal {
This identifies a breakpoint in the \c BreakHandler. The
major parts are strictly increasing over time.
+
+ The minor part identifies a multiple breakpoint
+ set for example by gdb in constructors.
*/
@@ -105,6 +109,10 @@ BreakpointModelId BreakpointModelId::child(int row) const
This is what the external debuggers use to identify a breakpoint.
It is only valid for one debugger run.
+
+ In gdb, the breakpoint number is used, which is constant
+ during a session. CDB's breakpoint numbers vary if breakpoints
+ are deleted, so, the ID is used.
*/
BreakpointResponseId::BreakpointResponseId(const QByteArray &ba)
@@ -227,12 +235,17 @@ bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
return s1 == s2;
}
-void BreakpointParameters::setLocation(const QByteArray &location)
+void BreakpointParameters::updateLocation(const QByteArray &location)
{
if (location.size()) {
int pos = location.indexOf(':');
lineNumber = location.mid(pos + 1).toInt();
- fileName = QString::fromUtf8(location.left(pos));
+ QString file = QString::fromUtf8(location.left(pos));
+ if (file.startsWith(QLatin1Char('"')) && file.endsWith(QLatin1Char('"')))
+ file = file.mid(1, file.size() - 2);
+ QFileInfo fi(file);
+ if (fi.isReadable())
+ fileName = fi.absoluteFilePath();
}
}
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h
index 8283132036..7e1fbe5856 100644
--- a/src/plugins/debugger/breakpoint.h
+++ b/src/plugins/debugger/breakpoint.h
@@ -209,7 +209,7 @@ public:
bool isBreakpoint() const { return !isWatchpoint() && !isTracepoint(); }
bool isTracepoint() const { return tracepoint; }
QString toString() const;
- void setLocation(const QByteArray &location); // file.cpp:42
+ void updateLocation(const QByteArray &location); // file.cpp:42
bool operator==(const BreakpointParameters &p) const { return equals(p); }
bool operator!=(const BreakpointParameters &p) const { return !equals(p); }
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index a2ea611039..9d2d1e3026 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -478,6 +478,7 @@ void CdbEngine::init()
m_extensionMessageBuffer.clear();
m_pendingBreakpointMap.clear();
m_customSpecialStopData.clear();
+ m_symbolAddressCache.clear();
// Create local list of mappings in native separators
m_sourcePathMappings.clear();
@@ -1532,16 +1533,149 @@ void CdbEngine::selectThread(int index)
postBuiltinCommand(cmd, 0, &CdbEngine::dummyHandler, CommandListStack);
}
+// Default address range for showing disassembly.
+enum { DisassemblerRange = 512 };
+
+/* Try to emulate gdb's behaviour: When passed an address, display
+ * the disassembled function. CDB's 'u' (disassemble) command takes a symbol,
+ * but does not display the whole function, only 10 lines per default.
+ * So, to ensure the agent's
+ * address is in that range, resolve the function symbol, cache it and
+ * request the disassembly for a range that contains the agent's address. */
+
void CdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{
QTC_ASSERT(m_accessible, return;)
+ const QString function = agent->location().functionName();
+ const QString module = agent->location().from();
+ const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent);
+ if (function.isEmpty() || module.isEmpty()) {
+ // No function, display a default range.
+ postDisassemblerCommand(agent->address(), cookie);
+ } else {
+ postResolveSymbol(module, function, cookie);
+ }
+}
+
+void CdbEngine::postDisassemblerCommand(quint64 address, const QVariant &cookie)
+{
+ postDisassemblerCommand(address - DisassemblerRange / 2,
+ address + DisassemblerRange / 2, cookie);
+}
+
+void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress,
+ const QVariant &cookie)
+{
QByteArray cmd;
ByteArrayInputStream str(cmd);
- str << "u " << hex << hexPrefixOn << agent->address() << " L40";
- const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent);
+ str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress;
postBuiltinCommand(cmd, 0, &CdbEngine::handleDisassembler, 0, cookie);
}
+void CdbEngine::postResolveSymbol(const QString &module, const QString &function,
+ const QVariant &cookie)
+{
+ const QString symbol = module + QLatin1Char('!') + function;
+ const QList<quint64> addresses = m_symbolAddressCache.values(symbol);
+ if (addresses.isEmpty()) {
+ QVariantList cookieList;
+ cookieList << QVariant(symbol) << cookie;
+ showMessage(QLatin1String("Resolving symbol: ") + symbol, LogMisc);
+ postBuiltinCommand(QByteArray("x ") + symbol.toLatin1(), 0,
+ &CdbEngine::handleResolveSymbol, 0,
+ QVariant(cookieList));
+ } else {
+ showMessage(QString::fromLatin1("Using cached addresses for %1.").
+ arg(symbol), LogMisc);
+ handleResolveSymbol(addresses, cookie);
+ }
+}
+
+// Parse address from 'x' response.
+// "00000001`3f7ebe80 module!foo (void)"
+static inline quint64 resolvedAddress(const QByteArray &line)
+{
+ const int blankPos = line.indexOf(' ');
+ if (blankPos >= 0) {
+ QByteArray addressBA = line.left(blankPos);
+ if (addressBA.size() > 9 && addressBA.at(8) == '`')
+ addressBA.remove(8, 1);
+ bool ok;
+ const quint64 address = addressBA.toULongLong(&ok, 16);
+ if (ok)
+ return address;
+ }
+ return 0;
+}
+
+void CdbEngine::handleResolveSymbol(const CdbBuiltinCommandPtr &command)
+{
+ QTC_ASSERT(command->cookie.type() == QVariant::List, return; );
+ const QVariantList cookieList = command->cookie.toList();
+ const QString symbol = cookieList.front().toString();
+ // Insert all matches of (potentially) ambiguous symbols
+ if (const int size = command->reply.size()) {
+ for (int i = 0; i < size; i++) {
+ if (const quint64 address = resolvedAddress(command->reply.at(i))) {
+ m_symbolAddressCache.insert(symbol, address);
+ showMessage(QString::fromLatin1("Obtained 0x%1 for %2 (#%3)").
+ arg(address, 0, 16).arg(symbol).arg(i + 1), LogMisc);
+ }
+ }
+ } else {
+ showMessage(QLatin1String("Symbol resolution failed: ")
+ + QString::fromLatin1(command->joinedReply()),
+ LogError);
+ }
+ handleResolveSymbol(m_symbolAddressCache.values(symbol), cookieList.back());
+}
+
+// Find the function address matching needle in a list of function
+// addresses obtained from the 'x' command. Check for the
+// mimimum POSITIVE offset (needle >= function address.)
+static inline quint64 findClosestFunctionAddress(const QList<quint64> &addresses,
+ quint64 needle)
+{
+ const int size = addresses.size();
+ if (!size)
+ return 0;
+ if (size == 1)
+ return addresses.front();
+ int closestIndex = 0;
+ quint64 closestOffset = 0xFFFFFFFF;
+ for (int i = 0; i < size; i++) {
+ if (addresses.at(i) <= needle) {
+ const quint64 offset = needle - addresses.at(i);
+ if (offset < offset) {
+ closestOffset = offset;
+ closestIndex = i;
+ }
+ }
+ }
+ return addresses.at(closestIndex);
+}
+
+void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie)
+{
+ // Disassembly mode: Determine suitable range containing the
+ // agent's address within the function to display.
+ if (qVariantCanConvert<DisassemblerAgent*>(cookie)) {
+ DisassemblerAgent *agent = cookie.value<DisassemblerAgent *>();
+ const quint64 agentAddress = agent->address();
+ const quint64 functionAddress
+ = findClosestFunctionAddress(addresses, agentAddress);
+ if (functionAddress > 0 && functionAddress <= agentAddress) {
+ quint64 endAddress = agentAddress + DisassemblerRange / 2;
+ if (const quint64 remainder = endAddress % 8)
+ endAddress += 8 - remainder;
+ postDisassemblerCommand(functionAddress, endAddress, cookie);
+ } else {
+ postDisassemblerCommand(agentAddress, cookie);
+ }
+ return;
+ }
+}
+
// Parse: "00000000`77606060 cc int 3"
void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command)
{
@@ -2512,6 +2646,7 @@ void CdbEngine::attemptBreakpointSynchronization()
BreakpointParameters parameters = handler->breakpointData(id);
BreakpointResponse response;
response.fromParameters(parameters);
+ response.id = BreakpointResponseId(id.majorPart(), id.minorPart());
// If we encountered that file and have a module for it: Add it.
if (parameters.type == BreakpointByFileAndLine && parameters.module.isEmpty()) {
const QHash<QString, QString>::const_iterator it = m_fileNameModuleHash.constFind(parameters.fileName);
@@ -2833,14 +2968,14 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
BreakHandler *handler = breakHandler();
foreach (const GdbMi &breakPointG, value.children()) {
BreakpointResponse reportedResponse;
- const BreakpointResponseId id = parseBreakPoint(breakPointG, &reportedResponse);
+ parseBreakPoint(breakPointG, &reportedResponse);
if (debugBreakpoints)
- qDebug(" Parsed %d: pending=%d %s\n", id.majorPart(),
+ qDebug(" Parsed %d: pending=%d %s\n", reportedResponse.id.majorPart(),
reportedResponse.pending,
qPrintable(reportedResponse.toString()));
-
- if (!reportedResponse.pending) {
- BreakpointModelId mid = handler->findBreakpointByResponseId(id);
+ if (reportedResponse.id.isValid() && !reportedResponse.pending) {
+ const BreakpointModelId mid = handler->findBreakpointByResponseId(reportedResponse.id);
+ QTC_ASSERT(mid.isValid(), continue; )
const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid);
if (it != m_pendingBreakpointMap.end()) {
// Complete the response and set on handler.
@@ -2852,9 +2987,8 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
currentResponse.enabled = reportedResponse.enabled;
formatCdbBreakPointResponse(mid, currentResponse, str);
if (debugBreakpoints)
- qDebug(" Setting for %d: %s\n", id.majorPart(),
+ qDebug(" Setting for %d: %s\n", currentResponse.id.majorPart(),
qPrintable(currentResponse.toString()));
- BreakpointModelId mid = handler->findBreakpointByResponseId(id);
handler->setResponse(mid, currentResponse);
m_pendingBreakpointMap.erase(it);
}
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index ef97f1fc72..9c21dd4b0a 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -40,6 +40,7 @@
#include <QtCore/QProcess>
#include <QtCore/QVariantList>
#include <QtCore/QMap>
+#include <QtCore/QMultiHash>
#include <QtCore/QTime>
#include <QtCore/QPair>
#include <QtCore/QList>
@@ -211,8 +212,12 @@ private:
void postWidgetAtCommand();
void handleCustomSpecialStop(const QVariant &v);
void postFetchMemory(const MemoryViewCookie &c);
+ inline void postDisassemblerCommand(quint64 address, const QVariant &cookie = QVariant());
+ void postDisassemblerCommand(quint64 address, quint64 endAddress,
+ const QVariant &cookie = QVariant());
+ void postResolveSymbol(const QString &module, const QString &function,
+ const QVariant &cookie = QVariant());
void evaluateExpression(QByteArray exp, const QVariant &cookie = QVariant());
-
// Builtin commands
void dummyHandler(const CdbBuiltinCommandPtr &);
void handleStackTrace(const CdbExtensionCommandPtr &);
@@ -220,7 +225,10 @@ private:
void handleDisassembler(const CdbBuiltinCommandPtr &);
void handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &);
void handleExpression(const CdbExtensionCommandPtr &);
+ void handleResolveSymbol(const CdbBuiltinCommandPtr &command);
+ void handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie);
void jumpToAddress(quint64 address);
+
// Extension commands
void handleThreads(const CdbExtensionCommandPtr &);
void handlePid(const CdbExtensionCommandPtr &reply);
@@ -270,6 +278,7 @@ private:
int m_watchPointY;
PendingBreakPointMap m_pendingBreakpointMap;
QHash<QString, QString> m_fileNameModuleHash;
+ QMultiHash<QString, quint64> m_symbolAddressCache;
bool m_ignoreCdbOutput;
QVariantList m_customSpecialStopData;
QList<SourcePathMapping> m_sourcePathMappings;
diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
index 92cc42090b..bade3a09a9 100644
--- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp
+++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
@@ -298,21 +298,18 @@ static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName,
// Parse extension command listing breakpoints.
// Note that not all fields are returned, since file, line, function are encoded
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
-BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
- QString *expression /* = 0 */)
+void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
+ QString *expression /* = 0 */)
{
- BreakpointResponseId id = BreakpointResponseId(-1);
- int majorPart = 0;
- gdbmiChildToInt(gdbmi, "number", &majorPart);
gdbmiChildToBool(gdbmi, "enabled", &(r->enabled));
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
- r->id = BreakpointResponseId(majorPart);
+ r->id = BreakpointResponseId();
const GdbMi idG = gdbmi.findChild("id");
if (idG.isValid()) { // Might not be valid if there is not id
bool ok;
- const BreakpointResponseId cid(idG.data().toInt(&ok));
+ const int id = idG.data().toInt(&ok);
if (ok)
- id = cid;
+ r->id = BreakpointResponseId(id);
}
const GdbMi moduleG = gdbmi.findChild("module");
if (moduleG.isValid())
@@ -328,7 +325,6 @@ BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
r->ignoreCount--;
gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec));
- return id;
}
QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data)
diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.h b/src/plugins/debugger/cdb/cdbparsehelpers.h
index 66f453b1d6..15a281a878 100644
--- a/src/plugins/debugger/cdb/cdbparsehelpers.h
+++ b/src/plugins/debugger/cdb/cdbparsehelpers.h
@@ -69,7 +69,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &d,
// Parse extension command listing breakpoints.
// Note that not all fields are returned, since file, line, function are encoded
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
-BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0);
+void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0);
// Convert a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10'
QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros = false, int *basePtr = 0);
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 7ff518a5b3..14e71f2d2e 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -39,7 +39,7 @@ namespace Debugger {
namespace Constants {
// Debug mode
-const char * const MODE_DEBUG = "Debugger.Mode.Debug";
+const char * const MODE_DEBUG = "Mode.Debug";
// Contexts
const char * const C_DEBUGMODE = "Debugger.DebugMode";
@@ -48,7 +48,7 @@ const char * const C_QMLDEBUGGER = "Qml/JavaScript Debugger";
// Project Explorer run mode (RUN/DEBUG)
const char * const DEBUGMODE = "Debugger.DebugMode";
-const char * const DEBUGMODE2 = "Debugger.DebugMode2";
+const char * const DEBUGMODE2 = "Debugger.DebugMode2"; // Breaks on main.
// Common actions (accessed by QML inspector)
const char * const INTERRUPT = "Debugger.Interrupt";
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index a46841c2f1..904ced3355 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -97,6 +97,7 @@ Internal::Location::Location(const StackFrame &frame, bool marker)
m_functionName = frame.function;
m_hasDebugInfo = frame.isUsable();
m_address = frame.address;
+ m_from = frame.from;
}
QDebug operator<<(QDebug d, DebuggerState state)
@@ -1508,7 +1509,7 @@ QString DebuggerEngine::msgWatchpointByExpressionTriggered(BreakpointModelId id,
return id
? tr("Data breakpoint %1 (%2) at %3 in thread %4 triggered.")
.arg(id.toString()).arg(number).arg(expr).arg(threadId)
- : tr("Internal data breakpoint %1 at %2 in thread %4 triggered.")
+ : tr("Internal data breakpoint %1 at %2 in thread %3 triggered.")
.arg(number).arg(expr).arg(threadId);
}
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 8fc593c8e9..7fabfd253d 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -100,6 +100,7 @@ public:
Location(const StackFrame &frame, bool marker = true);
QString fileName() const { return m_fileName; }
QString functionName() const { return m_functionName; }
+ QString from() const { return m_from; }
int lineNumber() const { return m_lineNumber; }
void setNeedsRaise(bool on) { m_needsRaise = on; }
void setNeedsMarker(bool on) { m_needsMarker = on; }
@@ -118,6 +119,7 @@ private:
int m_lineNumber;
QString m_fileName;
QString m_functionName;
+ QString m_from;
quint64 m_address;
};
diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
index c26c690d34..645d4baeef 100644
--- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
+++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
@@ -361,7 +361,7 @@ void DebuggerSourcePathMappingWidget::slotAddQt()
if (qtSourcesPath.isEmpty())
return;
const size_t buildPathCount = sizeof(qtBuildPaths)/sizeof(qtBuildPaths[0]);
- for (size_t i = 0; i < buildPathCount; ++i)
+ for (size_t i = 0; i != buildPathCount; ++i) // use != to avoid 0<0 which triggers warning on Mac
m_model->addMapping(QString::fromLatin1(qtBuildPaths[i]), qtSourcesPath);
resizeColumns();
setCurrentRow(m_model->rowCount() - 1);
@@ -403,7 +403,7 @@ DebuggerSourcePathMappingWidget::SourcePathMap
if (qtInstallPath.isEmpty() || buildPathCount == 0)
return rc;
- for (size_t i = 0; i < buildPathCount; i++) {
+ for (size_t i = 0; i != buildPathCount; ++i) { // use != to avoid 0<0 which triggers warning on Mac
const QString buildPath = QString::fromLatin1(qtBuildPaths[i]);
if (!rc.contains(buildPath)) // Do not overwrite user settings.
rc.insert(buildPath, qtInstallPath);
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index ca63193ee7..80d58ad7f2 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -56,6 +56,8 @@
#include <QtGui/QTextBlock>
#include <QtGui/QIcon>
#include <QtCore/QPointer>
+#include <QtCore/QPair>
+#include <QtCore/QDir>
using namespace Core;
using namespace TextEditor;
@@ -69,6 +71,27 @@ namespace Internal {
//
///////////////////////////////////////////////////////////////////////
+class FrameKey
+{
+public:
+ FrameKey() : startAddress(0), endAddress(0) {}
+ inline bool matches(const Location &loc) const;
+
+ QString functionName;
+ QString fileName;
+ quint64 startAddress;
+ quint64 endAddress;
+};
+
+bool FrameKey::matches(const Location &loc) const
+{
+ return loc.address() >= startAddress
+ && loc.address() < endAddress
+ && loc.fileName() == fileName && loc.functionName() == functionName;
+}
+
+typedef QPair<FrameKey, DisassemblerLines> CacheEntry;
+
class DisassemblerAgentPrivate
{
public:
@@ -83,8 +106,9 @@ public:
QPointer<DebuggerEngine> engine;
ITextMark *locationMark;
QList<ITextMark *> breakpointMarks;
-
- QHash<QString, DisassemblerLines> cache;
+
+ QList<CacheEntry> cache;
+
QString mimeType;
bool m_resetLocationScheduled;
};
@@ -130,6 +154,14 @@ DisassemblerAgent::~DisassemblerAgent()
d = 0;
}
+int DisassemblerAgent::indexOf(const Location &loc) const
+{
+ for (int i = 0; i < d->cache.size(); i++)
+ if (d->cache.at(i).first.matches(loc))
+ return i;
+ return -1;
+}
+
void DisassemblerAgent::cleanup()
{
d->cache.clear();
@@ -150,12 +182,6 @@ void DisassemblerAgent::resetLocation()
}
}
-static QString frameKey(const Location &loc)
-{
- return _("%1:%2:%3").arg(loc.functionName())
- .arg(loc.fileName()).arg(loc.address());
-}
-
const Location &DisassemblerAgent::location() const
{
return d->location;
@@ -172,20 +198,28 @@ bool DisassemblerAgent::isMixed() const
void DisassemblerAgent::setLocation(const Location &loc)
{
d->location = loc;
- if (isMixed()) {
- QHash<QString, DisassemblerLines>::ConstIterator it =
- d->cache.find(frameKey(loc));
- if (it != d->cache.end()) {
- QString msg = _("Use cache disassembler for '%1' in '%2'")
- .arg(loc.functionName()).arg(loc.fileName());
- d->engine->showMessage(msg);
- setContents(*it);
- updateBreakpointMarkers();
- updateLocationMarker();
- return;
+ int index = indexOf(loc);
+ if (index != -1) {
+ // Refresh when not displaying a function and there is not sufficient
+ // context left past the address.
+ if (!isMixed() && d->cache.at(index).first.endAddress - loc.address() < 24) {
+ index = -1;
+ d->cache.removeAt(index);
}
}
- d->engine->fetchDisassembler(this);
+ if (index != -1) {
+ const FrameKey &key = d->cache.at(index).first;
+ const QString msg =
+ _("Using cached disassembly for 0x%1 (0x%2-0x%3) in '%4'/ '%5'")
+ .arg(loc.address(), 0, 16)
+ .arg(key.startAddress, 0, 16).arg(key.endAddress, 0, 16)
+ .arg(loc.functionName(), QDir::toNativeSeparators(loc.fileName()));
+ d->engine->showMessage(msg);
+ setContentsToEditor(d->cache.at(index).second);
+ d->m_resetLocationScheduled = false; // In case reset from previous run still pending.
+ } else {
+ d->engine->fetchDisassembler(this);
+ }
}
void DisassemblerAgentPrivate::configureMimeType()
@@ -225,6 +259,24 @@ void DisassemblerAgent::setMimeType(const QString &mt)
void DisassemblerAgent::setContents(const DisassemblerLines &contents)
{
QTC_ASSERT(d, return);
+ if (contents.size()) {
+ const quint64 startAddress = contents.startAddress();
+ const quint64 endAddress = contents.endAddress();
+ if (startAddress) {
+ FrameKey key;
+ key.fileName = d->location.fileName();
+ key.functionName = d->location.functionName();
+ key.startAddress = startAddress;
+ key.endAddress = endAddress;
+ d->cache.append(CacheEntry(key, contents));
+ }
+ }
+ setContentsToEditor(contents);
+}
+
+void DisassemblerAgent::setContentsToEditor(const DisassemblerLines &contents)
+{
+ QTC_ASSERT(d, return);
using namespace Core;
using namespace TextEditor;
@@ -260,7 +312,6 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents)
plainTextEdit->setPlainText(str);
plainTextEdit->setReadOnly(true);
- d->cache.insert(frameKey(d->location), contents);
d->editor->setDisplayName(_("Disassembler (%1)")
.arg(d->location.functionName()));
@@ -272,9 +323,10 @@ void DisassemblerAgent::updateLocationMarker()
{
QTC_ASSERT(d->editor, return);
- const DisassemblerLines &contents = d->cache.value(frameKey(d->location));
+ const int index = indexOf(d->location);
+ const DisassemblerLines contents = index != -1 ?
+ d->cache.at(index).second : DisassemblerLines();
int lineNumber = contents.lineForAddress(d->location.address());
-
if (d->location.needsMarker()) {
d->editor->markableInterface()->removeMark(d->locationMark);
if (lineNumber)
@@ -300,8 +352,9 @@ void DisassemblerAgent::updateBreakpointMarkers()
if (ids.isEmpty())
return;
- const DisassemblerLines &contents = d->cache.value(frameKey(d->location));
-
+ const int index = indexOf(d->location);
+ const DisassemblerLines contents = index != -1 ?
+ d->cache.at(index).second : DisassemblerLines();
foreach (TextEditor::ITextMark *marker, d->breakpointMarks)
d->editor->markableInterface()->removeMark(marker);
d->breakpointMarks.clear();
diff --git a/src/plugins/debugger/disassembleragent.h b/src/plugins/debugger/disassembleragent.h
index 71665e4221..fea7c84882 100644
--- a/src/plugins/debugger/disassembleragent.h
+++ b/src/plugins/debugger/disassembleragent.h
@@ -72,6 +72,9 @@ public:
bool isMixed() const;
private:
+ void setContentsToEditor(const DisassemblerLines &contents);
+ int indexOf(const Location &loc) const;
+
DisassemblerAgentPrivate *d;
};
diff --git a/src/plugins/debugger/disassemblerlines.cpp b/src/plugins/debugger/disassemblerlines.cpp
index 2e2bad655e..4beee54169 100644
--- a/src/plugins/debugger/disassemblerlines.cpp
+++ b/src/plugins/debugger/disassemblerlines.cpp
@@ -80,6 +80,22 @@ quint64 DisassemblerLine::addressFromDisassemblyLine(const QString &line)
return l.address;
}
+quint64 DisassemblerLines::startAddress() const
+{
+ for (int i = 0; i < m_data.size(); ++i)
+ if (m_data.at(i).address)
+ return m_data.at(i).address;
+ return 0;
+}
+
+quint64 DisassemblerLines::endAddress() const
+{
+ for (int i = m_data.size()- 1; i >= 0; --i)
+ if (m_data.at(i).address)
+ return m_data.at(i).address;
+ return 0;
+}
+
int DisassemblerLines::lineForAddress(quint64 address) const
{
return m_rowCache.value(address);
diff --git a/src/plugins/debugger/disassemblerlines.h b/src/plugins/debugger/disassemblerlines.h
index ae0160e638..59cf0a1255 100644
--- a/src/plugins/debugger/disassemblerlines.h
+++ b/src/plugins/debugger/disassemblerlines.h
@@ -83,6 +83,9 @@ public:
const DisassemblerLine &at(int i) const { return m_data.at(i); }
int lineForAddress(quint64 address) const;
+ quint64 startAddress() const;
+ quint64 endAddress() const;
+
private:
QString m_lastFunction;
QVector<DisassemblerLine> m_data;
diff --git a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
index f492bcd378..6fe2477253 100644
--- a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
+++ b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
@@ -120,7 +120,7 @@ void AbstractPlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
// [some leading stdout here]
// >&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n"
// [some trailing stdout here]
- QString msg = _(response.data.findChild("consolestreamoutput").data());
+ QString msg = _(response.consoleStreamOutput);
QRegExp needle(_("\\bEntry point: 0x([0-9a-f]+)\\b"));
if (needle.indexIn(msg) != -1) {
m_engine->m_entryPoint =
diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp
index 8912bb8848..51ee1b6be1 100644
--- a/src/plugins/debugger/gdb/classicgdbengine.cpp
+++ b/src/plugins/debugger/gdb/classicgdbengine.cpp
@@ -676,8 +676,7 @@ static bool isAccessSpecifier(const QByteArray &ba)
// reads a MI-encoded item frome the consolestream
static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
{
- GdbMi output = response.data.findChild("consolestreamoutput");
- QByteArray out = output.data();
+ QByteArray out = response.consoleStreamOutput;
int markerPos = out.indexOf('"') + 1; // position of 'success marker'
if (markerPos == 0 || out.at(markerPos) == 'f') { // 't' or 'f'
@@ -1016,7 +1015,7 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
WatchData data = response.cookie.value<WatchData>();
- QByteArray out = response.data.findChild("consolestreamoutput").data();
+ QByteArray out = response.consoleStreamOutput;
while (out.endsWith(' ') || out.endsWith('\n'))
out.chop(1);
QList<QByteArray> list = out.split(' ');
diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp
index 7527795c99..6b80ce102c 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.cpp
+++ b/src/plugins/debugger/gdb/coregdbadapter.cpp
@@ -124,16 +124,16 @@ void CoreGdbAdapter::handleTemporaryTargetCore(const GdbResponse &response)
return;
}
- GdbMi console = response.data.findChild("consolestreamoutput");
- int pos1 = console.data().indexOf('`');
- int pos2 = console.data().indexOf('\'');
+ QByteArray console = response.consoleStreamOutput;
+ int pos1 = console.indexOf('`');
+ int pos2 = console.indexOf('\'');
if (pos1 == -1 || pos2 == -1) {
showMessage(tr("Attach to core failed."), StatusBar);
m_engine->notifyEngineSetupFailed();
return;
}
- m_executable = console.data().mid(pos1 + 1, pos2 - pos1 - 1);
+ m_executable = console.mid(pos1 + 1, pos2 - pos1 - 1);
// Strip off command line arguments. FIXME: make robust.
int idx = m_executable.indexOf(_c(' '));
if (idx >= 0)
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 2227b12ae3..f956c22cf8 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -171,8 +171,7 @@ static int &currentToken()
static QByteArray parsePlainConsoleStream(const GdbResponse &response)
{
- GdbMi output = response.data.findChild("consolestreamoutput");
- QByteArray out = output.data();
+ QByteArray out = response.consoleStreamOutput;
// FIXME: proper decoding needed
if (out.endsWith("\\n"))
out.chop(2);
@@ -653,10 +652,8 @@ void GdbEngine::handleResponse(const QByteArray &buff)
//qDebug() << "\nLOG STREAM:" + m_pendingLogStreamOutput;
//qDebug() << "\nCONSOLE STREAM:" + m_pendingConsoleStreamOutput;
- response.data.setStreamOutput("logstreamoutput",
- m_pendingLogStreamOutput);
- response.data.setStreamOutput("consolestreamoutput",
- m_pendingConsoleStreamOutput);
+ response.logStreamOutput = m_pendingLogStreamOutput;
+ response.consoleStreamOutput = m_pendingConsoleStreamOutput;
m_pendingLogStreamOutput.clear();
m_pendingConsoleStreamOutput.clear();
@@ -1070,8 +1067,8 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// Happens with some incarnations of gdb 6.8 for "jump to line"
// (response->resultClass == GdbResultDone && cmd.command.startsWith("jump"))
// (response->resultClass == GdbResultDone && cmd.command.startsWith("detach"))
- // Happens when stepping finishes very quickly and issues *stopped/^done
- // instead of ^running/*stopped
+ // Happens when stepping finishes very quickly and issues *stopped and ^done
+ // instead of ^running and *stopped
// (response->resultClass == GdbResultDone && (cmd.flags & RunRequest));
if (!isExpectedResult) {
@@ -1688,7 +1685,7 @@ void GdbEngine::handleInfoProc(const GdbResponse &response)
if (response.resultClass == GdbResultDone) {
static QRegExp re(_("\\bprocess ([0-9]+)\n"));
QTC_ASSERT(re.isValid(), return);
- if (re.indexIn(_(response.data.findChild("consolestreamoutput").data())) != -1)
+ if (re.indexIn(_(response.consoleStreamOutput)) != -1)
maybeHandleInferiorPidChanged(re.cap(1));
}
}
@@ -1700,8 +1697,7 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
m_gdbVersion = 100;
m_gdbBuildVersion = -1;
m_isMacGdb = false;
- GdbMi version = response.data.findChild("consolestreamoutput");
- QString msg = QString::fromLocal8Bit(version.data());
+ QString msg = QString::fromLocal8Bit(response.consoleStreamOutput);
extractGdbVersion(msg,
&m_gdbVersion, &m_gdbBuildVersion, &m_isMacGdb);
if (m_gdbVersion > 60500 && m_gdbVersion < 200000)
@@ -1726,9 +1722,8 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
m_hasPython = true;
- GdbMi contents = response.data.findChild("consolestreamoutput");
GdbMi data;
- data.fromStringMultiple(contents.data());
+ data.fromStringMultiple(response.consoleStreamOutput);
const GdbMi dumpers = data.findChild("dumpers");
foreach (const GdbMi &dumper, dumpers.children()) {
QByteArray type = dumper.findChild("type").data();
@@ -2386,7 +2381,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
response.fileName = name;
if (response.fileName.isEmpty())
- response.setLocation(originalLocation);
+ response.updateLocation(originalLocation);
}
QString GdbEngine::breakLocation(const QString &file) const
@@ -2442,7 +2437,7 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
// "Hardware watchpoint 2: *0xbfffed40\n"
- QByteArray ba = response.data.findChild("consolestreamoutput").data();
+ QByteArray ba = response.consoleStreamOutput;
GdbMi wpt = response.data.findChild("wpt");
if (wpt.isValid()) {
// Mac yields:
@@ -2517,6 +2512,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
foreach (const GdbMi bkpt, response.data.children()) {
nr = bkpt.findChild("number").data();
rid = BreakpointResponseId(nr);
+ QTC_ASSERT(rid.isValid(), continue);
if (nr.contains('.')) {
// A sub-breakpoint.
BreakpointResponse sub;
@@ -2664,8 +2660,7 @@ void GdbEngine::handleBreakListMultiple(const GdbResponse &response)
{
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
- const QString str = QString::fromLocal8Bit(
- response.data.findChild("consolestreamoutput").data());
+ const QString str = QString::fromLocal8Bit(response.consoleStreamOutput);
extractDataFromInfoBreak(str, id);
}
@@ -2720,7 +2715,7 @@ void GdbEngine::handleBreakIgnore(const GdbResponse &response)
//
// gdb 6.3 does not produce any console output
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
- QString msg = _(response.data.findChild("consolestreamoutput").data());
+ //QString msg = _(response.consoleStreamOutput);
BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
@@ -2847,8 +2842,8 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI
BreakpointResponse sub;
sub.address = address;
sub.functionName = QString::fromUtf8(function);
- sub.setLocation(location);
- sub.id = subId;
+ sub.updateLocation(location);
+ sub.id = BreakpointResponseId(majorPart, minorPart);
sub.type = response.type;
sub.address = address;
handler->insertSubBreakpoint(id, sub);
@@ -2863,7 +2858,20 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI
}
}
}
- // Commit main data.
+ if (minorPart) {
+ // Commit last chunk.
+ BreakpointResponse sub;
+ sub.address = address;
+ sub.functionName = QString::fromUtf8(function);
+ sub.updateLocation(location);
+ sub.id = BreakpointResponseId(majorPart, minorPart);
+ sub.type = response.type;
+ sub.address = address;
+ handler->insertSubBreakpoint(id, sub);
+ location.clear();
+ function.clear();
+ address = 0;
+ }
} else {
qDebug() << "COULD NOT MATCH" << output;
response.id = BreakpointResponseId(); // Unavailable.
@@ -2877,7 +2885,7 @@ void GdbEngine::handleInfoLine(const GdbResponse &response)
// Old-style output: "Line 1102 of \"simple/app.cpp\" starts
// at address 0x80526aa <_Z10...+131> and ends at 0x80526b5
// <_Z10testQStackv+142>.\n"
- QByteArray ba = response.data.findChild("consolestreamoutput").data();
+ QByteArray ba = response.consoleStreamOutput;
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
const int pos = ba.indexOf(' ', 5);
if (ba.startsWith("Line ") && pos != -1) {
@@ -3201,8 +3209,7 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
if (response.resultClass == GdbResultDone) {
// That's console-based output, likely Linux or Windows,
// but we can avoid the target dependency here.
- QString data = QString::fromLocal8Bit(
- response.data.findChild("consolestreamoutput").data());
+ QString data = QString::fromLocal8Bit(response.consoleStreamOutput);
QTextStream ts(&data, QIODevice::ReadOnly);
while (!ts.atEnd()) {
QString line = ts.readLine();
@@ -3378,7 +3385,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
if (!handleIt) {
// That always happens on symbian gdb with
// ^error,data={msg="Previous frame identical to this frame (corrupt stack?)"
- // logstreamoutput="Previous frame identical to this frame (corrupt stack?)\n"
+ // logStreamOutput: "Previous frame identical to this frame (corrupt stack?)\n"
//qDebug() << "LISTING STACK FAILED: " << response.toString();
reloadRegisters();
return;
@@ -3504,9 +3511,8 @@ void GdbEngine::handleThreadListIds(const GdbResponse &response)
void GdbEngine::handleThreadNames(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
- GdbMi contents = response.data.findChild("consolestreamoutput");
GdbMi names;
- names.fromString(contents.data());
+ names.fromString(response.consoleStreamOutput);
Threads threads = threadsHandler()->threads();
@@ -4406,28 +4412,26 @@ DisassemblerLines GdbEngine::parseMiDisassembler(const GdbMi &lines)
return result;
}
-DisassemblerLines GdbEngine::parseCliDisassembler(const GdbMi &output)
+DisassemblerLines GdbEngine::parseCliDisassembler(const QByteArray &output)
{
- const QString someSpace = _(" ");
// First line is something like
// "Dump of assembler code from 0xb7ff598f to 0xb7ff5a07:"
DisassemblerLines dlines;
- foreach (const QByteArray &line, output.data().split('\n'))
+ foreach (const QByteArray &line, output.split('\n'))
dlines.appendUnparsed(_(line));
return dlines;
}
-DisassemblerLines GdbEngine::parseDisassembler(const GdbMi &data)
+DisassemblerLines GdbEngine::parseDisassembler(const GdbResponse &response)
{
// Apple's gdb produces MI output even for CLI commands.
// FIXME: Check whether wrapping this into -interpreter-exec console
// (i.e. usgind the 'ConsoleCommand' GdbCommandFlag makes a
// difference.
- GdbMi lines = data.findChild("asm_insns");
+ GdbMi lines = response.data.findChild("asm_insns");
if (lines.isValid())
return parseMiDisassembler(lines);
- GdbMi output = data.findChild("consolestreamoutput");
- return parseCliDisassembler(output);
+ return parseCliDisassembler(response.consoleStreamOutput);
}
void GdbEngine::handleDisassemblerCheck(const GdbResponse &response)
@@ -4441,7 +4445,7 @@ void GdbEngine::handleFetchDisassemblerByCliPointMixed(const GdbResponse &respon
QTC_ASSERT(ac.agent, return);
if (response.resultClass == GdbResultDone) {
- DisassemblerLines dlines = parseDisassembler(response.data);
+ DisassemblerLines dlines = parseDisassembler(response);
if (dlines.coversAddress(ac.agent->address())) {
ac.agent->setContents(dlines);
return;
@@ -4456,7 +4460,7 @@ void GdbEngine::handleFetchDisassemblerByCliPointPlain(const GdbResponse &respon
QTC_ASSERT(ac.agent, return);
if (response.resultClass == GdbResultDone) {
- DisassemblerLines dlines = parseDisassembler(response.data);
+ DisassemblerLines dlines = parseDisassembler(response);
if (dlines.coversAddress(ac.agent->address())) {
ac.agent->setContents(dlines);
return;
@@ -4474,7 +4478,7 @@ void GdbEngine::handleFetchDisassemblerByCliRangeMixed(const GdbResponse &respon
QTC_ASSERT(ac.agent, return);
if (response.resultClass == GdbResultDone) {
- DisassemblerLines dlines = parseDisassembler(response.data);
+ DisassemblerLines dlines = parseDisassembler(response);
if (dlines.coversAddress(ac.agent->address())) {
ac.agent->setContents(dlines);
return;
@@ -4489,7 +4493,7 @@ void GdbEngine::handleFetchDisassemblerByCliRangePlain(const GdbResponse &respon
QTC_ASSERT(ac.agent, return);
if (response.resultClass == GdbResultDone) {
- DisassemblerLines dlines = parseDisassembler(response.data);
+ DisassemblerLines dlines = parseDisassembler(response);
if (dlines.size()) {
ac.agent->setContents(dlines);
return;
@@ -4992,8 +4996,7 @@ void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
debuggerCore()->openTextEditor(_("Backtrace $"),
- _(response.data.findChild("consolestreamoutput").data()
- + response.data.findChild("logstreamoutput").data()));
+ _(response.consoleStreamOutput + response.logStreamOutput));
}
}
@@ -5040,8 +5043,8 @@ void GdbEngine::handleSetQmlStepBreakpoint(const GdbResponse &response)
{
//QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (response.resultClass == GdbResultDone) {
- // "{logstreamoutput="tbreak 'myns::QScript::FunctionWrapper::proxyCall'\n"
- //,consolestreamoutput="Temporary breakpoint 1 at 0xf166e7:
+ // logStreamOutput: "tbreak 'myns::QScript::FunctionWrapper::proxyCall'\n"
+ // consoleStreamOutput: "Temporary breakpoint 1 at 0xf166e7:
// file bridge/qscriptfunction.cpp, line 75.\n"}
QByteArray ba = parsePlainConsoleStream(response);
const int pos2 = ba.indexOf(" at 0x");
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 3c610ca034..99d869e388 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -568,9 +568,9 @@ private: ////////// View & Data Stuff //////////
//void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response);
void handleDisassemblerCheck(const GdbResponse &response);
void handleBreakOnQFatal(const GdbResponse &response);
- DisassemblerLines parseDisassembler(const GdbMi &data);
- DisassemblerLines parseCliDisassembler(const GdbMi &lines);
- DisassemblerLines parseMiDisassembler(const GdbMi &lines);
+ DisassemblerLines parseDisassembler(const GdbResponse &response);
+ DisassemblerLines parseCliDisassembler(const QByteArray &response);
+ DisassemblerLines parseMiDisassembler(const GdbMi &response);
bool m_disassembleUsesComma;
diff --git a/src/plugins/debugger/gdb/gdbmi.cpp b/src/plugins/debugger/gdb/gdbmi.cpp
index 17abe88637..080916037a 100644
--- a/src/plugins/debugger/gdb/gdbmi.cpp
+++ b/src/plugins/debugger/gdb/gdbmi.cpp
@@ -228,19 +228,6 @@ void GdbMi::parseList(const char *&from, const char *to)
}
}
-void GdbMi::setStreamOutput(const QByteArray &name, const QByteArray &content)
-{
- if (content.isEmpty())
- return;
- GdbMi child;
- child.m_type = Const;
- child.m_name = name;
- child.m_data = content;
- m_children += child;
- if (m_type == Invalid)
- m_type = Tuple;
-}
-
static QByteArray ind(int indent)
{
return QByteArray(2 * indent, ' ');
diff --git a/src/plugins/debugger/gdb/gdbmi.h b/src/plugins/debugger/gdb/gdbmi.h
index 09cc4cc98a..c975ba1cad 100644
--- a/src/plugins/debugger/gdb/gdbmi.h
+++ b/src/plugins/debugger/gdb/gdbmi.h
@@ -130,7 +130,6 @@ public:
qulonglong toAddress() const;
void fromString(const QByteArray &str);
void fromStringMultiple(const QByteArray &str);
- void setStreamOutput(const QByteArray &name, const QByteArray &content);
private:
friend class GdbResponse;
@@ -170,6 +169,8 @@ public:
GdbResultClass resultClass;
GdbMi data;
QVariant cookie;
+ QByteArray logStreamOutput;
+ QByteArray consoleStreamOutput;
};
void extractGdbVersion(const QString &msg,
diff --git a/src/plugins/debugger/gdb/gdboptionspage.ui b/src/plugins/debugger/gdb/gdboptionspage.ui
index 9445a0d837..6fb810fca1 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.ui
+++ b/src/plugins/debugger/gdb/gdboptionspage.ui
@@ -154,7 +154,7 @@ on slow machines. In this case, the value should be increased.</string>
<string>This is the slowest but safest option.</string>
</property>
<property name="text">
- <string>Try to set breakpoints in plugins always automatically</string>
+ <string>Always try to set breakpoints in plugins automatically</string>
</property>
</widget>
</item>
diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp
index 50ffd4bc0d..81d5ca302b 100644
--- a/src/plugins/debugger/gdb/pythongdbengine.cpp
+++ b/src/plugins/debugger/gdb/pythongdbengine.cpp
@@ -135,7 +135,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
PRECONDITION;
if (response.resultClass == GdbResultDone) {
const bool partial = response.cookie.toBool();
- QByteArray out = response.data.findChild("consolestreamoutput").data();
+ QByteArray out = response.consoleStreamOutput;
while (out.endsWith(' ') || out.endsWith('\n'))
out.chop(1);
int pos = out.indexOf("data=");
diff --git a/src/plugins/debugger/gdb/remotegdbprocess.cpp b/src/plugins/debugger/gdb/remotegdbprocess.cpp
index f32af660e0..124e43f620 100644
--- a/src/plugins/debugger/gdb/remotegdbprocess.cpp
+++ b/src/plugins/debugger/gdb/remotegdbprocess.cpp
@@ -98,7 +98,8 @@ void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args,
handleConnected();
} else {
connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected()));
- m_conn->connectToHost();
+ if (m_conn->state() == SshConnection::Unconnected)
+ m_conn->connectToHost();
}
}
diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp
index d547b6a423..92e0722e7a 100644
--- a/src/plugins/debugger/stackwindow.cpp
+++ b/src/plugins/debugger/stackwindow.cpp
@@ -173,7 +173,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
else if (act == actAdjust)
resizeColumnsToContents();
else if (act == actShowMemory) {
- const QString title = tr("Memory at Frame #%1 (%2) 0x%3)").
+ const QString title = tr("Memory at Frame #%1 (%2) 0x%3").
arg(row).arg(frame.function).arg(address, 0, 16);
QList<MemoryMarkup> ml;
ml.push_back(MemoryMarkup(address, 1, QColor(Qt::blue).lighter(),
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 10ed4fe1e6..9bad66fcf9 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -462,7 +462,7 @@ static inline void addStackLayoutMemoryView(DebuggerEngine *engine,
regMap, true, background);
const unsigned flags = separateView ? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0;
const QString title =
- WatchWindow::tr("Memory Layout of Local Variables at 0x%2").arg(start, 0, 16);
+ WatchWindow::tr("Memory Layout of Local Variables at 0x%1").arg(start, 0, 16);
engine->openMemoryView(start, flags, markup, p, title, parent);
}
diff --git a/src/plugins/designer/qt_private/abstractnewformwidget_p.h b/src/plugins/designer/qt_private/abstractnewformwidget_p.h
index 7ac5dd2937..aaf1d1086e 100644
--- a/src/plugins/designer/qt_private/abstractnewformwidget_p.h
+++ b/src/plugins/designer/qt_private/abstractnewformwidget_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/abstractoptionspage_p.h b/src/plugins/designer/qt_private/abstractoptionspage_p.h
index 242f00f413..e0b0fd75c4 100644
--- a/src/plugins/designer/qt_private/abstractoptionspage_p.h
+++ b/src/plugins/designer/qt_private/abstractoptionspage_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/abstractsettings_p.h b/src/plugins/designer/qt_private/abstractsettings_p.h
index 736907f411..ca7615049c 100644
--- a/src/plugins/designer/qt_private/abstractsettings_p.h
+++ b/src/plugins/designer/qt_private/abstractsettings_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/formwindowbase_p.h b/src/plugins/designer/qt_private/formwindowbase_p.h
index 56a02babe1..99239adb91 100644
--- a/src/plugins/designer/qt_private/formwindowbase_p.h
+++ b/src/plugins/designer/qt_private/formwindowbase_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/iconloader_p.h b/src/plugins/designer/qt_private/iconloader_p.h
index 7cdd4a8105..b2eca12a9d 100644
--- a/src/plugins/designer/qt_private/iconloader_p.h
+++ b/src/plugins/designer/qt_private/iconloader_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/pluginmanager_p.h b/src/plugins/designer/qt_private/pluginmanager_p.h
index 6ca5003296..f1edc70836 100644
--- a/src/plugins/designer/qt_private/pluginmanager_p.h
+++ b/src/plugins/designer/qt_private/pluginmanager_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
index 8c3a95d5ca..539a3a99aa 100644
--- a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
+++ b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/qdesigner_integration_p.h b/src/plugins/designer/qt_private/qdesigner_integration_p.h
index 3014b00d39..af6ad5c9a4 100644
--- a/src/plugins/designer/qt_private/qdesigner_integration_p.h
+++ b/src/plugins/designer/qt_private/qdesigner_integration_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/qsimpleresource_p.h b/src/plugins/designer/qt_private/qsimpleresource_p.h
index 19cf8d5239..506efaf61c 100644
--- a/src/plugins/designer/qt_private/qsimpleresource_p.h
+++ b/src/plugins/designer/qt_private/qsimpleresource_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/qtresourcemodel_p.h b/src/plugins/designer/qt_private/qtresourcemodel_p.h
index 8361642052..b132eeb8b2 100644
--- a/src/plugins/designer/qt_private/qtresourcemodel_p.h
+++ b/src/plugins/designer/qt_private/qtresourcemodel_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/shared_enums_p.h b/src/plugins/designer/qt_private/shared_enums_p.h
index 7bc821c8b3..24296f7de6 100644
--- a/src/plugins/designer/qt_private/shared_enums_p.h
+++ b/src/plugins/designer/qt_private/shared_enums_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/designer/qt_private/shared_global_p.h b/src/plugins/designer/qt_private/shared_global_p.h
index 587f628097..41ead1158a 100644
--- a/src/plugins/designer/qt_private/shared_global_p.h
+++ b/src/plugins/designer/qt_private/shared_global_p.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
index 941738c50a..9b0741dd1d 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
@@ -179,6 +179,6 @@ bool ProjectFilesDocument::save(QString *errorString, const QString &name, bool
return false;
if (!autoSave)
- m_manager->notifyChanged(name);
+ m_manager->notifyChanged(name.isEmpty() ? fileName() : name);
return true;
}
diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp b/src/plugins/genericprojectmanager/selectablefilesmodel.cpp
index 4c516f3375..a9b5582f2f 100644
--- a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp
+++ b/src/plugins/genericprojectmanager/selectablefilesmodel.cpp
@@ -58,6 +58,12 @@ SelectableFilesModel::SelectableFilesModel(const QString &baseDir, QObject *pare
void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files)
{
m_files = files.toSet();
+ m_outOfBaseDirFiles.clear();
+ QString base = m_baseDir + '/';
+ foreach (const QString &file, m_files)
+ if (!file.startsWith(base))
+ m_outOfBaseDirFiles.append(file);
+
m_allFiles = false;
}
@@ -333,11 +339,16 @@ void SelectableFilesModel::collectPaths(Tree *root, QStringList *result) const
QStringList SelectableFilesModel::selectedFiles() const
{
- QStringList result;
+ QStringList result = m_outOfBaseDirFiles;
collectFiles(m_root, &result);
return result;
}
+QStringList SelectableFilesModel::preservedFiles() const
+{
+ return m_outOfBaseDirFiles;
+}
+
void SelectableFilesModel::collectFiles(Tree *root, QStringList *result) const
{
if (root->checked == Qt::Unchecked)
@@ -526,6 +537,10 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL
m_view->hide();
layout->addWidget(m_view);
+ m_preservedFiles = new QLabel;
+ m_preservedFiles->hide();
+ layout->addWidget(m_preservedFiles);
+
m_progressLabel = new QLabel(this);
m_progressLabel->setMaximumWidth(500);
layout->addWidget(m_progressLabel);
@@ -569,6 +584,13 @@ void SelectableFilesDialog::parsingFinished()
m_view->expand(QModelIndex());
smartExpand(m_selectableFilesModel->index(0,0, QModelIndex()));
applyFilter();
+ const QStringList &preservedFiles = m_selectableFilesModel->preservedFiles();
+ if (preservedFiles.isEmpty()) {
+ m_preservedFiles->hide();
+ } else {
+ m_preservedFiles->show();
+ m_preservedFiles->setText(tr("Not showing %n files that are outside of the base directory.\nThese files are preserved.", 0, preservedFiles.count()));
+ }
}
void SelectableFilesDialog::smartExpand(const QModelIndex &index)
diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.h b/src/plugins/genericprojectmanager/selectablefilesmodel.h
index 6b81e238fc..f85b4c5672 100644
--- a/src/plugins/genericprojectmanager/selectablefilesmodel.h
+++ b/src/plugins/genericprojectmanager/selectablefilesmodel.h
@@ -88,6 +88,7 @@ public:
QStringList selectedFiles() const;
QStringList selectedPaths() const;
+ QStringList preservedFiles() const;
// only call this once
void startParsing();
@@ -115,6 +116,7 @@ private:
// Used in the future thread need to all not used after calling startParsing
QString m_baseDir;
QSet<QString> m_files;
+ QStringList m_outOfBaseDirFiles;
QSet<QString> m_suffixes;
QFutureWatcher<void> m_watcher;
Tree *m_rootForFuture;
@@ -143,6 +145,7 @@ private:
QLineEdit *m_filterLineEdit;
QPushButton *m_applyFilterButton;
QTreeView *m_view;
+ QLabel *m_preservedFiles;
QLabel *m_progressLabel;
};
diff --git a/src/plugins/git/branchadddialog.cpp b/src/plugins/git/branchadddialog.cpp
index 64e2d32b2e..4a4981f2ab 100644
--- a/src/plugins/git/branchadddialog.cpp
+++ b/src/plugins/git/branchadddialog.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "branchadddialog.h"
#include "ui_branchadddialog.h"
diff --git a/src/plugins/git/branchadddialog.h b/src/plugins/git/branchadddialog.h
index 9fec0966a3..301c3e521c 100644
--- a/src/plugins/git/branchadddialog.h
+++ b/src/plugins/git/branchadddialog.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef BRANCHADDDIALOG_H
#define BRANCHADDDIALOG_H
diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp
index 2158540444..43831ebc56 100644
--- a/src/plugins/locator/locatorplugin.cpp
+++ b/src/plugins/locator/locatorplugin.cpp
@@ -45,12 +45,12 @@
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
-#include <coreplugin/actionmanager/command.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <qtconcurrent/QtConcurrentTools>
+#include <utils/qtcassert.h>
#include <QtCore/QSettings>
#include <QtCore/QtPlugin>
@@ -119,6 +119,8 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
->registerAction(action, "QtCreator.Locate", Core::Context(Core::Constants::C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence("Ctrl+K"));
connect(action, SIGNAL(triggered()), this, SLOT(openLocator()));
+ connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText()));
+ updatePlaceholderText(cmd);
Core::ActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS);
mtools->addAction(cmd);
@@ -137,6 +139,18 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
return true;
}
+void LocatorPlugin::updatePlaceholderText(Core::Command *command)
+{
+ if (!command)
+ command = qobject_cast<Core::Command *>(sender());
+ QTC_ASSERT(command, return);
+ if (command->keySequence().isEmpty())
+ m_locatorWidget->setPlaceholderText(tr("Type to locate"));
+ else
+ m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg(
+ command->keySequence().toString(QKeySequence::NativeText)));
+}
+
void LocatorPlugin::openLocator()
{
m_locatorWidget->show("");
diff --git a/src/plugins/locator/locatorplugin.h b/src/plugins/locator/locatorplugin.h
index 11020fa864..0d2ec895c0 100644
--- a/src/plugins/locator/locatorplugin.h
+++ b/src/plugins/locator/locatorplugin.h
@@ -37,6 +37,7 @@
#include "directoryfilter.h"
#include <extensionsystem/iplugin.h>
+#include <coreplugin/actionmanager/command.h>
#include <QtCore/QObject>
#include <QtCore/QTimer>
@@ -77,6 +78,7 @@ public slots:
private slots:
void startSettingsLoad();
void settingsLoaded();
+ void updatePlaceholderText(Core::Command *command = 0);
private:
void loadSettings();
diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp
index d9b83a04c3..5e9024c48b 100644
--- a/src/plugins/locator/locatorwidget.cpp
+++ b/src/plugins/locator/locatorwidget.cpp
@@ -306,7 +306,6 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) :
setWindowIcon(QIcon(QLatin1String(":/locator/images/locator.png")));
QPixmap image(Core::Constants::ICON_MAGNIFIER);
m_fileLineEdit->setButtonPixmap(Utils::FancyLineEdit::Left, image);
- m_fileLineEdit->setPlaceholderText(tr("Type to locate"));
m_fileLineEdit->setButtonToolTip(Utils::FancyLineEdit::Left, tr("Options"));
m_fileLineEdit->setFocusPolicy(Qt::ClickFocus);
m_fileLineEdit->setButtonVisible(Utils::FancyLineEdit::Left, true);
@@ -343,6 +342,11 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) :
connect(m_showPopupTimer, SIGNAL(timeout()), SLOT(showPopupNow()));
}
+void LocatorWidget::setPlaceholderText(const QString &text)
+{
+ m_fileLineEdit->setPlaceholderText(text);
+}
+
void LocatorWidget::updateFilterList()
{
m_filterMenu->clear();
diff --git a/src/plugins/locator/locatorwidget.h b/src/plugins/locator/locatorwidget.h
index f7dd2508e4..bdf053f413 100644
--- a/src/plugins/locator/locatorwidget.h
+++ b/src/plugins/locator/locatorwidget.h
@@ -67,6 +67,8 @@ public:
void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
+ void setPlaceholderText(const QString &text);
+
private slots:
void showPopup();
void showPopupNow();
diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp
index 577943fabf..f89a374baa 100644
--- a/src/plugins/projectexplorer/clangparser.cpp
+++ b/src/plugins/projectexplorer/clangparser.cpp
@@ -35,8 +35,6 @@
#include "taskwindow.h"
#include "projectexplorerconstants.h"
-#include <QtCore/QDir>
-
using namespace ProjectExplorer;
namespace {
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
index 414d01c8a6..496cb289bb 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "codestylesettingspropertiespage.h"
#include "editorconfiguration.h"
#include "project.h"
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
index 07ba4ae4b7..873c7faaf0 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CODESTYLESETTINGSPROPERTIESPAGE_H
#define CODESTYLESETTINGSPROPERTIESPAGE_H
diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp
index 845bb58c6f..9efca403d5 100644
--- a/src/plugins/projectexplorer/gccparser.cpp
+++ b/src/plugins/projectexplorer/gccparser.cpp
@@ -35,8 +35,6 @@
#include "taskwindow.h"
#include "projectexplorerconstants.h"
-#include <QtCore/QDir>
-
using namespace ProjectExplorer;
namespace {
@@ -105,7 +103,7 @@ void GccParser::stdError(const QString &line)
int lineno = m_regExp.cap(3).toInt();
Task task(Task::Unknown,
m_regExp.cap(8) /* description */,
- QDir::fromNativeSeparators(filename), lineno,
+ filename, lineno,
Constants::TASK_CATEGORY_COMPILE);
if (m_regExp.cap(7) == QLatin1String("warning"))
task.type = Task::Warning;
@@ -123,7 +121,7 @@ void GccParser::stdError(const QString &line)
} else if (m_regExpIncluded.indexIn(lne) > -1) {
emit addTask(Task(Task::Unknown,
lne /* description */,
- QDir::fromNativeSeparators(m_regExpIncluded.cap(1)) /* filename */,
+ m_regExpIncluded.cap(1) /* filename */,
m_regExpIncluded.cap(3).toInt() /* linenumber */,
Constants::TASK_CATEGORY_COMPILE));
return;
@@ -207,7 +205,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
<< QString() << QString()
<< (QList<ProjectExplorer::Task>() << Task(Task::Error,
QLatin1String("#error Symbian error"),
- QLatin1String("C:/temp/test/untitled8/main.cpp"), 7,
+ QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 7,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
// Symbian reports #warning(s) twice (using different syntax).
@@ -217,7 +215,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
<< QString() << QString()
<< (QList<ProjectExplorer::Task>() << Task(Task::Warning,
QLatin1String("#warning Symbian warning"),
- QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
+ QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 8,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("GCCE #warning2")
@@ -242,7 +240,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("undefined reference to `MainWindow::doSomething()'"),
- QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
+ QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), 8,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("collect2: ld returned 1 exit status"),
@@ -263,7 +261,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("undefined reference to `MainWindow::doSomething()'"),
- QLatin1String("C:/temp/test/untitled8/main.cpp"), -1,
+ QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), -1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("collect2: ld returned 1 exit status"),
@@ -278,7 +276,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("file not recognized: File format not recognized"),
- QLatin1String("c:/Qt/4.6/lib/QtGuid4.dll"), -1,
+ QLatin1String("c:\\Qt\\4.6\\lib/QtGuid4.dll"), -1,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("Invalid rpath")
@@ -510,11 +508,11 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("undefined reference to `vtable for QPlotAxis'"),
- QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
+ QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("undefined reference to `vtable for QPlotAxis'"),
- QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
+ QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("collect2: ld returned 1 exit status"),
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index a0976771f7..1c62f61b03 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -189,7 +189,7 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m)
|| p == QLatin1String("i686") || p == QLatin1String("x86")) {
arch = ProjectExplorer::Abi::X86Architecture;
width = 32;
- } else if (p == QLatin1String("arm") || p == QLatin1String("armv5tel")) {
+ } else if (p.startsWith(QLatin1String("arm"))) {
arch = ProjectExplorer::Abi::ArmArchitecture;
width = 32;
} else if (p == QLatin1String("mipsel")) {
@@ -1014,6 +1014,10 @@ void ProjectExplorerPlugin::testGccAbiGuessing_data()
QTest::newRow("Linux 7") // Meego
<< QString::fromLatin1("armv5tel-meego-linux-gnueabi")
<< (QStringList() << QLatin1String("arm-linux-meego-elf-32bit"));
+ QTest::newRow("Linux 8")
+ << QString::fromLatin1("armv5tl-montavista-linux-gnueabi")
+ << (QStringList() << QLatin1String("arm-linux-generic-elf-32bit"));
+
QTest::newRow("Mingw 1")
<< QString::fromLatin1("i686-w64-mingw32")
<< (QStringList() << QLatin1String("x86-windows-msys-pe-64bit")
diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp
index 6d01af617f..ca81054127 100644
--- a/src/plugins/projectexplorer/gnumakeparser.cpp
+++ b/src/plugins/projectexplorer/gnumakeparser.cpp
@@ -95,7 +95,7 @@ void GnuMakeParser::stdError(const QString &line)
m_suppressIssues = true;
addTask(Task(Task::Error,
m_makefileError.cap(3),
- QDir::fromNativeSeparators(m_makefileError.cap(1)),
+ m_makefileError.cap(1),
m_makefileError.cap(2).toInt(),
Constants::TASK_CATEGORY_BUILDSYSTEM));
}
diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp
index a1d7980ca0..a3272b0f16 100644
--- a/src/plugins/projectexplorer/ldparser.cpp
+++ b/src/plugins/projectexplorer/ldparser.cpp
@@ -34,8 +34,6 @@
#include "projectexplorerconstants.h"
#include "taskwindow.h"
-#include <QtCore/QDir>
-
using namespace ProjectExplorer;
namespace {
@@ -103,7 +101,7 @@ void LdParser::stdError(const QString &line)
&& !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text+0x")))
filename = m_regExpLinker.cap(4);
QString description = m_regExpLinker.cap(8).trimmed();
- Task task(Task::Error, description, QDir::fromNativeSeparators(filename), lineno,
+ Task task(Task::Error, description, filename, lineno,
Constants::TASK_CATEGORY_COMPILE);
if (m_regExpInFunction.indexIn(description) > -1 ||
description.startsWith(QLatin1String("At global scope")) ||
diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp
index 074eaf4352..d29d2f76ad 100644
--- a/src/plugins/projectexplorer/linuxiccparser.cpp
+++ b/src/plugins/projectexplorer/linuxiccparser.cpp
@@ -35,8 +35,6 @@
#include "taskwindow.h"
#include "projectexplorerconstants.h"
-#include <QtCore/QDir>
-
using namespace ProjectExplorer;
LinuxIccParser::LinuxIccParser()
@@ -75,7 +73,7 @@ void LinuxIccParser::stdError(const QString &line)
if (m_expectFirstLine && m_firstLine.indexIn(line) != -1) {
// Clear out old task
m_temporary = ProjectExplorer::Task(Task::Unknown, m_firstLine.cap(6).trimmed(),
- QDir::fromNativeSeparators(m_firstLine.cap(1)),
+ m_firstLine.cap(1),
m_firstLine.cap(2).toInt(),
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
QString category = m_firstLine.cap(4);
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index a1a8683cef..beb512dfbe 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -610,7 +610,6 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s32),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s32, version),
sdkVcVarsBat, QLatin1String("/x86"), true));
-#ifdef Q_OS_WIN64
// Add all platforms
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s64, version),
@@ -618,7 +617,6 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::ia64, version),
sdkVcVarsBat, QLatin1String("/ia64"), true));
-#endif
// Make sure the default is front.
if (folder == defaultSdkPath)
results = tmp + results;
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index 2e326022cc..1d3b8da6d6 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -101,8 +101,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_model(0),
m_filterProjectsAction(0),
m_autoSync(false),
- m_autoExpand(true),
- m_currentItemLocked(0)
+ m_autoExpand(true)
{
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
Project *pro = m_explorer->session()->startupProject();
@@ -282,13 +281,6 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
if (debug)
qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0")
<< ", " << (node ? node->path() : "0") << ")";
- if (m_currentItemLocked) {
- if (m_currentItemLocked == node) {
- m_currentItemLocked = 0;
- return;
- }
- m_currentItemLocked = 0;
- }
if (!project) {
return;
@@ -326,10 +318,6 @@ void ProjectTreeWidget::showContextMenu(const QPoint &pos)
void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
{
- // We disable auto-synchronization for the current node so that the project
- // is selected until another file is opened
- m_currentItemLocked = m_model->nodeForIndex(m_view->currentIndex());
-
Node *node = project->rootProjectNode();
QModelIndex idx = m_model->indexForNode(node);
if (m_autoExpand) // disabled while session restoring
diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h
index 9a15cc9169..570aa7fc00 100644
--- a/src/plugins/projectexplorer/projecttreewidget.h
+++ b/src/plugins/projectexplorer/projecttreewidget.h
@@ -101,7 +101,6 @@ private:
QString m_modelId;
bool m_autoSync;
bool m_autoExpand;
- Node *m_currentItemLocked;
friend class ProjectTreeWidgetFactory;
};
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index 63807deccf..e24c7a22ca 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -58,7 +58,7 @@ SessionModel::SessionModel(SessionManager *manager, QObject *parent)
int SessionModel::rowCount(const QModelIndex &) const
{
- return qMin(m_manager->sessions().count(), 12);
+ return m_manager->sessions().count();
}
QVariant SessionModel::data(const QModelIndex &index, int role) const
@@ -95,7 +95,7 @@ ProjectModel::ProjectModel(ProjectExplorerPlugin *plugin, QObject *parent)
int ProjectModel::rowCount(const QModelIndex &) const
{
- return qMin(m_plugin->recentProjects().count(), 6);
+ return m_plugin->recentProjects().count();
}
QVariant ProjectModel::data(const QModelIndex &index, int role) const
diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h
index 5b3d2da2cb..f63009f898 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.h
+++ b/src/plugins/projectexplorer/projectwelcomepage.h
@@ -103,7 +103,7 @@ public:
ProjectWelcomePage();
void facilitateQml(QDeclarativeEngine *engine);
- QString pageLocation() const { return Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/develop.qml"); }
+ QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/develop.qml")); }
QWidget *page() { return 0; }
QString title() const { return tr("Develop"); }
int priority() const { return 20; }
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp
index a1571b91b8..24e3bf56eb 100644
--- a/src/plugins/projectexplorer/task.cpp
+++ b/src/plugins/projectexplorer/task.cpp
@@ -32,6 +32,8 @@
#include "task.h"
+#include <QtCore/QDir>
+
namespace ProjectExplorer
{
@@ -48,8 +50,7 @@ Task::Task() : taskId(0), type(Unknown), line(-1)
Task::Task(TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_) :
- taskId(s_nextId), type(type_), description(description_), file(file_),
- line(line_), category(category_)
+ taskId(s_nextId), type(type_), description(description_), file(QDir::fromNativeSeparators(file_)), line(line_), category(category_)
{
++s_nextId;
}
diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h
index eed1ec3088..f61ef51631 100644
--- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h
+++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h
@@ -82,6 +82,7 @@ public:
virtual void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
virtual void instancesCompleted(const QList<FormEditorItem*> &itemList) = 0;
+ virtual void instancesParentChanged(const QList<FormEditorItem*> &itemList) = 0;
void setItems(const QList<FormEditorItem*> &itemList);
QList<FormEditorItem*> items() const;
diff --git a/src/plugins/qmldesigner/components/formeditor/anchortool.cpp b/src/plugins/qmldesigner/components/formeditor/anchortool.cpp
index 85d3707e69..b058a50249 100644
--- a/src/plugins/qmldesigner/components/formeditor/anchortool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/anchortool.cpp
@@ -220,6 +220,10 @@ void AnchorTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
{
}
+void AnchorTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/)
+{
+}
+
AnchorLineHandleItem* AnchorTool::topAnchorLineHandleItem(const QList<QGraphicsItem*> & itemList)
{
foreach (QGraphicsItem *item, itemList) {
diff --git a/src/plugins/qmldesigner/components/formeditor/anchortool.h b/src/plugins/qmldesigner/components/formeditor/anchortool.h
index b5a19a4c79..27fc531fca 100644
--- a/src/plugins/qmldesigner/components/formeditor/anchortool.h
+++ b/src/plugins/qmldesigner/components/formeditor/anchortool.h
@@ -74,6 +74,8 @@ public:
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList);
void instancesCompleted(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
+
static AnchorLineHandleItem* topAnchorLineHandleItem(const QList<QGraphicsItem*> & itemList);
diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
index ec62f391f1..38556c08cb 100644
--- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
@@ -217,6 +217,12 @@ void DragTool::instancesCompleted(const QList<FormEditorItem*> &itemList)
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
}
+void DragTool::instancesParentChanged(const QList<FormEditorItem *> &itemList)
+{
+ m_moveManipulator.synchronizeInstanceParent(itemList);
+}
+
+
void DragTool::clearMoveDelay()
{
if (!m_blockMove)
@@ -291,7 +297,7 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
const QString newImportVersion = QString("%1.%2").arg(QString::number(itemLibraryEntry.majorVersion()), QString::number(itemLibraryEntry.minorVersion()));
Import newImport = Import::createLibraryImport(newImportUrl, newImportVersion);
- if (!view()->model()->hasImport(newImport, true)) {
+ if (!view()->model()->hasImport(newImport, true, true)) {
importToBeAddedList.append(newImport);
}
@@ -381,6 +387,7 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
QTimer::singleShot(1000, m_timerHandler.data(), SLOT(clearMoveDelay()));
}
}
+
if (event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
}
}
diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.h b/src/plugins/qmldesigner/components/formeditor/dragtool.h
index d397c73158..f2a8db7f10 100644
--- a/src/plugins/qmldesigner/components/formeditor/dragtool.h
+++ b/src/plugins/qmldesigner/components/formeditor/dragtool.h
@@ -86,6 +86,7 @@ public:
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList);
void selectedItemsChanged(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
void updateMoveManipulator();
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp
index 52623f7716..c3b6993659 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp
@@ -46,8 +46,7 @@ FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) :
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
setResizeAnchor(QGraphicsView::AnchorViewCenter);
setAlignment(Qt::AlignCenter);
- setCacheMode(QGraphicsView::CacheBackground);
-// setCacheMode(QGraphicsView::CacheBackground);
+ setCacheMode(QGraphicsView::CacheNone);
setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
// setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp
index 4724c10edc..28331eeba2 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h
index d6ed7b223f..acd68af923 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
index bb257b3278..1b429d0dd9 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
@@ -196,6 +196,9 @@ void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, c
if (propertyName == "clip")
item->setFlag(QGraphicsItem::ItemClipsChildrenToShape, qmlItemNode.instanceValue("clip").toBool());
+ if (propertyName == "z")
+ item->setZValue(qmlItemNode.instanceValue("z").toDouble());
+
if (!qmlItemNode.isRootNode()) {
if (propertyName == "visible")
item->setContentVisible(qmlItemNode.instanceValue("visible").toBool());
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp
index 49a780fddf..8ba8533649 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h
index 0c902b2586..5cded6394c 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index 3e0ebe06c4..a2ed9a8554 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -56,6 +56,7 @@
#include <zoomaction.h>
#include <nodeabstractproperty.h>
#include <nodelistproperty.h>
+#include <commondefines.h>
namespace QmlDesigner {
@@ -489,6 +490,10 @@ void FormEditorView::instancesPreviewImageChanged(const QVector<ModelNode> &/*no
}
+void FormEditorView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+}
+
void FormEditorView::instancesChildrenChanged(const QVector<ModelNode> &nodeList)
{
QList<FormEditorItem*> itemNodeList;
@@ -502,6 +507,7 @@ void FormEditorView::instancesChildrenChanged(const QVector<ModelNode> &nodeList
}
m_currentTool->formEditorItemsChanged(itemNodeList);
+ m_currentTool->instancesParentChanged(itemNodeList);
}
void FormEditorView::rewriterBeginTransaction()
@@ -573,16 +579,22 @@ QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
return QmlItemNode();
}
-void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName)
+void FormEditorView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
{
- Q_ASSERT(qmlObjectNode.isValid());
-
- QmlItemNode itemNode = findRecursiveQmlItemNode(qmlObjectNode);
-
- if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
- m_scene->synchronizeOtherProperty(itemNode, propertyName);
- m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
+ typedef QPair<ModelNode, QString> NodePropertyPair;
+ foreach (const NodePropertyPair &nodePropertyPair, propertyList) {
+ const QmlItemNode itemNode(nodePropertyPair.first);
+ const QString propertyName = nodePropertyPair.second;
+ if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
+ static QStringList skipList = QStringList() << "x" << "y" << "width" << "height";
+ if (!skipList.contains(propertyName)) {
+ m_scene->synchronizeOtherProperty(itemNode, propertyName);
+ m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
+ }
+ }
}
+
+ QmlModelView::instancePropertyChange(propertyList);
}
void FormEditorView::updateGraphicsIndicators()
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.h b/src/plugins/qmldesigner/components/formeditor/formeditorview.h
index 2657d6ae3b..b723c4bcef 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.h
@@ -108,6 +108,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
void rewriterBeginTransaction();
void rewriterEndTransaction();
@@ -123,7 +125,6 @@ signals:
void ItemCreatorDeActivated();
protected:
- void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void reset();
diff --git a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp
index 4d6c3a769f..398dbe1f4d 100644
--- a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp
@@ -145,6 +145,10 @@ void ItemCreatorTool::instancesCompleted(const QList<FormEditorItem*> &/*itemLis
{
}
+void ItemCreatorTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/)
+{
+}
+
void ItemCreatorTool::setItemString(const QString &itemString)
{
m_itemString = itemString;
diff --git a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h
index 6c41176020..cd678b2647 100644
--- a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h
+++ b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
@@ -71,6 +71,7 @@ public:
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList);
void instancesCompleted(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
void setItemString(const QString &itemString);
diff --git a/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h b/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h
index ae91b5ef35..53478d01d7 100644
--- a/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h
+++ b/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
index 14bcc54256..91926dc5df 100644
--- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
@@ -88,6 +88,35 @@ void MoveManipulator::setItems(const QList<FormEditorItem*> &itemList)
}
}
+void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList, const ModelNode &parentNode)
+{
+ bool snapperUpdated = false;
+
+ foreach (FormEditorItem *item, itemList) {
+ if (m_itemList.contains(item)) {
+ QmlItemNode parentItemNode = QmlItemNode(parentNode);
+ if (parentItemNode.isValid()) {
+ if (snapperUpdated == false && m_snapper.containerFormEditorItem() != m_view->scene()->itemForQmlItemNode(parentItemNode)) {
+ m_snapper.setContainerFormEditorItem(m_view->scene()->itemForQmlItemNode(parentItemNode));
+ m_snapper.setTransformtionSpaceFormEditorItem(m_snapper.containerFormEditorItem());
+ m_snapper.updateSnappingLines(m_itemList);
+ updateHashes();
+ snapperUpdated = true;
+ }
+ }
+ }
+ }
+
+ update(m_lastPosition, NoSnapping, UseBaseState);
+}
+
+void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList)
+{
+ if (m_view->model() && !m_itemList.isEmpty())
+ synchronizeParent(itemList, m_itemList.first()->qmlItemNode().instanceParent());
+
+}
+
void MoveManipulator::updateHashes()
{
// foreach (FormEditorItem* item, m_itemList)
@@ -239,6 +268,7 @@ QHash<FormEditorItem*, QRectF> MoveManipulator::tanslatedBoundingRects(const QHa
*/
void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated)
{
+ m_lastPosition = updatePoint;
deleteSnapLines(); //Since they position is changed and the item is moved the snapping lines are
//are obsolete. The new updated snapping lines (color and visibility) will be
//calculated in snapPoint() called in moveNode() later
@@ -311,6 +341,7 @@ void MoveManipulator::clear()
m_beginPositionHash.clear();
m_beginPositionInSceneSpaceHash.clear();
m_itemList.clear();
+ m_lastPosition = QPointF();
m_rewriterTransaction.commit();
@@ -332,24 +363,30 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent)
if (!itemsCanReparented())
return;
- foreach (FormEditorItem* item, m_itemList) {
- if (!item || !item->qmlItemNode().isValid())
- continue;
+ QVector<ModelNode> nodeReparentVector;
+ NodeAbstractProperty parentProperty;
- QmlItemNode parent(newParent->qmlItemNode());
- if (parent.isValid()) {
- if (parent.hasDefaultProperty())
- item->qmlItemNode().setParentProperty(parent.nodeAbstractProperty(parent.defaultProperty()));
- else
- item->qmlItemNode().setParentProperty(parent.nodeAbstractProperty("data"));
+ QmlItemNode parent(newParent->qmlItemNode());
+ if (parent.isValid()) {
+ if (parent.hasDefaultProperty()) {
+ parentProperty = parent.nodeAbstractProperty(parent.defaultProperty());
+ } else {
+ parentProperty = parent.nodeAbstractProperty("data");
}
- }
- if (m_view->model()) {
- m_snapper.setContainerFormEditorItem(newParent);
- m_snapper.setTransformtionSpaceFormEditorItem(m_snapper.containerFormEditorItem());
- m_snapper.updateSnappingLines(m_itemList);
- updateHashes();
+ foreach (FormEditorItem* item, m_itemList) {
+ if (!item || !item->qmlItemNode().isValid())
+ continue;
+
+ if (parentProperty != item->qmlItemNode().modelNode().parentProperty())
+ nodeReparentVector.append(item->qmlItemNode().modelNode());
+
+ }
+
+ foreach (const ModelNode &nodeToReparented, nodeReparentVector)
+ parentProperty.reparentHere(nodeToReparented);
+
+ synchronizeParent(m_itemList, parentProperty.parentModelNode());
}
}
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.h b/src/plugins/qmldesigner/components/formeditor/movemanipulator.h
index d24cb50716..671feef038 100644
--- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.h
+++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.h
@@ -69,7 +69,8 @@ public:
~MoveManipulator();
void setItems(const QList<FormEditorItem*> &itemList);
void setItem(FormEditorItem* item);
-
+ void synchronizeInstanceParent(const QList<FormEditorItem*> &itemList);
+ void synchronizeParent(const QList<FormEditorItem*> &itemList, const ModelNode &parentNode);
void begin(const QPointF& beginPoint);
void update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated = UseActualState);
void reparentTo(FormEditorItem *newParent);
@@ -122,6 +123,7 @@ private:
QList<QGraphicsItem*> m_graphicsLineList;
bool m_isActive;
RewriterTransaction m_rewriterTransaction;
+ QPointF m_lastPosition;
};
}
diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.cpp b/src/plugins/qmldesigner/components/formeditor/movetool.cpp
index 5b8226fff4..0b68938bc6 100644
--- a/src/plugins/qmldesigner/components/formeditor/movetool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/movetool.cpp
@@ -256,6 +256,11 @@ void MoveTool::instancesCompleted(const QList<FormEditorItem*> & /*itemList*/)
{
}
+void MoveTool::instancesParentChanged(const QList<FormEditorItem *> &itemList)
+{
+ m_moveManipulator.synchronizeInstanceParent(itemList);
+}
+
bool MoveTool::haveSameParent(const QList<FormEditorItem*> &itemList)
{
if (itemList.isEmpty())
diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.h b/src/plugins/qmldesigner/components/formeditor/movetool.h
index be9227f714..9225e09890 100644
--- a/src/plugins/qmldesigner/components/formeditor/movetool.h
+++ b/src/plugins/qmldesigner/components/formeditor/movetool.h
@@ -67,7 +67,8 @@ public:
void selectedItemsChanged(const QList<FormEditorItem*> &itemList);
- void instancesCompleted(const QList<FormEditorItem*> &/*itemList*/);
+ void instancesCompleted(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
void updateMoveManipulator();
diff --git a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp
index 3063daff4f..fca319def1 100644
--- a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp
@@ -196,8 +196,14 @@ void ResizeTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList)
m_resizeIndicator.updateItems(itemList);
}
- void ResizeTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
- {
- }
+void ResizeTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/)
+{
+}
+
+
+void ResizeTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/)
+{
+
+}
}
diff --git a/src/plugins/qmldesigner/components/formeditor/resizetool.h b/src/plugins/qmldesigner/components/formeditor/resizetool.h
index d7ffa7a050..68c935b676 100644
--- a/src/plugins/qmldesigner/components/formeditor/resizetool.h
+++ b/src/plugins/qmldesigner/components/formeditor/resizetool.h
@@ -67,9 +67,11 @@ public:
void clear();
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
void instancesCompleted(const QList<FormEditorItem*> &itemList);
+
private:
SelectionIndicator m_selectionIndicator;
ResizeIndicator m_resizeIndicator;
diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp
index 110c751293..b79bf484ab 100644
--- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp
@@ -275,6 +275,11 @@ void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*
{
}
+void SelectionTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/)
+{
+
+}
+
void SelectionTool::selectUnderPoint(QGraphicsSceneMouseEvent *event)
{
m_singleSelectionManipulator.begin(event->scenePos());
diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.h b/src/plugins/qmldesigner/components/formeditor/selectiontool.h
index d9b1edcc37..a08c38dcae 100644
--- a/src/plugins/qmldesigner/components/formeditor/selectiontool.h
+++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.h
@@ -80,6 +80,8 @@ public:
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList);
void instancesCompleted(const QList<FormEditorItem*> &itemList);
+ void instancesParentChanged(const QList<FormEditorItem *> &itemList);
+
void selectUnderPoint(QGraphicsSceneMouseEvent *event);
diff --git a/src/plugins/qmldesigner/components/integration/componentview.cpp b/src/plugins/qmldesigner/components/integration/componentview.cpp
index a2d818d4dd..539c57578d 100644
--- a/src/plugins/qmldesigner/components/integration/componentview.cpp
+++ b/src/plugins/qmldesigner/components/integration/componentview.cpp
@@ -212,6 +212,8 @@ void ComponentView::instanceInformationsChange(const QMultiHash<ModelNode, Infor
void ComponentView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/) {}
void ComponentView::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/) {}
void ComponentView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/) {}
+void ComponentView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) {}
+
void ComponentView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) {}
void ComponentView::rewriterBeginTransaction() {}
diff --git a/src/plugins/qmldesigner/components/integration/componentview.h b/src/plugins/qmldesigner/components/integration/componentview.h
index fef34556b5..3541fbc760 100644
--- a/src/plugins/qmldesigner/components/integration/componentview.h
+++ b/src/plugins/qmldesigner/components/integration/componentview.h
@@ -81,6 +81,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
+
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
index ead2ab44a1..41c0e819cc 100644
--- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
@@ -92,6 +92,11 @@ void DesignDocumentControllerView::instancesChildrenChanged(const QVector<ModelN
}
+void DesignDocumentControllerView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+
+}
+
void DesignDocumentControllerView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/)
{
diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
index a915eeb4cd..6725ab4ea4 100644
--- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
+++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
@@ -68,6 +68,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
+
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
index 0987c3fb31..c454f45cd7 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp
@@ -408,7 +408,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
bool valid = model->metaInfo(entry.typeName(), entry.majorVersion(), entry.minorVersion()).isValid();
- if (valid && (entry.requiredImport().isEmpty() || model->hasImport(entryToImport(entry), true) || entry.forceImport())) {
+ if (valid && (entry.requiredImport().isEmpty() || model->hasImport(entryToImport(entry), true, true) || entry.forceImport())) {
QString itemSectionName = entry.category();
ItemLibrarySectionModel *sectionModel;
ItemLibraryItemModel *itemModel;
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
index 611257b27f..27133cffde 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
@@ -172,6 +172,11 @@ void ItemLibraryView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeL
}
+void ItemLibraryView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+
+}
+
void ItemLibraryView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/)
{
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h
index 3c61139efe..576de22546 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h
@@ -84,6 +84,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
+
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
index 4b5c64a783..3fe167f2ee 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
@@ -379,6 +379,7 @@ void ItemLibraryWidget::emitImportChecked()
void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag)
{
+ return;
static bool block = false;
if (!m_d->model)
diff --git a/src/plugins/qmldesigner/components/logger/logger.cpp b/src/plugins/qmldesigner/components/logger/logger.cpp
index 5b3a331ae6..42c4013b27 100644
--- a/src/plugins/qmldesigner/components/logger/logger.cpp
+++ b/src/plugins/qmldesigner/components/logger/logger.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/logger/logger.h b/src/plugins/qmldesigner/components/logger/logger.h
index 9f574b8175..e5ff44d293 100644
--- a/src/plugins/qmldesigner/components/logger/logger.h
+++ b/src/plugins/qmldesigner/components/logger/logger.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp
index 0d9e194219..884ee0894b 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h
index a5340bbf28..70d5293562 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml b/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml
index 699fdeef6a..738d521e06 100644
--- a/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml
+++ b/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import Qt 4.7
Item {
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h
index f688102d4a..f41c825f90 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
index 19b6bfb068..924258029e 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
+++ b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import Qt 4.7
Rectangle {
diff --git a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp
index db005b6267..21013ecb0e 100644
--- a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp
+++ b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h
index f68b5b422a..bc27f95f88 100644
--- a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h
+++ b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp b/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp
index 20dde948b6..57655ce687 100644
--- a/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp
+++ b/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h
index 88fc9204c9..45b2a064d6 100644
--- a/src/plugins/qmldesigner/designercore/include/abstractview.h
+++ b/src/plugins/qmldesigner/designercore/include/abstractview.h
@@ -121,8 +121,11 @@ public:
void emitInstancesChildrenChanged(const QVector<ModelNode> &nodeList);
void emitRewriterBeginTransaction();
void emitRewriterEndTransaction();
+ void emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
void emitActualStateChanged(const ModelNode &node);
+ void sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector);
+
virtual void modelAttached(Model *model);
virtual void modelAboutToBeDetached(Model *model);
@@ -144,6 +147,8 @@ public:
virtual void instancesRenderImageChanged(const QVector<ModelNode> &nodeList) = 0;
virtual void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) = 0;
virtual void instancesChildrenChanged(const QVector<ModelNode> &nodeList) = 0;
+ virtual void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector) = 0;
+
virtual void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) = 0;
virtual void rewriterBeginTransaction() = 0;
diff --git a/src/plugins/qmldesigner/designercore/include/anchorline.h b/src/plugins/qmldesigner/designercore/include/anchorline.h
index 54d317719a..c41cebda88 100644
--- a/src/plugins/qmldesigner/designercore/include/anchorline.h
+++ b/src/plugins/qmldesigner/designercore/include/anchorline.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h b/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h
index bfa2eb6a2d..9110036c17 100644
--- a/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h
+++ b/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/model.h b/src/plugins/qmldesigner/designercore/include/model.h
index e5ce969dbe..b2d51001a4 100644
--- a/src/plugins/qmldesigner/designercore/include/model.h
+++ b/src/plugins/qmldesigner/designercore/include/model.h
@@ -104,7 +104,7 @@ public:
// Imports:
QList<Import> imports() const;
void changeImports(const QList<Import> &importsToBeAdded, const QList<Import> &importsToBeRemoved);
- bool hasImport(const Import &import, bool ignoreAlias = true);
+ bool hasImport(const Import &import, bool ignoreAlias = true, bool allowHigherVersion = false);
RewriterView *rewriterView() const;
diff --git a/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h b/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h
index b709522b26..fbfc93bc79 100644
--- a/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h
+++ b/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h b/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h
index 56baa0e420..08ec189174 100644
--- a/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h
+++ b/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h b/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h
index 6260a3461c..9e69201688 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h
@@ -47,6 +47,11 @@ class NodeAbstractProperty : public AbstractProperty
friend class QmlDesigner::ModelNode;
friend class QmlDesigner::Internal::ModelPrivate;
friend class QmlDesigner::AbstractProperty;
+
+ friend CORESHARED_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
+ friend CORESHARED_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
+ friend CORESHARED_EXPORT uint qHash(const NodeAbstractProperty& property);
+
public:
NodeAbstractProperty();
NodeAbstractProperty(const NodeAbstractProperty &property, AbstractView *view);
@@ -63,6 +68,13 @@ protected:
void reparentHere(const ModelNode &modelNode, bool isNodeList);
};
+
+CORESHARED_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
+CORESHARED_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
+CORESHARED_EXPORT uint qHash(const NodeAbstractProperty& property);
+CORESHARED_EXPORT QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property);
+CORESHARED_EXPORT QDebug operator<<(QDebug debug, const NodeAbstractProperty &property);
+
} // namespace QmlDesigner
#endif // NODEABSTRACTPROPERTY_H
diff --git a/src/plugins/qmldesigner/designercore/include/nodeanchors.h b/src/plugins/qmldesigner/designercore/include/nodeanchors.h
index 8b09513a4d..4486ccceae 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeanchors.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeanchors.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
index 1cc469b411..053da698e2 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
@@ -69,6 +69,8 @@ class ChangeIdsCommand;
class RemoveInstancesCommand;
class RemovePropertiesCommand;
class CompleteComponentCommand;
+class InformationContainer;
+class TokenCommand;
class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface
{
@@ -106,10 +108,12 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
+
void rewriterBeginTransaction();
void rewriterEndTransaction();
@@ -135,11 +139,14 @@ public:
void childrenChanged(const ChildrenChangedCommand &command);
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
void componentCompleted(const ComponentCompletedCommand &command);
+ void token(const TokenCommand &command);
QImage statePreviewImage(const ModelNode &stateNode) const;
void setPathToQt(const QString &pathToQt);
+ void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
+
signals:
void qmlPuppetCrashed();
@@ -161,6 +168,8 @@ private: // functions
void clearStateInstance();
NodeInstanceServerInterface *nodeInstanceServer() const;
+ QMultiHash<ModelNode, InformationName> informationChanged(const QVector<InformationContainer> &containerVector);
+
CreateSceneCommand createCreateSceneCommand();
ClearSceneCommand createClearSceneCommand() const;
diff --git a/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h b/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h
index 562a425f8a..db43ab5940 100644
--- a/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h
+++ b/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/propertybinding.h b/src/plugins/qmldesigner/designercore/include/propertybinding.h
index 775e124530..85487a1e4f 100644
--- a/src/plugins/qmldesigner/designercore/include/propertybinding.h
+++ b/src/plugins/qmldesigner/designercore/include/propertybinding.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
index 4b72f12481..d77bfbb6cb 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
@@ -98,6 +98,7 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
void rewriterBeginTransaction();
void rewriterEndTransaction();
diff --git a/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h b/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h
index baa92ffc6a..98d901f119 100644
--- a/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h
+++ b/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/rewriterview.h b/src/plugins/qmldesigner/designercore/include/rewriterview.h
index 2f3bf35e5c..e78b6e733a 100644
--- a/src/plugins/qmldesigner/designercore/include/rewriterview.h
+++ b/src/plugins/qmldesigner/designercore/include/rewriterview.h
@@ -143,6 +143,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
+
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/designercore/include/stylemanager.h b/src/plugins/qmldesigner/designercore/include/stylemanager.h
index 8af2b28f20..838e720d8a 100644
--- a/src/plugins/qmldesigner/designercore/include/stylemanager.h
+++ b/src/plugins/qmldesigner/designercore/include/stylemanager.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h b/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h
index 211c31b06c..83414ab514 100644
--- a/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h
+++ b/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/include/widgetqueryview.h b/src/plugins/qmldesigner/designercore/include/widgetqueryview.h
index 42de5494eb..5a87046bfb 100644
--- a/src/plugins/qmldesigner/designercore/include/widgetqueryview.h
+++ b/src/plugins/qmldesigner/designercore/include/widgetqueryview.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index daccbb77c8..8c8f1bef42 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -65,6 +65,7 @@
#include "imagecontainer.h"
#include "statepreviewimagechangedcommand.h"
#include "componentcompletedcommand.h"
+#include "tokencommand.h"
#include "synchronizecommand.h"
@@ -203,7 +204,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"),
tr("The executable of the QML Puppet process (%1) cannot be found. "
"Please check your installation. "
- "QML Puppet is a process which runs in the background to render the the items.").
+ "QML Puppet is a process which runs in the background to render the items.").
arg(applicationPath));
}
}
@@ -241,6 +242,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
+ static const int tokenCommandType = QMetaType::type("TokenCommand");
if (command.userType() == informationChangedCommandType)
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());
@@ -254,6 +256,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>());
else if (command.userType() == componentCompletedCommandType)
nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>());
+ else if (command.userType() == tokenCommandType)
+ nodeInstanceClient()->token(command.value<TokenCommand>());
else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
@@ -523,4 +527,9 @@ void NodeInstanceServerProxy::changeNodeSource(const ChangeNodeSourceCommand &co
writeCommand(QVariant::fromValue(command));
}
+void NodeInstanceServerProxy::token(const TokenCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
index 6197694df0..42bf3e95ce 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
@@ -71,6 +71,7 @@ public:
void changeState(const ChangeStateCommand &command);
void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command);
+ void token(const TokenCommand &command);
protected:
void writeCommand(const QVariant &command);
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 65c5a1bfba..b21add18e2 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -80,6 +80,7 @@
#include "statepreviewimagechangedcommand.h"
#include "completecomponentcommand.h"
#include "componentcompletedcommand.h"
+#include "tokencommand.h"
#include "nodeinstanceserverproxy.h"
@@ -483,6 +484,11 @@ void NodeInstanceView::instancesChildrenChanged(const QVector<ModelNode> &/*node
}
+void NodeInstanceView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+
+}
+
void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data)
{
if (node.isRootNode() && (name == "width" || name == "height")) {
@@ -1058,14 +1064,11 @@ void NodeInstanceView::pixmapChanged(const PixmapChangedCommand &command)
emitInstancesRenderImageChanged(renderImageChangeSet.toList().toVector());
}
-void NodeInstanceView::informationChanged(const InformationChangedCommand &command)
+QMultiHash<ModelNode, InformationName> NodeInstanceView::informationChanged(const QVector<InformationContainer> &containerVector)
{
- if (!model())
- return;
-
QMultiHash<ModelNode, InformationName> informationChangeHash;
- foreach(const InformationContainer &container, command.informations()) {
+ foreach (const InformationContainer &container, containerVector) {
if (hasInstanceForId(container.instanceId())) {
NodeInstance instance = instanceForId(container.instanceId());
if (instance.isValid()) {
@@ -1076,6 +1079,16 @@ void NodeInstanceView::informationChanged(const InformationChangedCommand &comma
}
}
+ return informationChangeHash;
+}
+
+void NodeInstanceView::informationChanged(const InformationChangedCommand &command)
+{
+ if (!model())
+ return;
+
+ QMultiHash<ModelNode, InformationName> informationChangeHash = informationChanged(command.informations());
+
if (!informationChangeHash.isEmpty())
emitInstanceInformationsChange(informationChangeHash);
}
@@ -1138,6 +1151,7 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
if (!model())
return;
+
QVector<ModelNode> childNodeVector;
foreach(qint32 instanceId, command.childrenInstances()) {
@@ -1148,8 +1162,39 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
}
}
+ QMultiHash<ModelNode, InformationName> informationChangeHash = informationChanged(command.informations());
+
+ if (!informationChangeHash.isEmpty())
+ emitInstanceInformationsChange(informationChangeHash);
+
if (!childNodeVector.isEmpty())
emitInstancesChildrenChanged(childNodeVector);
}
+void NodeInstanceView::token(const TokenCommand &command)
+{
+ if (!model())
+ return;
+
+ QVector<ModelNode> nodeVector;
+
+ foreach (const qint32 &instanceId, command.instances()) {
+ if (hasModelNodeForInternalId(instanceId)) {
+ nodeVector.append(modelNodeForInternalId(instanceId));
+ }
+ }
+
+
+ emitInstanceToken(command.tokenName(), command.tokenNumber(), nodeVector);
+}
+
+void NodeInstanceView::sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector)
+{
+ QVector<qint32> instanceIdVector;
+ foreach (const ModelNode &node, nodeVector)
+ instanceIdVector.append(node.internalId());
+
+ nodeInstanceServer()->token(TokenCommand(token, number, instanceIdVector));
+}
+
}
diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp
index 4117986b1e..b8f589b669 100644
--- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp
@@ -429,6 +429,18 @@ void AbstractView::emitRewriterBeginTransaction()
model()->m_d->notifyRewriterBeginTransaction();
}
+void AbstractView::sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector)
+{
+ if (nodeInstanceView())
+ nodeInstanceView()->sendToken(token, number, nodeVector);
+}
+
+void AbstractView::emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector)
+{
+ if (nodeInstanceView())
+ model()->m_d->notifyInstanceToken(token, number, nodeVector);
+}
+
void AbstractView::emitRewriterEndTransaction()
{
if (model())
diff --git a/src/plugins/qmldesigner/designercore/model/anchorline.cpp b/src/plugins/qmldesigner/designercore/model/anchorline.cpp
index ee8159ec50..b8fccdd4a8 100644
--- a/src/plugins/qmldesigner/designercore/model/anchorline.cpp
+++ b/src/plugins/qmldesigner/designercore/model/anchorline.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp b/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp
index 2df0d4246b..c067653070 100644
--- a/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp
+++ b/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/copyhelper.cpp b/src/plugins/qmldesigner/designercore/model/copyhelper.cpp
index 7a9502c658..1a7ea3b7a0 100644
--- a/src/plugins/qmldesigner/designercore/model/copyhelper.cpp
+++ b/src/plugins/qmldesigner/designercore/model/copyhelper.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/copyhelper.h b/src/plugins/qmldesigner/designercore/model/copyhelper.h
index bdfd9c8de5..61f531320e 100644
--- a/src/plugins/qmldesigner/designercore/model/copyhelper.h
+++ b/src/plugins/qmldesigner/designercore/model/copyhelper.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp
index 18404c3054..938026c3f9 100644
--- a/src/plugins/qmldesigner/designercore/model/model.cpp
+++ b/src/plugins/qmldesigner/designercore/model/model.cpp
@@ -681,6 +681,36 @@ void ModelPrivate::notifyRewriterEndTransaction()
}
}
+void ModelPrivate::notifyInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector)
+{
+ bool resetModel = false;
+ QString description;
+
+ QVector<Internal::InternalNode::Pointer> internalVector(toInternalNodeVector(nodeVector));
+
+
+ try {
+ if (rewriterView())
+ rewriterView()->instancesToken(token, number, toModelNodeVector(internalVector, rewriterView()));
+ } catch (RewritingException &e) {
+ description = e.description();
+ resetModel = true;
+ }
+
+ foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
+ Q_ASSERT(view != 0);
+ view->instancesToken(token, number, toModelNodeVector(internalVector, view.data()));
+ }
+
+ if (nodeInstanceView()) {
+ nodeInstanceView()->instancesToken(token, number, toModelNodeVector(internalVector, nodeInstanceView()));
+ }
+
+ if (resetModel) {
+ resetModelByRewriter(description);
+ }
+}
+
void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
{
bool resetModel = false;
@@ -1742,7 +1772,39 @@ void Model::changeImports(const QList<Import> &importsToBeAdded, const QList<Imp
m_d->changeImports(importsToBeAdded, importsToBeRemoved);
}
-bool Model::hasImport(const Import &import, bool ignoreAlias)
+
+static bool compareVersions(const QString &version1, const QString &version2, bool allowHigherVersion)
+{
+ if (version1 == version2)
+ return true;
+ if (!allowHigherVersion)
+ return false;
+ QStringList version1List = version1.split('.');
+ QStringList version2List = version2.split('.');
+ if (version1List.count() == 2 && version2List.count() == 2) {
+ bool ok;
+ int major1 = version1List.first().toInt(&ok);
+ if (!ok)
+ return false;
+ int major2 = version2List.first().toInt(&ok);
+ if (!ok)
+ return false;
+ if (major1 >= major2) {
+ int minor1 = version1List.last().toInt(&ok);
+ if (!ok)
+ return false;
+ int minor2 = version2List.last().toInt(&ok);
+ if (!ok)
+ return false;
+ if (minor1 >= minor2)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Model::hasImport(const Import &import, bool ignoreAlias, bool allowHigherVersion)
{
if (imports().contains(import))
return true;
@@ -1751,10 +1813,10 @@ bool Model::hasImport(const Import &import, bool ignoreAlias)
foreach (const Import &existingImport, imports()) {
if (existingImport.isFileImport() && import.isFileImport())
- if (existingImport.file() == import.file() && existingImport.version() == import.version())
+ if (existingImport.file() == import.file() && compareVersions(existingImport.version(), import.version(), allowHigherVersion))
return true;
if (existingImport.isLibraryImport() && import.isLibraryImport())
- if (existingImport.url() == import.url() && existingImport.version() == import.version())
+ if (existingImport.url() == import.url() && compareVersions(existingImport.version(), import.version(), allowHigherVersion))
return true;
}
return false;
diff --git a/src/plugins/qmldesigner/designercore/model/model_p.h b/src/plugins/qmldesigner/designercore/model/model_p.h
index c806b1b82a..bc6ff14564 100644
--- a/src/plugins/qmldesigner/designercore/model/model_p.h
+++ b/src/plugins/qmldesigner/designercore/model/model_p.h
@@ -156,12 +156,13 @@ public:
void notifyInstancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void notifyInstancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void notifyInstancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void notifyInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
+
void notifyActualStateChanged(const ModelNode &node);
void notifyRewriterBeginTransaction();
void notifyRewriterEndTransaction();
-
void setSelectedNodes(const QList<InternalNodePointer> &selectedNodeList);
void clearSelectedNodes();
QList<InternalNodePointer> selectedNodes() const;
diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
index 780c090730..88cb7278a5 100644
--- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
+++ b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "modelnodecontextmenu.h"
#include <QApplication>
#include <coreplugin/editormanager/editormanager.h>
diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
index bbec61c210..df37142954 100644
--- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
+++ b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef MODELNODECONTEXTMENU_H
#define MODELNODECONTEXTMENU_H
diff --git a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp
index e57f6f2417..a13345493f 100644
--- a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp
+++ b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/modelrewriter.h b/src/plugins/qmldesigner/designercore/model/modelrewriter.h
index fdbb214848..05f358fa98 100644
--- a/src/plugins/qmldesigner/designercore/model/modelrewriter.h
+++ b/src/plugins/qmldesigner/designercore/model/modelrewriter.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp b/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp
index 5451717da3..dbadf522ce 100644
--- a/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp
+++ b/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp b/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp
index 530269f22a..8ebd1d4a7e 100644
--- a/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp
+++ b/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp
@@ -141,4 +141,36 @@ QList<ModelNode> NodeAbstractProperty::allSubNodes()
return toModelNodeList(property->allSubNodes(), view());
}
+/*!
+ \brief Returns if the the two property handles reference the same property in the same node
+*/
+bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2)
+{
+ return AbstractProperty(property1) == AbstractProperty(property2);
+}
+
+/*!
+ \brief Returns if the the two property handles do not reference the same property in the same node
+ */
+bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2)
+{
+ return !(property1 == property2);
+}
+
+uint qHash(const NodeAbstractProperty &property)
+{
+ return qHash(AbstractProperty(property));
+}
+
+QDebug operator<<(QDebug debug, const NodeAbstractProperty &property)
+{
+ return debug.nospace() << "NodeAbstractProperty(" << (property.isValid() ? property.name() : QLatin1String("invalid")) << ')';
+}
+
+QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property)
+{
+ stream << "NodeAbstractProperty(" << property.name() << ')';
+
+ return stream;
+}
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp b/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp
index 83a1ac5144..e58778d5be 100644
--- a/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp
+++ b/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp b/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp
index 771b0f0146..f541abb87e 100644
--- a/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp
+++ b/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/parsedqml.cpp b/src/plugins/qmldesigner/designercore/model/parsedqml.cpp
index 733c31c38f..543703df04 100644
--- a/src/plugins/qmldesigner/designercore/model/parsedqml.cpp
+++ b/src/plugins/qmldesigner/designercore/model/parsedqml.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/parsedqml.h b/src/plugins/qmldesigner/designercore/model/parsedqml.h
index 0bba6c57b8..9b4cbecc7d 100644
--- a/src/plugins/qmldesigner/designercore/model/parsedqml.h
+++ b/src/plugins/qmldesigner/designercore/model/parsedqml.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/paster.cpp b/src/plugins/qmldesigner/designercore/model/paster.cpp
index d8dcb79f3f..52f29146c6 100644
--- a/src/plugins/qmldesigner/designercore/model/paster.cpp
+++ b/src/plugins/qmldesigner/designercore/model/paster.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/paster.h b/src/plugins/qmldesigner/designercore/model/paster.h
index 38ccc01b9e..3f9d07c392 100644
--- a/src/plugins/qmldesigner/designercore/model/paster.h
+++ b/src/plugins/qmldesigner/designercore/model/paster.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/propertybinding.cpp b/src/plugins/qmldesigner/designercore/model/propertybinding.cpp
index 792321f0d3..d88ce07e8c 100644
--- a/src/plugins/qmldesigner/designercore/model/propertybinding.cpp
+++ b/src/plugins/qmldesigner/designercore/model/propertybinding.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
index 682a6e2d4a..ceec3fbd21 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
@@ -196,7 +196,7 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE
}
}
- if (!model()->hasImport(newImport, true)) {
+ if (!model()->hasImport(newImport, true, true)) {
model()->changeImports(QList<Import>() << newImport, QList<Import>());
}
}
@@ -414,6 +414,11 @@ void QmlModelView::importsChanged(const QList<Import> &/*addedImports*/, const Q
}
+void QmlModelView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+
+}
+
void QmlModelView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/)
{
diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
index 6b1d820012..a2ce780006 100644
--- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
@@ -407,6 +407,11 @@ void RewriterView::instancesChildrenChanged(const QVector<ModelNode> & /*nodeLis
}
+void RewriterView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+{
+
+}
+
void RewriterView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/)
{
diff --git a/src/plugins/qmldesigner/designercore/model/viewlogger.cpp b/src/plugins/qmldesigner/designercore/model/viewlogger.cpp
index b49a2358a9..2bb3e4eadc 100644
--- a/src/plugins/qmldesigner/designercore/model/viewlogger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/viewlogger.cpp
@@ -260,6 +260,13 @@ void ViewLogger::instancesChildrenChanged(const QVector<ModelNode> &nodeList)
m_output << time() << indent("node: ") << node << endl;
}
+void ViewLogger::instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector)
+{
+ m_output << time() << indent("instancesToken:") << tokenName << tokenNumber << endl;
+ foreach (const ModelNode &node, nodeVector)
+ m_output << time() << indent("node: ") << node << endl;
+}
+
void ViewLogger::nodeSourceChanged(const ModelNode &node, const QString & /*newNodeSource*/)
{
m_output << time() << indent("nodeSourceChanged:") << endl;
diff --git a/src/plugins/qmldesigner/designercore/model/viewlogger.h b/src/plugins/qmldesigner/designercore/model/viewlogger.h
index 01fc89ca25..2ca8ffa5e7 100644
--- a/src/plugins/qmldesigner/designercore/model/viewlogger.h
+++ b/src/plugins/qmldesigner/designercore/model/viewlogger.h
@@ -81,6 +81,8 @@ public:
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
+ void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
+
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp b/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp
index 3957af5ff6..09e89a6df8 100644
--- a/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp
+++ b/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/qmlcontextpane.cpp b/src/plugins/qmldesigner/qmlcontextpane.cpp
index 64cac4cf49..447a69fbe3 100644
--- a/src/plugins/qmldesigner/qmlcontextpane.cpp
+++ b/src/plugins/qmldesigner/qmlcontextpane.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/qmlcontextpane.h b/src/plugins/qmldesigner/qmlcontextpane.h
index 63d334c6db..9bc72eb950 100644
--- a/src/plugins/qmldesigner/qmlcontextpane.h
+++ b/src/plugins/qmldesigner/qmlcontextpane.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml b/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml
index 508edc8b83..3fd0503bb7 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml
@@ -1,8 +1,42 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
GridView {
- width: 200
- height: 200
+ width: 140
+ height: 140
+ cellWidth: 70
+ cellHeight: 70
model: ListModel {
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml
index 3f4f90abd3..5c5277e1f4 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml
@@ -1,7 +1,39 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
ListView {
- width: 160
+ width: 110
height: 160
model: ListModel {
ListElement {
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml b/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml
index 13b3f543c5..2eea6619e5 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml
@@ -1,8 +1,40 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
PathView {
width: 250
- height: 200
+ height: 130
path: Path {
startX: 120
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/text.qml b/src/plugins/qmldesigner/qtquickplugin/source/text.qml
index 088dfdd124..10a9aabc82 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/text.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/text.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
Text {
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml b/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml
index ac1bc18b44..87254f21c4 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
Text {
diff --git a/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml b/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml
index d78a430d03..423e599993 100644
--- a/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml
+++ b/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
Text {
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index bda56d06c3..1784c3cb9d 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -777,7 +777,9 @@ void QmlJSCompletionAssistProcessor::addCompletionsPropertyLhs(const QHash<QStri
it.next();
QString itemText = it.key();
- QLatin1String postfix(": ");
+ QString postfix;
+ if (!itemText.isEmpty() && itemText.at(0).isLower())
+ postfix = QLatin1String(": ");
if (afterOn)
postfix = QLatin1String(" {");
if (const Interpreter::QmlObjectValue *qmlValue =
diff --git a/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp b/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp
index d372482298..60a2a29f2d 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp
+++ b/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "qmljscodestylesettingsfactory.h"
#include "qmljscodestylesettingspage.h"
#include "qmljstoolsconstants.h"
diff --git a/src/plugins/qmljstools/qmljscodestylesettingsfactory.h b/src/plugins/qmljstools/qmljscodestylesettingsfactory.h
index 321f564e92..7efba77933 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingsfactory.h
+++ b/src/plugins/qmljstools/qmljscodestylesettingsfactory.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef QMLJSCODESTYLESETTINGSFACTORY_H
#define QMLJSCODESTYLESETTINGSFACTORY_H
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
index 40f2eccdb3..7be5e33184 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "qmljscodestylesettingspage.h"
#include "ui_qmljscodestylesettingspage.h"
#include "qmljstoolsconstants.h"
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.h b/src/plugins/qmljstools/qmljscodestylesettingspage.h
index 733160ba43..7629233203 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.h
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef QMLJSCODESTYLESETTINGSPAGE_H
#define QMLJSCODESTYLESETTINGSPAGE_H
diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp
index d471b7e18e..e1f161f129 100644
--- a/src/plugins/qmljstools/qmljstoolssettings.cpp
+++ b/src/plugins/qmljstools/qmljstoolssettings.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "qmljstoolssettings.h"
#include "qmljstoolsconstants.h"
diff --git a/src/plugins/qmljstools/qmljstoolssettings.h b/src/plugins/qmljstools/qmljstoolssettings.h
index 9eb8b657c5..8bc0e10461 100644
--- a/src/plugins/qmljstools/qmljstoolssettings.h
+++ b/src/plugins/qmljstools/qmljstoolssettings.h
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
index e66ef7c3dd..06c27d12b4 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#include "qdeclarativecanvas_p.h"
#include "qdeclarativecanvastimer_p.h"
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
index d7601d35e3..b43eefecef 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#ifndef QDECLARATIVECANVAS_P_H
#define QDECLARATIVECANVAS_P_H
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp
index c5efd4f1b4..44a3d3b56b 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#include <QtScript/qscriptengine.h>
#include <QtScript/qscriptvalue.h>
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h
index f77a5685cb..17ad439adf 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#ifndef QDECLARATIVECANVASTIMER_P_H
#define QDECLARATIVECANVASTIMER_P_H
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
index ed9d73d3ff..ddaa3d4d95 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#include "qdeclarativecontext2d_p.h"
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
index 73575fdb61..5d6048d449 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#ifndef QDECLARATIVECONTEXT2D_P_H
#define QDECLARATIVECONTEXT2D_P_H
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h
index ce8346007b..6a0a21ee19 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h
+++ b/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h
@@ -1,43 +1,34 @@
-/****************************************************************************
+/**************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (info@qt.nokia.com)
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** 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 info@qt.nokia.com.
-**
-**
+** Other Usage
**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+**************************************************************************/
#ifndef QDECLARATIVETILEDCANVAS_P_H
#define QDECLARATIVETILEDCANVAS_P_H
@@ -52,7 +43,37 @@ QT_MODULE(Declarative)
class Context2D;
class TiledCanvas : public QDeclarativeItem
{
- Q_OBJECT
+ Q_OBJECT/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
Q_PROPERTY(QSizeF canvasSize READ canvasSize WRITE setCanvasSize NOTIFY canvasSizeChanged)
Q_PROPERTY(QSize tileSize READ tileSize WRITE setTileSize NOTIFY tileSizeChanged)
diff --git a/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp
index 4e4b91559c..a2414b8f3b 100644
--- a/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
@@ -50,7 +49,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur
QObject *parent) :
AbstractQmlProfilerRunner(parent),
m_configuration(configuration),
- m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE))
+ m_runControl(new CodaRunControl(configuration, "QmlProfiler"))
{
connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped()));
connect(m_runControl,
diff --git a/src/plugins/qmlprofiler/codaqmlprofilerrunner.h b/src/plugins/qmlprofiler/codaqmlprofilerrunner.h
index 82dbe97d39..e9e931713f 100644
--- a/src/plugins/qmlprofiler/codaqmlprofilerrunner.h
+++ b/src/plugins/qmlprofiler/codaqmlprofilerrunner.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
index 38eb80e78d..98762b82e8 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
index c50ed76202..2a8b7031b2 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qml/Detail.qml b/src/plugins/qmlprofiler/qml/Detail.qml
index 815130c6af..c0ec386b84 100644
--- a/src/plugins/qmlprofiler/qml/Detail.qml
+++ b/src/plugins/qmlprofiler/qml/Detail.qml
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qml/Label.qml b/src/plugins/qmlprofiler/qml/Label.qml
index f1fa86b567..abe28391bb 100644
--- a/src/plugins/qmlprofiler/qml/Label.qml
+++ b/src/plugins/qmlprofiler/qml/Label.qml
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qml/MainView.js b/src/plugins/qmlprofiler/qml/MainView.js
index bbdc25cfa9..bd4752d071 100644
--- a/src/plugins/qmlprofiler/qml/MainView.js
+++ b/src/plugins/qmlprofiler/qml/MainView.js
@@ -36,7 +36,6 @@
var values = [ ]; //events
var ranges = [ ];
var frameFps = [ ];
-var valuesdone = false;
var xmargin = 0;
var ymargin = 0;
var drawFpsGraph = false;
@@ -55,7 +54,6 @@ function reset()
frameFps = [];
xmargin = 0;
ymargin = 0;
- valuesdone = false;
nestingDepth = [];
}
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index 635b4ef8fb..b66c73396b 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -38,9 +37,7 @@ import "MainView.js" as Plotter
Rectangle {
id: root
- property variant colors: Plotter.colors //the colors used for the timeline data
- property bool xRay: false //useful for seeing "nested" ranges (but redraw is buggy -- QGV problem?)
- property Item currentItem //currently selected item in the view
+ property bool dataAvailable: false;
// move the cursor in the editor
signal updateCursorPosition
@@ -55,6 +52,7 @@ Rectangle {
function clearData() {
Plotter.reset();
view.clearData();
+ root.dataAvailable = false;
rangeMover.x = 2
rangeMover.opacity = 0
}
@@ -62,7 +60,6 @@ Rectangle {
function clearAll() {
clearData();
selectedEventIndex = -1;
- Plotter.valuesdone = false;
canvas.requestPaint();
view.visible = false;
root.elapsedTime = 0;
@@ -132,21 +129,21 @@ Rectangle {
Connections {
target: connection
onEvent: {
- if (Plotter.valuesdone) {
+ if (root.dataAvailable) {
root.clearData();
}
- if (!Plotter.valuesdone && event === 0) //### only handle paint event
+ if (!root.dataAvailable && event === 0) //### only handle paint event
Plotter.values.push(time);
}
onRange: {
- if (Plotter.valuesdone) {
+ if (root.dataAvailable) {
root.clearData();
}
// todo: consider nestingLevel
- if (!Plotter.valuesdone) {
+ if (!root.dataAvailable) {
if (!Plotter.nestingDepth[type])
Plotter.nestingDepth[type] = nestingInType;
else
@@ -158,7 +155,7 @@ Rectangle {
}
onComplete: {
- Plotter.valuesdone = true;
+ root.dataAvailable = true;
Plotter.calcFps();
view.visible = true;
view.setRanges(Plotter.ranges);
@@ -264,7 +261,7 @@ Rectangle {
delegate: Rectangle {
id: obj
- property color baseColor: colors[type]
+ property color baseColor: Plotter.colors[type]
property color myColor: baseColor
function conditionalHide() {
@@ -302,7 +299,6 @@ Rectangle {
}
function enableSelected(x,y) {
- currentItem = obj
myColor = Qt.darker(baseColor, 1.2)
rangeDetails.duration = duration
rangeDetails.label = label
@@ -429,7 +425,7 @@ Rectangle {
canvasWindow.height: height
onDrawRegion: {
- if (Plotter.valuesdone)
+ if (root.dataAvailable)
Plotter.plot(canvas, ctxt, region);
else
Plotter.drawGraph(canvas, ctxt, region) //just draw the background
diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml
index 3b817e28c9..7b4207f0af 100644
--- a/src/plugins/qmlprofiler/qml/RangeDetails.qml
+++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qml/RangeMover.qml b/src/plugins/qmlprofiler/qml/RangeMover.qml
index 193921c688..14443783b8 100644
--- a/src/plugins/qmlprofiler/qml/RangeMover.qml
+++ b/src/plugins/qmlprofiler/qml/RangeMover.qml
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
index 026846f900..24dd47d8cf 100644
--- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml
+++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
import QtQuick 1.0
import Monitor 1.0
import "MainView.js" as Plotter
@@ -126,7 +158,7 @@ TiledCanvas {
var timeDisplayBeginTime = Math.min(bt, et);
var timeDisplayEndTime = Math.max(bt, et);
- timeDisplayText.text = qsTr("length:")+detailedPrintTime(timeDisplayEndTime-timeDisplayBeginTime);
+ timeDisplayText.text = qsTr("length: %1").arg(detailedPrintTime(timeDisplayEndTime-timeDisplayBeginTime));
timeDisplayEnd.visible = true;
timeDisplayEnd.x = xpos + flick.x
}
diff --git a/src/plugins/qmlprofiler/qml/analyzer_category_small.png b/src/plugins/qmlprofiler/qml/analyzer_category_small.png
deleted file mode 100644
index 5bc90fbf91..0000000000
--- a/src/plugins/qmlprofiler/qml/analyzer_category_small.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/qmlprofiler/qml/qml.qrc b/src/plugins/qmlprofiler/qml/qml.qrc
index 822e2096d0..acb92c1d77 100644
--- a/src/plugins/qmlprofiler/qml/qml.qrc
+++ b/src/plugins/qmlprofiler/qml/qml.qrc
@@ -5,16 +5,15 @@
<file>MainView.js</file>
<file>MainView.qml</file>
<file>popup.png</file>
- <file>range.png</file>
<file>RangeDetails.qml</file>
<file>RangeMover.qml</file>
- <file>analyzer_category_small.png</file>
<file>TimeDisplay.qml</file>
<file>clean_pane_small.png</file>
<file>prev.png</file>
<file>next.png</file>
- <file>toolbarbg.png</file>
<file>magnifier-minus.png</file>
<file>magnifier-plus.png</file>
+ <file>recordOff.png</file>
+ <file>recordOn.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/qmlprofiler/qml/range.png b/src/plugins/qmlprofiler/qml/range.png
deleted file mode 100644
index 2ac200fe18..0000000000
--- a/src/plugins/qmlprofiler/qml/range.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/qmlprofiler/qml/recordOff.png b/src/plugins/qmlprofiler/qml/recordOff.png
new file mode 100644
index 0000000000..66f4e3b36b
--- /dev/null
+++ b/src/plugins/qmlprofiler/qml/recordOff.png
Binary files differ
diff --git a/src/plugins/qmlprofiler/qml/recordOn.png b/src/plugins/qmlprofiler/qml/recordOn.png
new file mode 100644
index 0000000000..5d4b77f0f2
--- /dev/null
+++ b/src/plugins/qmlprofiler/qml/recordOn.png
Binary files differ
diff --git a/src/plugins/qmlprofiler/qml/toolbarbg.png b/src/plugins/qmlprofiler/qml/toolbarbg.png
deleted file mode 100644
index a94d5465b5..0000000000
--- a/src/plugins/qmlprofiler/qml/toolbarbg.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro
index 1aa41fbe83..69ed6b3c45 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.pro
+++ b/src/plugins/qmlprofiler/qmlprofiler.pro
@@ -23,14 +23,12 @@ SOURCES += \
tracewindow.cpp \
timelineview.cpp \
qmlprofilerattachdialog.cpp \
- qmlprofilersummaryview.cpp \
- qmlprojectanalyzerruncontrolfactory.cpp \
localqmlprofilerrunner.cpp \
codaqmlprofilerrunner.cpp \
remotelinuxqmlprofilerrunner.cpp \
- qmlprofilercalleeview.cpp \
- qmlprofilercallerview.cpp \
- qmlprofilertraceclient.cpp
+ qmlprofilertraceclient.cpp \
+ qmlprofilereventview.cpp \
+ qmlprofilerruncontrolfactory.cpp
HEADERS += \
qmlprofilerconstants.h \
@@ -41,15 +39,14 @@ HEADERS += \
tracewindow.h \
timelineview.h \
qmlprofilerattachdialog.h \
- qmlprofilersummaryview.h \
- qmlprojectanalyzerruncontrolfactory.h \
abstractqmlprofilerrunner.h \
localqmlprofilerrunner.h \
codaqmlprofilerrunner.h \
remotelinuxqmlprofilerrunner.h \
- qmlprofilercalleeview.h \
- qmlprofilercallerview.h \
- qmlprofilertraceclient.h
+ qmlprofilertraceclient.h \
+ qmlprofilereventview.h \
+ qmlprofilereventtypes.h \
+ qmlprofilerruncontrolfactory.h
RESOURCES += \
qml/qml.qrc
diff --git a/src/plugins/qmlprofiler/qmlprofiler_global.h b/src/plugins/qmlprofiler/qmlprofiler_global.h
index ac97df4bf4..a241f0615f 100644
--- a/src/plugins/qmlprofiler/qmlprofiler_global.h
+++ b/src/plugins/qmlprofiler/qmlprofiler_global.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp b/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp
deleted file mode 100644
index 71fd7677b9..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "qmlprofilercalleeview.h"
-
-#include <QtCore/QUrl>
-#include <QtCore/QHash>
-
-#include <QtGui/QHeaderView>
-#include <QtGui/QStandardItemModel>
-
-using namespace QmlProfiler::Internal;
-
-struct BindingData
-{
- BindingData() :
- displayname(0), filename(0), location(0), details(0),
- line(-1), rangeType(-1), level(-1), childrenHash(0), parentBinding(0) {}
-
- ~BindingData() {
- delete displayname;
- delete filename;
- delete location;
- delete childrenHash;
- }
- QString *displayname;
- QString *filename;
- QString *location;
- QString *details;
- int line;
- int rangeType;
- qint64 level;
- QHash<QString, BindingData *> *childrenHash;
-
- // reference to parent binding stored in the hash
- BindingData *parentBinding;
-};
-
-typedef QHash<QString, BindingData *> BindingHash;
-
-enum ItemRole {
- LocationRole = Qt::UserRole+1,
- FilenameRole = Qt::UserRole+2,
- LineRole = Qt::UserRole+3
-};
-
-class QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate
-{
-public:
- QmlProfilerCalleeViewPrivate(QmlProfilerCalleeView *qq) : q(qq) {}
-
- void recursiveClearHash(BindingHash *hash);
- void buildModelFromHash( BindingHash *hash, QStandardItem *parentItem );
-
- QmlProfilerCalleeView *q;
-
- QStandardItemModel *m_model;
-// ToDo: avoid unnecessary allocations by using global hash
-// BindingHash m_globalHash;
- BindingHash m_rootHash;
- QList<BindingData *> m_bindingBuffer;
-};
-
-QmlProfilerCalleeView::QmlProfilerCalleeView(QWidget *parent) :
- QTreeView(parent), d(new QmlProfilerCalleeViewPrivate(this))
-{
- setObjectName("QmlProfilerCalleeView");
- setRootIsDecorated(true);
- header()->setResizeMode(QHeaderView::Interactive);
- header()->setMinimumSectionSize(50);
- setSortingEnabled(false);
- setFrameStyle(QFrame::NoFrame);
-
- d->m_model = new QStandardItemModel(this);
-
- setModel(d->m_model);
-
- d->m_model->setColumnCount(3);
- setHeaderLabels();
-
- connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex)));
-}
-
-QmlProfilerCalleeView::~QmlProfilerCalleeView()
-{
- clean();
- delete d->m_model;
-}
-
-void QmlProfilerCalleeView::clean()
-{
- d->m_model->clear();
- d->m_model->setColumnCount(3);
-
- // clean the hashes
- d->recursiveClearHash(&d->m_rootHash);
-
- setHeaderLabels();
- setSortingEnabled(false);
-}
-
-void QmlProfilerCalleeView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line)
-{
- Q_UNUSED(startTime);
- Q_UNUSED(nestingInType);
- Q_UNUSED(length);
-
- const QChar colon = QLatin1Char(':');
- QString localName, displayName, location, details;
-
- if (fileName.isEmpty()) {
- displayName = tr("<bytecode>");
- location = QLatin1String("--");
-
- } else {
- localName = QUrl(fileName).toLocalFile();
- displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line);
- location = fileName+colon+QString::number(line);
- }
-
- if (data.isEmpty())
- details = tr("Source code not available");
- else
- details = data.join(" ").replace('\n'," ");
-
- // ToDo: instead of allocating each new event, store them in the global hash
- BindingData *newBinding = new BindingData;
- newBinding->displayname = new QString(displayName);
- newBinding->filename = new QString(fileName);
- newBinding->line = line;
- newBinding->level = nestingLevel;
- newBinding->rangeType = type;
- newBinding->location = new QString(location);
- newBinding->details = new QString(details);
- newBinding->childrenHash = 0;
-
- d->m_bindingBuffer.prepend(newBinding);
-
- if (nestingLevel == 1) {
- // top level: insert buffered stuff
- BindingHash *currentHash = &(d->m_rootHash);
- BindingData *lastBinding = 0;
- int lastLevel = 0;
-
- while (d->m_bindingBuffer.length()) {
- BindingData *bindingInfo = d->m_bindingBuffer.at(0);
- // find the data's place
- if (bindingInfo->level > lastLevel) {
- currentHash = lastBinding ? lastBinding->childrenHash : &(d->m_rootHash);
- bindingInfo->parentBinding = lastBinding;
- ++lastLevel;
- } else if (bindingInfo->level == lastLevel) {
- bindingInfo->parentBinding = lastBinding->parentBinding;
- } else if (bindingInfo->level < lastLevel) {
- while (bindingInfo->level < lastLevel) {
- bindingInfo->parentBinding = lastBinding->parentBinding ? lastBinding->parentBinding->parentBinding : 0;
- currentHash = bindingInfo->parentBinding ? bindingInfo->parentBinding->childrenHash : &(d->m_rootHash);
- --lastLevel;
- }
- }
-
- BindingHash::iterator it = currentHash->find(*bindingInfo->location);
- if (it == currentHash->end()) {
- bindingInfo->childrenHash = new BindingHash;
- currentHash->insert(*bindingInfo->location, bindingInfo);
- lastBinding = bindingInfo;
- } else {
- lastBinding = it.value();
- delete bindingInfo;
- }
-
- d->m_bindingBuffer.removeFirst();
- }
- }
-}
-
-void QmlProfilerCalleeView::complete()
-{
- // build the model from the hashed data
- d->buildModelFromHash( &d->m_rootHash, d->m_model->invisibleRootItem());
-
- expandAll();
- resizeColumnToContents(0);
- resizeColumnToContents(1);
-}
-
-void QmlProfilerCalleeView::jumpToItem(const QModelIndex &index)
-{
- QStandardItem *clickedItem = d->m_model->itemFromIndex(index);
- QStandardItem *infoItem;
- if (clickedItem->parent())
- infoItem = clickedItem->parent()->child(clickedItem->row(), 0);
- else
- infoItem = d->m_model->item(index.row(), 0);
-
- int line = infoItem->data(LineRole).toInt();
- if (line == -1)
- return;
- QString fileName = infoItem->data(FilenameRole).toString();
- emit gotoSourceLocation(fileName, line);
-}
-
-void QmlProfilerCalleeView::setHeaderLabels()
-{
- d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location")));
- d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Type")));
- d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Details")));
-}
-
-void QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate::recursiveClearHash(BindingHash *hash) {
- QHashIterator<QString, BindingData *> it(*hash);
- while (it.hasNext()) {
- it.next();
- if (it.value()->childrenHash)
- recursiveClearHash(it.value()->childrenHash);
- delete it.value();
- }
- hash->clear();
-}
-
-inline QString nameForType(int typeNumber)
-{
- switch (typeNumber) {
- case 0: return QmlProfilerCalleeView::tr("Paint");
- case 1: return QmlProfilerCalleeView::tr("Compile");
- case 2: return QmlProfilerCalleeView::tr("Create");
- case 3: return QmlProfilerCalleeView::tr("Binding");
- case 4: return QmlProfilerCalleeView::tr("Signal");
- }
- return QString();
-}
-
-void QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate::buildModelFromHash( BindingHash *hash, QStandardItem *parentItem )
-{
- QHashIterator<QString, BindingData *> it(*hash);
-
- while (it.hasNext()) {
- it.next();
- BindingData *binding = it.value();
-
- QStandardItem *nameColumn = new QStandardItem(*binding->displayname);
- nameColumn->setEditable(false);
-
- QStandardItem *typeColumn = new QStandardItem(nameForType(binding->rangeType));
- typeColumn->setEditable(false);
-
- QStandardItem *detailsColumn = new QStandardItem(*binding->details);
- detailsColumn->setEditable(false);
-
- QStandardItem *firstColumn = nameColumn;
- firstColumn->setData(QVariant(*binding->location),LocationRole);
- firstColumn->setData(QVariant(*binding->filename),FilenameRole);
- firstColumn->setData(QVariant(binding->line),LineRole);
-
- QList<QStandardItem *> newRow;
- newRow << nameColumn << typeColumn << detailsColumn;
- parentItem->appendRow(newRow);
- if (!binding->childrenHash->isEmpty())
- buildModelFromHash(binding->childrenHash, nameColumn);
- }
-}
diff --git a/src/plugins/qmlprofiler/qmlprofilercalleeview.h b/src/plugins/qmlprofiler/qmlprofilercalleeview.h
deleted file mode 100644
index 715a006edd..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilercalleeview.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef QMLPROFILERCALLEEVIEW_H
-#define QMLPROFILERCALLEEVIEW_H
-
-#include <QTreeView>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerCalleeView : public QTreeView
-{
- Q_OBJECT
-
-public:
- explicit QmlProfilerCalleeView(QWidget *parent = 0);
- ~QmlProfilerCalleeView();
-
-signals:
- void gotoSourceLocation(const QString &fileName, int lineNumber);
-
-public slots:
- void clean();
-
- void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line);
- void complete();
- void jumpToItem(const QModelIndex &index);
-
-private:
- class QmlProfilerCalleeViewPrivate;
- QmlProfilerCalleeViewPrivate *d;
-
- void setHeaderLabels();
-};
-
-} // namespace Internal
-} // namespace QmlProfiler
-
-#endif // QMLPROFILERCALLEEVIEW_H
diff --git a/src/plugins/qmlprofiler/qmlprofilercallerview.cpp b/src/plugins/qmlprofiler/qmlprofilercallerview.cpp
deleted file mode 100644
index 92cece6058..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilercallerview.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "qmlprofilercallerview.h"
-
-#include <QtCore/QUrl>
-#include <QtCore/QHash>
-
-#include <QtGui/QHeaderView>
-#include <QtGui/QStandardItemModel>
-
-using namespace QmlProfiler::Internal;
-
-struct BindingData
-{
- BindingData() : displayname(0) , filename(0) , location(0) , details(0),
- line(0), rangeType(0), level(-1), parentList(0) {}
- ~BindingData() {
- delete displayname;
- delete filename;
- delete location;
- delete parentList;
- }
- QString *displayname;
- QString *filename;
- QString *location;
- QString *details;
- int line;
- int rangeType;
- qint64 level;
- QList< BindingData *> *parentList;
-};
-
-typedef QHash<QString, BindingData *> BindingHash;
-typedef QList<BindingData *> BindingList;
-
-enum ItemRole {
- LocationRole = Qt::UserRole+1,
- FilenameRole = Qt::UserRole+2,
- LineRole = Qt::UserRole+3
-};
-
-class QmlProfilerCallerView::QmlProfilerCallerViewPrivate
-{
-public:
- QmlProfilerCallerViewPrivate(QmlProfilerCallerView *qq) : q(qq) {}
-
- void recursiveClearHash(BindingHash *hash);
- void buildModelFromList( BindingList *list, QStandardItem *parentItem, BindingList *listSoFar );
-
- QmlProfilerCallerView *q;
-
- QStandardItemModel *m_model;
- BindingHash m_rootHash;
- QHash<int, BindingList> m_pendingChildren;
- int m_lastLevel;
-};
-
-QmlProfilerCallerView::QmlProfilerCallerView(QWidget *parent) :
- QTreeView(parent), d(new QmlProfilerCallerViewPrivate(this))
-{
- setObjectName("QmlProfilerCallerView");
- setRootIsDecorated(true);
- header()->setResizeMode(QHeaderView::Interactive);
- header()->setMinimumSectionSize(50);
- setSortingEnabled(false);
- setFrameStyle(QFrame::NoFrame);
-
- d->m_model = new QStandardItemModel(this);
-
- setModel(d->m_model);
-
- d->m_model->setColumnCount(3);
- setHeaderLabels();
-
- connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex)));
-
- d->m_lastLevel = -1;
-}
-
-QmlProfilerCallerView::~QmlProfilerCallerView()
-{
- clean();
- delete d->m_model;
-}
-
-void QmlProfilerCallerView::clean()
-{
- d->m_model->clear();
- d->m_model->setColumnCount(3);
-
- foreach (int levelNumber, d->m_pendingChildren.keys())
- d->m_pendingChildren[levelNumber].clear();
-
- d->m_lastLevel = -1;
-
- // clean the hashes
- d->recursiveClearHash(&d->m_rootHash);
-
- setHeaderLabels();
- setSortingEnabled(false);
-}
-
-void QmlProfilerCallerView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line)
-{
- Q_UNUSED(startTime);
- Q_UNUSED(nestingInType);
- Q_UNUSED(length);
-
- const QChar colon = QLatin1Char(':');
- QString localName, displayName, location, details;
-
- if (fileName.isEmpty()) {
- displayName = tr("<bytecode>");
- location = QLatin1String("--");
-
- } else {
- localName = QUrl(fileName).toLocalFile();
- displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line);
- location = fileName+colon+QString::number(line);
- }
-
- if (data.isEmpty())
- details = tr("Source code not available");
- else
- details = data.join(" ").replace('\n'," ");
-
-
- // New Data: if it's not in the hash, put it there
- // if it's in the hash, get the reference from the hash
- BindingData *newBinding;
- BindingHash::iterator it = d->m_rootHash.find(location);
- if (it != d->m_rootHash.end()) {
- newBinding = it.value();
- } else {
- newBinding = new BindingData;
- newBinding->displayname = new QString(displayName);
- newBinding->filename = new QString(fileName);
- newBinding->line = line;
- newBinding->level = nestingLevel;
- newBinding->rangeType = type;
- newBinding->location = new QString(location);
- newBinding->details = new QString(details);
- newBinding->parentList = new BindingList();
- d->m_rootHash.insert(location, newBinding);
- }
-
- if (nestingLevel < d->m_lastLevel) {
- // I'm the parent of the former
- if (d->m_pendingChildren.contains(nestingLevel+1)) {
- foreach (BindingData *child, d->m_pendingChildren[nestingLevel + 1]) {
- if (!child->parentList->contains(newBinding))
- child->parentList->append(newBinding);
- }
- d->m_pendingChildren[nestingLevel + 1].clear();
- }
-
- }
-
- if (nestingLevel > 1 && !d->m_pendingChildren[nestingLevel].contains(newBinding)) {
- // I'm not root... there will come a parent later
- d->m_pendingChildren[nestingLevel].append(newBinding);
- }
-
- d->m_lastLevel = nestingLevel;
-}
-
-void QmlProfilerCallerView::complete()
-{
- // build the model from the hashed data
- BindingList bindingList = d->m_rootHash.values();
- BindingList emptyList;
- d->buildModelFromList(&bindingList, d->m_model->invisibleRootItem(), &emptyList);
-
- expandAll();
- resizeColumnToContents(0);
- resizeColumnToContents(1);
- collapseAll();
-}
-
-void QmlProfilerCallerView::jumpToItem(const QModelIndex &index)
-{
- QStandardItem *clickedItem = d->m_model->itemFromIndex(index);
- QStandardItem *infoItem;
- if (clickedItem->parent())
- infoItem = clickedItem->parent()->child(clickedItem->row(), 0);
- else
- infoItem = d->m_model->item(index.row(), 0);
-
- int line = infoItem->data(Qt::UserRole+3).toInt();
- if (line == -1)
- return;
- QString fileName = infoItem->data(Qt::UserRole+2).toString();
- emit gotoSourceLocation(fileName, line);
-}
-
-void QmlProfilerCallerView::setHeaderLabels()
-{
- d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location")));
- d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Type")));
- d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Details")));
-}
-
-// ToDo: property clean the stored data
-void QmlProfilerCallerView::QmlProfilerCallerViewPrivate::recursiveClearHash(BindingHash *hash) {
- QHashIterator<QString, BindingData *> it(*hash);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
- hash->clear();
-}
-
-inline QString nameForType(int typeNumber)
-{
- switch (typeNumber) {
- case 0: return QmlProfilerCallerView::tr("Paint");
- case 1: return QmlProfilerCallerView::tr("Compile");
- case 2: return QmlProfilerCallerView::tr("Create");
- case 3: return QmlProfilerCallerView::tr("Binding");
- case 4: return QmlProfilerCallerView::tr("Signal");
- }
- return QString();
-}
-
-void QmlProfilerCallerView::QmlProfilerCallerViewPrivate::buildModelFromList( BindingList *list, QStandardItem *parentItem, BindingList *listSoFar )
-{
- foreach (BindingData *binding, *list) {
- if (listSoFar->contains(binding))
- continue;
-
- QStandardItem *nameColumn = new QStandardItem(*binding->displayname);
- nameColumn->setEditable(false);
-
- QStandardItem *typeColumn = new QStandardItem(nameForType(binding->rangeType));
- typeColumn->setEditable(false);
-
- QStandardItem *detailsColumn = new QStandardItem(*binding->details);
- detailsColumn->setEditable(false);
-
- QStandardItem *firstColumn = nameColumn;
- firstColumn->setData(QVariant(*binding->location),LocationRole);
- firstColumn->setData(QVariant(*binding->filename),FilenameRole);
- firstColumn->setData(QVariant(binding->line),LineRole);
-
- QList<QStandardItem *> newRow;
- newRow << nameColumn << typeColumn << detailsColumn;
- parentItem->appendRow(newRow);
- if (!binding->parentList->isEmpty()) {
- // avoid infinite loops due to recursive functions
- BindingList newParentList(*listSoFar);
- newParentList.append(binding);
-
- buildModelFromList(binding->parentList, nameColumn, &newParentList);
- }
- }
-}
diff --git a/src/plugins/qmlprofiler/qmlprofilercallerview.h b/src/plugins/qmlprofiler/qmlprofilercallerview.h
deleted file mode 100644
index 7f9416fea9..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilercallerview.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef QMLPROFILERCALLERVIEW_H
-#define QMLPROFILERCALLERVIEW_H
-
-#include <QTreeView>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerCallerView : public QTreeView
-{
- Q_OBJECT
-
-public:
- explicit QmlProfilerCallerView(QWidget *parent = 0);
- ~QmlProfilerCallerView();
-
-signals:
- void gotoSourceLocation(const QString &fileName, int lineNumber);
-
-public slots:
- void clean();
-
- void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line);
- void complete();
- void jumpToItem(const QModelIndex &index);
-
-private:
- class QmlProfilerCallerViewPrivate;
- QmlProfilerCallerViewPrivate *d;
-
- void setHeaderLabels();
-};
-
-} // namespace Internal
-} // namespace QmlProfiler
-
-#endif // QMLPROFILERCALLERVIEW_H
diff --git a/src/plugins/qmlprofiler/qmlprofilerconstants.h b/src/plugins/qmlprofiler/qmlprofilerconstants.h
index ea7d06df2d..0a21fd7ad5 100644
--- a/src/plugins/qmlprofiler/qmlprofilerconstants.h
+++ b/src/plugins/qmlprofiler/qmlprofilerconstants.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
index 8d0f1ec981..27f34056ff 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -46,10 +45,18 @@
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h>
+#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
+#include <projectexplorer/localapplicationruncontrol.h>
+#include <projectexplorer/applicationrunconfiguration.h>
+#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
+#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
+using namespace Analyzer;
+using namespace ProjectExplorer;
+
namespace QmlProfiler {
namespace Internal {
@@ -65,12 +72,11 @@ public:
bool attach(const QString &address, uint port);
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
- const Analyzer::AnalyzerStartParameters &m_params,
QObject *parent);
QmlProfilerEngine *q;
- Analyzer::AnalyzerStartParameters m_params;
+ //AnalyzerStartParameters m_params;
AbstractQmlProfilerRunner *m_runner;
bool m_running;
bool m_fetchingData;
@@ -78,28 +84,38 @@ public:
};
AbstractQmlProfilerRunner *
-QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *configuration,
- const Analyzer::AnalyzerStartParameters &m_params,
+QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
QObject *parent)
{
AbstractQmlProfilerRunner *runner = 0;
- if (m_params.startMode == Analyzer::StartLocal) {
- LocalQmlProfilerRunner::Configuration configuration;
- configuration.executable = m_params.debuggee;
- configuration.executableArguments = m_params.debuggeeArgs;
- configuration.workingDirectory = m_params.workingDirectory;
- configuration.environment = m_params.environment;
- configuration.port = m_params.connParams.port;
-
- runner = new LocalQmlProfilerRunner(configuration, parent);
- } else if (m_params.startMode == Analyzer::StartRemote) {
- if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config
- = qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(configuration)) {
- runner = new CodaQmlProfilerRunner(s60Config, parent);
- } else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig
- = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration*>(configuration)){
- runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
- }
+ if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
+ // This is a "plain" .qmlproject.
+ LocalQmlProfilerRunner::Configuration conf;
+ conf.executable = rc1->observerPath();
+ conf.executableArguments = rc1->viewerArguments();
+ conf.workingDirectory = rc1->workingDirectory();
+ conf.environment = rc1->environment();
+ conf.port = rc1->qmlDebugServerPort();
+ runner = new LocalQmlProfilerRunner(conf, parent);
+ } else if (LocalApplicationRunConfiguration *rc2 =
+ qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
+ // FIXME: Check.
+ LocalQmlProfilerRunner::Configuration conf;
+ conf.executable = rc2->executable();
+ conf.executableArguments = rc2->commandLineArguments();
+ conf.workingDirectory = rc2->workingDirectory();
+ conf.environment = rc2->environment();
+ conf.port = rc2->qmlDebugServerPort();
+ runner = new LocalQmlProfilerRunner(conf, parent);
+ } else if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config =
+ qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(runConfiguration)) {
+ runner = new CodaQmlProfilerRunner(s60Config, parent);
+ } else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig =
+ qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
+ runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
+ } else {
+ QTC_ASSERT(false, /**/);
}
return runner;
}
@@ -108,12 +124,11 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
// QmlProfilerEngine
//
-QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : IAnalyzerEngine(sp, runConfiguration)
+QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+ : IAnalyzerEngine(tool, runConfiguration)
, d(new QmlProfilerEnginePrivate(this))
{
- d->m_params = sp;
d->m_running = false;
d->m_fetchingData = false;
d->m_delayedDelete = false;
@@ -129,8 +144,8 @@ QmlProfilerEngine::~QmlProfilerEngine()
void QmlProfilerEngine::start()
{
QTC_ASSERT(!d->m_runner, return);
- d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), d->m_params, this);
- QTC_ASSERT(d->m_runner, return);
+ d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this);
+
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped()));
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
@@ -140,6 +155,8 @@ void QmlProfilerEngine::start()
d->m_running = true;
d->m_delayedDelete = false;
+
+ AnalyzerManager::handleToolStarted();
}
void QmlProfilerEngine::stop()
@@ -157,7 +174,7 @@ void QmlProfilerEngine::stop()
void QmlProfilerEngine::stopped()
{
d->m_running = false;
- Analyzer::AnalyzerManager::instance()->stopTool();
+ AnalyzerManager::stopTool(); // FIXME: Needed?
emit finished();
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h
index 85a041dfe5..02dceaf8e2 100644
--- a/src/plugins/qmlprofiler/qmlprofilerengine.h
+++ b/src/plugins/qmlprofiler/qmlprofilerengine.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -43,9 +42,10 @@ namespace Internal {
class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
{
Q_OBJECT
+
public:
- explicit QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
+ QmlProfilerEngine(Analyzer::IAnalyzerTool *tool,
+ ProjectExplorer::RunConfiguration *runConfiguration);
~QmlProfilerEngine();
signals:
diff --git a/src/plugins/valgrind/valgrind_global.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h
index 27ce52a837..1739f90aef 100644
--- a/src/plugins/valgrind/valgrind_global.h
+++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h
@@ -4,8 +4,6 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
-**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
@@ -32,15 +30,23 @@
**
**************************************************************************/
-#ifndef VALGRINDTOOLBASE_GLOBAL_H
-#define VALGRINDTOOLBASE_GLOBAL_H
+#ifndef QMLPROFILEREVENTTYPES_H
+#define QMLPROFILEREVENTTYPES_H
+
+namespace QmlProfiler {
+namespace Internal {
+
+enum QmlEventType {
+ Painting,
+ Compiling,
+ Creating,
+ Binding,
+ HandlingSignal,
-#include <QtCore/qglobal.h>
+ MaximumQmlEventType
+};
-#if defined(VALGRINDTOOLBASE_LIBRARY)
-# define VALGRINDTOOLBASE_EXPORT Q_DECL_EXPORT
-#else
-# define VALGRINDTOOLBASE_EXPORT Q_DECL_IMPORT
-#endif
+}
+}
-#endif // VALGRINDTOOLBASE_GLOBAL_H
+#endif //QMLPROFILEREVENTTYPES_H
diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
new file mode 100644
index 0000000000..dc75dd5cb8
--- /dev/null
+++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
@@ -0,0 +1,543 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "qmlprofilereventview.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QHash>
+
+#include <QtGui/QHeaderView>
+#include <QtGui/QStandardItemModel>
+
+namespace QmlProfiler {
+namespace Internal {
+
+class EventsViewItem : public QStandardItem
+{
+public:
+ EventsViewItem(const QString &text) : QStandardItem(text) {}
+
+ virtual bool operator<(const QStandardItem &other) const
+ {
+ if (data().type() == QVariant::String) {
+ // first column
+ return data(FilenameRole).toString() == other.data(FilenameRole).toString() ?
+ data(LineRole).toInt() < other.data(LineRole).toInt() :
+ data(FilenameRole).toString() < other.data(FilenameRole).toString();
+ }
+
+ return data().toDouble() < other.data().toDouble();
+ }
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////
+
+class QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate
+{
+public:
+ QmlProfilerEventStatisticsPrivate(QmlProfilerEventStatistics *qq) : q(qq) {}
+
+ void postProcess();
+
+ QmlProfilerEventStatistics *q;
+ QmlEventHash m_rootHash;
+ QHash<int, QmlEventList> m_pendingEvents;
+ int m_lastLevel;
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////
+
+class QmlProfilerEventsView::QmlProfilerEventsViewPrivate
+{
+public:
+ QmlProfilerEventsViewPrivate(QmlProfilerEventsView *qq) : q(qq) {}
+
+ void buildModelFromList(const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList = QmlEventList() );
+ int getFieldCount();
+ QString displayTime(double time) const;
+ QString nameForType(int typeNumber) const;
+
+
+ QmlProfilerEventsView *q;
+
+ QmlProfilerEventStatistics *m_eventStatistics;
+ QStandardItemModel *m_model;
+ QList<bool> m_fieldShown;
+ bool m_showAnonymous;
+ int m_firstNumericColumn;
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////
+
+QmlProfilerEventStatistics::QmlProfilerEventStatistics(QObject *parent) :
+ QObject(parent), d(new QmlProfilerEventStatisticsPrivate(this))
+{
+ setObjectName("QmlProfilerEventStatistics");
+ d->m_lastLevel = -1;
+}
+
+QmlProfilerEventStatistics::~QmlProfilerEventStatistics()
+{
+ clear();
+}
+
+void QmlProfilerEventStatistics::clear()
+{
+ foreach (int levelNumber, d->m_pendingEvents.keys())
+ d->m_pendingEvents[levelNumber].clear();
+
+ d->m_lastLevel = -1;
+
+ foreach (QmlEventData *binding, d->m_rootHash.values())
+ delete binding;
+ d->m_rootHash.clear();
+}
+
+QList <QmlEventData *> QmlProfilerEventStatistics::getEventList()
+{
+ return d->m_rootHash.values();
+}
+
+void QmlProfilerEventStatistics::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
+ const QStringList &data, const QString &fileName, int line)
+{
+ Q_UNUSED(startTime);
+ Q_UNUSED(nestingInType);
+
+ const QChar colon = QLatin1Char(':');
+ QString localName, displayName, location, details;
+
+ if (data.isEmpty())
+ details = tr("Source code not available");
+ else {
+ details = data.join(" ").replace('\n'," ").simplified();
+ QRegExp rewrite("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)");
+ bool match = rewrite.exactMatch(details);
+ if (match) {
+ details = rewrite.cap(1) + ": " + rewrite.cap(3);
+ }
+ if (details.startsWith(QString("file://")))
+ details = details.mid(details.lastIndexOf(QChar('/')) + 1);
+ }
+
+ if (fileName.isEmpty()) {
+ displayName = tr("<bytecode>");
+ location = QString("--:%1:%2").arg(QString::number(type), details);
+ } else {
+ localName = QUrl(fileName).toLocalFile();
+ displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line);
+ location = fileName+colon+QString::number(line);
+ }
+
+
+ // New Data: if it's not in the hash, put it there
+ // if it's in the hash, get the reference from the hash
+ QmlEventData *newBinding;
+ QmlEventHash::iterator it = d->m_rootHash.find(location);
+ if (it != d->m_rootHash.end()) {
+ newBinding = it.value();
+ newBinding->duration += length;
+ newBinding->calls++;
+ if (newBinding->maxTime < length)
+ newBinding->maxTime = length;
+ if (newBinding->minTime > length)
+ newBinding->minTime = length;
+ } else {
+ newBinding = new QmlEventData;
+ newBinding->calls = 1;
+ newBinding->duration = length;
+ newBinding->displayname = new QString(displayName);
+ newBinding->filename = new QString(fileName);
+ newBinding->location = new QString(location);
+ newBinding->line = line;
+ newBinding->minTime = length;
+ newBinding->maxTime = length;
+ newBinding->level = nestingLevel;
+ newBinding->eventType = (QmlEventType)type;
+ newBinding->details = new QString(details);
+ newBinding->parentList = new QmlEventList();
+ newBinding->childrenList = new QmlEventList();
+ d->m_rootHash.insert(location, newBinding);
+ }
+
+ if (nestingLevel < d->m_lastLevel) {
+ // I'm the parent of the former
+ if (d->m_pendingEvents.contains(nestingLevel+1)) {
+ foreach (QmlEventData *child, d->m_pendingEvents[nestingLevel + 1]) {
+ if (!newBinding->childrenList->contains(child))
+ newBinding->childrenList->append(child);
+ if (!child->parentList->contains(newBinding))
+ child->parentList->append(newBinding);
+ }
+ d->m_pendingEvents[nestingLevel + 1].clear();
+ }
+
+ }
+
+ if (nestingLevel > 1 && !d->m_pendingEvents[nestingLevel].contains(newBinding)) {
+ // I'm not root... there will come a parent later
+ d->m_pendingEvents[nestingLevel].append(newBinding);
+ }
+
+ d->m_lastLevel = nestingLevel;
+}
+
+void QmlProfilerEventStatistics::complete()
+{
+ d->postProcess();
+ emit dataReady();
+}
+
+void QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate::postProcess()
+{
+ double totalTime = 0;
+
+ foreach (QmlEventData *binding, m_rootHash.values())
+ totalTime += binding->duration;
+
+ foreach (QmlEventData *binding, m_rootHash.values()) {
+ binding->percentOfTime = binding->duration * 100.0 / totalTime;
+ binding->timePerCall = binding->calls > 0 ? double(binding->duration) / binding->calls : 0;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+
+QmlProfilerEventsView::QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model) :
+ QTreeView(parent), d(new QmlProfilerEventsViewPrivate(this))
+{
+ setObjectName("QmlProfilerEventsView");
+ header()->setResizeMode(QHeaderView::Interactive);
+ header()->setDefaultSectionSize(100);
+ header()->setMinimumSectionSize(50);
+ setSortingEnabled(false);
+ setFrameStyle(QFrame::NoFrame);
+
+ d->m_model = new QStandardItemModel(this);
+ setModel(d->m_model);
+ connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex)));
+
+ d->m_eventStatistics = 0;
+ setEventStatisticsModel(model);
+
+ d->m_showAnonymous = false;
+ d->m_firstNumericColumn = 0;
+
+ // default view
+ setViewType(EventsView);
+}
+
+QmlProfilerEventsView::~QmlProfilerEventsView()
+{
+ clear();
+ delete d->m_model;
+}
+
+void QmlProfilerEventsView::setEventStatisticsModel( QmlProfilerEventStatistics *model )
+{
+ if (d->m_eventStatistics)
+ disconnect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel()));
+ d->m_eventStatistics = model;
+ connect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel()));
+}
+
+void QmlProfilerEventsView::setFieldViewable(Fields field, bool show)
+{
+ if (field < MaxFields) {
+ int length = d->m_fieldShown.count();
+ if (field >= length) {
+ for (int i=length; i<MaxFields; i++)
+ d->m_fieldShown << false;
+ }
+ d->m_fieldShown[field] = show;
+ }
+}
+
+void QmlProfilerEventsView::setViewType(ViewTypes type)
+{
+ switch (type) {
+ case EventsView: {
+ setObjectName("QmlProfilerEventsView");
+ setFieldViewable(Name, true);
+ setFieldViewable(Type, true);
+ setFieldViewable(Percent, true);
+ setFieldViewable(TotalDuration, true);
+ setFieldViewable(CallCount, true);
+ setFieldViewable(TimePerCall, true);
+ setFieldViewable(MaxTime, true);
+ setFieldViewable(MinTime, true);
+ setFieldViewable(Details, false);
+ setFieldViewable(Parents, false);
+ setFieldViewable(Children, false);
+ setShowAnonymousEvents(false);
+ break;
+ }
+ case CallersView: {
+ setObjectName("QmlProfilerCallersView");
+ setFieldViewable(Name, true);
+ setFieldViewable(Type, true);
+ setFieldViewable(Percent, false);
+ setFieldViewable(TotalDuration, false);
+ setFieldViewable(CallCount, false);
+ setFieldViewable(TimePerCall, false);
+ setFieldViewable(MaxTime, false);
+ setFieldViewable(MinTime, false);
+ setFieldViewable(Details, true);
+ setFieldViewable(Parents, true);
+ setFieldViewable(Children, false);
+ setShowAnonymousEvents(true);
+ break;
+ }
+ case CalleesView: {
+ setObjectName("QmlProfilerCalleesView");
+ setFieldViewable(Name, true);
+ setFieldViewable(Type, true);
+ setFieldViewable(Percent, false);
+ setFieldViewable(TotalDuration, false);
+ setFieldViewable(CallCount, false);
+ setFieldViewable(TimePerCall, false);
+ setFieldViewable(MaxTime, false);
+ setFieldViewable(MinTime, false);
+ setFieldViewable(Details, true);
+ setFieldViewable(Parents, false);
+ setFieldViewable(Children, true);
+ setShowAnonymousEvents(true);
+ break;
+ }
+ default: break;
+ }
+
+ buildModel();
+}
+
+void QmlProfilerEventsView::setShowAnonymousEvents( bool showThem )
+{
+ d->m_showAnonymous = showThem;
+}
+
+void QmlProfilerEventsView::setHeaderLabels()
+{
+ int fieldIndex = 0;
+ d->m_firstNumericColumn = 0;
+
+ if (d->m_fieldShown[Name]) {
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location")));
+ d->m_firstNumericColumn++;
+ }
+ if (d->m_fieldShown[Type]) {
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type")));
+ d->m_firstNumericColumn++;
+ }
+ if (d->m_fieldShown[Percent])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent")));
+ if (d->m_fieldShown[TotalDuration])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time")));
+ if (d->m_fieldShown[CallCount])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls")));
+ if (d->m_fieldShown[TimePerCall])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time per Call")));
+ if (d->m_fieldShown[MaxTime])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time")));
+ if (d->m_fieldShown[MinTime])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time")));
+ if (d->m_fieldShown[Details])
+ d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details")));
+}
+
+void QmlProfilerEventsView::clear()
+{
+ d->m_model->clear();
+ d->m_model->setColumnCount(d->getFieldCount());
+
+ setHeaderLabels();
+ setSortingEnabled(false);
+}
+
+int QmlProfilerEventsView::QmlProfilerEventsViewPrivate::getFieldCount()
+{
+ int count = 0;
+ for (int i=0; i < m_fieldShown.count(); ++i)
+ if (m_fieldShown[i] && i != Parents && i != Children)
+ count++;
+ return count;
+}
+
+void QmlProfilerEventsView::buildModel()
+{
+ if (d->m_eventStatistics) {
+ clear();
+ d->buildModelFromList( d->m_eventStatistics->getEventList(), d->m_model->invisibleRootItem() );
+
+ bool hasBranches = d->m_fieldShown[Parents] || d->m_fieldShown[Children];
+ setRootIsDecorated(hasBranches);
+
+ setSortingEnabled(!hasBranches);
+
+ if (!hasBranches)
+ sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder);
+
+ expandAll();
+ if (d->m_fieldShown[Name])
+ resizeColumnToContents(0);
+
+ if (d->m_fieldShown[Type])
+ resizeColumnToContents(d->m_fieldShown[Name]?1:0);
+ collapseAll();
+ }
+}
+
+void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList )
+{
+ foreach (QmlEventData *binding, list) {
+ if (visitedFunctionsList.contains(binding))
+ continue;
+
+ if ((!m_showAnonymous) && binding->filename->isEmpty())
+ continue;
+
+ QList<QStandardItem *> newRow;
+ if (m_fieldShown[Name]) {
+ newRow << new EventsViewItem(*binding->displayname);
+ }
+
+ if (m_fieldShown[Type]) {
+ newRow << new EventsViewItem(nameForType(binding->eventType));
+ newRow.last()->setData(QVariant(binding->eventType));
+ }
+
+ if (m_fieldShown[Percent]) {
+ newRow << new EventsViewItem(QString::number(binding->percentOfTime,'f',2)+QLatin1String(" %"));
+ newRow.last()->setData(QVariant(binding->eventType));
+ }
+
+ if (m_fieldShown[TotalDuration]) {
+ newRow << new EventsViewItem(displayTime(binding->duration));
+ newRow.last()->setData(QVariant(binding->duration));
+ }
+
+ if (m_fieldShown[CallCount]) {
+ newRow << new EventsViewItem(QString::number(binding->calls));
+ newRow.last()->setData(QVariant(binding->calls));
+ }
+
+ if (m_fieldShown[TimePerCall]) {
+ newRow << new EventsViewItem(displayTime(binding->timePerCall));
+ newRow.last()->setData(QVariant(binding->timePerCall));
+ }
+
+ if (m_fieldShown[MaxTime]) {
+ newRow << new EventsViewItem(displayTime(binding->maxTime));
+ newRow.last()->setData(QVariant(binding->maxTime));
+ }
+
+ if (m_fieldShown[MinTime]) {
+ newRow << new EventsViewItem(displayTime(binding->minTime));
+ newRow.last()->setData(QVariant(binding->minTime));
+ }
+
+ if (m_fieldShown[Details]) {
+ newRow << new EventsViewItem(*binding->details);
+ }
+
+ if (!newRow.isEmpty()) {
+ // no edit
+ foreach (QStandardItem *item, newRow)
+ item->setEditable(false);
+
+ // metadata
+ newRow.at(0)->setData(QVariant(*binding->location),LocationRole);
+ newRow.at(0)->setData(QVariant(*binding->filename),FilenameRole);
+ newRow.at(0)->setData(QVariant(binding->line),LineRole);
+
+ // append
+ parentItem->appendRow(newRow);
+
+ if (m_fieldShown[Parents] && !binding->parentList->isEmpty()) {
+ QmlEventList newParentList(visitedFunctionsList);
+ newParentList.append(binding);
+
+ buildModelFromList(*binding->parentList, newRow.at(0), newParentList);
+ }
+
+ if (m_fieldShown[Children] && !binding->childrenList->isEmpty()) {
+ QmlEventList newChildrenList(visitedFunctionsList);
+ newChildrenList.append(binding);
+
+ buildModelFromList(*binding->childrenList, newRow.at(0), newChildrenList);
+ }
+ }
+ }
+}
+
+QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::displayTime(double time) const
+{
+ if (time < 1e6)
+ return QString::number(time/1e3,'f',3) + QString::fromWCharArray(L" \u03BCs");
+ if (time < 1e9)
+ return QString::number(time/1e6,'f',3) + QLatin1String(" ms");
+
+ return QString::number(time/1e9,'f',3) + QLatin1String(" s");
+}
+
+QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::nameForType(int typeNumber) const
+{
+ switch (typeNumber) {
+ case 0: return QmlProfilerEventsView::tr("Paint");
+ case 1: return QmlProfilerEventsView::tr("Compile");
+ case 2: return QmlProfilerEventsView::tr("Create");
+ case 3: return QmlProfilerEventsView::tr("Binding");
+ case 4: return QmlProfilerEventsView::tr("Signal");
+ }
+ return QString();
+}
+
+void QmlProfilerEventsView::jumpToItem(const QModelIndex &index)
+{
+ QStandardItem *clickedItem = d->m_model->itemFromIndex(index);
+ QStandardItem *infoItem;
+ if (clickedItem->parent())
+ infoItem = clickedItem->parent()->child(clickedItem->row(), 0);
+ else
+ infoItem = d->m_model->item(index.row(), 0);
+
+ int line = infoItem->data(LineRole).toInt();
+ if (line == -1)
+ return;
+ QString fileName = infoItem->data(FilenameRole).toString();
+ emit gotoSourceLocation(fileName, line);
+}
+
+} // namespace Internal
+} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.h b/src/plugins/qmlprofiler/qmlprofilereventview.h
new file mode 100644
index 0000000000..eac510a9e2
--- /dev/null
+++ b/src/plugins/qmlprofiler/qmlprofilereventview.h
@@ -0,0 +1,160 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef QMLPROFILEREVENTVIEW_H
+#define QMLPROFILEREVENTVIEW_H
+
+#include <QTreeView>
+#include "qmlprofilereventtypes.h"
+
+namespace QmlProfiler {
+namespace Internal {
+
+struct QmlEventData
+{
+ QmlEventData() : displayname(0) , filename(0) , location(0) , details(0),
+ line(0), eventType(MaximumQmlEventType), level(-1), parentList(0), childrenList(0) {}
+ ~QmlEventData() {
+ delete displayname;
+ delete filename;
+ delete location;
+ delete parentList;
+ delete childrenList;
+ }
+ QString *displayname;
+ QString *filename;
+ QString *location;
+ QString *details;
+ int line;
+ QmlEventType eventType;
+ qint64 level;
+ QList< QmlEventData *> *parentList;
+ QList< QmlEventData *> *childrenList;
+ qint64 duration;
+ qint64 calls;
+ qint64 minTime;
+ qint64 maxTime;
+ double timePerCall;
+ double percentOfTime;
+};
+
+
+typedef QHash<QString, QmlEventData *> QmlEventHash;
+typedef QList<QmlEventData *> QmlEventList;
+
+enum ItemRole {
+ LocationRole = Qt::UserRole+1,
+ FilenameRole = Qt::UserRole+2,
+ LineRole = Qt::UserRole+3
+};
+
+class QmlProfilerEventStatistics : public QObject
+{
+ Q_OBJECT
+public:
+
+ explicit QmlProfilerEventStatistics(QObject *parent = 0);
+ ~QmlProfilerEventStatistics();
+
+ QmlEventList getEventList();
+
+signals:
+ void dataReady();
+
+public slots:
+ void clear();
+ void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
+ const QStringList &data, const QString &fileName, int line);
+ void complete();
+
+private:
+ class QmlProfilerEventStatisticsPrivate;
+ QmlProfilerEventStatisticsPrivate *d;
+};
+
+class QmlProfilerEventsView : public QTreeView
+{
+ Q_OBJECT
+public:
+ enum Fields {
+ Name,
+ Type,
+ Percent,
+ TotalDuration,
+ CallCount,
+ TimePerCall,
+ MaxTime,
+ MinTime,
+ Details,
+ Parents,
+ Children,
+
+ MaxFields
+ };
+
+ enum ViewTypes {
+ EventsView,
+ CallersView,
+ CalleesView,
+
+ MaxViewTypes
+ };
+
+ explicit QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model);
+ ~QmlProfilerEventsView();
+
+ void setEventStatisticsModel( QmlProfilerEventStatistics *model );
+ void setFieldViewable(Fields field, bool show);
+ void setViewType(ViewTypes type);
+ void setShowAnonymousEvents( bool showThem );
+
+signals:
+ void gotoSourceLocation(const QString &fileName, int lineNumber);
+
+public slots:
+ void clear();
+ void jumpToItem(const QModelIndex &index);
+ void buildModel();
+
+private:
+ void setHeaderLabels();
+
+private:
+ class QmlProfilerEventsViewPrivate;
+ QmlProfilerEventsViewPrivate *d;
+
+};
+
+} // namespace Internal
+} // namespace QmlProfiler
+
+#endif // QMLPROFILEREVENTVIEW_H
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 3f2dd50369..995a13cb5d 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -6,124 +6,71 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "qmlprofilerplugin.h"
-#include "qmlprofilerconstants.h"
-#include "qmlprojectanalyzerruncontrolfactory.h"
-#include <coreplugin/icore.h>
-#include <coreplugin/icontext.h>
-#include <coreplugin/actionmanager/actionmanager.h>
-#include <coreplugin/actionmanager/command.h>
-#include <coreplugin/actionmanager/actioncontainer.h>
-#include <coreplugin/coreconstants.h>
+#include "qmlprofilertool.h"
+#include "qmlprofilerruncontrolfactory.h"
#include <analyzerbase/analyzermanager.h>
-#include <QtGui/QAction>
-#include <QtGui/QMessageBox>
-#include <QtGui/QMainWindow>
-#include <QtGui/QMenu>
-
#include <QtCore/QtPlugin>
-#include "qmlprofilertool.h"
-
using namespace Analyzer;
using namespace QmlProfiler::Internal;
-QmlProfilerPlugin *QmlProfilerPlugin::m_instance = 0;
bool QmlProfilerPlugin::debugOutput = false;
-
-class QmlProfilerPlugin::QmlProfilerPluginPrivate
-{
-public:
- QmlProfilerPluginPrivate(QmlProfilerPlugin *qq):
- q(qq)
- {}
-
- void initialize(const QStringList &arguments, QString *errorString);
-
- QmlProjectAnalyzerRunControlFactory *m_runControlFactory;
- QmlProfilerPlugin *q;
-};
-
-void QmlProfilerPlugin::QmlProfilerPluginPrivate::initialize(const QStringList &arguments, QString *errorString)
+bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
-
- m_runControlFactory = new QmlProjectAnalyzerRunControlFactory();
- Analyzer::AnalyzerManager::instance()->registerRunControlFactory(m_runControlFactory);
-}
-
-
-
-QmlProfilerPlugin::QmlProfilerPlugin()
- : d(new QmlProfilerPluginPrivate(this))
-{
- m_instance = this;
-}
-
-QmlProfilerPlugin::~QmlProfilerPlugin()
-{
- delete d;
- m_instance = 0;
-}
-
-bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
-{
- d->initialize(arguments, errorString);
-
- AnalyzerManager::instance()->addTool(new QmlProfilerTool(this));
-
+ addAutoReleasedObject(new QmlProfilerRunControlFactory());
+ StartModes modes;
+ // They are handled the same actually.
+ //modes.append(StartMode(StartRemote));
+ modes.append(StartMode(StartLocal));
+ AnalyzerManager::addTool(new QmlProfilerTool(this), modes);
return true;
}
void QmlProfilerPlugin::extensionsInitialized()
{
- // Retrieve objects from the plugin manager's object pool
+ // Retrieve objects from the plugin manager's object pool.
// "In the extensionsInitialized method, a plugin can be sure that all
// plugins that depend on it are completely initialized."
}
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
{
- // Save settings
+ // Save settings.
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
return SynchronousShutdown;
}
-QmlProfilerPlugin *QmlProfilerPlugin::instance()
-{
- return m_instance;
-}
-
Q_EXPORT_PLUGIN(QmlProfilerPlugin)
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.h b/src/plugins/qmlprofiler/qmlprofilerplugin.h
index aa6a749c83..e6ce2b1d9c 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.h
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -46,22 +45,13 @@ class QmlProfilerPlugin : public ExtensionSystem::IPlugin
Q_OBJECT
public:
- static QmlProfilerPlugin *instance();
-
- QmlProfilerPlugin();
- ~QmlProfilerPlugin();
+ QmlProfilerPlugin() {}
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
static bool debugOutput;
-
-private:
- class QmlProfilerPluginPrivate;
- QmlProfilerPluginPrivate *d;
-
- static QmlProfilerPlugin *m_instance;
};
} // namespace Internal
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
new file mode 100644
index 0000000000..1b0edfeef4
--- /dev/null
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
@@ -0,0 +1,158 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "qmlprofilerruncontrolfactory.h"
+#include "qmlprojectmanager/qmlprojectrunconfiguration.h"
+
+#include <analyzerbase/analyzerstartparameters.h>
+#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzersettings.h>
+#include <analyzerbase/analyzerrunconfigwidget.h>
+
+#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+
+#include <remotelinux/linuxdeviceconfiguration.h>
+#include <remotelinux/remotelinuxrunconfiguration.h>
+#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
+#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
+
+#include <utils/qtcassert.h>
+
+#include <QtGui/QAction>
+
+using namespace Analyzer;
+using namespace ProjectExplorer;
+using namespace QmlProfiler::Internal;
+using namespace QmlProjectManager;
+
+QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent)
+ : IRunControlFactory(parent)
+{
+ setObjectName(QLatin1String("QmlProfilerRunControlFactory"));
+}
+
+bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
+{
+ // FIXME: Should this just accept all mode == QLatin1String("QmlProfiler"); ?
+ if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration))
+ return mode == QLatin1String("QmlProfiler");
+ if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration))
+ return mode == QLatin1String("QmlProfiler");
+ if (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
+ return mode == QLatin1String("QmlProfiler");
+ if (qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration))
+ return mode == QLatin1String("QmlProfiler");
+ return false;
+}
+
+RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
+{
+ QTC_ASSERT(canRun(runConfiguration, mode), return 0);
+ AnalyzerStartParameters sp;
+ sp.toolId = "QmlProfiler";
+ sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used.
+
+
+ // FIXME: This is only used to communicate the connParams settings.
+ if (QmlProjectRunConfiguration *rc1 =
+ qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) {
+ // This is a "plain" .qmlproject.
+ sp.environment = rc1->environment();
+ sp.workingDirectory = rc1->workingDirectory();
+ sp.debuggee = rc1->observerPath();
+ sp.debuggeeArgs = rc1->viewerArguments();
+ sp.displayName = rc1->displayName();
+ sp.connParams.host = QLatin1String("localhost");
+ sp.connParams.port = rc1->qmlDebugServerPort();
+ } else if (LocalApplicationRunConfiguration *rc2 =
+ qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
+ sp.environment = rc2->environment();
+ sp.workingDirectory = rc2->workingDirectory();
+ sp.debuggee = rc2->executable();
+ sp.debuggeeArgs = rc2->commandLineArguments();
+ sp.displayName = rc2->displayName();
+ sp.connParams.host = QLatin1String("localhost");
+ sp.connParams.port = rc2->qmlDebugServerPort();
+ } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 =
+ qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
+ sp.debuggee = rc3->remoteExecutableFilePath();
+ sp.debuggeeArgs = rc3->arguments();
+ sp.connParams = rc3->deviceConfig()->sshParameters();
+ sp.analyzerCmdPrefix = rc3->commandPrefix();
+ sp.displayName = rc3->displayName();
+ } else if (Qt4ProjectManager::S60DeviceRunConfiguration *rc4 =
+ qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) {
+ //sp.environment = rc4->environment();
+ //sp.workingDirectory = rc4->workingDirectory();
+ //sp.debuggee = rc4->executable();
+ sp.debuggeeArgs = rc4->commandLineArguments();
+ sp.displayName = rc4->displayName();
+ sp.connParams.host = QLatin1String("localhost");
+ sp.connParams.port = rc4->qmlDebugServerPort();
+ } else {
+ // What could that be?
+ QTC_ASSERT(false, return 0);
+ }
+
+ IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
+ AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
+ QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
+ return rc;
+}
+
+QString QmlProfilerRunControlFactory::displayName() const
+{
+ return tr("QML Profiler");
+}
+
+IRunConfigurationAspect *QmlProfilerRunControlFactory::createRunConfigurationAspect()
+{
+ return new AnalyzerProjectSettings;
+}
+
+RunConfigWidget *QmlProfilerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
+{
+ QmlProjectManager::QmlProjectRunConfiguration *localRc =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
+ if (!localRc)
+ return 0;
+
+ AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ if (!settings)
+ return 0;
+
+ Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget;
+
+ ret->setRunConfiguration(runConfiguration);
+ return ret;
+}
diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
index 7c518f15cc..d360fb3ae9 100644
--- a/src/plugins/analyzerbase/analyzerruncontrolfactory.h
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
@@ -30,34 +30,28 @@
**
**************************************************************************/
-#ifndef ANALYZERRUNCONTROLFACTORY_H
-#define ANALYZERRUNCONTROLFACTORY_H
+#ifndef QMLPROFILERRUNCONTROLFACTORY_H
+#define QMLPROFILERRUNCONTROLFACTORY_H
+#include <analyzerbase/analyzerruncontrol.h>
#include <projectexplorer/runconfiguration.h>
-namespace Analyzer {
-
-class AnalyzerRunControl;
-class AnalyzerStartParameters;
-
+namespace QmlProfiler {
namespace Internal {
-class AnalyzerRunControlFactory: public ProjectExplorer::IRunControlFactory
+class QmlProfilerRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
public:
- AnalyzerRunControlFactory(QObject *parent = 0);
-
typedef ProjectExplorer::RunConfiguration RunConfiguration;
- typedef ProjectExplorer::RunControl RunControl;
- // virtuals from IRunControlFactory
- bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
- RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
- AnalyzerRunControl *create(const AnalyzerStartParameters &sp, RunConfiguration *rc = 0);
- QString displayName() const;
+ QmlProfilerRunControlFactory(QObject *parent = 0);
+ // IRunControlFactory implementation
+ QString displayName() const;
+ bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
+ ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
@@ -66,6 +60,6 @@ signals:
};
} // namespace Internal
-} // namespace Analyzer
+} // namespace QmlProfiler
-#endif // ANALYZERRUNCONTROLFACTORY_H
+#endif // QMLPROFILERRUNCONTROLFACTORY_H
diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp b/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp
deleted file mode 100644
index 307d920c57..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "qmlprofilersummaryview.h"
-
-#include <QtCore/QUrl>
-#include <QtCore/QHash>
-
-#include <QtGui/QHeaderView>
-#include <QtGui/QStandardItemModel>
-
-using namespace QmlProfiler::Internal;
-
-struct BindingData
-{
- QString displayname;
- QString filename;
- int line;
- qint64 duration;
- qint64 calls;
- qint64 minTime;
- qint64 maxTime;
- double tpc;
- double percent;
-};
-
-class QmlProfilerSummaryView::QmlProfilerSummaryViewPrivate
-{
-public:
- QmlProfilerSummaryViewPrivate(QmlProfilerSummaryView *qq) : q(qq) {}
-
- QmlProfilerSummaryView *q;
-
- QStandardItemModel *m_model;
- QHash<QString, BindingData *> m_bindingHash;
-
- enum RangeType {
- Painting,
- Compiling,
- Creating,
- Binding,
- HandlingSignal,
-
- MaximumRangeType
- };
-};
-
-class ProfilerItem : public QStandardItem
-{
-public:
- ProfilerItem(const QString &text) : QStandardItem(text) {}
-
- virtual bool operator<(const QStandardItem &other) const
- {
- if (data().type() == QVariant::String) {
- // first column
- return data(Qt::UserRole+2).toString() == other.data(Qt::UserRole+2).toString() ?
- data(Qt::UserRole+3).toInt() < other.data(Qt::UserRole+3).toInt() :
- data(Qt::UserRole+2).toString() < other.data(Qt::UserRole+2).toString();
- }
-
- return data().toDouble() < other.data().toDouble();
- }
-};
-
-QmlProfilerSummaryView::QmlProfilerSummaryView(QWidget *parent) :
- QTreeView(parent), d(new QmlProfilerSummaryViewPrivate(this))
-{
- setObjectName("QmlProfilerSummaryView");
- setRootIsDecorated(false);
- header()->setResizeMode(QHeaderView::Interactive);
- header()->setMinimumSectionSize(100);
- setSortingEnabled(false);
- setFrameStyle(QFrame::NoFrame);
-
- d->m_model = new QStandardItemModel(this);
-
- setModel(d->m_model);
-
- d->m_model->setColumnCount(7);
- setHeaderLabels();
-
- connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex)));
-}
-
-QmlProfilerSummaryView::~QmlProfilerSummaryView()
-{
- delete d->m_model;
-}
-
-void QmlProfilerSummaryView::clean()
-{
- d->m_model->clear();
- d->m_model->setColumnCount(7);
-
- // clean the hash
- QHashIterator<QString, BindingData *> it(d->m_bindingHash);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
- d->m_bindingHash.clear();
-
- setHeaderLabels();
- setSortingEnabled(false);
-}
-
-void QmlProfilerSummaryView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line)
-{
- Q_UNUSED(startTime);
- Q_UNUSED(data);
- Q_UNUSED(nestingLevel);
- Q_UNUSED(nestingInType);
-
- if (type != QmlProfilerSummaryViewPrivate::Binding && type != QmlProfilerSummaryViewPrivate::HandlingSignal)
- return;
-
- if (fileName.isEmpty())
- return;
- const QChar colon = QLatin1Char(':');
- QString localName = QUrl(fileName).toLocalFile();
- QString displayName = localName.mid(localName.lastIndexOf(QChar('/'))+1)+colon+QString::number(line);
- QString location = fileName+colon+QString::number(line);
-
- QHash<QString, BindingData *>::iterator it = d->m_bindingHash.find(location);
- if (it != d->m_bindingHash.end()) {
- BindingData *bindingInfo = it.value();
- bindingInfo->duration += length;
- bindingInfo->calls++;
- if (bindingInfo->maxTime < length)
- bindingInfo->maxTime = length;
- if (bindingInfo->minTime > length)
- bindingInfo->minTime = length;
- } else {
- BindingData *newBinding = new BindingData;
- newBinding->calls = 1;
- newBinding->duration = length;
- newBinding->displayname = displayName;
- newBinding->filename = fileName;
- newBinding->line = line;
- newBinding->minTime = length;
- newBinding->maxTime = length;
-
- d->m_bindingHash.insert(location, newBinding);
- }
-}
-
-void QmlProfilerSummaryView::complete()
-{
- // compute percentages
- double totalTime = 0;
-
- QHashIterator<QString, BindingData *> it(d->m_bindingHash);
-
- while (it.hasNext()) {
- it.next();
- totalTime += it.value()->duration;
- }
-
- it.toFront();
-
- while (it.hasNext()) {
- it.next();
- BindingData *binding = it.value();
- binding->percent = binding->duration * 100.0 / totalTime;
- binding->tpc = binding->calls > 0 ? double(binding->duration) / binding->calls : 0;
-
- appendRow(binding->displayname,
- binding->filename,
- binding->line,
- binding->percent,
- binding->duration,
- binding->calls,
- binding->tpc,
- binding->maxTime,
- binding->minTime);
-
- }
- setSortingEnabled(true);
- sortByColumn(1,Qt::DescendingOrder);
- resizeColumnToContents(0);
-}
-
-void QmlProfilerSummaryView::jumpToItem(const QModelIndex &index)
-{
- int line = d->m_model->item(index.row(),0)->data(Qt::UserRole+3).toInt();
- if (line == -1)
- return;
- QString fileName = d->m_model->item(index.row(),0)->data(Qt::UserRole+2).toString();
- emit gotoSourceLocation(fileName, line);
-}
-
-void QmlProfilerSummaryView::appendRow(const QString &displayName,
- const QString &fileName,
- int line,
- double percentTime,
- double totalTime,
- int nCalls,
- double timePerCall,
- double maxTime,
- double minTime)
-{
- QString location = fileName + QLatin1Char(':') + QString::number(line);
- ProfilerItem *locationColumn = new ProfilerItem(displayName);
- locationColumn->setData(QVariant(location),Qt::UserRole+1);
- locationColumn->setData(QVariant(fileName),Qt::UserRole+2);
- locationColumn->setData(QVariant(line),Qt::UserRole+3);
- locationColumn->setEditable(false);
- ProfilerItem *percentColumn = new ProfilerItem(QString::number(percentTime,'f',2)+QLatin1String(" %"));
- percentColumn->setData(QVariant(percentTime));
- percentColumn->setEditable(false);
- ProfilerItem *timeColumn = new ProfilerItem(displayTime(totalTime));
- timeColumn->setData(QVariant(totalTime));
- timeColumn->setEditable(false);
- ProfilerItem *callsColumn = new ProfilerItem(QString::number(nCalls));
- callsColumn->setData(QVariant(nCalls));
- callsColumn->setEditable(false);
- ProfilerItem *tpcColumn = new ProfilerItem(displayTime(timePerCall));
- tpcColumn->setData(QVariant(timePerCall));
- tpcColumn->setEditable(false);
- ProfilerItem *maxTimeColumn = new ProfilerItem(displayTime(maxTime));
- maxTimeColumn->setData(QVariant(maxTime));
- maxTimeColumn->setEditable(false);
- ProfilerItem *minTimeColumn = new ProfilerItem(displayTime(minTime));
- minTimeColumn->setData(QVariant(minTime));
- minTimeColumn->setEditable(false);
-
- QList<QStandardItem *> newRow;
- newRow << locationColumn << percentColumn << timeColumn << callsColumn << tpcColumn << maxTimeColumn << minTimeColumn;
- d->m_model->appendRow(newRow);
-}
-
-QString QmlProfilerSummaryView::displayTime(double time) const
-{
- if (time < 1e6)
- return QString::number(time/1e3,'f',3) + QString::fromWCharArray(L" \u03BCs");
- if (time < 1e9)
- return QString::number(time/1e6,'f',3) + QLatin1String(" ms");
-
- return QString::number(time/1e9,'f',3) + QLatin1String(" s");
-}
-
-void QmlProfilerSummaryView::setHeaderLabels()
-{
- d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location")));
- d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Time in Percent")));
- d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Total Time")));
- d->m_model->setHeaderData(3, Qt::Horizontal, QVariant(tr("Calls")));
- d->m_model->setHeaderData(4, Qt::Horizontal, QVariant(tr("Time per Call")));
- d->m_model->setHeaderData(5, Qt::Horizontal, QVariant(tr("Longest Time")));
- d->m_model->setHeaderData(6, Qt::Horizontal, QVariant(tr("Shortest Time")));
-}
diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.h b/src/plugins/qmlprofiler/qmlprofilersummaryview.h
deleted file mode 100644
index 8de750d806..0000000000
--- a/src/plugins/qmlprofiler/qmlprofilersummaryview.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef QMLPROFILERSUMMARYVIEW_H
-#define QMLPROFILERSUMMARYVIEW_H
-
-#include <QTreeView>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerSummaryView : public QTreeView
-{
- Q_OBJECT
-
-public:
- explicit QmlProfilerSummaryView(QWidget *parent = 0);
- ~QmlProfilerSummaryView();
-
-signals:
- void gotoSourceLocation(const QString &fileName, int lineNumber);
-
-public slots:
- void clean();
- void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length,
- const QStringList &data, const QString &fileName, int line);
- void complete();
- void jumpToItem(const QModelIndex &index);
-
-private:
- class QmlProfilerSummaryViewPrivate;
- QmlProfilerSummaryViewPrivate *d;
-
- void appendRow(const QString &displayname,
- const QString &filename,
- int line,
- double percentTime,
- double totalTime,
- int ncalls,
- double timepercall,
- double maxtime,
- double mintime);
- void setHeaderLabels();
- QString displayTime(double time) const;
-};
-
-} // namespace Internal
-} // namespace QmlProfiler
-
-#endif // QMLPROFILERSUMMARYVIEW_H
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index bb810d04e8..fd004b7ae0 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -36,9 +35,7 @@
#include "qmlprofilerplugin.h"
#include "qmlprofilerconstants.h"
#include "qmlprofilerattachdialog.h"
-#include "qmlprofilersummaryview.h"
-#include "qmlprofilercalleeview.h"
-#include "qmlprofilercallerview.h"
+#include "qmlprofilereventview.h"
#include "tracewindow.h"
#include "timelineview.h"
@@ -96,9 +93,10 @@ public:
QTimer m_connectionTimer;
int m_connectionAttempts;
TraceWindow *m_traceWindow;
- QmlProfilerSummaryView *m_summary;
- QmlProfilerCalleeView *m_calleetree;
- QmlProfilerCallerView *m_callertree;
+ QmlProfilerEventStatistics *m_statistics;
+ QmlProfilerEventsView *m_eventsView;
+ QmlProfilerEventsView *m_calleeView;
+ QmlProfilerEventsView *m_callerView;
ProjectExplorer::Project *m_project;
Utils::FileInProjectFinder m_projectFinder;
ProjectExplorer::RunConfiguration *m_runConfiguration;
@@ -121,6 +119,7 @@ public:
QmlProfilerTool::QmlProfilerTool(QObject *parent)
: IAnalyzerTool(parent), d(new QmlProfilerToolPrivate(this))
{
+ setObjectName("QmlProfilerTool");
d->m_client = 0;
d->m_connectionAttempts = 0;
d->m_traceWindow = 0;
@@ -132,6 +131,13 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_connectionTimer.setInterval(200);
connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect()));
+
+ qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas");
+ qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas");
+ qmlRegisterType<Context2D>();
+ qmlRegisterType<CanvasImage>();
+ qmlRegisterType<CanvasGradient>();
+ qmlRegisterType<TimelineView>("Monitor", 1, 0,"TimelineView");
}
QmlProfilerTool::~QmlProfilerTool()
@@ -140,7 +146,7 @@ QmlProfilerTool::~QmlProfilerTool()
delete d;
}
-QString QmlProfilerTool::id() const
+QByteArray QmlProfilerTool::id() const
{
return "QmlProfiler";
}
@@ -156,7 +162,7 @@ QString QmlProfilerTool::description() const
"applications using QML.");
}
-IAnalyzerTool::ToolMode QmlProfilerTool::mode() const
+IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
{
return AnyMode;
}
@@ -164,7 +170,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::mode() const
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
{
- QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
+ QmlProfilerEngine *engine = new QmlProfilerEngine(this, runConfiguration);
// Check minimum Qt Version. We cannot really be sure what the Qt version
// at runtime is, but guess that the active build configuraiton has been used.
@@ -194,6 +200,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
}
}
+ // FIXME: Check that there's something sensible in sp.connParams
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
d->m_tcpHost = sp.connParams.host;
d->m_tcpPort = sp.connParams.port;
@@ -218,24 +225,25 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
return engine;
}
-void QmlProfilerTool::initialize()
+void QmlProfilerTool::toolSelected()
{
- qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas");
- qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas");
- qmlRegisterType<Context2D>();
- qmlRegisterType<CanvasImage>();
- qmlRegisterType<CanvasGradient>();
- qmlRegisterType<TimelineView>("Monitor", 1, 0,"TimelineView");
+ updateAttachAction(true);
}
-void QmlProfilerTool::extensionsInitialized()
+void QmlProfilerTool::toolDeselected()
{
+ updateAttachAction(false);
}
-void QmlProfilerTool::initializeDockWidgets()
+QWidget *QmlProfilerTool::createWidgets()
{
- Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance();
- Utils::FancyMainWindow *mw = analyzerMgr->mainWindow();
+ QTC_ASSERT(!d->m_traceWindow, return 0);
+
+ //
+ // DockWidgets
+ //
+
+ Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow();
d->m_traceWindow = new TraceWindow(mw);
d->m_traceWindow->reset(d->m_client);
@@ -243,29 +251,25 @@ void QmlProfilerTool::initializeDockWidgets()
connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int)));
connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal)));
- d->m_summary = new QmlProfilerSummaryView(mw);
+ d->m_statistics = new QmlProfilerEventStatistics(mw);
+ d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics);
+ d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView);
connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)),
- d->m_summary, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int)));
+ d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int)));
connect(d->m_traceWindow, SIGNAL(viewUpdated()),
- d->m_summary, SLOT(complete()));
- connect(d->m_summary, SIGNAL(gotoSourceLocation(QString,int)),
+ d->m_statistics, SLOT(complete()));
+ connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)),
this, SLOT(gotoSourceLocation(QString,int)));
- d->m_calleetree = new QmlProfilerCalleeView(mw);
- connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)),
- d->m_calleetree, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int)));
- connect(d->m_traceWindow, SIGNAL(viewUpdated()),
- d->m_calleetree, SLOT(complete()));
- connect(d->m_calleetree, SIGNAL(gotoSourceLocation(QString,int)),
+ d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics);
+ d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView);
+ connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)),
this, SLOT(gotoSourceLocation(QString,int)));
- d->m_callertree = new QmlProfilerCallerView(mw);
- connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)),
- d->m_callertree, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int)));
- connect(d->m_traceWindow, SIGNAL(viewUpdated()),
- d->m_callertree, SLOT(complete()));
- connect(d->m_callertree, SIGNAL(gotoSourceLocation(QString,int)),
+ d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics);
+ d->m_callerView->setViewType(QmlProfilerEventsView::CallersView);
+ connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)),
this, SLOT(gotoSourceLocation(QString,int)));
Core::ICore *core = Core::ICore::instance();
@@ -282,41 +286,23 @@ void QmlProfilerTool::initializeDockWidgets()
updateAttachAction(false);
- QDockWidget *summaryDock =
- analyzerMgr->createDockWidget(this, tr("Bindings"),
- d->m_summary, Qt::BottomDockWidgetArea);
-
- QDockWidget *timelineDock =
- analyzerMgr->createDockWidget(this, tr("Timeline"),
- d->m_traceWindow, Qt::BottomDockWidgetArea);
-
- QDockWidget *calleeDock =
- analyzerMgr->createDockWidget(this, tr("Callees"),
- d->m_calleetree, Qt::BottomDockWidgetArea);
-
- QDockWidget *callerDock =
- analyzerMgr->createDockWidget(this, tr("Callers"),
- d->m_callertree, Qt::BottomDockWidgetArea);
-
- mw->splitDockWidget(mw->toolBarDockWidget(), summaryDock, Qt::Vertical);
- mw->tabifyDockWidget(summaryDock, timelineDock);
+ QDockWidget *eventsDock = AnalyzerManager::createDockWidget
+ (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
+ QDockWidget *timelineDock = AnalyzerManager::createDockWidget
+ (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea);
+ QDockWidget *calleeDock = AnalyzerManager::createDockWidget
+ (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea);
+ QDockWidget *callerDock = AnalyzerManager::createDockWidget
+ (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea);
+
+ mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical);
+ mw->tabifyDockWidget(eventsDock, timelineDock);
mw->tabifyDockWidget(timelineDock, calleeDock);
mw->tabifyDockWidget(calleeDock, callerDock);
-}
-
-void QmlProfilerTool::toolSelected()
-{
- updateAttachAction(true);
-}
-void QmlProfilerTool::toolDeselected()
-{
- updateAttachAction(false);
-}
-
-QWidget *QmlProfilerTool::createControlWidget()
-{
- // custom toolbar (TODO)
+ //
+ // Toolbar
+ //
QWidget *toolbarWidget = new QWidget;
toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget"));
@@ -325,8 +311,7 @@ QWidget *QmlProfilerTool::createControlWidget()
layout->setSpacing(0);
d->m_recordButton = new QToolButton(toolbarWidget);
-
- d->m_recordButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/analyzer_category_small.png")));
+ // icon and tooltip set in setRecording(), called later
d->m_recordButton->setCheckable(true);
connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool)));
@@ -335,6 +320,7 @@ QWidget *QmlProfilerTool::createControlWidget()
d->m_clearButton = new QToolButton(toolbarWidget);
d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png")));
+ d->m_clearButton->setToolTip(tr("Discard data"));
connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay()));
layout->addWidget(d->m_clearButton);
@@ -409,6 +395,12 @@ void QmlProfilerTool::stopRecording()
void QmlProfilerTool::setRecording(bool recording)
{
d->m_recordingEnabled = recording;
+
+ // update record button
+ d->m_recordButton->setToolTip( d->m_recordingEnabled ? tr("Disable profiling") : tr("Enable profiling"));
+ d->m_recordButton->setIcon(QIcon(d->m_recordingEnabled ? QLatin1String(":/qmlprofiler/recordOn.png") :
+ QLatin1String(":/qmlprofiler/recordOff.png")));
+
if (recording)
startRecording();
else
@@ -447,23 +439,13 @@ void QmlProfilerTool::updateProjectFileList()
d->m_project->files(ProjectExplorer::Project::ExcludeGeneratedFiles));
}
-bool QmlProfilerTool::canRunRemotely() const
-{
- // TODO: Is this correct?
- return true;
-}
-
-bool QmlProfilerTool::canRunLocally() const
-{
- return true;
-}
-
void QmlProfilerTool::clearDisplay()
{
d->m_traceWindow->clearDisplay();
- d->m_summary->clean();
- d->m_calleetree->clean();
- d->m_callertree->clean();
+ d->m_statistics->clear();
+ d->m_eventsView->clear();
+ d->m_calleeView->clear();
+ d->m_callerView->clear();
}
void QmlProfilerTool::attach()
@@ -479,7 +461,7 @@ void QmlProfilerTool::attach()
d->m_tcpHost = dialog.address();
connectClient(d->m_tcpPort);
- AnalyzerManager::instance()->showMode();
+ AnalyzerManager::showMode();
} else {
stopRecording();
}
@@ -566,3 +548,18 @@ void QmlProfilerTool::updateRecordingState()
if (d->m_traceWindow->isRecording())
clearDisplay();
}
+
+void QmlProfilerTool::startTool(StartMode mode)
+{
+ Q_UNUSED(mode);
+
+ using namespace ProjectExplorer;
+
+ // Make sure mode is shown.
+ AnalyzerManager::showMode();
+
+ ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
+ // ### not sure if we're supposed to check if the RunConFiguration isEnabled
+ Project *pro = pe->startupProject();
+ pe->runProject(pro, id());
+}
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index 13e34375cd..c4520d5a65 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -45,27 +44,23 @@ class QmlProfilerTool : public Analyzer::IAnalyzerTool
Q_OBJECT
public:
- explicit QmlProfilerTool(QObject *parent = 0);
+ explicit QmlProfilerTool(QObject *parent);
~QmlProfilerTool();
- QString id() const;
+ QByteArray id() const;
QString displayName() const;
QString description() const;
- ToolMode mode() const;
+ ToolMode toolMode() const;
- void initialize();
- void extensionsInitialized();
- void initializeDockWidgets();
+ void extensionsInitialized() {}
void toolSelected();
void toolDeselected();
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
- QWidget *createControlWidget();
-
- bool canRunRemotely() const;
- bool canRunLocally() const;
+ QWidget *createWidgets();
+ void startTool(Analyzer::StartMode mode);
public slots:
void connectClient(int port);
@@ -95,6 +90,7 @@ private:
void updateAttachAction(bool isCurrentTool);
void connectToClient();
void updateRecordingState();
+ void ensureWidgets();
class QmlProfilerToolPrivate;
QmlProfilerToolPrivate *d;
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
index cfc69dad55..9e663d7c21 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -42,14 +41,14 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QDeclarativeDebugConnection *clie
: QDeclarativeDebugClient(QLatin1String("CanvasFrameRate"), client),
m_inProgressRanges(0), m_maximumTime(0), m_recording(false), m_nestingLevel(0)
{
- ::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int));
- ::memset(m_nestingInType, 0, MaximumRangeType * sizeof(int));
+ ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int));
+ ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int));
}
void QmlProfilerTraceClient::clearView()
{
- ::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int));
- ::memset(m_nestingInType, 0, MaximumRangeType * sizeof(int));
+ ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int));
+ ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int));
m_nestingLevel = 0;
emit clear();
}
@@ -111,7 +110,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
int range;
stream >> range;
- if (range >= MaximumRangeType)
+ if (range >= MaximumQmlEventType)
return;
if (messageType == RangeStart) {
@@ -150,7 +149,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
Location location = m_rangeLocations[range].count() ? m_rangeLocations[range].pop() : Location();
qint64 startTime = m_rangeStartTimes[range].pop();
- emit this->range((RangeType)range, m_nestingLevel, m_nestingInType[range], startTime,
+ emit this->range((QmlEventType)range, m_nestingLevel, m_nestingInType[range], startTime,
time - startTime, data, location.fileName, location.line);
--m_nestingLevel;
--m_nestingInType[range];
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.h b/src/plugins/qmlprofiler/qmlprofilertraceclient.h
index 207f63e9d6..39a3a92969 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceclient.h
+++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -38,6 +37,8 @@
#include <QtCore/QStack>
#include <QtCore/QStringList>
+#include "qmlprofilereventtypes.h"
+
namespace QmlProfiler {
namespace Internal {
@@ -76,16 +77,6 @@ public:
MaximumMessage
};
- enum RangeType {
- Painting,
- Compiling,
- Creating,
- Binding,
- HandlingSignal,
-
- MaximumRangeType
- };
-
bool isRecording() const { return m_recording; }
public slots:
@@ -112,14 +103,14 @@ protected:
private:
qint64 m_inProgressRanges;
- QStack<qint64> m_rangeStartTimes[MaximumRangeType];
- QStack<QStringList> m_rangeDatas[MaximumRangeType];
- QStack<Location> m_rangeLocations[MaximumRangeType];
- int m_rangeCount[MaximumRangeType];
+ QStack<qint64> m_rangeStartTimes[MaximumQmlEventType];
+ QStack<QStringList> m_rangeDatas[MaximumQmlEventType];
+ QStack<Location> m_rangeLocations[MaximumQmlEventType];
+ int m_rangeCount[MaximumQmlEventType];
qint64 m_maximumTime;
bool m_recording;
int m_nestingLevel;
- int m_nestingInType[MaximumRangeType];
+ int m_nestingInType[MaximumQmlEventType];
};
} // namespace Internal
diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp
deleted file mode 100644
index aad9d920f1..0000000000
--- a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "qmlprojectanalyzerruncontrolfactory.h"
-#include "qmlprojectmanager/qmlprojectrunconfiguration.h"
-#include <analyzerbase/analyzerstartparameters.h>
-#include <analyzerbase/analyzersettings.h>
-#include <analyzerbase/analyzerrunconfigwidget.h>
-
-#include <utils/qtcassert.h>
-
-using namespace Analyzer;
-using namespace ProjectExplorer;
-using namespace QmlProfiler::Internal;
-
-AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration)
-{
- AnalyzerStartParameters sp;
- QTC_ASSERT(runConfiguration, return sp);
- QmlProjectManager::QmlProjectRunConfiguration *rc =
- qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
- QTC_ASSERT(rc, return sp);
-
- sp.startMode = StartLocal;
- sp.environment = rc->environment();
- sp.workingDirectory = rc->workingDirectory();
- sp.debuggee = rc->observerPath();
- sp.debuggeeArgs = rc->viewerArguments();
- sp.displayName = rc->displayName();
- sp.connParams.host = QLatin1String("localhost");
- sp.connParams.port = rc->qmlDebugServerPort();
- return sp;
-}
-
-QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject *parent)
- : IRunControlFactory(parent)
-{
-}
-
-bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
-{
- if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration))
- return false;
- return mode == Constants::MODE_ANALYZE;
-}
-
-RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
-{
- if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)
- || mode != Constants::MODE_ANALYZE) {
- return 0;
- }
- const AnalyzerStartParameters sp = localStartParameters(runConfiguration);
- return create(sp, runConfiguration);
-}
-
-AnalyzerRunControl *QmlProjectAnalyzerRunControlFactory::create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
-{
- AnalyzerRunControl *rc = new AnalyzerRunControl(sp, runConfiguration);
- emit runControlCreated(rc);
- return rc;
-}
-
-QString QmlProjectAnalyzerRunControlFactory::displayName() const
-{
- return tr("QML Profiler");
-}
-
-IRunConfigurationAspect *QmlProjectAnalyzerRunControlFactory::createRunConfigurationAspect()
-{
- return new AnalyzerProjectSettings;
-}
-
-RunConfigWidget *QmlProjectAnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
-{
- QmlProjectManager::QmlProjectRunConfiguration *localRc =
- qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
- if (!localRc)
- return 0;
-
- AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
- if (!settings)
- return 0;
-
- Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget;
- ret->setRunConfiguration(runConfiguration);
- return ret;
-}
diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h
deleted file mode 100644
index c4de8f60de..0000000000
--- a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef QMLPROJECTANALYZERRUNCONTROLFACTORY_H
-#define QMLPROJECTANALYZERRUNCONTROLFACTORY_H
-
-#include <analyzerbase/analyzerruncontrol.h>
-//#include <analyzerbase/analyzerruncontrolfactory.h>
-#include <projectexplorer/runconfiguration.h>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProjectAnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory
-{
- Q_OBJECT
-
-public:
- typedef ProjectExplorer::RunConfiguration RunConfiguration;
-
- QmlProjectAnalyzerRunControlFactory(QObject *parent = 0);
-
- // IRunControlFactory implementation
- bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
- ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
- Analyzer::AnalyzerRunControl *create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration = 0);
- QString displayName() const;
-
- ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
- ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
-
-signals:
- void runControlCreated(Analyzer::AnalyzerRunControl *);
-};
-
-} // namespace Internal
-} // namespace QmlProfiler
-
-#endif // QMLPROJECTANALYZERRUNCONTROLFACTORY_H
diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp
index aecb8940ab..efccff105c 100644
--- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h
index a6b24f7e6e..cf7a444a6f 100644
--- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h
+++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/timelineview.cpp b/src/plugins/qmlprofiler/timelineview.cpp
index 4af994fb22..79afcf2cc2 100644
--- a/src/plugins/qmlprofiler/timelineview.cpp
+++ b/src/plugins/qmlprofiler/timelineview.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/timelineview.h b/src/plugins/qmlprofiler/timelineview.h
index 327ec5112c..ca0bffc792 100644
--- a/src/plugins/qmlprofiler/timelineview.h
+++ b/src/plugins/qmlprofiler/timelineview.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
diff --git a/src/plugins/qmlprofiler/tracewindow.cpp b/src/plugins/qmlprofiler/tracewindow.cpp
index dda54f327b..f5dee6e244 100644
--- a/src/plugins/qmlprofiler/tracewindow.cpp
+++ b/src/plugins/qmlprofiler/tracewindow.cpp
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -72,21 +71,32 @@ TraceWindow::TraceWindow(QWidget *parent)
toolBarLayout->setSpacing(0);
QToolButton *buttonPrev= new QToolButton;
buttonPrev->setIcon(QIcon(":/qmlprofiler/prev.png"));
+ buttonPrev->setToolTip(tr("Jump to previous event"));
connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev()));
+ connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool)));
QToolButton *buttonNext= new QToolButton;
buttonNext->setIcon(QIcon(":/qmlprofiler/next.png"));
+ buttonNext->setToolTip(tr("Jump to next event"));
connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext()));
+ connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool)));
QToolButton *buttonZoomIn = new QToolButton;
buttonZoomIn->setIcon(QIcon(":/qmlprofiler/magnifier-plus.png"));
+ buttonZoomIn->setToolTip(tr("Zoom in 10%"));
connect(buttonZoomIn, SIGNAL(clicked()), this, SIGNAL(zoomIn()));
+ connect(this, SIGNAL(enableToolbar(bool)), buttonZoomIn, SLOT(setEnabled(bool)));
QToolButton *buttonZoomOut = new QToolButton;
buttonZoomOut->setIcon(QIcon(":/qmlprofiler/magnifier-minus.png"));
+ buttonZoomOut->setToolTip(tr("Zoom out 10%"));
connect(buttonZoomOut, SIGNAL(clicked()), this, SIGNAL(zoomOut()));
+ connect(this, SIGNAL(enableToolbar(bool)), buttonZoomOut, SLOT(setEnabled(bool)));
+
toolBarLayout->addWidget(buttonPrev);
toolBarLayout->addWidget(buttonNext);
toolBarLayout->addWidget(buttonZoomIn);
toolBarLayout->addWidget(buttonZoomOut);
+
+
m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
m_view->setFocus();
groupLayout->addWidget(m_view);
@@ -115,8 +125,11 @@ void TraceWindow::reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn)
m_view->rootContext()->setContextProperty("connection", m_plugin.data());
m_view->setSource(QUrl("qrc:/qmlprofiler/MainView.qml"));
+ updateToolbar();
+
connect(m_view->rootObject(), SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(m_view->rootObject(), SIGNAL(updateTimer()), this, SLOT(updateTimer()));
+ connect(m_view->rootObject(), SIGNAL(dataAvailableChanged()), this, SLOT(updateToolbar()));
connect(this, SIGNAL(jumpToPrev()), m_view->rootObject(), SLOT(prevEvent()));
connect(this, SIGNAL(jumpToNext()), m_view->rootObject(), SLOT(nextEvent()));
connect(this, SIGNAL(zoomIn()), m_view->rootObject(), SLOT(zoomIn()));
@@ -144,6 +157,12 @@ void TraceWindow::clearDisplay()
emit internalClearDisplay();
}
+void TraceWindow::updateToolbar()
+{
+ bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool();
+ emit enableToolbar(dataAvailable);
+}
+
void TraceWindow::setRecording(bool recording)
{
if (m_plugin)
diff --git a/src/plugins/qmlprofiler/tracewindow.h b/src/plugins/qmlprofiler/tracewindow.h
index f76fea15f7..ffd414d9ca 100644
--- a/src/plugins/qmlprofiler/tracewindow.h
+++ b/src/plugins/qmlprofiler/tracewindow.h
@@ -6,26 +6,25 @@
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
@@ -64,6 +63,7 @@ public slots:
void updateCursorPosition();
void updateTimer();
void clearDisplay();
+ void updateToolbar();
signals:
void viewUpdated();
@@ -76,6 +76,7 @@ signals:
void jumpToNext();
void zoomIn();
void zoomOut();
+ void enableToolbar(bool);
private:
QWeakPointer<QmlProfilerTraceClient> m_plugin;
diff --git a/src/plugins/qt4projectmanager/applicationlauncher.h b/src/plugins/qt4projectmanager/applicationlauncher.h
index 0315b68c6f..a17f479fd8 100644
--- a/src/plugins/qt4projectmanager/applicationlauncher.h
+++ b/src/plugins/qt4projectmanager/applicationlauncher.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qt4projectmanager/qmakeparser.cpp b/src/plugins/qt4projectmanager/qmakeparser.cpp
index 19d8e7332d..dfc2514547 100644
--- a/src/plugins/qt4projectmanager/qmakeparser.cpp
+++ b/src/plugins/qt4projectmanager/qmakeparser.cpp
@@ -37,8 +37,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
-#include <QtCore/QDir>
-
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::Task;
@@ -73,7 +71,7 @@ void QMakeParser::stdError(const QString &line)
return;
}
if (m_error.indexIn(lne) > -1) {
- QString fileName = QDir::fromNativeSeparators(m_error.cap(1));
+ QString fileName = m_error.cap(1);
Task::TaskType type = Task::Error;
if (fileName.startsWith("WARNING: ")) {
type = Task::Warning;
@@ -143,7 +141,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("Parse Error ('sth odd')"),
- QDir::fromNativeSeparators(QLatin1String("e:\\project.pro")),
+ QLatin1String("e:\\project.pro"),
14,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))
<< QString();
@@ -166,7 +164,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Warning,
QLatin1String("Unescaped backslashes are deprecated."),
- QLatin1String("e:/NokiaQtSDK/Simulator/Qt/msvc2008/lib/qtmaind.prl"), 1,
+ QLatin1String("e:\\NokiaQtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl"), 1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))
<< QString();
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
index c54786eec2..504ac65200 100644
--- a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
@@ -35,8 +35,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskwindow.h>
-#include <QtCore/QDir>
-
using namespace Qt4ProjectManager;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Constants;
@@ -78,7 +76,7 @@ void AbldParser::stdOutput(const QString &line)
if (m_perlIssue.indexIn(lne) > -1) {
m_waitingForStdOutContinuation = true;
- m_currentFile = QDir::fromNativeSeparators(m_perlIssue.cap(2));
+ m_currentFile = m_perlIssue.cap(2);
m_currentLine = m_perlIssue.cap(3).toInt();
Task task(Task::Unknown,
@@ -148,7 +146,7 @@ void AbldParser::stdError(const QString &line)
}
if (lne.startsWith(QLatin1String("MMPFILE \""))) {
- m_currentFile = QDir::fromNativeSeparators(lne.mid(9, lne.size() - 10));
+ m_currentFile = lne.mid(9, lne.size() - 10);
m_waitingForStdErrContinuation = false;
return;
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
index 54b1e4ecfb..c783b4abc2 100644
--- a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp
@@ -34,8 +34,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskwindow.h>
-#include <QtCore/QDir>
-
using namespace ProjectExplorer;
using namespace ProjectExplorer::Constants;
using namespace Qt4ProjectManager;
@@ -85,7 +83,7 @@ void RvctParser::stdError(const QString &line)
m_task = new Task(Task::Unknown,
m_warningOrError.cap(5) /* description */,
- QDir::fromNativeSeparators(m_warningOrError.cap(1)) /* file */,
+ m_warningOrError.cap(1) /* file */,
m_warningOrError.cap(2).toInt() /* line */,
TASK_CATEGORY_COMPILE);
if (m_warningOrError.cap(4) == "Warning")
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
index 47c52dedba..5dfea8114e 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp
@@ -35,8 +35,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskwindow.h>
-#include <QtCore/QDebug>
-
using namespace Qt4ProjectManager::Internal;
S60CreatePackageParser::S60CreatePackageParser(const QString &packageName) :
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp
index c1e748f555..25e94091b0 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp
@@ -633,13 +633,13 @@ void S60DeployConfigurationWidget::getInstalledPackagesResult(const Coda::CodaCo
break;
case QTMOBILITY_UID: {
if (error)
- addErrorToTable(str, tr("QtMobility version: "), tr("Error reading QtMobility version"));
+ addErrorToTable(str, tr("Qt Mobility version: "), tr("Error reading Qt Mobility version"));
else
- addToTable(str, tr("QtMobility version: "), versionString);
+ addToTable(str, tr("Qt Mobility version: "), versionString);
}
break;
case QTCOMPONENTS_UID: {
- addToTable(str, tr("QtQuick components version: "), error ? tr("Not installed") : versionString);
+ addToTable(str, tr("Qt Quick components version: "), error ? tr("Not installed") : versionString);
}
break;
default: break;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
index d43a455b5f..35eb8df7b4 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h
index d316bf7793..d608635f35 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h
@@ -4,30 +4,29 @@
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.nokia.com)
**
-** No Commercial Usage
-**
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
**
** GNU Lesser General Public License Usage
**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
index 4fa0e50096..b2f2c8d962 100644
--- a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp
@@ -34,8 +34,6 @@
#include <projectexplorer/projectexplorerconstants.h>
-#include <QtCore/QDir>
-
using namespace Qt4ProjectManager;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Constants;
@@ -59,7 +57,7 @@ void WinscwParser::stdOutput(const QString &line)
if (m_compilerProblem.indexIn(lne) > -1) {
Task task(Task::Error,
m_compilerProblem.cap(3) /* description */,
- QDir::fromNativeSeparators(m_compilerProblem.cap(1)) /* filename */,
+ m_compilerProblem.cap(1) /* filename */,
m_compilerProblem.cap(2).toInt() /* linenumber */,
TASK_CATEGORY_COMPILE);
if (task.description.startsWith(QLatin1String("warning: "))) {
@@ -79,7 +77,7 @@ void WinscwParser::stdError(const QString &line)
if (m_linkerProblem.indexIn(lne) > -1) {
emit addTask(Task(Task::Error,
m_linkerProblem.cap(2) /* description */,
- QDir::fromNativeSeparators(m_linkerProblem.cap(1)) /* filename */,
+ m_linkerProblem.cap(1) /* filename */,
-1 /* linenumber */,
TASK_CATEGORY_COMPILE));
return;
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index b53bac567e..ebf2d0bade 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -619,8 +619,8 @@ void Qt4PriFileNode::update(ProFile *includeFileExact, QtSupport::ProFileReader
for (int i = 0; i < fileTypes.size(); ++i) {
FileType type = fileTypes.at(i).type;
- QSet<QString> newFilePaths = foundFiles[type];
- newFilePaths += filterFiles(type, m_recursiveEnumerateFiles);
+ QSet<QString> newFilePaths = filterFilesProVariables(type, foundFiles[type]);
+ newFilePaths += filterFilesRecursiveEnumerata(type, m_recursiveEnumerateFiles);
// We only need to save this information if
// we are watching folders
@@ -694,8 +694,8 @@ void Qt4PriFileNode::folderChanged(const QString &folder)
const QVector<Qt4NodeStaticData::FileTypeData> &fileTypes = qt4NodeStaticData()->fileTypeData;
for (int i = 0; i < fileTypes.size(); ++i) {
FileType type = fileTypes.at(i).type;
- QSet<QString> add = filterFiles(type, addedFiles);
- QSet<QString> remove = filterFiles(type, removedFiles);
+ QSet<QString> add = filterFilesRecursiveEnumerata(type, addedFiles);
+ QSet<QString> remove = filterFilesRecursiveEnumerata(type, removedFiles);
if (!add.isEmpty() || !remove.isEmpty()) {
// Scream :)
@@ -1227,7 +1227,26 @@ QStringList Qt4PriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerExac
return result;
}
-QSet<QString> Qt4PriFileNode::filterFiles(ProjectExplorer::FileType fileType, const QSet<QString> &files)
+QSet<QString> Qt4PriFileNode::filterFilesProVariables(ProjectExplorer::FileType fileType, const QSet<QString> &files)
+{
+ if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType)
+ return files;
+ QSet<QString> result;
+ if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType)
+ return result;
+ if (fileType == ProjectExplorer::QMLType) {
+ foreach (const QString &file, files)
+ if (file.endsWith(".qml"))
+ result << file;
+ } else {
+ foreach (const QString &file, files)
+ if (!file.endsWith(".qml"))
+ result << file;
+ }
+ return result;
+}
+
+QSet<QString> Qt4PriFileNode::filterFilesRecursiveEnumerata(ProjectExplorer::FileType fileType, const QSet<QString> &files)
{
QSet<QString> result;
if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType)
diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h
index d674a75899..3f2d1e7b8a 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.h
+++ b/src/plugins/qt4projectmanager/qt4nodes.h
@@ -153,7 +153,8 @@ protected:
void clear();
static QStringList varNames(FileType type);
static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative);
- static QSet<QString> filterFiles(ProjectExplorer::FileType fileType, const QSet<QString> &files);
+ static QSet<QString> filterFilesProVariables(ProjectExplorer::FileType fileType, const QSet<QString> &files);
+ static QSet<QString> filterFilesRecursiveEnumerata(ProjectExplorer::FileType fileType, const QSet<QString> &files);
enum ChangeType {
AddToProFile,
diff --git a/src/plugins/qtestlib/qtestlibplugin.cpp b/src/plugins/qtestlib/qtestlibplugin.cpp
index 91d443e7f2..972ec25f7f 100644
--- a/src/plugins/qtestlib/qtestlibplugin.cpp
+++ b/src/plugins/qtestlib/qtestlibplugin.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qtestlib/qtestlibplugin.h b/src/plugins/qtestlib/qtestlibplugin.h
index 7e89b4c0dd..612b99e8aa 100644
--- a/src/plugins/qtestlib/qtestlibplugin.h
+++ b/src/plugins/qtestlib/qtestlibplugin.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp
index c1700dc4f4..03a84f504b 100644
--- a/src/plugins/qtsupport/exampleslistmodel.cpp
+++ b/src/plugins/qtsupport/exampleslistmodel.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "exampleslistmodel.h"
#include <QtCore/QFile>
@@ -7,6 +39,7 @@
#include <QDebug>
#include <coreplugin/icore.h>
+#include <coreplugin/helpmanager.h>
#include <qtsupport/qtversionmanager.h>
#include <algorithm>
@@ -35,7 +68,9 @@ ExamplesListModel::ExamplesListModel(QObject *parent) :
setRoleNames(roleNames);
connect(QtVersionManager::instance(), SIGNAL(updateExamples(QString,QString,QString)),
- SLOT(readNewsItems(QString,QString,QString)));
+ SLOT(cacheExamplesPath(QString,QString,QString)));
+ connect(Core::HelpManager::instance(), SIGNAL(setupFinished()),
+ SLOT(helpInitialized()));
}
QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, const QString& projectsOffset)
@@ -230,7 +265,7 @@ QStringList ExamplesListModel::exampleSources() const
// Try Creator-provided XML file only
if (sources.isEmpty()) {
- qDebug() << Q_FUNC_INFO << "falling through to Creator-provided XML file";
+ // qDebug() << Q_FUNC_INFO << "falling through to Creator-provided XML file";
sources << QString(resourceDir + QLatin1String("/examples_fallback.xml"));
}
@@ -305,6 +340,20 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const
}
+void ExamplesListModel::cacheExamplesPath(const QString &examplesPath, const QString &demosPath, const QString &sourcePath)
+{
+ m_cache = QMakePathCache(examplesPath, demosPath, sourcePath);
+}
+
+void ExamplesListModel::helpInitialized()
+{
+ disconnect(this, SLOT(cacheExamplesPath(QString, QString, QString)));
+ connect(QtVersionManager::instance(), SIGNAL(updateExamples(QString,QString,QString)),
+ SLOT(readNewsItems(QString,QString,QString)));
+ readNewsItems(m_cache.examplesPath, m_cache.demosPath, m_cache.examplesPath);
+}
+
+
ExamplesListModelFilter::ExamplesListModelFilter(QObject *parent) :
QSortFilterProxyModel(parent), m_showTutorialsOnly(true)
{
diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h
index 97811764b3..fc36970f0b 100644
--- a/src/plugins/qtsupport/exampleslistmodel.h
+++ b/src/plugins/qtsupport/exampleslistmodel.h
@@ -1,15 +1,43 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef EXAMPLESLISTMODEL_H
#define EXAMPLESLISTMODEL_H
#include <QAbstractListModel>
#include <QStringList>
+#include <QtCore/QXmlStreamReader>
#include <QtGui/QSortFilterProxyModel>
-
-QT_BEGIN_NAMESPACE
-class QXmlStreamReader;
-QT_END_NAMESPACE
-
namespace QtSupport {
namespace Internal {
@@ -32,6 +60,15 @@ struct ExampleItem {
bool hasSourceCode;
};
+struct QMakePathCache {
+ QString examplesPath;
+ QString demosPath;
+ QString sourcePath;
+ QMakePathCache() {}
+ QMakePathCache(const QString &_examplesPath, const QString &_demosPath, const QString &_sourcePath)
+ : examplesPath(_examplesPath), demosPath(_demosPath), sourcePath(_sourcePath) {}
+};
+
class ExamplesListModel : public QAbstractListModel {
Q_OBJECT
public:
@@ -43,12 +80,15 @@ public:
QStringList tags() const { return m_tags; }
-public slots:
- void readNewsItems(const QString &examplesPath, const QString &demosPath, const QString &sourcePath);
signals:
void tagsUpdated();
+public slots:
+ void readNewsItems(const QString &examplesPath, const QString &demosPath, const QString &sourcePath);
+ void cacheExamplesPath(const QString &examplesPath, const QString &demosPath, const QString &sourcePath);
+ void helpInitialized();
+
private:
QList<ExampleItem> parseExamples(QXmlStreamReader* reader, const QString& projectsOffset);
QList<ExampleItem> parseDemos(QXmlStreamReader* reader, const QString& projectsOffset);
@@ -57,6 +97,8 @@ private:
QStringList exampleSources() const;
QList<ExampleItem> exampleItems;
QStringList m_tags;
+ QMakePathCache m_cache;
+
};
class ExamplesListModelFilter : public QSortFilterProxyModel {
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h
index 1c421d024a..b67d62c5c9 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.h
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h
@@ -56,7 +56,7 @@ class GettingStartedWelcomePage : public Utils::IWelcomePage
public:
GettingStartedWelcomePage();
- QString pageLocation() const { return Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml"); }
+ QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml")); }
QString title() const { return tr("Getting Started");}
int priority() const { return 10; }
void facilitateQml(QDeclarativeEngine *);
@@ -68,8 +68,6 @@ signals:
public slots:
void openSplitHelp(const QUrl &help);
void openProject(const QString& projectFile, const QStringList& additionalFilesToOpen, const QUrl& help);
-
-public slots:
void updateTagsModel();
private:
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp b/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp
deleted file mode 100644
index 1458c4ec50..0000000000
--- a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp
+++ /dev/null
@@ -1,591 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "gettingstartedwelcomepagewidget.h"
-#include "ui_gettingstartedwelcomepagewidget.h"
-
-#include <coreplugin/icore.h>
-#include <coreplugin/helpmanager.h>
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/rssfetcher.h>
-#include <coreplugin/dialogs/iwizard.h>
-#include <projectexplorer/projectexplorer.h>
-
-#include <utils/pathchooser.h>
-#include <utils/qtcassert.h>
-
-#include <extensionsystem/pluginmanager.h>
-
-#include <QtCore/QDateTime>
-#include <QtCore/QDir>
-#include <QtCore/QFileInfo>
-#include <QtCore/QDebug>
-#include <QtCore/QStringBuilder>
-#include <QtCore/QUrl>
-#include <QtCore/QTimer>
-#include <QtCore/QSettings>
-#include <QtCore/QXmlStreamReader>
-#include <QtCore/QScopedPointer>
-#include <QtGui/QDialogButtonBox>
-#include <QtGui/QFont>
-#include <QtGui/QMessageBox>
-#include <QtGui/QPushButton>
-#include <QtGui/QMenu>
-#include <QtGui/QDesktopServices>
-
-namespace Qt4ProjectManager {
-namespace Internal {
-
-const char ExamplePathPropertyName[] = "__qt_ExamplePath";
-const char HelpPathPropertyName[] = "__qt_HelpPath";
-const char QmlMainFileName[] = "__qt_QmlMainFileName";
-
-void PixmapDownloader::populatePixmap(QNetworkReply *reply) {
- QImage image;
- image.loadFromData(reply->readAll());
- m_label->setScaledContents(false);
- m_label->setPixmap(QPixmap::fromImage(image));
- deleteLater();
-}
-
-GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent) :
- QWidget(parent), ui(new Ui::GettingStartedWelcomePageWidget),
- m_currentFeature(0), m_rssFetcher(0)
-{
- ui->setupUi(this);
-
- ui->didYouKnowTextBrowser->viewport()->setAutoFillBackground(false);
- ui->detailsLabel->hide();
-
- connect(ui->tutorialTreeWidget, SIGNAL(activated(QString)), SLOT(slotOpenHelpPage(const QString&)));
-
- QFontMetrics fm = fontMetrics();
- const int margins = 30;
- int width = ui->tutorialTreeWidget->minimumWidth() - margins;
-
- QString itemText = tr("The Qt Creator User Interface");
- QString url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-quick-tour.html");
- ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText);
-
- itemText = tr("Building and Running an Example");
- url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-build-example-application.html?view=split");
- ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText);
-
- itemText = tr("Creating a Qt C++ Application");
- url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-writing-program.html?view=split");
- ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText);
-
- itemText = tr("Creating a Mobile Application");
- url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-mobile-example.html?view=split");
- ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText);
-
- itemText = tr("Creating a Qt Quick Application");
- url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-qml-application.html?view=split");
- ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText);
-
- srand(QDateTime::currentDateTime().toTime_t());
- QStringList tips = tipsOfTheDay();
- m_currentTip = rand()%tips.count();
-
- QTextDocument *doc = ui->didYouKnowTextBrowser->document();
- doc->setDefaultStyleSheet("* {color:black;};");
- ui->didYouKnowTextBrowser->setDocument(doc);
- ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
-
- connect(ui->nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
- connect(ui->prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
- connect(ui->openProjectButton, SIGNAL(clicked()),
- ProjectExplorer::ProjectExplorerPlugin::instance(),
- SLOT(openOpenProjectDialog()));
- connect(ui->createNewProjectButton, SIGNAL(clicked()), this, SLOT(slotCreateNewProject()));
-
- ui->createNewProjectButton->setIcon(
- QIcon::fromTheme(QLatin1String("document-new"), ui->createNewProjectButton->icon()));
- ui->openProjectButton->setIcon(
- QIcon::fromTheme(QLatin1String("document-open"), ui->openProjectButton->icon()));
-
- m_rssFetcher = new Core::RssFetcher;
- connect (m_rssFetcher, SIGNAL(rssItemReady(Core::RssItem)), SLOT(addToFeatures(Core::RssItem)));
- connect (m_rssFetcher, SIGNAL(finished(bool)), SLOT(showFeature()), Qt::QueuedConnection);
- connect(this, SIGNAL(startRssFetching(QUrl)), m_rssFetcher, SLOT(fetch(QUrl)), Qt::QueuedConnection);
- m_rssFetcher->start(QThread::LowestPriority);
- const QString featureRssFile = Core::ICore::instance()->resourcePath()+QLatin1String("/rss/featured.rss");
- emit startRssFetching(QUrl::fromLocalFile(featureRssFile));
-
- ui->nextFeatureBtn->hide();
- ui->prevFeatureBtn->hide();
- connect(ui->nextFeatureBtn, SIGNAL(clicked()), this, SLOT(slotNextFeature()));
- connect(ui->prevFeatureBtn, SIGNAL(clicked()), this, SLOT(slotPrevFeature()));
-}
-
-GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
-{
- m_rssFetcher->exit();
- m_rssFetcher->wait();
- delete m_rssFetcher;
- delete ui;
-}
-
-void GettingStartedWelcomePageWidget::parseXmlFile(QFile *file, QMenuHash &cppSubMenuHash, QMenuHash &qmlSubMenuHash,
- const QString &examplePath, const QString &sourcePath)
-{
- QMenu *cppSubMenu = 0;
- QMenu *qmlSubMenu = 0;
- bool inExamples = false;
- QString dirName;
-
- QXmlStreamReader reader(file);
-
- while (!reader.atEnd()) {
- switch (reader.readNext()) {
- case QXmlStreamReader::StartElement:
- if (reader.name() == QLatin1String("category")) {
- QString name = reader.attributes().value(QLatin1String("name")).toString();
- if (name.contains(QLatin1String("Tutorial")))
- break;
- dirName = reader.attributes().value(QLatin1String("dirname")).toString();
- if (!cppSubMenuHash.contains(dirName)) {
- cppSubMenu = new QMenu(name, this);
- cppSubMenu->setObjectName(dirName);
- cppSubMenuHash.insert(dirName, cppSubMenu);
- } else {
- cppSubMenu = cppSubMenuHash.value(dirName);
- }
- if (!qmlSubMenuHash.contains(dirName)) {
- qmlSubMenu = new QMenu(name, this);
- qmlSubMenu->setObjectName(dirName);
- qmlSubMenuHash.insert(dirName, qmlSubMenu);
- } else {
- qmlSubMenu = qmlSubMenuHash.value(dirName);
- }
- inExamples = true;
- }
- if (inExamples && reader.name() == QLatin1String("example")) {
- const QChar slash = QLatin1Char('/');
- const QString name = reader.attributes().value(QLatin1String("name")).toString();
- const bool isQml = reader.attributes().value(QLatin1String("qml")).toString() == "true";
- const QString localDir = reader.attributes().value(QLatin1String("filename")).toString();
- const QString fileName = localDir.section('/', -1);
- QString replacedFileName = fileName;
- replacedFileName.replace(QLatin1Char('-'), QString());
- QString relativeProPath = slash + dirName + slash + localDir + slash + replacedFileName;
-
- QString finalFileName = examplePath + relativeProPath + QLatin1String(".pro");
-
- if (!QFile::exists(finalFileName))
- finalFileName = sourcePath + QLatin1String("/examples") + relativeProPath + QLatin1String(".pro");
-
- if (isQml && !QFile::exists(finalFileName)) {
- // maybe it's an old-style QML project?
- relativeProPath = slash + dirName + slash + localDir + slash + fileName;
- finalFileName = examplePath + relativeProPath + QLatin1String(".qmlproject");
-
- if (!QFile::exists(finalFileName))
- finalFileName = sourcePath + QLatin1String("/examples") + relativeProPath + QLatin1String(".qmlproject");;
- }
-
- if (!QFile::exists(finalFileName))
- break;
-
- QString dirNameforHelp = dirName;
- dirNameforHelp.replace(slash, QLatin1Char('-'));
- QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") +
- dirNameforHelp +
- QLatin1Char('-') + fileName + QLatin1String(".html");
-
- QAction *exampleAction = 0;
- QAction *beforeAction = 0;
- bool duplicate = false;
- QMenu *subMenu;
- subMenu = isQml ? qmlSubMenu : cppSubMenu;
-
- foreach (beforeAction, subMenu->actions()) {
- int res = beforeAction->text().compare(name, Qt::CaseInsensitive);
- if (res==0) {
- duplicate = true;
- break;
- } else if (res<0)
- beforeAction = 0;
- else if (res>0) {
- break;
- }
- }
-
- if (!duplicate) {
- exampleAction = new QAction(name, subMenu);
- subMenu->insertAction(beforeAction, exampleAction);
- connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample()));
- exampleAction->setProperty(ExamplePathPropertyName, finalFileName);
- exampleAction->setProperty(HelpPathPropertyName, helpPath);
- if (isQml)
- exampleAction->setProperty(QmlMainFileName, fileName);
- }
- }
- break;
- case QXmlStreamReader::EndElement:
- if (inExamples && reader.name() == QLatin1String("category")) {
- if (cppSubMenu->actions().isEmpty())
- delete cppSubMenuHash.take(dirName);
-
- if (qmlSubMenu->actions().isEmpty())
- delete qmlSubMenuHash.take(dirName);
-
- inExamples = false;
- }
- break;
- default:
- break;
- }
- }
-}
-
-bool menuEntryCompare(QMenu* first, QMenu* second)
-{
- return (QString::localeAwareCompare(first->title(), second->title()) < 0);
-}
-
-void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath,
- const QString &demosPath,
- const QString &sourcePath)
-{
-
- QString demoXml = demosPath + "/qtdemo/xml/examples.xml";
- if (!QFile::exists(demoXml)) {
- demoXml = sourcePath + "/demos/qtdemo/xml/examples.xml";
- if (!QFile::exists(demoXml))
- return;
- }
-
- QMenuHash cppSubMenuHash;
- QMenuHash qmlSubMenuHash;
-
- const QString dropDownLabel = tr("Choose an Example...");
- QMenu *cppMenu = new QMenu(ui->cppExamplesButton);
- ui->cppExamplesButton->setMenu(cppMenu);
- QMenu *qmlMenu = new QMenu(ui->qmlExamplesButton);
-
-
- // let Creator's files take precedence
- QString localQmlExamplesXml =
- Core::ICore::instance()->resourcePath()+QLatin1String("/examplebrowser/qmlexamples.xml");
-
- QFile localDescriptions(localQmlExamplesXml);
- if (localDescriptions.open(QFile::ReadOnly)) {
- parseXmlFile(&localDescriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath);
- }
-
- QFile descriptions(demoXml);
- if (!descriptions.open(QFile::ReadOnly))
- return;
-
- ui->cppExamplesButton->setEnabled(true);
- ui->cppExamplesButton->setText(dropDownLabel);
-
- parseXmlFile(&descriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath);
-
- QList<QMenu*> cppSubMenus = cppSubMenuHash.values();
- qSort(cppSubMenus.begin(), cppSubMenus.end(), menuEntryCompare);
- QList<QMenu*> qmlSubMenus = qmlSubMenuHash.values();
- qSort(qmlSubMenus.begin(), qmlSubMenus.end(), menuEntryCompare);
-
- foreach (QMenu *menu, cppSubMenus)
- cppMenu->addMenu(menu);
- foreach (QMenu *menu, qmlSubMenus)
- qmlMenu->addMenu(menu);
-
- if (!qmlMenu->isEmpty()) {
- ui->qmlExamplesButton->setMenu(qmlMenu);
- ui->qmlExamplesButton->setEnabled(true);
- ui->qmlExamplesButton->setText(dropDownLabel);
- }
-}
-
-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()
-{
- QAction *action = qobject_cast<QAction*>(sender());
- if (!action)
- return;
-
- QString helpFile = action->property(HelpPathPropertyName).toString();
- QString proFile = action->property(ExamplePathPropertyName).toString();
- QString qmlMainFileName;
- bool isQmlProject = false;
- if (action->dynamicPropertyNames().contains(QmlMainFileName)) {
- qmlMainFileName = action->property(QmlMainFileName).toString();
- isQmlProject = true;
- }
- QStringList files;
-
- 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::ExistingDirectory);
- 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;
- if (isQmlProject) {
- tryFile = proFileInfo.path() + '/' + "/main.qml";
- if(!QFile::exists(tryFile))
- tryFile = proFileInfo.path() + "/qml/" + qmlMainFileName + ".qml";
- // legacy qmlproject case
- if(!QFile::exists(tryFile))
- tryFile = proFileInfo.path() + '/' + qmlMainFileName + ".qml";
- if(QFile::exists(tryFile))
- files << tryFile;
- } else {
- tryFile = proFileInfo.path() + "/main.cpp";
- if(!QFile::exists(tryFile))
- tryFile = proFileInfo.path() + '/' + proFileInfo.baseName() + ".cpp";
- files << tryFile;
- }
- if (ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFile)) {
- Core::ICore::instance()->openFiles(files);
- if (!helpFile.isEmpty()) {
- // queue this to make sure it gets executed after the editor widget
- // has been drawn, so we know whether to show a split help or not
- QMetaObject::invokeMethod(this, "slotOpenContextHelpPage",
- Qt::QueuedConnection, Q_ARG(QString, helpFile));
- }
- }
-}
-
-void GettingStartedWelcomePageWidget::slotOpenHelpPage(const QString& url)
-{
- Core::HelpManager *helpManager = Core::HelpManager::instance();
- Q_ASSERT(helpManager);
- helpManager->handleHelpRequest(url);
-}
-void GettingStartedWelcomePageWidget::slotOpenContextHelpPage(const QString& url)
-{
- Core::HelpManager *helpManager = Core::HelpManager::instance();
- Q_ASSERT(helpManager);
- helpManager->handleHelpRequest(url % QLatin1String("?view=split"));
-}
-
-void GettingStartedWelcomePageWidget::slotCreateNewProject()
-{
- Core::ICore::instance()->showNewItemDialog(tr("New Project"),
- Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard));
-}
-
-void GettingStartedWelcomePageWidget::slotNextTip()
-{
- QStringList tips = tipsOfTheDay();
- m_currentTip = ((m_currentTip+1)%tips.count());
- ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
-}
-
-void GettingStartedWelcomePageWidget::slotPrevTip()
-{
- QStringList tips = tipsOfTheDay();
- m_currentTip = ((m_currentTip-1)+tips.count())%tips.count();
- ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
-}
-
-QStringList GettingStartedWelcomePageWidget::tipsOfTheDay()
-{
- static QStringList tips;
- if (tips.isEmpty()) {
- QString altShortcut =
-#ifdef Q_WS_MAC
- tr("Cmd", "Shortcut key");
-#else
- tr("Alt", "Shortcut key");
-#endif
-
- QString ctrlShortcut =
-#ifdef Q_WS_MAC
- tr("Cmd", "Shortcut key");
-#else
- tr("Ctrl", "Shortcut key");
-#endif
-
- //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
- tips.append(tr("You can show and hide the side bar using <tt>%1+0<tt>.").arg(altShortcut));
- tips.append(tr("You can fine tune the <tt>Find</tt> function by selecting &quot;Whole Words&quot; "
- "or &quot;Case Sensitive&quot;. Simply click on the icons on the right end of the line edit."));
- tips.append(tr("If you add external libraries to your project, Qt Creator will automatically offer syntax highlighting "
- "and code completion."));
- tips.append(tr("The code completion is CamelCase-aware. For example, to complete <tt>namespaceUri</tt> "
- "you can just type <tt>nU</tt> and hit <tt>Ctrl+Space</tt>."));
- tips.append(tr("You can force code completion at any time using <tt>Ctrl+Space</tt>."));
- tips.append(tr("You can start Qt Creator with a session by calling <tt>qtcreator &lt;sessionname&gt;</tt>."));
- tips.append(tr("You can return to edit mode from any other mode at any time by hitting <tt>Escape</tt>."));
- //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
- tips.append(tr("You can switch between the output pane by hitting <tt>%1+n</tt> where n is the number denoted "
- "on the buttons at the window bottom: <br /><br />"
- "1: Build Issues, 2: Search Results, 3: Application Output, "
- "4: Compile Output").arg(altShortcut));
- tips.append(tr("You can quickly search methods, classes, help and more using the "
- "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-editor-locator.html\">Locator bar</a> (<tt>%1+K</tt>).").arg(ctrlShortcut));
- tips.append(tr("You can add custom build steps in the "
- "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>."));
- tips.append(tr("Within a session, you can add "
- "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-dependencies.html\">dependencies</a> between projects."));
- tips.append(tr("You can set the preferred editor encoding for every project in <tt>Projects -> Editor Settings -> Default Encoding</tt>."));
- tips.append(tr("You can use Qt Creator with a number of <a href=\"qthelp://com.nokia.qtcreator/doc/creator-version-control.html\">"
- "revision control systems</a> such as Subversion, Perforce, CVS and Git."));
- tips.append(tr("In the editor, <tt>F2</tt> follows symbol definition, <tt>Shift+F2</tt> toggles declaration and definition "
- "while <tt>F4</tt> toggles header file and source file."));
- }
- return tips;
-}
-
-void GettingStartedWelcomePageWidget::addToFeatures(const Core::RssItem &feature)
-{
- m_featuredItems.append(feature);
- if (m_featuredItems.count() > 1) {
- ui->nextFeatureBtn->show();
- ui->prevFeatureBtn->show();
- }
-}
-
-void GettingStartedWelcomePageWidget::showFeature(int feature)
-{
- if (m_featuredItems.isEmpty())
- return;
-
- if (feature == -1) {
- srand(QDateTime::currentDateTime().toTime_t());
- m_currentFeature = rand()%m_featuredItems.count();
- }
-
- const Core::RssItem &item = m_featuredItems.at(m_currentFeature);
- ui->featuredTextLabel->setTextFormat(Qt::RichText);
- QString text = QString::fromLatin1("<b style='color: rgb(85, 85, 85);'>%1</b><br><b>%2</b><br/><br/>%3").arg(item.category).arg(item.title).arg(item.description);
- ui->featuredTextLabel->setText(text);
- QString imagePath = item.imagePath;
- if (!imagePath.startsWith("http")) {
- imagePath = Core::ICore::instance()->resourcePath() + "/rss/" + item.imagePath;
- ui->featuredImage->setPixmap(QPixmap(imagePath));
- } else {
- new PixmapDownloader(QUrl(imagePath), ui->featuredImage);
- }
-
- if (item.category == QLatin1String("Event")) {
- ui->detailsLabel->setText(tr("<a href='%1'>Details...</a>").arg(item.url));
- ui->detailsLabel->show();
- ui->detailsLabel->setOpenExternalLinks(true);
- }
- else if (item.category == QLatin1String("Tutorial")) {
- ui->detailsLabel->setText(tr("<a href='%1'>Take Tutorial</a>").arg(item.url+"?view=split"));
- ui->detailsLabel->show();
- ui->detailsLabel->setOpenExternalLinks(true);
- }
-}
-
-void GettingStartedWelcomePageWidget::slotNextFeature()
-{
- QTC_ASSERT(!m_featuredItems.isEmpty(), return);
- m_currentFeature = (m_currentFeature+1) % m_featuredItems.count();
- showFeature(m_currentFeature);
-}
-
-void GettingStartedWelcomePageWidget::slotPrevFeature()
-{
- QTC_ASSERT(!m_featuredItems.isEmpty(), return);
- m_currentFeature = ((m_currentFeature-1)+m_featuredItems.count()) % m_featuredItems.count();
- showFeature(m_currentFeature);
-}
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h b/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h
deleted file mode 100644
index 1fe4e8277e..0000000000
--- a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef GETTINGSTARTEDWELCOMEPAGEWIDGET_H
-#define GETTINGSTARTEDWELCOMEPAGEWIDGET_H
-
-#include <QtGui/QWidget>
-#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
-
-QT_BEGIN_NAMESPACE
-class QUrl;
-class QLabel;
-class QFile;
-class QMenu;
-QT_END_NAMESPACE
-
-namespace Core {
-class RssFetcher;
-class RssItem;
-}
-
-namespace Qt4ProjectManager {
-namespace Internal {
-
-namespace Ui {
- class GettingStartedWelcomePageWidget;
-}
-
-typedef QHash<QString, QMenu*> QMenuHash;
-
-class PixmapDownloader : public QNetworkAccessManager {
- Q_OBJECT
-public:
- PixmapDownloader(const QUrl& url, QLabel* label, QObject *parent = 0)
- : QNetworkAccessManager(parent), m_url(url), m_label(label)
- {
- connect(this, SIGNAL(finished(QNetworkReply*)), SLOT(populatePixmap(QNetworkReply*)));
- get(QNetworkRequest(url));
- }
-public slots:
- void populatePixmap(QNetworkReply* reply);
-
-private:
- QUrl m_url;
- QLabel *m_label;
-
-};
-
-class GettingStartedWelcomePageWidget : public QWidget
-{
- Q_OBJECT
-public:
- GettingStartedWelcomePageWidget(QWidget *parent = 0);
- ~GettingStartedWelcomePageWidget();
-
-public slots:
- void updateExamples(const QString &examplePath,
- const QString &demosPath,
- const QString &sourcePath);
-
-private slots:
- void slotOpenHelpPage(const QString &url);
- void slotOpenContextHelpPage(const QString &url);
- void slotOpenExample();
- void slotNextTip();
- void slotPrevTip();
- void slotNextFeature();
- void slotPrevFeature();
- void slotCreateNewProject();
- void addToFeatures(const Core::RssItem&);
- void showFeature(int feature = -1);
-
-signals:
- void startRssFetching(const QUrl&);
-
-private:
- void parseXmlFile(QFile *file, QMenuHash &cppSubMenuHash, QMenuHash &qmlSubMenuHash,
- const QString &examplePath, const QString &sourcePath);
- QStringList tipsOfTheDay();
- Ui::GettingStartedWelcomePageWidget *ui;
- int m_currentTip;
- int m_currentFeature;
- QList<Core::RssItem> m_featuredItems;
- Core::RssFetcher *m_rssFetcher;
-};
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
-
-#endif // GETTINGSTARTEDWELCOMEPAGEWIDGET_H
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index 411d04675a..40febd9410 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -48,6 +48,7 @@
#include <utils/qtcassert.h>
#include <utils/buildablehelperlibrary.h>
#include <utils/pathchooser.h>
+#include <projectexplorer/toolchainmanager.h>
#include <qtconcurrent/runextensions.h>
#include <QtCore/QDir>
@@ -129,6 +130,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *>
, m_versionUi(new Internal::Ui::QtVersionInfo())
, m_debuggingHelperUi(new Internal::Ui::DebuggingHelper())
, m_invalidVersionIcon(":/projectexplorer/images/compile_error.png")
+ , m_warningVersionIcon(":/projectexplorer/images/compile_warning.png")
, m_configurationWidget(0)
{
// Initialize m_versions
@@ -169,7 +171,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *>
item->setText(0, version->displayName());
item->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
item->setData(0, VersionIdRole, version->uniqueId());
- item->setIcon(0, version->isValid()? m_validVersionIcon : m_invalidVersionIcon);
+ const ValidityInfo info = validInformation(version);
+ item->setIcon(0, info.icon);
}
m_ui->qtdirList->expandAll();
@@ -207,6 +210,9 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *>
connect(QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(QString)),
this, SLOT(qtVersionsDumpUpdated(QString)));
+
+ connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
+ this, SLOT(toolChainsUpdated()));
}
bool QtOptionsPageWidget::eventFilter(QObject *o, QEvent *e)
@@ -320,6 +326,19 @@ void QtOptionsPageWidget::cleanUpQtVersions()
updateCleanUpButton();
}
+void QtOptionsPageWidget::toolChainsUpdated()
+{
+ for (int i = 0; i < m_versions.count(); ++i) {
+ QTreeWidgetItem *item = treeItemForIndex(i);
+ if (item == m_ui->qtdirList->currentItem())
+ updateDescriptionLabel();
+ else {
+ const ValidityInfo info = validInformation(m_versions.at(i));
+ item->setIcon(0, info.icon);
+ }
+ }
+}
+
void QtOptionsPageWidget::qtVersionsDumpUpdated(const QString &qmakeCommand)
{
foreach (BaseQtVersion *version, m_versions) {
@@ -334,6 +353,49 @@ void QtOptionsPageWidget::qtVersionsDumpUpdated(const QString &qmakeCommand)
}
}
+QtOptionsPageWidget::ValidityInfo QtOptionsPageWidget::validInformation(const BaseQtVersion *version)
+{
+ ValidityInfo info;
+ info.icon = m_validVersionIcon;
+
+ if (!version)
+ return info;
+
+ if (!version->isValid()) {
+ info.icon = m_invalidVersionIcon;
+ info.message = version->invalidReason();
+ return info;
+ }
+
+ // Do we have tool chain issues?
+ QStringList missingToolChains;
+ int abiCount = 0;
+ foreach (const ProjectExplorer::Abi &a, version->qtAbis()) {
+ // Ignore symbian emulator since we do not support it.
+ if (a.osFlavor() == ProjectExplorer::Abi::SymbianEmulatorFlavor)
+ continue;
+ if (ProjectExplorer::ToolChainManager::instance()->findToolChains(a).isEmpty())
+ missingToolChains.append(a.toString());
+ ++abiCount;
+ }
+
+ if (missingToolChains.isEmpty()) {
+ // No:
+ info.message = tr("Qt version %1 for %2").arg(version->qtVersionString(), version->description());
+ } else if (missingToolChains.count() == abiCount) {
+ // Yes, this Qt version can't be used at all!
+ info.message = tr("No tool chain can produce code for this Qt version. Please define one or more tool chains.");
+ info.icon = m_invalidVersionIcon;
+ } else {
+ // Yes, some ABIs are unsupported
+ info.message = tr("Not all possible target environments can be supported due to missing tool chains.");
+ info.toolTip = tr("The following ABIs are currently not supported:<ul><li>%1</li></ul>")
+ .arg(missingToolChains.join(QLatin1String("</li><li>")));
+ info.icon = m_warningVersionIcon;
+ }
+ return info;
+}
+
void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools)
{
const int index = currentIndex();
@@ -725,17 +787,11 @@ void QtOptionsPageWidget::qtVersionChanged()
void QtOptionsPageWidget::updateDescriptionLabel()
{
QTreeWidgetItem *item = m_ui->qtdirList->currentItem();
- const BaseQtVersion *version = currentVersion();
- if (!version) {
- m_versionUi->errorLabel->setText(QString());
- } else if (version->isValid()) {
- m_versionUi->errorLabel->setText( tr("Qt version %1 for %2").arg(version->qtVersionString(),
- version->description()));
- item->setIcon(0, m_validVersionIcon);
- } else {
- m_versionUi->errorLabel->setText(version->invalidReason());
- item->setIcon(0, m_invalidVersionIcon);
- }
+ const ValidityInfo info = validInformation(currentVersion());
+ m_versionUi->errorLabel->setText(info.message);
+ m_versionUi->errorLabel->setToolTip(info.toolTip);
+ if (item)
+ item->setIcon(0, info.icon);
}
int QtOptionsPageWidget::indexForTreeItem(const QTreeWidgetItem *item) const
diff --git a/src/plugins/qtsupport/qtoptionspage.h b/src/plugins/qtsupport/qtoptionspage.h
index df89b2c79c..64bc3ba08c 100644
--- a/src/plugins/qtsupport/qtoptionspage.h
+++ b/src/plugins/qtsupport/qtoptionspage.h
@@ -88,6 +88,7 @@ private:
QList<BaseQtVersion *> m_versions;
int m_defaultVersion;
QIcon m_invalidVersionIcon;
+ QIcon m_warningVersionIcon;
QIcon m_validVersionIcon;
QtConfigWidget *m_configurationWidget;
@@ -108,8 +109,17 @@ private slots:
void slotShowDebuggingBuildLog();
void debuggingHelperBuildFinished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools);
void cleanUpQtVersions();
+ void toolChainsUpdated();
void qtVersionsDumpUpdated(const QString &qmakeCommand);
+
+private:
+ struct ValidityInfo {
+ QString message;
+ QString toolTip;
+ QIcon icon;
+ };
+ ValidityInfo validInformation(const BaseQtVersion *version);
};
class QtOptionsPage : public Core::IOptionsPage
diff --git a/src/plugins/qtsupport/qtversioninfo.ui b/src/plugins/qtsupport/qtversioninfo.ui
index 0e597e6782..9df6f277aa 100644
--- a/src/plugins/qtsupport/qtversioninfo.ui
+++ b/src/plugins/qtsupport/qtversioninfo.ui
@@ -55,7 +55,7 @@
</item>
</layout>
</item>
- <item row="2" column="0">
+ <item row="2" column="0" colspan="2">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string/>
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 8195f8deda..a259363c17 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -131,7 +131,6 @@ void QtVersionManager::extensionsInitialized()
// and add it to the qt versions
findSystemQt();
}
- updateDocumentation();
updateSettings();
saveQtVersions();
@@ -429,8 +428,7 @@ bool QtVersionManager::legacyRestore()
}
s->endArray();
- // TODO add removal of old settings
- // s->remove(QtVersionsSectionName);
+ s->remove(QtVersionsSectionName);
return true;
}
diff --git a/src/plugins/regexp/regexpplugin.cpp b/src/plugins/regexp/regexpplugin.cpp
index f774121bd8..f027c92b0b 100644
--- a/src/plugins/regexp/regexpplugin.cpp
+++ b/src/plugins/regexp/regexpplugin.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/regexp/regexpplugin.h b/src/plugins/regexp/regexpplugin.h
index f508450960..6343dc923a 100644
--- a/src/plugins/regexp/regexpplugin.h
+++ b/src/plugins/regexp/regexpplugin.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/regexp/regexpwindow.cpp b/src/plugins/regexp/regexpwindow.cpp
index 7497409e09..fe9ff1f1c9 100644
--- a/src/plugins/regexp/regexpwindow.cpp
+++ b/src/plugins/regexp/regexpwindow.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/regexp/regexpwindow.h b/src/plugins/regexp/regexpwindow.h
index 75e2e7cf3d..9b09259443 100644
--- a/src/plugins/regexp/regexpwindow.h
+++ b/src/plugins/regexp/regexpwindow.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/regexp/settings.cpp b/src/plugins/regexp/settings.cpp
index 18c0820068..0a58010f0f 100644
--- a/src/plugins/regexp/settings.cpp
+++ b/src/plugins/regexp/settings.cpp
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/regexp/settings.h b/src/plugins/regexp/settings.h
index ba7b65fc4c..56e3543159 100644
--- a/src/plugins/regexp/settings.h
+++ b/src/plugins/regexp/settings.h
@@ -26,7 +26,7 @@
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
+** Nokia at info@qt.nokia.com.
**
**************************************************************************/
diff --git a/src/plugins/remotelinux/abstractmaemodeploystep.cpp b/src/plugins/remotelinux/abstractmaemodeploystep.cpp
index e305bdc719..3275550245 100644
--- a/src/plugins/remotelinux/abstractmaemodeploystep.cpp
+++ b/src/plugins/remotelinux/abstractmaemodeploystep.cpp
@@ -298,7 +298,8 @@ void AbstractMaemoDeployStep::connectToDevice()
connect(m_connection.data(), SIGNAL(connected()), this,
SLOT(handleConnected()));
writeOutput(tr("Connecting to device..."));
- m_connection->connectToHost();
+ if (m_connection->state() == SshConnection::Unconnected)
+ m_connection->connectToHost();
}
}
diff --git a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp
index cf6b530bb1..796be2f874 100644
--- a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp
@@ -78,6 +78,7 @@ void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc)
SLOT(handleSelectedDeviceConfigurationChanged(int)));
connect(m_deployConfig, SIGNAL(deviceConfigurationListChanged()),
SLOT(handleDeviceConfigurationListChanged()));
+ handleDeviceConfigurationListChanged();
ui->projectsComboBox->setModel(m_deployConfig->deploymentInfo().data());
connect(m_deployConfig->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()),
diff --git a/src/plugins/remotelinux/maemodeploystepfactory.cpp b/src/plugins/remotelinux/maemodeploystepfactory.cpp
index a907660129..82b90fbe34 100644
--- a/src/plugins/remotelinux/maemodeploystepfactory.cpp
+++ b/src/plugins/remotelinux/maemodeploystepfactory.cpp
@@ -63,6 +63,9 @@ MaemoDeployStepFactory::MaemoDeployStepFactory(QObject *parent)
QStringList MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
QStringList ids;
+ if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
+ return ids;
+
AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(parent->target());
if (maemoTarget)
diff --git a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp
index 60a8605ea1..969515a75c 100644
--- a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp
+++ b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp
@@ -82,6 +82,7 @@ struct WizardData
QString publicKeyFilePath;
QString userName;
QString password;
+ int sshPort;
};
enum PageId {
@@ -119,6 +120,9 @@ public:
m_ui->hwButton->setChecked(true);
handleDeviceTypeChanged();
m_ui->hostNameLineEdit->setText(defaultHost(deviceType()));
+ m_ui->sshPortSpinBox->setMinimum(1);
+ m_ui->sshPortSpinBox->setMaximum(65535);
+ m_ui->sshPortSpinBox->setValue(22);
connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this,
SIGNAL(completeChanged()));
connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this,
@@ -150,12 +154,20 @@ public:
? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator;
}
+ int sshPort() const
+ {
+ return deviceType() == LinuxDeviceConfiguration::Emulator
+ ? 6666 : m_ui->sshPortSpinBox->value();
+ }
+
private slots:
void handleDeviceTypeChanged()
{
const bool enable = deviceType() == LinuxDeviceConfiguration::Physical;
m_ui->hostNameLabel->setEnabled(enable);
m_ui->hostNameLineEdit->setEnabled(enable);
+ m_ui->sshPortLabel->setEnabled(enable);
+ m_ui->sshPortSpinBox->setEnabled(enable);
}
private:
@@ -495,9 +507,9 @@ private:
SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostAddress();
- sshParams.port = 22;
+ sshParams.port = m_wizardData.sshPort;
sshParams.password = password();
- sshParams.timeout = 30;
+ sshParams.timeout = 10;
sshParams.userName = defaultUser(m_wizardData.osType);
m_ui->statusLabel->setText(tr("Deploying... "));
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
@@ -609,18 +621,17 @@ LinuxDeviceConfiguration::Ptr MaemoDeviceConfigWizard::deviceConfiguration()
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.userName = defaultUser(d->wizardData.osType);
sshParams.host = d->wizardData.hostName;
+ sshParams.port = d->wizardData.sshPort;
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.password = d->wizardData.osType == LinuxDeviceConfiguration::MeeGoOsType
? QLatin1String("meego") : QString();
- sshParams.port = 6666;
sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168");
doTest = false;
} else {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.privateKeyFile = d->wizardData.privateKeyFilePath;
- sshParams.port = 22;
sshParams.timeout = 10;
freePortsSpec = QLatin1String("10000-10100");
doTest = true;
@@ -643,7 +654,7 @@ int MaemoDeviceConfigWizard::nextId() const
d->wizardData.osType = d->startPage.osType();
d->wizardData.deviceType = d->startPage.deviceType();
d->wizardData.hostName = d->startPage.hostName();
-
+ d->wizardData.sshPort = d->startPage.sshPort();
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator)
return FinalPageId;
return PreviousKeySetupCheckPageId;
diff --git a/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui b/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui
index dc89ebe98f..062a89c4d1 100644
--- a/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui
+++ b/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui
@@ -6,17 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
- <width>727</width>
- <height>136</height>
+ <width>721</width>
+ <height>176</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
@@ -102,6 +99,33 @@
<item row="3" column="1">
<widget class="QLineEdit" name="hostNameLineEdit"/>
</item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="sshPortLabel">
+ <property name="text">
+ <string>The SSH port:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QSpinBox" name="sshPortSpinBox"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/src/plugins/remotelinux/maemoglobal.cpp b/src/plugins/remotelinux/maemoglobal.cpp
index 6d22c179ee..e022aafd0d 100644
--- a/src/plugins/remotelinux/maemoglobal.cpp
+++ b/src/plugins/remotelinux/maemoglobal.cpp
@@ -286,93 +286,6 @@ QString MaemoGlobal::architecture(const QString &qmakePath)
return arch;
}
-bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error)
-{
- error.clear();
- QFileInfo fileInfo(filePath);
- if (!fileInfo.exists())
- return true;
- QFile::setPermissions(filePath, fileInfo.permissions() | QFile::WriteUser);
- if (fileInfo.isDir()) {
- QDir dir(filePath);
- QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden
- | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot);
- foreach (const QString &fileName, fileNames) {
- if (!removeRecursively(filePath + QLatin1Char('/') + fileName, error))
- return false;
- }
- dir.cdUp();
- if (!dir.rmdir(fileInfo.fileName())) {
- error = tr("Failed to remove directory '%1'.")
- .arg(QDir::toNativeSeparators(filePath));
- return false;
- }
- } else {
- if (!QFile::remove(filePath)) {
- error = tr("Failed to remove file '%1'.")
- .arg(QDir::toNativeSeparators(filePath));
- return false;
- }
- }
- return true;
-}
-
-bool MaemoGlobal::copyRecursively(const QString &srcFilePath,
- const QString &tgtFilePath, QString *error)
-{
- QFileInfo srcFileInfo(srcFilePath);
- if (srcFileInfo.isDir()) {
- QDir targetDir(tgtFilePath);
- targetDir.cdUp();
- if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) {
- if (error) {
- *error = tr("Failed to create directory '%1'.")
- .arg(QDir::toNativeSeparators(tgtFilePath));
- return false;
- }
- }
- QDir sourceDir(srcFilePath);
- QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
- foreach (const QString &fileName, fileNames) {
- const QString newSrcFilePath
- = srcFilePath + QLatin1Char('/') + fileName;
- const QString newTgtFilePath
- = tgtFilePath + QLatin1Char('/') + fileName;
- if (!copyRecursively(newSrcFilePath, newTgtFilePath))
- return false;
- }
- } else {
- if (!QFile::copy(srcFilePath, tgtFilePath)) {
- if (error) {
- *error = tr("Could not copy file '%1' to '%2'.")
- .arg(QDir::toNativeSeparators(srcFilePath),
- QDir::toNativeSeparators(tgtFilePath));
- }
- return false;
- }
- }
- return true;
-}
-
-bool MaemoGlobal::isFileNewerThan(const QString &filePath,
- const QDateTime &timeStamp)
-{
- QFileInfo fileInfo(filePath);
- if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
- return true;
- if (fileInfo.isDir()) {
- const QStringList dirContents = QDir(filePath)
- .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
- foreach (const QString &curFileName, dirContents) {
- const QString curFilePath
- = filePath + QLatin1Char('/') + curFileName;
- if (isFileNewerThan(curFilePath, timeStamp))
- return true;
- }
- }
- return false;
-}
-
void MaemoGlobal::addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath)
{
Utils::Environment maddeEnv;
diff --git a/src/plugins/remotelinux/maemoglobal.h b/src/plugins/remotelinux/maemoglobal.h
index c185acce5d..f9751c6505 100644
--- a/src/plugins/remotelinux/maemoglobal.h
+++ b/src/plugins/remotelinux/maemoglobal.h
@@ -137,13 +137,6 @@ public:
static PackagingSystem packagingSystem(const QString &osType);
- static bool removeRecursively(const QString &filePath, QString &error);
- static bool copyRecursively(const QString &srcFilePath,
- const QString &tgtFilePath, QString *error = 0);
-
- static bool isFileNewerThan(const QString &filePath,
- const QDateTime &timeStamp);
-
template<class T> static T *earlierBuildStep(const ProjectExplorer::DeployConfiguration *dc,
const ProjectExplorer::BuildStep *laterBuildStep)
{
diff --git a/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp b/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp
index c4111de49d..ed10d87c9a 100644
--- a/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp
+++ b/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp
@@ -38,6 +38,8 @@
#include "maemoqtversion.h"
#include "qt4maemodeployconfiguration.h"
+#include <utils/fileutils.h>
+
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4target.h>
#include <qtsupport/baseqtversion.h>
@@ -323,8 +325,8 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
+ deployable.remoteDir + sep + localFileInfo.fileName();
sysrootDir.mkpath(deployable.remoteDir.mid(1));
QString errorMsg;
- MaemoGlobal::removeRecursively(targetFilePath, errorMsg);
- if (!MaemoGlobal::copyRecursively(deployable.localFilePath,
+ Utils::FileUtils::removeRecursively(targetFilePath, &errorMsg);
+ if (!Utils::FileUtils::copyRecursively(deployable.localFilePath,
targetFilePath, &errorMsg)) {
emit addOutput(tr("Sysroot installation failed: %1\n"
" Continuing anyway.").arg(errorMsg), ErrorMessageOutput);
diff --git a/src/plugins/remotelinux/maemopackagecreationfactory.cpp b/src/plugins/remotelinux/maemopackagecreationfactory.cpp
index bab364abe6..cccb44521c 100644
--- a/src/plugins/remotelinux/maemopackagecreationfactory.cpp
+++ b/src/plugins/remotelinux/maemopackagecreationfactory.cpp
@@ -63,6 +63,8 @@ QStringList MaemoPackageCreationFactory::availableCreationIds(ProjectExplorer::B
QStringList ids;
if (!MaemoGlobal::hasLinuxQt(parent->target()))
return ids;
+ if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
+ return ids;
if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())
&& !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) {
ids << MaemoDebianPackageCreationStep::CreatePackageId;
diff --git a/src/plugins/remotelinux/maemopackagecreationstep.cpp b/src/plugins/remotelinux/maemopackagecreationstep.cpp
index f48b456000..044b9b71f6 100644
--- a/src/plugins/remotelinux/maemopackagecreationstep.cpp
+++ b/src/plugins/remotelinux/maemopackagecreationstep.cpp
@@ -205,7 +205,7 @@ bool AbstractMaemoPackageCreationStep::packagingNeeded() const
const int deployableCount = deploymentInfo->deployableCount();
for (int i = 0; i < deployableCount; ++i) {
- if (MaemoGlobal::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath,
+ if (Utils::FileUtils::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath,
packageInfo.lastModified()))
return true;
}
@@ -427,7 +427,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
return false;
}
QString error;
- if (!MaemoGlobal::removeRecursively(debianDirPath, error)) {
+ if (!Utils::FileUtils::removeRecursively(debianDirPath, &error)) {
raiseError(tr("Packaging failed."),
tr("Could not remove directory '%1': %2").arg(debianDirPath, error));
return false;
@@ -640,7 +640,7 @@ MaemoTarPackageCreationStep::MaemoTarPackageCreationStep(BuildStepList *buildCon
void MaemoTarPackageCreationStep::ctor()
{
- setDefaultDisplayName(tr("Create tar ball"));
+ setDefaultDisplayName(tr("Create tarball"));
}
bool MaemoTarPackageCreationStep::createPackage(QProcess *buildProc,
diff --git a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp
index 36f6f28bd5..45ab841723 100644
--- a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp
+++ b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp
@@ -127,7 +127,7 @@ void MaemoPublisherFremantleFree::createPackage()
if (QFileInfo(tmpDirContainer()).exists()) {
emit progressReport(tr("Removing left-over temporary directory ..."));
QString error;
- if (!MaemoGlobal::removeRecursively(tmpDirContainer(), error)) {
+ if (!Utils::FileUtils::removeRecursively(tmpDirContainer(), &error)) {
finishWithFailure(tr("Error removing temporary directory: %1").arg(error),
tr("Publishing failed: Could not create source package."));
return;
@@ -360,7 +360,7 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage()
}
foreach (const QString &filePath, d.filesToExclude()) {
QString error;
- if (!MaemoGlobal::removeRecursively(filePath, error)) {
+ if (!Utils::FileUtils::removeRecursively(filePath, &error)) {
finishWithFailure(error,
tr("Publishing failed: Could not create package."));
}
diff --git a/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp b/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp
index 5101ffb063..09c2227033 100644
--- a/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp
+++ b/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp
@@ -277,7 +277,7 @@ const QString MaemoUploadAndInstallTarPackageStep::Id("MaemoUploadAndInstallTarP
QString MaemoUploadAndInstallTarPackageStep::displayName()
{
- return tr("Deploy tar package via SFTP upload");
+ return tr("Deploy tarball via SFTP upload");
}
} // namespace Internal
diff --git a/src/plugins/remotelinux/maemousedportsgatherer.cpp b/src/plugins/remotelinux/maemousedportsgatherer.cpp
index b5711b5db6..c72371989c 100644
--- a/src/plugins/remotelinux/maemousedportsgatherer.cpp
+++ b/src/plugins/remotelinux/maemousedportsgatherer.cpp
@@ -64,10 +64,12 @@ void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
SLOT(handleRemoteStdOut(QByteArray)));
connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray)));
- const QString command = MaemoGlobal::remoteSudo(devConf->osType(),
- m_procRunner->connection()->connectionParameters().userName)
- + QLatin1String(" lsof -nPi4tcp:") + devConf->freePorts().toString()
+ QString command = QLatin1String("lsof -nPi4tcp:") + devConf->freePorts().toString()
+ QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq");
+ if (devConf->osType() != LinuxDeviceConfiguration::HarmattanOsType) { // devrootsh is broken on Harmattan
+ command.prepend(MaemoGlobal::remoteSudo(devConf->osType(),
+ devConf->sshParameters().userName) + QLatin1Char(' '));
+ }
m_procRunner->run(command.toUtf8());
m_running = true;
}
diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp
index 9fe831e1a5..5107b867af 100644
--- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp
+++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp
@@ -64,7 +64,7 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfigurat
const QString &dir = QFileInfo(sshParams.privateKeyFile).path();
QString publicKeyFileName = QFileDialog::getOpenFileName(this,
tr("Choose Public Key File"), dir,
- tr("Public Key Files(*.pub);;All Files (*)"));
+ tr("Public Key Files (*.pub);;All Files (*)"));
if (publicKeyFileName.isEmpty()) {
reject();
return;
diff --git a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp
index c022de7226..c7f039fe17 100644
--- a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp
+++ b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp
@@ -196,15 +196,15 @@ QStringList Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *par
QString Qt4MaemoDeployConfigurationFactory::displayNameForId(const QString &id) const
{
if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId)
- return tr("Copy files to Maemo5 device");
+ return tr("Copy Files to Maemo5 Device");
else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId)
- return tr("Build Debian package and install to Maemo5 device");
+ return tr("Build Debian Package and Install to Maemo5 Device");
else if (id == Qt4MaemoDeployConfiguration::HarmattanId)
- return tr("Build Debian package and install to Harmattan device");
+ return tr("Build Debian Package and Install to Harmattan Device");
else if (id == Qt4MaemoDeployConfiguration::MeegoId)
- return tr("Build RPM package and install to Meego device");
+ return tr("Build RPM Package and Install to MeeGo Device");
else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId)
- return tr("Build tarball and install to Linux host");
+ return tr("Build Tarball and Install to Linux Host");
return QString();
}
diff --git a/src/plugins/remotelinux/qt4maemotarget.cpp b/src/plugins/remotelinux/qt4maemotarget.cpp
index 1a8ed325bc..92a675c7e8 100644
--- a/src/plugins/remotelinux/qt4maemotarget.cpp
+++ b/src/plugins/remotelinux/qt4maemotarget.cpp
@@ -311,7 +311,7 @@ void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *ta
const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs
| QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
if (otherContents.isEmpty()) {
- if (!MaemoGlobal::removeRecursively(packagingPath, error))
+ if (!Utils::FileUtils::removeRecursively(packagingPath, &error))
qDebug("%s", qPrintable(error));
}
}
@@ -684,7 +684,7 @@ bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const
void AbstractDebBasedQt4MaemoTarget::removeTarget()
{
QString error;
- if (!MaemoGlobal::removeRecursively(debianDirPath(), error))
+ if (!Utils::FileUtils::removeRecursively(debianDirPath(), &error))
qDebug("%s", qPrintable(error));
}
@@ -705,7 +705,7 @@ AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpeci
projectDir.path() + QLatin1Char('/') + PackagingDirName);
const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/')
+ PackagingDirName + QLatin1String("/debian");
- MaemoGlobal::removeRecursively(dhMakeDebianDir, error);
+ Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error);
const QStringList dh_makeArgs = QStringList() << QLatin1String("dh_make")
<< QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p")
<< (defaultPackageFileName() + QLatin1Char('_')
@@ -733,7 +733,7 @@ AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpeci
if (!QFile::rename(dhMakeDebianDir, debianDirPath())) {
raiseError(tr("Unable to move new debian directory to '%1'.")
.arg(QDir::toNativeSeparators(debianDirPath())));
- MaemoGlobal::removeRecursively(dhMakeDebianDir, error);
+ Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error);
return ActionFailed;
}
diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index 1039af7e31..cc5a0a3429 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -4,8 +4,6 @@ TARGET = RemoteLinux
include(../../qtcreatorplugin.pri)
include(remotelinux_dependencies.pri)
-message(target.path = $$target.path)
-
HEADERS += \
remotelinuxplugin.h \
remotelinux_export.h \
diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
index 919238e3d0..f758c27bc9 100644
--- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
+++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
@@ -375,7 +375,8 @@ void RemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success)
handleConnected();
} else {
emit reportProgress(tr("Connecting to device..."));
- m_connection->connectToHost();
+ if (m_connection->state() == Utils::SshConnection::Unconnected)
+ m_connection->connectToHost();
}
}
diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
index b7a86df3f7..b159e052c0 100644
--- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
+++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
@@ -181,12 +181,16 @@ void AbstractRemoteLinuxDebugSupport::startExecution()
void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode)
{
- if (!m_engine || m_state == Inactive || exitCode == 0)
+ if (!m_engine || m_state == Inactive)
return;
if (m_state == Debugging) {
- if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly)
+ // The QML engine does not realize on its own that the application has finished.
+ if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly)
+ m_engine->quitDebugger();
+ else if (exitCode != 0)
m_engine->notifyInferiorIll();
+
} else {
const QString errorMsg = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? tr("Remote application failed with exit code %1.").arg(exitCode)
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
index f2c8c97445..2a2d0a967b 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
@@ -102,7 +102,7 @@ QStringList RemoteLinuxRunConfigurationFactory::availableCreationIds(Target *par
QString RemoteLinuxRunConfigurationFactory::displayNameForId(const QString &id) const
{
return QFileInfo(pathFromId(id)).completeBaseName()
- + QLatin1String(" (on remote generic Linux device)");
+ + tr(" (on Remote Generic Linux Host)");
}
RunConfiguration *RemoteLinuxRunConfigurationFactory::create(Target *parent, const QString &id)
diff --git a/src/plugins/texteditor/codestylepreferencesmanager.cpp b/src/plugins/texteditor/codestylepreferencesmanager.cpp
index f3e3199590..93b0200abc 100644
--- a/src/plugins/texteditor/codestylepreferencesmanager.cpp
+++ b/src/plugins/texteditor/codestylepreferencesmanager.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "codestylepreferencesmanager.h"
#include "icodestylepreferencesfactory.h"
diff --git a/src/plugins/texteditor/codestylepreferencesmanager.h b/src/plugins/texteditor/codestylepreferencesmanager.h
index 1b26228d0b..a17cf6a274 100644
--- a/src/plugins/texteditor/codestylepreferencesmanager.h
+++ b/src/plugins/texteditor/codestylepreferencesmanager.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef CODESTYLEPREFERENCESMANAGER_H
#define CODESTYLEPREFERENCESMANAGER_H
diff --git a/src/plugins/texteditor/fallbackselectorwidget.cpp b/src/plugins/texteditor/fallbackselectorwidget.cpp
index af931fe137..8abacb092a 100644
--- a/src/plugins/texteditor/fallbackselectorwidget.cpp
+++ b/src/plugins/texteditor/fallbackselectorwidget.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "fallbackselectorwidget.h"
#include "ifallbackpreferences.h"
diff --git a/src/plugins/texteditor/fallbackselectorwidget.h b/src/plugins/texteditor/fallbackselectorwidget.h
index 795112b660..205b4a6ebd 100644
--- a/src/plugins/texteditor/fallbackselectorwidget.h
+++ b/src/plugins/texteditor/fallbackselectorwidget.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef FALLBACKSELECTORWIDGET_H
#define FALLBACKSELECTORWIDGET_H
diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.cpp b/src/plugins/texteditor/icodestylepreferencesfactory.cpp
index 888bd01336..fe4b193296 100644
--- a/src/plugins/texteditor/icodestylepreferencesfactory.cpp
+++ b/src/plugins/texteditor/icodestylepreferencesfactory.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "icodestylepreferencesfactory.h"
using namespace TextEditor;
diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.h b/src/plugins/texteditor/icodestylepreferencesfactory.h
index d0c49d884e..da5c35f134 100644
--- a/src/plugins/texteditor/icodestylepreferencesfactory.h
+++ b/src/plugins/texteditor/icodestylepreferencesfactory.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef ICODESTYLEPREFERENCESFACTORY_H
#define ICODESTYLEPREFERENCESFACTORY_H
diff --git a/src/plugins/texteditor/ifallbackpreferences.cpp b/src/plugins/texteditor/ifallbackpreferences.cpp
index 4dcb2f6f66..95bfd49d62 100644
--- a/src/plugins/texteditor/ifallbackpreferences.cpp
+++ b/src/plugins/texteditor/ifallbackpreferences.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "ifallbackpreferences.h"
#include <utils/settingsutils.h>
diff --git a/src/plugins/texteditor/ifallbackpreferences.h b/src/plugins/texteditor/ifallbackpreferences.h
index a6339abe4e..435c21a992 100644
--- a/src/plugins/texteditor/ifallbackpreferences.h
+++ b/src/plugins/texteditor/ifallbackpreferences.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef IFALLBACKPREFERENCES_H
#define IFALLBACKPREFERENCES_H
diff --git a/src/plugins/texteditor/tabpreferences.cpp b/src/plugins/texteditor/tabpreferences.cpp
index bb3d439def..93458d5e83 100644
--- a/src/plugins/texteditor/tabpreferences.cpp
+++ b/src/plugins/texteditor/tabpreferences.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "tabpreferences.h"
#include "tabsettings.h"
#include "texteditorconstants.h"
diff --git a/src/plugins/texteditor/tabpreferences.h b/src/plugins/texteditor/tabpreferences.h
index 37a2b7b4c4..c553ab344d 100644
--- a/src/plugins/texteditor/tabpreferences.h
+++ b/src/plugins/texteditor/tabpreferences.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef TABPREFERENCES_H
#define TABPREFERENCES_H
diff --git a/src/plugins/texteditor/tabpreferenceswidget.cpp b/src/plugins/texteditor/tabpreferenceswidget.cpp
index ec559a91f6..a542a9e5c9 100644
--- a/src/plugins/texteditor/tabpreferenceswidget.cpp
+++ b/src/plugins/texteditor/tabpreferenceswidget.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "tabpreferenceswidget.h"
#include "ui_tabpreferenceswidget.h"
#include "tabpreferences.h"
diff --git a/src/plugins/texteditor/tabpreferenceswidget.h b/src/plugins/texteditor/tabpreferenceswidget.h
index 20132e41af..a11f6ccad8 100644
--- a/src/plugins/texteditor/tabpreferenceswidget.h
+++ b/src/plugins/texteditor/tabpreferenceswidget.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef TABPREFERENCESWIDGET_H
#define TABPREFERENCESWIDGET_H
diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp
index 9e4336902f..60cc37caf8 100644
--- a/src/plugins/texteditor/tabsettingswidget.cpp
+++ b/src/plugins/texteditor/tabsettingswidget.cpp
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#include "tabsettingswidget.h"
#include "ui_tabsettingswidget.h"
#include "tabsettings.h"
diff --git a/src/plugins/texteditor/tabsettingswidget.h b/src/plugins/texteditor/tabsettingswidget.h
index ff79a9d8f8..db4818e6f4 100644
--- a/src/plugins/texteditor/tabsettingswidget.h
+++ b/src/plugins/texteditor/tabsettingswidget.h
@@ -1,3 +1,35 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
#ifndef TEXTEDITOR_TABSETTINGSWIDGET_H
#define TEXTEDITOR_TABSETTINGSWIDGET_H
diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp
index 9fc18f85f0..988c709329 100644
--- a/src/plugins/valgrind/callgrindengine.cpp
+++ b/src/plugins/valgrind/callgrindengine.cpp
@@ -45,22 +45,24 @@ using namespace Analyzer;
using namespace Valgrind;
using namespace Valgrind::Internal;
-CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : ValgrindEngine(sp, runConfiguration)
+CallgrindEngine::CallgrindEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+ : ValgrindEngine(tool, sp, runConfiguration)
, m_markAsPaused(false)
{
connect(&m_runner, SIGNAL(finished()), this, SLOT(slotFinished()));
connect(&m_runner, SIGNAL(started()), this, SLOT(slotStarted()));
-
connect(m_runner.parser(), SIGNAL(parserDataReady()), this, SLOT(slotFinished()));
-
- connect(&m_runner, SIGNAL(statusMessage(QString)),
- Analyzer::AnalyzerManager::instance(), SLOT(showStatusMessage(QString)));
+ connect(&m_runner, SIGNAL(statusMessage(QString)), SLOT(showStatusMessage(QString)));
m_progress->setProgressRange(0, 2);
}
+void CallgrindEngine::showStatusMessage(const QString &msg)
+{
+ AnalyzerManager::showStatusMessage(msg);
+}
+
QStringList CallgrindEngine::toolArguments() const
{
QStringList arguments;
diff --git a/src/plugins/valgrind/callgrindengine.h b/src/plugins/valgrind/callgrindengine.h
index 33e8d426ca..53a10a8a41 100644
--- a/src/plugins/valgrind/callgrindengine.h
+++ b/src/plugins/valgrind/callgrindengine.h
@@ -46,8 +46,8 @@ class CallgrindEngine : public Valgrind::Internal::ValgrindEngine
Q_OBJECT
public:
- explicit CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
+ CallgrindEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration);
void start();
@@ -79,15 +79,16 @@ protected:
signals:
void parserDataReady(CallgrindEngine *engine);
+private slots:
+ void slotFinished();
+ void slotStarted();
+ void showStatusMessage(const QString &msg);
+
private:
Valgrind::Callgrind::CallgrindRunner m_runner;
bool m_markAsPaused;
QStringList m_extraArguments;
-
-private slots:
- void slotFinished();
- void slotStarted();
};
} // namespace Internal
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index 874a4fc00c..d89632d6c7 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -47,6 +47,7 @@
#include <valgrind/callgrind/callgrindparsedata.h>
#include <valgrind/callgrind/callgrindproxymodel.h>
#include <valgrind/callgrind/callgrindstackbrowser.h>
+#include <valgrind/valgrindplugin.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzersettings.h>
@@ -114,10 +115,8 @@ public:
void setParseData(ParseData *data);
CostDelegate::CostFormat costFormat() const;
- QWidget *createControlWidget();
- void initializeDockWidgets();
+ QWidget *createWidgets();
- void ensureDockWidgets();
void doClear(bool clearParseData);
void updateEventCombo();
@@ -501,9 +500,9 @@ CallgrindTool::CallgrindTool(QObject *parent)
: Analyzer::IAnalyzerTool(parent)
{
d = new CallgrindToolPrivate(this);
- Core::ICore *core = Core::ICore::instance();
+ setObjectName(QLatin1String("CallgrindTool"));
- // EditorManager
+ Core::ICore *core = Core::ICore::instance();
QObject *editorManager = core->editorManager();
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
d, SLOT(editorOpened(Core::IEditor*)));
@@ -514,7 +513,7 @@ CallgrindTool::~CallgrindTool()
delete d;
}
-QString CallgrindTool::id() const
+QByteArray CallgrindTool::id() const
{
return "Callgrind";
}
@@ -530,15 +529,11 @@ QString CallgrindTool::description() const
"record function calls when a program runs.");
}
-IAnalyzerTool::ToolMode CallgrindTool::mode() const
+IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
{
return ReleaseMode;
}
-void CallgrindTool::initialize()
-{
-}
-
void CallgrindTool::extensionsInitialized()
{
Core::ICore *core = Core::ICore::instance();
@@ -570,25 +565,78 @@ void CallgrindTool::extensionsInitialized()
}
}
-void CallgrindTool::initializeDockWidgets()
+IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+{
+ return d->createEngine(sp, runConfiguration);
+}
+
+IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+{
+ CallgrindEngine *engine = new CallgrindEngine(q, sp, runConfiguration);
+
+ connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)),
+ SLOT(takeParserData(CallgrindEngine *)));
+ connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
+ SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
+ connect(engine, SIGNAL(finished()),
+ SLOT(engineFinished()));
+
+ connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump()));
+ connect(this, SIGNAL(resetRequested()), engine, SLOT(reset()));
+ connect(this, SIGNAL(pauseToggled(bool)), engine, SLOT(setPaused(bool)));
+
+ // initialize engine
+ engine->setPaused(m_pauseAction->isChecked());
+
+ // we may want to toggle collect for one function only in this run
+ engine->setToggleCollectFunction(m_toggleCollectFunction);
+ m_toggleCollectFunction.clear();
+
+ AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName()));
+
+ // apply project settings
+ AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>();
+ QTC_ASSERT(settings, return engine)
+
+ QTC_ASSERT(m_visualisation, return engine);
+ m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
+ m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
+ m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips());
+
+ return engine;
+}
+
+void CallgrindTool::startTool(StartMode mode)
+{
+ ValgrindPlugin::startValgrindTool(this, mode);
+}
+
+QWidget *CallgrindTool::createWidgets()
{
- d->initializeDockWidgets();
+ return d->createWidgets();
}
-void CallgrindToolPrivate::initializeDockWidgets()
+QWidget *CallgrindToolPrivate::createWidgets()
{
- AnalyzerManager *am = AnalyzerManager::instance();
- Utils::FancyMainWindow *mw = am->mainWindow();
+ QTC_ASSERT(!m_visualisation, return 0);
+
+ //
+ // DockWidgets
+ //
+ Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow();
m_visualisation = new Visualisation(mw);
m_visualisation->setFrameStyle(QFrame::NoFrame);
- m_visualisation->setObjectName("Valgrind.CallgrindToolPrivate.Visualisation");
+ m_visualisation->setObjectName("Valgrind.CallgrindTool.Visualisation");
m_visualisation->setModel(m_dataModel);
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
this, SLOT(visualisationFunctionSelected(const Valgrind::Callgrind::Function*)));
m_callersView = new CostView(mw);
+ m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView");
m_callersView->sortByColumn(CallModel::CostColumn);
- m_callersView->setObjectName("Valgrind.CallgrindToolPrivate.CallersView");
m_callersView->setFrameStyle(QFrame::NoFrame);
// enable sorting
QSortFilterProxyModel *callerProxy = new QSortFilterProxyModel(m_callersModel);
@@ -599,8 +647,8 @@ void CallgrindToolPrivate::initializeDockWidgets()
this, SLOT(callerFunctionSelected(QModelIndex)));
m_calleesView = new CostView(mw);
+ m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView");
m_calleesView->sortByColumn(CallModel::CostColumn);
- m_calleesView->setObjectName("Valgrind.CallgrindToolPrivate.CalleesView");
m_calleesView->setFrameStyle(QFrame::NoFrame);
// enable sorting
QSortFilterProxyModel *calleeProxy = new QSortFilterProxyModel(m_calleesModel);
@@ -611,90 +659,40 @@ void CallgrindToolPrivate::initializeDockWidgets()
this, SLOT(calleeFunctionSelected(QModelIndex)));
m_flatView = new CostView(mw);
+ m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView");
m_flatView->sortByColumn(DataModel::SelfCostColumn);
m_flatView->setFrameStyle(QFrame::NoFrame);
m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);
m_flatView->setModel(m_proxyModel);
- m_flatView->setObjectName("Valgrind.CallgrindToolPrivate.FlatView");
connect(m_flatView, SIGNAL(activated(QModelIndex)),
this, SLOT(dataFunctionSelected(QModelIndex)));
updateCostFormat();
- QDockWidget *callersDock =
- am->createDockWidget(q, tr("Callers"), m_callersView,
- Qt::BottomDockWidgetArea);
+ QDockWidget *callersDock = AnalyzerManager::createDockWidget
+ (q, tr("Callers"), m_callersView, Qt::BottomDockWidgetArea);
+
+ QDockWidget *flatDock = AnalyzerManager::createDockWidget
+ (q, tr("Functions"), m_flatView, Qt::BottomDockWidgetArea);
- QDockWidget *flatDock =
- am->createDockWidget(q, tr("Functions"), m_flatView,
- Qt::BottomDockWidgetArea);
+ QDockWidget *calleesDock = AnalyzerManager::createDockWidget
+ (q, tr("Callees"), m_calleesView, Qt::BottomDockWidgetArea);
- QDockWidget *calleesDock =
- am->createDockWidget(q, tr("Callees"), m_calleesView,
- Qt::BottomDockWidgetArea);
+ QDockWidget *visualizationDock = AnalyzerManager::createDockWidget
+ (q, tr("Visualization"), m_visualisation, Qt::RightDockWidgetArea);
- QDockWidget *visualizationDock =
- am->createDockWidget(q, tr("Visualization"), m_visualisation,
- Qt::RightDockWidgetArea);
+ callersDock->show();
+ calleesDock->show();
+ flatDock->show();
visualizationDock->hide();
- mw->splitDockWidget(mw->toolBarDockWidget(), calleesDock, Qt::Vertical);
- mw->splitDockWidget(mw->toolBarDockWidget(), callersDock, Qt::Vertical);
mw->splitDockWidget(mw->toolBarDockWidget(), flatDock, Qt::Vertical);
- mw->tabifyDockWidget(callersDock, calleesDock);
-}
-
-IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
-{
- return d->createEngine(sp, runConfiguration);
-}
-
-IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
-{
- CallgrindEngine *engine = new CallgrindEngine(sp, runConfiguration);
-
- connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)),
- SLOT(takeParserData(CallgrindEngine *)));
- connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
- SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
- connect(engine, SIGNAL(finished()),
- SLOT(engineFinished()));
-
- connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump()));
- connect(this, SIGNAL(resetRequested()), engine, SLOT(reset()));
- connect(this, SIGNAL(pauseToggled(bool)), engine, SLOT(setPaused(bool)));
-
- // initialize engine
- engine->setPaused(m_pauseAction->isChecked());
-
- // we may want to toggle collect for one function only in this run
- engine->setToggleCollectFunction(m_toggleCollectFunction);
- m_toggleCollectFunction.clear();
-
- AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName()));
-
- // apply project settings
- AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
- CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>();
- QTC_ASSERT(settings, return engine)
-
- QTC_ASSERT(m_visualisation, return engine);
- m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
- m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
- m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips());
-
- return engine;
-}
-
-QWidget *CallgrindTool::createControlWidget()
-{
- return d->createControlWidget();
-}
+ mw->splitDockWidget(mw->toolBarDockWidget(), calleesDock, Qt::Vertical);
+ mw->splitDockWidget(calleesDock, callersDock, Qt::Horizontal);
-QWidget *CallgrindToolPrivate::createControlWidget()
-{
+ //
+ // Control Widget
+ //
QAction *action = 0;
QWidget *widget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout;
@@ -862,7 +860,7 @@ void CallgrindToolPrivate::engineFinished()
if (data)
showParserResults(data);
else
- AnalyzerManager::instance()->showStatusMessage(tr("Profiling aborted."));
+ AnalyzerManager::showStatusMessage(tr("Profiling aborted."));
}
void CallgrindToolPrivate::showParserResults(const ParseData *data)
@@ -879,7 +877,7 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
} else {
msg = tr("Parsing failed.");
}
- AnalyzerManager::instance()->showStatusMessage(msg);
+ AnalyzerManager::showStatusMessage(msg);
}
void CallgrindToolPrivate::editorOpened(Core::IEditor *editor)
@@ -938,8 +936,8 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
m_toggleCollectFunction = QString("%1()").arg(qualifiedFunctionName);
- AnalyzerManager::instance()->selectTool(q);
- AnalyzerManager::instance()->startTool(q);
+ AnalyzerManager::selectTool(q, StartMode(StartLocal));
+ AnalyzerManager::startTool(q, StartMode(StartLocal));
}
void CallgrindToolPrivate::slotRequestDump()
@@ -999,15 +997,6 @@ void CallgrindToolPrivate::createTextMarks()
}
}
-bool CallgrindTool::canRunLocally() const
-{
-#ifdef Q_OS_WINDOWS
- return false;
-#else
- return true;
-#endif
-}
-
} // namespace Internal
} // namespace Valgrind
diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h
index e3a438b70a..35da11be71 100644
--- a/src/plugins/valgrind/callgrindtool.h
+++ b/src/plugins/valgrind/callgrindtool.h
@@ -45,24 +45,21 @@ class CallgrindTool : public Analyzer::IAnalyzerTool
Q_OBJECT
public:
- explicit CallgrindTool(QObject *parent = 0);
+ CallgrindTool(QObject *parent);
~CallgrindTool();
- QString id() const;
+ QByteArray id() const;
QString displayName() const;
QString description() const;
- ToolMode mode() const;
+ ToolMode toolMode() const;
- void initialize();
void extensionsInitialized();
- void initializeDockWidgets();
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
- QWidget *createControlWidget();
+ QWidget *createWidgets();
- bool canRunRemotely() const { return true; }
- bool canRunLocally() const;
+ void startTool(Analyzer::StartMode mode);
private:
CallgrindToolPrivate *d;
diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp
index 10e82fc1db..341b7a5470 100644
--- a/src/plugins/valgrind/memcheckengine.cpp
+++ b/src/plugins/valgrind/memcheckengine.cpp
@@ -49,9 +49,9 @@ using namespace Valgrind::XmlProtocol;
namespace Valgrind {
namespace Internal {
-MemcheckEngine::MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : ValgrindEngine(sp, runConfiguration)
+MemcheckEngine::MemcheckEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+ : ValgrindEngine(tool, sp, runConfiguration)
{
connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
diff --git a/src/plugins/valgrind/memcheckengine.h b/src/plugins/valgrind/memcheckengine.h
index de21bdf5cd..6fb21599db 100644
--- a/src/plugins/valgrind/memcheckengine.h
+++ b/src/plugins/valgrind/memcheckengine.h
@@ -46,9 +46,10 @@ namespace Internal {
class MemcheckEngine : public ValgrindEngine
{
Q_OBJECT
+
public:
- explicit MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
+ MemcheckEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration);
void start();
void stop();
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index 109029a15b..9c2e89a817 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -37,6 +37,7 @@
#include "memcheckerrorview.h"
#include "memchecksettings.h"
#include "valgrindsettings.h"
+#include "valgrindplugin.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerconstants.h>
@@ -229,15 +230,8 @@ void MemcheckTool::settingsDestroyed(QObject *settings)
m_settings = AnalyzerGlobalSettings::instance();
}
-void MemcheckTool::extensionsInitialized()
-{
- //ensureWidgets(); // FIXME: Try to do that later.
-}
-
void MemcheckTool::maybeActiveRunConfigurationChanged()
{
- ensureWidgets();
-
AnalyzerSettings *settings = 0;
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
if (ProjectExplorer::Project *project = pe->startupProject()) {
@@ -292,9 +286,9 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
m_errorProxyModel->setFilterExternalIssues(memcheckSettings->filterExternalIssues());
}
-QString MemcheckTool::id() const
+QByteArray MemcheckTool::id() const
{
- return "Memcheck";
+ return "MemcheckLocal";
}
QString MemcheckTool::displayName() const
@@ -308,7 +302,7 @@ QString MemcheckTool::description() const
"memory leaks");
}
-IAnalyzerTool::ToolMode MemcheckTool::mode() const
+IAnalyzerTool::ToolMode MemcheckTool::toolMode() const
{
return DebugMode;
}
@@ -359,18 +353,12 @@ private:
QStringList m_projectFiles;
};
-void MemcheckTool::initializeDockWidgets()
-{
- ensureWidgets();
-}
-void MemcheckTool::ensureWidgets()
+QWidget *MemcheckTool::createWidgets()
{
- if (m_errorView)
- return;
+ QTC_ASSERT(!m_errorView, return 0);
- AnalyzerManager *am = AnalyzerManager::instance();
- Utils::FancyMainWindow *mw = am->mainWindow();
+ Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow();
m_errorView = new MemcheckErrorView;
m_errorView->setObjectName(QLatin1String("MemcheckErrorView"));
@@ -390,19 +378,16 @@ void MemcheckTool::ensureWidgets()
m_errorView->setAutoScroll(false);
m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
- QDockWidget *errorDock =
- am->createDockWidget(this, tr("Memory Issues"), m_errorView,
- Qt::BottomDockWidgetArea);
+ QDockWidget *errorDock = AnalyzerManager::createDockWidget
+ (this, tr("Memory Issues"), m_errorView, Qt::BottomDockWidgetArea);
mw->splitDockWidget(mw->toolBarDockWidget(), errorDock, Qt::Vertical);
connect(ProjectExplorer::ProjectExplorerPlugin::instance(),
SIGNAL(updateRunActions()), SLOT(maybeActiveRunConfigurationChanged()));
-}
-
-QWidget *MemcheckTool::createControlWidget()
-{
- ensureWidgets();
+ //
+ // The Control Widget.
+ //
QAction *action = 0;
QHBoxLayout *layout = new QHBoxLayout;
QToolButton *button = 0;
@@ -457,9 +442,10 @@ QWidget *MemcheckTool::createControlWidget()
IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
{
- m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()->project()->files(ProjectExplorer::Project::AllFiles) : QStringList());
+ m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
+ ->project()->files(ProjectExplorer::Project::AllFiles) : QStringList());
- MemcheckEngine *engine = new MemcheckEngine(sp, runConfiguration);
+ MemcheckEngine *engine = new MemcheckEngine(this, sp, runConfiguration);
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
@@ -468,10 +454,15 @@ IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
connect(engine, SIGNAL(internalParserError(QString)),
this, SLOT(internalParserError(QString)));
connect(engine, SIGNAL(finished()), this, SLOT(finished()));
- AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
+ AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
return engine;
}
+void MemcheckTool::startTool(StartMode mode)
+{
+ ValgrindPlugin::startValgrindTool(this, mode);
+}
+
void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
{
clearErrorView();
@@ -519,7 +510,7 @@ void MemcheckTool::internalParserError(const QString &errorString)
void MemcheckTool::clearErrorView()
{
- ensureWidgets();
+ QTC_ASSERT(m_errorView, return);
m_errorModel->clear();
qDeleteAll(m_suppressionActions);
@@ -529,7 +520,7 @@ void MemcheckTool::clearErrorView()
void MemcheckTool::updateErrorFilter()
{
- ensureWidgets();
+ QTC_ASSERT(m_errorView, return);
QTC_ASSERT(m_settings, return);
AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>();
@@ -556,21 +547,7 @@ void MemcheckTool::finished()
m_goBack->setEnabled(n > 0);
m_goNext->setEnabled(n > 0);
const QString msg = AnalyzerManager::msgToolFinished(displayName(), n);
- AnalyzerManager::instance()->showStatusMessage(msg);
-}
-
-bool MemcheckTool::canRunRemotely() const
-{
- return true;
-}
-
-bool MemcheckTool::canRunLocally() const
-{
-#ifdef Q_OS_WINDOWS
- return false;
-#else
- return true;
-#endif
+ AnalyzerManager::showStatusMessage(msg);
}
} // namespace Internal
diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h
index 611471290c..60fa684292 100644
--- a/src/plugins/valgrind/memchecktool.h
+++ b/src/plugins/valgrind/memchecktool.h
@@ -91,12 +91,11 @@ class MemcheckTool : public Analyzer::IAnalyzerTool
Q_OBJECT
public:
- explicit MemcheckTool(QObject *parent = 0);
+ MemcheckTool(QObject *parent);
- QString id() const;
+ QByteArray id() const;
QString displayName() const;
QString description() const;
- ToolMode mode() const;
private slots:
void settingsDestroyed(QObject *settings);
@@ -111,19 +110,17 @@ private slots:
void suppressionActionTriggered();
private:
- void ensureWidgets();
- bool canRunRemotely() const;
- bool canRunLocally() const;
- void initializeDockWidgets();
- void initialize() {}
- void extensionsInitialized();
- QWidget *createControlWidget();
+ ToolMode toolMode() const;
+ void extensionsInitialized() {}
+ QWidget *createWidgets();
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
+ void startTool(Analyzer::StartMode mode);
void clearErrorView();
+private:
Analyzer::AnalyzerSettings *m_settings;
QMenu *m_filterMenu;
diff --git a/src/plugins/valgrind/valgrind.pro b/src/plugins/valgrind/valgrind.pro
index 18bdb64441..e07d06ee74 100644
--- a/src/plugins/valgrind/valgrind.pro
+++ b/src/plugins/valgrind/valgrind.pro
@@ -1,20 +1,18 @@
TEMPLATE = lib
TARGET = Valgrind
-DEFINES += VALGRIND_LIBRARY
-
include(../../qtcreatorplugin.pri)
-include(valgrind.pri)
+include(valgrind_dependencies.pri)
+include(valgrind/valgrind.pri)
+QT *= network
-QT += network
+INCLUDEPATH *= $$PWD
HEADERS += \
valgrindplugin.h \
- valgrind_global.h \
valgrindengine.h \
valgrindconfigwidget.h \
valgrindsettings.h \
- \
callgrindconfigwidget.h \
callgrindcostdelegate.h \
callgrindcostview.h \
@@ -51,7 +49,6 @@ SOURCES += \
callgrindengine.cpp \
workarounds.cpp \
callgrindtextmark.cpp \
- \
memchecktool.cpp \
memcheckengine.cpp \
memcheckerrorview.cpp \
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp
new file mode 100644
index 0000000000..08f815034d
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp
@@ -0,0 +1,31 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h
new file mode 100644
index 0000000000..90518e9a09
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h
@@ -0,0 +1,54 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRINDABSTRACTMODEL_H
+#define LIBVALGRIND_CALLGRINDABSTRACTMODEL_H
+
+#include <QtGui/QAbstractItemView>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class ParseData;
+
+enum AbstractModelRoles
+{
+ ParentCostRole = Qt::UserRole,
+ RelativeTotalCostRole,
+ RelativeParentCostRole,
+ NextCustomRole
+};
+
+} // Callgrind
+} // Valgrind
+
+#endif // LIBVALGRIND_CALLGRINDABSTRACTMODEL_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp
new file mode 100644
index 0000000000..d2be2c250c
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp
@@ -0,0 +1,239 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindcallmodel.h"
+
+#include "callgrindfunctioncall.h"
+#include "callgrindfunction.h"
+#include "callgrindparsedata.h"
+
+#include <utils/qtcassert.h>
+
+#include <QVector>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN CallModel::Private
+
+class CallModel::Private
+{
+public:
+ Private();
+
+ const ParseData *m_data;
+ QVector<const FunctionCall *> m_calls;
+ int m_event;
+ const Function *m_function;
+};
+
+CallModel::Private::Private()
+ : m_data(0)
+ , m_event(0)
+ , m_function(0)
+{
+}
+
+//END CallModel::Private
+
+//BEGIN CallModel
+CallModel::CallModel(QObject *parent)
+ : QAbstractItemModel(parent), d(new Private)
+{
+}
+
+CallModel::~CallModel()
+{
+ delete d;
+}
+
+void CallModel::clear()
+{
+ beginResetModel();
+ d->m_function = 0;
+ d->m_calls.clear();
+ endResetModel();
+}
+
+void CallModel::setCalls(const QVector<const FunctionCall *> &calls, const Function *function)
+{
+ beginResetModel();
+ d->m_function = function;
+ d->m_calls = calls;
+ endResetModel();
+}
+
+QVector<const FunctionCall *> CallModel::calls() const
+{
+ return d->m_calls;
+}
+
+const Function *CallModel::function() const
+{
+ return d->m_function;
+}
+
+void CallModel::setCostEvent(int event)
+{
+ d->m_event = event;
+}
+
+int CallModel::costEvent() const
+{
+ return d->m_event;
+}
+
+void CallModel::setParseData(const ParseData *data)
+{
+ if (d->m_data == data)
+ return;
+
+ if (!data)
+ clear();
+
+ d->m_data = data;
+}
+
+const ParseData *CallModel::parseData() const
+{
+ return d->m_data;
+}
+
+int CallModel::rowCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+
+ if (parent.isValid())
+ return 0;
+
+ return d->m_calls.count();
+}
+
+int CallModel::columnCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+
+ if (parent.isValid())
+ return 0;
+
+ return ColumnCount;
+}
+
+QModelIndex CallModel::parent(const QModelIndex &child) const
+{
+ QTC_ASSERT(!child.isValid() || child.model() == this, return QModelIndex());
+
+ return QModelIndex();
+}
+
+QModelIndex CallModel::index(int row, int column, const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return QModelIndex());
+
+ if (row == 0 && rowCount(parent) == 0) // happens with empty models
+ return QModelIndex();
+
+ QTC_ASSERT(row >= 0 && row < rowCount(parent), return QModelIndex());
+
+ return createIndex(row, column);
+}
+
+QVariant CallModel::data(const QModelIndex &index, int role) const
+{
+ QTC_ASSERT(index.isValid() && index.model() == this, return QVariant());
+ QTC_ASSERT(index.column() >= 0 && index.column() < columnCount(index.parent()), return QVariant());
+ QTC_ASSERT(index.row() >= 0 && index.row() < rowCount(index.parent()), return QVariant());
+
+ const FunctionCall *call = d->m_calls.at(index.row());
+ const quint64 callCost = call->cost(d->m_event);
+ const quint64 parentCost = d->m_function->inclusiveCost(d->m_event);
+ if (role == ParentCostRole) {
+ return parentCost;
+ }
+ else if (role == FunctionCallRole
+ || role == RelativeParentCostRole || role == RelativeTotalCostRole) {
+ if (role == FunctionCallRole)
+ return QVariant::fromValue(call);
+
+ if (role == RelativeTotalCostRole) {
+ const quint64 totalCost = d->m_data->totalCost(d->m_event);
+ return (float) callCost / totalCost;
+ }
+
+ if (role == RelativeParentCostRole)
+ return (float) callCost / parentCost;
+ }
+ else if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
+ if (index.column() == CalleeColumn)
+ return call->callee()->name();
+ else if (index.column() == CallerColumn)
+ return call->caller()->name();
+ else if (index.column() == CostColumn && role != Qt::ToolTipRole)
+ return callCost;
+ else if (index.column() == CallsColumn && role != Qt::ToolTipRole)
+ return call->calls();
+ }
+
+ return QVariant();
+}
+
+QVariant CallModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Vertical || (role != Qt::DisplayRole && role != Qt::ToolTipRole))
+ return QVariant();
+
+ QTC_ASSERT(section >= 0 && section < columnCount(), return QVariant());
+
+ if (role == Qt::ToolTipRole) {
+ if (section == CostColumn) {
+ if (!d->m_data)
+ return QVariant();
+
+ return ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event));
+ }
+ return QVariant();
+ }
+
+ if (section == CalleeColumn)
+ return tr("Callee");
+ else if (section == CallerColumn)
+ return tr("Caller");
+ else if (section == CostColumn)
+ return tr("Cost");
+ else if (section == CallsColumn)
+ return tr("Calls");
+
+ return QVariant();
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h
new file mode 100644
index 0000000000..77bc69b850
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h
@@ -0,0 +1,97 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_CALLGRIND_CALLGRINDCALLMODEL_H
+#define VALGRIND_CALLGRIND_CALLGRINDCALLMODEL_H
+
+#include <QtCore/QAbstractItemModel>
+
+#include "callgrindabstractmodel.h"
+
+namespace Valgrind {
+namespace Callgrind {
+
+class FunctionCall;
+class Function;
+
+/**
+ * Model to display list of function calls.
+ */
+class CallModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ explicit CallModel(QObject *parent);
+ virtual ~CallModel();
+
+ void clear();
+
+ /// Only one cost event column will be shown, this decides which one it is.
+ /// By default it is the first event in the @c ParseData, i.e. 0.
+ virtual int costEvent() const;
+ virtual void setCostEvent(int event);
+
+ virtual void setParseData(const ParseData *data);
+ virtual const ParseData *parseData() const;
+
+ void setCalls(const QVector<const FunctionCall *> &calls, const Function *function);
+ QVector<const FunctionCall *> calls() const;
+ const Function *function() const;
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &child) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+ enum Columns {
+ CallerColumn,
+ CalleeColumn,
+ CallsColumn,
+ CostColumn,
+ ColumnCount
+ };
+
+ enum Roles {
+ FunctionCallRole = NextCustomRole
+ };
+
+private:
+ class Private;
+ Private *d;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // VALGRIND_CALLGRIND_CALLGRINDCALLMODEL_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp
new file mode 100644
index 0000000000..c968cfa1de
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp
@@ -0,0 +1,277 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindcontroller.h"
+
+#include <QDebug>
+#include <QDir>
+
+#include <valgrindprocess.h>
+
+#include <utils/qtcassert.h>
+#include <utils/ssh/sftpchannel.h>
+
+#include <QTemporaryFile>
+
+#define CALLGRIND_CONTROL_DEBUG 0
+
+const QLatin1String CALLGRIND_CONTROL_BINARY("callgrind_control");
+
+namespace Valgrind {
+namespace Callgrind {
+
+CallgrindController::CallgrindController(QObject *parent)
+ : QObject(parent)
+ , m_process(0)
+ , m_valgrindProc(0)
+ , m_lastOption(Unknown)
+{
+}
+
+CallgrindController::~CallgrindController()
+{
+ cleanupTempFile();
+}
+
+QString toOptionString(CallgrindController::Option option)
+{
+ /* Callgrind help from v3.6.0
+
+ Options:
+ -h --help Show this help text
+ --version Show version
+ -l --long Show more information
+ -s --stat Show statistics
+ -b --back Show stack/back trace
+ -e [<A>,...] Show event counters for <A>,... (default: all)
+ --dump[=<s>] Request a dump optionally using <s> as description
+ -z --zero Zero all event counters
+ -k --kill Kill
+ --instr=<on|off> Switch instrumentation state on/off
+ -w=<dir> Specify the startup directory of an active Callgrind run
+ */
+
+ switch (option) {
+ case CallgrindController::Dump:
+ return "--dump";
+ case CallgrindController::ResetEventCounters:
+ return "--zero";
+ case CallgrindController::Pause:
+ return "--instr=off";
+ case CallgrindController::UnPause:
+ return "--instr=on";
+ default:
+ return ""; // never reached
+ }
+}
+
+
+void CallgrindController::run(Option option)
+{
+ if (m_process) {
+ emit statusMessage(tr("Previous command has not yet finished."));
+ return;
+ }
+ QTC_ASSERT(m_valgrindProc, return)
+
+ if (RemoteValgrindProcess *remote = qobject_cast<RemoteValgrindProcess *>(m_valgrindProc))
+ m_process = new RemoteValgrindProcess(remote->connection(), this);
+ else
+ m_process = new LocalValgrindProcess(this);
+
+ connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
+ SLOT(processFinished(int,QProcess::ExitStatus)));
+ connect(m_process, SIGNAL(error(QProcess::ProcessError)),
+ SLOT(processError(QProcess::ProcessError)));
+
+ // save back current running operation
+ m_lastOption = option;
+
+ const QString optionString = toOptionString(option);
+
+ switch (option) {
+ case CallgrindController::Dump:
+ emit statusMessage(tr("Dumping profile data..."));
+ break;
+ case CallgrindController::ResetEventCounters:
+ emit statusMessage(tr("Resetting event counters..."));
+ break;
+ case CallgrindController::Pause:
+ emit statusMessage(tr("Pausing instrumentation..."));
+ break;
+ case CallgrindController::UnPause:
+ emit statusMessage(tr("Unpausing instrumentation..."));
+ break;
+ default:
+ break;
+ }
+
+#if CALLGRIND_CONTROL_DEBUG
+ m_process->setProcessChannelMode(QProcess::ForwardedChannels);
+#endif
+#ifdef Q_OS_WIN
+ int pid = 0;
+#else
+ const int pid = m_valgrindProc->pid();
+#endif
+ m_process->run(CALLGRIND_CONTROL_BINARY,
+ QStringList() << optionString << QString::number(pid),
+ QString(), QString());
+}
+
+void CallgrindController::processError(QProcess::ProcessError)
+{
+ QTC_ASSERT(m_process, return)
+ const QString error = m_process->errorString();
+ emit statusMessage(QString("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
+
+ m_process->deleteLater();
+ m_process = 0;
+}
+
+void CallgrindController::processFinished(int rc, QProcess::ExitStatus status)
+{
+ QTC_ASSERT(m_process, return);
+ const QString error = m_process->errorString();
+
+ delete m_process;
+ m_process = 0;
+
+ if (rc != 0 || status != QProcess::NormalExit) {
+ qWarning() << "Controller exited abnormally:" << error;
+ return;
+ }
+
+ // this call went fine, we might run another task after this
+ switch (m_lastOption) {
+ case ResetEventCounters:
+ // lets dump the new reset profiling info
+ run(Dump);
+ return;
+ case Pause:
+ // on pause, reset profiling info (for now)
+ run(ResetEventCounters);
+ return;
+ case Dump:
+ emit statusMessage(tr("Callgrind dumped profiling info"));
+ break;
+ case UnPause:
+ emit statusMessage(tr("Callgrind unpaused."));
+ break;
+ default:
+ break;
+ }
+
+ emit finished(m_lastOption);
+ m_lastOption = Unknown;
+}
+
+void CallgrindController::setValgrindProcess(ValgrindProcess *proc)
+{
+ m_valgrindProc = proc;
+}
+
+void CallgrindController::getLocalDataFile()
+{
+ QTC_ASSERT(m_valgrindProc, return);
+
+ // we look for callgrind.out.PID, but there may be updated ones called ~.PID.NUM
+ QString baseFileName = QString("callgrind.out.%1").
+ arg(m_valgrindProc->pid());
+ const QString workingDir = m_valgrindProc->workingDirectory();
+ // first, set the to-be-parsed file to callgrind.out.PID
+ QString fileName = workingDir.isEmpty() ? baseFileName : (workingDir + QDir::separator() + baseFileName);
+
+ if (RemoteValgrindProcess *remote = qobject_cast<RemoteValgrindProcess *>(m_valgrindProc)) {
+ ///TODO: error handling
+ emit statusMessage(tr("Downloading remote profile data..."));
+ m_ssh = remote->connection();
+ // if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
+ QString cmd = QString("ls -t %1* | head -n 1").arg(fileName);
+ m_findRemoteFile = m_ssh->createRemoteProcess(cmd.toUtf8());
+ connect(m_findRemoteFile.data(), SIGNAL(outputAvailable(QByteArray)),
+ this, SLOT(foundRemoteFile(QByteArray)));
+ m_findRemoteFile->start();
+ } else {
+ QDir dir(workingDir, QString("%1.*").arg(baseFileName), QDir::Time);
+ QStringList outputFiles = dir.entryList();
+ // if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
+ if (!outputFiles.isEmpty())
+ fileName = workingDir + QDir::separator() + dir.entryList().first();
+
+ emit localParseDataAvailable(fileName);
+ }
+}
+
+void CallgrindController::foundRemoteFile(const QByteArray &file)
+{
+ m_remoteFile = file.trimmed();
+
+ m_sftp = m_ssh->createSftpChannel();
+ connect(m_sftp.data(), SIGNAL(finished(Utils::SftpJobId,QString)),
+ this, SLOT(sftpJobFinished(Utils::SftpJobId,QString)));
+ connect(m_sftp.data(), SIGNAL(initialized()), this, SLOT(sftpInitialized()));
+ m_sftp->initialize();
+}
+
+void CallgrindController::sftpInitialized()
+{
+ cleanupTempFile();
+ QTemporaryFile dataFile(QDir::tempPath() + QDir::separator() + "callgrind.out.");
+ QTC_ASSERT(dataFile.open(), return);
+ m_tempDataFile = dataFile.fileName();
+ dataFile.setAutoRemove(false);
+ dataFile.close();
+
+ m_downloadJob = m_sftp->downloadFile(m_remoteFile, m_tempDataFile, Utils::SftpOverwriteExisting);
+}
+
+void CallgrindController::sftpJobFinished(Utils::SftpJobId job, const QString &error)
+{
+ QTC_ASSERT(job == m_downloadJob, return);
+
+ m_sftp->closeChannel();
+
+ if (error.isEmpty())
+ emit localParseDataAvailable(m_tempDataFile);
+}
+
+void CallgrindController::cleanupTempFile()
+{
+ if (!m_tempDataFile.isEmpty() && QFile::exists(m_tempDataFile))
+ QFile::remove(m_tempDataFile);
+
+ m_tempDataFile.clear();
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h
new file mode 100644
index 0000000000..0368f5316f
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h
@@ -0,0 +1,116 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef CALLGRINDCONTROLLER_H
+#define CALLGRINDCONTROLLER_H
+
+#include <QObject>
+
+#include <qprocess.h>
+
+#include <utils/ssh/sshconnection.h>
+#include <utils/ssh/sshremoteprocess.h>
+#include <utils/ssh/sftpchannel.h>
+
+namespace Valgrind {
+
+class ValgrindProcess;
+
+namespace Callgrind {
+
+class CallgrindController : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(Option)
+
+public:
+ enum Option {
+ Unknown,
+ Dump,
+ ResetEventCounters,
+ Pause, UnPause
+ };
+
+ explicit CallgrindController(QObject *parent = 0);
+ virtual ~CallgrindController();
+
+ void run(Valgrind::Callgrind::CallgrindController::Option option);
+
+ void setValgrindProcess(ValgrindProcess *process);
+ ValgrindProcess *valgrindProcess() { return m_valgrindProc; }
+
+ /**
+ * Make data file available locally, triggers @c localParseDataAvailable.
+ *
+ * If the valgrind process was run remotely, this transparently
+ * downloads the data file first and returns a local path.
+ */
+ void getLocalDataFile();
+
+Q_SIGNALS:
+ void finished(Valgrind::Callgrind::CallgrindController::Option option);
+
+ void localParseDataAvailable(const QString &file);
+
+ void statusMessage(const QString &msg);
+
+private Q_SLOTS:
+ void processError(QProcess::ProcessError);
+ void processFinished(int, QProcess::ExitStatus);
+
+ void foundRemoteFile(const QByteArray &file);
+ void sftpInitialized();
+ void sftpJobFinished(Utils::SftpJobId job, const QString &error);
+
+private:
+ void cleanupTempFile();
+
+ // callgrind_control process
+ Valgrind::ValgrindProcess *m_process;
+ // valgrind process
+ Valgrind::ValgrindProcess *m_valgrindProc;
+
+ Option m_lastOption;
+
+ // remote callgrind support
+ Utils::SshConnection::Ptr m_ssh;
+ QString m_tempDataFile;
+ Utils::SshRemoteProcess::Ptr m_findRemoteFile;
+ Utils::SftpChannel::Ptr m_sftp;
+ Utils::SftpJobId m_downloadJob;
+ QByteArray m_remoteFile;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // CALLGRINDCONTROLLER_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp
new file mode 100644
index 0000000000..a463ee75fa
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp
@@ -0,0 +1,145 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindcostitem.h"
+
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+
+#include "callgrindparsedata.h"
+#include "callgrindfunctioncall.h"
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN CostItem::Private
+
+class CostItem::Private {
+public:
+ Private(ParseData *data);
+ ~Private();
+
+ QVector<quint64> m_positions;
+ QVector<quint64> m_events;
+ const FunctionCall *m_call;
+
+ const ParseData *m_data;
+ qint64 m_differingFileId;
+};
+
+CostItem::Private::Private(ParseData *data)
+ : m_positions(data->positions().size(), 0)
+ , m_events(data->events().size(), 0)
+ , m_call(0)
+ , m_data(data)
+ , m_differingFileId(-1)
+{
+}
+
+CostItem::Private::~Private()
+{
+ delete m_call;
+}
+
+
+//BEGIN CostItem
+CostItem::CostItem(ParseData *data)
+: d(new Private(data))
+{
+}
+
+CostItem::~CostItem()
+{
+ delete d;
+}
+
+quint64 CostItem::position(int posIdx) const
+{
+ return d->m_positions.at(posIdx);
+}
+
+void CostItem::setPosition(int posIdx, quint64 position)
+{
+ d->m_positions[posIdx] = position;
+}
+
+QVector< quint64 > CostItem::positions() const
+{
+ return d->m_positions;
+}
+
+quint64 CostItem::cost(int event) const
+{
+ return d->m_events.at(event);
+}
+
+void CostItem::setCost(int event, quint64 cost)
+{
+ d->m_events[event] = cost;
+}
+
+QVector< quint64 > CostItem::costs() const
+{
+ return d->m_events;
+}
+
+const FunctionCall *CostItem::call() const
+{
+ return d->m_call;
+}
+
+void CostItem::setCall(const FunctionCall *call)
+{
+ d->m_call = call;
+}
+
+QString CostItem::differingFile() const
+{
+ if (d->m_differingFileId != -1)
+ return d->m_data->stringForFileCompression(d->m_differingFileId);
+ else
+ return QString();
+}
+
+qint64 CostItem::differingFileId() const
+{
+ return d->m_differingFileId;
+}
+
+void CostItem::setDifferingFile(qint64 fileId)
+{
+ d->m_differingFileId = fileId;
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h
new file mode 100644
index 0000000000..c0804606b0
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h
@@ -0,0 +1,103 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRIND_COSTITEM_H
+#define LIBVALGRIND_CALLGRIND_COSTITEM_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QString;
+template<typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace Callgrind {
+
+class FunctionCall;
+class ParseData;
+
+/**
+ * This class represents the cost(s) at given position(s).
+ */
+class CostItem
+{
+public:
+ /// @p data the file data this cost item was parsed in.
+ /// required for decompression of string data like differing source file information
+ explicit CostItem(ParseData *data);
+ ~CostItem();
+
+ /**
+ * Position data for the given position-index @p posIdx
+ * @see ParseData::positions()
+ */
+ quint64 position(int posIdx) const;
+ void setPosition(int posIdx, quint64 position);
+ QVector<quint64> positions() const;
+
+ /**
+ * Cost data for the given event-index @p event
+ * @see ParseData::events()
+ */
+ quint64 cost(int event) const;
+ void setCost(int event, quint64 cost);
+ QVector<quint64> costs() const;
+
+ /**
+ * If this cost item represents a function call, this will return the @c Callee.
+ * Otherwise zero will be returned.
+ */
+ const FunctionCall *call() const;
+ ///NOTE: @c CostItem will take ownership
+ void setCall(const FunctionCall *call);
+
+ /**
+ * If this cost item represents a jump to a different file, this will
+ * return the path to that file. The string will be empty otherwise.
+ */
+ QString differingFile() const;
+ /// @return compressed file id or -1 if none is set
+ qint64 differingFileId() const;
+ void setDifferingFile(qint64 fileId);
+
+private:
+ Q_DISABLE_COPY(CostItem)
+
+ class Private;
+ Private *d;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_CALLGRIND_COSTITEM_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp
new file mode 100644
index 0000000000..424bfa182b
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp
@@ -0,0 +1,123 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindcycledetection.h"
+
+#include "callgrindfunction.h"
+#include "callgrindfunctioncall.h"
+#include "callgrindparsedata.h"
+#include "callgrindfunctioncycle.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QDebug>
+
+namespace Valgrind {
+namespace Callgrind {
+namespace Internal {
+
+CycleDetection::CycleDetection(ParseData *data)
+ : m_data(data)
+ , m_depth(0)
+ , m_cycle(0)
+{
+}
+
+QVector<const Function *> CycleDetection::run(const QVector<const Function *> &input)
+{
+ foreach (const Function *function, input) {
+ Node *node = new Node;
+ node->function = function;
+ node->dfs = -1;
+ node->lowlink = -1;
+ m_nodes.insert(function, node);
+ }
+ foreach (Node *node, m_nodes) {
+ if (node->dfs == -1)
+ tarjan(node);
+ }
+ qDeleteAll(m_nodes);
+ return m_ret;
+}
+
+void CycleDetection::tarjan(Node *node)
+{
+ QTC_ASSERT(node->dfs == -1, return);
+ node->dfs = m_depth;
+ node->lowlink = m_depth;
+
+ m_depth++;
+ m_stack.push(node);
+
+ foreach (const FunctionCall *call, node->function->outgoingCalls())
+ tarjanForChildNode(node, m_nodes.value(call->callee()));
+
+ if (node->dfs == node->lowlink) {
+ QVector<const Function *> functions;
+ Node *n;
+ do {
+ n = m_stack.pop();
+ functions << n->function;
+ } while (n != node);
+
+ if (functions.size() == 1) {
+ // not a real cycle
+ m_ret.append(node->function);
+ } else {
+ // actual cycle
+ FunctionCycle *cycle = new FunctionCycle(m_data);
+ cycle->setFile(node->function->fileId());
+ m_cycle++;
+ qint64 id = -1;
+ m_data->addCompressedFunction(QString("cycle %1").arg(m_cycle), id);
+ cycle->setName(id);
+ cycle->setObject(node->function->objectId());
+ cycle->setFunctions(functions);
+ m_ret.append(cycle);
+ }
+ }
+}
+
+void CycleDetection::tarjanForChildNode(Node *node, Node *childNode)
+{
+ if (childNode->dfs == -1) {
+ tarjan(childNode);
+ if (childNode->lowlink < node->lowlink)
+ node->lowlink = childNode->lowlink;
+ } else if (childNode->dfs < node->lowlink && m_stack.contains(childNode)) {
+ node->lowlink = childNode->dfs;
+ }
+}
+
+} // namespace Internal
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h
new file mode 100644
index 0000000000..1420145612
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h
@@ -0,0 +1,86 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRINDCYCLEDETECTION_H
+#define LIBVALGRIND_CALLGRINDCYCLEDETECTION_H
+
+#include <QtCore/QHash>
+#include <QtCore/QStack>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function;
+class ParseData;
+
+namespace Internal {
+
+/**
+ * Implementation of Tarjan's strongly connected components algorithm, to find function cycles,
+ * as suggested by the GProf paper:
+ *
+ * ``gprof: A Call Graph Execution Profiler'', by S. Graham, P. Kessler,
+ * M. McKusick; Proceedings of the SIGPLAN '82 Symposium on Compiler Construction,
+ * SIGPLAN Notices, Vol. 17, No 6, pp. 120-126, June 1982.
+ */
+class CycleDetection
+{
+public:
+ explicit CycleDetection(ParseData *data);
+ QVector<const Function *> run(const QVector<const Function *> &input);
+
+private:
+ ParseData *m_data;
+
+ struct Node {
+ int dfs;
+ int lowlink;
+ const Function *function;
+ };
+
+ void tarjan(Node *node);
+ void tarjanForChildNode(Node *node, Node *childNode);
+
+ QHash<const Function *, Node *> m_nodes;
+ QStack<Node *> m_stack;
+ QVector<const Function *> m_ret;
+ int m_depth;
+
+ int m_cycle;
+};
+
+} // namespace Internal
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_CALLGRINDCYCLEDETECTION_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp
new file mode 100644
index 0000000000..f72d6fae58
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp
@@ -0,0 +1,365 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrinddatamodel.h"
+
+#include "callgrindparsedata.h"
+#include "callgrindfunction.h"
+#include "callgrindcostitem.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QChar>
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN Helper
+
+namespace {
+ // minimum amount of columns, i.e.:
+ // function name
+ // file name
+ // object name
+ // num called
+ // Additional to this, 2 * ParseData::events().size will be shown (inclusive + self cost)
+ const int MinColumnSize = 4;
+}
+
+//BEGIN DataModel::Private
+
+class DataModel::Private
+{
+public:
+ Private()
+ : m_data(0)
+ , m_event(0)
+ , m_verboseToolTips(true)
+ , m_cycleDetection(false)
+ {
+ }
+
+ void updateFunctions();
+
+ const ParseData *m_data;
+ int m_event;
+ bool m_verboseToolTips;
+ bool m_cycleDetection;
+ QVector<const Function *> m_functions;
+};
+
+struct SortFunctions {
+ SortFunctions(int event)
+ : m_event(event)
+ {
+ }
+ bool operator()(const Function *left, const Function *right)
+ {
+ return left->inclusiveCost(m_event) > right->inclusiveCost(m_event);
+ }
+ int m_event;
+};
+
+void DataModel::Private::updateFunctions()
+{
+ if (m_data) {
+ m_functions = m_data->functions(m_cycleDetection);
+ qSort(m_functions.begin(), m_functions.end(), SortFunctions(m_event));
+ } else {
+ m_functions.clear();
+ }
+}
+
+//BEGIN DataModel
+
+DataModel::DataModel(QObject *parent)
+ : QAbstractItemModel(parent), d(new Private)
+{
+}
+
+DataModel::~DataModel()
+{
+ delete d;
+}
+
+void DataModel::setParseData(const ParseData *data)
+{
+ if (d->m_data == data)
+ return;
+
+ beginResetModel();
+ d->m_data = data;
+ d->m_event = 0;
+ d->updateFunctions();
+ endResetModel();
+}
+
+void DataModel::setVerboseToolTipsEnabled(bool enabled)
+{
+ d->m_verboseToolTips = enabled;
+}
+
+bool DataModel::verboseToolTipsEnabled() const
+{
+ return d->m_verboseToolTips;
+}
+
+const ParseData *DataModel::parseData() const
+{
+ return d->m_data;
+}
+
+void DataModel::setCostEvent(int event)
+{
+ if (!d->m_data)
+ return;
+
+ QTC_ASSERT(event >= 0 && d->m_data->events().size() > event, return)
+ beginResetModel();
+ d->m_event = event;
+ d->updateFunctions();
+ endResetModel();
+ emit dataChanged(index(0, SelfCostColumn), index(qMax(0, rowCount() - 1), InclusiveCostColumn));
+}
+
+int DataModel::costEvent() const
+{
+ return d->m_event;
+}
+
+int DataModel::rowCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+
+ if (!d->m_data || parent.isValid())
+ return 0;
+
+ return d->m_functions.size();
+}
+
+int DataModel::columnCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+ if (parent.isValid())
+ return 0;
+
+ return ColumnCount;
+}
+
+QModelIndex DataModel::index(int row, int column, const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return QModelIndex());
+ if (row == 0 && rowCount(parent) == 0) // happens with empty models
+ return QModelIndex();
+ QTC_ASSERT(row >= 0 && row < rowCount(parent), return QModelIndex());
+ return createIndex(row, column);
+}
+
+QModelIndex DataModel::parent(const QModelIndex &child) const
+{
+ QTC_ASSERT(!child.isValid() || child.model() == this, return QModelIndex());
+ return QModelIndex();
+}
+
+QModelIndex DataModel::indexForObject(const Function *function) const
+{
+ if (!function)
+ return QModelIndex();
+
+ const int row = d->m_functions.indexOf(function);
+ if (row < 0)
+ return QModelIndex();
+
+ return createIndex(row, 0);
+}
+
+/**
+ * Evil workaround for http://bugreports.qt.nokia.com/browse/QTBUG-1135
+ * Just replace the bad hyphens by a 'NON-BREAKING HYPHEN' unicode char
+ */
+static QString noWrap(const QString &str)
+{
+ QString escapedStr = str;
+ return escapedStr.replace("-", "&#8209;");
+}
+
+QVariant DataModel::data(const QModelIndex &index, int role) const
+{
+ QTC_ASSERT(index.isValid() && index.model() == this, return QVariant());
+ QTC_ASSERT(index.column() >= 0 && index.column() < columnCount(index.parent()), return QVariant());
+ QTC_ASSERT(index.row() >= 0 && index.row() < rowCount(index.parent()), return QVariant());
+
+ const Function *func = d->m_functions.at(index.row());
+ const quint64 selfCost = func->selfCost(d->m_event);
+ const quint64 inclusiveCost = func->inclusiveCost(d->m_event);
+ const quint64 totalCost = d->m_data->totalCost(d->m_event);
+
+ if (role == FunctionRole) {
+ return QVariant::fromValue(func);
+ }
+ else if (role == ParentCostRole) {
+ return totalCost;
+ }
+ // the data model does not know about parent<->child relationship
+ else if (role == RelativeParentCostRole || role == RelativeTotalCostRole) {
+ if (index.column() == SelfCostColumn)
+ return (float)selfCost / totalCost;
+ if (index.column() == InclusiveCostColumn)
+ return (float)inclusiveCost / totalCost;
+ }
+ else if (role == LineNumberRole) {
+ return func->lineNumber();
+ }
+ else if (role == FileNameRole) {
+ return func->file();
+ }
+ else if (role == Qt::TextAlignmentRole) {
+ if (index.column() == CalledColumn) {
+ return Qt::AlignRight;
+ }
+ }
+ else if (role == Qt::DisplayRole) {
+ if (index.column() == NameColumn)
+ return func->name();
+ if (index.column() == LocationColumn)
+ return func->location();
+ if (index.column() == CalledColumn)
+ return func->called();
+ if (index.column() == SelfCostColumn)
+ return selfCost;
+ if (index.column() == InclusiveCostColumn)
+ return inclusiveCost;
+ } else if (role == Qt::ToolTipRole) {
+ if (!d->m_verboseToolTips)
+ return data(index, Qt::DisplayRole);
+
+ QString ret = "<html><head><style>\
+ dt { font-weight: bold; }\
+ dd { font-family: monospace; }\
+ tr.head, td.head { font-weight: bold; }\
+ tr.head { text-decoration: underline; }\
+ td.group { padding-left: 20px; }\
+ td { white-space: nowrap; }\
+ </style></head>\n";
+
+ // body, function info first
+ ret += "<body><dl>";
+ ret += "<dt>" + tr("Function:") + "</dt><dd>" + func->name() + "</dd>\n";
+ ret += "<dt>" + tr("File:") + "</dt><dd>" + func->file() + "</dd>\n";
+ if (!func->costItems().isEmpty()) {
+ const CostItem *firstItem = func->costItems().first();
+ for (int i = 0; i < d->m_data->positions().size(); ++i) {
+ ret += "<dt>" + ParseData::prettyStringForPosition(d->m_data->positions().at(i)) + "</dt>";
+ ret += "<dd>" + QString::number(firstItem->position(i)) + "</dd>\n";
+ }
+ }
+ ret += "<dt>" + tr("Object:") + "</dt><dd>" + func->object() + "</dd>\n";
+ ret += "<dt>" + tr("Called:") + "</dt><dd>" + tr("%n time(s)", 0, func->called()) + "</dd>\n";
+ ret += "</dl><p/>";
+
+ // self/inclusive costs
+ ret += "<table>";
+ ret += "<thead><tr class='head'><td>" + tr("Events") + "</td>";
+ ret += "<td class='group'>" + tr("Self costs") + "</td><td>" + tr("(%)") + "</td>";
+ ret += "<td class='group'>" + tr("Incl. costs") + "</td><td>" + tr("(%)") + "</td>";
+ ret += "</tr></thead>";
+ ret += "<tbody>";
+ for (int i = 0; i < d->m_data->events().size(); ++i) {
+ quint64 selfCost = func->selfCost(i);
+ quint64 inclCost = func->inclusiveCost(i);
+ quint64 totalCost = d->m_data->totalCost(i);
+ // 0.00% format
+ const float relSelfCost = (float)qRound((float)selfCost / totalCost * 10000) / 100;
+ const float relInclCost = (float)qRound((float)inclCost / totalCost * 10000) / 100;
+
+ ret += "<tr>";
+ ret += "<td class='head'><nobr>" + noWrap(ParseData::prettyStringForEvent(d->m_data->events().at(i))) + "</nobr></td>";
+ ret += "<td class='group'>" + tr("%1").arg(selfCost) + "</td>";
+ ret += "<td>" + tr("(%1%)").arg(relSelfCost) + "</td>";
+ ret += "<td class='group'>" + tr("%1").arg(inclCost) + "</td>";
+ ret += "<td>" + tr("(%1%)").arg(relInclCost) + "</td>";
+ ret += "</tr>";
+ }
+ ret += "</tbody></table>";
+ ret += "</body></html>";
+ return ret;
+ }
+
+ return QVariant();
+}
+
+QVariant DataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Vertical || (role != Qt::DisplayRole && role != Qt::ToolTipRole))
+ return QVariant();
+
+ QTC_ASSERT(section >= 0 && section < columnCount(), return QVariant());
+
+ if (role == Qt::ToolTipRole) {
+ if (!d->m_data)
+ return QVariant();
+
+ const QString prettyCostStr = ParseData::prettyStringForEvent(d->m_data->events().at(d->m_event));
+ if (section == SelfCostColumn)
+ return tr("%1 cost spent in a given function excluding costs from called functions.").arg(prettyCostStr);
+ if (section == InclusiveCostColumn)
+ return tr("%1 cost spent in a given function including costs from called functions.").arg(prettyCostStr);
+ return QVariant();
+ }
+
+ if (section == NameColumn)
+ return tr("Function");
+ if (section == LocationColumn)
+ return tr("Location");
+ if (section == CalledColumn)
+ return tr("Called");
+ if (section == SelfCostColumn)
+ return tr("Self Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
+ if (section == InclusiveCostColumn)
+ return tr("Incl. Cost: %1").arg(d->m_data ? d->m_data->events().value(d->m_event) : QString());
+
+ return QVariant();
+}
+
+void DataModel::enableCycleDetection(bool enabled)
+{
+ beginResetModel();
+ d->m_cycleDetection = enabled;
+ d->updateFunctions();
+ endResetModel();
+}
+
+} // namespace Valgrind
+} // namespace Callgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h
new file mode 100644
index 0000000000..c155ef661c
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h
@@ -0,0 +1,105 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H
+#define VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H
+
+#include "callgrindabstractmodel.h"
+
+#include <QtCore/QAbstractItemModel>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function;
+class ParseData;
+
+class DataModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ explicit DataModel(QObject *parent);
+ virtual ~DataModel();
+
+ virtual void setParseData(const ParseData *data);
+ virtual const ParseData *parseData() const;
+
+ void setVerboseToolTipsEnabled(bool enabled);
+ bool verboseToolTipsEnabled() const;
+
+ /// Only one cost event column will be shown, this decides which one it is.
+ /// By default it is the first event in the @c ParseData, i.e. 0.
+ virtual int costEvent() const;
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &child) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+
+ QModelIndex indexForObject(const Function *function) const;
+
+ enum Columns {
+ NameColumn,
+ LocationColumn,
+ CalledColumn,
+ SelfCostColumn,
+ InclusiveCostColumn,
+ ColumnCount
+ };
+
+ enum Roles {
+ FunctionRole = NextCustomRole,
+ LineNumberRole,
+ FileNameRole
+ };
+
+public slots:
+ /// enable/disable cycle detection
+ void enableCycleDetection(bool enabled);
+
+ /// Only one cost event column will be shown, this decides which one it is.
+ /// By default it is the first event in the @c ParseData, i.e. 0.
+ virtual void setCostEvent(int event);
+
+private:
+ class Private;
+ Private *d;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp
new file mode 100644
index 0000000000..49069c9cf2
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp
@@ -0,0 +1,335 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindfunction.h"
+
+#include "callgrindfunctioncall.h"
+#include "callgrindcostitem.h"
+#include "callgrindparsedata.h"
+#include "callgrindfunction_p.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <QtCore/QFileInfo>
+#include <QtCore/QCoreApplication>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN Function::Private
+
+Function::Private::Private(const ParseData *data)
+ : m_data(data)
+ , m_fileId(-1)
+ , m_objectId(-1)
+ , m_nameId(-1)
+ , m_selfCost(data->events().size(), 0)
+ , m_inclusiveCost(data->events().size(), 0)
+ , m_called(0)
+{
+}
+
+Function::Private::~Private()
+{
+ // we don't own m_callers
+ // we own the costitem which in turn owns the callees,
+ // so only delete the former
+ qDeleteAll(m_costItems);
+
+ qDeleteAll(m_outgoingCalls);
+}
+
+void Function::Private::accumulateCost(QVector<quint64> &base, const QVector<quint64> &add)
+{
+ if (base.isEmpty()) {
+ base = add;
+ } else {
+ ///TODO: see whether .data() is noticably faster (less detaching)
+ int i = 0;
+ foreach (quint64 cost, add)
+ base[i++] += cost;
+ }
+}
+
+FunctionCall *Function::Private::accumulateCall(const FunctionCall *call, CallType type)
+{
+ const Function *key = (type == Incoming) ? call->caller() : call->callee();
+ QHash<const Function *, FunctionCall *> &callMap = (type == Incoming) ? m_incomingCallMap : m_outgoingCallMap;
+
+ FunctionCall *accumulatedCall = callMap.value(key, 0);
+ if (!accumulatedCall) {
+ accumulatedCall = new FunctionCall;
+ if (type == Incoming)
+ m_incomingCalls << accumulatedCall;
+ else
+ m_outgoingCalls << accumulatedCall;
+
+ accumulatedCall->setCallee(call->callee());
+ accumulatedCall->setCaller(call->caller());
+ ///TODO: could the destinations differ from call to call? they should not, or?
+ accumulatedCall->setDestinations(call->destinations());
+ callMap.insert(key, accumulatedCall);
+
+ accumulatedCall->setCosts(call->costs());
+ } else {
+ QVector<quint64> costs = accumulatedCall->costs();
+ accumulateCost(costs, call->costs());
+ accumulatedCall->setCosts(costs);
+ }
+
+ accumulatedCall->setCalls(accumulatedCall->calls() + call->calls());
+ return accumulatedCall;
+}
+
+//BEGIN Function
+Function::Function(const ParseData *data)
+ : d(new Private(data))
+{
+}
+
+Function::Function(Function::Private *d)
+ : d(d)
+{
+}
+
+Function::~Function()
+{
+ delete d;
+}
+
+qint64 Function::nameId() const
+{
+ return d->m_nameId;
+}
+
+QString Function::name() const
+{
+ if (d->m_nameId != -1)
+ return d->m_data->stringForFunctionCompression(d->m_nameId);
+ else
+ return QString();
+}
+
+void Function::setName(qint64 id)
+{
+ d->m_nameId = id;
+}
+
+qint64 Function::fileId() const
+{
+ return d->m_fileId;
+}
+
+QString Function::file() const
+{
+ if (d->m_fileId != -1)
+ return d->m_data->stringForFileCompression(d->m_fileId);
+ else
+ return QString();
+}
+
+void Function::setFile(qint64 id)
+{
+ d->m_fileId = id;
+}
+
+qint64 Function::objectId() const
+{
+ return d->m_objectId;
+}
+
+QString Function::object() const
+{
+ if (d->m_objectId != -1)
+ return d->m_data->stringForObjectCompression(d->m_objectId);
+ else
+ return QString();
+}
+
+void Function::setObject(qint64 id)
+{
+ d->m_objectId = id;
+}
+
+QString Function::location() const
+{
+ QString pos;
+ foreach (const CostItem *costItem, d->m_costItems) {
+ if (costItem->differingFileId() != -1) {
+ QTextStream stream(&pos);
+ stream << '(';
+ for (int i = 0, c = costItem->positions().count(); i < c; ++i) {
+ ///TODO: remember what was hex formatted
+ stream << costItem->position(i);
+ if (i != c - 1)
+ stream << ", ";
+ }
+ stream << ')';
+ break;
+ }
+ }
+ QString f = file();
+
+ if (!f.isEmpty()) {
+ QFileInfo info(f);
+ if (info.exists()) {
+ f = info.canonicalFilePath();
+ }
+ }
+
+ QString o = object();
+ if (o.isEmpty())
+ return QString();
+ if (f.isEmpty() || f == "???")
+ return o;
+ if (pos.isEmpty())
+ return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o);
+
+ return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1:%2 in %3").arg(f, pos, o);
+}
+
+int Function::lineNumber() const
+{
+ const int lineIdx = d->m_data->lineNumberPositionIndex();
+ if (lineIdx == -1)
+ return -1;
+
+ foreach (const CostItem *costItem, d->m_costItems) {
+ if (costItem->differingFileId() == -1)
+ return costItem->position(lineIdx);
+ }
+
+ return -1;
+}
+
+quint64 Function::selfCost(int event) const
+{
+ return d->m_selfCost.at(event);
+}
+
+QVector< quint64 > Function::selfCosts() const
+{
+ return d->m_selfCost;
+}
+
+quint64 Function::inclusiveCost(int event) const
+{
+ return d->m_inclusiveCost.at(event) + d->m_selfCost.at(event);
+}
+
+QVector<const FunctionCall *> Function::outgoingCalls() const
+{
+ return d->m_outgoingCalls;
+}
+
+void Function::addOutgoingCall(const FunctionCall *call)
+{
+ QTC_ASSERT(call->caller() == this, return);
+
+ d->accumulateCall(call, Private::Outgoing);
+}
+
+QVector<const FunctionCall *> Function::incomingCalls() const
+{
+ return d->m_incomingCalls;
+}
+
+void Function::addIncomingCall(const FunctionCall *call)
+{
+ QTC_ASSERT(call->callee() == this, return);
+ d->m_called += call->calls();
+ d->accumulateCall(call, Private::Incoming);
+}
+
+quint64 Function::called() const
+{
+ return d->m_called;
+}
+
+QVector<const CostItem *> Function::costItems() const
+{
+ return d->m_costItems;
+}
+
+void Function::addCostItem(const CostItem *item)
+{
+ QTC_ASSERT(!d->m_costItems.contains(item), return);
+
+ d->m_costItems.append(item);
+
+ // accumulate costs
+ if (item->call()) {
+ d->accumulateCost(d->m_inclusiveCost, item->costs());
+ } else {
+ d->accumulateCost(d->m_selfCost, item->costs());
+ }
+}
+
+void Function::finalize()
+{
+ bool recursive = false;
+ foreach (const FunctionCall *call, d->m_incomingCalls) {
+ if (call->caller() == this) {
+ recursive = true;
+ break;
+ }
+ }
+
+ if (recursive) {
+ // now handle recursive calls by setting the incl cost to the sum of all (external) calls
+ // to this function
+ // e.g.: A -> B -> B ..., C -> B -> B ...
+ // cost of B = cost of call to B in A + cost of call to B in C + ...
+ d->m_inclusiveCost.fill(0);
+ foreach (const FunctionCall *call, d->m_incomingCalls) {
+ if (call->caller() != this) {
+ foreach (const CostItem *costItem, call->caller()->costItems()) {
+ if (costItem->call() && costItem->call()->callee() == this)
+ d->accumulateCost(d->m_inclusiveCost, costItem->costs());
+ }
+ }
+ }
+ // now subtract self cost (see @c inclusiveCost() implementation)
+ for (int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
+ if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
+ d->m_inclusiveCost[i] = 0;
+ else
+ d->m_inclusiveCost[i] -= d->m_selfCost.at(i);
+ }
+ }
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h
new file mode 100644
index 0000000000..50a84b9218
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h
@@ -0,0 +1,161 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRIND_FUNCTION_H
+#define LIBVALGRIND_CALLGRIND_FUNCTION_H
+
+#include <QtCore/QMetaType>
+
+QT_BEGIN_NAMESPACE
+class QString;
+template <typename T> class QVector;
+template <typename T> class QSet;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace Callgrind {
+
+class FunctionCall;
+class CostItem;
+class ParseData;
+
+class Function
+{
+public:
+ /// @p data the ParseData for the file this function was part of
+ /// required for the decompression of string data like function name etc.
+ explicit Function(const ParseData *data);
+ virtual ~Function();
+
+ /// @return the compressed function name id
+ qint64 nameId() const;
+ /// @return the function name.
+ QString name() const;
+ /**
+ * Set function name to internal string id @p id.
+ * @see ParseData::stringForFunction()
+ */
+ void setName(qint64 id);
+
+ /// @return the compressed file id
+ qint64 fileId() const;
+ /// @return the file path where this function was defined
+ QString file() const;
+ /**
+ * Set function name to internal string id @p id.
+ * @see ParseData::stringForFunction()
+ */
+ void setFile(qint64 id);
+
+ /// @return the compressed object id
+ qint64 objectId() const;
+ /// @return the object where this function was defined
+ QString object() const;
+ /**
+ * Set function name to internal string id @p id.
+ * @see ParseData::stringForFunction()
+ */
+ void setObject(qint64 id);
+
+ /**
+ * @return a string representing the location of this function
+ * It is a combination of file, object and line of the first CostItem.
+ */
+ QString location() const;
+
+ /**
+ * @return the line number of the function or -1 if not known
+ */
+ int lineNumber() const;
+
+ /**
+ * total accumulated self cost of @p event
+ * @see ParseData::events()
+ */
+ quint64 selfCost(int event) const;
+ QVector<quint64> selfCosts() const;
+
+ /**
+ * total accumulated inclusive cost of @p event
+ * @see ParseData::events()
+ */
+ quint64 inclusiveCost(int event) const;
+
+ /// calls from other functions to this function
+ QVector<const FunctionCall *> incomingCalls() const;
+ void addIncomingCall(const FunctionCall *call);
+ /// @return how often this function was called in total
+ quint64 called() const;
+
+ /**
+ * The detailed list of cost items, which could e.g. be used for
+ * a detailed view of the function's source code annotated with
+ * cost per line.
+ */
+ QVector<const CostItem *> costItems() const;
+
+ /**
+ * Add parsed @c CostItem @p item to this function.
+ *
+ * NOTE: The @c Function will take ownership.
+ */
+ void addCostItem(const CostItem *item);
+
+ /**
+ * Function calls from this function to others.
+ */
+ QVector<const FunctionCall *> outgoingCalls() const;
+ void addOutgoingCall(const FunctionCall *call);
+
+ /**
+ * Gets called after all functions where looked up, required
+ * to properly calculate inclusive cost of recursive functions
+ * for example
+ */
+ void finalize();
+
+protected:
+ class Private;
+ Private *d;
+
+ explicit Function(Private *d);
+
+private:
+ Q_DISABLE_COPY(Function)
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+Q_DECLARE_METATYPE(const Valgrind::Callgrind::Function *);
+
+#endif // LIBVALGRIND_CALLGRIND_FUNCTION_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h
new file mode 100644
index 0000000000..b7fac85811
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h
@@ -0,0 +1,82 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRINDFUNCTION_P_H
+#define LIBVALGRIND_CALLGRINDFUNCTION_P_H
+
+#include "callgrindfunction.h"
+#include "callgrindparsedata.h"
+#include "callgrindcostitem.h"
+#include "callgrindfunctioncall.h"
+
+#include <QtCore/QVector>
+#include <QtCore/QHash>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function::Private
+{
+public:
+ Private(const ParseData *data);
+ ~Private();
+
+ static void accumulateCost(QVector<quint64> &base, const QVector<quint64> &add);
+ enum CallType {
+ Incoming,
+ Outgoing
+ };
+ ///@return accumulated call
+ FunctionCall *accumulateCall(const FunctionCall *call, CallType type);
+
+ const ParseData *m_data;
+ qint64 m_fileId;
+ qint64 m_objectId;
+ qint64 m_nameId;
+
+ QVector<quint64> m_selfCost;
+ QVector<quint64> m_inclusiveCost;
+
+ QVector<const CostItem *> m_costItems;
+ // used to accumulate, hence values not const
+ QHash<const Function *, FunctionCall *> m_outgoingCallMap;
+ QHash<const Function *, FunctionCall *> m_incomingCallMap;
+ // used in public api, hence const
+ QVector<const FunctionCall *> m_outgoingCalls;
+ QVector<const FunctionCall *> m_incomingCalls;
+ quint64 m_called;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_CALLGRINDFUNCTION_P_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp
new file mode 100644
index 0000000000..69dbce2b7c
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp
@@ -0,0 +1,140 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindfunctioncall.h"
+
+#include "callgrindfunction.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QVector>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN FunctionCall::Private
+class FunctionCall::Private
+{
+public:
+ explicit Private();
+
+ const Function *m_callee;
+ const Function *m_caller;
+ quint64 m_calls;
+ quint64 m_totalInclusiveCost;
+ QVector<quint64> m_destinations;
+ QVector<quint64> m_costs;
+};
+
+FunctionCall::Private::Private()
+ : m_callee(0)
+ , m_caller(0)
+ , m_calls(0)
+ , m_totalInclusiveCost(0)
+{
+}
+
+//BEGIN FunctionCall
+
+FunctionCall::FunctionCall()
+ : d(new Private)
+{
+}
+
+FunctionCall::~FunctionCall()
+{
+ delete d;
+}
+
+const Function *FunctionCall::callee() const
+{
+ return d->m_callee;
+}
+
+void FunctionCall::setCallee(const Function *function)
+{
+ d->m_callee = function;
+}
+
+const Function *FunctionCall::caller() const
+{
+ return d->m_caller;
+}
+
+void FunctionCall::setCaller(const Function *function)
+{
+ d->m_caller = function;
+}
+
+quint64 FunctionCall::calls() const
+{
+ return d->m_calls;
+}
+
+void FunctionCall::setCalls(quint64 calls)
+{
+ d->m_calls = calls;
+}
+
+quint64 FunctionCall::destination(int posIdx) const
+{
+ return d->m_destinations.at(posIdx);
+}
+
+QVector<quint64> FunctionCall::destinations() const
+{
+ return d->m_destinations;
+}
+
+void FunctionCall::setDestinations(const QVector<quint64> &destinations)
+{
+ d->m_destinations = destinations;
+}
+
+quint64 FunctionCall::cost(int event) const
+{
+ QTC_ASSERT(event >= 0 && event < d->m_costs.size(), return 0);
+ return d->m_costs.at(event);
+}
+
+QVector<quint64> FunctionCall::costs() const
+{
+ return d->m_costs;
+}
+
+void FunctionCall::setCosts(const QVector<quint64> &costs)
+{
+ d->m_costs = costs;
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h
new file mode 100644
index 0000000000..2e825ebca3
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h
@@ -0,0 +1,96 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRIND_CALLEE_H
+#define LIBVALGRIND_CALLGRIND_CALLEE_H
+
+#include <QtCore/QMetaType>
+
+QT_BEGIN_NAMESPACE
+template <typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function;
+
+/**
+ * This represents a function call.
+ */
+class FunctionCall
+{
+public:
+ explicit FunctionCall();
+ ~FunctionCall();
+
+ /// the called function
+ const Function *callee() const;
+ void setCallee(const Function *function);
+
+ /// the calling function
+ const Function *caller() const;
+ void setCaller(const Function *function);
+
+ /// how often the function was called
+ quint64 calls() const;
+ void setCalls(quint64 calls);
+
+ /**
+ * Destination position data for the given position-index @p posIdx
+ * @see ParseData::positions()
+ */
+ quint64 destination(int posIdx) const;
+ QVector<quint64> destinations() const;
+ void setDestinations(const QVector<quint64> &destinations);
+
+ /**
+ * Inclusive cost of the function call.
+ * @see ParseData::events()
+ */
+ quint64 cost(int event) const;
+ QVector<quint64> costs() const;
+ void setCosts(const QVector<quint64> &costs);
+
+private:
+ Q_DISABLE_COPY(FunctionCall);
+
+ class Private;
+ Private *d;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+Q_DECLARE_METATYPE(const Valgrind::Callgrind::FunctionCall *);
+
+#endif // LIBVALGRIND_CALLGRIND_CALLEE_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp
new file mode 100644
index 0000000000..952f6d48d9
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp
@@ -0,0 +1,118 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindfunctioncycle.h"
+#include "callgrindfunction_p.h"
+
+#include "callgrindfunctioncall.h"
+#include "callgrindparsedata.h"
+
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN FunctionCycle::Private
+
+class FunctionCycle::Private : public Function::Private
+{
+public:
+ Private(const ParseData *data);
+ QVector<const Function *> m_functions;
+};
+
+FunctionCycle::Private::Private(const ParseData *data)
+ : Function::Private(data)
+{
+}
+
+#define CYCLE_D static_cast<FunctionCycle::Private *>(this->d)
+
+//BEGIN FunctionCycle
+
+FunctionCycle::FunctionCycle(const ParseData *data)
+ : Function(new Private(data))
+{
+}
+
+FunctionCycle::~FunctionCycle()
+{
+ // d should be deleted by Function::~Function()
+}
+
+void FunctionCycle::setFunctions(const QVector<const Function *> functions)
+{
+ Private *d = CYCLE_D;
+
+ d->m_functions = functions;
+
+ d->m_incomingCallMap.clear();
+ d->m_outgoingCallMap.clear();
+ d->m_called = 0;
+ d->m_selfCost.fill(0, d->m_data->events().size());
+ d->m_inclusiveCost.fill(0, d->m_data->events().size());
+
+ foreach (const Function *func, functions) {
+ // just add up self cost
+ d->accumulateCost(d->m_selfCost, func->selfCosts());
+ // add outgoing calls to functions that are not part of the cycle
+ foreach (const FunctionCall *call, func->outgoingCalls()) {
+ if (!functions.contains(call->callee()))
+ d->accumulateCall(call, Function::Private::Outgoing);
+ }
+ // add incoming calls from functions that are not part of the cycle
+ foreach (const FunctionCall *call, func->incomingCalls()) {
+ if (!functions.contains(call->caller())) {
+ d->accumulateCall(call, Function::Private::Incoming);
+ d->m_called += call->calls();
+ d->accumulateCost(d->m_inclusiveCost, call->costs());
+ }
+ }
+ }
+ // now subtract self from incl. cost (see implementation of inclusiveCost())
+ // now subtract self cost (see @c inclusiveCost() implementation)
+ for (int i = 0, c = d->m_inclusiveCost.size(); i < c; ++i) {
+ if (d->m_inclusiveCost.at(i) < d->m_selfCost.at(i))
+ d->m_inclusiveCost[i] = 0;
+ else
+ d->m_inclusiveCost[i] -= d->m_selfCost.at(i);
+ }
+}
+
+QVector<const Function *> FunctionCycle::functions() const
+{
+ return CYCLE_D->m_functions;
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h
new file mode 100644
index 0000000000..d4feaca2c0
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h
@@ -0,0 +1,68 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRINDFUNCTIONCYCLE_H
+#define LIBVALGRIND_CALLGRINDFUNCTIONCYCLE_H
+
+#include "callgrindfunction.h"
+
+namespace Valgrind {
+namespace Callgrind {
+
+/**
+ * self cost of a function cycle: sum of self costs of functions in the cycle
+ * callers of a function cycle: set of callers to functions in the cycle
+ * excluding calls inside the cycle
+ * callees of a function cycle: set of callees from functions in the cycle
+ * excluding calees inside the cycle
+ * inclusive cost of a function cycle: sum of inclusive cost of callees of the cycle (see above)
+ */
+class FunctionCycle : public Function
+{
+public:
+ explicit FunctionCycle(const ParseData *data);
+ virtual ~FunctionCycle();
+
+ /// sets the list of functions that make up this cycle
+ /// NOTE: ownership is *not* transferred to the cycle
+ void setFunctions(const QVector<const Function *> functions);
+ /// @return the functions that make up this cycle
+ QVector<const Function *> functions() const;
+
+private:
+ class Private;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_CALLGRINDFUNCTIONCYCLE_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp
new file mode 100644
index 0000000000..57f09d3701
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp
@@ -0,0 +1,377 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindparsedata.h"
+
+#include "callgrindfunction.h"
+#include "callgrindcycledetection.h"
+#include "callgrindfunctioncycle.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+#include <QtCore/QHash>
+#include <QtCore/QCoreApplication>
+
+namespace Valgrind {
+namespace Callgrind {
+
+//BEGIN ParseData::Private
+
+class ParseData::Private {
+ Q_DECLARE_TR_FUNCTIONS(Valgrind::Callgrind::ParseData)
+public:
+ Private(ParseData *q)
+ : m_lineNumberPositionIndex(-1)
+ , m_pid(0)
+ , m_part(0)
+ , m_version(0)
+ , m_cycleCacheValid(false)
+ , m_q(q)
+ {
+ }
+
+ ~Private();
+
+ QStringList m_events;
+ QStringList m_positions;
+ int m_lineNumberPositionIndex;
+ QVector<quint64> m_totalCosts;
+ QVector<const Function *> m_functions;
+ QString m_command;
+ quint64 m_pid;
+ uint m_part;
+ QStringList m_descriptions;
+ int m_version;
+ QString m_creator;
+
+ QHash<qint64, QHash<qint64, QVector<Function *> > > functionLookup;
+
+ typedef QHash<qint64, QString> NameLookupTable;
+ QString stringForCompression(const NameLookupTable &lookup, qint64 id);
+ void addCompressedString(NameLookupTable &lookup, const QString &string, qint64 &id);
+
+ NameLookupTable m_objectCompression;
+ NameLookupTable m_fileCompression;
+ NameLookupTable m_functionCompression;
+
+ void cycleDetection();
+ void cleanupFunctionCycles();
+ bool m_cycleCacheValid;
+ QVector<const Function *> m_cycleCache;
+
+ ParseData *m_q;
+};
+
+ParseData::Private::~Private()
+{
+ cleanupFunctionCycles();
+ qDeleteAll(m_functions);
+}
+
+void ParseData::Private::cleanupFunctionCycles()
+{
+ m_cycleCacheValid = false;
+ foreach (const Function *func, m_cycleCache) {
+ if (dynamic_cast<const FunctionCycle *>(func))
+ delete func;
+ }
+ m_cycleCache.clear();
+}
+
+QString ParseData::Private::stringForCompression(const NameLookupTable &lookup, qint64 id)
+{
+ if (id == -1) {
+ return QString();
+ } else {
+ QTC_ASSERT(lookup.contains(id), return QString());
+ return lookup.value(id);
+ }
+}
+
+void ParseData::Private::addCompressedString(NameLookupTable &lookup, const QString &string,
+ qint64 &id)
+{
+ QTC_ASSERT(!string.isEmpty(), return);
+
+ if (id == -1) {
+ // for uncompressed files, use a hash of the string
+ id = qHash(string);
+
+ if (lookup.contains(id)) {
+ QTC_ASSERT(lookup.value(id) == string, return);
+ return;
+ }
+ }
+
+ QTC_ASSERT(!lookup.contains(id), return);
+ lookup.insert(id, string);
+}
+
+void ParseData::Private::cycleDetection()
+{
+ if (m_cycleCacheValid) {
+ return;
+ }
+ cleanupFunctionCycles();
+ Internal::CycleDetection algorithm(m_q);
+ m_cycleCache = algorithm.run(m_functions);
+ m_cycleCacheValid = true;
+}
+
+//BEGIN ParseData
+
+ParseData::ParseData()
+: d(new Private(this))
+{
+
+}
+
+ParseData::~ParseData()
+{
+ delete d;
+}
+
+QString ParseData::prettyStringForEvent(const QString &event)
+{
+ /*
+ From Callgrind documentation, see: http://valgrind.org/docs/manual/cg-manual.html#cg-manual.overview
+
+ I cache reads (Ir, which equals the number of instructions executed),
+ I1 cache read misses (I1mr) and LL cache instruction read misses (ILmr).
+ D cache reads (Dr, which equals the number of memory reads),
+ D1 cache read misses (D1mr), and LL cache data read misses (DLmr).
+ D cache writes (Dw, which equals the number of memory writes),
+ D1 cache write misses (D1mw), and LL cache data write misses (DLmw).
+ Conditional branches executed (Bc) and conditional branches mispredicted (Bcm).
+ Indirect branches executed (Bi) and indirect branches mispredicted (Bim)
+ */
+
+ QTC_ASSERT(event.size() >= 2, return event) // should not happen
+
+ const bool isMiss = event.contains(QLatin1Char('m')); // else hit
+ const bool isRead = event.contains(QLatin1Char('r')); // else write
+
+ QString type;
+ if (event.contains(QLatin1Char('L')))
+ type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others
+ else if (event.at(0) == 'I')
+ type = ParseData::Private::tr("Instruction");
+ else if (event.at(0) == 'D')
+ type = ParseData::Private::tr("Cache");
+ else if (event.leftRef(2) == "Bc")
+ type = ParseData::Private::tr("Conditional branches");
+ else if (event.leftRef(2) == "Bi")
+ type = ParseData::Private::tr("Indirect branches");
+
+ QStringList prettyString;
+ prettyString << type;
+
+ if (event.at(1).isNumber())
+ prettyString << ParseData::Private::tr("level %1").arg(event.at(1));
+ prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write"));
+
+ if (event.at(0) == 'B')
+ prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed"));
+ else
+ prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access"));
+
+ // add original abbreviation
+ prettyString << QLatin1Char('(') + event + QLatin1Char(')');
+ return prettyString.join(QString(QLatin1Char(' ')));
+}
+
+QStringList ParseData::events() const
+{
+ return d->m_events;
+}
+
+void ParseData::setEvents(const QStringList &events)
+{
+ d->m_events = events;
+ d->m_totalCosts.fill(0, d->m_events.size());
+}
+
+QString ParseData::prettyStringForPosition(const QString &position)
+{
+ if (position == "line")
+ return ParseData::Private::tr("Line:"); // as in: "line number"
+ else if (position == "instr")
+ return ParseData::Private::tr("Instruction"); // as in: "instruction address"
+ return ParseData::Private::tr("Position:"); // never reached, in theory
+}
+
+QStringList ParseData::positions() const
+{
+ return d->m_positions;
+}
+
+int ParseData::lineNumberPositionIndex() const
+{
+ return d->m_lineNumberPositionIndex;
+}
+
+void ParseData::setPositions(const QStringList &positions)
+{
+ d->m_positions = positions;
+ d->m_lineNumberPositionIndex = -1;
+ for (int i = 0; i < positions.size(); ++i) {
+ if (positions.at(i) == "line") {
+ d->m_lineNumberPositionIndex = i;
+ break;
+ }
+ }
+}
+
+quint64 ParseData::totalCost(uint event) const
+{
+ return d->m_totalCosts.at(event);
+}
+
+void ParseData::setTotalCost(uint event, quint64 cost)
+{
+ d->m_totalCosts[event] = cost;
+}
+
+QVector<const Function *> ParseData::functions(bool detectCycles) const
+{
+ if (detectCycles) {
+ d->cycleDetection();
+ return d->m_cycleCache;
+ }
+ return d->m_functions;
+}
+
+void ParseData::addFunction(const Function *function)
+{
+ d->m_cycleCacheValid = false;
+ d->m_functions.append(function);
+}
+
+QString ParseData::command() const
+{
+ return d->m_command;
+}
+
+void ParseData::setCommand(const QString &command)
+{
+ d->m_command = command;
+}
+
+quint64 ParseData::pid() const
+{
+ return d->m_pid;
+}
+
+void ParseData::setPid(quint64 pid)
+{
+ d->m_pid = pid;
+}
+
+uint ParseData::part() const
+{
+ return d->m_part;
+}
+
+void ParseData::setPart(uint part) const
+{
+ d->m_part = part;
+}
+
+QStringList ParseData::descriptions() const
+{
+ return d->m_descriptions;
+}
+
+void ParseData::addDescription(const QString &description)
+{
+ d->m_descriptions.append(description);
+}
+
+void ParseData::setDescriptions(const QStringList &descriptions)
+{
+ d->m_descriptions = descriptions;
+}
+
+int ParseData::version() const
+{
+ return d->m_version;
+}
+
+void ParseData::setVersion(int version)
+{
+ d->m_version = version;
+}
+
+QString ParseData::creator() const
+{
+ return d->m_creator;
+}
+
+void ParseData::setCreator(const QString &creator)
+{
+ d->m_creator = creator;
+}
+
+QString ParseData::stringForObjectCompression(qint64 id) const
+{
+ return d->stringForCompression(d->m_objectCompression, id);
+}
+
+void ParseData::addCompressedObject(const QString &object, qint64 &id)
+{
+ d->addCompressedString(d->m_objectCompression, object, id);
+}
+
+QString ParseData::stringForFileCompression(qint64 id) const
+{
+ return d->stringForCompression(d->m_fileCompression, id);
+}
+
+void ParseData::addCompressedFile(const QString &file, qint64 &id)
+{
+ d->addCompressedString(d->m_fileCompression, file, id);
+}
+
+QString ParseData::stringForFunctionCompression(qint64 id) const
+{
+ return d->stringForCompression(d->m_functionCompression, id);
+}
+
+void ParseData::addCompressedFunction(const QString &function, qint64 &id)
+{
+ d->addCompressedString(d->m_functionCompression, function, id);
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h
new file mode 100644
index 0000000000..a77f638f6f
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h
@@ -0,0 +1,146 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRIND_PARSEDATA_P_H
+#define LIBVALGRIND_CALLGRIND_PARSEDATA_P_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QString;
+template <typename T> class QVector;
+class QStringList;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function;
+
+/**
+ * Represents all the information extracted from a callgrind data file.
+ */
+class ParseData
+{
+public:
+ explicit ParseData();
+ ~ParseData();
+
+ static QString prettyStringForEvent(const QString &event);
+ /// List of events reported in the data file.
+ QStringList events() const;
+ void setEvents(const QStringList &events);
+
+ static QString prettyStringForPosition(const QString &position);
+ /// List of positions reported in the data file.
+ QStringList positions() const;
+ void setPositions(const QStringList &positions);
+
+ /// the index of the line number in @c positions()
+ /// or -1 if no line numbers where reported.
+ int lineNumberPositionIndex() const;
+
+ /**
+ * Total cost of @p event reported in the data file.
+ *
+ * @see events()
+ */
+ quint64 totalCost(uint event) const;
+ void setTotalCost(uint event, quint64 cost);
+
+ /**
+ * When @p detectCycles is set to true, the returned list will have all @c Function's in call
+ * cycles replaced with @c FunctionCycle.
+ *
+ * @return All functions that where reported in the data file.
+ */
+ QVector<const Function *> functions(bool detectCycles = false) const;
+ /// NOTE: The @c ParseData will take ownership.
+ void addFunction(const Function *function);
+
+ /// @return executed command with arguments
+ QString command() const;
+ void setCommand(const QString &command);
+
+ /// @return pid of executed command
+ quint64 pid() const;
+ void setPid(quint64 pid);
+
+ /// @return number of data, if callgrind_control --dump was used
+ uint part() const;
+ void setPart(uint part) const;
+
+ /// @return list of desc: lines in the data
+ QStringList descriptions() const;
+ void addDescription(const QString &description);
+ void setDescriptions(const QStringList &descriptions);
+
+ /// @return version of the callgrind data format
+ int version() const;
+ void setVersion(int version);
+
+ /// @return creator of the data
+ QString creator() const;
+ void setCreator(const QString &creator);
+
+ /**
+ * Internal name compression lookup table.
+ *
+ * We save the @c QString representations of the compressed data format only once here.
+ * This should make sure the memory consumption doesn't skyrocket as long
+ * as these strings are only displayed without applying detaching operations on them.
+ */
+
+ /// for Objects
+ QString stringForObjectCompression(qint64 id) const;
+ /// @p id if it is -1, an uncompressed string is assumed and it will be compressed internally
+ void addCompressedObject(const QString &object, qint64 &id);
+
+ /// for Files
+ QString stringForFileCompression(qint64 id) const;
+ /// @p id if it is -1, an uncompressed string is assumed and it will be compressed internally
+ void addCompressedFile(const QString &file, qint64 &id);
+
+ /// for Functions
+ QString stringForFunctionCompression(qint64 id) const;
+ /// @p id if it is -1, an uncompressed string is assumed and it will be compressed internally
+ void addCompressedFunction(const QString &function, qint64 &id);
+
+private:
+ class Private;
+ Private *d;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_CALLGRIND_PARSEDATA_P_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp
new file mode 100644
index 0000000000..50a6a4db3d
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp
@@ -0,0 +1,679 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindparser.h"
+
+#include "callgrindparsedata.h"
+#include "callgrindfunctioncall.h"
+#include "callgrindcostitem.h"
+#include "callgrindfunction.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QHash>
+#include <QtCore/QVector>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+// #define DEBUG_PARSER
+
+namespace {
+
+static void skipSpace(const char **current, const char *end)
+{
+ const char *b = *current;
+ while (b < end) {
+ if (*b == ' ' || *b == '\t')
+ b++;
+ else
+ break;
+ }
+ *current = b;
+}
+
+// set *ok to true if at least one digit was parsed; "garbage" after the number is not considered
+// an error.
+// *current is moved to one char after the last digit
+static qint64 parseDecimal(const char **current, const char *end, bool *ok)
+{
+ const char *b = *current;
+ bool parsedDigit = false;
+ qint64 ret = 0;
+ while (b < end) {
+ const char c = *b;
+ if (c >= '0' && c <= '9') {
+ b++;
+ ret *= 10;
+ ret += c - '0';
+ parsedDigit = true;
+ } else {
+ break;
+ }
+ }
+
+ *ok = parsedDigit;
+ *current = b;
+ return ret;
+}
+
+//like parseDecimal, but for 0xabcd-style hex encoding (without the leading 0x)
+static qint64 parseHex(const char **current, const char *end, bool *ok)
+{
+ const char *b = *current;
+ bool parsedDigit = false;
+ qint64 ret = 0;
+ while (b < end) {
+ char c = *b;
+ if (c >= '0' && c <= '9')
+ c &= 0x0f;
+ else if (c >= 'a' && c <= 'f')
+ c = c - 'a' + 10;
+ else
+ break;
+
+ b++;
+ ret <<= 4;
+ ret += c;
+ parsedDigit = true;
+ }
+
+ *ok = parsedDigit;
+ *current = b;
+ return ret;
+}
+
+static quint64 parseAddr(const char **current, const char *end, bool *ok)
+{
+ if (**current == '0' && *(*current + 1) == 'x') {
+ *current += 2;
+ return parseHex(current, end, ok);
+ } else {
+ return parseDecimal(current, end, ok);
+ }
+}
+
+// this function expects that *current already points one past the opening parenthesis
+static int parseNameShorthand(const char **current, const char *end)
+{
+ bool ok;
+ int ret = parseDecimal(current, end, &ok);
+ if (ok) {
+ if (**current == ')') {
+ (*current)++;
+ return ret;
+ }
+ }
+ return -1; // invalid
+}
+
+}
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Parser::Private
+{
+ Parser *const q;
+public:
+
+ explicit Private(Parser *qq)
+ : q(qq),
+ addressValuesCount(0),
+ costValuesCount(0),
+ data(0),
+ currentFunction(0),
+ lastObject(-1),
+ lastFile(-1),
+ currentDifferingFile(-1),
+ isParsingFunctionCall(false),
+ callsCount(0)
+ {
+ }
+
+ ~Private()
+ {
+ delete data;
+ }
+
+ void parse(QIODevice *device);
+ void parseHeader(QIODevice *device);
+
+ typedef QPair<qint64, QString> NamePair;
+ NamePair parseName(const char *begin, const char *end);
+
+ void dispatchLine(const QByteArray &line);
+ void parseCostItem(const char *begin, const char *end);
+ void parseFunction(const char *begin, const char *end);
+ void parseSourceFile(const char *begin, const char *end);
+ void parseDifferingSourceFile(const char *begin, const char *end);
+ void parseObjectFile(const char *begin, const char *end);
+ void parseCalls(const char *begin, const char *end);
+ void parseCalledFunction(const char *begin, const char *end);
+ void parseCalledSourceFile(const char *begin, const char *end);
+ void parseCalledObjectFile(const char *begin, const char *end);
+
+ int addressValuesCount;
+ int costValuesCount;
+
+ ParseData *data;
+ Function *currentFunction;
+ qint64 lastObject;
+ qint64 lastFile;
+ qint64 currentDifferingFile;
+
+ bool isParsingFunctionCall;
+ quint64 callsCount;
+ struct CallData {
+ CallData()
+ : calledFunction(-1)
+ , calledObject(-1)
+ , calledFile(-1)
+ , call(0)
+ {
+ }
+
+ qint64 calledFunction;
+ qint64 calledObject;
+ qint64 calledFile;
+ FunctionCall *call;
+ };
+ CallData currentCallData;
+ QVector<quint64> callDestinations;
+
+ // we can only resolve callees after parsing the whole file so save that data here for now
+ QVector<CallData> pendingCallees;
+
+ // id(s) for the ??? file
+ QVector<quint64> unknownFiles;
+
+ // functions which call themselves
+ QSet<Function *> recursiveFunctions;
+};
+
+void Parser::Private::parse(QIODevice *device)
+{
+ // be sure to clean up existing data before re-allocating
+ // the callee might not have taken the parse data
+ delete data;
+ data = 0;
+
+ data = new ParseData;
+ parseHeader(device);
+ while (!device->atEnd()) {
+ QByteArray line = device->readLine();
+ // empty lines actually have no meaning - only fn= starts a new function
+ if (line.length() > 1)
+ dispatchLine(line);
+ }
+
+ // build fast lookup of functions by their nameId
+ QHash<qint64, QList<const Function *> > functionLookup;
+ foreach (const Function *function, data->functions()) {
+ functionLookup[function->nameId()].append(function);
+ }
+
+ // functions that need to accumulate their calees
+ QSet<Function *> pendingFunctions;
+ foreach (const CallData &callData, pendingCallees) {
+ Function *calledFunction = 0;
+ QTC_ASSERT(callData.call, continue);
+ QTC_ASSERT(callData.call->caller(), continue);
+ foreach (const Function *function, functionLookup.value(callData.calledFunction)) {
+ QTC_ASSERT(function->nameId() == callData.calledFunction, continue);
+ if (function->objectId() == callData.calledObject
+ && function->fileId() == callData.calledFile)
+ {
+ calledFunction = const_cast<Function *>(function);
+ break;
+ }
+ }
+#ifdef DEBUG_PARSER
+ if (!calledFunction) {
+ qDebug() << unknownFiles;
+ qDebug() << "could not find called function:" << data->stringForFunctionCompression(callData.calledFunction) << callData.calledFunction;
+ qDebug() << "caller is:" << callData.call->caller()->name() << callData.call->caller()->nameId();
+ qDebug() << "called file:" << callData.calledFile << "object:" << callData.calledObject;
+ qDebug() << data->stringForFileCompression(callData.calledFile) << data->stringForObjectCompression(callData.calledObject);
+ foreach (const Function *function, functionLookup.value(callData.calledFunction)) {
+ qDebug() << "available function file:" << function->fileId() << function->file() << "object:" << function->objectId() << function->object();
+ }
+ }
+#endif
+ QTC_ASSERT(calledFunction, continue)
+ callData.call->setCallee(calledFunction);
+ calledFunction->addIncomingCall(callData.call);
+
+ Function *caller = const_cast<Function *>(callData.call->caller());
+ caller->addOutgoingCall(callData.call);
+ pendingFunctions.insert(caller);
+ }
+
+ pendingCallees.clear();
+ // lookup done
+
+ // now accumulate callees
+ foreach (Function *func, pendingFunctions)
+ func->finalize();
+
+ q->parserDataReady(); // emit
+}
+
+inline QString getValue(const QByteArray &line, const int prefixLength)
+{
+ // we are not interested in the trailing newline
+ // TODO: \r\n ?
+ return QString::fromLatin1(line.mid(prefixLength, line.length() - 1 - prefixLength).constData());
+}
+
+void Parser::Private::parseHeader(QIODevice *device)
+{
+ QTC_ASSERT(device->isOpen(), return);
+ QTC_ASSERT(device->isReadable(), return);
+
+ // parse expected headers until we hit the first non-empty line
+ while (!device->atEnd()) {
+ QByteArray line = device->readLine();
+
+ // now that we're done checking if we're done (heh) with the header, parse the address
+ // and cost column descriptions. speed is unimportant here.
+ if (line.startsWith("positions: ")) {
+ QString values = getValue(line, 11);
+ data->setPositions(values.split(QLatin1Char(' '), QString::SkipEmptyParts));
+ addressValuesCount = data->positions().count();
+ } else if (line.startsWith("events: ")) {
+ QString values = getValue(line, 8);
+ data->setEvents(values.split(QLatin1Char(' '), QString::SkipEmptyParts));
+ costValuesCount = data->events().count();
+ } else if (line.startsWith("version: ")) {
+ QString value = getValue(line, 9);
+ data->setVersion(value.toInt());
+ } else if (line.startsWith("creator: ")) {
+ QString value = getValue(line, 9);
+ data->setCreator(value);
+ } else if (line.startsWith("pid: ")) {
+ QString value = getValue(line, 5);
+ data->setPid(value.toULongLong());
+ } else if (line.startsWith("cmd: ")) {
+ QString value = getValue(line, 5);
+ data->setCommand(value);
+ } else if (line.startsWith("part: ")) {
+ QString value = getValue(line, 6);
+ data->setPart(value.toUInt());
+ } else if (line.startsWith("desc: ")) {
+ QString value = getValue(line, 6);
+ data->addDescription(value);
+ } else if (line.startsWith("summary: ")) {
+ QString values = getValue(line, 9);
+ uint i = 0;
+ foreach (const QString &value, values.split(QLatin1Char(' '), QString::SkipEmptyParts))
+ data->setTotalCost(i++, value.toULongLong());
+ } else if (!line.trimmed().isEmpty()) {
+ // handle line and exit parseHeader
+ dispatchLine(line);
+ return;
+ }
+ }
+}
+
+Parser::Private::NamePair Parser::Private::parseName(const char *begin, const char *end)
+{
+ const char *current = begin;
+ qint64 nameShorthand = -1;
+ if (*current == '(') {
+ current++;
+ if ((nameShorthand = parseNameShorthand(&current, end)) == -1)
+ return qMakePair(qint64(-1), QString()); // error
+ }
+
+ skipSpace(&current, end);
+ return qMakePair(nameShorthand, QString::fromUtf8(QByteArray(current, end - current)));
+}
+
+/*
+ * fl means source file
+ * ob means object file
+ * fn means function
+ * fe, fi means different source file
+ * cfi or cfl means called source file
+ * cob means called object file
+ * cfn means called function
+ */
+
+void Parser::Private::dispatchLine(const QByteArray &line)
+{
+ const char *const begin = line.constData();
+ const char *const end = begin + line.length() - 1; // we're not interested in the '\n'
+ const char *current = begin;
+
+ // shortest possible line is "1 1" - a cost item line
+ QTC_ASSERT(end - begin >= 3, return);
+
+ const char first = *begin;
+
+ if ((first >= '0' && first <= '9') || first == '+' || first == '*' || first =='-') {
+ parseCostItem(begin, end);
+ if (isParsingFunctionCall)
+ isParsingFunctionCall = false;
+ return;
+ }
+
+ QTC_ASSERT(!isParsingFunctionCall, return);
+
+ current++;
+ const char second = *current++;
+ const char third = *current++;
+ // current now points to the fourth char...
+
+ if (first == 'c') {
+ // information about a callee
+ const char fourth = *current++;
+ // current now points to the fifth char...
+
+ switch (second) {
+ // comments show the shortest possible line for every case
+ case 'a':
+ {
+ // "calls=1 1", length 9
+ QTC_ASSERT(end - begin >= 9, return);
+ const char fifth = *current++;
+ const char sixth = *current++;
+ if (third == 'l' && fourth == 'l' && fifth == 's' && sixth == '=')
+ parseCalls(current, end);
+ break;
+ }
+ case 'f':
+ QTC_ASSERT(end - begin >= 5, return);
+ // "cfi=a" / "cfl=a", length 5
+ // "cfn=a", length 5
+ if (fourth == '=') {
+ if (third == 'i' || third == 'l')
+ parseCalledSourceFile(current, end);
+ else if (third == 'n')
+ parseCalledFunction(current, end);
+ }
+ break;
+ case 'o':
+ QTC_ASSERT(end - begin >= 5, return);
+ // "cob=a", length 5
+ if (third == 'b' && fourth == '=')
+ parseCalledObjectFile(current, end);
+ break;
+ default:
+ break;
+ }
+
+ } else {
+ // information about this function
+ // shortest possible line is always four chars here, of the type "fl=a"
+ QTC_ASSERT(end - begin >= 4, return);
+ if (third == '=') {
+ if (first == 'f') {
+ if (second == 'l')
+ parseSourceFile(current, end);
+ else if (second == 'n')
+ parseFunction(current, end);
+ else if (second == 'i' || second == 'e')
+ parseDifferingSourceFile(current, end);
+ } else if (first == 'o' && second == 'b') {
+ parseObjectFile(current, end);
+ }
+ }
+ }
+}
+
+void Parser::Private::parseCostItem(const char *begin, const char *end)
+{
+ QTC_ASSERT(currentFunction, return);
+
+ bool ok;
+ const char *current = begin;
+
+ CostItem *costItem = new CostItem(data);
+ QTC_ASSERT(currentDifferingFile == -1 || currentDifferingFile != currentFunction->fileId(), return);
+ costItem->setDifferingFile(currentDifferingFile);
+ FunctionCall *call = 0;
+ if (isParsingFunctionCall) {
+ call = new FunctionCall;
+ call->setCaller(currentFunction);
+
+ currentCallData.call = call;
+ costItem->setCall(call);
+ call->setCalls(callsCount);
+ callsCount = 0;
+
+ call->setDestinations(callDestinations);
+ callDestinations.clear();
+
+ if (currentCallData.calledFile == -1) {
+ currentCallData.calledFile = currentDifferingFile != -1 ? currentDifferingFile : lastFile;
+ //HACK: workaround issue where sometimes fi=??? lines are prepended to function calls
+ if (unknownFiles.contains(currentCallData.calledFile))
+ currentCallData.calledFile = lastFile;
+ }
+ if (currentCallData.calledObject == -1)
+ currentCallData.calledObject = lastObject;
+
+
+ if (currentCallData.calledFunction == currentFunction->nameId() &&
+ currentCallData.calledFile == currentFunction->fileId() &&
+ currentCallData.calledObject == currentFunction->objectId() )
+ {
+ // recursive call,
+ recursiveFunctions << currentFunction;
+ }
+
+ pendingCallees.append(currentCallData);
+ currentCallData = CallData();
+ }
+
+ const CostItem *lastCostItem = 0;
+ if (!currentFunction->costItems().isEmpty())
+ lastCostItem = currentFunction->costItems().last();
+
+ // parse positions ("where")
+ for (int i = 0; i < addressValuesCount; ++i) {
+ char c = *current;
+ // TODO overflow checks
+ quint64 position = 0;
+ if (c == '*') {
+ // leave the old value unchanged
+ current++;
+ QTC_ASSERT(lastCostItem, continue);
+ position = lastCostItem->position(i);
+ } else {
+ if (c == '+' || c == '-')
+ current++;
+
+ quint64 addr = parseAddr(&current, end, &ok);
+
+ if (!ok)
+ break; /// TODO: error reporting
+
+ if (c == '+') {
+ QTC_ASSERT(lastCostItem, continue);
+ position = lastCostItem->position(i) + addr;
+ } else if (c == '-') {
+ QTC_ASSERT(lastCostItem, continue);
+ position = lastCostItem->position(i) - addr;
+ } else
+ position = addr;
+ }
+ costItem->setPosition(i, position);
+ skipSpace(&current, end);
+ }
+
+ // parse events ("what")
+ for (int i = 0; i < costValuesCount; ++i) {
+ quint64 parsedCost = parseDecimal(&current, end, &ok);
+ if (!ok)
+ break; /// TODO: error reporting
+ costItem->setCost(i, parsedCost);
+ skipSpace(&current, end);
+ }
+
+ if (call) {
+ call->setCosts(costItem->costs());
+ }
+
+ currentFunction->addCostItem(costItem);
+}
+
+void Parser::Private::parseSourceFile(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+
+ if (!name.second.isEmpty()) {
+ data->addCompressedFile(name.second, name.first);
+ if (name.second == QLatin1String("???"))
+ unknownFiles << name.first;
+ }
+
+ lastFile = name.first;
+ currentDifferingFile = -1;
+}
+
+void Parser::Private::parseFunction(const char *begin, const char *end)
+{
+ currentFunction = new Function(data);
+ currentFunction->setFile(lastFile);
+ currentFunction->setObject(lastObject);
+
+ data->addFunction(currentFunction);
+
+ NamePair name = parseName(begin, end);
+
+ if (!name.second.isEmpty())
+ data->addCompressedFunction(name.second, name.first);
+
+ currentFunction->setName(name.first);
+}
+
+void Parser::Private::parseDifferingSourceFile(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+
+ if (!name.second.isEmpty()) {
+ data->addCompressedFile(name.second, name.first);
+ if (name.second == QLatin1String("???"))
+ unknownFiles << name.first;
+ }
+
+ if (name.first == currentFunction->fileId())
+ currentDifferingFile = -1;
+ else
+ currentDifferingFile = name.first;
+}
+
+void Parser::Private::parseObjectFile(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+ if (!name.second.isEmpty())
+ data->addCompressedObject(name.second, name.first);
+
+ lastObject = name.first;
+}
+
+void Parser::Private::parseCalls(const char *begin, const char *end)
+{
+ const char *current = begin;
+ bool ok;
+ callsCount = parseDecimal(&current, end, &ok);
+ skipSpace(&current, end);
+
+ callDestinations.fill(0, addressValuesCount);
+ for (int i = 0; i < addressValuesCount; ++i) {
+ callDestinations[i] = parseAddr(&current, end, &ok);
+ if (!ok)
+ break; // TODO error handling?
+ skipSpace(&current, end);
+ }
+
+ isParsingFunctionCall = true;
+}
+
+void Parser::Private::parseCalledFunction(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+ if (!name.second.isEmpty())
+ data->addCompressedFunction(name.second, name.first);
+
+ currentCallData.calledFunction = name.first;
+}
+
+void Parser::Private::parseCalledSourceFile(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+ if (!name.second.isEmpty()) {
+ data->addCompressedFile(name.second, name.first);
+ if (name.second == QLatin1String("???"))
+ unknownFiles << name.first;
+ }
+
+ currentCallData.calledFile = name.first;
+}
+
+void Parser::Private::parseCalledObjectFile(const char *begin, const char *end)
+{
+ NamePair name = parseName(begin, end);
+ if (!name.second.isEmpty())
+ data->addCompressedObject(name.second, name.first);
+
+ currentCallData.calledObject = name.first;
+}
+
+//BEGIN Parser
+
+void Parser::parse(QIODevice *device)
+{
+ d->parse(device);
+}
+
+Parser::Parser(QObject *parent)
+ : QObject(parent),
+ d(new Private(this))
+{
+}
+
+Parser::~Parser()
+{
+ delete d;
+}
+
+ParseData *Parser::takeData()
+{
+ ParseData *data = d->data;
+ d->data = 0;
+ return data;
+}
+
+} //Callgrind
+} //Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindparser.h b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.h
new file mode 100644
index 0000000000..40ee223524
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.h
@@ -0,0 +1,84 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_CALLGRIND_PARSER_H
+#define LIBVALGRIND_CALLGRIND_PARSER_H
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+class QIODevice;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace Callgrind {
+
+class ParseData;
+
+/**
+ * Parser for Valgrind --tool=callgrind output
+ * most of the format is documented at http://kcachegrind.sourceforge.net/html/CallgrindFormat.html
+ *
+ * FIXME: most length asserts are not correct, see documentation 1.2:
+ * "If a cost line specifies less event counts than given in the "events" line,
+ * the rest is assumed to be zero."
+ *
+ */
+class Parser : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit Parser(QObject *parent = 0);
+ ~Parser();
+
+ // get and take ownership of the parsing results. If this method is not called the repository
+ // will be destroyed when the parser is destroyed. Subsequent calls return null.
+ ParseData *takeData();
+
+signals:
+ void parserDataReady();
+
+public Q_SLOTS:
+ void parse(QIODevice *stream);
+
+private:
+ Q_DISABLE_COPY(Parser)
+
+ class Private;
+ Private *const d;
+};
+
+} // Callgrind
+} // Valgrind
+
+#endif // LIBVALGRIND_CALLGRIND_PARSER_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp
new file mode 100644
index 0000000000..44318ce406
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp
@@ -0,0 +1,169 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindproxymodel.h"
+
+#include "callgrinddatamodel.h"
+#include "callgrindfunction.h"
+#include "callgrindfunctioncall.h"
+#include "callgrindparsedata.h"
+
+#include <utils/qtcassert.h>
+
+#include <QDebug>
+
+namespace Valgrind {
+namespace Callgrind {
+
+DataProxyModel::DataProxyModel(QObject *parent)
+ : QSortFilterProxyModel(parent)
+ , m_function(0)
+ , m_maxRows(0)
+ , m_minimumInclusiveCostRatio(0.0)
+{
+ setDynamicSortFilter(true);
+}
+
+const Function *DataProxyModel::filterFunction() const
+{
+ return m_function;
+}
+
+void DataProxyModel::setFilterBaseDir ( const QString &baseDir )
+{
+ if (m_baseDir == baseDir)
+ return;
+
+ m_baseDir = baseDir;
+ invalidateFilter();
+}
+
+void DataProxyModel::setFilterFunction(const Function *function)
+{
+ if (m_function == function)
+ return;
+
+ const Function *previousFunction = m_function;
+ m_function = function;
+ invalidateFilter();
+ emit filterFunctionChanged(previousFunction, function);
+}
+
+void DataProxyModel::setFilterMaximumRows(int rows)
+{
+ if (m_maxRows == rows)
+ return;
+
+ m_maxRows = rows;
+ invalidateFilter();
+ emit filterMaximumRowsChanged(rows);
+}
+
+void DataProxyModel::setMinimumInclusiveCostRatio(double minimumInclusiveCost)
+{
+ if (m_minimumInclusiveCostRatio == minimumInclusiveCost)
+ return;
+
+ m_minimumInclusiveCostRatio = minimumInclusiveCost;
+ invalidateFilter();
+}
+
+void DataProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
+{
+ if (!qobject_cast<DataModel *>(sourceModel)) {
+ qWarning() << Q_FUNC_INFO << "accepts DataModel instances only";
+ return;
+ }
+
+ QSortFilterProxyModel::setSourceModel(sourceModel);
+}
+
+DataModel *DataProxyModel::dataModel() const
+{
+ return qobject_cast<DataModel *>(sourceModel());
+}
+
+bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ const QModelIndex source_index = sourceModel()->index( source_row, 0, source_parent );
+ if (!source_index.isValid())
+ return false;
+
+ // if the filter regexp is a non-empty string, ignore our filters
+ if (!filterRegExp().isEmpty()) {
+ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+ }
+
+ // check max rows
+ if (m_maxRows > 0 && source_row > m_maxRows)
+ return false;
+
+ const Function *func = source_index.data(DataModel::FunctionRole).value<const Function *>();
+
+ // check if func is located in the specific base directory, if any
+ if (func && !m_baseDir.isEmpty()) {
+ if (!func->location().startsWith(m_baseDir))
+ return false;
+ }
+
+ // check if the function from this index is a child of (called by) the filter function
+ if (func && m_function) {
+ bool isValid = false;
+ foreach (const FunctionCall *call, func->incomingCalls()) {
+ if (call->caller() == m_function) {
+ isValid = true;
+ break;
+ }
+ }
+ if (!isValid) {
+ return false;
+ }
+ }
+
+ // check minimum inclusive costs
+ DataModel *model = dataModel();
+ QTC_ASSERT(model, return false) // as always: this should never happen
+ const ParseData *data = model->parseData();
+ QTC_ASSERT(data, return false)
+ if (m_minimumInclusiveCostRatio != 0.0) {
+ const quint64 totalCost = data->totalCost(0);
+ const quint64 inclusiveCost = func->inclusiveCost(0);
+ const float inclusiveCostRatio = (float)inclusiveCost / totalCost;
+ if (inclusiveCostRatio < m_minimumInclusiveCostRatio)
+ return false;
+ }
+
+ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h
new file mode 100644
index 0000000000..c4c99e9e7f
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h
@@ -0,0 +1,89 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H
+#define VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class DataModel;
+class Function;
+
+class DataProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+ explicit DataProxyModel(QObject *parent = 0);
+
+ virtual void setSourceModel(QAbstractItemModel *sourceModel);
+
+ QString filterBaseDir() const { return m_baseDir; }
+ const Function *filterFunction() const;
+ int filterMaximumRows() const { return m_maxRows; }
+
+ /// Only functions with an inclusive cost ratio above this minimum will be shown in the model
+ double minimumInclusiveCostRatio() const { return m_minimumInclusiveCostRatio; }
+
+public Q_SLOTS:
+ /// This will filter out all entries that are not located within \param baseDir
+ void setFilterBaseDir(const QString& baseDir);
+ void setFilterFunction(const Function *call);
+ void setFilterMaximumRows(int rows);
+
+ /// Only rows with a inclusive cost ratio above @p minimumInclusiveCost will be shown
+ /// by this model. If @c 0 is passed as argument, all rows will be shown.
+ void setMinimumInclusiveCostRatio(double minimumInclusiveCost);
+
+Q_SIGNALS:
+ void filterFunctionChanged(const Function *previous, const Function *current);
+ void filterMaximumRowsChanged(int rows);
+
+protected:
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+
+private:
+ DataModel *dataModel() const;
+
+ QString m_baseDir;
+ const Function *m_function;
+ int m_maxRows;
+ double m_minimumInclusiveCostRatio;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp
new file mode 100644
index 0000000000..a42b825967
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp
@@ -0,0 +1,136 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindrunner.h"
+#include "callgrindparser.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QFile>
+
+namespace Valgrind {
+namespace Callgrind {
+
+CallgrindRunner::CallgrindRunner(QObject *parent)
+ : ValgrindRunner(parent)
+ , m_controller(new CallgrindController(this))
+ , m_parser(new Parser(this))
+ , m_paused(false)
+{
+ connect(m_controller,
+ SIGNAL(finished(Valgrind::Callgrind::CallgrindController::Option)),
+ SLOT(controllerFinished(Valgrind::Callgrind::CallgrindController::Option)));
+ connect(m_controller, SIGNAL(localParseDataAvailable(QString)),
+ this, SLOT(localParseDataAvailable(QString)));
+ connect(m_controller, SIGNAL(statusMessage(QString)),
+ this, SIGNAL(statusMessage(QString)));
+}
+
+QString CallgrindRunner::tool() const
+{
+ return QString("callgrind");
+}
+
+Parser *CallgrindRunner::parser() const
+{
+ return m_parser;
+}
+
+CallgrindController *CallgrindRunner::controller() const
+{
+ return m_controller;
+}
+
+void CallgrindRunner::start()
+{
+ ValgrindRunner::start();
+ m_controller->setValgrindProcess(valgrindProcess());
+}
+
+void CallgrindRunner::startRemotely(const Utils::SshConnectionParameters &sshParams)
+{
+ ValgrindRunner::startRemotely(sshParams);
+ m_controller->setValgrindProcess(valgrindProcess());
+}
+
+void CallgrindRunner::processFinished(int ret, QProcess::ExitStatus status)
+{
+ triggerParse();
+ m_controller->setValgrindProcess(0);
+
+ ValgrindRunner::processFinished(ret, status); // call base class method
+}
+
+bool CallgrindRunner::isPaused() const
+{
+ return m_paused;
+}
+
+void CallgrindRunner::triggerParse()
+{
+ m_controller->getLocalDataFile();
+}
+
+void CallgrindRunner::localParseDataAvailable(const QString &file)
+{
+ // parse the callgrind file
+ QTC_ASSERT(!file.isEmpty(), return);
+ QFile outputFile(file);
+ QTC_ASSERT(outputFile.exists(), return);
+ if (outputFile.open(QIODevice::ReadOnly)) {
+ emit statusMessage(tr("Parsing Profile Data..."));
+ m_parser->parse(&outputFile);
+ } else {
+ qWarning() << "Could not open file for parsing:" << outputFile.fileName();
+ }
+}
+
+void CallgrindRunner::controllerFinished(CallgrindController::Option option)
+{
+ switch (option)
+ {
+ case CallgrindController::Pause:
+ m_paused = true;
+ break;
+ case CallgrindController::UnPause:
+ m_paused = false;
+ break;
+ case CallgrindController::Dump:
+ triggerParse();
+ break;
+ default:
+ break; // do nothing
+ }
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h
new file mode 100644
index 0000000000..fb7da49db4
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h
@@ -0,0 +1,86 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_CALLGRIND_CALLGRINDRUNNER_H
+#define VALGRIND_CALLGRIND_CALLGRINDRUNNER_H
+
+#include <valgrindrunner.h>
+
+#include "callgrindcontroller.h"
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Parser;
+class CallgrindController;
+
+class CallgrindRunner : public ValgrindRunner
+{
+ Q_OBJECT
+
+public:
+ explicit CallgrindRunner(QObject *parent = 0);
+
+ Parser *parser() const;
+
+ CallgrindController *controller() const;
+
+ bool isPaused() const;
+
+ virtual void start();
+ virtual void startRemotely(const Utils::SshConnectionParameters &sshParams);
+
+signals:
+ void statusMessage(const QString &message);
+
+private slots:
+ void localParseDataAvailable(const QString &file);
+
+ void controllerFinished(Valgrind::Callgrind::CallgrindController::Option);
+
+ void processFinished(int, QProcess::ExitStatus);
+
+private:
+ void triggerParse();
+
+ QString tool() const;
+
+ CallgrindController *m_controller;
+ Parser *m_parser;
+
+ bool m_paused;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // VALGRIND_CALLGRIND_CALLGRINDRUNNER_H
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp
new file mode 100644
index 0000000000..b448b2f23d
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp
@@ -0,0 +1,84 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "callgrindstackbrowser.h"
+
+namespace Valgrind {
+namespace Callgrind {
+
+StackBrowser::StackBrowser(QObject *parent)
+ : QObject(parent)
+{
+}
+
+void StackBrowser::clear()
+{
+ m_stack.clear();
+ m_redoStack.clear();
+ emit currentChanged();
+}
+
+void StackBrowser::select(const Function *item)
+{
+ if (!m_stack.isEmpty() && m_stack.top() == item)
+ return;
+
+ m_stack.push(item);
+ m_redoStack.clear();
+ emit currentChanged();
+}
+
+const Function *StackBrowser::current() const
+{
+ return m_stack.isEmpty() ? 0 : m_stack.top();
+}
+
+void StackBrowser::goBack()
+{
+ if (m_stack.isEmpty())
+ return;
+
+ m_redoStack.push(m_stack.pop());
+ emit currentChanged();
+}
+
+void StackBrowser::goNext()
+{
+ if (m_redoStack.isEmpty())
+ return;
+
+ m_stack.push(m_redoStack.pop());
+ emit currentChanged();
+}
+
+} // namespace Callgrind
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h
new file mode 100644
index 0000000000..a7b239ef4b
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h
@@ -0,0 +1,72 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef CALLGRINDSTACKBROWSER_H
+#define CALLGRINDSTACKBROWSER_H
+
+#include <QObject>
+#include <QStack>
+
+namespace Valgrind {
+namespace Callgrind {
+
+class Function;
+
+class StackBrowser : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit StackBrowser(QObject *parent = 0);
+
+ void select(const Function *item);
+ const Function *current() const;
+ void clear();
+ bool hasPrevious() const { return !m_stack.isEmpty(); }
+ bool hasNext() const { return !m_redoStack.isEmpty(); }
+
+public slots:
+ void goBack();
+ void goNext();
+
+signals:
+ void currentChanged();
+
+private:
+ QStack<const Function *> m_stack;
+ QStack<const Function *> m_redoStack;
+};
+
+} // namespace Callgrind
+} // namespace Valgrind
+
+#endif // CALLGRINDSTACKBROWSER_H
diff --git a/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp
new file mode 100644
index 0000000000..2786451d93
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp
@@ -0,0 +1,234 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "memcheckrunner.h"
+
+#include <xmlprotocol/error.h>
+#include <xmlprotocol/status.h>
+#include <xmlprotocol/threadedparser.h>
+
+#include <utils/qtcassert.h>
+
+#include <QtNetwork/QNetworkInterface>
+#include <QtNetwork/QTcpServer>
+#include <QtNetwork/QTcpSocket>
+#include <QtCore/QEventLoop>
+#include <QtGui/QApplication>
+#include <QtGui/QDialog>
+#include <QtGui/QDialogButtonBox>
+#include <QtGui/QLabel>
+#include <QtGui/QListWidget>
+#include <QtGui/QVBoxLayout>
+
+namespace Valgrind {
+namespace Memcheck {
+
+class MemcheckRunner::Private
+{
+public:
+ explicit Private()
+ : parser(0),
+ logSocket(0)
+ {
+ }
+
+ QTcpServer xmlServer;
+ XmlProtocol::ThreadedParser *parser;
+ QTcpServer logServer;
+ QTcpSocket *logSocket;
+};
+
+MemcheckRunner::MemcheckRunner(QObject *parent)
+ : ValgrindRunner(parent),
+ d(new Private)
+{
+}
+
+MemcheckRunner::~MemcheckRunner()
+{
+ if (d->parser->isRunning()) {
+ // make sure we don't delete the thread while it's still running
+ waitForFinished();
+ }
+ delete d;
+ d = 0;
+}
+
+QString MemcheckRunner::tool() const
+{
+ return QString("memcheck");
+}
+
+void MemcheckRunner::setParser(XmlProtocol::ThreadedParser *parser)
+{
+ QTC_ASSERT(!d->parser, qt_noop());
+ d->parser = parser;
+}
+
+void MemcheckRunner::start()
+{
+ QTC_ASSERT(d->parser, return);
+
+ bool check = d->xmlServer.listen(QHostAddress(QHostAddress::LocalHost));
+ QTC_ASSERT(check, return);
+ d->xmlServer.setMaxPendingConnections(1);
+ const quint16 xmlPortNumber = d->xmlServer.serverPort();
+ connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
+
+ check = d->logServer.listen(QHostAddress(QHostAddress::LocalHost));
+ QTC_ASSERT(check, return);
+ d->logServer.setMaxPendingConnections(1);
+ const quint16 logPortNumber = d->logServer.serverPort();
+ connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
+
+ QStringList memcheckArguments;
+ memcheckArguments << QString("--xml=yes")
+ << QString("--xml-socket=127.0.0.1:%1").arg(QString::number(xmlPortNumber))
+ << QString("--child-silent-after-fork=yes")
+ << QString("--log-socket=127.0.0.1:%1").arg(QString::number(logPortNumber))
+ << valgrindArguments();
+ setValgrindArguments(memcheckArguments);
+
+ ValgrindRunner::start();
+}
+
+void MemcheckRunner::startRemotely(const Utils::SshConnectionParameters &sshParams)
+{
+ QTC_ASSERT(d->parser, return);
+
+ QList<QHostAddress> possibleHostAddresses;
+ //NOTE: ::allAddresses does not seem to work for usb interfaces...
+ foreach (const QNetworkInterface &iface, QNetworkInterface::allInterfaces()) {
+ foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) {
+ const QHostAddress addr = entry.ip();
+ if (addr.toString() != "127.0.0.1"
+ && addr.toString() != "0:0:0:0:0:0:0:1")
+ {
+ possibleHostAddresses << addr;
+ break;
+ }
+ }
+ }
+
+ QHostAddress hostAddr;
+
+ if (possibleHostAddresses.isEmpty()) {
+ emit processErrorReceived(tr("No network interface found for remote analysis."),
+ QProcess::FailedToStart);
+ return;
+ } else if (possibleHostAddresses.size() > 1) {
+ QDialog dlg;
+ dlg.setWindowTitle(tr("Select Network Interface"));
+ QVBoxLayout *layout = new QVBoxLayout;
+ QLabel *description = new QLabel;
+ description->setWordWrap(true);
+ description->setText(tr("More than one network interface was found on your machine. Please select which one you want to use for remote analysis."));
+ layout->addWidget(description);
+ QListWidget *list = new QListWidget;
+ foreach (const QHostAddress &address, possibleHostAddresses)
+ list->addItem(address.toString());
+
+ list->setSelectionMode(QAbstractItemView::SingleSelection);
+ list->setCurrentRow(0);
+ layout->addWidget(list);
+
+ QDialogButtonBox *buttons = new QDialogButtonBox;
+ buttons->addButton(QDialogButtonBox::Ok);
+ buttons->addButton(QDialogButtonBox::Cancel);
+ connect(buttons, SIGNAL(accepted()),
+ &dlg, SLOT(accept()));
+ connect(buttons, SIGNAL(rejected()),
+ &dlg, SLOT(reject()));
+ layout->addWidget(buttons);
+
+ dlg.setLayout(layout);
+ if (dlg.exec() != QDialog::Accepted)
+ return;
+
+ QTC_ASSERT(list->currentRow() >= 0, return);
+ QTC_ASSERT(list->currentRow() < possibleHostAddresses.size(), return);
+ hostAddr = possibleHostAddresses.at(list->currentRow());
+ } else {
+ hostAddr = possibleHostAddresses.first();
+ }
+
+ QString ip = hostAddr.toString();
+ QTC_ASSERT(!ip.isEmpty(), return);
+
+ bool check = d->xmlServer.listen(hostAddr);
+ QTC_ASSERT(check, return);
+ d->xmlServer.setMaxPendingConnections(1);
+ const quint16 xmlPortNumber = d->xmlServer.serverPort();
+ connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
+
+ check = d->logServer.listen(hostAddr);
+ QTC_ASSERT(check, return);
+ d->logServer.setMaxPendingConnections(1);
+ const quint16 logPortNumber = d->logServer.serverPort();
+ connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
+
+ QStringList memcheckArguments;
+ memcheckArguments << QString("--xml=yes")
+ << QString("--xml-socket=%1:%2").arg(ip, QString::number(xmlPortNumber))
+ << QString("--child-silent-after-fork=yes")
+ << QString("--log-socket=%1:%2").arg(ip, QString::number(logPortNumber));
+ setValgrindArguments(memcheckArguments);
+
+ ValgrindRunner::startRemotely(sshParams);
+}
+
+void MemcheckRunner::xmlSocketConnected()
+{
+ QTcpSocket *socket = d->xmlServer.nextPendingConnection();
+ QTC_ASSERT(socket, return);
+ d->xmlServer.close();
+ d->parser->parse(socket);
+}
+
+void MemcheckRunner::logSocketConnected()
+{
+ d->logSocket = d->logServer.nextPendingConnection();
+ QTC_ASSERT(d->logSocket, return);
+ connect(d->logSocket, SIGNAL(readyRead()),
+ this, SLOT(readLogSocket()));
+ d->logServer.close();
+}
+
+void MemcheckRunner::readLogSocket()
+{
+ emit logMessageReceived(d->logSocket->readAll());
+}
+
+} // namespace Memcheck
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h
new file mode 100644
index 0000000000..9fa5957061
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h
@@ -0,0 +1,79 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_PROTOCOL_MEMCHECKRUNNER_H
+#define VALGRIND_PROTOCOL_MEMCHECKRUNNER_H
+
+#include <valgrindrunner.h>
+
+namespace Valgrind {
+
+namespace XmlProtocol{
+class ThreadedParser;
+}
+
+namespace Memcheck {
+
+class MemcheckRunner : public ValgrindRunner
+{
+ Q_OBJECT
+
+public:
+ explicit MemcheckRunner(QObject *parent = 0);
+ ~MemcheckRunner();
+
+ void setParser(XmlProtocol::ThreadedParser *parser);
+
+ void start();
+ void startRemotely(const Utils::SshConnectionParameters &sshParams);
+
+signals:
+ void logMessageReceived(const QByteArray &);
+
+private slots:
+ void xmlSocketConnected();
+ void logSocketConnected();
+ void readLogSocket();
+
+private:
+ QString tool() const;
+
+ class Private;
+ Private *d;
+};
+
+} // namespace Memcheck
+} // namespace Valgrind
+
+#endif // VALGRIND_PROTOCOL_MEMCHECKRUNNER_H
diff --git a/src/plugins/valgrind/valgrind/valgrind.pri b/src/plugins/valgrind/valgrind/valgrind.pri
new file mode 100644
index 0000000000..73cb4fcdbf
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/valgrind.pri
@@ -0,0 +1,63 @@
+QT *= network
+
+INCLUDEPATH *= $$PWD
+
+HEADERS += \
+ $$PWD/xmlprotocol/frame.h \
+ $$PWD/xmlprotocol/parser.h \
+ $$PWD/xmlprotocol/error.h \
+ $$PWD/xmlprotocol/status.h \
+ $$PWD/xmlprotocol/suppression.h \
+ $$PWD/xmlprotocol/threadedparser.h \
+ $$PWD/xmlprotocol/announcethread.h \
+ $$PWD/xmlprotocol/stack.h \
+ $$PWD/xmlprotocol/errorlistmodel.h \
+ $$PWD/xmlprotocol/stackmodel.h \
+ $$PWD/xmlprotocol/modelhelpers.h \
+ $$PWD/callgrind/callgrindparser.h \
+ $$PWD/callgrind/callgrindparsedata.h \
+ $$PWD/callgrind/callgrindfunction.h \
+ $$PWD/callgrind/callgrindfunction_p.h \
+ $$PWD/callgrind/callgrindfunctioncycle.h \
+ $$PWD/callgrind/callgrindfunctioncall.h \
+ $$PWD/callgrind/callgrindcostitem.h \
+ $$PWD/callgrind/callgrinddatamodel.h \
+ $$PWD/callgrind/callgrindabstractmodel.h \
+ $$PWD/callgrind/callgrindcallmodel.h \
+ $$PWD/callgrind/callgrindcontroller.h \
+ $$PWD/callgrind/callgrindcycledetection.h \
+ $$PWD/callgrind/callgrindproxymodel.h \
+ $$PWD/callgrind/callgrindstackbrowser.h \
+ $$PWD/callgrind/callgrindrunner.h \
+ $$PWD/memcheck/memcheckrunner.h \
+ $$PWD/valgrindrunner.h \
+ $$PWD/valgrindprocess.h
+
+SOURCES += $$PWD/xmlprotocol/error.cpp \
+ $$PWD/xmlprotocol/frame.cpp \
+ $$PWD/xmlprotocol/parser.cpp \
+ $$PWD/xmlprotocol/status.cpp \
+ $$PWD/xmlprotocol/suppression.cpp \
+ $$PWD/xmlprotocol/threadedparser.cpp \
+ $$PWD/xmlprotocol/announcethread.cpp \
+ $$PWD/xmlprotocol/stack.cpp \
+ $$PWD/xmlprotocol/errorlistmodel.cpp \
+ $$PWD/xmlprotocol/stackmodel.cpp \
+ $$PWD/xmlprotocol/modelhelpers.cpp \
+ $$PWD/callgrind/callgrindparser.cpp \
+ $$PWD/callgrind/callgrindparsedata.cpp \
+ $$PWD/callgrind/callgrindfunction.cpp \
+ $$PWD/callgrind/callgrindfunctioncycle.cpp \
+ $$PWD/callgrind/callgrindfunctioncall.cpp \
+ $$PWD/callgrind/callgrindcostitem.cpp \
+ $$PWD/callgrind/callgrindabstractmodel.cpp \
+ $$PWD/callgrind/callgrinddatamodel.cpp \
+ $$PWD/callgrind/callgrindcallmodel.cpp \
+ $$PWD/callgrind/callgrindcontroller.cpp \
+ $$PWD/callgrind/callgrindcycledetection.cpp \
+ $$PWD/callgrind/callgrindproxymodel.cpp \
+ $$PWD/callgrind/callgrindrunner.cpp \
+ $$PWD/callgrind/callgrindstackbrowser.cpp \
+ $$PWD/memcheck/memcheckrunner.cpp \
+ $$PWD/valgrindrunner.cpp \
+ $$PWD/valgrindprocess.cpp
diff --git a/src/plugins/valgrind/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrind/valgrindprocess.cpp
new file mode 100644
index 0000000000..b2da5551f2
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/valgrindprocess.cpp
@@ -0,0 +1,370 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "valgrindprocess.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QEventLoop>
+#include <QtCore/QFileInfo>
+
+#include <utils/qtcassert.h>
+
+#ifdef Q_OS_WIN
+# include <QtCore/qt_windows.h>
+#endif
+
+namespace Valgrind {
+
+ValgrindProcess::ValgrindProcess(QObject *parent)
+ : QObject(parent)
+{
+}
+
+////////////////////////
+
+LocalValgrindProcess::LocalValgrindProcess(QObject *parent)
+: ValgrindProcess(parent)
+{
+ connect(&m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SIGNAL(finished(int, QProcess::ExitStatus)));
+ connect(&m_process, SIGNAL(started()),
+ this, SIGNAL(started()));
+ connect(&m_process, SIGNAL(error(QProcess::ProcessError)),
+ this, SIGNAL(error(QProcess::ProcessError)));
+ connect(&m_process, SIGNAL(readyReadStandardError()),
+ this, SLOT(readyReadStandardError()));
+ connect(&m_process, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(readyReadStandardOutput()));
+}
+
+void LocalValgrindProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode)
+{
+ m_process.setProcessChannelMode(mode);
+}
+
+void LocalValgrindProcess::setWorkingDirectory(const QString &path)
+{
+ m_process.setWorkingDirectory(path);
+}
+
+QString LocalValgrindProcess::workingDirectory() const
+{
+ return m_process.workingDirectory();
+}
+
+bool LocalValgrindProcess::isRunning() const
+{
+ return m_process.state() != QProcess::NotRunning;
+}
+
+void LocalValgrindProcess::setEnvironment(const Utils::Environment &environment)
+{
+ m_process.setEnvironment(environment);
+}
+
+void LocalValgrindProcess::close()
+{
+ m_process.terminate();
+}
+
+void LocalValgrindProcess::run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
+ const QString &debuggeeExecutable, const QString &debuggeeArguments)
+{
+ QString arguments;
+ Utils::QtcProcess::addArgs(&arguments, valgrindArguments);
+
+ Utils::QtcProcess::addArg(&arguments, debuggeeExecutable);
+ Utils::QtcProcess::addArgs(&arguments, debuggeeArguments);
+
+ m_process.setCommand(valgrindExecutable, arguments);
+ m_process.start();
+ m_process.waitForStarted();
+#ifdef Q_OS_WIN
+ m_pid = m_process.pid()->dwProcessId;
+#else
+ m_pid = m_process.pid();
+#endif
+}
+
+QString LocalValgrindProcess::errorString() const
+{
+ return m_process.errorString();
+}
+
+QProcess::ProcessError LocalValgrindProcess::error() const
+{
+ return m_process.error();
+}
+
+qint64 LocalValgrindProcess::pid() const
+{
+ return m_pid;
+}
+
+void LocalValgrindProcess::readyReadStandardError()
+{
+ const QByteArray b = m_process.readAllStandardError();
+ if (!b.isEmpty())
+ emit processOutput(b, Utils::StdErrFormat);
+}
+
+void LocalValgrindProcess::readyReadStandardOutput()
+{
+ const QByteArray b = m_process.readAllStandardOutput();
+ if (!b.isEmpty())
+ emit processOutput(b, Utils::StdOutFormat);
+}
+
+////////////////////////
+
+RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnectionParameters &sshParams,
+ QObject *parent)
+ : ValgrindProcess(parent)
+ , m_params(sshParams)
+ , m_error(QProcess::UnknownError)
+ , m_pid(0)
+{}
+
+RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnection::Ptr &connection, QObject *parent)
+ : ValgrindProcess(parent)
+ , m_params(connection->connectionParameters())
+ , m_connection(connection)
+ , m_error(QProcess::UnknownError)
+ , m_pid(0)
+{}
+
+bool RemoteValgrindProcess::isRunning() const
+{
+ return m_process && m_process->isRunning();
+}
+
+void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
+ const QString &debuggeeExecutable, const QString &debuggeeArguments)
+{
+ m_valgrindExe = valgrindExecutable;
+ m_debuggee = debuggeeExecutable;
+ m_debuggeeArgs = debuggeeArguments;
+ m_valgrindArgs = valgrindArguments;
+
+ // connect to host and wait for connection
+ if (!m_connection)
+ m_connection = Utils::SshConnection::create(m_params);
+
+ if (m_connection->state() != Utils::SshConnection::Connected) {
+ connect(m_connection.data(), SIGNAL(connected()),
+ this, SLOT(connected()));
+ connect(m_connection.data(), SIGNAL(error(Utils::SshError)),
+ this, SLOT(error(Utils::SshError)));
+ if (m_connection->state() == Utils::SshConnection::Unconnected)
+ m_connection->connectToHost();
+ } else {
+ connected();
+ }
+}
+
+void RemoteValgrindProcess::connected()
+{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
+
+ // connected, run command
+ QString cmd;
+
+ if (!m_workingDir.isEmpty())
+ cmd += QString("cd '%1' && ").arg(m_workingDir);
+
+ QString arguments;
+ Utils::QtcProcess::addArgs(&arguments, m_valgrindArgs);
+ Utils::QtcProcess::addArg(&arguments, m_debuggee);
+ Utils::QtcProcess::addArgs(&arguments, m_debuggeeArgs);
+ cmd += m_valgrindExe + ' ' + arguments;
+
+ m_process = m_connection->createRemoteProcess(cmd.toUtf8());
+ connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
+ this, SLOT(standardError(QByteArray)));
+ connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
+ this, SLOT(standardOutput(QByteArray)));
+ connect(m_process.data(), SIGNAL(closed(int)),
+ this, SLOT(closed(int)));
+ connect(m_process.data(), SIGNAL(started()),
+ this, SLOT(processStarted()));
+ m_process->start();
+}
+
+Utils::SshConnection::Ptr RemoteValgrindProcess::connection() const
+{
+ return m_connection;
+}
+
+void RemoteValgrindProcess::processStarted()
+{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
+
+ // find out what PID our process has
+
+ // NOTE: valgrind cloaks its name,
+ // e.g.: valgrind --tool=memcheck foobar
+ // => ps aux, pidof will see valgrind.bin
+ // => pkill/killall/top... will see memcheck-amd64-linux or similar
+ // hence we need to do something more complex...
+
+ // plain path to exe, m_valgrindExe contains e.g. env vars etc. pp.
+ const QString proc = m_valgrindExe.split(QLatin1Char(' ')).last();
+ // sleep required since otherwise we might only match "bash -c..."
+ // and not the actual valgrind run
+ const QString cmd = QString("sleep 1; ps ax" // list all processes with aliased name
+ " | grep '\\b%1.*%2'" // find valgrind process
+ " | tail -n 1" // limit to single process
+ // we pick the last one, first would be "bash -c ..."
+ " | awk '{print $1;}'" // get pid
+ ).arg(proc, QFileInfo(m_debuggee).fileName());
+
+ m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
+ connect(m_findPID.data(), SIGNAL(errorOutputAvailable(QByteArray)),
+ this, SLOT(standardOutput(QByteArray)));
+ connect(m_findPID.data(), SIGNAL(outputAvailable(QByteArray)),
+ this, SLOT(findPIDOutputReceived(QByteArray)));
+ m_findPID->start();
+}
+
+void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
+{
+ bool ok;
+ m_pid = output.trimmed().toLongLong(&ok);
+ if (!ok) {
+ m_pid = 0;
+ m_errorString = tr("Could not determine remote PID.");
+ m_error = QProcess::FailedToStart;
+ emit ValgrindProcess::error(QProcess::FailedToStart);
+ close();
+ } else {
+ emit started();
+ }
+}
+
+void RemoteValgrindProcess::standardOutput(const QByteArray &output)
+{
+ emit processOutput(output, Utils::StdOutFormat);
+}
+
+void RemoteValgrindProcess::standardError(const QByteArray &output)
+{
+ emit processOutput(output, Utils::StdErrFormat);
+}
+
+void RemoteValgrindProcess::error(Utils::SshError error)
+{
+ switch (error) {
+ case Utils::SshTimeoutError:
+ m_error = QProcess::Timedout;
+ break;
+ default:
+ m_error = QProcess::FailedToStart;
+ break;
+ }
+ m_errorString = m_connection->errorString();
+ emit ValgrindProcess::error(m_error);
+}
+
+void RemoteValgrindProcess::close()
+{
+ QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
+ if (m_process) {
+ if (m_pid) {
+ const QString killTemplate = QString("kill -%2 %1" // kill
+ ).arg(m_pid);
+
+ const QString niceKill = killTemplate.arg("SIGTERM");
+ const QString brutalKill = killTemplate.arg("SIGKILL");
+ const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
+
+ Utils::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
+ cleanup->start();
+ }
+ }
+}
+
+void RemoteValgrindProcess::closed(int status)
+{
+ QTC_ASSERT(m_process, return);
+
+ m_errorString = m_process->errorString();
+ if (status == Utils::SshRemoteProcess::FailedToStart) {
+ m_error = QProcess::FailedToStart;
+ emit ValgrindProcess::error(QProcess::FailedToStart);
+ } else if (status == Utils::SshRemoteProcess::ExitedNormally) {
+ emit finished(m_process->exitCode(), QProcess::NormalExit);
+ } else if (status == Utils::SshRemoteProcess::KilledBySignal) {
+ m_error = QProcess::Crashed;
+ emit finished(m_process->exitCode(), QProcess::CrashExit);
+ }
+}
+
+QString RemoteValgrindProcess::errorString() const
+{
+ return m_errorString;
+}
+
+QProcess::ProcessError RemoteValgrindProcess::error() const
+{
+ return m_error;
+}
+
+void RemoteValgrindProcess::setEnvironment(const Utils::Environment &environment)
+{
+ Q_UNUSED(environment);
+ ///TODO: anything that should/could be done here?
+}
+
+void RemoteValgrindProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode)
+{
+ Q_UNUSED(mode);
+ ///TODO: support this by handling the mode internally
+}
+
+void RemoteValgrindProcess::setWorkingDirectory(const QString &path)
+{
+ m_workingDir = path;
+}
+
+QString RemoteValgrindProcess::workingDirectory() const
+{
+ return m_workingDir;
+}
+
+qint64 RemoteValgrindProcess::pid() const
+{
+ return m_pid;
+}
+
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/valgrindprocess.h b/src/plugins/valgrind/valgrind/valgrindprocess.h
new file mode 100644
index 0000000000..f4230bcd58
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/valgrindprocess.h
@@ -0,0 +1,170 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_RUNNER_P_H
+#define VALGRIND_RUNNER_P_H
+
+#include <utils/qtcprocess.h>
+#include <utils/ssh/sshremoteprocess.h>
+#include <utils/ssh/sshconnection.h>
+#include <utils/outputformat.h>
+
+namespace Valgrind {
+
+/**
+ * Abstract process that can be subclassed to supply local and remote valgrind runs
+ */
+class ValgrindProcess : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit ValgrindProcess(QObject *parent = 0);
+
+ virtual bool isRunning() const = 0;
+
+ virtual void run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
+ const QString &debuggeeExecutable, const QString &debuggeeArguments) = 0;
+ virtual void close() = 0;
+
+ virtual QString errorString() const = 0;
+ virtual QProcess::ProcessError error() const = 0;
+
+ virtual void setProcessChannelMode(QProcess::ProcessChannelMode mode) = 0;
+ virtual void setWorkingDirectory(const QString &path) = 0;
+ virtual QString workingDirectory() const = 0;
+ virtual void setEnvironment(const Utils::Environment &environment) = 0;
+
+ virtual qint64 pid() const = 0;
+
+signals:
+ void started();
+ void finished(int, QProcess::ExitStatus);
+ void error(QProcess::ProcessError);
+ void processOutput(const QByteArray &, Utils::OutputFormat format);
+};
+
+/**
+ * Run valgrind on the local machine
+ */
+class LocalValgrindProcess : public ValgrindProcess
+{
+ Q_OBJECT
+
+public:
+ explicit LocalValgrindProcess(QObject *parent = 0);
+
+ virtual bool isRunning() const;
+
+ virtual void run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
+ const QString &debuggeeExecutable, const QString &debuggeeArguments);
+ virtual void close();
+
+ virtual QString errorString() const;
+ QProcess::ProcessError error() const;
+
+ virtual void setProcessChannelMode(QProcess::ProcessChannelMode mode);
+ virtual void setWorkingDirectory(const QString &path);
+ virtual QString workingDirectory() const;
+ virtual void setEnvironment(const Utils::Environment &environment);
+
+ virtual qint64 pid() const;
+
+private slots:
+ void readyReadStandardError();
+ void readyReadStandardOutput();
+
+private:
+ Utils::QtcProcess m_process;
+ qint64 m_pid;
+};
+
+/**
+ * Run valgrind on a remote machine via SSH
+ */
+class RemoteValgrindProcess : public ValgrindProcess
+{
+ Q_OBJECT
+
+public:
+ explicit RemoteValgrindProcess(const Utils::SshConnectionParameters &sshParams,
+ QObject *parent = 0);
+ explicit RemoteValgrindProcess(const Utils::SshConnection::Ptr &connection,
+ QObject *parent = 0);
+
+ virtual bool isRunning() const;
+
+ virtual void run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
+ const QString &debuggeeExecutable, const QString &debuggeeArguments);
+ virtual void close();
+
+ virtual QString errorString() const;
+ QProcess::ProcessError error() const;
+
+ virtual void setProcessChannelMode(QProcess::ProcessChannelMode mode);
+ virtual void setWorkingDirectory(const QString &path);
+ virtual QString workingDirectory() const;
+ virtual void setEnvironment(const Utils::Environment &environment);
+
+ virtual qint64 pid() const;
+
+ Utils::SshConnection::Ptr connection() const;
+
+private slots:
+ void closed(int);
+ void connected();
+ void error(Utils::SshError error);
+ void processStarted();
+ void findPIDOutputReceived(const QByteArray &output);
+ void standardOutput(const QByteArray &output);
+ void standardError(const QByteArray &output);
+
+private:
+ Utils::SshConnectionParameters m_params;
+ Utils::SshConnection::Ptr m_connection;
+ Utils::SshRemoteProcess::Ptr m_process;
+ QString m_workingDir;
+ QString m_valgrindExe;
+ QStringList m_valgrindArgs;
+ QString m_debuggee;
+ QString m_debuggeeArgs;
+ QString m_errorString;
+ QProcess::ProcessError m_error;
+ qint64 m_pid;
+ Utils::SshRemoteProcess::Ptr m_findPID;
+};
+
+} // namespace Valgrind
+
+#endif // VALGRIND_RUNNER_P_H
diff --git a/src/plugins/valgrind/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrind/valgrindrunner.cpp
new file mode 100644
index 0000000000..8fdb69542e
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/valgrindrunner.cpp
@@ -0,0 +1,258 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "valgrindrunner.h"
+#include "valgrindprocess.h"
+
+#include <utils/qtcassert.h>
+
+#include <utils/environment.h>
+#include <utils/ssh/sshconnection.h>
+#include <utils/ssh/sshremoteprocess.h>
+
+#include <QtCore/QEventLoop>
+
+namespace Valgrind {
+
+class ValgrindRunner::Private
+{
+public:
+ explicit Private(ValgrindRunner *qq)
+ : q(qq),
+ process(0),
+ channelMode(QProcess::SeparateChannels),
+ finished(false)
+ {
+ }
+
+ void run(ValgrindProcess *process);
+
+ ValgrindRunner *q;
+ ValgrindProcess *process;
+ Utils::Environment environment;
+ QProcess::ProcessChannelMode channelMode;
+ bool finished;
+ QString valgrindExecutable;
+ QStringList valgrindArguments;
+ QString debuggeeExecutable;
+ QString debuggeeArguments;
+ QString workingdir;
+};
+
+void ValgrindRunner::Private::run(ValgrindProcess *_process)
+{
+ if (process && process->isRunning()) {
+ process->close();
+ process->disconnect(q);
+ process->deleteLater();
+ }
+
+ QTC_ASSERT(_process, return);
+
+ process = _process;
+
+ if (environment.size() > 0)
+ process->setEnvironment(environment);
+
+ process->setWorkingDirectory(workingdir);
+ process->setProcessChannelMode(channelMode);
+ // consider appending our options last so they override any interfering user-supplied options
+ // -q as suggested by valgrind manual
+ QStringList valgrindArgs = valgrindArguments;
+ valgrindArgs << QString("--tool=%1").arg(q->tool());
+
+#ifdef Q_OS_MAC
+ // May be slower to start but without it we get no filenames for symbols.
+ valgrindArgs << QLatin1String("--dsymutil=yes");
+#endif
+
+ QObject::connect(process, SIGNAL(processOutput(QByteArray,Utils::OutputFormat)),
+ q, SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)));
+ QObject::connect(process, SIGNAL(started()),
+ q, SLOT(processStarted()));
+ QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ q, SLOT(processFinished(int, QProcess::ExitStatus)));
+ QObject::connect(process, SIGNAL(error(QProcess::ProcessError)),
+ q, SLOT(processError(QProcess::ProcessError)));
+
+ process->run(valgrindExecutable, valgrindArgs, debuggeeExecutable, debuggeeArguments);
+}
+
+ValgrindRunner::ValgrindRunner(QObject *parent)
+ : QObject(parent),
+ d(new Private(this))
+{
+}
+
+ValgrindRunner::~ValgrindRunner()
+{
+ if (d->process && d->process->isRunning()) {
+ // make sure we don't delete the thread while it's still running
+ waitForFinished();
+ }
+ delete d;
+ d = 0;
+}
+
+void ValgrindRunner::setValgrindExecutable(const QString &executable)
+{
+ d->valgrindExecutable = executable;
+}
+
+QString ValgrindRunner::valgrindExecutable() const
+{
+ return d->valgrindExecutable;
+}
+
+void ValgrindRunner::setValgrindArguments(const QStringList &toolArguments)
+{
+ d->valgrindArguments = toolArguments;
+}
+
+QStringList ValgrindRunner::valgrindArguments() const
+{
+ return d->valgrindArguments;
+}
+
+QString ValgrindRunner::debuggeeExecutable() const
+{
+ return d->debuggeeExecutable;
+}
+
+void ValgrindRunner::setDebuggeeExecutable(const QString &executable)
+{
+ d->debuggeeExecutable = executable;
+}
+
+QString ValgrindRunner::debuggeeArguments() const
+{
+ return d->debuggeeArguments;
+}
+
+void ValgrindRunner::setDebuggeeArguments(const QString &arguments)
+{
+ d->debuggeeArguments = arguments;
+}
+
+void ValgrindRunner::setWorkingDirectory(const QString &path)
+{
+ d->workingdir = path;
+}
+
+QString ValgrindRunner::workingDirectory() const
+{
+ return d->workingdir;
+}
+
+void ValgrindRunner::setEnvironment(const Utils::Environment &environment)
+{
+ d->environment = environment;
+}
+
+void ValgrindRunner::setProcessChannelMode(QProcess::ProcessChannelMode mode)
+{
+ d->channelMode = mode;
+}
+
+void ValgrindRunner::waitForFinished() const
+{
+ if (d->finished || !d->process)
+ return;
+
+ QEventLoop loop;
+ connect(this, SIGNAL(finished()), &loop, SLOT(quit()));
+ loop.exec();
+}
+
+void ValgrindRunner::start()
+{
+ d->run(new LocalValgrindProcess(this));
+}
+
+void ValgrindRunner::startRemotely(const Utils::SshConnectionParameters &sshParams)
+{
+ d->run(new RemoteValgrindProcess(sshParams, this));
+}
+
+void ValgrindRunner::processError(QProcess::ProcessError e)
+{
+ if (d->finished)
+ return;
+
+ d->finished = true;
+
+ // make sure we don't wait for the connection anymore
+ emit processErrorReceived(errorString(), e);
+ emit finished();
+}
+
+void ValgrindRunner::processFinished(int ret, QProcess::ExitStatus status)
+{
+ if (d->finished)
+ return;
+
+ d->finished = true;
+
+ // make sure we don't wait for the connection anymore
+ emit finished();
+
+ if (ret != 0 || status == QProcess::CrashExit)
+ emit processErrorReceived(errorString(), d->process->error());
+}
+
+void ValgrindRunner::processStarted()
+{
+ emit started();
+}
+
+QString ValgrindRunner::errorString() const
+{
+ if (d->process)
+ return d->process->errorString();
+ else
+ return QString();
+}
+
+void ValgrindRunner::stop()
+{
+ if (d->process)
+ d->process->close();
+}
+
+ValgrindProcess *ValgrindRunner::valgrindProcess() const
+{
+ return d->process;
+}
+
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/valgrindrunner.h b/src/plugins/valgrind/valgrind/valgrindrunner.h
new file mode 100644
index 0000000000..3b866dfc54
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/valgrindrunner.h
@@ -0,0 +1,104 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef VALGRIND_RUNNER_H
+#define VALGRIND_RUNNER_H
+
+#include <QtCore/QProcess>
+#include <utils/outputformat.h>
+
+namespace Utils {
+class Environment;
+class SshConnectionParameters;
+}
+
+namespace Valgrind {
+
+class ValgrindProcess;
+
+class ValgrindRunner : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit ValgrindRunner(QObject *parent = 0);
+ ~ValgrindRunner();
+
+ QString valgrindExecutable() const;
+ void setValgrindExecutable(const QString &executable);
+ QStringList valgrindArguments() const;
+ void setValgrindArguments(const QStringList &toolArguments);
+ QString debuggeeExecutable() const;
+ void setDebuggeeExecutable(const QString &executable);
+ QString debuggeeArguments() const;
+ void setDebuggeeArguments(const QString &arguments);
+
+ void setWorkingDirectory(const QString &path);
+ QString workingDirectory() const;
+ void setEnvironment(const Utils::Environment &environment);
+ void setProcessChannelMode(QProcess::ProcessChannelMode mode);
+
+ void waitForFinished() const;
+
+ QString errorString() const;
+
+ virtual void start();
+ virtual void startRemotely(const Utils::SshConnectionParameters &sshParams);
+
+ virtual void stop();
+
+ ValgrindProcess *valgrindProcess() const;
+
+protected:
+ virtual QString tool() const = 0;
+
+signals:
+ void processOutputReceived(const QByteArray &, Utils::OutputFormat);
+ void processErrorReceived(const QString &, QProcess::ProcessError);
+ void started();
+ void finished();
+
+protected slots:
+ virtual void processError(QProcess::ProcessError);
+ virtual void processStarted();
+ virtual void processFinished(int, QProcess::ExitStatus);
+
+private:
+ class Private;
+ Private *d;
+};
+
+} // namespace Valgrind
+
+#endif // VALGRIND_RUNNER_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp
new file mode 100644
index 0000000000..c4219652b0
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp
@@ -0,0 +1,111 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "announcethread.h"
+#include "frame.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QVector>
+
+#include <algorithm>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class AnnounceThread::Private : public QSharedData
+{
+public:
+ Private()
+ : hThreadId( -1 )
+ {
+ }
+
+ qint64 hThreadId;
+ QVector<Frame> stack;
+};
+
+AnnounceThread::AnnounceThread()
+ : d(new Private)
+{
+}
+
+AnnounceThread::AnnounceThread(const AnnounceThread &other)
+ : d(other.d)
+{
+}
+
+AnnounceThread::~AnnounceThread()
+{
+}
+
+void AnnounceThread::swap(AnnounceThread &other)
+{
+ qSwap(d, other.d);
+}
+
+AnnounceThread &AnnounceThread::operator=(const AnnounceThread &other)
+{
+ AnnounceThread tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool AnnounceThread::operator==(const AnnounceThread &other) const
+{
+ return d->stack == other.d->stack
+ && d->hThreadId == other.d->hThreadId;
+}
+
+qint64 AnnounceThread::helgrindThreadId() const
+{
+ return d->hThreadId;
+}
+
+void AnnounceThread::setHelgrindThreadId(qint64 id)
+{
+ d->hThreadId = id;
+}
+
+QVector<Frame> AnnounceThread::stack() const
+{
+ return d->stack;
+}
+
+void AnnounceThread::setStack(const QVector<Frame> &stack)
+{
+ d->stack = stack;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h
new file mode 100644
index 0000000000..529e798d87
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h
@@ -0,0 +1,72 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H
+#define LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H
+
+#include <QtCore/QSharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+template <typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame;
+
+class AnnounceThread {
+public:
+ AnnounceThread();
+ AnnounceThread(const AnnounceThread &other);
+ ~AnnounceThread();
+ AnnounceThread &operator=(const AnnounceThread &other);
+ void swap(AnnounceThread &other);
+ bool operator==(const AnnounceThread &other) const;
+
+ qint64 helgrindThreadId() const;
+ void setHelgrindThreadId(qint64 id);
+
+ QVector<Frame> stack() const;
+ void setStack(const QVector<Frame> &stack);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/error.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/error.cpp
new file mode 100644
index 0000000000..3742456142
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/error.cpp
@@ -0,0 +1,266 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "error.h"
+#include "frame.h"
+#include "stack.h"
+#include "suppression.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QString>
+#include <QtCore/QTextStream>
+#include <QtCore/QVector>
+
+#include <QtCore/QtAlgorithms>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Error::Private : public QSharedData
+{
+public:
+ explicit Private() :
+ unique(0),
+ tid(0),
+ kind(0),
+ leakedBytes(0),
+ leakedBlocks(0),
+ hThreadId(-1)
+ {}
+
+ qint64 unique;
+ qint64 tid;
+ QString what;
+ int kind;
+ QVector<Stack> stacks;
+ Suppression suppression;
+ quint64 leakedBytes;
+ qint64 leakedBlocks;
+ qint64 hThreadId;
+
+ bool operator==(const Private &other) const
+ {
+ return unique == other.unique
+ && tid == other.tid
+ && what == other.what
+ && kind == other.kind
+ && stacks == other.stacks
+ && suppression == other.suppression
+ && leakedBytes == other.leakedBytes
+ && leakedBlocks == other.leakedBlocks
+ && hThreadId == other.hThreadId;
+ }
+};
+
+Error::Error() :
+ d(new Private)
+{
+}
+
+Error::~Error()
+{
+}
+
+Error::Error(const Error &other) :
+ d( other.d )
+{
+}
+
+void Error::swap(Error &other)
+{
+ qSwap(d, other.d);
+}
+
+Error &Error::operator=(const Error &other)
+{
+ Error tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool Error::operator ==(const Error &other) const
+{
+ return *d == *other.d;
+}
+
+bool Error::operator !=(const Error &other) const
+{
+ return !(*d == *other.d);
+}
+
+Suppression Error::suppression() const
+{
+ return d->suppression;
+}
+
+void Error::setSuppression(const Suppression &supp)
+{
+ d->suppression = supp;
+}
+
+qint64 Error::unique() const
+{
+ return d->unique;
+}
+
+void Error::setUnique(qint64 unique)
+{
+ d->unique = unique;
+}
+
+qint64 Error::tid() const
+{
+ return d->tid;
+}
+
+void Error::setTid(qint64 tid)
+{
+ d->tid = tid;
+}
+
+quint64 Error::leakedBytes() const
+{
+ return d->leakedBytes;
+}
+
+void Error::setLeakedBytes(quint64 l)
+{
+ d->leakedBytes = l;
+}
+
+qint64 Error::leakedBlocks() const
+{
+ return d->leakedBlocks;
+}
+
+void Error::setLeakedBlocks(qint64 b)
+{
+ d->leakedBlocks = b;
+}
+
+QString Error::what() const
+{
+ return d->what;
+}
+
+void Error::setWhat(const QString &what)
+{
+ d->what = what;
+}
+
+int Error::kind() const
+{
+ return d->kind;
+}
+
+void Error::setKind(int k)
+{
+ d->kind = k;
+}
+
+QVector<Stack> Error::stacks() const
+{
+ return d->stacks;
+}
+
+void Error::setStacks(const QVector<Stack> &stacks)
+{
+ d->stacks = stacks;
+}
+
+void Error::setHelgrindThreadId(qint64 id)
+{
+ d->hThreadId = id;
+}
+
+qint64 Error::helgrindThreadId() const
+{
+ return d->hThreadId;
+}
+
+QString Error::toXml() const
+{
+ QString xml;
+ QTextStream stream(&xml);
+ stream << "<error>\n";
+ stream << " <unique>" << d->unique << "</unique>\n";
+ stream << " <tid>" << d->tid << "</tid>\n";
+ stream << " <kind>" << d->kind << "</kind>\n";
+ if (d->leakedBlocks > 0 && d->leakedBytes > 0) {
+ stream << " <xwhat>\n"
+ << " <text>" << d->what << "</text>\n"
+ << " <leakedbytes>" << d->leakedBytes << "</leakedbytes>\n"
+ << " <leakedblocks>" << d->leakedBlocks << "</leakedblocks>\n"
+ << " </xwhat>\n";
+ } else {
+ stream << " <what>" << d->what << "</what>\n";
+ }
+
+ foreach (const Stack &stack, d->stacks) {
+ if (!stack.auxWhat().isEmpty()) {
+ stream << " <auxwhat>" << stack.auxWhat() << "</auxwhat>\n";
+ }
+ stream << " <stack>\n";
+
+ foreach (const Frame &frame, stack.frames()) {
+ stream << " <frame>\n";
+ stream << " <ip>0x" << QString::number(frame.instructionPointer(), 16) << "</ip>\n";
+ if (!frame.object().isEmpty()) {
+ stream << " <obj>" << frame.object() << "</obj>\n";
+ }
+ if (!frame.functionName().isEmpty()) {
+ stream << " <fn>" << frame.functionName() << "</fn>\n";
+ }
+ if (!frame.directory().isEmpty()) {
+ stream << " <dir>" << frame.directory() << "</dir>\n";
+ }
+ if (!frame.file().isEmpty()) {
+ stream << " <file>" << frame.file() << "</file>\n";
+ }
+ if (!frame.line() == -1) {
+ stream << " <line>" << frame.line() << "</line>";
+ }
+ stream << " </frame>\n";
+ }
+
+ stream << " </stack>\n";
+ }
+
+ stream << "</error>\n";
+
+ return xml;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/error.h b/src/plugins/valgrind/valgrind/xmlprotocol/error.h
new file mode 100644
index 0000000000..910098809d
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/error.h
@@ -0,0 +1,150 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_ERROR_H
+#define LIBVALGRIND_PROTOCOL_ERROR_H
+
+#include <QtCore/QMetaType>
+#include <QtCore/QSharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+class QString;
+template <typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame;
+class Stack;
+class Suppression;
+
+/**
+ * Error kinds, specific to memcheck
+ */
+enum MemcheckErrorKind
+{
+ InvalidFree,
+ MismatchedFree,
+ InvalidRead,
+ InvalidWrite,
+ InvalidJump,
+ Overlap,
+ InvalidMemPool,
+ UninitCondition,
+ UninitValue,
+ SyscallParam,
+ ClientCheck,
+ Leak_DefinitelyLost,
+ Leak_PossiblyLost,
+ Leak_StillReachable,
+ Leak_IndirectlyLost,
+ MemcheckErrorKindCount
+};
+
+enum PtrcheckErrorKind
+{
+ SorG,
+ Heap,
+ Arith,
+ SysParam
+};
+
+enum HelgrindErrorKind
+{
+ Race,
+ UnlockUnlocked,
+ UnlockForeign,
+ UnlockBogus,
+ PthAPIerror,
+ LockOrder,
+ Misc
+};
+
+class Error
+{
+public:
+ Error();
+ ~Error();
+
+ Error(const Error &other);
+
+ Error &operator=(const Error &other);
+ void swap(Error &other);
+
+ bool operator==(const Error &other) const;
+ bool operator!=(const Error &other) const;
+
+ qint64 unique() const;
+ void setUnique(qint64 unique);
+
+ qint64 tid() const;
+ void setTid(qint64);
+
+ QString what() const;
+ void setWhat(const QString &what);
+
+ int kind() const;
+ void setKind(int kind);
+
+ QVector<Stack> stacks() const;
+ void setStacks(const QVector<Stack> &stacks);
+
+ Suppression suppression() const;
+ void setSuppression(const Suppression &suppression);
+
+ //memcheck
+ quint64 leakedBytes() const;
+ void setLeakedBytes(quint64);
+
+ qint64 leakedBlocks() const;
+ void setLeakedBlocks(qint64 blocks);
+
+ //helgrind
+ qint64 helgrindThreadId() const;
+ void setHelgrindThreadId( qint64 threadId );
+
+ QString toXml() const;
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+Q_DECLARE_METATYPE(Valgrind::XmlProtocol::Error)
+
+#endif // LIBVALGRIND_PROTOCOL_ERROR_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp
new file mode 100644
index 0000000000..08794bd742
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp
@@ -0,0 +1,300 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "errorlistmodel.h"
+#include "error.h"
+#include "frame.h"
+#include "stack.h"
+#include "modelhelpers.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QDir>
+#include <QtCore/QVector>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class ErrorListModel::Private
+{
+public:
+ QVector<Error> errors;
+ QVariant errorData(int row, int column, int role) const;
+ QSharedPointer<const ErrorListModel::RelevantFrameFinder> relevantFrameFinder;
+ Frame findRelevantFrame(const Error &error) const;
+ QString formatAbsoluteFilePath(const Error &error) const;
+ QString formatLocation(const Error &error) const;
+};
+
+ErrorListModel::ErrorListModel(QObject *parent)
+ : QAbstractItemModel(parent)
+ , d(new Private)
+{
+}
+
+ErrorListModel::~ErrorListModel()
+{
+ delete d;
+}
+
+QSharedPointer<const ErrorListModel::RelevantFrameFinder> ErrorListModel::relevantFrameFinder() const
+{
+ return d->relevantFrameFinder;
+}
+
+void ErrorListModel::setRelevantFrameFinder(const QSharedPointer<const RelevantFrameFinder> &finder)
+{
+ d->relevantFrameFinder = finder;
+}
+
+Frame ErrorListModel::findRelevantFrame(const Error &error) const
+{
+ return d->findRelevantFrame(error);
+}
+
+QModelIndex ErrorListModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (parent.isValid()) {
+ QTC_ASSERT(parent.model() == this, qt_noop());
+ return QModelIndex();
+ }
+ return createIndex(row, column, 0);
+}
+
+QModelIndex ErrorListModel::parent(const QModelIndex &child) const
+{
+ QTC_ASSERT(!child.isValid() || child.model() == this, return QModelIndex());
+ return QModelIndex();
+}
+
+Frame ErrorListModel::Private::findRelevantFrame(const Error &error) const
+{
+ if (relevantFrameFinder)
+ return relevantFrameFinder->findRelevant(error);
+ const QVector<Stack> stacks = error.stacks();
+ if (stacks.isEmpty())
+ return Frame();
+ const Stack &stack = stacks[0];
+ const QVector<Frame> frames = stack.frames();
+ if (!frames.isEmpty())
+ return frames.first();
+ return Frame();
+}
+
+QString ErrorListModel::Private::formatAbsoluteFilePath(const Error &error) const
+{
+ const Frame f = findRelevantFrame(error);
+ if (!f.directory().isEmpty() && !f.file().isEmpty())
+ return QString(f.directory() + QDir::separator() + f.file());
+ return QString();
+}
+
+QString ErrorListModel::Private::formatLocation(const Error &error) const
+{
+ const Frame frame = findRelevantFrame(error);
+ const QString file = frame.file();
+ if (!frame.functionName().isEmpty())
+ return frame.functionName();
+ if (!file.isEmpty()) {
+ const qint64 line = frame.line();
+ if (line > 0)
+ return QString::fromLatin1("%1:%2").arg(file, QString::number(frame.line()));
+ return file;
+ }
+ return frame.object();
+}
+
+QVariant ErrorListModel::Private::errorData(int row, int column, int role) const
+{
+ if (row < 0 || row >= errors.size())
+ return QVariant();
+ const Error &error = errors[row];
+
+ const QVector<Stack> stacks = error.stacks();
+ const Stack stack = !stacks.isEmpty() ? stacks.first() : Stack();
+
+ if (error.stacks().count())
+ switch (role) {
+ case Qt::DisplayRole:
+ {
+ switch (column) {
+ case WhatColumn:
+ return error.what();
+ case LocationColumn:
+ return formatLocation(error);
+ case AbsoluteFilePathColumn:
+ return formatAbsoluteFilePath(error);
+ case LineColumn:
+ {
+ const qint64 line = findRelevantFrame(error).line();
+ return line > 0 ? line : QVariant();
+ }
+ case UniqueColumn:
+ return error.unique();
+ case TidColumn:
+ return error.tid();
+ case KindColumn:
+ return error.kind();
+ case LeakedBlocksColumn:
+ return error.leakedBlocks();
+ case LeakedBytesColumn:
+ return error.leakedBytes();
+ case HelgrindThreadIdColumn:
+ return error.helgrindThreadId();
+ default:
+ break;
+ }
+ }
+ case Qt::ToolTipRole:
+ {
+ return toolTipForFrame(findRelevantFrame(error));
+ }
+ case ErrorRole:
+ return QVariant::fromValue<Error>(error);
+ case AbsoluteFilePathRole:
+ return formatAbsoluteFilePath(error);
+ case FileRole:
+ return findRelevantFrame(error).file();
+ case LineRole:
+ {
+ const qint64 line = findRelevantFrame(error).line();
+ return line > 0 ? line : QVariant();
+ }
+ }
+ return QVariant();
+}
+
+QVariant ErrorListModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ QTC_ASSERT(index.model() == this, return QVariant());
+
+ if (!index.parent().isValid())
+ return d->errorData(index.row(), index.column(), role);
+
+ return QVariant();
+}
+
+QVariant ErrorListModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+ return QVariant();
+
+ switch (section) {
+ case WhatColumn:
+ return tr("What");
+ case LocationColumn:
+ return tr("Location");
+ case AbsoluteFilePathColumn:
+ return tr("File");
+ case LineColumn:
+ return tr("Line");
+ case UniqueColumn:
+ return tr("Unique");
+ case TidColumn:
+ return tr("Thread ID");
+ case KindColumn:
+ return tr("Kind");
+ case LeakedBlocksColumn:
+ return tr("Leaked Blocks");
+ case LeakedBytesColumn:
+ return tr("Leaked Bytes");
+ case HelgrindThreadIdColumn:
+ return tr("Helgrind Thread ID");
+ }
+
+ return QVariant();
+}
+
+int ErrorListModel::rowCount(const QModelIndex &parent) const
+{
+ //root
+ if (!parent.isValid())
+ return d->errors.count();
+
+ QTC_ASSERT(parent.model() == this, return 0);
+
+ return 0;
+}
+
+int ErrorListModel::columnCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+ return ColumnCount;
+}
+
+bool ErrorListModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return false);
+
+ if (row < 0 || row + count > d->errors.size() || parent.isValid())
+ return false;
+
+ beginRemoveRows(parent, row, row + count);
+ d->errors.remove(row, count);
+ endRemoveRows();
+ return true;
+}
+
+void ErrorListModel::addError(const Error &error)
+{
+ beginInsertRows(QModelIndex(), d->errors.size(), d->errors.size());
+ d->errors.push_back(error);
+ endInsertRows();
+}
+
+Error ErrorListModel::error(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return Error();
+
+ QTC_ASSERT(index.model() == this, return Error());
+
+ const int r = index.row();
+ if (r < 0 || r >= d->errors.size())
+ return Error();
+ return d->errors[r];
+}
+
+void ErrorListModel::clear()
+{
+ beginResetModel();
+ d->errors.clear();
+ endResetModel();
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h
new file mode 100644
index 0000000000..fe758ed01a
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h
@@ -0,0 +1,110 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H
+#define LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H
+
+#include <QtCore/QAbstractItemModel>
+#include <QtCore/QSharedPointer>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Error;
+class Frame;
+
+class ErrorListModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ enum Column {
+ WhatColumn=0,
+ LocationColumn,
+ AbsoluteFilePathColumn,
+ LineColumn,
+ UniqueColumn,
+ TidColumn,
+ KindColumn,
+ LeakedBlocksColumn,
+ LeakedBytesColumn,
+ HelgrindThreadIdColumn,
+ ColumnCount
+ };
+
+ enum Role {
+ ErrorRole=Qt::UserRole,
+ AbsoluteFilePathRole,
+ FileRole,
+ LineRole
+ };
+
+ class RelevantFrameFinder
+ {
+ public:
+ virtual ~RelevantFrameFinder() {}
+ virtual Frame findRelevant(const Error &error) const = 0;
+ };
+
+ explicit ErrorListModel(QObject *parent = 0);
+ ~ErrorListModel();
+
+ QSharedPointer<const RelevantFrameFinder> relevantFrameFinder() const;
+ void setRelevantFrameFinder(const QSharedPointer<const RelevantFrameFinder> &finder);
+
+ QVariant data(const QModelIndex &index, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &child) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+
+ Error error(const QModelIndex &index) const;
+
+ Frame findRelevantFrame(const Error &error) const;
+
+ void clear();
+
+public Q_SLOTS:
+ void addError(const Valgrind::XmlProtocol::Error &error);
+
+private:
+ class Private;
+ Private *const d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp
new file mode 100644
index 0000000000..9b36a4a368
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp
@@ -0,0 +1,164 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "frame.h"
+
+#include <QtCore/QString>
+#include <QtCore/QtAlgorithms>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame::Private : public QSharedData
+{
+public:
+ explicit Private() :
+ ip(0), line( -1 )
+ {}
+
+ bool operator==(const Private &other) const
+ {
+ return ip == other.ip
+ && object == other.object
+ && functionName == other.functionName
+ && file == other.file
+ && directory == other.directory
+ && line == other.line;
+ }
+
+ quint64 ip;
+ QString object;
+ QString functionName;
+ QString file;
+ QString directory;
+ int line;
+};
+
+Frame::Frame() : d(new Private)
+{
+}
+
+Frame::~Frame()
+{
+}
+
+Frame::Frame(const Frame &other) :
+ d( other.d )
+{
+}
+
+Frame &Frame::operator=(const Frame &other)
+{
+ Frame tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool Frame::operator==( const Frame &other ) const
+{
+ return *d == *other.d;
+}
+
+bool Frame::operator!=(const Frame &other) const
+{
+ return !(*this == other);
+}
+
+void Frame::swap(Frame &other)
+{
+ qSwap(d, other.d);
+}
+
+quint64 Frame::instructionPointer() const
+{
+ return d->ip;
+}
+
+void Frame::setInstructionPointer(quint64 ip)
+{
+ d->ip = ip;
+}
+
+QString Frame::object() const
+{
+ return d->object;
+}
+
+void Frame::setObject(const QString &obj)
+{
+ d->object = obj;
+}
+
+QString Frame::functionName() const
+{
+ return d->functionName;
+}
+
+void Frame::setFunctionName(const QString &functionName)
+{
+ d->functionName = functionName;
+}
+
+QString Frame::file() const
+{
+ return d->file;
+}
+
+void Frame::setFile(const QString &file)
+{
+ d->file = file;
+}
+
+QString Frame::directory() const
+{
+ return d->directory;
+}
+
+void Frame::setDirectory(const QString &directory)
+{
+ d->directory = directory;
+}
+
+int Frame::line() const
+{
+ return d->line;
+}
+
+void Frame::setLine(int line)
+{
+ d->line = line;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/frame.h b/src/plugins/valgrind/valgrind/xmlprotocol/frame.h
new file mode 100644
index 0000000000..e7b5cd649a
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/frame.h
@@ -0,0 +1,82 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_FRAME_H
+#define LIBVALGRIND_PROTOCOL_FRAME_H
+
+#include <QtCore/QSharedDataPointer>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame
+{
+public:
+ Frame();
+ ~Frame();
+ Frame(const Frame &other);
+
+ Frame &operator=(const Frame &other);
+ void swap(Frame &other);
+
+ bool operator==(const Frame &other) const;
+ bool operator!=(const Frame &other) const;
+
+ quint64 instructionPointer() const;
+ void setInstructionPointer(quint64);
+
+ QString object() const;
+ void setObject(const QString &obj);
+
+ QString functionName() const;
+ void setFunctionName(const QString &functionName);
+
+ QString file() const;
+ void setFile(const QString &file);
+
+ QString directory() const;
+ void setDirectory(const QString &directory);
+
+ int line() const;
+ void setLine(int line);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp
new file mode 100644
index 0000000000..bb8151485b
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp
@@ -0,0 +1,88 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "modelhelpers.h"
+#include "frame.h"
+
+#include <QtCore/QString>
+#include <QtCore/QDir>
+#include <QtCore/QPair>
+#include <QtCore/QCoreApplication>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+QString toolTipForFrame(const Frame &frame)
+{
+ QString location;
+ if (!frame.file().isEmpty()) {
+ location = frame.directory() + QDir::separator() + frame.file();
+ if (frame.line() > 0)
+ location += ':' + QString::number(frame.line());
+ }
+
+ typedef QPair<QString, QString> StringPair;
+ QList<StringPair> lines;
+
+ if (!frame.functionName().isEmpty())
+ lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Function:"),
+ frame.functionName());
+ if (!location.isEmpty())
+ lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Location:"),
+ location);
+ if (frame.instructionPointer())
+ lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
+ "Instruction pointer:"),
+ QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16));
+ if (!frame.object().isEmpty())
+ lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
+
+ QString html = "<html>"
+ "<head>"
+ "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
+ "<body><dl>";
+
+ foreach (const StringPair &pair, lines) {
+ html += QLatin1String("<dt>");
+ html += pair.first;
+ html += QLatin1String("</dt><dd>");
+ html += pair.second;
+ html += QLatin1String("</dd>\n");
+ }
+ html += "</dl></body></html>";
+ return html;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h
new file mode 100644
index 0000000000..6c2a57f155
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h
@@ -0,0 +1,54 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H
+#define LIBVALGRIND_PROTOCOL_MODELHELPERS_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame;
+
+QString toolTipForFrame(const Frame &frame);
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_PROTOCOL_MODELHELPERS_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp
new file mode 100644
index 0000000000..6d602c9602
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp
@@ -0,0 +1,753 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "parser.h"
+#include "announcethread.h"
+#include "error.h"
+#include "frame.h"
+#include "stack.h"
+#include "status.h"
+#include "suppression.h"
+#include <utils/qtcassert.h>
+
+#include <QtNetwork/QAbstractSocket>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QHash>
+#include <QtCore/QIODevice>
+#include <QtCore/QPair>
+#include <QtCore/QThread>
+#include <QtCore/QXmlStreamReader>
+
+namespace {
+
+ class ParserException
+ {
+ public:
+ explicit ParserException(const QString &message)
+ : m_message(message)
+ {}
+
+ ~ParserException() throw() {}
+
+ QString message() const { return m_message; }
+
+ private:
+ QString m_message;
+ };
+
+ struct XWhat
+ {
+ XWhat() : leakedblocks(0), leakedbytes(0), hthreadid(-1) {}
+ QString text;
+ qint64 leakedblocks;
+ qint64 leakedbytes;
+ qint64 hthreadid;
+ };
+
+ struct XauxWhat
+ {
+ XauxWhat() : line(-1), hthreadid(-1) {}
+ void clear() { *this = XauxWhat(); }
+
+ QString text;
+ QString file;
+ QString dir;
+ qint64 line;
+ qint64 hthreadid;
+ };
+
+} // namespace anon
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Parser::Private
+{
+ Parser *const q;
+public:
+ explicit Private(Parser *qq);
+
+ void parse(QIODevice *device);
+
+ void parse_error();
+ QVector<Frame> parseStack();
+ Suppression parseSuppression();
+ SuppressionFrame parseSuppressionFrame();
+ Frame parse_frame();
+ void parse_status();
+ void parse_errorcounts();
+ void parse_suppcounts();
+ void parse_announcethread();
+ void checkProtocolVersion(const QString &versionStr);
+ void checkTool(const QString &tool);
+ XWhat parseXWhat();
+ XauxWhat parseXauxWhat();
+ MemcheckErrorKind parseMemcheckErrorKind(const QString &kind);
+ HelgrindErrorKind parseHelgrindErrorKind(const QString &kind);
+ PtrcheckErrorKind parsePtrcheckErrorKind(const QString &kind);
+ int parseErrorKind(const QString &kind);
+
+ void reportInternalError(const QString &errorString);
+ QXmlStreamReader::TokenType blockingReadNext();
+ bool notAtEnd() const;
+ QString blockingReadElementText();
+
+ Tool tool;
+ QString errorString;
+ QXmlStreamReader reader;
+ QHash<QString,MemcheckErrorKind> errorKindsByName_memcheck;
+ QHash<QString,HelgrindErrorKind> errorKindsByName_helgrind;
+ QHash<QString,PtrcheckErrorKind> errorKindsByName_ptrcheck;
+ QHash<QString,Parser::Tool> toolsByName;
+};
+
+#undef ADD_ENUM
+#define ADD_ENUM(tool,enumV) { errorKindsByName_##tool.insert(QLatin1String(#enumV), enumV); }
+
+
+Parser::Private::Private(Parser *qq)
+ : q(qq),
+ tool(Parser::Unknown)
+{
+ toolsByName.insert(QLatin1String("memcheck"), Parser::Memcheck);
+ toolsByName.insert(QLatin1String("ptrcheck"), Parser::Ptrcheck);
+ toolsByName.insert(QLatin1String("exp-ptrcheck"), Parser::Ptrcheck);
+ toolsByName.insert(QLatin1String("helgrind"), Parser::Helgrind);
+
+ ADD_ENUM(memcheck, ClientCheck)
+ ADD_ENUM(memcheck, InvalidFree)
+ ADD_ENUM(memcheck, InvalidJump)
+ ADD_ENUM(memcheck, InvalidRead)
+ ADD_ENUM(memcheck, InvalidWrite)
+ ADD_ENUM(memcheck, Leak_DefinitelyLost)
+ ADD_ENUM(memcheck, Leak_PossiblyLost)
+ ADD_ENUM(memcheck, Leak_StillReachable)
+ ADD_ENUM(memcheck, Leak_IndirectlyLost)
+ ADD_ENUM(memcheck, MismatchedFree)
+ ADD_ENUM(memcheck, Overlap)
+ ADD_ENUM(memcheck, SyscallParam)
+ ADD_ENUM(memcheck, UninitCondition)
+ ADD_ENUM(memcheck, UninitValue)
+
+ ADD_ENUM(helgrind, Race)
+ ADD_ENUM(helgrind, UnlockUnlocked)
+ ADD_ENUM(helgrind, UnlockForeign)
+ ADD_ENUM(helgrind, UnlockBogus)
+ ADD_ENUM(helgrind, PthAPIerror)
+ ADD_ENUM(helgrind, LockOrder)
+ ADD_ENUM(helgrind, Misc)
+
+ ADD_ENUM(ptrcheck, SorG)
+ ADD_ENUM(ptrcheck, Heap)
+ ADD_ENUM(ptrcheck, Arith)
+ ADD_ENUM(ptrcheck, SysParam)
+}
+
+#undef ADD_ENUM
+
+static quint64 parseHex(const QString &str, const QString &context)
+{
+ bool ok;
+ const quint64 v = str.toULongLong(&ok, 16);
+ if (!ok)
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Could not parse hex number from \"%1\" (%2)").arg(str, context));
+ return v;
+}
+
+static qint64 parseInt64(const QString &str, const QString &context)
+{
+ bool ok;
+ const quint64 v = str.toLongLong(&ok);
+ if (!ok)
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Could not parse hex number from \"%1\" (%2)").arg(str, context));
+ return v;
+}
+
+QXmlStreamReader::TokenType Parser::Private::blockingReadNext()
+{
+ QXmlStreamReader::TokenType token = QXmlStreamReader::Invalid;
+
+ forever {
+ token = reader.readNext();
+
+ if (reader.error() == QXmlStreamReader::PrematureEndOfDocumentError) {
+ if (reader.device()->waitForReadyRead(1000)) {
+ // let's try again
+ continue;
+ } else {
+ // device error, e.g. remote host closed connection, or timeout
+ // ### we have no way to know if waitForReadyRead() timed out or failed with a real
+ // error, and sensible heuristics based on QIODevice fail.
+ // - error strings are translated and in any case not guaranteed to stay the same,
+ // so we can't use them.
+ // - errorString().isEmpty() does not work because errorString() is
+ // "network timeout error" if the waitFor... timed out.
+ // - isSequential() [for socket] && isOpen() doesn't work because isOpen()
+ // returns true if the remote host closed the connection.
+ // ...so we fall back to knowing it might be a QAbstractSocket.
+
+ QIODevice *dev = reader.device();
+ QAbstractSocket *sock = qobject_cast<QAbstractSocket *>(dev);
+
+ if (!sock || sock->state() != QAbstractSocket::ConnectedState) {
+ throw ParserException(dev->errorString());
+ }
+ }
+ } else if (reader.hasError()) {
+ throw ParserException(reader.errorString()); //TODO add line, column?
+ break;
+ } else {
+ // read a valid next token
+ break;
+ }
+ }
+
+ return token;
+}
+
+bool Parser::Private::notAtEnd() const
+{
+ return !reader.atEnd()
+ || reader.error() == QXmlStreamReader::PrematureEndOfDocumentError;
+}
+
+QString Parser::Private::blockingReadElementText()
+{
+ //analogous to QXmlStreamReader::readElementText(), but blocking. readElementText() doesn't recover from PrematureEndOfData,
+ //but always returns a null string if isStartElement() is false (which is the case if it already parts of the text)
+ //affects at least Qt <= 4.7.1. Reported as QTBUG-14661.
+
+ if (!reader.isStartElement())
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "trying to read element text although current position is not start of element"));
+
+ QString result;
+
+ forever {
+ const QXmlStreamReader::TokenType type = blockingReadNext();
+ switch (type) {
+ case QXmlStreamReader::Characters:
+ case QXmlStreamReader::EntityReference:
+ result += reader.text();
+ break;
+ case QXmlStreamReader::EndElement:
+ return result;
+ case QXmlStreamReader::ProcessingInstruction:
+ case QXmlStreamReader::Comment:
+ break;
+ case QXmlStreamReader::StartElement:
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unexpected child element while reading element text"));
+ default:
+ //TODO handle
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unexpected token type %1").arg(type));
+ break;
+ }
+ }
+ return QString();
+}
+
+void Parser::Private::checkProtocolVersion(const QString &versionStr)
+{
+ bool ok;
+ const int version = versionStr.toInt(&ok);
+ if (!ok)
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Could not parse protocol version from \"%1\"").arg(versionStr));
+ if (version != 4)
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "XmlProtocol version %1 not supported (supported version: 4)").arg(version));
+}
+
+void Parser::Private::checkTool(const QString &reportedStr)
+{
+ const QHash<QString,Parser::Tool>::ConstIterator reported = toolsByName.find(reportedStr);
+
+ if (reported == toolsByName.constEnd())
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Valgrind tool \"%1\" not supported").arg(reportedStr));
+
+ tool = reported.value();
+}
+
+XWhat Parser::Private::parseXWhat()
+{
+ XWhat what;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.name() == QLatin1String("text"))
+ what.text = blockingReadElementText();
+ else if (reader.name() == QLatin1String("leakedbytes"))
+ what.leakedbytes = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedbytes"));
+ else if (reader.name() == QLatin1String("leakedblocks"))
+ what.leakedblocks = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedblocks"));
+ else if (reader.name() == QLatin1String("hthreadid"))
+ what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/hthreadid"));
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ return what;
+}
+
+XauxWhat Parser::Private::parseXauxWhat()
+{
+ XauxWhat what;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.name() == QLatin1String("text"))
+ what.text = blockingReadElementText();
+ else if (reader.name() == QLatin1String("file"))
+ what.file = blockingReadElementText();
+ else if (reader.name() == QLatin1String("dir"))
+ what.dir = blockingReadElementText();
+ else if (reader.name() == QLatin1String("line"))
+ what.line = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/line"));
+ else if (reader.name() == QLatin1String("hthreadid"))
+ what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/hthreadid"));
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ return what;
+}
+
+
+
+MemcheckErrorKind Parser::Private::parseMemcheckErrorKind(const QString &kind)
+{
+ const QHash<QString,MemcheckErrorKind>::ConstIterator it = errorKindsByName_memcheck.find(kind);
+ if (it != errorKindsByName_memcheck.constEnd())
+ return *it;
+ else
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unknown memcheck error kind \"%1\"").arg(kind));
+}
+
+HelgrindErrorKind Parser::Private::parseHelgrindErrorKind(const QString &kind)
+{
+ const QHash<QString,HelgrindErrorKind>::ConstIterator it = errorKindsByName_helgrind.find(kind);
+ if (it != errorKindsByName_helgrind.constEnd())
+ return *it;
+ else
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unknown helgrind error kind \"%1\"").arg(kind));
+}
+
+PtrcheckErrorKind Parser::Private::parsePtrcheckErrorKind(const QString &kind)
+{
+ const QHash<QString,PtrcheckErrorKind>::ConstIterator it = errorKindsByName_ptrcheck.find(kind);
+ if (it != errorKindsByName_ptrcheck.constEnd())
+ return *it;
+ else
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unknown ptrcheck error kind \"%1\"").arg(kind));
+}
+
+int Parser::Private::parseErrorKind(const QString &kind)
+{
+ switch (tool) {
+ case Memcheck:
+ return parseMemcheckErrorKind(kind);
+ case Ptrcheck:
+ return parsePtrcheckErrorKind(kind);
+ case Helgrind:
+ return parseHelgrindErrorKind(kind);
+ case Unknown:
+ default:
+ break;
+ }
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Could not parse error kind, tool not yet set."));
+}
+
+static Status::State parseState(const QString &state)
+{
+ if (state == QLatin1String("RUNNING"))
+ return Status::Running;
+ if (state == QLatin1String("FINISHED"))
+ return Status::Finished;
+ throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unknown state \"%1\"").arg(state));
+}
+
+void Parser::Private::reportInternalError(const QString &e)
+{
+ errorString = e;
+ emit q->internalError(e);
+}
+
+static Stack makeStack(const XauxWhat &xauxwhat, const QVector<Frame> &frames)
+{
+ Stack s;
+ s.setFrames(frames);
+ s.setFile(xauxwhat.file);
+ s.setDirectory(xauxwhat.dir);
+ s.setLine(xauxwhat.line);
+ s.setHelgrindThreadId(xauxwhat.hthreadid);
+ s.setAuxWhat(xauxwhat.text);
+ return s;
+}
+
+void Parser::Private::parse_error()
+{
+ Error e;
+ QVector<QVector<Frame> > frames;
+ XauxWhat currentAux;
+ QVector<XauxWhat> auxs;
+
+ int lastAuxWhat = -1;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement())
+ lastAuxWhat++;
+ if (reader.name() == QLatin1String("unique"))
+ e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique")));
+ else if ( reader.name() == QLatin1String("tid"))
+ e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid")));
+ else if (reader.name() == QLatin1String("kind")) //TODO this is memcheck-specific:
+ e.setKind(parseErrorKind(blockingReadElementText()));
+ else if (reader.name() == QLatin1String("suppression"))
+ e.setSuppression(parseSuppression());
+ else if (reader.name() == QLatin1String("xwhat")) {
+ const XWhat xw = parseXWhat();
+ e.setWhat(xw.text);
+ e.setLeakedBlocks(xw.leakedblocks);
+ e.setLeakedBytes(xw.leakedbytes);
+ e.setHelgrindThreadId(xw.hthreadid);
+ }
+ else if (reader.name() == QLatin1String("what"))
+ e.setWhat(blockingReadElementText());
+ else if (reader.name() == QLatin1String("xauxwhat")) {
+ if (!currentAux.text.isEmpty())
+ auxs.push_back(currentAux);
+ currentAux = parseXauxWhat();
+ }
+ else if (reader.name() == QLatin1String("auxwhat")) {
+ const QString aux = blockingReadElementText();
+ //concatenate multiple consecutive <auxwhat> tags
+ if (lastAuxWhat > 1) {
+ if (!currentAux.text.isEmpty())
+ auxs.push_back(currentAux);
+ currentAux.clear();
+ currentAux.text = aux;
+ } else {
+ if (!currentAux.text.isEmpty())
+ currentAux.text.append(QLatin1Char(' '));
+ currentAux.text.append(aux);
+ }
+ lastAuxWhat = 0;
+ }
+ else if (reader.name() == QLatin1String("stack")) {
+ frames.push_back(parseStack());
+ }
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+
+ if (!currentAux.text.isEmpty())
+ auxs.push_back(currentAux);
+
+ //if we have less xaux/auxwhats than stacks, prepend empty xauxwhats
+ //(the first frame usually has not xauxwhat in helgrind and memcheck)
+ while (auxs.size() < frames.size())
+ auxs.prepend(XauxWhat());
+
+ QVector<Stack> stacks;
+ for (int i = 0; i < auxs.size(); ++i)
+ stacks.append(makeStack(auxs[i], frames[i]));
+ e.setStacks(stacks);
+
+ emit q->error(e);
+}
+
+Frame Parser::Private::parse_frame()
+{
+ Frame frame;
+
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("ip"))
+ frame.setInstructionPointer(parseHex(blockingReadElementText(), QLatin1String("error/frame/ip")));
+ else if (reader.name() == QLatin1String("obj"))
+ frame.setObject(blockingReadElementText());
+ else if (reader.name() == QLatin1String("fn"))
+ frame.setFunctionName( blockingReadElementText());
+ else if (reader.name() == QLatin1String("dir"))
+ frame.setDirectory(blockingReadElementText());
+ else if (reader.name() == QLatin1String("file"))
+ frame.setFile( blockingReadElementText());
+ else if (reader.name() == QLatin1String("line"))
+ frame.setLine(parseInt64(blockingReadElementText(), QLatin1String("error/frame/line")));
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+
+ return frame;
+}
+
+void Parser::Private::parse_announcethread()
+{
+ AnnounceThread at;
+
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("hthreadid"))
+ at.setHelgrindThreadId(parseInt64(blockingReadElementText(), QLatin1String("announcethread/hthreadid")));
+ else if (reader.name() == QLatin1String("stack"))
+ at.setStack(parseStack());
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+
+ emit q->announceThread(at);
+}
+
+void Parser::Private::parse_errorcounts()
+{
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("pair")) {
+ qint64 unique = 0;
+ qint64 count = 0;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("unique"))
+ unique = parseHex(blockingReadElementText(), QLatin1String("errorcounts/pair/unique"));
+ else if (reader.name() == QLatin1String("count"))
+ count = parseInt64(blockingReadElementText(), QLatin1String("errorcounts/pair/count"));
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+ emit q->errorCount(unique, count);
+ }
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+}
+
+
+void Parser::Private::parse_suppcounts()
+{
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("pair")) {
+ QString name;
+ qint64 count = 0;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("name"))
+ name = blockingReadElementText();
+ else if (reader.name() == QLatin1String("count"))
+ count = parseInt64(blockingReadElementText(), QLatin1String("suppcounts/pair/count"));
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+ emit q->suppressionCount(name, count);
+ }
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+}
+
+void Parser::Private::parse_status()
+{
+ Status s;
+
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("state"))
+ s.setState(parseState(blockingReadElementText()));
+ else if (reader.name() == QLatin1String("time"))
+ s.setTime(blockingReadElementText());
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+
+ emit q->status(s);
+}
+
+QVector<Frame> Parser::Private::parseStack()
+{
+ QVector<Frame> frames;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("frame"))
+ frames.append(parse_frame());
+ }
+ }
+
+ return frames;
+}
+
+SuppressionFrame Parser::Private::parseSuppressionFrame()
+{
+ SuppressionFrame frame;
+
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("obj"))
+ frame.setObject(blockingReadElementText());
+ else if (reader.name() == QLatin1String("fun"))
+ frame.setFunction( blockingReadElementText());
+ else if (reader.isStartElement())
+ reader.skipCurrentElement();
+ }
+ }
+
+ return frame;
+}
+
+Suppression Parser::Private::parseSuppression()
+{
+ Suppression supp;
+ SuppressionFrames frames;
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.isEndElement())
+ break;
+ if (reader.isStartElement()) {
+ if (reader.name() == QLatin1String("sname"))
+ supp.setName(blockingReadElementText());
+ else if (reader.name() == QLatin1String("skind"))
+ supp.setKind(blockingReadElementText());
+ else if (reader.name() == QLatin1String("skaux"))
+ supp.setAuxKind(blockingReadElementText());
+ else if (reader.name() == QLatin1String("rawtext"))
+ supp.setRawText(blockingReadElementText());
+ else if (reader.name() == QLatin1String("sframe"))
+ frames.push_back(parseSuppressionFrame());
+ }
+ }
+
+ supp.setFrames(frames);
+ return supp;
+}
+
+void Parser::Private::parse(QIODevice *device)
+{
+ QTC_ASSERT(device, return);
+ reader.setDevice(device);
+
+ try {
+ while (notAtEnd()) {
+ blockingReadNext();
+ if (reader.name() == QLatin1String("error"))
+ parse_error();
+ else if (reader.name() == QLatin1String("announcethread"))
+ parse_announcethread();
+ else if (reader.name() == QLatin1String("status"))
+ parse_status();
+ else if (reader.name() == QLatin1String("errorcounts"))
+ parse_errorcounts();
+ else if (reader.name() == QLatin1String("suppcounts"))
+ parse_suppcounts();
+ else if (reader.name() == QLatin1String("protocolversion"))
+ checkProtocolVersion(blockingReadElementText());
+ else if (reader.name() == QLatin1String("protocoltool"))
+ checkTool(blockingReadElementText());
+ }
+ } catch (const ParserException &e) {
+ reportInternalError(e.message());
+ } catch (...) {
+ reportInternalError(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
+ "Unexpected exception caught during parsing."));
+ }
+ emit q->finished();
+}
+
+Parser::Parser(QObject *parent)
+ : QObject(parent)
+ , d(new Private(this))
+{
+}
+
+Parser::~Parser()
+{
+ delete d;
+}
+
+QString Parser::errorString() const
+{
+ return d->errorString;
+}
+
+void Parser::parse(QIODevice *device)
+{
+ d->parse(device);
+}
+
+} // namespace XmlParser
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/parser.h b/src/plugins/valgrind/valgrind/xmlprotocol/parser.h
new file mode 100644
index 0000000000..0fed01dad9
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/parser.h
@@ -0,0 +1,91 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_PARSER_H
+#define LIBVALGRIND_PROTOCOL_PARSER_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+class QIODevice;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class AnnounceThread;
+class Error;
+class Status;
+
+/**
+ * Parser for the Valgrind Output XML Protocol 4
+ */
+class Parser : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum Tool {
+ Unknown,
+ Memcheck,
+ Ptrcheck,
+ Helgrind
+ };
+
+ explicit Parser(QObject *parent=0);
+ ~Parser();
+
+ QString errorString() const;
+
+public Q_SLOTS:
+ void parse(QIODevice *stream);
+
+Q_SIGNALS:
+ void status(const Valgrind::XmlProtocol::Status &status);
+ void error(const Valgrind::XmlProtocol::Error &error);
+ void internalError(const QString &errorString);
+ void errorCount(qint64 unique, qint64 count);
+ void suppressionCount(const QString &name, qint64 count);
+ void announceThread(const Valgrind::XmlProtocol::AnnounceThread &announceThread);
+ void finished();
+
+private:
+ class Private;
+ Private *const d;
+};
+
+} // XmlProtocol
+} // Valgrind
+
+#endif //LIBVALGRIND_PROTOCOL_PARSER_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp
new file mode 100644
index 0000000000..8c2de28ff3
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp
@@ -0,0 +1,161 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "stack.h"
+#include "frame.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QString>
+#include <QtCore/QVector>
+
+#include <algorithm>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Stack::Private : public QSharedData
+{
+public:
+ Private()
+ : line(-1)
+ , hthreadid(-1)
+ {
+ }
+
+ QString auxwhat;
+ QString file;
+ QString dir;
+ qint64 line;
+ qint64 hthreadid;
+ QVector<Frame> frames;
+};
+
+Stack::Stack()
+ : d(new Private)
+{
+}
+
+Stack::Stack(const Stack &other)
+ : d(other.d)
+{
+}
+
+Stack::~Stack()
+{
+}
+
+void Stack::swap(Stack &other)
+{
+ qSwap(d, other.d);
+}
+
+Stack &Stack::operator=(const Stack &other)
+{
+ Stack tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool Stack::operator==(const Stack &other) const
+{
+ return d->frames == other.d->frames
+ && d->auxwhat == other.d->auxwhat
+ && d->file == other.d->file
+ && d->dir == other.d->dir
+ && d->line == other.d->line
+ && d->hthreadid == other.d->hthreadid;
+}
+
+QString Stack::auxWhat() const
+{
+ return d->auxwhat;
+}
+
+void Stack::setAuxWhat(const QString &auxwhat)
+{
+ d->auxwhat = auxwhat;
+}
+
+QVector<Frame> Stack::frames() const
+{
+ return d->frames;
+}
+
+void Stack::setFrames(const QVector<Frame> &frames)
+{
+ d->frames = frames;
+}
+
+QString Stack::file() const
+{
+ return d->file;
+}
+
+void Stack::setFile(const QString &file)
+{
+ d->file = file;
+}
+
+QString Stack::directory() const
+{
+ return d->dir;
+}
+
+void Stack::setDirectory(const QString &directory)
+{
+ d->dir = directory;
+}
+
+qint64 Stack::line() const
+{
+ return d->line;
+}
+
+void Stack::setLine(qint64 line)
+{
+ d->line = line;
+}
+
+qint64 Stack::helgrindThreadId() const
+{
+ return d->hthreadid;
+}
+
+void Stack::setHelgrindThreadId(qint64 id)
+{
+ d->hthreadid = id;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/stack.h b/src/plugins/valgrind/valgrind/xmlprotocol/stack.h
new file mode 100644
index 0000000000..72330007f1
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/stack.h
@@ -0,0 +1,87 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_STACK_H
+#define LIBVALGRIND_PROTOCOL_STACK_H
+
+#include <QtCore/QSharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+template <typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Frame;
+
+class Stack
+{
+public:
+ Stack();
+ Stack(const Stack &other);
+ ~Stack();
+ Stack &operator=(const Stack &other);
+ void swap(Stack &other);
+ bool operator==(const Stack &other) const;
+
+ QString auxWhat() const;
+ void setAuxWhat(const QString &auxwhat);
+
+ QVector<Frame> frames() const;
+ void setFrames(const QVector<Frame> &frames);
+
+ //memcheck, ptrcheck, helgrind:
+ QString file() const;
+ void setFile(const QString &file);
+
+ QString directory() const;
+ void setDirectory(const QString &directory);
+
+ qint64 line() const;
+ void setLine(qint64 line);
+
+ //helgrind:
+ qint64 helgrindThreadId() const;
+ void setHelgrindThreadId(qint64 threadId );
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Stack
+
+#endif // LIBVALGRIND_PROTOCOL_STACK_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp
new file mode 100644
index 0000000000..ef20cd940a
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp
@@ -0,0 +1,238 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator Instrumentation Tools
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "stackmodel.h"
+#include "error.h"
+#include "frame.h"
+#include "stack.h"
+#include "modelhelpers.h"
+
+#include <utils/qtcassert.h>
+
+#include <QtCore/QDir>
+#include <QtCore/QVector>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class StackModel::Private
+{
+public:
+ Error error;
+
+ Stack stack(int i) const
+ {
+ if (i < 0 || i >= error.stacks().size())
+ return Stack();
+ else
+ return error.stacks().at(i);
+ }
+};
+
+static QString makeName(const Frame &frame)
+{
+ const QString d = frame.directory();
+ const QString f = frame.file();
+ const QString fn = frame.functionName();
+ if (!fn.isEmpty())
+ return fn;
+ if (!d.isEmpty() && !f.isEmpty())
+ return frame.line() > 0 ? QString::fromLatin1("%1%2%3:%4").arg(d, QDir::separator(), f, QString::number(frame.line()))
+ : QString::fromLatin1("%1%2%3").arg(d, QDir::separator(), f);
+ return frame.object();
+}
+
+StackModel::StackModel(QObject *parent)
+ : QAbstractItemModel(parent)
+ , d(new Private)
+{
+}
+
+StackModel::~StackModel()
+{
+ delete d;
+}
+
+QVariant StackModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ QTC_ASSERT(index.model() == this, return QVariant());
+
+ if (!index.parent().isValid()) {
+ const Stack stack = d->stack(index.row());
+ if (role == Qt::DisplayRole) {
+ switch (index.column()) {
+ case NameColumn:
+ if (!stack.auxWhat().isEmpty())
+ return stack.auxWhat();
+ else
+ return d->error.what();
+ default:
+ return QVariant();
+ }
+ }
+ } else {
+ const Stack stack = d->stack(index.parent().row());
+ const QVector<Frame> frames = stack.frames();
+ const int fidx = index.row();
+ if (fidx < 0 || fidx >= frames.size())
+ return QVariant();
+ const Frame &frame = frames[fidx];
+ switch (role) {
+ case Qt::DisplayRole:
+ {
+ switch (index.column()) {
+ case NameColumn:
+ return makeName(frame);
+ case InstructionPointerColumn:
+ return QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16);
+ case ObjectColumn:
+ return frame.object();
+ case FunctionNameColumn:
+ return frame.functionName();
+ case DirectoryColumn:
+ return frame.directory();
+ case FileColumn:
+ return frame.file();
+ case LineColumn:
+ if (frame.line() > 0)
+ return frame.line();
+ else
+ return QVariant();
+ }
+ break;
+ }
+ case Qt::ToolTipRole:
+ return toolTipForFrame(frame);
+ case ObjectRole:
+ return frame.object();
+ case FunctionNameRole:
+ return frame.functionName();
+ case FileRole:
+ return frame.file();
+ case DirectoryRole:
+ return frame.directory();
+ case LineRole:
+ if (frame.line() > 0)
+ return frame.line();
+ else
+ return QVariant();
+ }
+ }
+
+ return QVariant();
+}
+
+QVariant StackModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+ return QVariant();
+
+ switch (section) {
+ case NameColumn:
+ return tr("Description");
+ case InstructionPointerColumn:
+ return tr("Instruction Pointer");
+ case ObjectColumn:
+ return tr("Object");
+ case FunctionNameColumn:
+ return tr("Function");
+ case DirectoryColumn:
+ return tr("Directory");
+ case FileColumn:
+ return tr("File");
+ case LineColumn:
+ return tr("Line");
+ }
+
+ return QVariant();
+}
+
+QModelIndex StackModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (parent.isValid()) {
+ QTC_ASSERT(parent.model() == this, return QModelIndex());
+ return createIndex(row, column, parent.row());
+ }
+ return createIndex(row, column, -1);
+}
+
+QModelIndex StackModel::parent(const QModelIndex &child) const
+{
+ QTC_ASSERT(!child.isValid() || child.model() == this, return QModelIndex());
+
+ if (child.internalId() == -1)
+ return QModelIndex();
+ return createIndex(child.internalId(), 0, -1);
+}
+
+int StackModel::rowCount(const QModelIndex &parent) const
+{
+ if (!parent.isValid())
+ return d->error.stacks().size();
+
+ QTC_ASSERT(parent.model() == this, return 0);
+
+ const QModelIndex gp = parent.parent();
+
+ if (!gp.isValid())
+ return d->stack(parent.row()).frames().size();
+ return 0;
+}
+
+int StackModel::columnCount(const QModelIndex &parent) const
+{
+ QTC_ASSERT(!parent.isValid() || parent.model() == this, return 0);
+ return ColumnCount;
+}
+
+void StackModel::setError(const Error &error)
+{
+ if (d->error == error)
+ return;
+ d->error = error;
+ reset();
+}
+
+void StackModel::clear()
+{
+ beginResetModel();
+ d->error = Error();
+ endResetModel();
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h
new file mode 100644
index 0000000000..df6574fcd0
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h
@@ -0,0 +1,91 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator Instrumentation Tools
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_STACKMODEL_H
+#define LIBVALGRIND_PROTOCOL_STACKMODEL_H
+
+#include <QtCore/QAbstractItemModel>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Error;
+
+class StackModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ enum Column {
+ NameColumn = 0,
+ FunctionNameColumn,
+ DirectoryColumn,
+ FileColumn,
+ LineColumn,
+ InstructionPointerColumn,
+ ObjectColumn,
+ ColumnCount
+ };
+
+ enum Role {
+ ObjectRole = Qt::UserRole,
+ FunctionNameRole,
+ DirectoryRole,
+ FileRole,
+ LineRole
+ };
+
+ explicit StackModel(QObject *parent = 0);
+ ~StackModel();
+
+ QVariant data(const QModelIndex &index, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &child) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ void clear();
+
+public Q_SLOTS:
+ void setError(const Valgrind::XmlProtocol::Error &error);
+
+private:
+ class Private;
+ Private *const d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_PROTOCOL_STACKMODEL_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/status.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/status.cpp
new file mode 100644
index 0000000000..2991dd3d2f
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/status.cpp
@@ -0,0 +1,107 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "status.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QString>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Status::Private : public QSharedData
+{
+public:
+ Private()
+ : state(Running)
+ {
+ }
+
+ State state;
+ QString time;
+};
+
+Status::Status()
+ : d(new Private)
+{
+}
+
+Status::Status(const Status &other)
+ : d(other.d)
+{
+}
+
+Status::~Status()
+{
+}
+
+void Status::swap(Status &other)
+{
+ qSwap(d, other.d);
+}
+
+Status &Status::operator=(const Status &other)
+{
+ Status tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool Status::operator==(const Status &other) const
+{
+ return d->state == other.d->state && d->time == other.d->time;
+}
+
+void Status::setState(State state)
+{
+ d->state = state;
+}
+
+Status::State Status::state() const
+{
+ return d->state;
+}
+
+void Status::setTime(const QString &time)
+{
+ d->time = time;
+}
+
+QString Status::time() const
+{
+ return d->time;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/status.h b/src/plugins/valgrind/valgrind/xmlprotocol/status.h
new file mode 100644
index 0000000000..1c1089d0e9
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/status.h
@@ -0,0 +1,75 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_STATUS_H
+#define LIBVALGRIND_PROTOCOL_STATUS_H
+
+#include <QtCore/QMetaType>
+#include <QtCore/QSharedDataPointer>
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Status
+{
+public:
+ enum State {
+ Running,
+ Finished
+ };
+
+ Status();
+ Status(const Status &other);
+ ~Status();
+ Status &operator=(const Status &other);
+ void swap(Status &other);
+ bool operator==(const Status &other) const;
+
+ State state() const;
+ void setState(State state);
+
+ QString time() const;
+ void setTime(const QString &time);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+Q_DECLARE_METATYPE(Valgrind::XmlProtocol::Status)
+
+#endif // LIBVALGRIND_PROTOCOL_STATUS_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp
new file mode 100644
index 0000000000..3720c41999
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp
@@ -0,0 +1,243 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "suppression.h"
+
+#include <QtCore/QSharedData>
+#include <QtCore/QString>
+#include <QtCore/QVector>
+#include <QtCore/QTextStream>
+
+#include <algorithm>
+
+using namespace Valgrind;
+using namespace Valgrind::XmlProtocol;
+
+class SuppressionFrame::Private : public QSharedData
+{
+public:
+ Private()
+ {
+ }
+
+ QString obj;
+ QString fun;
+};
+
+SuppressionFrame::SuppressionFrame()
+ : d(new Private)
+{
+}
+
+SuppressionFrame::SuppressionFrame(const SuppressionFrame &other)
+ : d(other.d)
+{
+}
+
+SuppressionFrame::~SuppressionFrame()
+{
+}
+
+void SuppressionFrame::swap(SuppressionFrame &other)
+{
+ qSwap(d, other.d);
+}
+
+SuppressionFrame &SuppressionFrame::operator=(const SuppressionFrame &other)
+{
+ SuppressionFrame tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool SuppressionFrame::operator==(const SuppressionFrame &other) const
+{
+ return d->fun == other.d->fun
+ && d->obj == other.d->obj;
+}
+
+QString SuppressionFrame::function() const
+{
+ return d->fun;
+}
+
+void SuppressionFrame::setFunction(const QString &fun)
+{
+ d->fun = fun;
+}
+
+QString SuppressionFrame::object() const
+{
+ return d->obj;
+}
+
+void SuppressionFrame::setObject(const QString &obj)
+{
+ d->obj = obj;
+}
+
+QString SuppressionFrame::toString() const
+{
+ if (!d->fun.isEmpty()) {
+ return QLatin1String("fun:") + d->fun;
+ } else {
+ return QLatin1String("obj:") + d->obj;
+ }
+}
+
+class Suppression::Private : public QSharedData
+{
+public:
+ Private()
+ : isNull(true)
+ {
+ }
+
+ bool isNull;
+ QString name;
+ QString kind;
+ QString auxkind;
+ QString rawText;
+ SuppressionFrames frames;
+};
+
+Suppression::Suppression()
+ : d(new Private)
+{
+}
+
+Suppression::Suppression(const Suppression &other)
+ : d(other.d)
+{
+}
+
+Suppression::~Suppression()
+{
+}
+
+void Suppression::swap(Suppression &other)
+{
+ qSwap(d, other.d);
+}
+
+Suppression &Suppression::operator=(const Suppression &other)
+{
+ Suppression tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+bool Suppression::operator==(const Suppression &other) const
+{
+ return d->isNull == other.d->isNull
+ && d->name == other.d->name
+ && d->kind == other.d->kind
+ && d->auxkind == other.d->auxkind
+ && d->rawText == other.d->rawText
+ && d->frames == other.d->frames;
+}
+
+bool Suppression::isNull() const
+{
+ return d->isNull;
+}
+void Suppression::setName(const QString &name)
+{
+ d->isNull = false;
+ d->name = name;
+}
+
+QString Suppression::name() const
+{
+ return d->name;
+}
+
+void Suppression::setKind(const QString &kind)
+{
+ d->isNull = false;
+ d->kind = kind;
+}
+
+QString Suppression::kind() const
+{
+ return d->kind;
+}
+
+void Suppression::setAuxKind(const QString &auxkind)
+{
+ d->isNull = false;
+ d->auxkind = auxkind;
+}
+
+QString Suppression::auxKind() const
+{
+ return d->auxkind;
+}
+
+void Suppression::setRawText(const QString &text)
+{
+ d->isNull = false;
+ d->rawText = text;
+}
+
+QString Suppression::rawText() const
+{
+ return d->rawText;
+}
+
+void Suppression::setFrames(const SuppressionFrames &frames)
+{
+ d->isNull = false;
+ d->frames = frames;
+}
+
+SuppressionFrames Suppression::frames() const
+{
+ return d->frames;
+}
+
+QString Suppression::toString() const
+{
+ QString ret;
+ QTextStream stream(&ret);
+ const QLatin1String indent(" ");
+
+ stream << "{\n";
+ stream << indent << d->name << '\n';
+ stream << indent << d->kind << '\n';
+ foreach (const SuppressionFrame &frame, d->frames)
+ stream << indent << frame.toString() << '\n';
+ stream << "}\n";
+ return ret;
+}
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/suppression.h b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.h
new file mode 100644
index 0000000000..82d781ff76
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.h
@@ -0,0 +1,115 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_SUPPRESSION_H
+#define LIBVALGRIND_PROTOCOL_SUPPRESSION_H
+
+#include <QtCore/QSharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+class QString;
+template <typename T> class QVector;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class SuppressionFrame
+{
+public:
+ SuppressionFrame();
+ SuppressionFrame(const SuppressionFrame &other);
+ ~SuppressionFrame();
+ SuppressionFrame &operator=(const SuppressionFrame &other);
+ void swap(SuppressionFrame &other);
+ bool operator==(const SuppressionFrame &other) const;
+ bool operator!=(const SuppressionFrame &other) const
+ {
+ return !operator==(other);
+ }
+
+ QString object() const;
+ void setObject(const QString &object);
+
+ QString function() const;
+ void setFunction(const QString &function);
+
+ QString toString() const;
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+typedef QVector<SuppressionFrame> SuppressionFrames;
+
+class Suppression
+{
+public:
+ Suppression();
+ Suppression(const Suppression &other);
+ ~Suppression();
+ Suppression &operator=(const Suppression &other);
+
+ void swap(Suppression &other);
+ bool operator==(const Suppression &other) const;
+
+ bool isNull() const;
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QString kind() const;
+ void setKind(const QString &kind);
+
+ QString auxKind() const;
+ void setAuxKind(const QString &kind);
+
+ QString rawText() const;
+ void setRawText(const QString &text);
+
+ SuppressionFrames frames() const;
+ void setFrames(const SuppressionFrames &frames);
+
+ QString toString() const;
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+} // namespace XmlProtocol
+} // namespace Valgrind
+
+#endif // LIBVALGRIND_PROTOCOL_SUPPRESSION_H
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp
new file mode 100644
index 0000000000..29968356af
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp
@@ -0,0 +1,156 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "threadedparser.h"
+#include "parser.h"
+#include "error.h"
+#include "frame.h"
+#include "status.h"
+#include "suppression.h"
+#include <utils/qtcassert.h>
+
+#include <QtCore/QMetaType>
+#include <QtCore/QThread>
+#include <QtCore/QSharedPointer>
+
+namespace {
+
+class Thread : public QThread
+{
+public:
+ Thread() : parser(0) , device(0) {}
+
+ void run()
+ {
+ QTC_ASSERT(QThread::currentThread() == this, return);
+ parser->parse(device);
+ delete parser;
+ parser = 0;
+ delete device;
+ device = 0;
+ }
+
+ Valgrind::XmlProtocol::Parser *parser;
+ QIODevice *device;
+};
+
+} // namespace anon
+
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class ThreadedParser::Private
+{
+public:
+ Private()
+ {}
+
+ QWeakPointer<Thread> parserThread;
+ QString errorString;
+};
+
+
+ThreadedParser::ThreadedParser(QObject *parent)
+ : QObject(parent),
+ d(new Private)
+{
+}
+
+ThreadedParser::~ThreadedParser()
+{
+ delete d;
+}
+
+QString ThreadedParser::errorString() const
+{
+ return d->errorString;
+}
+
+bool ThreadedParser::isRunning() const
+{
+ return d->parserThread ? d->parserThread.data()->isRunning() : 0;
+}
+
+void ThreadedParser::parse(QIODevice *device)
+{
+ QTC_ASSERT(!d->parserThread, return);
+
+ Parser *parser = new Parser;
+ qRegisterMetaType<Valgrind::XmlProtocol::Status>();
+ qRegisterMetaType<Valgrind::XmlProtocol::Error>();
+ connect(parser, SIGNAL(status(Valgrind::XmlProtocol::Status)),
+ SIGNAL(status(Valgrind::XmlProtocol::Status)),
+ Qt::QueuedConnection);
+ connect(parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
+ SIGNAL(error(Valgrind::XmlProtocol::Error)),
+ Qt::QueuedConnection);
+ connect(parser, SIGNAL(internalError(QString)),
+ SLOT(slotInternalError(QString)),
+ Qt::QueuedConnection);
+ connect(parser, SIGNAL(errorCount(qint64, qint64)),
+ SIGNAL(errorCount(qint64, qint64)),
+ Qt::QueuedConnection);
+ connect(parser, SIGNAL(suppressionCount(QString, qint64)),
+ SIGNAL(suppressionCount(QString, qint64)),
+ Qt::QueuedConnection);
+ connect(parser, SIGNAL(finished()), SIGNAL(finished()),
+ Qt::QueuedConnection);
+
+
+ Thread *thread = new Thread;
+ d->parserThread = thread;
+ connect(thread, SIGNAL(finished()),
+ thread, SLOT(deleteLater()));
+ device->setParent(0);
+ device->moveToThread(thread);
+ parser->moveToThread(thread);
+ thread->device = device;
+ thread->parser = parser;
+ thread->start();
+}
+
+void ThreadedParser::slotInternalError(const QString &errorString)
+{
+ d->errorString = errorString;
+ emit internalError(errorString);
+}
+
+bool ThreadedParser::waitForFinished()
+{
+ return d->parserThread ? d->parserThread.data()->wait() : true;
+}
+
+} // namespace XmlProtocol
+} // namespace Valgrind
diff --git a/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h
new file mode 100644
index 0000000000..49d6d11509
--- /dev/null
+++ b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h
@@ -0,0 +1,91 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef LIBVALGRIND_PROTOCOL_THREADEDPARSER_H
+#define LIBVALGRIND_PROTOCOL_THREADEDPARSER_H
+
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+class QIODevice;
+QT_END_NAMESPACE
+
+namespace Valgrind {
+namespace XmlProtocol {
+
+class Error;
+class Status;
+
+/**
+ * ThreadedParser for the Valgrind Output XmlProtocol 4
+ */
+class ThreadedParser : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit ThreadedParser(QObject *parent = 0);
+ ~ThreadedParser();
+
+ QString errorString() const;
+
+ /// interface additions relative to Parser because Parser is synchronous and this
+ /// class parses asynchronously in a non-public secondary thread.
+ bool waitForFinished();
+ bool isRunning() const;
+
+public Q_SLOTS:
+ ///@warning will move @p stream to a different thread and take ownership of it
+ void parse(QIODevice *stream);
+
+private Q_SLOTS:
+ void slotInternalError(const QString &errorString);
+
+Q_SIGNALS:
+ void status(const Valgrind::XmlProtocol::Status &status);
+ void error(const Valgrind::XmlProtocol::Error &error);
+ void internalError(const QString &errorString);
+ void errorCount(qint64 unique, qint64 count);
+ void suppressionCount(const QString &name, qint64 count);
+ void finished();
+
+private:
+ class Private;
+ Private *const d;
+};
+
+} // XmlProtocol
+} // Valgrind
+
+#endif //LIBVALGRIND_PROTOCOL_THREADEDPARSER_H
diff --git a/src/plugins/valgrind/valgrind_dependencies.pri b/src/plugins/valgrind/valgrind_dependencies.pri
index 04786e9e89..b6b5ec7ed6 100644
--- a/src/plugins/valgrind/valgrind_dependencies.pri
+++ b/src/plugins/valgrind/valgrind_dependencies.pri
@@ -2,3 +2,4 @@ include(../../libs/cplusplus/cplusplus.pri)
include(../../plugins/analyzerbase/analyzerbase.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
+include(../../libs/utils/utils.pri)
diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp
index e4cddcfd89..3b7279d6fc 100644
--- a/src/plugins/valgrind/valgrindengine.cpp
+++ b/src/plugins/valgrind/valgrindengine.cpp
@@ -52,9 +52,9 @@ using namespace Analyzer;
using namespace Valgrind::Internal;
using namespace Utils;
-ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration)
- : IAnalyzerEngine(sp, runConfiguration),
+ValgrindEngine::ValgrindEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration)
+ : IAnalyzerEngine(tool, sp, runConfiguration),
m_settings(0),
m_progress(new QFutureInterface<void>()),
m_progressWatcher(new QFutureWatcher<void>()),
@@ -130,7 +130,7 @@ QString ValgrindEngine::executable() const
void ValgrindEngine::handleProgressCanceled()
{
- AnalyzerManager::instance()->stopTool();
+ AnalyzerManager::stopTool();
}
void ValgrindEngine::handleProgressFinished()
diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h
index 2a790a59ed..72901fe648 100644
--- a/src/plugins/valgrind/valgrindengine.h
+++ b/src/plugins/valgrind/valgrindengine.h
@@ -35,9 +35,6 @@
#ifndef VALGRINDENGINE_H
#define VALGRINDENGINE_H
-#include "valgrind_global.h"
-
-#include <analyzerbase/ianalyzerengine.h>
#include <analyzerbase/ianalyzerengine.h>
#include <utils/environment.h>
@@ -56,13 +53,15 @@ class AnalyzerSettings;
namespace Valgrind {
namespace Internal {
-class VALGRINDTOOLBASE_EXPORT ValgrindEngine : public Analyzer::IAnalyzerEngine
+class ValgrindEngine : public Analyzer::IAnalyzerEngine
{
Q_OBJECT
+
public:
- explicit ValgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
- ProjectExplorer::RunConfiguration *runConfiguration);
- virtual ~ValgrindEngine();
+ ValgrindEngine(Analyzer::IAnalyzerTool *tool,
+ const Analyzer::AnalyzerStartParameters &sp,
+ ProjectExplorer::RunConfiguration *runConfiguration);
+ ~ValgrindEngine();
void start();
void stop();
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index e9f13d0265..86ac42e97f 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -33,21 +33,171 @@
**************************************************************************/
#include "valgrindplugin.h"
-#include "valgrindsettings.h"
-#include "callgrindtool.h"
+
#include "callgrindsettings.h"
-#include "memchecktool.h"
+#include "callgrindtool.h"
#include "memchecksettings.h"
+#include "memchecktool.h"
+#include "valgrindsettings.h"
-#include <analyzerbase/analyzersettings.h>
+#include <analyzerbase/analyzerconstants.h>
#include <analyzerbase/analyzermanager.h>
+#include <analyzerbase/analyzerrunconfigwidget.h>
+#include <analyzerbase/analyzerruncontrol.h>
+#include <analyzerbase/analyzersettings.h>
+#include <analyzerbase/analyzerstartparameters.h>
+#include <analyzerbase/startremotedialog.h>
+
+#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+
+#include <remotelinux/linuxdeviceconfiguration.h>
+#include <remotelinux/remotelinuxrunconfiguration.h>
+#include <utils/qtcassert.h>
+
+#include <QtCore/QDebug>
#include <QtCore/QStringList>
#include <QtCore/QtPlugin>
+#include <QtGui/QAction>
using namespace Analyzer;
using namespace Valgrind::Internal;
+using namespace ProjectExplorer;
+
+/////////////////////////////////////////////////////////////////////////////////
+//
+// ValgrindRunControlFactory
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+namespace Valgrind {
+namespace Internal {
+class ValgrindRunControlFactory : public ProjectExplorer::IRunControlFactory
+{
+ Q_OBJECT
+
+public:
+ ValgrindRunControlFactory(QObject *parent = 0);
+
+ // IRunControlFactory
+ bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
+ RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
+ QString displayName() const;
+
+ IRunConfigurationAspect *createRunConfigurationAspect();
+ RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
+};
+
+ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent)
+ : IRunControlFactory(parent)
+{
+ setObjectName(QLatin1String("ValgrindRunControlFactory"));
+}
+
+bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
+{
+ Q_UNUSED(runConfiguration);
+ return mode.startsWith("Callgrind") || mode.startsWith("Memcheck");
+}
+
+RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
+{
+ QTC_ASSERT(canRun(runConfiguration, mode), return 0);
+
+ AnalyzerStartParameters sp;
+ if (LocalApplicationRunConfiguration *rc1 =
+ qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
+ sp.startMode = StartLocal;
+ sp.environment = rc1->environment();
+ sp.workingDirectory = rc1->workingDirectory();
+ sp.debuggee = rc1->executable();
+ sp.debuggeeArgs = rc1->commandLineArguments();
+ sp.displayName = rc1->displayName();
+ sp.connParams.host = QLatin1String("localhost");
+ sp.connParams.port = rc1->qmlDebugServerPort();
+ } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc2 =
+ qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
+ sp.startMode = StartRemote;
+ sp.debuggee = rc2->remoteExecutableFilePath();
+ sp.debuggeeArgs = rc2->arguments();
+ sp.connParams = rc2->deviceConfig()->sshParameters();
+ sp.analyzerCmdPrefix = rc2->commandPrefix();
+ sp.displayName = rc2->displayName();
+ } else {
+ // Might be S60DeviceRunfiguration, or something else ...
+ //sp.startMode = StartRemote;
+ sp.startMode = StartRemote;
+ }
+
+ IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
+ AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
+ QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
+ return rc;
+}
+
+QString ValgrindRunControlFactory::displayName() const
+{
+ return tr("Analyzer");
+}
+
+IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect()
+{
+ return new AnalyzerProjectSettings;
+}
+
+RunConfigWidget *ValgrindRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
+{
+ LocalApplicationRunConfiguration *localRc =
+ qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
+ if (!localRc)
+ return 0;
+ AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
+ if (!settings)
+ return 0;
+
+ AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
+ ret->setRunConfiguration(runConfiguration);
+ return ret;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+//
+// ValgrindPlugin
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
+{
+ Q_UNUSED(tool);
+ StartRemoteDialog dlg;
+ if (dlg.exec() != QDialog::Accepted)
+ return;
+
+ AnalyzerStartParameters sp;
+ sp.toolId = tool->id();
+ sp.startMode = mode;
+ sp.connParams = dlg.sshParams();
+ sp.debuggee = dlg.executable();
+ sp.debuggeeArgs = dlg.arguments();
+ sp.displayName = dlg.executable();
+ sp.workingDirectory = dlg.workingDirectory();
+
+ AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
+ //m_currentRunControl = rc;
+ QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
+
+ ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id());
+}
+
+void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
+{
+ if (mode == StartLocal)
+ AnalyzerManager::startLocalTool(tool, mode);
+ if (mode == StartRemote)
+ startRemoteTool(tool, mode);
+}
static AbstractAnalyzerSubConfig *valgrindConfigFactory()
{
@@ -80,14 +230,25 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalCallgrindFactory, &projectCallgrindFactory);
AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalMemcheckFactory, &projectMemcheckFactory);
- AnalyzerManager::instance()->addTool(new MemcheckTool(this));
- AnalyzerManager::instance()->addTool(new CallgrindTool(this));
+ StartModes modes;
+#ifndef Q_OS_WIN
+ modes.append(StartMode(StartLocal));
+#endif
+ modes.append(StartMode(StartRemote));
+
+ AnalyzerManager::addTool(new MemcheckTool(this), modes);
+ AnalyzerManager::addTool(new CallgrindTool(this), modes);
+
+ ValgrindRunControlFactory *factory = new ValgrindRunControlFactory();
+ addAutoReleasedObject(factory);
+
return true;
}
+} // namespace Internal
+} // namespace Valgrind
-void ValgrindPlugin::extensionsInitialized()
-{
-}
Q_EXPORT_PLUGIN(Valgrind::Internal::ValgrindPlugin)
+
+#include "valgrindplugin.moc"
diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h
index 6dee7dd544..9598572bd3 100644
--- a/src/plugins/valgrind/valgrindplugin.h
+++ b/src/plugins/valgrind/valgrindplugin.h
@@ -36,6 +36,7 @@
#define VALGRINDTOOLBASEPLUGIN_H
#include <extensionsystem/iplugin.h>
+#include <analyzerbase/ianalyzertool.h>
namespace Valgrind {
namespace Internal {
@@ -48,7 +49,9 @@ public:
ValgrindPlugin() {}
virtual bool initialize(const QStringList &arguments, QString *errorString);
- virtual void extensionsInitialized();
+ virtual void extensionsInitialized() {}
+
+ static void startValgrindTool(Analyzer::IAnalyzerTool *tool, Analyzer::StartMode mode);
};
} // namespace Internal
diff --git a/src/plugins/valgrind/valgrindsettings.h b/src/plugins/valgrind/valgrindsettings.h
index c01fc74595..0e4b5dfe38 100644
--- a/src/plugins/valgrind/valgrindsettings.h
+++ b/src/plugins/valgrind/valgrindsettings.h
@@ -35,8 +35,6 @@
#ifndef ANALYZER_INTERNAL_VALGRINDSETTINGS_H
#define ANALYZER_INTERNAL_VALGRINDSETTINGS_H
-#include "valgrind_global.h"
-
#include <analyzerbase/analyzersettings.h>
#include <QtCore/QObject>
@@ -48,7 +46,7 @@ namespace Internal {
/**
* Generic Valgrind settings shared by all tools.
*/
-class VALGRINDTOOLBASE_EXPORT ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
+class ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
{
Q_OBJECT
public:
diff --git a/src/plugins/welcome/images/center_frame_header.png b/src/plugins/welcome/images/center_frame_header.png
index 4d840b48f9..ce88366718 100644
--- a/src/plugins/welcome/images/center_frame_header.png
+++ b/src/plugins/welcome/images/center_frame_header.png
Binary files differ
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index 2c6e2b6e6e..0196bda808 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -97,6 +97,8 @@ public:
void initPlugins();
int activePlugin() const { return m_activePlugin; }
+ Q_SCRIPTABLE QString platform() const;
+
public slots:
void sendFeedback();
void newProject();
@@ -182,6 +184,7 @@ void WelcomeMode::initPlugins()
QDeclarativeEngine *engine = m_welcomePage->engine();
engine->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory);
+ engine->addImportPath(Core::ICore::instance()->resourcePath() + "/welcomescreen");
foreach (Utils::IWelcomePage *plugin, plugins) {
plugin->facilitateQml(engine);
m_pluginList.append(plugin);
@@ -194,6 +197,21 @@ void WelcomeMode::initPlugins()
QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + "/welcomescreen/welcomescreen.qml"));
}
+QString WelcomeMode::platform() const
+{
+#if defined(Q_OS_WIN)
+ return QLatin1String("windows");
+#elif defined(Q_OS_MAC)
+ return QLatin1String("mac");
+#elif defined(Q_OS_LINUX)
+ return QLatin1String("linux");
+#elif defined(Q_OS_UNIX)
+ return QLatin1String("unix");
+#else
+ return QLatin1String("other")
+#endif
+}
+
void WelcomeMode::welcomePluginAdded(QObject *obj)
{
if (Utils::IWelcomePage *plugin = qobject_cast<Utils::IWelcomePage*>(obj)) {