summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/android/androiddev.qdoc2
-rw-r--r--doc/src/howto/creator-vcs.qdoc40
-rw-r--r--doc/src/qnx/creator-developing-bb10.qdoc4
-rw-r--r--qtcreator.pri16
-rw-r--r--qtcreator.qbs4
-rw-r--r--share/qtcreator/debugger/dumper.py30
-rw-r--r--share/qtcreator/debugger/gdbbridge.py32
-rw-r--r--share/qtcreator/debugger/qttypes.py11
-rw-r--r--share/qtcreator/debugger/stdtypes.py203
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp5
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri1
-rw-r--r--share/qtcreator/qml/qmlpuppet/types/enumeration.cpp122
-rw-r--r--share/qtcreator/qml/qmlpuppet/types/enumeration.h (renamed from src/plugins/debugger/lldblib/lldbenginehost.h)81
-rw-r--r--share/qtcreator/qml/qmlpuppet/types/types.pri5
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml6
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml1
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml1
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml1
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml1
-rw-r--r--share/qtcreator/templates/qml/qtquick_1_1/template.xml5
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_0/template.xml5
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_1/main.qml17
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_1/main.qmlproject21
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_1/template.xml6
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_2/main.qml17
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_2/main.qmlproject21
-rw-r--r--share/qtcreator/templates/qml/qtquick_2_2/template.xml6
-rw-r--r--share/qtcreator/templates/qml/qtquickcontrols_1_0/template.xml5
-rw-r--r--share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qml25
-rw-r--r--share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qmlproject21
-rw-r--r--share/qtcreator/templates/qml/qtquickcontrols_1_1/template.xml6
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/app.pro2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_1_1/template.xml2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/app.pro2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_0/template.xml2
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/app.pro22
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp13
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/qml/app/main.qml16
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_1/template.xml9
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/app.pro22
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp13
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/qml/app/main.qml16
-rw-r--r--share/qtcreator/templates/qtquick/qtquick_2_2/template.xml9
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro2
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml2
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro22
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp12
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml/app/main.qml23
-rw-r--r--share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml9
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.cpp (renamed from share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.h (renamed from share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.pri (renamed from share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.cpp (renamed from share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.h (renamed from share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri (renamed from share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp (renamed from share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h (renamed from share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h)0
-rw-r--r--share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri (renamed from share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri)0
-rw-r--r--src/libs/3rdparty/cplusplus/Control.cpp5
-rw-r--r--src/libs/3rdparty/cplusplus/Control.h1
-rw-r--r--src/libs/3rdparty/cplusplus/Lexer.cpp19
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.h1
-rw-r--r--src/libs/qmljs/qmljsconstants.h2
-rw-r--r--src/libs/qtcreatorcdbext/containers.cpp32
-rw-r--r--src/libs/qtcreatorcdbext/knowntype.h4
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupnode.cpp16
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupvalue.cpp254
-rw-r--r--src/libs/utils/detailswidget.cpp17
-rw-r--r--src/libs/utils/detailswidget.h1
-rw-r--r--src/libs/utils/execmenu.cpp71
-rw-r--r--src/libs/utils/execmenu.h (renamed from src/plugins/qmlprofiler/canvas/qmlprofilercanvas.h)49
-rw-r--r--src/libs/utils/fancylineedit.cpp32
-rw-r--r--src/libs/utils/textfileformat.cpp33
-rw-r--r--src/libs/utils/textfileformat.h2
-rw-r--r--src/libs/utils/utils-lib.pri6
-rw-r--r--src/libs/utils/utils.qbs2
-rw-r--r--src/plugins/analyzerbase/analyzerrunconfigwidget.cpp4
-rw-r--r--src/plugins/android/androidconfigurations.cpp84
-rw-r--r--src/plugins/android/androidconfigurations.h8
-rw-r--r--src/plugins/android/androiddeployqtstep.cpp4
-rw-r--r--src/plugins/android/androiddeployqtwidget.ui4
-rw-r--r--src/plugins/android/androiddeploystep.cpp5
-rw-r--r--src/plugins/android/androidmanager.cpp2
-rw-r--r--src/plugins/android/androidmanifesteditorfactory.cpp6
-rw-r--r--src/plugins/android/androidmanifesteditorfactory.h5
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp9
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.h4
-rw-r--r--src/plugins/android/androidpotentialkit.cpp3
-rw-r--r--src/plugins/android/androidruncontrol.cpp2
-rw-r--r--src/plugins/android/androidrunner.cpp4
-rw-r--r--src/plugins/android/androidsettingspage.cpp13
-rw-r--r--src/plugins/android/androidsettingspage.h8
-rw-r--r--src/plugins/android/androidsettingswidget.cpp18
-rw-r--r--src/plugins/android/androidsettingswidget.h3
-rw-r--r--src/plugins/android/androidsettingswidget.ui4
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.cpp8
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.h1
-rw-r--r--src/plugins/bazaar/bazaar.pro9
-rw-r--r--src/plugins/bazaar/bazaar.qbs3
-rw-r--r--src/plugins/bazaar/bazaarclient.cpp19
-rw-r--r--src/plugins/bazaar/bazaarclient.h3
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp18
-rw-r--r--src/plugins/bazaar/bazaarplugin.h1
-rw-r--r--src/plugins/bazaar/constants.h1
-rw-r--r--src/plugins/bazaar/optionspage.cpp30
-rw-r--r--src/plugins/bazaar/optionspage.h5
-rw-r--r--src/plugins/bazaar/uncommitdialog.cpp83
-rw-r--r--src/plugins/bazaar/uncommitdialog.h62
-rw-r--r--src/plugins/bazaar/uncommitdialog.ui104
-rw-r--r--src/plugins/classview/classview.pro28
-rw-r--r--src/plugins/classview/classview.qbs32
-rw-r--r--src/plugins/clearcase/clearcasecontrol.cpp25
-rw-r--r--src/plugins/clearcase/clearcasecontrol.h2
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp373
-rw-r--r--src/plugins/clearcase/clearcaseplugin.h28
-rw-r--r--src/plugins/clearcase/clearcasesync.cpp365
-rw-r--r--src/plugins/clearcase/clearcasesync.h26
-rw-r--r--src/plugins/clearcase/settingspage.cpp32
-rw-r--r--src/plugins/clearcase/settingspage.h10
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp10
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.h4
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp5
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditorfactory.h3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp8
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.h1
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp29
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.h10
-rw-r--r--src/plugins/coreplugin/actionmanager/actionmanager.cpp2
-rw-r--r--src/plugins/coreplugin/actionmanager/commandmappings.cpp72
-rw-r--r--src/plugins/coreplugin/actionmanager/commandmappings.h4
-rw-r--r--src/plugins/coreplugin/coreplugin.h6
-rw-r--r--src/plugins/coreplugin/dialogs/ioptionspage.cpp61
-rw-r--r--src/plugins/coreplugin/dialogs/ioptionspage.h12
-rw-r--r--src/plugins/coreplugin/dialogs/newdialog.cpp2
-rw-r--r--src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp26
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp37
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.h1
-rw-r--r--src/plugins/coreplugin/dialogs/shortcutsettings.cpp15
-rw-r--r--src/plugins/coreplugin/dialogs/shortcutsettings.h4
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp5
-rw-r--r--src/plugins/coreplugin/documentmanager.h4
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp11
-rw-r--r--src/plugins/coreplugin/editormanager/systemeditor.cpp2
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp6
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp110
-rw-r--r--src/plugins/coreplugin/generalsettings.h4
-rw-r--r--src/plugins/coreplugin/idocument.h6
-rw-r--r--src/plugins/coreplugin/iversioncontrol.cpp57
-rw-r--r--src/plugins/coreplugin/iversioncontrol.h56
-rw-r--r--src/plugins/coreplugin/mimetypesettings.cpp19
-rw-r--r--src/plugins/coreplugin/mimetypesettings.h3
-rw-r--r--src/plugins/coreplugin/toolsettings.cpp16
-rw-r--r--src/plugins/coreplugin/toolsettings.h4
-rw-r--r--src/plugins/coreplugin/vcsmanager.cpp212
-rw-r--r--src/plugins/coreplugin/vcsmanager.h8
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp2
-rw-r--r--src/plugins/cpaster/fileshareprotocolsettingspage.cpp8
-rw-r--r--src/plugins/cpaster/fileshareprotocolsettingspage.h2
-rw-r--r--src/plugins/cpaster/settingspage.cpp16
-rw-r--r--src/plugins/cpaster/settingspage.h4
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.cpp2302
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.h129
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.ui381
-rw-r--r--src/plugins/cppeditor/cppdoxygen_test.cpp14
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp11
-rw-r--r--src/plugins/cppeditor/cppeditor.pro64
-rw-r--r--src/plugins/cppeditor/cppeditor.qbs81
-rw-r--r--src/plugins/cppeditor/cppeditorconstants.h1
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.cpp39
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.h10
-rw-r--r--src/plugins/cppeditor/cppelementevaluator.cpp2
-rw-r--r--src/plugins/cppeditor/cppfollowsymbolundercursor.cpp11
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.cpp6
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy_test.cpp20
-rw-r--r--src/plugins/cppeditor/cppquickfix_test.cpp20
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.cpp2
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp14
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp224
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionassistprovider.h15
-rw-r--r--src/plugins/cppeditor/fileandtokenactions_test.cpp3
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp22
-rw-r--r--src/plugins/cpptools/completionsettingspage.cpp111
-rw-r--r--src/plugins/cpptools/completionsettingspage.h7
-rw-r--r--src/plugins/cpptools/completionsettingspage.ui12
-rw-r--r--src/plugins/cpptools/cppcodemodelsettings.h2
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.cpp31
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.h8
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.cpp67
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.h8
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp2
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.cpp30
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.h8
-rw-r--r--src/plugins/cpptools/cpplocatorfilter_test.cpp2
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp38
-rw-r--r--src/plugins/cpptools/cppmodelmanager.h1
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp73
-rw-r--r--src/plugins/cpptools/cppmodelmanagerinterface.cpp11
-rw-r--r--src/plugins/cpptools/cppmodelmanagerinterface.h4
-rw-r--r--src/plugins/cpptools/cppsnapshotupdater.cpp3
-rw-r--r--src/plugins/cpptools/cpptools.pro183
-rw-r--r--src/plugins/cpptools/cpptools.qbs159
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp10
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.h3
-rw-r--r--src/plugins/cpptools/functionutils.cpp321
-rw-r--r--src/plugins/cpptools/functionutils.h (renamed from src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp)73
-rw-r--r--src/plugins/cpptools/modelmanagertesthelper.cpp7
-rw-r--r--src/plugins/cpptools/modelmanagertesthelper.h4
-rw-r--r--src/plugins/cpptools/symbolsearcher_test.cpp4
-rw-r--r--src/plugins/cpptools/typehierarchybuilder.h3
-rw-r--r--src/plugins/cpptools/typehierarchybuilder_test.cpp7
-rw-r--r--src/plugins/cvs/checkoutwizard.cpp2
-rw-r--r--src/plugins/cvs/cvs.pro2
-rw-r--r--src/plugins/cvs/cvs.qbs2
-rw-r--r--src/plugins/cvs/cvsclient.cpp182
-rw-r--r--src/plugins/cvs/cvsclient.h (renamed from src/plugins/debugger/lldblib/lldboptionspage.h)58
-rw-r--r--src/plugins/cvs/cvscontrol.cpp5
-rw-r--r--src/plugins/cvs/cvscontrol.h2
-rw-r--r--src/plugins/cvs/cvsplugin.cpp172
-rw-r--r--src/plugins/cvs/cvsplugin.h6
-rw-r--r--src/plugins/cvs/cvssettings.cpp83
-rw-r--r--src/plugins/cvs/cvssettings.h38
-rw-r--r--src/plugins/cvs/settingspage.cpp58
-rw-r--r--src/plugins/cvs/settingspage.h12
-rw-r--r--src/plugins/debugger/breakwindow.cpp1
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp8
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h1
-rw-r--r--src/plugins/debugger/cdb/cdboptionspage.cpp52
-rw-r--r--src/plugins/debugger/cdb/cdboptionspage.h10
-rw-r--r--src/plugins/debugger/commonoptionspage.cpp100
-rw-r--r--src/plugins/debugger/commonoptionspage.h10
-rw-r--r--src/plugins/debugger/debugger.pro1
-rw-r--r--src/plugins/debugger/debugger.qbs20
-rw-r--r--src/plugins/debugger/debuggerconstants.h2
-rw-r--r--src/plugins/debugger/debuggerdialogs.cpp1
-rw-r--r--src/plugins/debugger/debuggerengine.cpp2
-rw-r--r--src/plugins/debugger/debuggeritem.cpp8
-rw-r--r--src/plugins/debugger/debuggeritem.h4
-rw-r--r--src/plugins/debugger/debuggeroptionspage.cpp119
-rw-r--r--src/plugins/debugger/debuggeroptionspage.h7
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp8
-rw-r--r--src/plugins/debugger/debuggerrunner.cpp5
-rw-r--r--src/plugins/debugger/debuggersourcepathmappingwidget.cpp1
-rw-r--r--src/plugins/debugger/disassembleragent.cpp10
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.cpp65
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.h6
-rw-r--r--src/plugins/debugger/lldblib/guest/README31
-rw-r--r--src/plugins/debugger/lldblib/guest/lldbengineguest.cpp761
-rw-r--r--src/plugins/debugger/lldblib/guest/lldbengineguest.h136
-rw-r--r--src/plugins/debugger/lldblib/guest/main.cpp151
-rw-r--r--src/plugins/debugger/lldblib/guest/qtcreator-lldb.plist21
-rw-r--r--src/plugins/debugger/lldblib/guest/qtcreator-lldb.pri2
-rw-r--r--src/plugins/debugger/lldblib/guest/qtcreator-lldb.pro61
-rw-r--r--src/plugins/debugger/lldblib/ipcengineguest.cpp637
-rw-r--r--src/plugins/debugger/lldblib/ipcengineguest.h191
-rw-r--r--src/plugins/debugger/lldblib/ipcenginehost.cpp661
-rw-r--r--src/plugins/debugger/lldblib/ipcenginehost.h140
-rw-r--r--src/plugins/debugger/lldblib/lldbenginehost.cpp232
-rw-r--r--src/plugins/debugger/lldblib/lldbhost.pri20
-rw-r--r--src/plugins/debugger/lldblib/lldboptionspage.cpp109
-rw-r--r--src/plugins/debugger/lldblib/lldboptionspagewidget.ui59
-rw-r--r--src/plugins/debugger/loadcoredialog.cpp3
-rw-r--r--src/plugins/debugger/localsandexpressionsoptionspage.ui4
-rw-r--r--src/plugins/debugger/qml/qmllivetextpreview.cpp4
-rw-r--r--src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp1
-rw-r--r--src/plugins/debugger/sourceagent.cpp4
-rw-r--r--src/plugins/debugger/watchhandler.cpp6
-rw-r--r--src/plugins/designer/cpp/cppsettingspage.cpp28
-rw-r--r--src/plugins/designer/cpp/cppsettingspage.h6
-rw-r--r--src/plugins/designer/formwindoweditor.h1
-rw-r--r--src/plugins/designer/gotoslot_test.cpp13
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp2
-rw-r--r--src/plugins/designer/settingspage.cpp48
-rw-r--r--src/plugins/designer/settingspage.h7
-rw-r--r--src/plugins/fakevim/fakevim_test.cpp13
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp77
-rw-r--r--src/plugins/fakevim/fakevimhandler.h1
-rw-r--r--src/plugins/fakevim/fakevimoptions.ui4
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp240
-rw-r--r--src/plugins/genericprojectmanager/filesselectionwizardpage.cpp7
-rw-r--r--src/plugins/genericprojectmanager/filesselectionwizardpage.h7
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp8
-rw-r--r--src/plugins/genericprojectmanager/genericproject.h4
-rw-r--r--src/plugins/genericprojectmanager/genericprojectfileseditor.cpp25
-rw-r--r--src/plugins/genericprojectmanager/genericprojectfileseditor.h14
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.pro2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.qbs2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectnodes.cpp1
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin.cpp11
-rw-r--r--src/plugins/git/branchdialog.cpp15
-rw-r--r--src/plugins/git/gerrit/gerritdialog.cpp1
-rw-r--r--src/plugins/git/gerrit/gerritoptionspage.cpp17
-rw-r--r--src/plugins/git/gerrit/gerritoptionspage.h5
-rw-r--r--src/plugins/git/gerrit/gerritpushdialog.cpp19
-rw-r--r--src/plugins/git/git.qrc1
-rw-r--r--src/plugins/git/gitclient.cpp153
-rw-r--r--src/plugins/git/gitclient.h21
-rw-r--r--src/plugins/git/giteditor.cpp4
-rw-r--r--src/plugins/git/gitplugin.cpp57
-rw-r--r--src/plugins/git/gitplugin.h1
-rw-r--r--src/plugins/git/gitsubmiteditorwidget.cpp2
-rw-r--r--src/plugins/git/images/arrowup.pngbin0 -> 376 bytes
-rw-r--r--src/plugins/git/logchangedialog.cpp65
-rw-r--r--src/plugins/git/logchangedialog.h31
-rw-r--r--src/plugins/git/settingspage.cpp34
-rw-r--r--src/plugins/git/settingspage.h14
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp4
-rw-r--r--src/plugins/glsleditor/glsleditorfactory.cpp9
-rw-r--r--src/plugins/glsleditor/glsleditorplugin.cpp18
-rw-r--r--src/plugins/glsleditor/glsleditorplugin.h2
-rw-r--r--src/plugins/help/docsettingspage.cpp35
-rw-r--r--src/plugins/help/docsettingspage.h9
-rw-r--r--src/plugins/help/filtersettingspage.cpp45
-rw-r--r--src/plugins/help/filtersettingspage.h7
-rw-r--r--src/plugins/help/generalsettingspage.cpp91
-rw-r--r--src/plugins/help/generalsettingspage.h7
-rw-r--r--src/plugins/ios/iosdeploystep.h20
-rw-r--r--src/plugins/ios/iossettingspage.cpp13
-rw-r--r--src/plugins/ios/iossettingspage.h8
-rw-r--r--src/plugins/ios/iossettingswidget.cpp8
-rw-r--r--src/plugins/ios/iossettingswidget.h3
-rw-r--r--src/plugins/locator/settingspage.cpp59
-rw-r--r--src/plugins/locator/settingspage.h11
-rw-r--r--src/plugins/macros/macrooptionspage.cpp7
-rw-r--r--src/plugins/macros/macrooptionspage.h6
-rw-r--r--src/plugins/mercurial/optionspage.cpp28
-rw-r--r--src/plugins/mercurial/optionspage.h7
-rw-r--r--src/plugins/perforce/perforceversioncontrol.cpp3
-rw-r--r--src/plugins/perforce/perforceversioncontrol.h2
-rw-r--r--src/plugins/perforce/settingspage.cpp15
-rw-r--r--src/plugins/perforce/settingspage.h10
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp8
-rw-r--r--src/plugins/projectexplorer/appoutputpane.h6
-rw-r--r--src/plugins/projectexplorer/clangparser.h2
-rw-r--r--src/plugins/projectexplorer/customtoolchain.cpp2
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardpage.cpp2
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardparameters.cpp1
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardparameters.h1
-rw-r--r--src/plugins/projectexplorer/devicesupport/deviceapplicationrunner.cpp4
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp13
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicesettingspage.h8
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicesettingswidget.h2
-rw-r--r--src/plugins/projectexplorer/gccparser.h2
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp1
-rw-r--r--src/plugins/projectexplorer/importwidget.cpp1
-rw-r--r--src/plugins/projectexplorer/kit.cpp18
-rw-r--r--src/plugins/projectexplorer/kit.h2
-rw-r--r--src/plugins/projectexplorer/kitinformationconfigwidget.cpp1
-rw-r--r--src/plugins/projectexplorer/kitoptionspage.cpp136
-rw-r--r--src/plugins/projectexplorer/kitoptionspage.h7
-rw-r--r--src/plugins/projectexplorer/msvcparser.h2
-rw-r--r--src/plugins/projectexplorer/osparser.h2
-rw-r--r--src/plugins/projectexplorer/processstep.cpp1
-rw-r--r--src/plugins/projectexplorer/project.cpp12
-rw-r--r--src/plugins/projectexplorer/project.h3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp40
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h1
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro6
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs3
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h7
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.cpp46
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.h7
-rw-r--r--src/plugins/projectexplorer/projectnodes.h3
-rw-r--r--src/plugins/projectexplorer/selectablefilesmodel.cpp (renamed from src/plugins/genericprojectmanager/selectablefilesmodel.cpp)160
-rw-r--r--src/plugins/projectexplorer/selectablefilesmodel.h (renamed from src/plugins/genericprojectmanager/selectablefilesmodel.h)53
-rw-r--r--src/plugins/projectexplorer/targetselector.cpp4
-rw-r--r--src/plugins/projectexplorer/targetselector.h2
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp8
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.cpp4
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.h2
-rw-r--r--src/plugins/projectexplorer/targetsetuppage.cpp8
-rw-r--r--src/plugins/projectexplorer/targetsetupwidget.cpp1
-rw-r--r--src/plugins/projectexplorer/task.cpp20
-rw-r--r--src/plugins/projectexplorer/task.h4
-rw-r--r--src/plugins/projectexplorer/taskhub.cpp18
-rw-r--r--src/plugins/projectexplorer/taskhub.h2
-rw-r--r--src/plugins/projectexplorer/taskmodel.cpp2
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp6
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.cpp161
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.h7
-rw-r--r--src/plugins/pythoneditor/pythoneditor.cpp2
-rw-r--r--src/plugins/pythoneditor/pythoneditorfactory.cpp8
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp15
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.h4
-rw-r--r--src/plugins/pythoneditor/pythoneditorwidget.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstep.cpp29
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstep.h3
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui7
-rw-r--r--src/plugins/qbsprojectmanager/qbsinstallstep.cpp1
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp20
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.h4
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.pro4
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.qbs4
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp1
-rw-r--r--src/plugins/qbsprojectmanager/qbsstep.cpp242
-rw-r--r--src/plugins/qbsprojectmanager/qbsstep.h108
-rw-r--r--src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp3
-rw-r--r--src/plugins/qmakeprojectmanager/makestep.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.cpp11
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.h10
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditorfactory.cpp11
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditorfactory.h5
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparser.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparser.h6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp8
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.h1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp7
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h2
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp18
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtquickapp.h4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp13
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.h2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp8
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp11
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h5
-rw-r--r--src/plugins/qmldesigner/designercore/designercore-lib.pri1
-rw-r--r--src/plugins/qmldesigner/designercore/include/variantproperty.h6
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp139
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/model/variantproperty.cpp22
-rw-r--r--src/plugins/qmldesigner/settingspage.cpp26
-rw-r--r--src/plugins/qmldesigner/settingspage.h11
-rw-r--r--src/plugins/qmldesigner/settingspage.ui4
-rw-r--r--src/plugins/qmljseditor/qmljscomponentnamedialog.cpp1
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp20
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h1
-rw-r--r--src/plugins/qmljseditor/qmljseditorfactory.cpp10
-rw-r--r--src/plugins/qmljseditor/qmljseditorplugin.cpp21
-rw-r--r--src/plugins/qmljseditor/qmljseditorplugin.h7
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljssemantichighlighter.cpp4
-rw-r--r--src/plugins/qmljseditor/quicktoolbarsettingspage.cpp24
-rw-r--r--src/plugins/qmljseditor/quicktoolbarsettingspage.h10
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.cpp38
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.h7
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp2
-rw-r--r--src/plugins/qmlprofiler/abstracttimelinemodel.cpp20
-rw-r--r--src/plugins/qmlprofiler/abstracttimelinemodel.h7
-rw-r--r--src/plugins/qmlprofiler/canvas/canvas.pri9
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp242
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h107
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp1134
-rw-r--r--src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h326
-rw-r--r--src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp105
-rw-r--r--src/plugins/qmlprofiler/qml/CategoryLabel.qml2
-rw-r--r--src/plugins/qmlprofiler/qml/Detail.qml31
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml33
-rw-r--r--src/plugins/qmlprofiler/qml/Overview.qml13
-rw-r--r--src/plugins/qmlprofiler/qml/RangeDetails.qml14
-rw-r--r--src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml32
-rw-r--r--src/plugins/qmlprofiler/qml/TimeDisplay.qml61
-rw-r--r--src/plugins/qmlprofiler/qml/TimeMarks.qml61
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.pro7
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.qbs12
-rw-r--r--src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp2
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.h1
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp148
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h6
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp248
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h18
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp8
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.cpp3
-rw-r--r--src/plugins/qmlprofiler/qv8profilerdatamodel.cpp12
-rw-r--r--src/plugins/qmlprofiler/sortedtimelinemodel.cpp110
-rw-r--r--src/plugins/qmlprofiler/sortedtimelinemodel.h187
-rw-r--r--src/plugins/qmlprojectmanager/qmlapp.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/qmlapp.h1
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp6
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h1
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectnodes.cpp6
-rw-r--r--src/plugins/qnx/bardescriptoreditorfactory.cpp13
-rw-r--r--src/plugins/qnx/bardescriptoreditorfactory.h8
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.cpp8
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.h4
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstep.cpp156
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstep.h77
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp (renamed from src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.cpp)12
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h (renamed from src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.h)8
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp (renamed from src/plugins/qnx/blackberrycheckdevmodestepfactory.cpp)34
-rw-r--r--src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h (renamed from src/plugins/qnx/blackberrycheckdevmodestepfactory.h)8
-rw-r--r--src/plugins/qnx/blackberrycheckdevmodestep.cpp110
-rw-r--r--src/plugins/qnx/blackberryconfiguration.cpp108
-rw-r--r--src/plugins/qnx/blackberryconfiguration.h9
-rw-r--r--src/plugins/qnx/blackberryconfigurationmanager.cpp44
-rw-r--r--src/plugins/qnx/blackberryconfigurationmanager.h1
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp24
-rw-r--r--src/plugins/qnx/blackberrydeployconfigurationfactory.cpp4
-rw-r--r--src/plugins/qnx/blackberrydeviceinformation.cpp13
-rw-r--r--src/plugins/qnx/blackberrydeviceinformation.h2
-rw-r--r--src/plugins/qnx/blackberryinstallwizardpages.cpp2
-rw-r--r--src/plugins/qnx/blackberrykeyspage.cpp6
-rw-r--r--src/plugins/qnx/blackberrykeyspage.h6
-rw-r--r--src/plugins/qnx/blackberrykeyswidget.cpp25
-rw-r--r--src/plugins/qnx/blackberryndkprocess.cpp1
-rw-r--r--src/plugins/qnx/blackberryndkprocess.h1
-rw-r--r--src/plugins/qnx/blackberryndksettingspage.cpp8
-rw-r--r--src/plugins/qnx/blackberryndksettingspage.h6
-rw-r--r--src/plugins/qnx/blackberryndksettingswidget.cpp68
-rw-r--r--src/plugins/qnx/blackberryndksettingswidget.ui262
-rw-r--r--src/plugins/qnx/blackberrysetupwizard.cpp14
-rw-r--r--src/plugins/qnx/blackberrysetupwizardpages.cpp2
-rw-r--r--src/plugins/qnx/blackberrysigningutils.cpp39
-rw-r--r--src/plugins/qnx/blackberrysigningutils.h8
-rw-r--r--src/plugins/qnx/blackberryversionnumber.cpp125
-rw-r--r--src/plugins/qnx/blackberryversionnumber.h (renamed from src/plugins/qnx/blackberrycheckdevmodestep.h)33
-rw-r--r--src/plugins/qnx/qnx.pro18
-rw-r--r--src/plugins/qnx/qnx.qbs14
-rw-r--r--src/plugins/qnx/qnxconstants.h2
-rw-r--r--src/plugins/qnx/qnxplugin.cpp4
-rw-r--r--src/plugins/qtsupport/customexecutableconfigurationwidget.cpp2
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.cpp18
-rw-r--r--src/plugins/qtsupport/qtoptionspage.cpp25
-rw-r--r--src/plugins/qtsupport/qtoptionspage.h14
-rw-r--r--src/plugins/qtsupport/qtparser.cpp24
-rw-r--r--src/plugins/qtsupport/qtparser.h1
-rw-r--r--src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp1
-rw-r--r--src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp1
-rw-r--r--src/plugins/resourceeditor/resourceeditorw.cpp2
-rw-r--r--src/plugins/subversion/checkoutwizard.cpp3
-rw-r--r--src/plugins/subversion/settingspage.cpp35
-rw-r--r--src/plugins/subversion/settingspage.h10
-rw-r--r--src/plugins/subversion/subversion.pro2
-rw-r--r--src/plugins/subversion/subversion.qbs2
-rw-r--r--src/plugins/subversion/subversionclient.cpp216
-rw-r--r--src/plugins/subversion/subversionclient.h82
-rw-r--r--src/plugins/subversion/subversionplugin.cpp174
-rw-r--r--src/plugins/subversion/subversionplugin.h23
-rw-r--r--src/plugins/subversion/subversionsettings.cpp2
-rw-r--r--src/plugins/subversion/subversionsettings.h1
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp4
-rw-r--r--src/plugins/texteditor/basetextdocument.h4
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp36
-rw-r--r--src/plugins/texteditor/basetexteditor.h18
-rw-r--r--src/plugins/texteditor/basetexteditor_p.h4
-rw-r--r--src/plugins/texteditor/basetextmark.cpp23
-rw-r--r--src/plugins/texteditor/behaviorsettingspage.cpp54
-rw-r--r--src/plugins/texteditor/behaviorsettingspage.h3
-rw-r--r--src/plugins/texteditor/behaviorsettingswidget.cpp29
-rw-r--r--src/plugins/texteditor/behaviorsettingswidget.h2
-rw-r--r--src/plugins/texteditor/behaviorsettingswidget.ui8
-rw-r--r--src/plugins/texteditor/codeassist/codeassistant.cpp2
-rw-r--r--src/plugins/texteditor/displaysettingspage.cpp36
-rw-r--r--src/plugins/texteditor/displaysettingspage.h3
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp76
-rw-r--r--src/plugins/texteditor/fontsettingspage.h3
-rw-r--r--src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp60
-rw-r--r--src/plugins/texteditor/generichighlighter/highlightersettingspage.h3
-rw-r--r--src/plugins/texteditor/itexteditor.cpp2
-rw-r--r--src/plugins/texteditor/itexteditor.h6
-rw-r--r--src/plugins/texteditor/plaintexteditor.cpp12
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp12
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.h6
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp2
-rw-r--r--src/plugins/texteditor/simplecodestylepreferenceswidget.cpp5
-rw-r--r--src/plugins/texteditor/simplecodestylepreferenceswidget.h1
-rw-r--r--src/plugins/texteditor/snippets/snippetssettingspage.cpp27
-rw-r--r--src/plugins/texteditor/snippets/snippetssettingspage.h3
-rw-r--r--src/plugins/texteditor/tabsettingswidget.cpp15
-rw-r--r--src/plugins/texteditor/tabsettingswidget.h1
-rw-r--r--src/plugins/texteditor/texteditoractionhandler.cpp134
-rw-r--r--src/plugins/texteditor/texteditoractionhandler.h28
-rw-r--r--src/plugins/texteditor/texteditorplugin.cpp13
-rw-r--r--src/plugins/texteditor/texteditorplugin.h2
-rw-r--r--src/plugins/todo/optionsdialog.ui4
-rw-r--r--src/plugins/todo/optionspage.cpp20
-rw-r--r--src/plugins/todo/optionspage.h7
-rwxr-xr-xsrc/plugins/todo/todooutputpane.cpp8
-rw-r--r--src/plugins/updateinfo/settingspage.cpp24
-rw-r--r--src/plugins/updateinfo/settingspage.h8
-rw-r--r--src/plugins/valgrind/suppressiondialog.cpp1
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.cpp1
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp20
-rw-r--r--src/plugins/vcsbase/basecheckoutwizardpage.cpp1
-rw-r--r--src/plugins/vcsbase/basevcseditorfactory.cpp11
-rw-r--r--src/plugins/vcsbase/commonsettingspage.cpp19
-rw-r--r--src/plugins/vcsbase/commonsettingspage.h9
-rw-r--r--src/plugins/vcsbase/vcsbaseclient.cpp2
-rw-r--r--src/qtcreatorplugin.pri8
-rw-r--r--src/rpath.pri8
-rw-r--r--src/tools/buildoutputparser/buildoutputparser.pro25
-rw-r--r--src/tools/buildoutputparser/buildoutputparser.qbs20
-rw-r--r--src/tools/buildoutputparser/main.cpp107
-rw-r--r--src/tools/buildoutputparser/outputprocessor.cpp98
-rw-r--r--src/tools/buildoutputparser/outputprocessor.h (renamed from src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h)46
-rw-r--r--src/tools/tools.pro3
-rw-r--r--src/tools/tools.qbs1
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/cplusplus/lexer/tst_lexer.cpp15
-rw-r--r--tests/auto/externaltool/externaltool.pro8
-rw-r--r--tests/auto/externaltool/tst_externaltooltest.cpp6
606 files changed, 10846 insertions, 11008 deletions
diff --git a/doc/src/android/androiddev.qdoc b/doc/src/android/androiddev.qdoc
index 30d56285c9..aa0987f0b4 100644
--- a/doc/src/android/androiddev.qdoc
+++ b/doc/src/android/androiddev.qdoc
@@ -218,7 +218,7 @@
\gui Add. If you run an application without a device connected to the
development PC and without an AVD specified, \QC asks you to add an AVD.
- To manage AVDs, select \gui {Start Android AVD Manager}.
+ To manage AVDs, select \gui {Start AVD Manager}.
\note The Android Emulator has a bug that prevents it from starting on some
systems. If the Android Emulator does not start, you can try starting it
diff --git a/doc/src/howto/creator-vcs.qdoc b/doc/src/howto/creator-vcs.qdoc
index 4783cd4eee..fd32f3555b 100644
--- a/doc/src/howto/creator-vcs.qdoc
+++ b/doc/src/howto/creator-vcs.qdoc
@@ -312,10 +312,42 @@
Bazaar is a free version control system sponsored by Canonical.
- In addition to the standard version control system functions, you can
- select \gui Tools > \gui Bazaar > \gui Pull to turn the branch into a
- mirror of another branch. To update a mirror of the branch, select
- \gui Push.
+ The \gui Bazaar submenu contains the following additional items:
+
+ \table
+ \header
+ \li Menu Item
+ \li Description
+ \row
+ \li \gui Pull
+ \li Turn the branch into a mirror of another branch.
+ \row
+ \li \gui Push
+ \li Update a mirror of the branch.
+ \row
+ \li \gui Uncommit
+ \li Remove the last committed revision.
+ \endtable
+
+ \section3 Uncommitting Revisions
+
+ In Bazaar, committing changes to a branch creates a new revision that holds
+ a snapshot of the state of the working tree. To remove the last committed
+ revision, select \gui Tools > \gui Bazaar > \gui Uncommit.
+
+ In the \gui Uncommit dialog, select options to keep tags that point to
+ removed revisions and to only remove the commits from the local branch when
+ in a checkout.
+
+ To remove all commits up to an entry in the revision log, specify the
+ revision in the \gui Revision field.
+
+ To test the outcome of the \gui Uncommit command without actually removing
+ anything, select \gui {Dry Run}.
+
+ \gui Uncommit leaves the working tree ready for a new commit. The only
+ change it might make is restoring pending merges that were present before
+ the commit.
\section2 Using Additional ClearCase Functions
diff --git a/doc/src/qnx/creator-developing-bb10.qdoc b/doc/src/qnx/creator-developing-bb10.qdoc
index 83926824e5..118a690a23 100644
--- a/doc/src/qnx/creator-developing-bb10.qdoc
+++ b/doc/src/qnx/creator-developing-bb10.qdoc
@@ -49,7 +49,9 @@
\li Set up API Levels:
\list 1
- \li Select \gui Tools > \gui Options > \gui BlackBerry > \gui NDK to list all registered API Levels automatically detected by \QC.
+ \li Select \gui Tools > \gui Options > \gui BlackBerry >
+ \gui {API Level} to list all registered API Levels automatically
+ detected by \QC.
\li The API Levels printed with a bold font are active. Use \gui Activate and \gui Deactivate to change it. When an API Level is active, \QC registers kits, Qt versions, tool chains, and debuggers to enable BlackBerry 10 development against the API Level.
\li Use \gui Add to install a new API Level or to register an existing one.
\li It is recommended to install the latest API Level too even though you are not going to use it. This will enable all \QC features including device auto-detection and the new BlackBerry Signing Keys process.
diff --git a/qtcreator.pri b/qtcreator.pri
index 261fadef77..175070567f 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -1,9 +1,9 @@
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1
-QTCREATOR_VERSION = 3.0.0
-QTCREATOR_COMPAT_VERSION = 3.0.0
-BINARY_ARTIFACTS_BRANCH = 3.0
+QTCREATOR_VERSION = 3.0.81
+QTCREATOR_COMPAT_VERSION = 3.0.81
+BINARY_ARTIFACTS_BRANCH = master
isEqual(QT_MAJOR_VERSION, 5) {
@@ -130,13 +130,11 @@ macx {
IDE_DOC_PATH = $$IDE_DATA_PATH/doc
IDE_BIN_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/MacOS
copydata = 1
- isEmpty(TIGER_COMPAT_MODE):TIGER_COMPAT_MODE=$$(QTC_TIGER_COMPAT)
!isEqual(QT_MAJOR_VERSION, 5) {
- # Qt5 doesn't support 10.5, and will set the minimum version correctly to 10.6 or 10.7.
- isEmpty(TIGER_COMPAT_MODE) {
- QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
- QMAKE_LFLAGS *= -mmacosx-version-min=10.5
- }
+ # we use @rpath which is 10.5+
+ # Qt5 doesn't support 10.5, and will set the minimum version to 10.6 or 10.7.
+ QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
+ QMAKE_LFLAGS *= -mmacosx-version-min=10.5
}
} else {
contains(TEMPLATE, vc.*):vcproj = 1
diff --git a/qtcreator.qbs b/qtcreator.qbs
index 9cce364395..6228a1b53d 100644
--- a/qtcreator.qbs
+++ b/qtcreator.qbs
@@ -4,11 +4,11 @@ Project {
property bool withAutotests: qbs.buildVariant === "debug"
property string ide_version_major: '3'
property string ide_version_minor: '0'
- property string ide_version_release: '0'
+ property string ide_version_release: '81'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property string ide_compat_version_major: '3'
property string ide_compat_version_minor: '0'
- property string ide_compat_version_release: '0'
+ property string ide_compat_version_release: '81'
property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
property path ide_source_tree: path
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 63ee3a53b3..5bec6499a1 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -260,10 +260,19 @@ class DumperBase:
self.cachedFormats[typeName] = stripped
return stripped
+ def isArmArchitecture(self):
+ return False
+
+ def isQnxTarget(self):
+ return False
def is32bit(self):
return self.ptrSize() == 4
+ def isQt3Support(self):
+ # assume no Qt 3 support by default
+ return False
+
def computeLimit(self, size, limit):
if limit is None:
return size
@@ -596,7 +605,7 @@ class DumperBase:
if format == 0:
# Explicitly requested bald pointer.
self.putType(typeName)
- self.putPointerValue(value)
+ self.putValue(b16encode(str(value)), Hex2EncodedUtf8WithoutQuotes)
self.putNumChild(1)
if self.currentIName in self.expandedINames:
with Children(self):
@@ -639,20 +648,13 @@ class DumperBase:
self.putNumChild(0)
return True
- if format == 6:
- # Explicitly requested formatting as array of 10 items.
- self.putType(typeName)
- self.putItemCount(10)
- self.putNumChild(10)
- self.putArrayData(innerType, value, 10)
- return True
-
- if format == 7:
- # Explicitly requested formatting as array of 1000 items.
+ if not format is None and format >= 6 and format <= 9:
+ # Explicitly requested formatting as array of n items.
+ n = (10, 100, 1000, 10000)[format - 6]
self.putType(typeName)
- self.putItemCount(1000)
- self.putNumChild(1000)
- self.putArrayData(innerType, value, 1000)
+ self.putItemCount(n)
+ self.putNumChild(n)
+ self.putArrayData(innerType, value, n)
return True
if self.isFunctionType(innerType):
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 7803f48eae..7560ded0ce 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -515,13 +515,11 @@ class Dumper(DumperBase):
self.autoDerefPointers = "autoderef" in options
self.partialUpdate = "partial" in options
self.tooltipOnly = "tooltiponly" in options
- self.noLocals = "nolocals" in options
#warn("NAMESPACE: '%s'" % self.qtNamespace())
#warn("VARIABLES: %s" % varList)
#warn("EXPANDED INAMES: %s" % self.expandedINames)
#warn("WATCHERS: %s" % watchers)
#warn("PARTIAL: %s" % self.partialUpdate)
- #warn("NO LOCALS: %s" % self.noLocals)
#
# Locals
@@ -548,7 +546,7 @@ class Dumper(DumperBase):
pass
varList = []
- if fullUpdateNeeded and not self.tooltipOnly and not self.noLocals:
+ if fullUpdateNeeded and not self.tooltipOnly:
locals = listOfLocals(varList)
# Take care of the return value of the last function call.
@@ -611,7 +609,6 @@ class Dumper(DumperBase):
#
with OutputSafer(self):
if len(watchers) > 0:
- self.put(",")
for watcher in watchers.split("##"):
(exp, iname) = watcher.split("#")
self.handleWatch(exp, iname)
@@ -999,6 +996,12 @@ class Dumper(DumperBase):
return xrange(0, toInteger(self.currentNumChild))
return xrange(min(toInteger(self.currentMaxNumChild), toInteger(self.currentNumChild)))
+ def isArmArchitecture(self):
+ return 'arm' in gdb.TARGET_CONFIG.lower()
+
+ def isQnxTarget(self):
+ return 'qnx' in gdb.TARGET_CONFIG.lower()
+
def qtVersion(self):
try:
version = str(gdb.parse_and_eval("qVersion()"))
@@ -1007,7 +1010,7 @@ class Dumper(DumperBase):
except:
try:
# This will fail on Qt 5
- gdb.execute("ptype QString::shared_empty", to_string=True)
+ gdb.execute("ptype QString::shared_null", to_string=True)
self.cachedQtVersion = 0x040800
except:
#self.cachedQtVersion = 0x050000
@@ -1018,6 +1021,21 @@ class Dumper(DumperBase):
self.qtVersion = lambda: self.cachedQtVersion
return self.cachedQtVersion
+ def isQt3Support(self):
+ if self.qtVersion() >= 0x050000:
+ return False
+ else:
+ try:
+ # This will fail on Qt 4 without Qt 3 support
+ gdb.execute("ptype QChar::null", to_string=True)
+ self.cachedIsQt3Suport = True
+ except:
+ self.cachedIsQt3Suport = False
+
+ # Memoize good results.
+ self.isQt3Support = lambda: self.cachedIsQt3Suport
+ return self.cachedIsQt3Suport
+
def putBetterType(self, type):
self.currentType = str(type)
self.currentTypePriority = self.currentTypePriority + 1
@@ -1489,9 +1507,11 @@ class Dumper(DumperBase):
if dumpBase:
baseNumber += 1
with UnnamedSubItem(self, "@%d" % baseNumber):
+ baseValue = value.cast(field.type)
self.put('iname="%s",' % self.currentIName)
self.put('name="[%s]",' % field.name)
- self.putItem(value.cast(field.type), False)
+ self.putAddress(baseValue.address)
+ self.putItem(baseValue, False)
elif len(field.name) == 0:
# Anonymous union. We need a dummy name to distinguish
# multiple anonymous unions in the struct.
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index 5754b4a8d1..7d5d32ea05 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -316,6 +316,7 @@ def qdump__QDir(d, value):
privAddress = d.dereferenceValue(value)
bit32 = d.is32bit()
qt5 = d.qtVersion() >= 0x050000
+ qt3support = d.isQt3Support()
# QDirPrivate:
# QAtomicInt ref
# QStringList nameFilters;
@@ -331,7 +332,7 @@ def qdump__QDir(d, value):
# QFileInfoList fileInfos;
# QFileSystemEntry dirEntry;
# QFileSystemEntry absoluteDirEntry;
- qt3SupportAddition = 0 if qt5 else d.ptrSize() # qt5 doesn't have qt3support
+ qt3SupportAddition = d.ptrSize() if qt3support else 0
filesOffset = (24 if bit32 else 40) + qt3SupportAddition
fileInfosOffset = filesOffset + d.ptrSize()
dirEntryOffset = fileInfosOffset + d.ptrSize()
@@ -758,6 +759,7 @@ def qdump__QImage(d, value):
ptrSize = d.ptrSize()
isQt5 = d.qtVersion() >= 0x050000
+ qt3Support = d.isQt3Support()
offset = (3 if isQt5 else 2) * ptrSize
base = d.dereference(d.addressOf(value) + offset)
width = d.extractInt(base + 4)
@@ -765,7 +767,7 @@ def qdump__QImage(d, value):
nbytes = d.extractInt(base + 16)
padding = d.ptrSize() - d.intSize()
pixelRatioSize = 8 if isQt5 else 0
- jumpTableSize = ptrSize if not isQt5 else 0 # FIXME: Assumes Qt3 Support
+ jumpTableSize = ptrSize if qt3Support else 0
bits = d.dereference(base + 20 + padding + pixelRatioSize + ptrSize)
iformat = d.extractInt(base + 20 + padding + pixelRatioSize + jumpTableSize + 2 * ptrSize)
d.putValue("(%dx%d)" % (width, height))
@@ -895,7 +897,10 @@ def qdumpHelper__Qt4_QMap(d, value, forceLong):
# Or possibly 2 * sizeof(void *)
nodeType = d.lookupType(d.qtNamespace() + "QMapNode<%s,%s>" % (keyType, valueType))
nodePointerType = nodeType.pointer()
- payloadSize = nodeType.sizeof - 2 * nodePointerType.sizeof
+ if d.isArmArchitecture() and d.isQnxTarget() and str(valueType) == 'QVariant': # symbols reports payload size at wrong size 24
+ payloadSize = 28
+ else:
+ payloadSize = nodeType.sizeof - 2 * nodePointerType.sizeof
if isCompact:
innerType = valueType
diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py
index 512255a00a..1f7242135b 100644
--- a/share/qtcreator/debugger/stdtypes.py
+++ b/share/qtcreator/debugger/stdtypes.py
@@ -55,6 +55,10 @@ def qdump__std__complex(d, value):
def qdump__std__deque(d, value):
+ if d.isQnxTarget():
+ qdump__std__deque__QNX(d, value)
+ return
+
innerType = d.templateArgument(value.type, 0)
innerSize = innerType.sizeof
bufsize = 1
@@ -87,11 +91,47 @@ def qdump__std__deque(d, value):
plast = pfirst + bufsize
pcur = pfirst
+def qdump__std__deque__QNX(d, value):
+ innerType = d.templateArgument(value.type, 0)
+ innerSize = innerType.sizeof
+ if innerSize <= 1:
+ bufsize = 16
+ elif innerSize <= 2:
+ bufsize = 8
+ elif innerSize <= 4:
+ bufsize = 4
+ elif innerSize <= 8:
+ bufsize = 2
+ else:
+ bufsize = 1
+
+ myoff = value['_Myoff']
+ mysize = value['_Mysize']
+ mapsize = value['_Mapsize']
+
+ d.check(0 <= mapsize and mapsize <= 1000 * 1000 * 1000)
+ d.putItemCount(mysize)
+ d.putNumChild(mysize)
+ if d.isExpanded():
+ with Children(d, mysize, maxNumChild=2000, childType=innerType):
+ map = value['_Map']
+ for i in d.childRange():
+ block = myoff / bufsize
+ offset = myoff - (block * bufsize)
+ if mapsize <= block:
+ block -= mapsize
+ d.putSubItem(i, map[block][offset])
+ myoff += 1;
+
def qdump__std____debug__deque(d, value):
qdump__std__deque(d, value)
def qdump__std__list(d, value):
+ if d.isQnxTarget():
+ qdump__std__list__QNX(d, value)
+ return
+
impl = value["_M_impl"]
node = impl["_M_node"]
head = d.addressOf(node)
@@ -113,6 +153,21 @@ def qdump__std__list(d, value):
d.putSubItem(i, (p + 1).cast(innerPointer).dereference())
p = p["_M_next"]
+def qdump__std__list__QNX(d, value):
+ node = value["_Myhead"]
+ size = value["_Mysize"]
+
+ d.putItemCount(size, 1000)
+ d.putNumChild(size)
+
+ if d.isExpanded():
+ p = node["_Next"]
+ innerType = d.templateArgument(value.type, 0)
+ with Children(d, size, maxNumChild=1000, childType=innerType):
+ for i in d.childRange():
+ d.putSubItem(i, p['_Myval'])
+ p = p["_Next"]
+
def qdump__std____debug__list(d, value):
qdump__std__list(d, value)
@@ -120,6 +175,10 @@ def qform__std__map():
return mapForms()
def qdump__std__map(d, value):
+ if d.isQnxTarget():
+ qdump__std__map__QNX(d, value)
+ return
+
impl = value["_M_t"]["_M_impl"]
size = int(impl["_M_node_count"])
d.check(0 <= size and size <= 100*1000*1000)
@@ -175,6 +234,63 @@ def qdump__std__map(d, value):
while not d.isNull(node["_M_left"]):
node = node["_M_left"]
+def qdump__std__map__QNX(d, value):
+ size = value['_Mysize']
+ d.check(0 <= size and size <= 100*1000*1000)
+ d.putItemCount(size)
+ d.putNumChild(size)
+
+ if d.isExpanded():
+ keyType = d.templateArgument(value.type, 0)
+ valueType = d.templateArgument(value.type, 1)
+ try:
+ # Does not work on gcc 4.4, the allocator type (fourth template
+ # argument) seems not to be available.
+ pairType = d.templateArgument(d.templateArgument(value.type, 3), 0)
+ pairPointer = pairType.pointer()
+ except:
+ # So use this as workaround:
+ pairType = d.templateArgument(impl.type, 1)
+ pairPointer = pairType.pointer()
+ isCompact = d.isMapCompact(keyType, valueType)
+ innerType = pairType
+ if isCompact:
+ innerType = valueType
+ head = value['_Myhead']
+ node = head['_Left']
+ nodeType = head.type
+ childType = innerType
+ if size == 0:
+ childType = pairType
+ childNumChild = 2
+ if isCompact:
+ childNumChild = None
+ with Children(d, size, maxNumChild=1000,
+ childType=childType, childNumChild=childNumChild):
+ for i in d.childRange():
+ with SubItem(d, i):
+ pair = node.cast(nodeType).dereference()['_Myval']
+ if isCompact:
+ d.putMapName(pair["first"])
+ d.putItem(pair["second"])
+ else:
+ d.putEmptyValue()
+ if d.isExpanded():
+ with Children(d, 2):
+ d.putSubItem("first", pair["first"])
+ d.putSubItem("second", pair["second"])
+ if not node['_Right']['_Isnil']:
+ node = node['_Right']
+ while not node['_Left']['_Isnil']:
+ node = node['_Left']
+ else:
+ parent = node['_Parent']
+ while node == parent['_Right']['_Isnil']:
+ node = parent
+ parent = parent['_Parent']
+ if node['_Right'] != parent:
+ node = parent
+
def qdump__std____debug__map(d, value):
qdump__std__map(d, value)
@@ -236,6 +352,10 @@ def qdump__std____cxx1998__set(d, value):
qdump__std__set(d, value)
def qdump__std__set(d, value):
+ if d.isQnxTarget():
+ qdump__std__set__QNX(d, value)
+ return
+
impl = value["_M_t"]["_M_impl"]
size = int(impl["_M_node_count"])
d.check(0 <= size and size <= 100*1000*1000)
@@ -259,9 +379,34 @@ def qdump__std__set(d, value):
while not d.isNull(node["_M_left"]):
node = node["_M_left"]
+def qdump__std__set__QNX(d, value):
+ size = value['_Mysize']
+ d.check(0 <= size and size <= 100*1000*1000)
+ d.putItemCount(size)
+ d.putNumChild(size)
+ if d.isExpanded():
+ valueType = d.templateArgument(value.type, 0)
+ head = value['_Myhead']
+ node = head['_Left']
+ nodeType = head.type
+ with Children(d, size, maxNumChild=1000, childType=valueType):
+ for i in d.childRange():
+ d.putSubItem(i, node.cast(nodeType).dereference()['_Myval'])
+ if not node['_Right']['_Isnil']:
+ node = node['_Right']
+ while not node['_Left']['_Isnil']:
+ node = node['_Left']
+ else:
+ parent = node['_Parent']
+ while node == parent['_Right']['_Isnil']:
+ node = parent
+ parent = parent['_Parent']
+ if node['_Right'] != parent:
+ node = parent
def qdump__std__stack(d, value):
- qdump__std__deque(d, value["c"])
+ d.putItem(value["c"])
+ d.putType(str(value.type))
def qdump__std____debug__stack(d, value):
qdump__std__stack(d, value)
@@ -273,6 +418,10 @@ def qdump__std__string(d, value):
qdump__std__stringHelper1(d, value, 1)
def qdump__std__stringHelper1(d, value, charSize):
+ if d.isQnxTarget():
+ qdump__std__stringHelper1__QNX(d, value, charSize)
+ return
+
data = value["_M_dataplus"]["_M_p"]
# We can't lookup the std::string::_Rep type without crashing LLDB,
# so hard-code assumption on member position
@@ -285,6 +434,20 @@ def qdump__std__stringHelper1(d, value, charSize):
d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)
qdump_stringHelper(d, sizePtr, size * charSize, charSize)
+def qdump__std__stringHelper1__QNX(d, value, charSize):
+ size = value['_Mysize']
+ alloc = value['_Myres']
+ _BUF_SIZE = 16 / charSize
+ if _BUF_SIZE <= alloc: #(_BUF_SIZE <= _Myres ? _Bx._Ptr : _Bx._Buf);
+ data = value['_Bx']['_Ptr']
+ else:
+ data = value['_Bx']['_Buf']
+ sizePtr = data.cast(d.charType().pointer())
+ refcount = int(sizePtr[-1])
+ d.check(refcount >= -1) # Can be -1 accoring to docs.
+ d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)
+ qdump_stringHelper(d, sizePtr, size * charSize, charSize)
+
def qdump_stringHelper(d, data, size, charSize):
cutoff = min(size, d.stringCutOff)
mem = d.readMemory(data, cutoff)
@@ -510,6 +673,10 @@ def qedit__std__vector(d, value, data):
gdb.execute(cmd)
def qdump__std__vector(d, value):
+ if d.isQnxTarget():
+ qdump__std__vector__QNX(d, value)
+ return
+
impl = value["_M_impl"]
type = d.templateArgument(value.type, 0)
alloc = impl["_M_end_of_storage"]
@@ -548,6 +715,40 @@ def qdump__std__vector(d, value):
else:
d.putArrayData(type, start, size)
+def qdump__std__vector__QNX(d, value):
+ type = d.templateArgument(value.type, 0)
+ isBool = str(type) == 'bool'
+ if isBool:
+ impl = value['_Myvec']
+ start = impl['_Myfirst']
+ last = impl['_Mylast']
+ end = impl['_Myend']
+ size = value['_Mysize']
+ storagesize = start.dereference().type.sizeof * 8
+ else:
+ start = value['_Myfirst']
+ last = value['_Mylast']
+ end = value['_Myend']
+ size = int (last - start)
+ alloc = int (end - start)
+
+ d.check(0 <= size and size <= 1000 * 1000 * 1000)
+ d.check(last <= end)
+ d.checkPointer(start)
+ d.checkPointer(last)
+ d.checkPointer(end)
+
+ d.putItemCount(size)
+ d.putNumChild(size)
+ if d.isExpanded():
+ if isBool:
+ with Children(d, size, maxNumChild=10000, childType=type):
+ for i in d.childRange():
+ q = start + int(i / storagesize)
+ d.putBoolItem(str(i), (q.dereference() >> (i % storagesize)) & 1)
+ else:
+ d.putArrayData(type, start, size)
+
def qdump__std____1__vector(d, value):
innerType = d.templateArgument(value.type, 0)
if d.isLldb and d.childAt(value, 0).type == innerType:
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
index 9155a4b17f..9f07d89132 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
@@ -63,6 +63,8 @@
#include "endpuppetcommand.h"
#include "debugoutputcommand.h"
+#include <enumeration.h>
+
namespace QmlDesigner {
static bool isRegistered=false;
@@ -181,6 +183,9 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<DebugOutputCommand>("DebugOutputCommand");
qRegisterMetaTypeStreamOperators<DebugOutputCommand>("DebugOutputCommand");
+
+ qRegisterMetaType<Enumeration>("Enumeration");
+ qRegisterMetaTypeStreamOperators<Enumeration>("Enumeration");
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
index 6443495c34..93d2d08d95 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
@@ -29,7 +29,7 @@
#include "objectnodeinstance.h"
-
+#include <enumeration.h>
#include <QEvent>
#include <QQmlContext>
@@ -472,6 +472,9 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
QVariant fixedValue = fixResourcePaths(value);
+ if (value.canConvert<Enumeration>())
+ fixedValue = QVariant::fromValue(value.value<Enumeration>().nameToString());
+
QVariant oldValue = property.read();
if (oldValue.type() == QVariant::Url) {
QUrl url = oldValue.toUrl();
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
index 68324e6a79..4ce25e1e59 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppet.pri
@@ -26,6 +26,7 @@ include (instances/instances.pri)
include (../commands/commands.pri)
include (../container/container.pri)
include (../interfaces/interfaces.pri)
+include (../types/types.pri)
QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH)
!isEmpty(QT_BREAKPAD_ROOT_PATH) {
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp
index 7da7543d57..ab99cbc5d2 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/objectnodeinstance.cpp
@@ -29,7 +29,7 @@
#include "objectnodeinstance.h"
-
+#include <enumeration.h>
#include <QEvent>
#include <QGraphicsScene>
@@ -443,6 +443,9 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
QVariant fixedValue = fixResourcePaths(value);
+ if (value.canConvert<Enumeration>())
+ fixedValue = QVariant::fromValue(value.value<Enumeration>().nameToString());
+
QVariant oldValue = property.read();
if (oldValue.type() == QVariant::Url) {
QUrl url = oldValue.toUrl();
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri b/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri
index a4332bdc35..f54d0170e6 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/qmlpuppet.pri
@@ -16,6 +16,7 @@ include (instances/instances.pri)
include (../commands/commands.pri)
include (../container/container.pri)
include (../interfaces/interfaces.pri)
+include (../types/types.pri)
SOURCES += $$PWD/qmlpuppetmain.cpp
RESOURCES += $$PWD/../qmlpuppet.qrc
diff --git a/share/qtcreator/qml/qmlpuppet/types/enumeration.cpp b/share/qtcreator/qml/qmlpuppet/types/enumeration.cpp
new file mode 100644
index 0000000000..d0f8abfbc7
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/types/enumeration.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "enumeration.h"
+
+#include <QString>
+#include <QList>
+#include <QtDebug>
+
+namespace QmlDesigner {
+
+Enumeration::Enumeration()
+{
+}
+
+Enumeration::Enumeration(const EnumerationName &enumerationName)
+ : m_enumerationName(enumerationName)
+{
+}
+
+Enumeration::Enumeration(const QString &enumerationName)
+ : m_enumerationName(enumerationName.toUtf8())
+{
+}
+
+Enumeration::Enumeration(const QString &scope, const QString &name)
+{
+ QString enumerationString = scope + QLatin1Char('.') + name;
+
+ m_enumerationName = enumerationString.toUtf8();
+}
+
+QmlDesigner::EnumerationName QmlDesigner::Enumeration::scope() const
+{
+ return m_enumerationName.split('.').first();
+}
+
+EnumerationName Enumeration::name() const
+{
+ return m_enumerationName.split('.').last();
+}
+
+EnumerationName Enumeration::toEnumerationName() const
+{
+ return m_enumerationName;
+}
+
+QString Enumeration::toString() const
+{
+ return QString::fromUtf8(m_enumerationName);
+}
+
+QString Enumeration::nameToString()
+{
+ return QString::fromUtf8(name());
+}
+
+QDataStream &operator<<(QDataStream &out, const Enumeration &enumeration)
+{
+ out << enumeration.toEnumerationName();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, Enumeration &enumeration)
+{
+ in >> enumeration.m_enumerationName;
+
+ return in;
+}
+
+
+bool operator ==(const Enumeration &first, const Enumeration &second)
+{
+ return first.m_enumerationName == second.m_enumerationName;
+}
+
+bool operator <(const Enumeration &first, const Enumeration &second)
+{
+ return first.m_enumerationName < second.m_enumerationName;
+}
+
+QDebug operator <<(QDebug debug, const Enumeration &enumeration)
+{
+ debug.nospace() << "Enumeration("
+ << enumeration.toString()
+ << ")";
+
+ return debug;
+}
+
+
+} // namespace QmlDesigner
+
+
+
diff --git a/src/plugins/debugger/lldblib/lldbenginehost.h b/share/qtcreator/qml/qmlpuppet/types/enumeration.h
index 52df2b373e..c7194e95dc 100644
--- a/src/plugins/debugger/lldblib/lldbenginehost.h
+++ b/share/qtcreator/qml/qmlpuppet/types/enumeration.h
@@ -27,62 +27,51 @@
**
****************************************************************************/
-#ifndef DEBUGGER_LLDBENGINE_HOST_H
-#define DEBUGGER_LLDBENGINE_HOST_H
+#ifndef QMLDESIGNER_ENUMERATION_H
+#define QMLDESIGNER_ENUMERATION_H
-#include "ipcenginehost.h"
-#include <ssh/ssherrors.h>
-#include <ssh/sshconnection.h>
-#include <ssh/sshremoteprocess.h>
-#include <ssh/sshremoteprocessrunner.h>
+#include <QByteArray>
+#include <QDataStream>
+#include <QMetaType>
+#include <QVariant>
-#include <QProcess>
-#include <QQueue>
+namespace QmlDesigner {
-namespace Debugger {
-namespace Internal {
+typedef QByteArray EnumerationName;
-class SshIODevice : public QIODevice
+class Enumeration
{
-Q_OBJECT
+ friend bool operator ==(const Enumeration &first, const Enumeration &second);
+ friend bool operator <(const Enumeration &first, const Enumeration &second);
+ friend QDataStream &operator>>(QDataStream &in, Enumeration &enumeration);
+
public:
- SshIODevice(QSsh::SshRemoteProcessRunner *r);
- ~SshIODevice();
- virtual qint64 bytesAvailable () const;
- virtual qint64 writeData (const char * data, qint64 maxSize);
- virtual qint64 readData (char * data, qint64 maxSize);
-private slots:
- void processStarted();
- void outputAvailable();
- void errorOutputAvailable();
+ Enumeration();
+ Enumeration(const EnumerationName &enumerationName);
+ Enumeration(const QString &enumerationName);
+ Enumeration(const QString &scope, const QString &name);
+
+ EnumerationName scope() const;
+ EnumerationName name() const;
+ EnumerationName toEnumerationName() const;
+ QString toString() const;
+ QString nameToString();
+
private:
- QSsh::SshRemoteProcessRunner *runner;
- QSsh::SshRemoteProcess::Ptr proc;
- int buckethead;
- QQueue<QByteArray> buckets;
- QByteArray startupbuffer;
+ EnumerationName m_enumerationName;
};
-class LldbEngineHost : public IPCEngineHost
-{
- Q_OBJECT
+QDataStream &operator<<(QDataStream &out, const Enumeration &enumeration);
+QDataStream &operator>>(QDataStream &in, Enumeration &enumeration);
-public:
- explicit LldbEngineHost(const DebuggerStartParameters &startParameters);
- ~LldbEngineHost();
+bool operator ==(const Enumeration &first, const Enumeration &second);
+bool operator <(const Enumeration &first, const Enumeration &second);
-private:
- QProcess *m_guestProcess;
- QSsh::SshRemoteProcessRunner *m_ssh;
-protected:
- void nuke();
-private slots:
- void sshConnectionError(QSsh::SshError);
- void finished(int, QProcess::ExitStatus);
- void stderrReady();
-};
+QDebug operator <<(QDebug debug, const Enumeration &enumeration);
+
+
+} // namespace QmlDesigner
-} // namespace Internal
-} // namespace Debugger
+Q_DECLARE_METATYPE(QmlDesigner::Enumeration)
-#endif // DEBUGGER_LLDBENGINE_HOST_H
+#endif // QMLDESIGNER_ENUMERATION_H
diff --git a/share/qtcreator/qml/qmlpuppet/types/types.pri b/share/qtcreator/qml/qmlpuppet/types/types.pri
new file mode 100644
index 0000000000..87425205e6
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/types/types.pri
@@ -0,0 +1,5 @@
+INCLUDEPATH += $$PWD/
+
+HEADERS += $$PWD/enumeration.h
+
+SOURCES += $$PWD/enumeration.cpp
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml
index 39419cc54e..23e72c9250 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ComboBox.qml
@@ -37,12 +37,13 @@ Controls.ComboBox {
property variant backendValue
property color textColor: colorLogic.textColor
+ property string scope: "Qt"
ColorLogic {
id: colorLogic
backendValue: comboBox.backendValue
onValueFromBackendChanged: {
- comboBox.currentIndex = comboBox.find(comboBox.backendValue.valueToString);
+ comboBox.currentIndex = comboBox.find(comboBox.backendValue.enumeration);
}
}
@@ -50,8 +51,7 @@ Controls.ComboBox {
if (backendValue === undefined)
return;
- if (backendValue.value !== currentText)
- backendValue.value = currentText;
+ backendValue.setEnumeration(comboBox.scope, comboBox.currentText)
}
onFocusChanged: {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml
index ce98140396..b63bcb28ab 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml
@@ -72,6 +72,7 @@ Section {
visible: showVerticalAlignment
Layout.fillWidth: true
backendValue: backendValues.wrapMode
+ scope: "Text"
model: ["NoWrap", "WordWrap", "WrapAnywhere", "WrapAtWordBoundaryOrAnywhere"]
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
index cc3dd56d99..0a7e53ecae 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/BorderImageSpecifics.qml
@@ -137,6 +137,7 @@ Column {
backendValue: backendValues.horizontalTileMode
implicitWidth: 180
Layout.fillWidth: true
+ scope: "BorderImage"
}
}
@@ -150,6 +151,7 @@ Column {
backendValue: backendValues.verticalTileMode
implicitWidth: 180
Layout.fillWidth: true
+ scope: "BorderImage"
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
index 995874e73d..33a84d5349 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/FlowSpecifics.qml
@@ -49,6 +49,7 @@ Column {
ComboBox {
model: ["LeftToRight", "TopToBottom"]
backendValue: backendValues.flow
+ scope: "Qt"
}
ExpandingSpacer {
@@ -65,6 +66,7 @@ Column {
model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection
Layout.fillWidth: true
+ scope: "Qt"
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
index c22a26ac89..54d20e94e6 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/GridSpecifics.qml
@@ -84,6 +84,7 @@ Column {
model: ["LeftToRight", "TopToBottom"]
backendValue: backendValues.flow
Layout.fillWidth: true
+ scope: "Qt"
}
}
@@ -96,6 +97,7 @@ Column {
model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection
Layout.fillWidth: true
+ scope: "Qt"
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
index 8939739f6a..98ed392465 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ImageSpecifics.qml
@@ -66,6 +66,7 @@ Column {
backendValue: backendValues.fillMode
implicitWidth: 180
Layout.fillWidth: true
+ scope: "Image"
}
ExpandingSpacer {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
index a65994eeea..a29dfc45f5 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/RowSpecifics.qml
@@ -50,6 +50,7 @@ Column {
model: ["LeftToRight", "RightToLeft"]
backendValue: backendValues.layoutDirection
Layout.fillWidth: true
+ scope: "Qt"
}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
index 770ba6a1bb..506e63fa2c 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
@@ -60,6 +60,7 @@ Section {
visible: showVerticalAlignment
Layout.fillWidth: true
backendValue: backendValues.echoMode
+ scope: "TextInput"
model: ["Normal", "Password", "PasswordEchoOnEdit", "NoEcho"]
}
diff --git a/share/qtcreator/templates/qml/qtquick_1_1/template.xml b/share/qtcreator/templates/qml/qtquick_1_1/template.xml
index ee2868b0af..51b653bafe 100644
--- a/share/qtcreator/templates/qml/qtquick_1_1/template.xml
+++ b/share/qtcreator/templates/qml/qtquick_1_1/template.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="C"
- featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.1.1"
- id="QB.QML Application for Qt Quick 1.1">
+<template openeditor="main.qml" priority="F"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.1.1">
<displayname>Qt Quick 1.1</displayname>
<description>Creates a Qt Quick 1 UI project with a single QML file that contains the main view. You can review Qt Quick 1 UI projects in the QML Viewer and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 4.8 or newer.</description>
</template>
diff --git a/share/qtcreator/templates/qml/qtquick_2_0/template.xml b/share/qtcreator/templates/qml/qtquick_2_0/template.xml
index b7efc7c355..9caad365ea 100644
--- a/share/qtcreator/templates/qml/qtquick_2_0/template.xml
+++ b/share/qtcreator/templates/qml/qtquick_2_0/template.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="A"
- featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
- id="QB.QML Application for Qt Quick 2.0">
+<template openeditor="main.qml" priority="E"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2">
<displayname>Qt Quick 2.0</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.0 or newer.</description>
</template>
diff --git a/share/qtcreator/templates/qml/qtquick_2_1/main.qml b/share/qtcreator/templates/qml/qtquick_2_1/main.qml
new file mode 100644
index 0000000000..88ea490076
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_1/main.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.1
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ anchors.centerIn: parent
+ text: "Hello World"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
+
diff --git a/share/qtcreator/templates/qml/qtquick_2_1/main.qmlproject b/share/qtcreator/templates/qml/qtquick_2_1/main.qmlproject
new file mode 100644
index 0000000000..558f68d035
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_1/main.qmlproject
@@ -0,0 +1,21 @@
+/* File generated by Qt Creator, version 2.7.0 */
+
+import QmlProject 1.1
+
+Project {
+// QTC_REPLACE main.qml WITH main
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ "../exampleplugin" ]
+}
diff --git a/share/qtcreator/templates/qml/qtquick_2_1/template.xml b/share/qtcreator/templates/qml/qtquick_2_1/template.xml
new file mode 100644
index 0000000000..86e9074adb
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_1/template.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="C"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2">
+ <displayname>Qt Quick 2.1</displayname>
+ <description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.1 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qml/qtquick_2_2/main.qml b/share/qtcreator/templates/qml/qtquick_2_2/main.qml
new file mode 100644
index 0000000000..0190f166d3
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_2/main.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.2
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ anchors.centerIn: parent
+ text: "Hello World"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
+
diff --git a/share/qtcreator/templates/qml/qtquick_2_2/main.qmlproject b/share/qtcreator/templates/qml/qtquick_2_2/main.qmlproject
new file mode 100644
index 0000000000..558f68d035
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_2/main.qmlproject
@@ -0,0 +1,21 @@
+/* File generated by Qt Creator, version 2.7.0 */
+
+import QmlProject 1.1
+
+Project {
+// QTC_REPLACE main.qml WITH main
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ "../exampleplugin" ]
+}
diff --git a/share/qtcreator/templates/qml/qtquick_2_2/template.xml b/share/qtcreator/templates/qml/qtquick_2_2/template.xml
new file mode 100644
index 0000000000..c070ec2158
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquick_2_2/template.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="A"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2">
+ <displayname>Qt Quick 2.2</displayname>
+ <description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.2 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qml/qtquickcontrols_1_0/template.xml b/share/qtcreator/templates/qml/qtquickcontrols_1_0/template.xml
index b76fdfb026..a0f35614d1 100644
--- a/share/qtcreator/templates/qml/qtquickcontrols_1_0/template.xml
+++ b/share/qtcreator/templates/qml/qtquickcontrols_1_0/template.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="B"
- featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
- id="QB.QML Application for Qt Quick 2.0">
+<template openeditor="main.qml" priority="D"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls">
<displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.1 or newer.</description>
</template>
diff --git a/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qml b/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qml
new file mode 100644
index 0000000000..74609d82c8
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Window 2.0
+
+ApplicationWindow {
+ title: qsTr("Hello World")
+ width: 640
+ height: 480
+
+ menuBar: MenuBar {
+ Menu {
+ title: qsTr("File")
+ MenuItem {
+ text: qsTr("Exit")
+ onTriggered: Qt.quit();
+ }
+ }
+ }
+
+ Button {
+ text: qsTr("Hello World")
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ }
+}
diff --git a/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qmlproject b/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qmlproject
new file mode 100644
index 0000000000..558f68d035
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquickcontrols_1_1/main.qmlproject
@@ -0,0 +1,21 @@
+/* File generated by Qt Creator, version 2.7.0 */
+
+import QmlProject 1.1
+
+Project {
+// QTC_REPLACE main.qml WITH main
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ "../exampleplugin" ]
+}
diff --git a/share/qtcreator/templates/qml/qtquickcontrols_1_1/template.xml b/share/qtcreator/templates/qml/qtquickcontrols_1_1/template.xml
new file mode 100644
index 0000000000..a2c09247b3
--- /dev/null
+++ b/share/qtcreator/templates/qml/qtquickcontrols_1_1/template.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="B"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls">
+ <displayname>Qt Quick Controls 1.1</displayname>
+ <description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.2 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro b/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro
index 0fd73e63dd..1c990093fb 100644
--- a/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/app.pro
@@ -16,7 +16,7 @@ SOURCES += main.cpp
# target.path =
# Please do not modify the following two lines. Required for deployment.
-include(qtquick1applicationviewer/qtquick1applicationviewer.pri)
+include(../../shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qtquick1applicationviewer.pri, instead) #
include(../../shared/deployment.pri)
qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml b/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml
index 3a39b42d35..e9ab8b2956 100644
--- a/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquick_1_1/template.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="C"
+<template openeditor="main.qml" priority="F"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.1.1"
viewerdir="qtquick1applicationviewer"
viewerclassname="QtQuick1ApplicationViewer"
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro
index d0247c4bcd..c9e32a3c26 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/app.pro
@@ -16,7 +16,7 @@ SOURCES += main.cpp
# target.path =
# Please do not modify the following two lines. Required for deployment.
-include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
+include(../../shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
include(../../shared/deployment.pri)
qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml
index ba341d2c55..2c29847412 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquick_2_0/template.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="A"
+<template openeditor="main.qml" priority="E"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
viewerdir="qtquick2applicationviewer"
viewerclassname="QtQuick2ApplicationViewer"
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro
new file mode 100644
index 0000000000..c9e32a3c26
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/app.pro
@@ -0,0 +1,22 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(../../shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
+include(../../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp
new file mode 100644
index 0000000000..fd46906328
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/main.cpp
@@ -0,0 +1,13 @@
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+ viewer.setMainQmlFile(QStringLiteral("qml/app/main.qml")); // MAINQML
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_1/qml/app/main.qml
new file mode 100644
index 0000000000..20ec49e4ff
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/qml/app/main.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.1
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml
new file mode 100644
index 0000000000..4db5883e43
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_1/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="C"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
+ viewerdir="qtquick2applicationviewer"
+ viewerclassname="QtQuick2ApplicationViewer"
+ stubversionminor="5">
+ <displayname>Qt Quick 2.1</displayname>
+ <description>Creates a deployable Qt Quick 2 application using the QtQuick 2.1 import. Requires Qt 5.1 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro b/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro
new file mode 100644
index 0000000000..c9e32a3c26
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/app.pro
@@ -0,0 +1,22 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(../../shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
+include(../../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp b/share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp
new file mode 100644
index 0000000000..fd46906328
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/main.cpp
@@ -0,0 +1,13 @@
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+ viewer.setMainQmlFile(QStringLiteral("qml/app/main.qml")); // MAINQML
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquick_2_2/qml/app/main.qml
new file mode 100644
index 0000000000..7f67d2c235
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/qml/app/main.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.2
+
+Rectangle {
+ width: 360
+ height: 360
+ Text {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
+ }
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml b/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml
new file mode 100644
index 0000000000..9416267e46
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquick_2_2/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="A"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
+ viewerdir="qtquick2applicationviewer"
+ viewerclassname="QtQuick2ApplicationViewer"
+ stubversionminor="5">
+ <displayname>Qt Quick 2.2</displayname>
+ <description>Creates a deployable Qt Quick 2 application using the QtQuick 2.2 import. Requires Qt 5.2 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
index d1cfc6b2b5..89f1ed5fe9 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/app.pro
@@ -16,7 +16,7 @@ SOURCES += main.cpp
# target.path =
# Please do not modify the following two lines. Required for deployment.
-include(qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri)
+include(../../shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
include(../../shared/deployment.pri)
qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
index 886e530395..b294c81d62 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/template.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<template openeditor="main.qml" priority="B"
+<template openeditor="main.qml" priority="D"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
viewerdir="qtquick2controlsapplicationviewer"
viewerclassname="QtQuick2ControlsApplicationViewer"
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro
new file mode 100644
index 0000000000..89f1ed5fe9
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/app.pro
@@ -0,0 +1,22 @@
+# Add more folders to ship with the application, here
+# DEPLOYMENTFOLDERS #
+folder_01.source = qml/app
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+# DEPLOYMENTFOLDERS_END #
+
+# Additional import path used to resolve QML modules in Creator's code model
+# QML_IMPORT_PATH #
+QML_IMPORT_PATH =
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(../../shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri)
+# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
+include(../../shared/deployment.pri)
+qtcAddDeployment()
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp
new file mode 100644
index 0000000000..18fd2076cf
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/main.cpp
@@ -0,0 +1,12 @@
+#include "qtquick2controlsapplicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ Application app(argc, argv);
+
+ QtQuick2ControlsApplicationViewer viewer;
+ viewer.setMainQmlFile(QStringLiteral("qml/app/main.qml")); // MAINQML
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml/app/main.qml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml/app/main.qml
new file mode 100644
index 0000000000..b257de0b83
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/qml/app/main.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+
+ApplicationWindow {
+ title: qsTr("Hello World")
+ width: 640
+ height: 480
+
+ menuBar: MenuBar {
+ Menu {
+ title: qsTr("File")
+ MenuItem {
+ text: qsTr("Exit")
+ onTriggered: Qt.quit();
+ }
+ }
+ }
+
+ Button {
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ }
+}
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml
new file mode 100644
index 0000000000..a9e6f828bf
--- /dev/null
+++ b/share/qtcreator/templates/qtquick/qtquickcontrols_1_1/template.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template openeditor="main.qml" priority="B"
+ featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
+ viewerdir="qtquick2controlsapplicationviewer"
+ viewerclassname="QtQuick2ControlsApplicationViewer"
+ stubversionminor="1">
+ <displayname>Qt Quick Controls 1.1</displayname>
+ <description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.2 or newer.</description>
+</template>
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.cpp
index 0b7ffe85da..0b7ffe85da 100644
--- a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.cpp
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.cpp
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.h
index b9dc3a9fee..b9dc3a9fee 100644
--- a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.h
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.h
diff --git a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.pri
index 030edc1d01..030edc1d01 100644
--- a/share/qtcreator/templates/qtquick/qtquick_1_1/qtquick1applicationviewer/qtquick1applicationviewer.pri
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick1applicationviewer/qtquick1applicationviewer.pri
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.cpp
index 2a62ca97b6..2a62ca97b6 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.cpp
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.cpp
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.h
index 6eee3c89b9..6eee3c89b9 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.h
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.h
diff --git a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri
index 5123a2567e..5123a2567e 100644
--- a/share/qtcreator/templates/qtquick/qtquick_2_0/qtquick2applicationviewer/qtquick2applicationviewer.pri
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2applicationviewer/qtquick2applicationviewer.pri
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp
index 7198a903b4..7198a903b4 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.cpp
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h
index 76c12b7720..76c12b7720 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h
diff --git a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri
index 32007f73fd..32007f73fd 100644
--- a/share/qtcreator/templates/qtquick/qtquickcontrols_1_0/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri
+++ b/share/qtcreator/templates/shared/qtquickapplicationviewer/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.pri
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp
index 42028ae4ed..1b04f04c19 100644
--- a/src/libs/3rdparty/cplusplus/Control.cpp
+++ b/src/libs/3rdparty/cplusplus/Control.cpp
@@ -808,6 +808,11 @@ Symbol **Control::lastSymbol() const
return &*d->symbols.begin() + d->symbols.size();
}
+unsigned Control::symbolCount() const
+{
+ return unsigned(d->symbols.size());
+}
+
bool Control::hasSymbol(Symbol *symbol) const
{
return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end();
diff --git a/src/libs/3rdparty/cplusplus/Control.h b/src/libs/3rdparty/cplusplus/Control.h
index 538ecc2766..d1946e0b52 100644
--- a/src/libs/3rdparty/cplusplus/Control.h
+++ b/src/libs/3rdparty/cplusplus/Control.h
@@ -213,6 +213,7 @@ public:
Symbol **firstSymbol() const;
Symbol **lastSymbol() const;
+ unsigned symbolCount() const;
bool hasSymbol(Symbol *symbol) const;
void addSymbol(Symbol *symbol);
diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp
index 6e6e6c2feb..0e0d1f4330 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.cpp
+++ b/src/libs/3rdparty/cplusplus/Lexer.cpp
@@ -297,7 +297,24 @@ void Lexer::scan_helper(Token *tok)
break;
case '?':
- tok->f.kind = T_QUESTION;
+ if (_yychar == '?') {
+ yyinp();
+ if (_yychar == '(') {
+ yyinp();
+ tok->f.kind = T_LBRACKET;
+ } else if (_yychar == ')') {
+ yyinp();
+ tok->f.kind = T_RBRACKET;
+ } else if (_yychar == '<') {
+ yyinp();
+ tok->f.kind = T_LBRACE;
+ } else if (_yychar == '>') {
+ yyinp();
+ tok->f.kind = T_RBRACE;
+ }
+ } else {
+ tok->f.kind = T_QUESTION;
+ }
break;
case '+':
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h
index 81df75f2aa..d5682cd1b3 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.h
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h
@@ -82,6 +82,7 @@ public:
MemoryPool *memoryPool() const;
AST *ast() const;
+ bool blockErrors() const { return f._blockErrors; }
bool blockErrors(bool block)
{
const bool previous = f._blockErrors;
diff --git a/src/libs/qmljs/qmljsconstants.h b/src/libs/qmljs/qmljsconstants.h
index 6f0f4c7fad..4f4df7c021 100644
--- a/src/libs/qmljs/qmljsconstants.h
+++ b/src/libs/qmljs/qmljsconstants.h
@@ -50,7 +50,7 @@ enum Enum {
Invalid,
Library,
Path,
- QrcPath,
+ QrcPath
};
}
diff --git a/src/libs/qtcreatorcdbext/containers.cpp b/src/libs/qtcreatorcdbext/containers.cpp
index 8fbd64f0a5..ad7c0b5495 100644
--- a/src/libs/qtcreatorcdbext/containers.cpp
+++ b/src/libs/qtcreatorcdbext/containers.cpp
@@ -203,7 +203,21 @@ int containerSize(KnownType kt, const SymbolGroupValue &v)
if (const SymbolGroupValue deque = v[unsigned(0)])
return containerSize(KT_StdDeque, deque);
break;
+ case KT_StdArray: {
+ std::string::size_type arraySizeStart = v.type().find(',');
+ if (arraySizeStart != std::string::npos) {
+ ++arraySizeStart;
+ std::string::size_type arraySizeEnd = v.type().find('>', arraySizeStart);
+ if (arraySizeEnd != std::string::npos) {
+ int rc = 0;
+ if (integerFromString(v.type().substr(arraySizeStart, arraySizeEnd - arraySizeStart), &rc))
+ return rc;
+ }
+ }
+ break;
+ }
}
+
return -1;
}
@@ -253,6 +267,22 @@ static inline AbstractSymbolGroupNodePtrVector stdListChildList(SymbolGroupNode
return AbstractSymbolGroupNodePtrVector();
}
+static inline AbstractSymbolGroupNodePtrVector stdArrayChildList(SymbolGroupNode *n, int count,
+ const SymbolGroupValueContext &ctx)
+{
+ AbstractSymbolGroupNodePtrVector rc;
+ if (SymbolGroupValue elems = SymbolGroupValue(n, ctx)["_Elems"]) {
+ rc.reserve(count);
+ for (int i = 0; i < count; ++i) {
+ if (const SymbolGroupValue value = elems[i])
+ rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, value.node()));
+ else
+ break;
+ }
+ }
+ return rc;
+}
+
// QLinkedList<T>: Dummy head node and then a linked list of "n", "t".
static inline AbstractSymbolGroupNodePtrVector qLinkedListChildList(SymbolGroupNode *n, int count,
const SymbolGroupValueContext &ctx)
@@ -1109,6 +1139,8 @@ AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int ty
break;
case KT_StdList:
return stdListChildList(node, size , ctx);
+ case KT_StdArray:
+ return stdArrayChildList(node, size , ctx);
case KT_StdDeque:
return stdDequeChildList(SymbolGroupValue(node, ctx), size);
case KT_StdStack:
diff --git a/src/libs/qtcreatorcdbext/knowntype.h b/src/libs/qtcreatorcdbext/knowntype.h
index 7604d25efe..4a99284f28 100644
--- a/src/libs/qtcreatorcdbext/knowntype.h
+++ b/src/libs/qtcreatorcdbext/knowntype.h
@@ -167,6 +167,7 @@ enum KnownType
// Types: STL
KT_StdString = KT_STL_Type + KT_Editable + KT_HasSimpleDumper + 1,
KT_StdWString = KT_STL_Type + KT_Editable + KT_HasSimpleDumper + 2,
+ KT_StdComplex = KT_STL_Type + KT_HasSimpleDumper + 3,
// Types: STL containers
KT_StdVector = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 1,
KT_StdList = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 2,
@@ -174,7 +175,8 @@ enum KnownType
KT_StdDeque = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 4,
KT_StdSet = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 5,
KT_StdMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 6,
- KT_StdMultiMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 7
+ KT_StdMultiMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 7,
+ KT_StdArray = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 8
};
#endif // KNOWNTYPE_H
diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
index 15002f322d..f292f24f02 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
@@ -1101,13 +1101,15 @@ int SymbolGroupNode::dumpNode(std::ostream &str,
if (addr) {
str << std::hex << std::showbase << ",addr=\"" << addr << '"';
- if (!value.compare(0, 2u, L"0x")) {
- // Determine referenced address of pointers?
- ULONG64 referencedAddr = 0;
- std::wistringstream istr(value.substr(2u, value.size() - 2u));
- istr >> std::hex >> referencedAddr;
- if (referencedAddr)
- str << ",origaddr=\"" << referencedAddr << '"';
+ if (SymbolGroupValue::isPointerType(t)) {
+ std::string::size_type pointerPos = value.rfind(L"0x");
+ if (pointerPos != std::string::npos) {
+ ULONG64 referencedAddr = 0;
+ std::wistringstream istr(value.substr(pointerPos + 2u));
+ istr >> std::hex >> referencedAddr;
+ if (referencedAddr)
+ str << ",origaddr=\"" << referencedAddr << '"';
+ }
}
str << std::noshowbase << std::dec;
}
diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
index 7cc61ed36b..4cb915e15b 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
@@ -1078,11 +1078,17 @@ static KnownType knownClassTypeHelper(const std::string &type,
return KT_StdStack;
if (!type.compare(hPos, 5, "deque"))
return KT_StdDeque;
+ if (!type.compare(hPos, 5, "array"))
+ return KT_StdArray;
break;
case 6:
if (!type.compare(hPos, 6, "vector"))
return KT_StdVector;
break;
+ case 7:
+ if (!type.compare(hPos, 7, "complex"))
+ return KT_StdComplex;
+ break;
case 8:
if (!type.compare(hPos, 8, "multimap"))
return KT_StdMultiMap;
@@ -2430,6 +2436,21 @@ static bool dumpStd_W_String(const SymbolGroupValue &v, int type, std::wostream
return true;
}
+// Dump a std::complex.
+static bool dumpStd_Complex(const SymbolGroupValue &v, std::wostream &str)
+{
+ if (const SymbolGroupValue &valArray = v[0u][0u]["_Val"]) {
+ if (const SymbolGroupValue &val0 = valArray["0"]) {
+ str << L'(' << val0.value();
+ if (const SymbolGroupValue &val1 = valArray["1"]) {
+ str << L", " << val1.value() << L')';
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
// QVariant employs a template for storage where anything bigger than the data union
// is pointed to by data.shared.ptr, else it is put into the data struct (pointer size)
// itself (notably Qt types consisting of a d-ptr only).
@@ -2690,10 +2711,8 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
const SymbolGroupValue v(n, ctx);
if (!v) // Value as such has memory read error?
return SymbolGroupNode::SimpleDumperFailed;
- if (SymbolGroupValue::isPointerType(v.type()))
- if (const ULONG64 pointerValue = v.pointerValue())
- str << std::showbase << std::hex << pointerValue << std::dec << std::noshowbase << ' ';
+ unsigned rc = SymbolGroupNode::SimpleDumperNotApplicable;
// Simple dump of size for containers
if (kt & KT_ContainerType) {
const int size = containerSize(kt, v);
@@ -2703,120 +2722,125 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
*containerSizeIn = size;
if (size >= 0) {
str << L'<' << size << L" items>";
- *s = str.str();
- return SymbolGroupNode::SimpleDumperOk;
+ rc = SymbolGroupNode::SimpleDumperOk;
+ } else {
+ rc = SymbolGroupNode::SimpleDumperFailed;
+ }
+ } else {
+ switch (kt) {
+ case KT_QChar:
+ rc = dumpQChar(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QByteArray:
+ rc = dumpQByteArray(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QFileInfo:
+ rc = dumpQFileInfo(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QFile:
+ rc = dumpQFile(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QDir:
+ rc = dumpQDir(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QRegExp:
+ rc = dumpQRegExp(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QUrl:
+ rc = dumpQUrl(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QHostAddress:
+ rc = dumpQHostAddress(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QProcess:
+ rc = dumpQProcess(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QScriptValue:
+ rc = dumpQScriptValue(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QString:
+ rc = dumpQString(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QStringRef:
+ rc = dumpQStringRef(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QColor:
+ rc = dumpQColor(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QFlags:
+ rc = dumpQFlags(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QDate:
+ rc = dumpQDate(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QTime:
+ rc = dumpQTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QDateTime:
+ rc = dumpQDateTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QPoint:
+ case KT_QPointF:
+ rc = dumpQPoint_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QSize:
+ case KT_QSizeF:
+ rc = dumpQSize_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QLine:
+ case KT_QLineF:
+ rc = dumpQLine_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QPixmap:
+ rc = dumpQPixmap(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QImage:
+ rc = dumpQImage(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QRect:
+ rc = dumpQRect(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QRectF:
+ rc = dumpQRectF(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QVariant:
+ rc = dumpQVariant(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QAtomicInt:
+ rc = dumpQAtomicInt(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QBasicAtomicInt:
+ rc = dumpQBasicAtomicInt(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QObject:
+ rc = dumpQObject(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QWidget:
+ rc = dumpQWidget(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QWindow:
+ rc = dumpQWindow(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QSharedPointer:
+ rc = dumpQSharedPointer(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_StdString:
+ case KT_StdWString:
+ rc = dumpStd_W_String(v, kt, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_StdComplex:
+ rc = dumpStd_Complex(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ case KT_QTextCursor:
+ rc = dumpQTextCursor(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
+ break;
+ default:
+ break;
}
- return SymbolGroupNode::SimpleDumperFailed;
- }
- unsigned rc = SymbolGroupNode::SimpleDumperNotApplicable;
- switch (kt) {
- case KT_QChar:
- rc = dumpQChar(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QByteArray:
- rc = dumpQByteArray(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QFileInfo:
- rc = dumpQFileInfo(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QFile:
- rc = dumpQFile(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QDir:
- rc = dumpQDir(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QRegExp:
- rc = dumpQRegExp(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QUrl:
- rc = dumpQUrl(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QHostAddress:
- rc = dumpQHostAddress(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QProcess:
- rc = dumpQProcess(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QScriptValue:
- rc = dumpQScriptValue(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QString:
- rc = dumpQString(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QStringRef:
- rc = dumpQStringRef(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QColor:
- rc = dumpQColor(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QFlags:
- rc = dumpQFlags(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QDate:
- rc = dumpQDate(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QTime:
- rc = dumpQTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QDateTime:
- rc = dumpQDateTime(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QPoint:
- case KT_QPointF:
- rc = dumpQPoint_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QSize:
- case KT_QSizeF:
- rc = dumpQSize_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QLine:
- case KT_QLineF:
- rc = dumpQLine_F(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QPixmap:
- rc = dumpQPixmap(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QImage:
- rc = dumpQImage(v, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QRect:
- rc = dumpQRect(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QRectF:
- rc = dumpQRectF(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QVariant:
- rc = dumpQVariant(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QAtomicInt:
- rc = dumpQAtomicInt(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QBasicAtomicInt:
- rc = dumpQBasicAtomicInt(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QObject:
- rc = dumpQObject(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QWidget:
- rc = dumpQWidget(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QWindow:
- rc = dumpQWindow(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QSharedPointer:
- rc = dumpQSharedPointer(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_StdString:
- case KT_StdWString:
- rc = dumpStd_W_String(v, kt, str, memoryHandleIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
- break;
- case KT_QTextCursor:
- rc = dumpQTextCursor(v, str) ? SymbolGroupNode::SimpleDumperOk
- : SymbolGroupNode::SimpleDumperFailed;
- break;
- default:
- break;
}
+ if (rc != SymbolGroupNode::SimpleDumperFailed && SymbolGroupValue::isPointerType(v.type()))
+ str << L" @" << std::showbase << std::hex << v.pointerValue() << std::dec << std::noshowbase;
+
if (rc == SymbolGroupNode::SimpleDumperOk)
*s = str.str();
QTC_TRACE_OUT
diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp
index 32d54c18cb..c80ba92b5f 100644
--- a/src/libs/utils/detailswidget.cpp
+++ b/src/libs/utils/detailswidget.cpp
@@ -37,6 +37,7 @@
#include <QPainter>
#include <QScrollArea>
#include <QApplication>
+#include <QStyle>
/*!
\class Utils::DetailsWidget
@@ -73,6 +74,7 @@ public:
QWidget *q;
DetailsButton *m_detailsButton;
QGridLayout *m_grid;
+ QLabel *m_summaryLabelIcon;
QLabel *m_summaryLabel;
QCheckBox *m_summaryCheckBox;
QLabel *m_additionalSummaryLabel;
@@ -91,6 +93,7 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
q(parent),
m_detailsButton(new DetailsButton),
m_grid(new QGridLayout),
+ m_summaryLabelIcon(new QLabel(parent)),
m_summaryLabel(new QLabel(parent)),
m_summaryCheckBox(new QCheckBox(parent)),
m_additionalSummaryLabel(new QLabel(parent)),
@@ -104,6 +107,11 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
summaryLayout->setSpacing(0);
+ m_summaryLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ m_summaryLabelIcon->setContentsMargins(0, 0, 0, 0);
+ m_summaryLabelIcon->setFixedWidth(0);
+ summaryLayout->addWidget(m_summaryLabelIcon);
+
m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
m_summaryLabel->setContentsMargins(0, 0, 0, 0);
@@ -164,6 +172,7 @@ void DetailsWidgetPrivate::updateControls()
m_widget->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::NoSummary);
m_detailsButton->setChecked(m_state == DetailsWidget::Expanded && m_widget);
m_detailsButton->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::Collapsed);
+ m_summaryLabelIcon->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryLabel->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryCheckBox->setVisible(m_state != DetailsWidget::NoSummary && m_useCheckBox);
@@ -219,8 +228,7 @@ bool DetailsWidget::useCheckBox()
void DetailsWidget::setUseCheckBox(bool b)
{
d->m_useCheckBox = b;
- d->m_summaryLabel->setVisible(b);
- d->m_summaryCheckBox->setVisible(!b);
+ d->updateControls();
}
void DetailsWidget::setChecked(bool b)
@@ -243,6 +251,9 @@ void DetailsWidget::setSummaryFontBold(bool b)
void DetailsWidget::setIcon(const QIcon &icon)
{
+ int iconSize = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this);
+ d->m_summaryLabelIcon->setFixedWidth(icon.isNull() ? 0 : iconSize);
+ d->m_summaryLabelIcon->setPixmap(icon.pixmap(iconSize, iconSize));
d->m_summaryCheckBox->setIcon(icon);
}
@@ -252,7 +263,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
QPainter p(this);
- QWidget *topLeftWidget = d->m_useCheckBox ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabel);
+ QWidget *topLeftWidget = d->m_useCheckBox ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabelIcon);
QPoint topLeft(topLeftWidget->geometry().left() - MARGIN, contentsRect().top());
const QRect paintArea(topLeft, contentsRect().bottomRight());
diff --git a/src/libs/utils/detailswidget.h b/src/libs/utils/detailswidget.h
index 6465ce0ec6..9ed7a58701 100644
--- a/src/libs/utils/detailswidget.h
+++ b/src/libs/utils/detailswidget.h
@@ -83,7 +83,6 @@ public:
bool useCheckBox();
void setUseCheckBox(bool b);
- /// Sets an icon, only supported if useCheckBox is true
void setIcon(const QIcon &icon);
static QPixmap createBackground(const QSize &size, int topHeight, QWidget *widget);
diff --git a/src/libs/utils/execmenu.cpp b/src/libs/utils/execmenu.cpp
new file mode 100644
index 0000000000..b760132801
--- /dev/null
+++ b/src/libs/utils/execmenu.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "execmenu.h"
+
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QMenu>
+#include <QPoint>
+#include <QRect>
+#include <QSize>
+#include <QWidget>
+
+namespace Utils {
+
+/*!
+ * Opens \a menu at the specified \a widget position.
+ * This function computes the position where to show the menu, and opens it with
+ * QMenu::exec().
+ */
+QAction *execMenuAtWidget(QMenu *menu, QWidget *widget)
+{
+ QPoint p;
+ QRect screen = qApp->desktop()->availableGeometry(widget);
+ QSize sh = menu->sizeHint();
+ QRect rect = widget->rect();
+ if (widget->isRightToLeft()) {
+ if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
+ p = widget->mapToGlobal(rect.bottomRight());
+ else
+ p = widget->mapToGlobal(rect.topRight() - QPoint(0, sh.height()));
+ p.rx() -= sh.width();
+ } else {
+ if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
+ p = widget->mapToGlobal(rect.bottomLeft());
+ else
+ p = widget->mapToGlobal(rect.topLeft() - QPoint(0, sh.height()));
+ }
+ p.rx() = qMax(screen.left(), qMin(p.x(), screen.right() - sh.width()));
+ p.ry() += 1;
+
+ return menu->exec(p);
+}
+
+} // namespace Utils
diff --git a/src/plugins/qmlprofiler/canvas/qmlprofilercanvas.h b/src/libs/utils/execmenu.h
index 4a360d012c..0a385c2d07 100644
--- a/src/plugins/qmlprofiler/canvas/qmlprofilercanvas.h
+++ b/src/libs/utils/execmenu.h
@@ -27,50 +27,21 @@
**
****************************************************************************/
-#ifndef QMLPROFILERCANVAS_H
-#define QMLPROFILERCANVAS_H
+#ifndef EXECMENU_H
+#define EXECMENU_H
-#include <QQuickPaintedItem>
-#include <QTimer>
-#include <QMutex>
+#include "utils_global.h"
QT_BEGIN_NAMESPACE
-class Context2D;
+class QAction;
+class QMenu;
+class QWidget;
QT_END_NAMESPACE
-namespace QmlProfiler {
-namespace Internal {
+namespace Utils {
-class QmlProfilerCanvas : public QQuickPaintedItem
-{
- Q_OBJECT
+QTCREATOR_UTILS_EXPORT QAction *execMenuAtWidget(QMenu *menu, QWidget *widget);
-public:
- QmlProfilerCanvas();
+} // namespace Utils
-signals:
- void drawRegion(Context2D *ctxt, const QRect &region);
-
-public slots:
- void requestPaint();
- void requestRedraw();
-
-private slots:
- void draw();
-
-protected:
- virtual void paint(QPainter *);
- virtual void componentComplete();
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
-
-private:
- Context2D *m_context2d;
-
- QTimer m_drawTimer;
- QMutex m_pixmapMutex;
-};
-
-}
-}
-
-#endif // QMLPROFILERCANVAS_H
+#endif // EXECMENU_H
diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp
index d945852698..ed80be0ba0 100644
--- a/src/libs/utils/fancylineedit.cpp
+++ b/src/libs/utils/fancylineedit.cpp
@@ -27,14 +27,13 @@
**
****************************************************************************/
+#include "execmenu.h"
#include "fancylineedit.h"
#include "historycompleter.h"
#include "qtcassert.h"
#include <QAbstractItemView>
-#include <QApplication>
#include <QDebug>
-#include <QDesktopWidget>
#include <QKeyEvent>
#include <QMenu>
#include <QPainter>
@@ -42,35 +41,6 @@
#include <QStyle>
/*!
- * Opens \a menu at the specified \a widget position.
- * This function computes the position where to show the menu, and opens it with
- * QMenu::exec().
- */
-static void execMenuAtWidget(QMenu *menu, QWidget *widget)
-{
- QPoint p;
- QRect screen = qApp->desktop()->availableGeometry(widget);
- QSize sh = menu->sizeHint();
- QRect rect = widget->rect();
- if (widget->isRightToLeft()) {
- if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
- p = widget->mapToGlobal(rect.bottomRight());
- else
- p = widget->mapToGlobal(rect.topRight() - QPoint(0, sh.height()));
- p.rx() -= sh.width();
- } else {
- if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
- p = widget->mapToGlobal(rect.bottomLeft());
- else
- p = widget->mapToGlobal(rect.topLeft() - QPoint(0, sh.height()));
- }
- p.rx() = qMax(screen.left(), qMin(p.x(), screen.right() - sh.width()));
- p.ry() += 1;
-
- menu->exec(p);
-}
-
-/*!
\class Utils::FancyLineEdit
\brief The FancyLineEdit class is a line edit with an embedded pixmap on
diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp
index c4b26695b3..c175ce1f4d 100644
--- a/src/libs/utils/textfileformat.cpp
+++ b/src/libs/utils/textfileformat.cpp
@@ -272,39 +272,6 @@ TextFileFormat::ReadResult
}
TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
- QByteArray *plainText, QString *errorString)
-{
- QByteArray data;
- try {
- Utils::FileReader reader;
- if (!reader.fetch(fileName, errorString))
- return TextFileFormat::ReadIOError;
- data = reader.data();
- } catch (const std::bad_alloc &) {
- *errorString = QCoreApplication::translate("Utils::TextFileFormat", "Out of memory.");
- return TextFileFormat::ReadMemoryAllocationError;
- }
-
- TextFileFormat format = TextFileFormat::detect(data);
- if (!format.codec)
- format.codec = QTextCodec::codecForLocale();
- if (format.codec->name() == "UTF-8") {
- if (format.hasUtf8Bom)
- data.remove(0, 3);
- *plainText = data;
- return TextFileFormat::ReadSuccess;
- }
-
- QString target;
- if (!format.decode(data, &target)) {
- *errorString = QCoreApplication::translate("Utils::TextFileFormat", "An encoding error was encountered.");
- return TextFileFormat::ReadEncodingError;
- }
- *plainText = target.toUtf8();
- return TextFileFormat::ReadSuccess;
-}
-
-TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
const QTextCodec *defaultCodec,
QByteArray *plainText, QString *errorString)
{
diff --git a/src/libs/utils/textfileformat.h b/src/libs/utils/textfileformat.h
index 9ca55042e1..7d8e37810f 100644
--- a/src/libs/utils/textfileformat.h
+++ b/src/libs/utils/textfileformat.h
@@ -76,8 +76,6 @@ public:
static ReadResult readFile(const QString &fileName, const QTextCodec *defaultCodec,
QString *plainText, TextFileFormat *format, QString *errorString,
QByteArray *decodingErrorSample = 0);
- static ReadResult readFileUTF8(const QString &fileName, QByteArray *plainText,
- QString *errorString); // TODO: Remove this version.
static ReadResult readFileUTF8(const QString &fileName, const QTextCodec *defaultCodec,
QByteArray *plainText, QString *errorString);
diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri
index 97833eb8e7..2825a5661f 100644
--- a/src/libs/utils/utils-lib.pri
+++ b/src/libs/utils/utils-lib.pri
@@ -86,7 +86,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/tooltip/tipcontents.cpp \
$$PWD/unixutils.cpp \
$$PWD/function.cpp \
- $$PWD/ansiescapecodehandler.cpp
+ $$PWD/ansiescapecodehandler.cpp \
+ $$PWD/execmenu.cpp
win32 {
SOURCES += \
@@ -180,7 +181,8 @@ HEADERS += \
$$PWD/unixutils.h \
$$PWD/qtcoverride.h \
$$PWD/function.h \
- $$PWD/ansiescapecodehandler.h
+ $$PWD/ansiescapecodehandler.h \
+ $$PWD/execmenu.h
FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \
diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs
index c40db11a3e..99174d119c 100644
--- a/src/libs/utils/utils.qbs
+++ b/src/libs/utils/utils.qbs
@@ -64,6 +64,8 @@ QtcLibrary {
"environment.h",
"environmentmodel.cpp",
"environmentmodel.h",
+ "execmenu.cpp",
+ "execmenu.h",
"faketooltip.cpp",
"faketooltip.h",
"fancylineedit.cpp",
diff --git a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
index 65a24e6041..cb7aedeade 100644
--- a/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
+++ b/src/plugins/analyzerbase/analyzerrunconfigwidget.cpp
@@ -98,8 +98,8 @@ void AnalyzerRunConfigWidget::chooseSettings(int setting)
m_configWidget->setEnabled(isCustom);
m_restoreButton->setEnabled(isCustom);
m_details->setSummaryText(isCustom
- ? tr("Use <strong>Customized Settings<strong>")
- : tr("Use <strong>Global Settings<strong>"));
+ ? tr("Use <strong>Customized Settings</strong>")
+ : tr("Use <strong>Global Settings</strong>"));
}
void AnalyzerRunConfigWidget::restoreGlobal()
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 6254c11d23..f2b2fecac0 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -37,6 +37,7 @@
#include "androiddevicedialog.h"
#include <coreplugin/icore.h>
+#include <coreplugin/messagemanager.h>
#include <utils/hostosinfo.h>
#include <utils/persistentsettings.h>
#include <projectexplorer/kitmanager.h>
@@ -248,7 +249,7 @@ void AndroidConfigurations::updateAvailableSdkPlatforms()
QProcess proc;
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
- if (!proc.waitForFinished(-1)) {
+ if (!proc.waitForFinished(5000)) {
proc.terminate();
return;
}
@@ -458,7 +459,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro
QVector<AndroidDeviceInfo> devices;
QProcess adbProc;
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
if (error)
*error = tr("Could not run: %1").arg(adbToolPath().toString() + QLatin1String(" devices"));
@@ -563,6 +564,8 @@ QString AndroidConfigurations::createAVD(const QString &target, const QString &n
break;
}
+ Core::MessageManager::write(QString::fromLocal8Bit(question), Core::MessageManager::Flash);
+
proc.waitForFinished();
if (proc.exitCode()) // error!
@@ -577,7 +580,7 @@ bool AndroidConfigurations::removeAVD(const QString &name) const
proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("delete") << QLatin1String("avd")
<< QLatin1String("-n") << name);
- if (!proc.waitForFinished(-1)) {
+ if (!proc.waitForFinished(5000)) {
proc.terminate();
return false;
}
@@ -591,7 +594,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
- if (!proc.waitForFinished(-1)) {
+ if (!proc.waitForFinished(5000)) {
proc.terminate();
return devices;
}
@@ -634,7 +637,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
QString AndroidConfigurations::startAVD(const QString &name, int apiLevel, QString cpuAbi) const
{
- if (findAvd(apiLevel, cpuAbi) || startAVDAsync(name))
+ if (!findAvd(apiLevel, cpuAbi).isEmpty() || startAVDAsync(name))
return waitForAvd(apiLevel, cpuAbi);
return QString();
}
@@ -656,7 +659,7 @@ bool AndroidConfigurations::startAVDAsync(const QString &avdName) const
return true;
}
-bool AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
+QString AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
{
QVector<AndroidDeviceInfo> devices = connectedDevices();
foreach (AndroidDeviceInfo device, devices) {
@@ -666,37 +669,50 @@ bool AndroidConfigurations::findAvd(int apiLevel, const QString &cpuAbi) const
continue;
if (device.sdk != apiLevel)
continue;
- return true;
+ return device.serialNumber;
+ }
+ return QString();
+}
+
+bool AndroidConfigurations::isConnected(const QString &serialNumber) const
+{
+ QVector<AndroidDeviceInfo> devices = connectedDevices();
+ foreach (AndroidDeviceInfo device, devices) {
+ if (device.serialNumber == serialNumber)
+ return true;
}
return false;
}
-QString AndroidConfigurations::waitForAvd(int apiLevel, const QString &cpuAbi) const
+bool AndroidConfigurations::waitForBooted(const QString &serialNumber, const QFutureInterface<bool> &fi) const
{
- // we cannot use adb -e wait-for-device, since that doesn't work if a emulator is already running
+ // found a serial number, now wait until it's done booting...
+ for (int i = 0; i < 60; ++i) {
+ if (fi.isCanceled())
+ return false;
+ if (hasFinishedBooting(serialNumber)) {
+ return true;
+ } else {
+ Utils::sleep(2000);
+ if (!isConnected(serialNumber)) // device was disconnected
+ return false;
+ }
+ }
+ return false;
+}
- // 15 rounds of 8s sleeping, a minute for the avd to start
+QString AndroidConfigurations::waitForAvd(int apiLevel, const QString &cpuAbi, const QFutureInterface<bool> &fi) const
+{
+ // we cannot use adb -e wait-for-device, since that doesn't work if a emulator is already running
+ // 60 rounds of 2s sleeping, two minutes for the avd to start
QString serialNumber;
- for (int i = 0; i < 15; ++i) {
- QVector<AndroidDeviceInfo> devices = connectedDevices();
- foreach (AndroidDeviceInfo device, devices) {
- if (!device.serialNumber.startsWith(QLatin1String("emulator")))
- continue;
- if (!device.cpuAbi.contains(cpuAbi))
- continue;
- if (device.sdk != apiLevel)
- continue;
- serialNumber = device.serialNumber;
- // found a serial number, now wait until it's done booting...
- for (int i = 0; i < 15; ++i) {
- if (hasFinishedBooting(serialNumber))
- return serialNumber;
- else
- Utils::sleep(8000);
- }
+ for (int i = 0; i < 60; ++i) {
+ if (fi.isCanceled())
return QString();
- }
- Utils::sleep(8000);
+ serialNumber = findAvd(apiLevel, cpuAbi);
+ if (!serialNumber.isEmpty())
+ return waitForBooted(serialNumber, fi) ? serialNumber : QString();
+ Utils::sleep(2000);
}
return QString();
}
@@ -710,7 +726,7 @@ bool AndroidConfigurations::isBootToQt(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return false;
}
@@ -726,7 +742,7 @@ int AndroidConfigurations::getSDKVersion(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return -1;
}
@@ -749,7 +765,7 @@ QString AndroidConfigurations::getProductModel(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return device;
}
@@ -769,7 +785,7 @@ bool AndroidConfigurations::hasFinishedBooting(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return false;
}
@@ -792,7 +808,7 @@ QStringList AndroidConfigurations::getAbis(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
- if (!adbProc.waitForFinished(-1)) {
+ if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return result;
}
diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h
index 1d87f5b27d..f69a830aed 100644
--- a/src/plugins/android/androidconfigurations.h
+++ b/src/plugins/android/androidconfigurations.h
@@ -36,6 +36,7 @@
#include <QVector>
#include <QHash>
#include <QMap>
+#include <QFutureInterface>
#include <projectexplorer/abi.h>
#include <utils/fileutils.h>
#include <utils/environment.h>
@@ -108,8 +109,9 @@ public:
QVector<AndroidDeviceInfo> androidVirtualDevices() const;
QString startAVD(const QString &name, int apiLevel, QString cpuAbi) const;
bool startAVDAsync(const QString &avdName) const;
- bool findAvd(int apiLevel, const QString &cpuAbi) const;
- QString waitForAvd(int apiLevel, const QString &cpuAbi) const;
+ QString findAvd(int apiLevel, const QString &cpuAbi) const;
+ QString waitForAvd(int apiLevel, const QString &cpuAbi, const QFutureInterface<bool> &fi = QFutureInterface<bool>()) const;
+ // special version for AndroidDeployQt::run
QString bestNdkPlatformMatch(const QString &targetAPI) const;
QStringList makeExtraSearchDirectories() const;
@@ -123,6 +125,8 @@ public:
QString getProductModel(const QString &device) const;
bool hasFinishedBooting(const QString &device) const;
+ bool waitForBooted(const QString &serialNumber, const QFutureInterface<bool> &fi) const;
+ bool isConnected(const QString &serialNumber) const;
AndroidDeviceInfo showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi);
void setDefaultDevice(ProjectExplorer::Project *project, const QString &abi, const QString &serialNumber); // serial number or avd name
diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp
index b5d0a796e6..d7f35042d8 100644
--- a/src/plugins/android/androiddeployqtstep.cpp
+++ b/src/plugins/android/androiddeployqtstep.cpp
@@ -285,7 +285,7 @@ bool AndroidDeployQtStep::init()
if (!result)
return false;
- if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch))
+ if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty())
AndroidConfigurations::instance().startAVDAsync(m_avdName);
return true;
}
@@ -293,7 +293,7 @@ bool AndroidDeployQtStep::init()
void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
{
if (!m_avdName.isEmpty()) {
- QString serialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch);
+ QString serialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch, fi);
if (serialNumber.isEmpty()) {
fi.reportResult(false);
emit finished();
diff --git a/src/plugins/android/androiddeployqtwidget.ui b/src/plugins/android/androiddeployqtwidget.ui
index a726f9134f..180bccc3b7 100644
--- a/src/plugins/android/androiddeployqtwidget.ui
+++ b/src/plugins/android/androiddeployqtwidget.ui
@@ -200,7 +200,7 @@
<item row="1" column="0">
<widget class="QLabel" name="targetSDKLabel">
<property name="text">
- <string>Android target SDK:</string>
+ <string>Android build SDK:</string>
</property>
</widget>
</item>
@@ -241,7 +241,7 @@
<item>
<widget class="QLabel" name="oldFilesWarningLabel">
<property name="text">
- <string>Qt no longer uses the folder "android" in the project's source directory.</string>
+ <string>Qt no longer uses the folder &quot;android&quot; in the project's source directory.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp
index d971eb6e71..29b77b06ed 100644
--- a/src/plugins/android/androiddeploystep.cpp
+++ b/src/plugins/android/androiddeploystep.cpp
@@ -281,8 +281,7 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("ls") << destination;
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
- process.waitForFinished(-1);
- if (process.error() != QProcess::UnknownError
+ if (!process.waitForFinished(5000)
|| process.exitCode() != 0)
return -1;
QByteArray output = process.readAll();
@@ -389,7 +388,7 @@ void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &
bool AndroidDeployStep::deployPackage()
{
if (!m_avdName.isEmpty()) {
- if (!AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch)
+ if (AndroidConfigurations::instance().findAvd(m_deviceAPILevel, m_targetArch).isEmpty()
&& !AndroidConfigurations::instance().startAVDAsync(m_avdName))
return false;
m_deviceSerialNumber = AndroidConfigurations::instance().waitForAvd(m_deviceAPILevel, m_targetArch);
diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp
index 712933a627..68fbc57ee0 100644
--- a/src/plugins/android/androidmanager.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -791,7 +791,7 @@ QString AndroidManager::androidNameForApiLevel(int x)
case 19:
return QLatin1String("Android 4.4");
default:
- return QLatin1String("Unknown Android version.");
+ return tr("Unknown Android version.");
}
}
diff --git a/src/plugins/android/androidmanifesteditorfactory.cpp b/src/plugins/android/androidmanifesteditorfactory.cpp
index ba80296bd7..ac2e1f5e5a 100644
--- a/src/plugins/android/androidmanifesteditorfactory.cpp
+++ b/src/plugins/android/androidmanifesteditorfactory.cpp
@@ -41,17 +41,17 @@ using namespace Android::Internal;
AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent)
- : Core::IEditorFactory(parent),
- m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT))
+ : Core::IEditorFactory(parent)
{
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
setDisplayName(tr("Android Manifest editor"));
addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
+ new TextEditor::TextEditorActionHandler(this, Constants::ANDROID_MANIFEST_EDITOR_CONTEXT);
}
Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent)
{
- AndroidManifestEditorWidget *editor = new AndroidManifestEditorWidget(parent, m_actionHandler);
+ AndroidManifestEditorWidget *editor = new AndroidManifestEditorWidget(parent);
TextEditor::TextEditorSettings::initializeEditor(editor);
return editor->editor();
}
diff --git a/src/plugins/android/androidmanifesteditorfactory.h b/src/plugins/android/androidmanifesteditorfactory.h
index 3a1fa07844..afcb8abe24 100644
--- a/src/plugins/android/androidmanifesteditorfactory.h
+++ b/src/plugins/android/androidmanifesteditorfactory.h
@@ -32,8 +32,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
-namespace TextEditor { class TextEditorActionHandler; }
-
namespace Android {
namespace Internal {
@@ -45,9 +43,6 @@ public:
explicit AndroidManifestEditorFactory(QObject *parent = 0);
Core::IEditor *createEditor(QWidget *parent);
-
-private:
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 4c74236bc5..400be15983 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -95,7 +95,7 @@ Project *androidProject(const QString &file)
} // anonymous namespace
-AndroidManifestEditorWidget::AndroidManifestEditorWidget(QWidget *parent, TextEditor::TextEditorActionHandler *ah)
+AndroidManifestEditorWidget::AndroidManifestEditorWidget(QWidget *parent)
: TextEditor::PlainTextEditorWidget(parent),
m_dirty(false),
m_stayClean(false),
@@ -106,7 +106,6 @@ AndroidManifestEditorWidget::AndroidManifestEditorWidget(QWidget *parent, TextEd
doc->setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
setBaseTextDocument(doc);
- ah->setupActions(this);
configure(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
initializePage();
@@ -203,7 +202,7 @@ void AndroidManifestEditorWidget::initializePage()
m_androidTargetSdkVersion = new QComboBox(packageGroupBox);
m_androidTargetSdkVersion->setToolTip(
- tr("Sets the target SDK. Set this to the highest tested version."
+ tr("Sets the target SDK. Set this to the highest tested version. "
"This disables compatibility behavior of the system for your application."));
m_androidTargetSdkVersion->addItem(tr("Not set"), 0);
@@ -714,7 +713,7 @@ void AndroidManifestEditorWidget::updateSdkVersions()
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
- Core::InfoBar *infoBar = editorDocument()->infoBar();
+ Core::InfoBar *infoBar = baseTextDocument()->infoBar();
QString text;
if (line < 0)
text = tr("Could not parse file: '%1'.").arg(errorMessage);
@@ -732,7 +731,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
void AndroidManifestEditorWidget::hideInfoBar()
{
- Core::InfoBar *infoBar = editorDocument()->infoBar();
+ Core::InfoBar *infoBar = baseTextDocument()->infoBar();
infoBar->removeInfo(infoBarId);
m_timerParseCheck.stop();
}
diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h
index cdd77ef926..3318c39782 100644
--- a/src/plugins/android/androidmanifesteditorwidget.h
+++ b/src/plugins/android/androidmanifesteditorwidget.h
@@ -51,8 +51,6 @@ QT_END_NAMESPACE
namespace Core { class IEditor; }
-namespace TextEditor { class TextEditorActionHandler; }
-
namespace Android {
namespace Internal {
class AndroidManifestEditor;
@@ -86,7 +84,7 @@ public:
Source
};
- explicit AndroidManifestEditorWidget(QWidget *parent, TextEditor::TextEditorActionHandler *ah);
+ explicit AndroidManifestEditorWidget(QWidget *parent);
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
diff --git a/src/plugins/android/androidpotentialkit.cpp b/src/plugins/android/androidpotentialkit.cpp
index 9083d018f4..abc23682d1 100644
--- a/src/plugins/android/androidpotentialkit.cpp
+++ b/src/plugins/android/androidpotentialkit.cpp
@@ -76,6 +76,7 @@ AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent)
: Utils::DetailsWidget(parent)
{
setSummaryText(QLatin1String("<b>Create Android Kits</b>"));
+ setIcon(QIcon(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON)));
//detailsWidget->setState(Utils::DetailsWidget::NoSummary);
QWidget *mainWidget = new QWidget(this);
setWidget(mainWidget);
@@ -84,7 +85,7 @@ AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent)
layout->setMargin(0);
QLabel *label = new QLabel;
label->setText(tr("Qt Creator needs additional settings to enable Android support."
- "You can configure those settings in the Options dialog."));
+ " You can configure those settings in the Options dialog."));
label->setWordWrap(true);
layout->addWidget(label, 0, 0, 1, 2);
diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp
index 8b8e2ae5fa..46ae55465d 100644
--- a/src/plugins/android/androidruncontrol.cpp
+++ b/src/plugins/android/androidruncontrol.cpp
@@ -107,7 +107,7 @@ QString AndroidRunControl::displayName() const
QIcon AndroidRunControl::icon() const
{
- return QIcon(QLatin1String(ProjectExplorer::Constants::ICON_DEBUG_SMALL));
+ return QIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
}
} // namespace Internal
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index 881d61cc82..a3895c0cc5 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -217,7 +217,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}
- if (!adb.waitForFinished(-1)) {
+ if (!adb.waitForFinished(5000)) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports."));
return;
}
@@ -260,7 +260,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString()));
return;
}
- if (!adb.waitForFinished(-1)) {
+ if (!adb.waitForFinished(5000)) {
adb.terminate();
emit remoteProcessFinished(tr("Unable to start '%1'.").arg(m_packageName));
return;
diff --git a/src/plugins/android/androidsettingspage.cpp b/src/plugins/android/androidsettingspage.cpp
index 95cb4af425..d99c4b94eb 100644
--- a/src/plugins/android/androidsettingspage.cpp
+++ b/src/plugins/android/androidsettingspage.cpp
@@ -52,16 +52,10 @@ AndroidSettingsPage::AndroidSettingsPage(QObject *parent)
setCategoryIcon(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON));
}
-bool AndroidSettingsPage::matches(const QString &searchKeyWord) const
+QWidget *AndroidSettingsPage::widget()
{
- return m_keywords.contains(searchKeyWord, Qt::CaseInsensitive);
-}
-
-QWidget *AndroidSettingsPage::createPage(QWidget *parent)
-{
- m_widget = new AndroidSettingsWidget(parent);
- if (m_keywords.isEmpty())
- m_keywords = m_widget->searchKeywords();
+ if (!m_widget)
+ m_widget = new AndroidSettingsWidget;
return m_widget;
}
@@ -97,6 +91,7 @@ void AndroidSettingsPage::apply()
void AndroidSettingsPage::finish()
{
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/android/androidsettingspage.h b/src/plugins/android/androidsettingspage.h
index 2beb36c3cb..a9e966317c 100644
--- a/src/plugins/android/androidsettingspage.h
+++ b/src/plugins/android/androidsettingspage.h
@@ -32,6 +32,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Android {
namespace Internal {
@@ -44,14 +46,12 @@ class AndroidSettingsPage : public Core::IOptionsPage
public:
explicit AndroidSettingsPage(QObject *parent = 0);
- bool matches(const QString &searchKeyWord) const;
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- QString m_keywords;
- AndroidSettingsWidget *m_widget;
+ QPointer<AndroidSettingsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index 4ab8228d0b..24ef4dd2a5 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -129,24 +129,6 @@ AndroidSettingsWidget::~AndroidSettingsWidget()
delete m_ui;
}
-QString AndroidSettingsWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc) << m_ui->SDKLocationLabel->text()
- << ' ' << m_ui->SDKLocationLineEdit->text()
- << ' ' << m_ui->NDKLocationLabel->text()
- << ' ' << m_ui->NDKLocationLineEdit->text()
- << ' ' << m_ui->AntLocationLabel->text()
- << ' ' << m_ui->AntLocationLineEdit->text()
- << ' ' << m_ui->OpenJDKLocationLabel->text()
- << ' ' << m_ui->OpenJDKLocationLineEdit->text()
- << ' ' << m_ui->AVDManagerLabel->text()
- << ' ' << m_ui->DataPartitionSizeLable->text()
- << ' ' << m_ui->DataPartitionSizeSpinBox->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void AndroidSettingsWidget::initGui()
{
m_ui->setupUi(this);
diff --git a/src/plugins/android/androidsettingswidget.h b/src/plugins/android/androidsettingswidget.h
index 74e7fe6d43..bb72957a29 100644
--- a/src/plugins/android/androidsettingswidget.h
+++ b/src/plugins/android/androidsettingswidget.h
@@ -66,11 +66,10 @@ class AndroidSettingsWidget : public QWidget
Q_OBJECT
public:
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
- AndroidSettingsWidget(QWidget *parent);
+ AndroidSettingsWidget(QWidget *parent = 0);
~AndroidSettingsWidget();
void saveSettings(bool saveNow = false);
- QString searchKeywords() const;
private slots:
void sdkLocationEditingFinished();
diff --git a/src/plugins/android/androidsettingswidget.ui b/src/plugins/android/androidsettingswidget.ui
index 4c4c1d8bd0..985ccde98c 100644
--- a/src/plugins/android/androidsettingswidget.ui
+++ b/src/plugins/android/androidsettingswidget.ui
@@ -214,7 +214,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Ant location:</string>
+ <string>Ant executable:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -323,7 +323,7 @@
<item>
<widget class="QPushButton" name="manageAVDPushButton">
<property name="text">
- <string>Start Android AVD Manager</string>
+ <string>Start AVD Manager</string>
</property>
</widget>
</item>
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index 2891954bf1..505daf7f73 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
@@ -78,6 +78,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
m_watchedFiles(),
m_makefileParserThread(0)
{
+ setId(Constants::AUTOTOOLS_PROJECT_ID);
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -108,11 +109,6 @@ QString AutotoolsProject::displayName() const
return m_projectName;
}
-Core::Id AutotoolsProject::id() const
-{
- return Core::Id(Constants::AUTOTOOLS_PROJECT_ID);
-}
-
Core::IDocument *AutotoolsProject::document() const
{
return m_file;
@@ -437,7 +433,7 @@ void AutotoolsProject::updateCppCodeModel()
part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource);
part->includePaths += m_makefileParserThread->includePaths();
- part->defines += m_makefileParserThread->defines();
+ part->projectDefines += m_makefileParserThread->defines();
pinfo.appendProjectPart(part);
modelManager->updateProjectInfo(pinfo);
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
index 1af14a6bed..739c2535f5 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
@@ -73,7 +73,6 @@ public:
~AutotoolsProject();
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
ProjectExplorer::ProjectNode *rootProjectNode() const;
diff --git a/src/plugins/bazaar/bazaar.pro b/src/plugins/bazaar/bazaar.pro
index 06259346df..f3a266221b 100644
--- a/src/plugins/bazaar/bazaar.pro
+++ b/src/plugins/bazaar/bazaar.pro
@@ -13,7 +13,8 @@ SOURCES += \
branchinfo.cpp \
clonewizardpage.cpp \
clonewizard.cpp \
- cloneoptionspanel.cpp
+ cloneoptionspanel.cpp \
+ uncommitdialog.cpp
HEADERS += \
bazaarclient.h \
constants.h \
@@ -29,11 +30,13 @@ HEADERS += \
branchinfo.h \
clonewizard.h \
clonewizardpage.h \
- cloneoptionspanel.h
+ cloneoptionspanel.h \
+ uncommitdialog.h
FORMS += \
optionspage.ui \
revertdialog.ui \
bazaarcommitpanel.ui \
pullorpushdialog.ui \
- cloneoptionspanel.ui
+ cloneoptionspanel.ui \
+ uncommitdialog.ui
RESOURCES += bazaar.qrc
diff --git a/src/plugins/bazaar/bazaar.qbs b/src/plugins/bazaar/bazaar.qbs
index 8a5791e6be..54cbc804f0 100644
--- a/src/plugins/bazaar/bazaar.qbs
+++ b/src/plugins/bazaar/bazaar.qbs
@@ -49,6 +49,9 @@ QtcPlugin {
"pullorpushdialog.h",
"pullorpushdialog.ui",
"revertdialog.ui",
+ "uncommitdialog.cpp",
+ "uncommitdialog.h",
+ "uncommitdialog.ui",
"images/bazaar.png",
]
}
diff --git a/src/plugins/bazaar/bazaarclient.cpp b/src/plugins/bazaar/bazaarclient.cpp
index 5df1804457..ffc210be86 100644
--- a/src/plugins/bazaar/bazaarclient.cpp
+++ b/src/plugins/bazaar/bazaarclient.cpp
@@ -30,6 +30,7 @@
#include "constants.h"
#include <vcsbase/vcsbaseplugin.h>
+#include <vcsbase/vcsbaseoutputwindow.h>
#include <vcsbase/vcsbaseeditorparameterwidget.h>
#include <utils/synchronousprocess.h>
@@ -102,6 +103,24 @@ BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) c
return BranchInfo(repositoryRoot, false);
}
+//! Removes the last committed revision(s)
+bool BazaarClient::synchronousUncommit(const QString &workingDir,
+ const QString &revision,
+ const QStringList &extraOptions)
+{
+ QStringList args;
+ args << QLatin1String("uncommit")
+ << QLatin1String("--force") // Say yes to all questions
+ << QLatin1String("--verbose") // Will print out what is being removed
+ << revisionSpec(revision)
+ << extraOptions;
+ QByteArray stdOut;
+ const bool success = vcsFullySynchronousExec(workingDir, args, &stdOut);
+ if (!stdOut.isEmpty())
+ VcsBase::VcsBaseOutputWindow::instance()->append(QString::fromUtf8(stdOut));
+ return success;
+}
+
void BazaarClient::commit(const QString &repositoryRoot, const QStringList &files,
const QString &commitMessageFile, const QStringList &extraOptions)
{
diff --git a/src/plugins/bazaar/bazaarclient.h b/src/plugins/bazaar/bazaarclient.h
index 3dc756ef58..df42d899fa 100644
--- a/src/plugins/bazaar/bazaarclient.h
+++ b/src/plugins/bazaar/bazaarclient.h
@@ -49,6 +49,9 @@ public:
bool synchronousSetUserId();
BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
+ bool synchronousUncommit(const QString &workingDir,
+ const QString& revision = QString(),
+ const QStringList &extraOptions = QStringList());
void commit(const QString &repositoryRoot, const QStringList &files,
const QString &commitMessageFile, const QStringList &extraOptions = QStringList());
void annotate(const QString &workingDir, const QString &file,
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index 47045f8eb6..1ca6863a85 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -34,6 +34,7 @@
#include "bazaarcommitwidget.h"
#include "bazaareditor.h"
#include "pullorpushdialog.h"
+#include "uncommitdialog.h"
#include "commiteditor.h"
#include "clonewizard.h"
@@ -421,6 +422,13 @@ void BazaarPlugin::createRepositoryActions(const Core::Context &context)
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
+ action = new QAction(tr("Uncommit..."), this);
+ m_repositoryActionList.append(action);
+ command = Core::ActionManager::registerAction(action, Core::Id(Constants::UNCOMMIT), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(uncommit()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this);
command = Core::ActionManager::registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
@@ -640,6 +648,16 @@ void BazaarPlugin::commitFromEditor()
Core::EditorManager::closeEditor();
}
+void BazaarPlugin::uncommit()
+{
+ const VcsBase::VcsBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ UnCommitDialog dialog;
+ if (dialog.exec() == QDialog::Accepted)
+ m_client->synchronousUncommit(state.topLevel(), dialog.revision(), dialog.extraOptions());
+}
+
bool BazaarPlugin::submitEditorAboutToClose()
{
CommitEditor *commitEditor = qobject_cast<CommitEditor *>(submitEditor());
diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h
index ed93dd221f..7f9c85abab 100644
--- a/src/plugins/bazaar/bazaarplugin.h
+++ b/src/plugins/bazaar/bazaarplugin.h
@@ -106,6 +106,7 @@ private slots:
void commit();
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
void commitFromEditor();
+ void uncommit();
void diffFromEditorSelected(const QStringList &files);
#ifdef WITH_TESTS
void testDiffFileResolving_data();
diff --git a/src/plugins/bazaar/constants.h b/src/plugins/bazaar/constants.h
index c81427eba0..7143e1280c 100644
--- a/src/plugins/bazaar/constants.h
+++ b/src/plugins/bazaar/constants.h
@@ -87,6 +87,7 @@ const char PULL[] = "Bazaar.Action.Pull";
const char PUSH[] = "Bazaar.Action.Push";
const char UPDATE[] = "Bazaar.Action.Update";
const char COMMIT[] = "Bazaar.Action.Commit";
+const char UNCOMMIT[] = "Bazaar.Action.UnCommit";
const char CREATE_REPOSITORY[] = "Bazaar.Action.CreateRepository";
// Submit editor actions
diff --git a/src/plugins/bazaar/optionspage.cpp b/src/plugins/bazaar/optionspage.cpp
index 34d2caee04..bf35dc436c 100644
--- a/src/plugins/bazaar/optionspage.cpp
+++ b/src/plugins/bazaar/optionspage.cpp
@@ -44,6 +44,7 @@ OptionsPageWidget::OptionsPageWidget(QWidget *parent)
m_ui.setupUi(this);
m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui.commandChooser->setPromptDialogTitle(tr("Bazaar Command"));
+ m_ui.commandChooser->setHistoryCompleter(QLatin1String("Bazaar.Command.History"));
}
BazaarSettings OptionsPageWidget::settings() const
@@ -66,37 +67,17 @@ void OptionsPageWidget::setSettings(const BazaarSettings &s)
m_ui.timeout->setValue(s.intValue(BazaarSettings::timeoutKey));
}
-QString OptionsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.configGroupBox->title()
- << sep << m_ui.commandLabel->text()
- << sep << m_ui.userGroupBox->title()
- << sep << m_ui.defaultUsernameLabel->text()
- << sep << m_ui.defaultEmailLabel->text()
- << sep << m_ui.miscGroupBox->title()
- << sep << m_ui.showLogEntriesLabel->text()
- << sep << m_ui.timeoutSecondsLabel->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
OptionsPage::OptionsPage()
{
setId(VcsBase::Constants::VCS_ID_BAZAAR);
setDisplayName(tr("Bazaar"));
}
-QWidget *OptionsPage::createPage(QWidget *parent)
+QWidget *OptionsPage::widget()
{
if (!m_optionsPageWidget)
- m_optionsPageWidget = new OptionsPageWidget(parent);
+ m_optionsPageWidget = new OptionsPageWidget;
m_optionsPageWidget->setSettings(BazaarPlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_optionsPageWidget->searchKeywords();
return m_optionsPageWidget;
}
@@ -113,8 +94,3 @@ void OptionsPage::apply()
emit settingsChanged();
}
}
-
-bool OptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
diff --git a/src/plugins/bazaar/optionspage.h b/src/plugins/bazaar/optionspage.h
index b8f7bf6260..d3928eb6b1 100644
--- a/src/plugins/bazaar/optionspage.h
+++ b/src/plugins/bazaar/optionspage.h
@@ -50,7 +50,6 @@ public:
BazaarSettings settings() const;
void setSettings(const BazaarSettings &s);
- QString searchKeywords() const;
private:
Ui::OptionsPage m_ui;
@@ -64,16 +63,14 @@ class OptionsPage : public VcsBase::VcsBaseOptionsPage
public:
OptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish() { }
- bool matches(const QString &s) const;
signals:
void settingsChanged();
private:
- QString m_searchKeywords;
QPointer<OptionsPageWidget> m_optionsPageWidget;
};
diff --git a/src/plugins/bazaar/uncommitdialog.cpp b/src/plugins/bazaar/uncommitdialog.cpp
new file mode 100644
index 0000000000..30c7c75451
--- /dev/null
+++ b/src/plugins/bazaar/uncommitdialog.cpp
@@ -0,0 +1,83 @@
+/**************************************************************************
+**
+** Copyright (c) 2013 Hugues Delorme
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+#include "uncommitdialog.h"
+
+#include "ui_uncommitdialog.h"
+#include "bazaarclient.h"
+#include "bazaarplugin.h"
+#include <utils/qtcassert.h>
+
+#include <QPushButton>
+
+namespace Bazaar {
+namespace Internal {
+
+UnCommitDialog::UnCommitDialog(QWidget *parent)
+ : QDialog(parent),
+ m_ui(new Ui::UnCommitDialog)
+{
+ m_ui->setupUi(this);
+
+ QPushButton* dryRunBtn = new QPushButton(tr("Dry Run"));
+ dryRunBtn->setToolTip(tr("Test the outcome of removing the last committed revision, without actually removing anything."));
+ m_ui->buttonBox->addButton(dryRunBtn, QDialogButtonBox::ApplyRole);
+ connect(dryRunBtn, SIGNAL(clicked()), this, SLOT(dryRun()));
+}
+
+UnCommitDialog::~UnCommitDialog()
+{
+ delete m_ui;
+}
+
+QStringList UnCommitDialog::extraOptions() const
+{
+ QStringList opts;
+ if (m_ui->keepTagsCheckBox->isChecked())
+ opts += QLatin1String("--keep-tags");
+ if (m_ui->localCheckBox->isChecked())
+ opts += QLatin1String("--local");
+ return opts;
+}
+
+QString UnCommitDialog::revision() const
+{
+ return m_ui->revisionLineEdit->text().trimmed();
+}
+
+void UnCommitDialog::dryRun()
+{
+ BazaarPlugin* bzrPlugin = BazaarPlugin::instance();
+ QTC_ASSERT(bzrPlugin->currentState().hasTopLevel(), return);
+ bzrPlugin->client()->synchronousUncommit(bzrPlugin->currentState().topLevel(),
+ revision(),
+ extraOptions() << QLatin1String("--dry-run"));
+}
+
+} // namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/uncommitdialog.h b/src/plugins/bazaar/uncommitdialog.h
new file mode 100644
index 0000000000..9a59db18c1
--- /dev/null
+++ b/src/plugins/bazaar/uncommitdialog.h
@@ -0,0 +1,62 @@
+/**************************************************************************
+**
+** Copyright (c) 2013 Hugues Delorme
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+#ifndef UNCOMMITDIALOG_H
+#define UNCOMMITDIALOG_H
+
+#include <QDialog>
+
+namespace Bazaar {
+namespace Internal {
+
+namespace Ui {
+class UnCommitDialog;
+}
+
+class UnCommitDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit UnCommitDialog(QWidget *parent = 0);
+ ~UnCommitDialog();
+
+ QStringList extraOptions() const;
+ QString revision() const;
+
+private slots:
+ void dryRun();
+
+private:
+ Ui::UnCommitDialog *m_ui;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // UNCOMMITDIALOG_H
diff --git a/src/plugins/bazaar/uncommitdialog.ui b/src/plugins/bazaar/uncommitdialog.ui
new file mode 100644
index 0000000000..f08a8c8a7a
--- /dev/null
+++ b/src/plugins/bazaar/uncommitdialog.ui
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::UnCommitDialog</class>
+ <widget class="QDialog" name="Bazaar::Internal::UnCommitDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>412</width>
+ <height>124</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Uncommit</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="keepTagsCheckBox">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Keep tags that point to removed revisions</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="localCheckBox">
+ <property name="text">
+ <string>Only remove the commits from the local branch when in a checkout</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="revisionLabel">
+ <property name="text">
+ <string>Revision:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="revisionLineEdit">
+ <property name="toolTip">
+ <string>If a revision is specified, uncommits revisions to leave the branch at the specified revision.
+For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</string>
+ </property>
+ <property name="placeholderText">
+ <string>Last committed</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>buttonBox</zorder>
+ <zorder>revisionLabel</zorder>
+ <zorder>revisionLineEdit</zorder>
+ <zorder>keepTagsCheckBox</zorder>
+ <zorder>localCheckBox</zorder>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Bazaar::Internal::UnCommitDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Bazaar::Internal::UnCommitDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/classview/classview.pro b/src/plugins/classview/classview.pro
index 86352ed98f..a2c22df521 100644
--- a/src/plugins/classview/classview.pro
+++ b/src/plugins/classview/classview.pro
@@ -1,29 +1,29 @@
include(../../qtcreatorplugin.pri)
HEADERS += \
- classviewplugin.h \
- classviewnavigationwidgetfactory.h \
classviewconstants.h \
+ classviewmanager.h \
classviewnavigationwidget.h \
+ classviewnavigationwidgetfactory.h \
classviewparser.h \
- classviewmanager.h \
- classviewsymbollocation.h \
- classviewsymbolinformation.h \
classviewparsertreeitem.h \
- classviewutils.h \
- classviewtreeitemmodel.h
+ classviewplugin.h \
+ classviewsymbolinformation.h \
+ classviewsymbollocation.h \
+ classviewtreeitemmodel.h \
+ classviewutils.h
SOURCES += \
- classviewplugin.cpp \
- classviewnavigationwidgetfactory.cpp \
+ classviewmanager.cpp \
classviewnavigationwidget.cpp \
+ classviewnavigationwidgetfactory.cpp \
classviewparser.cpp \
- classviewmanager.cpp \
- classviewsymbollocation.cpp \
- classviewsymbolinformation.cpp \
classviewparsertreeitem.cpp \
- classviewutils.cpp \
- classviewtreeitemmodel.cpp
+ classviewplugin.cpp \
+ classviewsymbolinformation.cpp \
+ classviewsymbollocation.cpp \
+ classviewtreeitemmodel.cpp \
+ classviewutils.cpp
FORMS += \
classviewnavigationwidget.ui
diff --git a/src/plugins/classview/classview.qbs b/src/plugins/classview/classview.qbs
index a3699245d0..a80e8837ce 100644
--- a/src/plugins/classview/classview.qbs
+++ b/src/plugins/classview/classview.qbs
@@ -12,31 +12,19 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" }
-
files: [
"classview.qrc",
"classviewconstants.h",
- "classviewmanager.cpp",
- "classviewmanager.h",
- "classviewnavigationwidget.cpp",
- "classviewnavigationwidget.h",
- "classviewnavigationwidget.ui",
- "classviewnavigationwidgetfactory.cpp",
- "classviewnavigationwidgetfactory.h",
- "classviewparser.cpp",
- "classviewparser.h",
- "classviewparsertreeitem.cpp",
- "classviewparsertreeitem.h",
- "classviewplugin.cpp",
- "classviewplugin.h",
- "classviewsymbolinformation.cpp",
- "classviewsymbolinformation.h",
- "classviewsymbollocation.cpp",
- "classviewsymbollocation.h",
- "classviewtreeitemmodel.cpp",
- "classviewtreeitemmodel.h",
- "classviewutils.cpp",
- "classviewutils.h",
+ "classviewmanager.cpp", "classviewmanager.h",
+ "classviewnavigationwidget.cpp", "classviewnavigationwidget.h", "classviewnavigationwidget.ui",
+ "classviewnavigationwidgetfactory.cpp", "classviewnavigationwidgetfactory.h",
+ "classviewparser.cpp", "classviewparser.h",
+ "classviewparsertreeitem.cpp", "classviewparsertreeitem.h",
+ "classviewplugin.cpp", "classviewplugin.h",
+ "classviewsymbolinformation.cpp", "classviewsymbolinformation.h",
+ "classviewsymbollocation.cpp", "classviewsymbollocation.h",
+ "classviewtreeitemmodel.cpp", "classviewtreeitemmodel.h",
+ "classviewutils.cpp", "classviewutils.h",
]
}
diff --git a/src/plugins/clearcase/clearcasecontrol.cpp b/src/plugins/clearcase/clearcasecontrol.cpp
index 3026262389..1fc377a584 100644
--- a/src/plugins/clearcase/clearcasecontrol.cpp
+++ b/src/plugins/clearcase/clearcasecontrol.cpp
@@ -57,6 +57,10 @@ Core::Id ClearCaseControl::id() const
bool ClearCaseControl::isConfigured() const
{
+#ifdef WITH_TESTS
+ if (m_plugin->isFakeCleartool())
+ return true;
+#endif
const QString binary = m_plugin->settings().ccBinaryPath;
if (binary.isEmpty())
return false;
@@ -83,12 +87,23 @@ bool ClearCaseControl::supportsOperation(Operation operation) const
return rc;
}
-Core::IVersionControl::OpenSupportMode ClearCaseControl::openSupportMode() const
+Core::IVersionControl::OpenSupportMode ClearCaseControl::openSupportMode(const QString &fileName) const
{
- if (m_plugin->isDynamic())
- return IVersionControl::OpenMandatory; // Checkout is the only option for dynamic views
- else
+ if (m_plugin->isDynamic()) {
+ // NB! Has to use managesFile() and not vcsStatus() since the index can only be guaranteed
+ // to be up to date if the file has been explicitly opened, which is not the case when
+ // doing a search and replace as a part of a refactoring.
+ if (m_plugin->managesFile(QFileInfo(fileName).absolutePath(), fileName)) {
+ // Checkout is the only option for managed files in dynamic views
+ return IVersionControl::OpenMandatory;
+ } else {
+ // Not managed files can be edited without noticing the VCS
+ return IVersionControl::NoOpen;
+ }
+
+ } else {
return IVersionControl::OpenOptional; // Snapshot views supports Hijack and check out
+ }
}
bool ClearCaseControl::vcsOpen(const QString &fileName)
@@ -153,6 +168,8 @@ QString ClearCaseControl::vcsOpenText() const
QString ClearCaseControl::vcsMakeWritableText() const
{
+ if (m_plugin->isDynamic())
+ return QString();
return tr("&Hijack");
}
diff --git a/src/plugins/clearcase/clearcasecontrol.h b/src/plugins/clearcase/clearcasecontrol.h
index f94ee44052..794cd8b2b4 100644
--- a/src/plugins/clearcase/clearcasecontrol.h
+++ b/src/plugins/clearcase/clearcasecontrol.h
@@ -53,7 +53,7 @@ public:
bool isConfigured() const;
bool supportsOperation(Operation operation) const;
- OpenSupportMode openSupportMode() const;
+ OpenSupportMode openSupportMode(const QString &fileName) const;
bool vcsOpen(const QString &fileName);
SettingsFlags settingsFlags() const;
bool vcsAdd(const QString &fileName);
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index dd78679704..bc9750c61b 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -48,6 +48,7 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
+#include <coreplugin/infobar.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/progressmanager/progressmanager.h>
@@ -186,6 +187,9 @@ ClearCasePlugin::ClearCasePlugin() :
m_submitActionTriggered(false),
m_activityMutex(new QMutex),
m_statusMap(new StatusMap)
+ #ifdef WITH_TESTS
+ ,m_fakeClearTool(false)
+ #endif
{
qRegisterMetaType<ClearCase::Internal::FileStatus::Status>("ClearCase::Internal::FileStatus::Status");
}
@@ -236,6 +240,76 @@ QString ClearCasePlugin::getDriveLetterOfPath(const QString &directory)
return dir.path();
}
+void ClearCasePlugin::updateStatusForFile(const QString &absFile)
+{
+ setStatus(absFile, getFileStatus(absFile), false);
+}
+
+/// Give warning if a derived object is edited
+void ClearCasePlugin::updateEditDerivedObjectWarning(const QString &fileName,
+ const FileStatus::Status status)
+{
+ if (!isDynamic())
+ return;
+
+ Core::IDocument *curDocument = Core::EditorManager::currentDocument();
+ if (!curDocument)
+ return;
+
+ Core::InfoBar *infoBar = curDocument->infoBar();
+ const Core::Id derivedObjectWarning("ClearCase.DerivedObjectWarning");
+
+ if (status == FileStatus::Derived) {
+ if (!infoBar->canInfoBeAdded(derivedObjectWarning))
+ return;
+
+ infoBar->addInfo(Core::InfoBarEntry(derivedObjectWarning,
+ tr("Editing Derived Object: %1")
+ .arg(fileName)));
+ } else {
+ infoBar->removeInfo(derivedObjectWarning);
+ }
+}
+
+FileStatus::Status ClearCasePlugin::getFileStatus(const QString &fileName) const
+{
+ QTC_CHECK(!fileName.isEmpty());
+
+ const QDir viewRootDir = QFileInfo(fileName).dir();
+ const QString viewRoot = viewRootDir.path();
+
+ QStringList args(QLatin1String("ls"));
+ args << fileName;
+ QString buffer = runCleartoolSync(viewRoot, args);
+
+ const int atatpos = buffer.indexOf(QLatin1String("@@"));
+ if (atatpos != -1) { // probably a managed file
+ const QString absFile =
+ viewRootDir.absoluteFilePath(
+ QDir::fromNativeSeparators(buffer.left(atatpos)));
+ QTC_CHECK(QFile(absFile).exists());
+ QTC_CHECK(!absFile.isEmpty());
+
+ // "cleartool ls" of a derived object looks like this:
+ // /path/to/file/export/MyFile.h@@--11-13T19:52.266580
+ const QChar c = buffer.at(atatpos + 2);
+ const bool isDerivedObject = c != QLatin1Char('/') && c != QLatin1Char('\\');
+ if (isDerivedObject)
+ return FileStatus::Derived;
+
+ // find first whitespace. anything before that is not interesting
+ const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
+ if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
+ return FileStatus::CheckedOut;
+ else
+ return FileStatus::CheckedIn;
+ } else {
+ QTC_CHECK(QFile(fileName).exists());
+ QTC_CHECK(!fileName.isEmpty());
+ return FileStatus::NotManaged;
+ }
+}
+
///
/// Check if the directory is managed by ClearCase.
///
@@ -483,12 +557,14 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
clearcaseMenu->addSeparator(globalcontext);
m_diffActivityAction = new QAction(tr("Diff A&ctivity..."), this);
+ m_diffActivityAction->setEnabled(false);
command = ActionManager::registerAction(m_diffActivityAction, CMD_ID_DIFF_ACTIVITY, globalcontext);
connect(m_diffActivityAction, SIGNAL(triggered()), this, SLOT(diffActivity()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_checkInActivityAction = new Utils::ParameterAction(tr("Ch&eck In Activity"), tr("Chec&k In Activity \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
+ m_checkInActivityAction->setEnabled(false);
command = ActionManager::registerAction(m_checkInActivityAction, CMD_ID_CHECKIN_ACTIVITY, globalcontext);
connect(m_checkInActivityAction, SIGNAL(triggered()), this, SLOT(startCheckInActivity()));
command->setAttribute(Command::CA_UpdateText);
@@ -671,7 +747,16 @@ QStringList ClearCasePlugin::ccGetActiveVobs() const
return res;
}
-// file must be relative to topLevel, and using '/' path separator
+void ClearCasePlugin::checkAndReIndexUnknownFile(const QString &file)
+{
+ if (isDynamic()) {
+ // reindex unknown files
+ if (m_statusMap->value(file, FileStatus(FileStatus::Unknown)).status == FileStatus::Unknown)
+ updateStatusForFile(file);
+ }
+}
+
+// file must be absolute, and using '/' path separator
FileStatus ClearCasePlugin::vcsStatus(const QString &file) const
{
return m_statusMap->value(file, FileStatus(FileStatus::Unknown));
@@ -700,16 +785,41 @@ ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString
return submitEditor;
}
+QString fileStatusToText(FileStatus fileStatus)
+{
+ switch (fileStatus.status)
+ {
+ case FileStatus::CheckedIn:
+ return QLatin1String("CheckedIn");
+ case FileStatus::CheckedOut:
+ return QLatin1String("CheckedOut");
+ case FileStatus::Hijacked:
+ return QLatin1String("Hijacked");
+ case FileStatus::Missing:
+ return QLatin1String("Missing");
+ case FileStatus::NotManaged:
+ return QLatin1String("ViewPrivate");
+ case FileStatus::Unknown:
+ return QLatin1String("Unknown");
+ default:
+ return QLatin1String("default");
+ }
+}
+
void ClearCasePlugin::updateStatusActions()
{
FileStatus fileStatus = FileStatus::Unknown;
bool hasFile = currentState().hasFile();
if (hasFile) {
QString absoluteFileName = currentState().currentFile();
- fileStatus = m_statusMap->value(absoluteFileName, FileStatus(FileStatus::Unknown));
+ checkAndReIndexUnknownFile(absoluteFileName);
+ fileStatus = vcsStatus(absoluteFileName);
+
+ updateEditDerivedObjectWarning(absoluteFileName, fileStatus.status);
if (Constants::debug)
- qDebug() << Q_FUNC_INFO << absoluteFileName << ", status = " << fileStatus.status;
+ qDebug() << Q_FUNC_INFO << absoluteFileName << ", status = "
+ << fileStatusToText(fileStatus.status) << "(" << fileStatus.status << ")";
}
m_checkOutAction->setEnabled(hasFile && (fileStatus.status & (FileStatus::CheckedIn | FileStatus::Hijacked)));
@@ -717,6 +827,9 @@ void ClearCasePlugin::updateStatusActions()
m_undoHijackAction->setEnabled(!m_viewData.isDynamic && hasFile && (fileStatus.status & FileStatus::Hijacked));
m_checkInCurrentAction->setEnabled(hasFile && (fileStatus.status & FileStatus::CheckedOut));
m_addFileAction->setEnabled(hasFile && (fileStatus.status & FileStatus::NotManaged));
+ m_diffCurrentAction->setEnabled(hasFile && (fileStatus.status != FileStatus::NotManaged));
+ m_historyCurrentAction->setEnabled(hasFile && (fileStatus.status != FileStatus::NotManaged));
+ m_annotateCurrentAction->setEnabled(hasFile && (fileStatus.status != FileStatus::NotManaged));
m_checkInActivityAction->setEnabled(m_viewData.isUcm);
m_diffActivityAction->setEnabled(m_viewData.isUcm);
@@ -746,6 +859,7 @@ void ClearCasePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
m_annotateCurrentAction->setParameter(fileName);
m_addFileAction->setParameter(fileName);
m_updateIndexAction->setEnabled(!m_settings.disableIndexer);
+
updateStatusActions();
}
@@ -766,6 +880,7 @@ void ClearCasePlugin::addCurrentFile()
// Set the FileStatus of file given in absolute path
void ClearCasePlugin::setStatus(const QString &file, FileStatus::Status status, bool update)
{
+ QTC_CHECK(!file.isEmpty());
m_statusMap->insert(file, FileStatus(status, QFileInfo(file).permissions()));
if (update && currentState().currentFile() == file)
@@ -904,7 +1019,7 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
if ((m_settings.diffType == GraphicalDiff) && (files.count() == 1)) {
const QString file = files.first();
const QString absFilePath = workingDir + QLatin1Char('/') + file;
- if (m_statusMap->value(absFilePath).status == FileStatus::Hijacked)
+ if (vcsStatus(absFilePath).status == FileStatus::Hijacked)
diffGraphical(ccGetFileVersion(workingDir, file), file);
else
diffGraphical(file);
@@ -918,7 +1033,7 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis
QString result;
foreach (const QString &file, files) {
const QString absFilePath = workingDir + QLatin1Char('/') + file;
- if (m_statusMap->value(QDir::fromNativeSeparators(absFilePath)).status == FileStatus::Hijacked)
+ if (vcsStatus(QDir::fromNativeSeparators(absFilePath)).status == FileStatus::Hijacked)
result += diffExternal(ccGetFileVersion(workingDir, file), file);
else
result += diffExternal(file);
@@ -1210,7 +1325,8 @@ void ClearCasePlugin::viewStatus()
m_viewData = ccGetView(m_topLevel);
QTC_ASSERT(!m_viewData.name.isEmpty() && !m_settings.disableIndexer, return);
VcsBase::VcsBaseOutputWindow *outputwindow = VcsBase::VcsBaseOutputWindow::instance();
- outputwindow->appendCommand(QLatin1String("Indexed files status (C=Checked Out, H=Hijacked, ?=Missing)"));
+ outputwindow->appendCommand(QLatin1String("Indexed files status (C=Checked Out, "
+ "H=Hijacked, ?=Missing)"));
bool anymod = false;
for (StatusMap::ConstIterator it = m_statusMap->constBegin();
it != m_statusMap->constEnd();
@@ -1456,14 +1572,14 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
CheckOutDialog coDialog(title, m_viewData.isUcm);
if (!m_settings.disableIndexer &&
- (fi.isWritable() || m_statusMap->value(absPath).status == FileStatus::Unknown))
+ (fi.isWritable() || vcsStatus(absPath).status == FileStatus::Unknown))
QtConcurrent::run(&sync, QStringList(absPath)).waitForFinished();
- if (m_statusMap->value(absPath).status == FileStatus::CheckedOut) {
+ if (vcsStatus(absPath).status == FileStatus::CheckedOut) {
QMessageBox::information(0, tr("ClearCase Checkout"), tr("File is already checked out."));
return true;
}
// Only snapshot views can have hijacked files
- bool isHijacked = (!m_viewData.isDynamic && (m_statusMap->value(absPath).status & FileStatus::Hijacked));
+ bool isHijacked = (!m_viewData.isDynamic && (vcsStatus(absPath).status & FileStatus::Hijacked));
if (!isHijacked)
coDialog.hideHijack();
if (coDialog.exec() == QDialog::Accepted) {
@@ -1735,7 +1851,13 @@ QString ClearCasePlugin::vcsGetRepositoryURL(const QString & /*directory*/)
///
bool ClearCasePlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
{
+#ifdef WITH_TESTS
+ // If running with tests and fake ClearTool is enabled, then pretend we manage every directory
+ QString topLevelFound = m_fakeClearTool ? directory : findTopLevel(directory);
+#else
QString topLevelFound = findTopLevel(directory);
+#endif
+
if (topLevel)
*topLevel = topLevelFound;
return !topLevelFound.isEmpty();
@@ -1852,9 +1974,9 @@ bool ClearCasePlugin::ccCheckUcm(const QString &viewname, const QString &working
bool ClearCasePlugin::managesFile(const QString &workingDirectory, const QString &fileName) const
{
- QStringList args;
- args << QLatin1String("ls") << fileName;
- return runCleartoolSync(workingDirectory, args).contains(QLatin1String("@@"));
+ QString absFile = QFileInfo(QDir(workingDirectory), fileName).absoluteFilePath();
+ const FileStatus::Status status = getFileStatus(absFile);
+ return status != FileStatus::NotManaged && status != FileStatus::Derived;
}
ViewData ClearCasePlugin::ccGetView(const QString &workingDir) const
@@ -2117,6 +2239,233 @@ void ClearCasePlugin::testLogResolving()
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9",
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8");
}
+
+void ClearCasePlugin::initTestCase()
+{
+ m_tempFile = QDir::currentPath() + QLatin1String("/cc_file.cpp");
+ Utils::FileSaver srcSaver(m_tempFile);
+ srcSaver.write(QByteArray());
+ srcSaver.finalize();
+}
+
+void ClearCasePlugin::cleanupTestCase()
+{
+ QVERIFY(QFile::remove(m_tempFile));
+}
+
+void ClearCasePlugin::testFileStatusParsing_data()
+{
+ QTest::addColumn<QString>("filename");
+ QTest::addColumn<QString>("cleartoolLsLine");
+ QTest::addColumn<int>("status");
+
+ QTest::newRow("CheckedOut")
+ << m_tempFile
+ << QString(m_tempFile + QLatin1String("@@/main/branch1/CHECKEDOUT from /main/branch1/0 Rule: CHECKEDOUT"))
+ << static_cast<int>(FileStatus::CheckedOut);
+
+ QTest::newRow("CheckedIn")
+ << m_tempFile
+ << QString(m_tempFile + QLatin1String("@@/main/9 Rule: MY_LABEL_1.6.4 [-mkbranch branch1]"))
+ << static_cast<int>(FileStatus::CheckedIn);
+
+ QTest::newRow("Hijacked")
+ << m_tempFile
+ << QString(m_tempFile + QLatin1String("@@/main/9 [hijacked] Rule: MY_LABEL_1.5.33 [-mkbranch myview1]"))
+ << static_cast<int>(FileStatus::Hijacked);
+
+
+ QTest::newRow("Missing")
+ << m_tempFile
+ << QString(m_tempFile + QLatin1String("@@/main/9 [loaded but missing] Rule: MY_LABEL_1.5.33 [-mkbranch myview1]"))
+ << static_cast<int>(FileStatus::Missing);
+}
+
+void ClearCasePlugin::testFileStatusParsing()
+{
+ ClearCasePlugin *plugin = ClearCasePlugin::instance();
+ plugin->m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+
+ QFETCH(QString, filename);
+ QFETCH(QString, cleartoolLsLine);
+ QFETCH(int, status);
+
+ ClearCaseSync ccSync(plugin, plugin->m_statusMap);
+ ccSync.verifyParseStatus(filename, cleartoolLsLine, static_cast<FileStatus::Status>(status));
+}
+
+void ClearCasePlugin::testFileNotManaged()
+{
+ ClearCasePlugin *plugin = ClearCasePlugin::instance();
+ plugin->m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+ ClearCaseSync ccSync(plugin, plugin->m_statusMap);
+ ccSync.verifyFileNotManaged();
+}
+
+void ClearCasePlugin::testFileCheckedOutDynamicView()
+{
+ ClearCasePlugin *plugin = ClearCasePlugin::instance();
+ plugin->m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+
+ ClearCaseSync ccSync(plugin, plugin->m_statusMap);
+ ccSync.verifyFileCheckedOutDynamicView();
+}
+
+void ClearCasePlugin::testFileCheckedInDynamicView()
+{
+ ClearCasePlugin *plugin = ClearCasePlugin::instance();
+ plugin->m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+ ClearCaseSync ccSync(plugin, plugin->m_statusMap);
+ ccSync.verifyFileCheckedInDynamicView();
+}
+
+void ClearCasePlugin::testFileNotManagedDynamicView()
+{
+ ClearCasePlugin *plugin = ClearCasePlugin::instance();
+ plugin->m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+ ClearCaseSync ccSync(plugin, plugin->m_statusMap);
+ ccSync.verifyFileNotManagedDynamicView();
+}
+
+namespace {
+/**
+ * @brief Convenience class which also properly cleans up editors and temp files
+ */
+class TestCase
+{
+public:
+ TestCase(const QString &fileName) :
+ m_fileName(fileName) ,
+ m_editor(0)
+ {
+ ClearCasePlugin::instance()->setFakeCleartool(true);
+ Utils::FileSaver srcSaver(fileName);
+ srcSaver.write(QByteArray());
+ srcSaver.finalize();
+
+ m_editor = Core::EditorManager::openEditor(fileName);
+
+ QCoreApplication::processEvents(); // process any pending events
+ }
+
+ ViewData dummyViewData() const
+ {
+ ViewData viewData;
+ viewData.name = QLatin1String("fake_view");
+ viewData.root = QDir::currentPath();
+ viewData.isUcm = false;
+ return viewData;
+ }
+
+ ~TestCase()
+ {
+ Core::EditorManager::closeEditor(m_editor, false);
+ QCoreApplication::processEvents(); // process any pending events
+
+ QFile file(m_fileName);
+ if (!file.isWritable()) // Windows can't delete read only files
+ file.setPermissions(file.permissions() | QFile::WriteUser);
+ QVERIFY(file.remove());
+ ClearCasePlugin::instance()->setFakeCleartool(false);
+ }
+
+private:
+ QString m_fileName;
+ Core::IEditor *m_editor;
+};
+}
+
+void ClearCasePlugin::testStatusActions_data()
+{
+ QTest::addColumn<int>("status");
+ QTest::addColumn<bool>("checkOutAction");
+ QTest::addColumn<bool>("undoCheckOutAction");
+ QTest::addColumn<bool>("undoHijackAction");
+ QTest::addColumn<bool>("checkInCurrentAction");
+ QTest::addColumn<bool>("addFileAction");
+ QTest::addColumn<bool>("checkInActivityAction");
+ QTest::addColumn<bool>("diffActivityAction");
+
+ QTest::newRow("Unknown") << static_cast<int>(FileStatus::Unknown)
+ << true << true << true << true << true << false << false;
+ QTest::newRow("CheckedOut") << static_cast<int>(FileStatus::CheckedOut)
+ << false << true << false << true << false << false << false;
+ QTest::newRow("CheckedIn") << static_cast<int>(FileStatus::CheckedIn)
+ << true << false << false << false << false << false << false;
+ QTest::newRow("NotManaged") << static_cast<int>(FileStatus::NotManaged)
+ << false << false << false << false << true << false << false;
+}
+
+void ClearCasePlugin::testStatusActions()
+{
+ const QString fileName = QDir::currentPath() + QLatin1String("/clearcase_file.cpp");
+ TestCase testCase(fileName);
+
+ m_viewData = testCase.dummyViewData();
+
+ QFETCH(int, status);
+ FileStatus::Status tempStatus = static_cast<FileStatus::Status>(status);
+
+ // special case: file should appear as "Unknown" since there is no entry in the index
+ // and we don't want to explicitly set the status for this test case
+ if (tempStatus != FileStatus::Unknown)
+ setStatus(fileName, tempStatus, true);
+
+ QFETCH(bool, checkOutAction);
+ QFETCH(bool, undoCheckOutAction);
+ QFETCH(bool, undoHijackAction);
+ QFETCH(bool, checkInCurrentAction);
+ QFETCH(bool, addFileAction);
+ QFETCH(bool, checkInActivityAction);
+ QFETCH(bool, diffActivityAction);
+
+ QCOMPARE(m_checkOutAction->isEnabled(), checkOutAction);
+ QCOMPARE(m_undoCheckOutAction->isEnabled(), undoCheckOutAction);
+ QCOMPARE(m_undoHijackAction->isEnabled(), undoHijackAction);
+ QCOMPARE(m_checkInCurrentAction->isEnabled(), checkInCurrentAction);
+ QCOMPARE(m_addFileAction->isEnabled(), addFileAction);
+ QCOMPARE(m_checkInActivityAction->isEnabled(), checkInActivityAction);
+ QCOMPARE(m_diffActivityAction->isEnabled(), diffActivityAction);
+}
+
+void ClearCasePlugin::testVcsStatusDynamicReadonlyNotManaged()
+{
+ // File is not in map, and is read-only
+ ClearCasePlugin::instance();
+ m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+
+ const QString fileName = QDir::currentPath() + QLatin1String("/readonly_notmanaged_file.cpp");
+
+ m_viewData.isDynamic = true;
+ TestCase testCase(fileName);
+
+ QFile::setPermissions(fileName, QFile::ReadOwner |
+ QFile::ReadUser |
+ QFile::ReadGroup |
+ QFile::ReadOther);
+
+ m_viewData = testCase.dummyViewData();
+ m_viewData.isDynamic = true;
+
+ QCOMPARE(vcsStatus(fileName).status, FileStatus::NotManaged);
+
+}
+
+void ClearCasePlugin::testVcsStatusDynamicNotManaged()
+{
+ ClearCasePlugin::instance();
+ m_statusMap = QSharedPointer<StatusMap>(new StatusMap);
+
+ const QString fileName = QDir::currentPath() + QLatin1String("/notmanaged_file.cpp");
+
+ m_viewData.isDynamic = true;
+ TestCase testCase(fileName);
+
+ m_viewData = testCase.dummyViewData();
+ m_viewData.isDynamic = true;
+
+ QCOMPARE(vcsStatus(fileName).status, FileStatus::NotManaged);
+}
#endif
} // namespace Internal
diff --git a/src/plugins/clearcase/clearcaseplugin.h b/src/plugins/clearcase/clearcaseplugin.h
index 929844197a..3f263e67f6 100644
--- a/src/plugins/clearcase/clearcaseplugin.h
+++ b/src/plugins/clearcase/clearcaseplugin.h
@@ -89,7 +89,8 @@ public:
CheckedOut = 0x02,
Hijacked = 0x04,
NotManaged = 0x08,
- Missing = 0x10
+ Missing = 0x10,
+ Derived = 0x20
} status;
QFile::Permissions permissions;
@@ -158,6 +159,7 @@ public:
bool ccFileOp(const QString &workingDir, const QString &title, const QStringList &args,
const QString &fileName, const QString &file2 = QString());
FileStatus vcsStatus(const QString &file) const;
+ void checkAndReIndexUnknownFile(const QString &file);
QString currentView() const { return m_viewData.name; }
QString viewRoot() const { return m_viewData.root; }
void refreshActivities();
@@ -167,6 +169,10 @@ public:
bool ccCheckUcm(const QString &viewname, const QString &workingDir) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
+#ifdef WITH_TESTS
+ inline void setFakeCleartool(const bool b = true) { m_fakeClearTool = b; }
+ inline bool isFakeCleartool() const { return m_fakeClearTool; }
+#endif
public slots:
void vcsAnnotate(const QString &workingDir, const QString &file,
@@ -199,9 +205,21 @@ private slots:
void closing();
void updateStatusActions();
#ifdef WITH_TESTS
+ void initTestCase();
+ void cleanupTestCase();
void testDiffFileResolving_data();
void testDiffFileResolving();
void testLogResolving();
+ void testFileStatusParsing_data();
+ void testFileStatusParsing();
+ void testFileNotManaged();
+ void testFileCheckedOutDynamicView();
+ void testFileCheckedInDynamicView();
+ void testFileNotManagedDynamicView();
+ void testStatusActions_data();
+ void testStatusActions();
+ void testVcsStatusDynamicReadonlyNotManaged();
+ void testVcsStatusDynamicNotManaged();
#endif
protected:
@@ -244,6 +262,10 @@ private:
int timeOut, QTextCodec *outputCodec = 0);
static QString getDriveLetterOfPath(const QString &directory);
+ FileStatus::Status getFileStatus(const QString &fileName) const;
+ void updateStatusForFile(const QString &absFile);
+ void updateEditDerivedObjectWarning(const QString &fileName, const FileStatus::Status status);
+
ClearCaseSettings m_settings;
QString m_checkInMessageFileName;
@@ -282,6 +304,10 @@ private:
QSharedPointer<StatusMap> m_statusMap;
static ClearCasePlugin *m_clearcasePluginInstance;
+#ifdef WITH_TESTS
+ bool m_fakeClearTool;
+ QString m_tempFile;
+#endif
};
} // namespace Internal
diff --git a/src/plugins/clearcase/clearcasesync.cpp b/src/plugins/clearcase/clearcasesync.cpp
index ac965eec93..769c4707bd 100644
--- a/src/plugins/clearcase/clearcasesync.cpp
+++ b/src/plugins/clearcase/clearcasesync.cpp
@@ -34,6 +34,12 @@
#include <QFutureInterface>
#include <QProcess>
#include <QStringList>
+#include <utils/qtcassert.h>
+
+#ifdef WITH_TESTS
+#include <QTest>
+#include <utils/fileutils.h>
+#endif
namespace ClearCase {
namespace Internal {
@@ -44,60 +50,108 @@ ClearCaseSync::ClearCaseSync(ClearCasePlugin *plugin, QSharedPointer<StatusMap>
{
}
-void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
+QStringList ClearCaseSync::updateStatusHotFiles(const QString &viewRoot, int &total)
{
- ClearCaseSettings settings = m_plugin->settings();
- const QString program = settings.ccBinaryPath;
- if (program.isEmpty())
- return;
- int total = files.size();
- const bool hot = (total < 10);
- int processed = 0;
- QString view = m_plugin->currentView();
- if (view.isEmpty())
- emit updateStreamAndView();
- if (!hot)
- total = settings.totalFiles.value(view, total);
+ QStringList hotFiles;
+ // find all files whose permissions changed OR hijacked files
+ // (might have become checked out)
+ const StatusMap::Iterator send = m_statusMap->end();
+ for (StatusMap::Iterator it = m_statusMap->begin(); it != send; ++it) {
+ const QFileInfo fi(viewRoot, it.key());
+ const bool permChanged = it.value().permissions != fi.permissions();
+ if (permChanged || it.value().status == FileStatus::Hijacked) {
+ hotFiles.append(it.key());
+ it.value().status = FileStatus::Unknown;
+ ++total;
+ }
+ }
+ return hotFiles;
+}
- // refresh activities list
- if (m_plugin->isUcm())
- m_plugin->refreshActivities();
+// Set status for all files to unknown until we're done indexing
+void ClearCaseSync::invalidateStatus(const QDir &viewRootDir,
+ const QStringList &files)
+{
+ foreach (const QString &file, files) {
+ m_plugin->setStatus(viewRootDir.absoluteFilePath(file), FileStatus::Unknown, false);
+ }
+}
- if (settings.disableIndexer)
+void ClearCaseSync::invalidateStatusAllFiles()
+{
+ const StatusMap::ConstIterator send = m_statusMap->end();
+ for (StatusMap::ConstIterator it = m_statusMap->begin(); it != send; ++it)
+ m_plugin->setStatus(it.key(), FileStatus::Unknown, false);
+}
+
+void ClearCaseSync::processCleartoolLsLine(const QDir &viewRootDir, const QString &buffer)
+{
+ const int atatpos = buffer.indexOf(QLatin1String("@@"));
+
+ if (atatpos == -1)
return;
- const bool isDynamic = m_plugin->isDynamic();
+ // find first whitespace. anything before that is not interesting
+ const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
+ const QString absFile =
+ viewRootDir.absoluteFilePath(
+ QDir::fromNativeSeparators(buffer.left(atatpos)));
+ QTC_CHECK(QFile(absFile).exists());
+ QTC_CHECK(!absFile.isEmpty());
+
+ QString ccState;
+ const QRegExp reState(QLatin1String("^\\s*\\[[^\\]]*\\]")); // [hijacked]; [loaded but missing]
+ if (reState.indexIn(buffer, wspos + 1, QRegExp::CaretAtOffset) != -1) {
+ ccState = reState.cap();
+ if (ccState.indexOf(QLatin1String("hijacked")) != -1)
+ m_plugin->setStatus(absFile, FileStatus::Hijacked, true);
+ else if (ccState.indexOf(QLatin1String("loaded but missing")) != -1)
+ m_plugin->setStatus(absFile, FileStatus::Missing, false);
+ }
+ else if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
+ m_plugin->setStatus(absFile, FileStatus::CheckedOut, true);
+ // don't care about checked-in files not listed in project
+ else if (m_statusMap->contains(absFile))
+ m_plugin->setStatus(absFile, FileStatus::CheckedIn, true);
+}
+
+void ClearCaseSync::updateTotalFilesCount(const QString view, ClearCaseSettings settings,
+ const int processed)
+{
+ settings = m_plugin->settings(); // Might have changed while task was running
+ settings.totalFiles[view] = processed;
+ m_plugin->setSettings(settings);
+}
+
+void ClearCaseSync::updateStatusForNotManagedFiles(const QStringList &files)
+{
+ foreach (const QString &file, files) {
+ QString absFile = QFileInfo(file).absoluteFilePath();
+ if (!m_statusMap->contains(absFile))
+ m_plugin->setStatus(absFile, FileStatus::NotManaged, false);
+ }
+}
+
+void ClearCaseSync::syncSnapshotView(QFutureInterface<void> &future, QStringList &files,
+ const ClearCaseSettings &settings)
+{
+ QString view = m_plugin->currentView();
+
+ int totalFileCount = files.size();
+ const bool hot = (totalFileCount < 10);
+ int processed = 0;
+ if (!hot)
+ totalFileCount = settings.totalFiles.value(view, totalFileCount);
+
const QString viewRoot = m_plugin->viewRoot();
const QDir viewRootDir(viewRoot);
QStringList args(QLatin1String("ls"));
if (hot) {
- // find all files whose permissions changed OR hijacked files
- // (might have become checked out)
- const StatusMap::Iterator send = m_statusMap->end();
- for (StatusMap::Iterator it = m_statusMap->begin(); it != send; ++it) {
- const QFileInfo fi(viewRoot, it.key());
- const bool permChanged = it.value().permissions != fi.permissions();
- if (permChanged || it.value().status == FileStatus::Hijacked) {
- files.append(it.key());
- it.value().status = FileStatus::Unknown;
- ++total;
- } else if (isDynamic && !fi.isWritable()) { // assume a read only file is checked in
- it.value().status = FileStatus::CheckedIn;
- ++total;
- }
- }
+ files << updateStatusHotFiles(viewRoot, totalFileCount);
args << files;
} else {
- foreach (const QString &file, files) {
- if (isDynamic) { // assume a read only file is checked in
- const QFileInfo fi(viewRootDir, file);
- if (!fi.isWritable())
- m_plugin->setStatus(fi.absoluteFilePath(), FileStatus::CheckedIn, false);
- } else {
- m_plugin->setStatus(viewRootDir.absoluteFilePath(file), FileStatus::Unknown, false);
- }
- }
+ invalidateStatus(viewRootDir, files);
args << QLatin1String("-recurse");
QStringList vobs;
@@ -111,10 +165,12 @@ void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
// adding 1 for initial sync in which total is not accurate, to prevent finishing
// (we don't want it to become green)
- future.setProgressRange(0, total + 1);
+ future.setProgressRange(0, totalFileCount + 1);
QProcess process;
process.setWorkingDirectory(viewRoot);
+ const QString program = settings.ccBinaryPath;
+
process.start(program, args);
if (!process.waitForStarted())
return;
@@ -124,55 +180,208 @@ void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
process.bytesAvailable() && !future.isCanceled())
{
const QString line = QString::fromLocal8Bit(process.readLine().constData());
-
buffer += line;
if (buffer.endsWith(QLatin1Char('\n')) || process.atEnd()) {
- const int atatpos = buffer.indexOf(QLatin1String("@@"));
- if (atatpos != -1) { // probably managed file
- // find first whitespace. anything before that is not interesting
- const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
- const QString absFile =
- viewRootDir.absoluteFilePath(
- QDir::fromNativeSeparators(buffer.left(atatpos)));
-
- QString ccState;
- const QRegExp reState(QLatin1String("^\\s*\\[[^\\]]*\\]")); // [hijacked]; [loaded but missing]
- if (reState.indexIn(buffer, wspos + 1, QRegExp::CaretAtOffset) != -1) {
- ccState = reState.cap();
- if (ccState.indexOf(QLatin1String("hijacked")) != -1)
- m_plugin->setStatus(absFile, FileStatus::Hijacked, true);
- else if (ccState.indexOf(QLatin1String("loaded but missing")) != -1)
- m_plugin->setStatus(absFile, FileStatus::Missing, false);
- }
- else if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
- m_plugin->setStatus(absFile, FileStatus::CheckedOut, true);
- // don't care about checked-in files not listed in project
- else if (m_statusMap->contains(absFile))
- m_plugin->setStatus(absFile, FileStatus::CheckedIn, true);
- }
+ processCleartoolLsLine(viewRootDir, buffer);
buffer.clear();
- future.setProgressValue(qMin(total, ++processed));
+ future.setProgressValue(qMin(totalFileCount, ++processed));
}
}
}
if (!future.isCanceled()) {
- foreach (const QString &file, files) {
- QString absFile = QFileInfo(file).absoluteFilePath();
- if (!m_statusMap->contains(absFile))
- m_plugin->setStatus(absFile, FileStatus::NotManaged, false);
- }
- future.setProgressValue(total + 1);
- if (!hot) {
- settings = m_plugin->settings(); // Might have changed while task was running
- settings.totalFiles[view] = processed;
- m_plugin->setSettings(settings);
+ updateStatusForNotManagedFiles(files);
+ future.setProgressValue(totalFileCount + 1);
+ if (!hot)
+ updateTotalFilesCount(view, settings, processed);
+ }
+
+ if (process.state() == QProcess::Running)
+ process.kill();
+
+ process.waitForFinished();
+}
+
+void ClearCaseSync::processCleartoolLscheckoutLine(const QString &buffer)
+{
+ QString absFile = buffer.trimmed();
+ m_plugin->setStatus(absFile, FileStatus::CheckedOut, true);
+}
+
+///
+/// Update the file status for dynamic views.
+///
+void ClearCaseSync::syncDynamicView(QFutureInterface<void> &future,
+ const ClearCaseSettings& settings)
+{
+ // Always invalidate status for all files
+ invalidateStatusAllFiles();
+
+ QStringList args(QLatin1String("lscheckout"));
+ args << QLatin1String("-avobs")
+ << QLatin1String("-me")
+ << QLatin1String("-cview")
+ << QLatin1String("-s");
+
+ const QString viewRoot = m_plugin->viewRoot();
+
+ QProcess process;
+ process.setWorkingDirectory(viewRoot);
+
+ const QString program = settings.ccBinaryPath;
+ process.start(program, args);
+ if (!process.waitForStarted())
+ return;
+
+ QString buffer;
+ int processed = 0;
+ while (process.waitForReadyRead() && !future.isCanceled()) {
+ while (process.state() == QProcess::Running &&
+ process.bytesAvailable() && !future.isCanceled()) {
+ const QString line = QString::fromLocal8Bit(process.readLine().constData());
+ buffer += line;
+ if (buffer.endsWith(QLatin1Char('\n')) || process.atEnd()) {
+ processCleartoolLscheckoutLine(buffer);
+ buffer.clear();
+ future.setProgressValue(++processed);
+ }
}
}
+
if (process.state() == QProcess::Running)
process.kill();
+
process.waitForFinished();
}
+void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
+{
+ ClearCaseSettings settings = m_plugin->settings();
+ if (settings.disableIndexer)
+ return;
+
+ const QString program = settings.ccBinaryPath;
+ if (program.isEmpty())
+ return;
+
+ // refresh activities list
+ if (m_plugin->isUcm())
+ m_plugin->refreshActivities();
+
+ QString view = m_plugin->currentView();
+ if (view.isEmpty())
+ emit updateStreamAndView();
+
+ if (m_plugin->isDynamic())
+ syncDynamicView(future, settings);
+ else
+ syncSnapshotView(future, files, settings);
+}
+
+#ifdef WITH_TESTS
+namespace {
+class TempFile
+{
+public:
+ TempFile(const QString &fileName)
+ : m_fileName(fileName)
+ {
+ Utils::FileSaver srcSaver(fileName);
+ srcSaver.write(QByteArray());
+ srcSaver.finalize();
+
+ }
+
+ QString fileName() const { return m_fileName; }
+
+ ~TempFile()
+ {
+ QVERIFY(QFile::remove(m_fileName));
+ }
+
+private:
+ const QString m_fileName;
+};
+}
+
+void ClearCaseSync::verifyParseStatus(const QString &fileName,
+ const QString &cleartoolLsLine,
+ const FileStatus::Status status)
+{
+ QCOMPARE(m_statusMap->count(), 0);
+ processCleartoolLsLine(QDir(QLatin1String("/")), cleartoolLsLine);
+
+ if (status == FileStatus::CheckedIn) {
+ // The algorithm doesn't store checked in files in the index, unless it was there already
+ QCOMPARE(m_statusMap->count(), 0);
+ QCOMPARE(m_statusMap->contains(fileName), false);
+ m_plugin->setStatus(fileName, FileStatus::Unknown, false);
+ processCleartoolLsLine(QDir(QLatin1String("/")), cleartoolLsLine);
+ }
+
+ QCOMPARE(m_statusMap->count(), 1);
+ QCOMPARE(m_statusMap->contains(fileName), true);
+ QCOMPARE(m_statusMap->value(fileName).status, status);
+
+ QCOMPARE(m_statusMap->contains(QLatin1String(("notexisting"))), false);
+}
+
+void ClearCaseSync::verifyFileNotManaged()
+{
+ QCOMPARE(m_statusMap->count(), 0);
+ TempFile temp(QDir::currentPath() + QLatin1String("/notmanaged.cpp"));
+ const QString fileName = temp.fileName();
+
+ updateStatusForNotManagedFiles(QStringList(fileName));
+
+ QCOMPARE(m_statusMap->count(), 1);
+
+ QCOMPARE(m_statusMap->contains(fileName), true);
+ QCOMPARE(m_statusMap->value(fileName).status, FileStatus::NotManaged);
+}
+
+void ClearCaseSync::verifyFileCheckedOutDynamicView()
+{
+ QCOMPARE(m_statusMap->count(), 0);
+
+ QString fileName(QLatin1String("/hello.C"));
+ processCleartoolLscheckoutLine(fileName);
+
+ QCOMPARE(m_statusMap->count(), 1);
+
+ QVERIFY(m_statusMap->contains(fileName));
+ QCOMPARE(m_statusMap->value(fileName).status, FileStatus::CheckedOut);
+
+ QVERIFY(!m_statusMap->contains(QLatin1String(("notexisting"))));
+}
+
+void ClearCaseSync::verifyFileCheckedInDynamicView()
+{
+ QCOMPARE(m_statusMap->count(), 0);
+
+ QString fileName(QLatin1String("/hello.C"));
+
+ // checked in files are not kept in the index
+ QCOMPARE(m_statusMap->count(), 0);
+ QCOMPARE(m_statusMap->contains(fileName), false);
+}
+
+void ClearCaseSync::verifyFileNotManagedDynamicView()
+{
+ QCOMPARE(m_statusMap->count(), 0);
+ TempFile temp(QDir::currentPath() + QLatin1String("/notmanaged.cpp"));
+ const QString fileName = temp.fileName();
+
+ updateStatusForNotManagedFiles(QStringList(fileName));
+
+ QCOMPARE(m_statusMap->count(), 1);
+
+ QVERIFY(m_statusMap->contains(fileName));
+ QCOMPARE(m_statusMap->value(fileName).status, FileStatus::NotManaged);
+}
+
+#endif
+
+
} // namespace Internal
} // namespace ClearCase
diff --git a/src/plugins/clearcase/clearcasesync.h b/src/plugins/clearcase/clearcasesync.h
index 31b109a3c9..1a4e4f9f77 100644
--- a/src/plugins/clearcase/clearcasesync.h
+++ b/src/plugins/clearcase/clearcasesync.h
@@ -42,12 +42,38 @@ public:
explicit ClearCaseSync(ClearCasePlugin *plugin, QSharedPointer<StatusMap> statusMap);
void run(QFutureInterface<void> &future, QStringList &files);
+ QStringList updateStatusHotFiles(const QString &viewRoot, int &total);
+ void invalidateStatus(const QDir &viewRootDir, const QStringList &files);
+ void invalidateStatusAllFiles();
+ void processCleartoolLsLine(const QDir &viewRootDir, const QString &buffer);
+ void updateTotalFilesCount(const QString view, ClearCaseSettings settings, const int processed);
+ void updateStatusForNotManagedFiles(const QStringList &files);
+
+ void syncDynamicView(QFutureInterface<void> &future,
+ const ClearCaseSettings &settings);
+ void syncSnapshotView(QFutureInterface<void> &future, QStringList &files,
+ const ClearCaseSettings &settings);
+
+ void processCleartoolLscheckoutLine(const QString &buffer);
signals:
void updateStreamAndView();
private:
ClearCasePlugin *m_plugin;
QSharedPointer<StatusMap> m_statusMap;
+
+public slots:
+#ifdef WITH_TESTS
+ void verifyParseStatus(const QString &fileName, const QString &cleartoolLsLine,
+ const FileStatus::Status);
+ void verifyFileNotManaged();
+
+ void verifyFileCheckedOutDynamicView();
+ void verifyFileCheckedInDynamicView();
+ void verifyFileNotManagedDynamicView();
+
+#endif
+
};
} // namespace Internal
diff --git a/src/plugins/clearcase/settingspage.cpp b/src/plugins/clearcase/settingspage.cpp
index 2dc0ad0019..e2816344b8 100644
--- a/src/plugins/clearcase/settingspage.cpp
+++ b/src/plugins/clearcase/settingspage.cpp
@@ -52,6 +52,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.setupUi(this);
m_ui.commandPathChooser->setPromptDialogTitle(tr("ClearCase Command"));
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
+ m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("ClearCase.Command.History"));
}
ClearCaseSettings SettingsPageWidget::settings() const
@@ -106,25 +107,6 @@ void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
m_ui.indexOnlyVOBsEdit->setText(s.indexOnlyVOBs);
}
-QString SettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc) << m_ui.commandLabel->text()
- << sep << m_ui.autoCheckOutCheckBox->text()
- << sep << m_ui.externalDiffRadioButton->text()
- << sep << m_ui.graphicalDiffRadioButton->text()
- << sep << m_ui.diffArgsLabel->text()
- << sep << m_ui.historyCountLabel->text()
- << sep << m_ui.promptCheckBox->text()
- << sep << m_ui.disableIndexerCheckBox->text()
- << sep << m_ui.timeOutLabel->text()
- << sep << m_ui.indexOnlyVOBsLabel->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
SettingsPage::SettingsPage() :
m_widget(0)
{
@@ -132,12 +114,11 @@ SettingsPage::SettingsPage() :
setDisplayName(tr("ClearCase"));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
+ if (!m_widget)
+ m_widget = new SettingsPageWidget;
m_widget->setSettings(ClearCasePlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
return m_widget;
}
@@ -145,8 +126,3 @@ void SettingsPage::apply()
{
ClearCasePlugin::instance()->setSettings(m_widget->settings());
}
-
-bool SettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
diff --git a/src/plugins/clearcase/settingspage.h b/src/plugins/clearcase/settingspage.h
index 9b40545c07..0cdacf2164 100644
--- a/src/plugins/clearcase/settingspage.h
+++ b/src/plugins/clearcase/settingspage.h
@@ -35,6 +35,8 @@
#include "ui_settingspage.h"
+#include <QPointer>
+
namespace ClearCase {
namespace Internal {
@@ -50,8 +52,6 @@ public:
ClearCaseSettings settings() const;
void setSettings(const ClearCaseSettings &);
- QString searchKeywords() const;
-
private:
Ui::SettingsPage m_ui;
};
@@ -64,14 +64,12 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish() { }
- bool matches(const QString &) const;
private:
- QString m_searchKeywords;
- SettingsPageWidget* m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace ClearCase
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index 3ae4a1e730..84e6c3eb52 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -68,7 +68,7 @@ CMakeEditor::CMakeEditor(CMakeEditorWidget *editor)
Core::IEditor *CMakeEditor::duplicate(QWidget *parent)
{
CMakeEditorWidget *w = qobject_cast<CMakeEditorWidget*>(widget());
- CMakeEditorWidget *ret = new CMakeEditorWidget(parent, w->factory(), w->actionHandler());
+ CMakeEditorWidget *ret = new CMakeEditorWidget(parent, w->factory());
ret->duplicateFrom(w);
TextEditor::TextEditorSettings::initializeEditor(ret);
return ret->editor();
@@ -116,8 +116,8 @@ void CMakeEditor::build()
// CMakeEditor
//
-CMakeEditorWidget::CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah)
- : BaseTextEditorWidget(parent), m_factory(factory), m_ah(ah)
+CMakeEditorWidget::CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory)
+ : BaseTextEditorWidget(parent), m_factory(factory)
{
QSharedPointer<CMakeDocument> doc(new CMakeDocument);
doc->setMimeType(QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE));
@@ -127,8 +127,6 @@ CMakeEditorWidget::CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factor
m_commentDefinition.clearCommentStyles();
m_commentDefinition.singleLine = QLatin1Char('#');
-
- ah->setupActions(this);
}
TextEditor::BaseTextEditor *CMakeEditorWidget::createEditor()
@@ -203,7 +201,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
- QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
+ QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h
index 55e7639a24..8f6f6a1f1d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.h
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h
@@ -71,12 +71,11 @@ class CMakeEditorWidget : public TextEditor::BaseTextEditorWidget
Q_OBJECT
public:
- CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory, TextEditor::TextEditorActionHandler *ah);
+ CMakeEditorWidget(QWidget *parent, CMakeEditorFactory *factory);
bool save(const QString &fileName = QString());
CMakeEditorFactory *factory() { return m_factory; }
- TextEditor::TextEditorActionHandler *actionHandler() const { return m_ah; }
Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true, bool inNextSplit = false);
@@ -89,7 +88,6 @@ public slots:
private:
CMakeEditorFactory *m_factory;
- TextEditor::TextEditorActionHandler *m_ah;
Utils::CommentDefinition m_commentDefinition;
};
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
index 7b7b32ae5a..fd16bf2d7d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
@@ -52,8 +52,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
- m_actionHandler =
- new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
+ new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor);
@@ -72,7 +71,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
{
- CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler);
+ CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this);
TextEditor::TextEditorSettings::initializeEditor(rc);
return rc->editor();
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
index aafa5a4875..7356b445fe 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
+++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
@@ -34,8 +34,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
-namespace TextEditor { class TextEditorActionHandler; }
-
namespace CMakeProjectManager {
namespace Internal {
@@ -50,7 +48,6 @@ public:
private:
const QStringList m_mimeTypes;
CMakeManager *m_manager;
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 68acc76aa6..e2adb85a99 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -92,6 +92,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
m_rootNode(new CMakeProjectNode(fileName)),
m_watcher(new QFileSystemWatcher(this))
{
+ setId(Constants::CMAKEPROJECT_ID);
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -349,7 +350,7 @@ bool CMakeProject::parseCMakeLists()
// This explicitly adds -I. to the include paths
part->includePaths += projectDirectory();
part->includePaths += cbpparser.includeFiles();
- part->defines += cbpparser.defines();
+ part->projectDefines += cbpparser.defines();
CppTools::ProjectFileAdder adder(part->files);
foreach (const QString &file, m_files)
@@ -512,11 +513,6 @@ QString CMakeProject::displayName() const
return m_projectName;
}
-Core::Id CMakeProject::id() const
-{
- return Core::Id(Constants::CMAKEPROJECT_ID);
-}
-
Core::IDocument *CMakeProject::document() const
{
return m_file;
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index c950575e0f..f89081bd43 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -80,7 +80,6 @@ public:
~CMakeProject();
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
CMakeManager *projectManager() const;
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index fe0c2561d0..556a8d88dc 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -291,22 +291,23 @@ QString CMakeSettingsPage::findCmakeExecutable() const
return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake"));
}
-QWidget *CMakeSettingsPage::createPage(QWidget *parent)
+QWidget *CMakeSettingsPage::widget()
{
- QWidget *outerWidget = new QWidget(parent);
- QFormLayout *formLayout = new QFormLayout(outerWidget);
- formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
- m_pathchooser = new Utils::PathChooser;
- m_pathchooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
- formLayout->addRow(tr("Executable:"), m_pathchooser);
- formLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+ if (!m_widget) {
+ m_widget = new QWidget;
+ QFormLayout *formLayout = new QFormLayout(m_widget);
+ formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
+ m_pathchooser = new Utils::PathChooser;
+ m_pathchooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ formLayout->addRow(tr("Executable:"), m_pathchooser);
+ formLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+
+ m_preferNinja = new QCheckBox(tr("Prefer Ninja generator (CMake 2.8.9 or higher required)"));
+ formLayout->addRow(m_preferNinja);
+ }
m_pathchooser->setPath(m_cmakeValidatorForUser.cmakeExecutable());
-
- m_preferNinja = new QCheckBox(tr("Prefer Ninja generator (CMake 2.8.9 or higher required)"));
m_preferNinja->setChecked(preferNinja());
- formLayout->addRow(m_preferNinja);
-
- return outerWidget;
+ return m_widget;
}
void CMakeSettingsPage::saveSettings() const
@@ -329,7 +330,7 @@ void CMakeSettingsPage::apply()
void CMakeSettingsPage::finish()
{
-
+ delete m_widget;
}
QString CMakeSettingsPage::cmakeExecutable() const
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
index 55e4507147..f99ed968f2 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
@@ -40,12 +40,13 @@
#include <utils/environment.h>
#include <utils/pathchooser.h>
-#include <QFuture>
-#include <QStringList>
+#include <QAction>
#include <QCheckBox>
#include <QDir>
+#include <QFuture>
+#include <QPointer>
+#include <QStringList>
#include <QVector>
-#include <QAction>
#include "cmakevalidator.h"
@@ -108,7 +109,7 @@ public:
CMakeSettingsPage();
~CMakeSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
@@ -125,6 +126,7 @@ private:
void saveSettings() const;
QString findCmakeExecutable() const;
+ QPointer<QWidget> m_widget;
Utils::PathChooser *m_pathchooser;
QCheckBox *m_preferNinja;
CMakeValidator m_cmakeValidatorForUser;
diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
index a4b2080e93..b57c5fbfee 100644
--- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp
+++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
@@ -336,7 +336,7 @@ QList<Command *> ActionManager::commands()
{
// transform list of CommandPrivate into list of Command
QList<Command *> result;
- foreach (Command *cmd, d->m_idCmdMap.values())
+ foreach (Command *cmd, d->m_idCmdMap)
result << cmd;
return result;
}
diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.cpp b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
index ee17ff370f..59da19d70a 100644
--- a/src/plugins/coreplugin/actionmanager/commandmappings.cpp
+++ b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
@@ -50,42 +50,43 @@ CommandMappings::CommandMappings(QObject *parent)
// IOptionsPage
-QWidget *CommandMappings::createPage(QWidget *parent)
+QWidget *CommandMappings::widget()
{
- m_page = new Ui::CommandMappings();
- QWidget *w = new QWidget(parent);
- m_page->setupUi(w);
- m_page->targetEdit->setAutoHideButton(Utils::FancyLineEdit::Right, true);
- m_page->targetEdit->setPlaceholderText(QString());
- m_page->targetEdit->installEventFilter(this);
-
- connect(m_page->targetEdit, SIGNAL(buttonClicked(Utils::FancyLineEdit::Side)),
- this, SLOT(removeTargetIdentifier()));
- connect(m_page->resetButton, SIGNAL(clicked()),
- this, SLOT(resetTargetIdentifier()));
- connect(m_page->exportButton, SIGNAL(clicked()),
- this, SLOT(exportAction()));
- connect(m_page->importButton, SIGNAL(clicked()),
- this, SLOT(importAction()));
- connect(m_page->defaultButton, SIGNAL(clicked()),
- this, SLOT(defaultAction()));
-
- initialize();
-
- m_page->commandList->sortByColumn(0, Qt::AscendingOrder);
-
- connect(m_page->filterEdit, SIGNAL(textChanged(QString)),
- this, SLOT(filterChanged(QString)));
- connect(m_page->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
- this, SLOT(commandChanged(QTreeWidgetItem*)));
- connect(m_page->targetEdit, SIGNAL(textChanged(QString)),
- this, SLOT(targetIdentifierChanged()));
-
- new Utils::HeaderViewStretcher(m_page->commandList->header(), 1);
-
- commandChanged(0);
-
- return w;
+ if (!m_widget) {
+ m_page = new Ui::CommandMappings();
+ m_widget = new QWidget;
+ m_page->setupUi(m_widget);
+ m_page->targetEdit->setAutoHideButton(Utils::FancyLineEdit::Right, true);
+ m_page->targetEdit->setPlaceholderText(QString());
+ m_page->targetEdit->installEventFilter(this);
+
+ connect(m_page->targetEdit, SIGNAL(buttonClicked(Utils::FancyLineEdit::Side)),
+ this, SLOT(removeTargetIdentifier()));
+ connect(m_page->resetButton, SIGNAL(clicked()),
+ this, SLOT(resetTargetIdentifier()));
+ connect(m_page->exportButton, SIGNAL(clicked()),
+ this, SLOT(exportAction()));
+ connect(m_page->importButton, SIGNAL(clicked()),
+ this, SLOT(importAction()));
+ connect(m_page->defaultButton, SIGNAL(clicked()),
+ this, SLOT(defaultAction()));
+
+ initialize();
+
+ m_page->commandList->sortByColumn(0, Qt::AscendingOrder);
+
+ connect(m_page->filterEdit, SIGNAL(textChanged(QString)),
+ this, SLOT(filterChanged(QString)));
+ connect(m_page->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
+ this, SLOT(commandChanged(QTreeWidgetItem*)));
+ connect(m_page->targetEdit, SIGNAL(textChanged(QString)),
+ this, SLOT(targetIdentifierChanged()));
+
+ new Utils::HeaderViewStretcher(m_page->commandList->header(), 1);
+
+ commandChanged(0);
+ }
+ return m_widget;
}
void CommandMappings::setImportExportEnabled(bool enabled)
@@ -126,6 +127,7 @@ void CommandMappings::setTargetHeader(const QString &s)
void CommandMappings::finish()
{
+ delete m_widget;
if (!m_page) // page was never shown
return;
delete m_page;
diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.h b/src/plugins/coreplugin/actionmanager/commandmappings.h
index 42ed428d67..3b3c9731c9 100644
--- a/src/plugins/coreplugin/actionmanager/commandmappings.h
+++ b/src/plugins/coreplugin/actionmanager/commandmappings.h
@@ -33,6 +33,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QObject>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QLineEdit;
@@ -60,7 +61,7 @@ protected slots:
protected:
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
virtual void apply() {}
virtual void finish();
@@ -80,6 +81,7 @@ protected:
virtual void markPossibleCollisions(QTreeWidgetItem *) {}
virtual void resetCollisionMarkers() {}
private:
+ QPointer<QWidget> m_widget;
Internal::Ui::CommandMappings *m_page;
};
diff --git a/src/plugins/coreplugin/coreplugin.h b/src/plugins/coreplugin/coreplugin.h
index b9ca64b855..9e1ad58c1f 100644
--- a/src/plugins/coreplugin/coreplugin.h
+++ b/src/plugins/coreplugin/coreplugin.h
@@ -57,6 +57,12 @@ public:
public slots:
void fileOpenRequest(const QString&);
+private slots:
+#if defined(WITH_TESTS)
+ void testVcsManager_data();
+ void testVcsManager();
+#endif
+
private:
void parseArguments(const QStringList & arguments);
diff --git a/src/plugins/coreplugin/dialogs/ioptionspage.cpp b/src/plugins/coreplugin/dialogs/ioptionspage.cpp
index 12ad324c7b..c252bdf477 100644
--- a/src/plugins/coreplugin/dialogs/ioptionspage.cpp
+++ b/src/plugins/coreplugin/dialogs/ioptionspage.cpp
@@ -29,6 +29,11 @@
#include "ioptionspage.h"
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+
/*!
\class Core::IOptionsPage
\mainclass
@@ -43,12 +48,58 @@
\li \c displayName() is the (translated) name for display
\li \c category() is the unique id for the category that the page should be displayed in
\li \c displayCategory() is the translated name of the category
- \li \c createPage() is called to retrieve the widget to show in the
- \gui Options dialog
- The widget will be destroyed by the widget hierarchy when the dialog closes
+ \li \c widget() is called to retrieve the widget to show in the
+ \gui Options dialog. You should create a widget lazily here, and delete it again in the
+ finish() method. This method can be called multiple times, so you should only create a new
+ widget if the old one was deleted.
\li \c apply() is called to store the settings. It should detect if any changes have been
made and store those
- \li \c finish() is called directly before the \gui Options dialog closes
- \li \c matches() is used for the \gui Options dialog search filter
+ \li \c finish() is called directly before the \gui Options dialog closes. Here you should delete
+ the widget that was created in widget() to free resources.
+ \li \c matches() is used for the \gui Options dialog search filter. The default implementation
+ takes the widget() and searches for all labels, buttons, checkboxes and group boxes,
+ and matches on their texts/titles. You can implement your own matching algorithm, but
+ usually the default implementation will work fine.
\endlist
*/
+
+
+Core::IOptionsPage::IOptionsPage(QObject *parent)
+ : QObject(parent),
+ m_keywordsInitialized(false)
+{
+
+}
+
+Core::IOptionsPage::~IOptionsPage()
+{
+}
+
+bool Core::IOptionsPage::matches(const QString &searchKeyWord) const
+{
+ if (!m_keywordsInitialized) {
+ IOptionsPage *that = const_cast<IOptionsPage *>(this);
+ QWidget *widget = that->widget();
+ if (!widget)
+ return false;
+ // find common subwidgets
+ foreach (const QLabel *label, widget->findChildren<QLabel *>())
+ m_keywords << label->text();
+ foreach (const QCheckBox *checkbox, widget->findChildren<QCheckBox *>())
+ m_keywords << checkbox->text();
+ foreach (const QPushButton *pushButton, widget->findChildren<QPushButton *>())
+ m_keywords << pushButton->text();
+ foreach (const QGroupBox *groupBox, widget->findChildren<QGroupBox *>())
+ m_keywords << groupBox->title();
+
+ // clean up accelerators
+ QMutableStringListIterator it(m_keywords);
+ while (it.hasNext())
+ it.next().remove(QLatin1Char('&'));
+ m_keywordsInitialized = true;
+ }
+ foreach (const QString &keyword, m_keywords)
+ if (keyword.contains(searchKeyWord, Qt::CaseInsensitive))
+ return true;
+ return false;
+}
diff --git a/src/plugins/coreplugin/dialogs/ioptionspage.h b/src/plugins/coreplugin/dialogs/ioptionspage.h
index 1fa1e51447..0b121ba2d8 100644
--- a/src/plugins/coreplugin/dialogs/ioptionspage.h
+++ b/src/plugins/coreplugin/dialogs/ioptionspage.h
@@ -34,6 +34,7 @@
#include <QIcon>
#include <QObject>
+#include <QStringList>
namespace Core {
@@ -42,7 +43,8 @@ class CORE_EXPORT IOptionsPage : public QObject
Q_OBJECT
public:
- IOptionsPage(QObject *parent = 0) : QObject(parent) {}
+ IOptionsPage(QObject *parent = 0);
+ virtual ~IOptionsPage();
Id id() const { return m_id; }
QString displayName() const { return m_displayName; }
@@ -50,8 +52,8 @@ public:
QString displayCategory() const { return m_displayCategory; }
QIcon categoryIcon() const { return QIcon(m_categoryIcon); }
- virtual bool matches(const QString & /* searchKeyWord*/) const { return false; }
- virtual QWidget *createPage(QWidget *parent) = 0;
+ virtual bool matches(const QString &searchKeyWord) const;
+ virtual QWidget *widget() = 0;
virtual void apply() = 0;
virtual void finish() = 0;
@@ -67,6 +69,9 @@ protected:
QString m_displayName;
QString m_displayCategory;
QString m_categoryIcon;
+
+ mutable bool m_keywordsInitialized;
+ mutable QStringList m_keywords;
};
/*
@@ -89,6 +94,7 @@ public:
QIcon categoryIcon() const { return QIcon(m_categoryIcon); }
virtual QList<IOptionsPage *> pages() const = 0;
+ virtual bool matches(const QString & /* searchKeyWord*/) const = 0;
protected:
void setCategory(Core::Id category) { m_category = category; }
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp
index 1353b95ae9..6379a55274 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/newdialog.cpp
@@ -194,7 +194,7 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui->frame->setPalette(p);
m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
m_okButton->setDefault(true);
- m_okButton->setText(tr("&Choose..."));
+ m_okButton->setText(tr("Choose..."));
m_model = new QStandardItemModel(this);
m_twoLevelProxyModel = new TwoLevelProxyModel(this);
diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
index e5b92af57c..601251180c 100644
--- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
@@ -257,33 +257,33 @@ int ReadOnlyFilesDialog::exec()
ReadOnlyResult result = RO_Cancel;
QStringList failedToMakeWritable;
- foreach (ReadOnlyFilesDialogPrivate::ButtonGroupForFile buttengroup, d->buttonGroups) {
- result = static_cast<ReadOnlyResult>(buttengroup.group->checkedId());
+ foreach (ReadOnlyFilesDialogPrivate::ButtonGroupForFile buttongroup, d->buttonGroups) {
+ result = static_cast<ReadOnlyResult>(buttongroup.group->checkedId());
switch (result) {
case RO_MakeWritable:
- if (!Utils::FileUtils::makeWritable(Utils::FileName(QFileInfo(buttengroup.fileName)))) {
- failedToMakeWritable << buttengroup.fileName;
+ if (!Utils::FileUtils::makeWritable(Utils::FileName(QFileInfo(buttongroup.fileName)))) {
+ failedToMakeWritable << buttongroup.fileName;
continue;
}
break;
case RO_OpenVCS:
- if (!d->versionControls[buttengroup.fileName]->vcsOpen(buttengroup.fileName)) {
- failedToMakeWritable << buttengroup.fileName;
+ if (!d->versionControls[buttongroup.fileName]->vcsOpen(buttongroup.fileName)) {
+ failedToMakeWritable << buttongroup.fileName;
continue;
}
break;
case RO_SaveAs:
if (!EditorManager::saveDocumentAs(d->document)) {
- failedToMakeWritable << buttengroup.fileName;
+ failedToMakeWritable << buttongroup.fileName;
continue;
}
break;
default:
- failedToMakeWritable << buttengroup.fileName;
+ failedToMakeWritable << buttongroup.fileName;
continue;
}
- if (!QFileInfo(buttengroup.fileName).isWritable())
- failedToMakeWritable << buttengroup.fileName;
+ if (!QFileInfo(buttongroup.fileName).isWritable())
+ failedToMakeWritable << buttongroup.fileName;
}
if (!failedToMakeWritable.isEmpty()) {
if (d->showWarnings)
@@ -366,7 +366,7 @@ void ReadOnlyFilesDialog::updateSelectAll()
void ReadOnlyFilesDialog::initDialog(const QStringList &fileNames)
{
ui->setupUi(this);
- ui->buttonBox->addButton(tr("&Change Permission"), QDialogButtonBox::AcceptRole);
+ ui->buttonBox->addButton(tr("Change &Permission"), QDialogButtonBox::AcceptRole);
ui->buttonBox->addButton(QDialogButtonBox::Cancel);
QString vcsOpenTextForAll;
@@ -389,7 +389,7 @@ void ReadOnlyFilesDialog::initDialog(const QStringList &fileNames)
IVersionControl *versionControlForFile =
VcsManager::findVersionControlForDirectory(directory);
const bool fileManagedByVCS = versionControlForFile
- && versionControlForFile->openSupportMode() != IVersionControl::NoOpen;
+ && versionControlForFile->openSupportMode(fileName) != IVersionControl::NoOpen;
if (fileManagedByVCS) {
const QString vcsOpenTextForFile =
versionControlForFile->vcsOpenText().remove(QLatin1Char('&'));
@@ -407,7 +407,7 @@ void ReadOnlyFilesDialog::initDialog(const QStringList &fileNames)
vcsMakeWritableTextForAll.clear();
}
// Add make writable if it is supported by the reposetory.
- if (versionControlForFile->openSupportMode() == IVersionControl::OpenOptional) {
+ if (versionControlForFile->openSupportMode(fileName) == IVersionControl::OpenOptional) {
useMakeWritable = true;
createRadioButtonForItem(item, radioButtonGroup, MakeWritable);
}
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index c265adbba3..516b3650d7 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -66,12 +66,15 @@ static QPointer<SettingsDialog> m_instance = 0;
class Category
{
public:
+ Category() : index(-1), providerPagesCreated(false) { }
+
Id id;
int index;
QString displayName;
QIcon icon;
QList<IOptionsPage *> pages;
QList<IOptionsPageProvider *> providers;
+ bool providerPagesCreated;
QTabWidget *tabWidget;
};
@@ -210,15 +213,23 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
if (QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent))
return true;
+ const QString pattern = filterRegExp().pattern();
const CategoryModel *cm = static_cast<CategoryModel*>(sourceModel());
- foreach (const IOptionsPage *page, cm->categories().at(sourceRow)->pages) {
- const QString pattern = filterRegExp().pattern();
+ const Category *category = cm->categories().at(sourceRow);
+ foreach (const IOptionsPage *page, category->pages) {
if (page->displayCategory().contains(pattern, Qt::CaseInsensitive)
- || page->displayName().contains(pattern, Qt::CaseInsensitive)
- || page->matches(pattern))
+ || page->displayName().contains(pattern, Qt::CaseInsensitive)
+ || page->matches(pattern))
return true;
}
+ if (!category->providerPagesCreated) {
+ foreach (const IOptionsPageProvider *provider, category->providers) {
+ if (provider->matches(pattern))
+ return true;
+ }
+ }
+
return false;
}
@@ -325,8 +336,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
// The order of the slot connection matters here, the filter slot
// opens the matching page after the model has filtered.
connect(m_filterLineEdit, SIGNAL(filterChanged(QString)),
- this, SLOT(ensureAllCategoryWidgets()));
- connect(m_filterLineEdit, SIGNAL(filterChanged(QString)),
m_proxyModel, SLOT(setFilterFixedString(QString)));
connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), this, SLOT(filter(QString)));
m_categoryList->setFocus();
@@ -432,15 +441,18 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
{
if (category->tabWidget != 0)
return;
- foreach (const IOptionsPageProvider *provider, category->providers) {
- category->pages += provider->pages();
+ if (!category->providerPagesCreated) {
+ foreach (const IOptionsPageProvider *provider, category->providers)
+ category->pages += provider->pages();
+ category->providerPagesCreated = true;
}
+
qStableSort(category->pages.begin(), category->pages.end(), optionsPageLessThan);
QTabWidget *tabWidget = new QTabWidget;
for (int j = 0; j < category->pages.size(); ++j) {
IOptionsPage *page = category->pages.at(j);
- QWidget *widget = page->createPage(0);
+ QWidget *widget = page->widget();
tabWidget->addTab(widget, page->displayName());
}
@@ -451,12 +463,6 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
category->index = m_stackedLayout->addWidget(tabWidget);
}
-void SettingsDialog::ensureAllCategoryWidgets()
-{
- foreach (Category *category, m_model->categories())
- ensureCategoryWidget(category);
-}
-
void SettingsDialog::disconnectTabWidgets()
{
foreach (Category *category, m_model->categories()) {
@@ -514,7 +520,6 @@ void SettingsDialog::currentTabChanged(int index)
void SettingsDialog::filter(const QString &text)
{
- ensureAllCategoryWidgets();
// When there is no current index, select the first one when possible
if (!m_categoryList->currentIndex().isValid() && m_model->rowCount() > 0)
m_categoryList->setCurrentIndex(m_proxyModel->index(0, 0));
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.h b/src/plugins/coreplugin/dialogs/settingsdialog.h
index b77c06c4ef..044ae80d40 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.h
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.h
@@ -79,7 +79,6 @@ private slots:
void currentChanged(const QModelIndex &current);
void currentTabChanged(int);
void filter(const QString &text);
- void ensureAllCategoryWidgets();
private:
SettingsDialog(QWidget *parent);
diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
index a774587f92..eed6cdc4a9 100644
--- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
+++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
@@ -61,12 +61,12 @@ ShortcutSettings::ShortcutSettings(QObject *parent)
setCategoryIcon(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE_ICON));
}
-QWidget *ShortcutSettings::createPage(QWidget *parent)
+QWidget *ShortcutSettings::widget()
{
m_initialized = true;
m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
- QWidget *w = CommandMappings::createPage(parent);
+ QWidget *w = CommandMappings::widget();
const QString pageTitle = tr("Keyboard Shortcuts");
const QString targetLabelText = tr("Key sequence:");
@@ -78,12 +78,6 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
setTargetHeader(editTitle);
targetEdit()->setPlaceholderText(tr("Type to set shortcut"));
- if (m_searchKeywords.isEmpty()) {
- QTextStream(&m_searchKeywords) << ' ' << pageTitle
- << ' ' << targetLabelText
- << ' ' << editTitle;
- }
-
return w;
}
@@ -102,11 +96,6 @@ void ShortcutSettings::finish()
m_initialized = false;
}
-bool ShortcutSettings::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
bool ShortcutSettings::eventFilter(QObject *o, QEvent *e)
{
Q_UNUSED(o)
diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.h b/src/plugins/coreplugin/dialogs/shortcutsettings.h
index 888e8deacc..8511f8b994 100644
--- a/src/plugins/coreplugin/dialogs/shortcutsettings.h
+++ b/src/plugins/coreplugin/dialogs/shortcutsettings.h
@@ -62,10 +62,9 @@ class ShortcutSettings : public Core::CommandMappings
public:
ShortcutSettings(QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
protected:
bool eventFilter(QObject *o, QEvent *e);
@@ -94,7 +93,6 @@ private:
QList<ShortcutItem *> m_scitems;
int m_key[4], m_keyNum;
- QString m_searchKeywords;
bool m_initialized;
};
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 9e7dbbdba3..414fc8ca02 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -1368,11 +1368,6 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
EditorManager::openExternalEditor(entry.fileName, entry.externalEditor->id());
}
-void DocumentManager::slotExecuteOpenWithMenuAction(QAction *action)
-{
- executeOpenWithMenuAction(action);
-}
-
bool DocumentManager::eventFilter(QObject *obj, QEvent *e)
{
if (obj == qApp && e->type() == QEvent::ApplicationActivate) {
diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h
index 70168a2b23..ef54a55cfc 100644
--- a/src/plugins/coreplugin/documentmanager.h
+++ b/src/plugins/coreplugin/documentmanager.h
@@ -126,10 +126,8 @@ public:
lead to any editors to reload or any other editor manager actions. */
static void notifyFilesChangedInternally(const QStringList &files);
- static void executeOpenWithMenuAction(QAction *action);
-
public slots:
- void slotExecuteOpenWithMenuAction(QAction *action);
+ static void executeOpenWithMenuAction(QAction *action);
signals:
void currentFileChanged(const QString &filePath);
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index b10cf3d2b2..ca62088313 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1893,7 +1893,7 @@ void EditorManager::vcsOpenCurrentEditor()
const QString directory = QFileInfo(document->filePath()).absolutePath();
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (!versionControl || versionControl->openSupportMode() == IVersionControl::NoOpen)
+ if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
return;
if (!versionControl->vcsOpen(document->filePath())) {
@@ -1955,7 +1955,7 @@ void EditorManager::updateMakeWritableWarning()
bool promptVCS = false;
const QString directory = QFileInfo(document->filePath()).absolutePath();
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (versionControl && versionControl->openSupportMode() != IVersionControl::NoOpen) {
+ if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
vcsOpenCurrentEditor();
ww = false;
@@ -1988,8 +1988,7 @@ void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, Q
{
saveAction->setEnabled(document != 0 && document->isModified());
saveAsAction->setEnabled(document != 0 && document->isSaveAsAllowed());
- revertToSavedAction->setEnabled(document != 0
- && !document->filePath().isEmpty() && document->isModified());
+ revertToSavedAction->setEnabled(document != 0 && !document->filePath().isEmpty());
const QString documentName = document ? document->displayName() : QString();
QString quotedName;
@@ -1998,7 +1997,9 @@ void EditorManager::setupSaveActions(IDocument *document, QAction *saveAction, Q
quotedName = QLatin1Char('"') + documentName + QLatin1Char('"');
saveAction->setText(tr("&Save %1").arg(quotedName));
saveAsAction->setText(tr("Save %1 &As...").arg(quotedName));
- revertToSavedAction->setText(tr("Revert %1 to Saved").arg(quotedName));
+ revertToSavedAction->setText(document->isModified()
+ ? tr("Revert %1 to Saved").arg(quotedName)
+ : tr("Reload %1").arg(quotedName));
}
}
diff --git a/src/plugins/coreplugin/editormanager/systemeditor.cpp b/src/plugins/coreplugin/editormanager/systemeditor.cpp
index ef9cb8fec9..42336b277b 100644
--- a/src/plugins/coreplugin/editormanager/systemeditor.cpp
+++ b/src/plugins/coreplugin/editormanager/systemeditor.cpp
@@ -54,7 +54,7 @@ Id SystemEditor::id() const
QString SystemEditor::displayName() const
{
- return QLatin1String("System Editor");
+ return tr("System Editor");
}
bool SystemEditor::startEditor(const QString &fileName, QString *errorMessage)
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index 536bd883f5..98706fdb6a 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -317,10 +317,12 @@ void EditorToolBar::listContextMenu(QPoint pos)
DocumentModel::Entry *entry = EditorManager::documentModel()->documentAtRow(
d->m_editorList->currentIndex());
QString fileName = entry ? entry->fileName() : QString();
- if (fileName.isEmpty())
+ QString shortFileName = entry ? QFileInfo(fileName).fileName() : QString();
+ if (fileName.isEmpty() || shortFileName.isEmpty())
return;
QMenu menu;
QAction *copyPath = menu.addAction(tr("Copy Full Path to Clipboard"));
+ QAction *copyFileName = menu.addAction(tr("Copy File Name to Clipboard"));
menu.addSeparator();
EditorManager::addSaveAndCloseEditorActions(&menu, entry);
menu.addSeparator();
@@ -328,6 +330,8 @@ void EditorToolBar::listContextMenu(QPoint pos)
QAction *result = menu.exec(d->m_editorList->mapToGlobal(pos));
if (result == copyPath)
QApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
+ if (result == copyFileName)
+ QApplication::clipboard()->setText(shortFileName);
}
void EditorToolBar::makeEditorWritable()
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index 834879c172..40cb62ec3b 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -102,76 +102,61 @@ void GeneralSettings::fillLanguageBox() const
}
}
-QWidget *GeneralSettings::createPage(QWidget *parent)
+QWidget *GeneralSettings::widget()
{
- m_page = new Ui::GeneralSettings();
- m_widget = new QWidget(parent);
- m_page->setupUi(m_widget);
-
- fillLanguageBox();
-
- m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
- m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
- if (HostOsInfo::isAnyUnixHost()) {
- QSettings *settings = Core::ICore::settings();
- const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
- const QString currentTerminal = ConsoleProcess::terminalEmulator(settings, false);
- m_page->terminalComboBox->addItems(availableTerminals);
- m_page->terminalComboBox->lineEdit()->setText(currentTerminal);
- m_page->terminalComboBox->lineEdit()->setPlaceholderText(ConsoleProcess::defaultTerminalEmulator());
- } else {
- m_page->terminalLabel->hide();
- m_page->terminalComboBox->hide();
- m_page->resetTerminalButton->hide();
- }
-
- if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
- QSettings *settings = Core::ICore::settings();
- m_page->externalFileBrowserEdit->setText(UnixUtils::fileBrowser(settings));
- } else {
- m_page->externalFileBrowserLabel->hide();
- m_page->externalFileBrowserEdit->hide();
- m_page->resetFileBrowserButton->hide();
- m_page->helpExternalFileBrowserButton->hide();
- }
-
- m_page->autoSaveCheckBox->setChecked(EditorManager::autoSaveEnabled());
- m_page->autoSaveInterval->setValue(EditorManager::autoSaveInterval());
- m_page->resetWarningsButton->setEnabled(Core::InfoBar::anyGloballySuppressed()
- || Utils::CheckableMessageBox::hasSuppressedQuestions(ICore::settings()));
+ if (!m_widget) {
+ m_page = new Ui::GeneralSettings();
+ m_widget = new QWidget;
+ m_page->setupUi(m_widget);
+
+ fillLanguageBox();
+
+ m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
+ m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
+ if (HostOsInfo::isAnyUnixHost()) {
+ QSettings *settings = Core::ICore::settings();
+ const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
+ const QString currentTerminal = ConsoleProcess::terminalEmulator(settings, false);
+ m_page->terminalComboBox->addItems(availableTerminals);
+ m_page->terminalComboBox->lineEdit()->setText(currentTerminal);
+ m_page->terminalComboBox->lineEdit()->setPlaceholderText(ConsoleProcess::defaultTerminalEmulator());
+ } else {
+ m_page->terminalLabel->hide();
+ m_page->terminalComboBox->hide();
+ m_page->resetTerminalButton->hide();
+ }
- connect(m_page->resetColorButton, SIGNAL(clicked()),
- this, SLOT(resetInterfaceColor()));
- connect(m_page->resetWarningsButton, SIGNAL(clicked()),
- this, SLOT(resetWarnings()));
- if (HostOsInfo::isAnyUnixHost()) {
- connect(m_page->resetTerminalButton, SIGNAL(clicked()), this, SLOT(resetTerminal()));
- if (!HostOsInfo::isMacHost()) {
- connect(m_page->resetFileBrowserButton, SIGNAL(clicked()), this, SLOT(resetFileBrowser()));
- connect(m_page->helpExternalFileBrowserButton, SIGNAL(clicked()),
- this, SLOT(showHelpForFileBrowser()));
+ if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
+ QSettings *settings = Core::ICore::settings();
+ m_page->externalFileBrowserEdit->setText(UnixUtils::fileBrowser(settings));
+ } else {
+ m_page->externalFileBrowserLabel->hide();
+ m_page->externalFileBrowserEdit->hide();
+ m_page->resetFileBrowserButton->hide();
+ m_page->helpExternalFileBrowserButton->hide();
}
- }
- if (m_searchKeywords.isEmpty()) {
- QLatin1Char sep(' ');
- QTextStream(&m_searchKeywords)
- << m_page->interfaceBox->title() << sep
- << m_page->colorLabel->text() << sep
- << m_page->languageLabel->text() << sep
- << m_page->systemBox->title() << sep
- << m_page->terminalLabel->text() << sep
- << m_page->modifiedLabel->text();
- m_searchKeywords.remove(QLatin1Char('&'));
+ m_page->autoSaveCheckBox->setChecked(EditorManager::autoSaveEnabled());
+ m_page->autoSaveInterval->setValue(EditorManager::autoSaveInterval());
+ m_page->resetWarningsButton->setEnabled(Core::InfoBar::anyGloballySuppressed()
+ || Utils::CheckableMessageBox::hasSuppressedQuestions(ICore::settings()));
+
+ connect(m_page->resetColorButton, SIGNAL(clicked()),
+ this, SLOT(resetInterfaceColor()));
+ connect(m_page->resetWarningsButton, SIGNAL(clicked()),
+ this, SLOT(resetWarnings()));
+ if (HostOsInfo::isAnyUnixHost()) {
+ connect(m_page->resetTerminalButton, SIGNAL(clicked()), this, SLOT(resetTerminal()));
+ if (!HostOsInfo::isMacHost()) {
+ connect(m_page->resetFileBrowserButton, SIGNAL(clicked()), this, SLOT(resetFileBrowser()));
+ connect(m_page->helpExternalFileBrowserButton, SIGNAL(clicked()),
+ this, SLOT(showHelpForFileBrowser()));
+ }
+ }
}
return m_widget;
}
-bool GeneralSettings::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void GeneralSettings::apply()
{
if (!m_page) // wasn't shown, can't be changed
@@ -195,6 +180,7 @@ void GeneralSettings::apply()
void GeneralSettings::finish()
{
+ delete m_widget;
if (!m_page) // page was never shown
return;
delete m_page;
diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h
index c812ac45af..ee13d5ad10 100644
--- a/src/plugins/coreplugin/generalsettings.h
+++ b/src/plugins/coreplugin/generalsettings.h
@@ -51,10 +51,9 @@ class GeneralSettings : public IOptionsPage
public:
GeneralSettings();
- QWidget* createPage(QWidget *parent);
+ QWidget* widget();
void apply();
void finish();
- virtual bool matches(const QString &) const;
private slots:
void resetInterfaceColor();
@@ -70,7 +69,6 @@ private:
QString language() const;
void setLanguage(const QString&);
Ui::GeneralSettings *m_page;
- QString m_searchKeywords;
QPointer<QMessageBox> m_dialog;
QPointer<QWidget> m_widget;
};
diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h
index 3178268389..7c8040e697 100644
--- a/src/plugins/coreplugin/idocument.h
+++ b/src/plugins/coreplugin/idocument.h
@@ -51,12 +51,6 @@ public:
IgnoreAll = 2
};
- enum Utf8BomSetting {
- AlwaysAdd = 0,
- OnlyKeep = 1,
- AlwaysDelete = 2
- };
-
enum ChangeTrigger {
TriggerInternal,
TriggerExternal
diff --git a/src/plugins/coreplugin/iversioncontrol.cpp b/src/plugins/coreplugin/iversioncontrol.cpp
index 814bee6859..80977eecfd 100644
--- a/src/plugins/coreplugin/iversioncontrol.cpp
+++ b/src/plugins/coreplugin/iversioncontrol.cpp
@@ -46,9 +46,64 @@ QString IVersionControl::vcsTopic(const QString &)
return QString();
}
-IVersionControl::OpenSupportMode IVersionControl::openSupportMode() const
+IVersionControl::OpenSupportMode IVersionControl::openSupportMode(const QString &fileName) const
{
+ Q_UNUSED(fileName);
return NoOpen;
}
+} // namespace Core
+
+#if defined(WITH_TESTS)
+
+#include "vcsmanager.h"
+
+#include <QFileInfo>
+
+namespace Core {
+
+TestVersionControl::~TestVersionControl()
+{
+ VcsManager::instance()->clearVersionControlCache();
+}
+
+void TestVersionControl::setManagedDirectories(const QHash<QString, QString> &dirs)
+{
+ m_managedDirs = dirs;
+ m_dirCount = 0;
+ VcsManager::instance()->clearVersionControlCache();
+}
+
+void TestVersionControl::setManagedFiles(const QSet<QString> &files)
+{
+ m_managedFiles = files;
+ m_fileCount = 0;
+ VcsManager::instance()->clearVersionControlCache();
+}
+
+bool TestVersionControl::managesDirectory(const QString &filename, QString *topLevel) const
+{
+ ++m_dirCount;
+
+ if (m_managedDirs.contains(filename)) {
+ if (topLevel)
+ *topLevel = m_managedDirs.value(filename);
+ return true;
+ }
+ return false;
}
+
+bool TestVersionControl::managesFile(const QString &workingDirectory, const QString &fileName) const
+{
+ ++m_fileCount;
+
+ QFileInfo fi(workingDirectory + QLatin1Char('/') + fileName);
+ QString dir = fi.absolutePath();
+ if (!managesDirectory(dir, 0))
+ return false;
+ QString file = fi.absoluteFilePath();
+ return m_managedFiles.contains(file);
+}
+
+} // namespace Core
+#endif
diff --git a/src/plugins/coreplugin/iversioncontrol.h b/src/plugins/coreplugin/iversioncontrol.h
index c5a307d731..06dd31d1e7 100644
--- a/src/plugins/coreplugin/iversioncontrol.h
+++ b/src/plugins/coreplugin/iversioncontrol.h
@@ -100,9 +100,9 @@ public:
virtual bool supportsOperation(Operation operation) const = 0;
/*!
- * Returns the open support mode.
+ * Returns the open support mode for \a fileName.
*/
- virtual OpenSupportMode openSupportMode() const;
+ virtual OpenSupportMode openSupportMode(const QString &fileName) const;
/*!
* Called prior to save, if the file is read only. Should be implemented if
@@ -153,7 +153,7 @@ public:
/*!
* Called to get the version control repository root.
*/
- virtual QString vcsGetRepositoryURL(const QString &director) = 0;
+ virtual QString vcsGetRepositoryURL(const QString &directory) = 0;
/*!
* Topic (e.g. name of the current branch)
@@ -188,4 +188,54 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IVersionControl::SettingsFlags)
} // namespace Core
+#if defined(WITH_TESTS)
+
+#include <QSet>
+
+namespace Core {
+
+class CORE_EXPORT TestVersionControl : public IVersionControl
+{
+ Q_OBJECT
+public:
+ TestVersionControl(Core::Id id, const QString &name) :
+ m_id(id), m_displayName(name), m_dirCount(0), m_fileCount(0)
+ { }
+ ~TestVersionControl();
+
+ void setManagedDirectories(const QHash<QString, QString> &dirs);
+ void setManagedFiles(const QSet<QString> &files);
+
+ int dirCount() const { return m_dirCount; }
+ int fileCount() const { return m_fileCount; }
+
+ // IVersionControl interface
+ QString displayName() const { return m_displayName; }
+ Id id() const { return m_id; }
+ bool managesDirectory(const QString &filename, QString *topLevel) const;
+ bool managesFile(const QString &workingDirectory, const QString &fileName) const;
+ bool isConfigured() const { return true; }
+ bool supportsOperation(Operation) const { return false; }
+ bool vcsOpen(const QString &) { return false; }
+ bool vcsAdd(const QString &) { return false; }
+ bool vcsDelete(const QString &) { return false; }
+ bool vcsMove(const QString &, const QString &) { return false; }
+ bool vcsCreateRepository(const QString &) { return false; }
+ bool vcsCheckout(const QString &, const QByteArray &) { return false; }
+ QString vcsGetRepositoryURL(const QString &) { return QString(); }
+ bool vcsAnnotate(const QString &, int) { return false; }
+
+private:
+ Id m_id;
+ QString m_displayName;
+ QHash<QString, QString> m_managedDirs;
+ QSet<QString> m_managedFiles;
+ mutable int m_dirCount;
+ mutable int m_fileCount;
+};
+
+} // namespace Core
+#endif
+
+
#endif // IVERSIONCONTROL_H
diff --git a/src/plugins/coreplugin/mimetypesettings.cpp b/src/plugins/coreplugin/mimetypesettings.cpp
index 07315c389b..5185f554bc 100644
--- a/src/plugins/coreplugin/mimetypesettings.cpp
+++ b/src/plugins/coreplugin/mimetypesettings.cpp
@@ -41,6 +41,7 @@
#include <QCoreApplication>
#include <QHash>
#include <QMessageBox>
+#include <QPointer>
#include <QScopedPointer>
#include <QSet>
#include <QStringList>
@@ -239,7 +240,6 @@ private slots:
public:
static const QChar kSemiColon;
- QString m_keywords;
MimeTypeSettingsModel *m_model;
QSortFilterProxyModel *m_filterModel;
int m_mimeForPatternSync;
@@ -249,6 +249,7 @@ public:
QList<int> m_modifiedMimeTypes;
QString m_filterPattern;
Ui::MimeTypeSettingsPage m_ui;
+ QPointer<QWidget> m_widget;
};
const QChar MimeTypeSettingsPrivate::kSemiColon(QLatin1Char(';'));
@@ -586,16 +587,13 @@ MimeTypeSettings::~MimeTypeSettings()
delete d;
}
-bool MimeTypeSettings::matches(const QString &s) const
+QWidget *MimeTypeSettings::widget()
{
- return d->m_keywords.contains(s, Qt::CaseInsensitive);
-}
-
-QWidget *MimeTypeSettings::createPage(QWidget *parent)
-{
- QWidget *w = new QWidget(parent);
- d->configureUi(w);
- return w;
+ if (!d->m_widget) {
+ d->m_widget = new QWidget;
+ d->configureUi(d->m_widget);
+ }
+ return d->m_widget;
}
void MimeTypeSettings::apply()
@@ -625,6 +623,7 @@ void MimeTypeSettings::finish()
d->updateMimeDatabase();
}
d->resetState();
+ delete d->m_widget;
}
} // Internal
diff --git a/src/plugins/coreplugin/mimetypesettings.h b/src/plugins/coreplugin/mimetypesettings.h
index 19908aeeb6..261ae93a74 100644
--- a/src/plugins/coreplugin/mimetypesettings.h
+++ b/src/plugins/coreplugin/mimetypesettings.h
@@ -45,8 +45,7 @@ public:
MimeTypeSettings(QObject *parent = 0);
virtual ~MimeTypeSettings();
- virtual bool matches(const QString &s) const;
- virtual QWidget *createPage(QWidget *parent);
+ virtual QWidget *widget();
virtual void apply();
virtual void finish();
diff --git a/src/plugins/coreplugin/toolsettings.cpp b/src/plugins/coreplugin/toolsettings.cpp
index 84b13024b3..be94b4dceb 100644
--- a/src/plugins/coreplugin/toolsettings.cpp
+++ b/src/plugins/coreplugin/toolsettings.cpp
@@ -56,17 +56,12 @@ ToolSettings::ToolSettings(QObject *parent) :
}
-bool ToolSettings::matches(const QString & searchKeyWord) const
+QWidget *ToolSettings::widget()
{
- return m_searchKeywords.contains(searchKeyWord, Qt::CaseInsensitive);
-}
-
-QWidget *ToolSettings::createPage(QWidget *parent)
-{
- m_widget = new ExternalToolConfig(parent);
- m_widget->setTools(ExternalToolManager::toolsByCategory());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new ExternalToolConfig;
+ m_widget->setTools(ExternalToolManager::toolsByCategory());
+ }
return m_widget;
}
@@ -206,4 +201,5 @@ void ToolSettings::apply()
void ToolSettings::finish()
{
+ delete m_widget;
}
diff --git a/src/plugins/coreplugin/toolsettings.h b/src/plugins/coreplugin/toolsettings.h
index c161436de9..038baf376d 100644
--- a/src/plugins/coreplugin/toolsettings.h
+++ b/src/plugins/coreplugin/toolsettings.h
@@ -46,13 +46,11 @@ class ToolSettings : public IOptionsPage
public:
explicit ToolSettings(QObject *parent = 0);
- bool matches(const QString & searchKeyWord) const;
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- QString m_searchKeywords;
QPointer<ExternalToolConfig> m_widget;
};
diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp
index acfeb9145d..552f21f826 100644
--- a/src/plugins/coreplugin/vcsmanager.cpp
+++ b/src/plugins/coreplugin/vcsmanager.cpp
@@ -59,6 +59,10 @@ static inline VersionControlList allVersionControls()
return ExtensionSystem::PluginManager::getObjects<IVersionControl>();
}
+#if defined(WITH_TESTS)
+const char TEST_PREFIX[] = "/8E3A9BA0-0B97-40DF-AEC1-2BDF9FC9EDBE/";
+#endif
+
// ---- VCSManagerPrivate:
// Maintains a cache of top-level directory->version control.
@@ -196,7 +200,7 @@ VcsManager::~VcsManager()
delete d;
}
-QObject *VcsManager::instance()
+VcsManager *VcsManager::instance()
{
return m_instance;
}
@@ -233,8 +237,11 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
{
typedef QPair<QString, IVersionControl *> StringVersionControlPair;
typedef QList<StringVersionControlPair> StringVersionControlPairs;
- if (inputDirectory.isEmpty())
+ if (inputDirectory.isEmpty()) {
+ if (topLevelDirectory)
+ topLevelDirectory->clear();
return 0;
+ }
// Make sure we an absolute path:
const QString directory = QDir(inputDirectory).absolutePath();
@@ -271,6 +278,11 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
// Register Vcs(s) with the cache
QString tmpDir = QFileInfo(directory).canonicalFilePath();
+#if defined WITH_TESTS
+ // Force caching of test directories (even though they do not exist):
+ if (directory.startsWith(QLatin1String(TEST_PREFIX)))
+ tmpDir = directory;
+#endif
// directory might refer to a historical directory which doesn't exist.
// In this case, don't cache it.
if (!tmpDir.isEmpty()) {
@@ -352,24 +364,6 @@ IVersionControl *VcsManager::checkout(const QString &versionControlType,
return 0;
}
-bool VcsManager::findVersionControl(const QString &versionControlType)
-{
- foreach (IVersionControl * versionControl, allVersionControls()) {
- if (versionControl->displayName() == versionControlType)
- return true;
- }
- return false;
-}
-
-QString VcsManager::repositoryUrl(const QString &directory)
-{
- IVersionControl *vc = findVersionControlForDirectory(directory);
-
- if (vc && vc->supportsOperation(Core::IVersionControl::GetRepositoryRootOperation))
- return vc->vcsGetRepositoryURL(directory);
- return QString();
-}
-
bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
{
QTC_ASSERT(vc, return true);
@@ -465,3 +459,181 @@ void VcsManager::configureVcs()
}
} // namespace Core
+
+#if defined(WITH_TESTS)
+
+#include <QtTest>
+
+#include "coreplugin.h"
+#include "iversioncontrol.h"
+
+#include <extensionsystem/pluginmanager.h>
+
+namespace Core {
+namespace Internal {
+
+const char ID_VCS_A[] = "A";
+const char ID_VCS_B[] = "B";
+
+typedef QHash<QString, QString> FileHash;
+
+template<class T>
+class ObjectPoolGuard
+{
+public:
+ ObjectPoolGuard(T *watch) : m_watched(watch)
+ {
+ ExtensionSystem::PluginManager::addObject(watch);
+ }
+
+ operator bool() { return m_watched; }
+ bool operator !() { return !m_watched; }
+ T &operator*() { return *m_watched; }
+ T *operator->() { return m_watched; }
+ T *value() { return m_watched; }
+
+ ~ObjectPoolGuard()
+ {
+ ExtensionSystem::PluginManager::removeObject(m_watched);
+ delete m_watched;
+ }
+
+private:
+ T *m_watched;
+};
+
+static FileHash makeHash(const QStringList &list)
+{
+ FileHash result;
+ foreach (const QString &i, list) {
+ QStringList parts = i.split(QLatin1Char(':'));
+ QTC_ASSERT(parts.count() == 2, continue);
+ result.insert(QString::fromLatin1(TEST_PREFIX) + parts.at(0),
+ QString::fromLatin1(TEST_PREFIX) + parts.at(1));
+ }
+ return result;
+}
+
+static QString makeString(const QString &s)
+{
+ if (s.isEmpty())
+ return QString();
+ return QString::fromLatin1(TEST_PREFIX) + s;
+}
+
+void CorePlugin::testVcsManager_data()
+{
+ // avoid conflicts with real files and directories:
+
+ QTest::addColumn<QStringList>("dirsVcsA"); // <directory>:<toplevel>
+ QTest::addColumn<QStringList>("dirsVcsB"); // <directory>:<toplevel>
+ // <directory>:<toplevel>:<vcsid>:<- from cache, * from VCS>
+ QTest::addColumn<QStringList>("results");
+
+ QTest::newRow("A and B next to each other")
+ << (QStringList()
+ << QLatin1String("a:a") << QLatin1String("a/1:a") << QLatin1String("a/2:a")
+ << QLatin1String("a/2/5:a") << QLatin1String("a/2/5/6:a"))
+ << (QStringList()
+ << QLatin1String("b:b") << QLatin1String("b/3:b") << QLatin1String("b/4:b"))
+ << (QStringList()
+ << QLatin1String(":::-") // empty directory to look up
+ << QLatin1String("c:::*") // Neither in A nor B
+ << QLatin1String("a:a:A:*") // in A
+ << QLatin1String("b:b:B:*") // in B
+ << QLatin1String("b/3:b:B:*") // in B
+ << QLatin1String("b/4:b:B:*") // in B
+ << QLatin1String("a/1:a:A:*") // in A
+ << QLatin1String("a/2:a:A:*") // in A
+ << QLatin1String(":::-") // empty directory to look up
+ << QLatin1String("a/2/5/6:a:A:*") // in A
+ << QLatin1String("a/2/5:a:A:-") // in A (cached from before!)
+ // repeat: These need to come from the cache now:
+ << QLatin1String("c:::-") // Neither in A nor B
+ << QLatin1String("a:a:A:-") // in A
+ << QLatin1String("b:b:B:-") // in B
+ << QLatin1String("b/3:b:B:-") // in B
+ << QLatin1String("b/4:b:B:-") // in B
+ << QLatin1String("a/1:a:A:-") // in A
+ << QLatin1String("a/2:a:A:-") // in A
+ << QLatin1String("a/2/5/6:a:A:-") // in A
+ << QLatin1String("a/2/5:a:A:-") // in A
+ );
+ QTest::newRow("B in A")
+ << (QStringList()
+ << QLatin1String("a:a") << QLatin1String("a/1:a") << QLatin1String("a/2:a")
+ << QLatin1String("a/2/5:a") << QLatin1String("a/2/5/6:a"))
+ << (QStringList()
+ << QLatin1String("a/1/b:a/1/b") << QLatin1String("a/1/b/3:a/1/b")
+ << QLatin1String("a/1/b/4:a/1/b") << QLatin1String("a/1/b/3/5:a/1/b")
+ << QLatin1String("a/1/b/3/5/6:a/1/b"))
+ << (QStringList()
+ << QLatin1String("a:a:A:*") // in A
+ << QLatin1String("c:::*") // Neither in A nor B
+ << QLatin1String("a/3:::*") // Neither in A nor B
+ << QLatin1String("a/1/b/x:::*") // Neither in A nor B
+ << QLatin1String("a/1/b:a/1/b:B:*") // in B
+ << QLatin1String("a/1:a:A:*") // in A
+ << QLatin1String("a/1/b/../../2:a:A:*") // in A
+ );
+ QTest::newRow("A and B") // first one wins...
+ << (QStringList() << QLatin1String("a:a") << QLatin1String("a/1:a") << QLatin1String("a/2:a"))
+ << (QStringList() << QLatin1String("a:a") << QLatin1String("a/1:a") << QLatin1String("a/2:a"))
+ << (QStringList() << QLatin1String("a/2:a:A:*"));
+}
+
+void CorePlugin::testVcsManager()
+{
+ // setup:
+ ObjectPoolGuard<TestVersionControl> vcsA(new TestVersionControl(ID_VCS_A, QLatin1String("A")));
+ ObjectPoolGuard<TestVersionControl> vcsB(new TestVersionControl(ID_VCS_B, QLatin1String("B")));
+
+ // test:
+ QFETCH(QStringList, dirsVcsA);
+ QFETCH(QStringList, dirsVcsB);
+ QFETCH(QStringList, results);
+
+ vcsA->setManagedDirectories(makeHash(dirsVcsA));
+ vcsB->setManagedDirectories(makeHash(dirsVcsB));
+
+ QString realTopLevel = QLatin1String("ABC"); // Make sure this gets cleared if needed.
+
+ // From VCSes:
+ int expectedCount = 0;
+ foreach (const QString &result, results) {
+ // qDebug() << "Expecting:" << result;
+
+ QStringList split = result.split(QLatin1String(":"));
+ QCOMPARE(split.count(), 4);
+ QVERIFY(split.at(3) == QLatin1String("*") || split.at(3) == QLatin1String("-"));
+
+
+ const QString directory = split.at(0);
+ const QString topLevel = split.at(1);
+ const QString vcsId = split.at(2);
+ bool fromCache = split.at(3) == QLatin1String("-");
+
+ if (!fromCache && !directory.isEmpty())
+ ++expectedCount;
+
+ IVersionControl *vcs;
+ vcs = VcsManager::findVersionControlForDirectory(makeString(directory), &realTopLevel);
+ QCOMPARE(realTopLevel, makeString(topLevel));
+ if (vcs)
+ QCOMPARE(vcs->id().toString(), vcsId);
+ else
+ QCOMPARE(QString(), vcsId);
+ QCOMPARE(vcsA->dirCount(), expectedCount);
+ QCOMPARE(vcsA->fileCount(), 0);
+ QCOMPARE(vcsB->dirCount(), expectedCount);
+ QCOMPARE(vcsB->fileCount(), 0);
+ }
+
+ // teardown:
+ // handled by guards
+}
+
+} // namespace Internal
+} // namespace Core
+
+#endif
diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h
index 6e76995b64..f346ac7638 100644
--- a/src/plugins/coreplugin/vcsmanager.h
+++ b/src/plugins/coreplugin/vcsmanager.h
@@ -58,23 +58,19 @@ class CORE_EXPORT VcsManager : public QObject
Q_OBJECT
public:
- static QObject *instance();
+ static VcsManager *instance();
static void extensionsInitialized();
static void resetVersionControlForDirectory(const QString &inputDirectory);
static IVersionControl *findVersionControlForDirectory(const QString &directory,
- QString *topLevelDirectory = 0);
+ QString *topLevelDirectory = 0);
static QStringList repositories(const IVersionControl *);
static IVersionControl *checkout(const QString &versionControlType,
const QString &directory,
const QByteArray &url);
- // Used only by Trac plugin.
- bool findVersionControl(const QString &versionControl);
- // Used only by Trac plugin.
- static QString repositoryUrl(const QString &directory);
// Shows a confirmation dialog, whether the file should also be deleted
// from revision control. Calls vcsDelete on the file. Returns false
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index 58020e6153..8878eb2dd2 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -211,7 +211,7 @@ void CodepasterPlugin::postEditor()
if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
data = textEditor->selectedText();
if (data.isEmpty())
- data = textEditor->textDocument()->contents();
+ data = textEditor->textDocument()->plainText();
mimeType = textEditor->document()->mimeType();
}
}
diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
index 8a7c4c0496..47ec8a9d55 100644
--- a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
+++ b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
@@ -104,10 +104,12 @@ FileShareProtocolSettingsPage::FileShareProtocolSettingsPage(const QSharedPointe
setDisplayCategory(QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY));
}
-QWidget *FileShareProtocolSettingsPage::createPage(QWidget *parent)
+QWidget *FileShareProtocolSettingsPage::widget()
{
- m_widget = new FileShareProtocolSettingsWidget(parent);
- m_widget->setSettings(*m_settings);
+ if (!m_widget) {
+ m_widget = new FileShareProtocolSettingsWidget;
+ m_widget->setSettings(*m_settings);
+ }
return m_widget;
}
diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.h b/src/plugins/cpaster/fileshareprotocolsettingspage.h
index 91d1c996fe..c6970aa6b9 100644
--- a/src/plugins/cpaster/fileshareprotocolsettingspage.h
+++ b/src/plugins/cpaster/fileshareprotocolsettingspage.h
@@ -78,7 +78,7 @@ public:
explicit FileShareProtocolSettingsPage(const QSharedPointer<FileShareProtocolSettings> &s,
QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish() { }
diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp
index 35060653eb..6ea55f1f48 100644
--- a/src/plugins/cpaster/settingspage.cpp
+++ b/src/plugins/cpaster/settingspage.cpp
@@ -90,13 +90,12 @@ SettingsPage::~SettingsPage()
{
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsWidget(m_protocols, parent);
- m_widget->setSettings(*m_settings);
-
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsWidget(m_protocols);
+ m_widget->setSettings(*m_settings);
+ }
return m_widget;
}
@@ -111,11 +110,6 @@ void SettingsPage::apply()
}
}
-bool SettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void SettingsPage::addProtocol(const QString &name)
{
m_protocols.append(name);
diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h
index 9297da67cb..e94348e231 100644
--- a/src/plugins/cpaster/settingspage.h
+++ b/src/plugins/cpaster/settingspage.h
@@ -66,10 +66,9 @@ public:
explicit SettingsPage(const QSharedPointer<Settings> &settings);
~SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish() { }
- bool matches(const QString &) const;
void addProtocol(const QString& name);
@@ -78,7 +77,6 @@ private:
QPointer<SettingsWidget> m_widget;
QStringList m_protocols;
- QString m_searchKeywords;
};
} // namespace CodePaster
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
new file mode 100644
index 0000000000..812ef3eb80
--- /dev/null
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
@@ -0,0 +1,2302 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "cppcodemodelinspectordialog.h"
+#include "cppeditor.h"
+#include "ui_cppcodemodelinspectordialog.h"
+
+#include <app/app_version.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/icore.h>
+#include <cpptools/cppmodelmanagerinterface.h>
+#include <cpptools/cppprojectfile.h>
+#include <cpptools/cpptoolseditorsupport.h>
+#include <projectexplorer/project.h>
+
+#include <cplusplus/CppDocument.h>
+#include <cplusplus/Overview.h>
+#include <cplusplus/Token.h>
+#include <utils/qtcassert.h>
+
+#include <QAbstractTableModel>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSortFilterProxyModel>
+
+using namespace CppTools;
+
+namespace {
+
+// --- Utils --------------------------------------------------------------------------------------
+
+QString toString(bool value)
+{
+ return value ? QLatin1String("Yes") : QLatin1String("No");
+}
+
+QString toString(unsigned value)
+{
+ return QString::number(value);
+}
+
+QString toString(const QDateTime &dateTime)
+{
+ return dateTime.toString(QLatin1String("hh:mm:ss dd.MM.yy"));
+}
+
+QString toString(CPlusPlus::Document::CheckMode checkMode)
+{
+#define CASE_CHECKMODE(x) case CPlusPlus::Document::x: return QLatin1String(#x)
+ switch (checkMode) {
+ CASE_CHECKMODE(Unchecked);
+ CASE_CHECKMODE(FullCheck);
+ CASE_CHECKMODE(FastCheck);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_CHECKMODE
+ return QString();
+}
+
+QString toString(CPlusPlus::Document::DiagnosticMessage::Level level)
+{
+#define CASE_LEVEL(x) case CPlusPlus::Document::DiagnosticMessage::x: return QLatin1String(#x)
+ switch (level) {
+ CASE_LEVEL(Warning);
+ CASE_LEVEL(Error);
+ CASE_LEVEL(Fatal);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_LEVEL
+ return QString();
+}
+
+QString toString(ProjectPart::CVersion cVersion)
+{
+#define CASE_CVERSION(x) case ProjectPart::x: return QLatin1String(#x)
+ switch (cVersion) {
+ CASE_CVERSION(C89);
+ CASE_CVERSION(C99);
+ CASE_CVERSION(C11);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_CVERSION
+ return QString();
+}
+
+QString toString(ProjectPart::CXXVersion cxxVersion)
+{
+#define CASE_CXXVERSION(x) case ProjectPart::x: return QLatin1String(#x)
+ switch (cxxVersion) {
+ CASE_CXXVERSION(CXX98);
+ CASE_CXXVERSION(CXX11);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_CXXVERSION
+ return QString();
+}
+
+QString toString(ProjectPart::CXXExtensions cxxExtension)
+{
+ QString result;
+
+#define CASE_CXXEXTENSION(ext) if (cxxExtension & ProjectPart::ext) \
+ result += QLatin1String(#ext ", ");
+
+ CASE_CXXEXTENSION(NoExtensions);
+ CASE_CXXEXTENSION(GnuExtensions);
+ CASE_CXXEXTENSION(MicrosoftExtensions);
+ CASE_CXXEXTENSION(BorlandExtensions);
+ CASE_CXXEXTENSION(OpenMPExtensions);
+#undef CASE_CXXEXTENSION
+ if (result.endsWith(QLatin1String(", ")))
+ result.chop(2);
+ return result;
+}
+
+QString toString(ProjectPart::QtVersion qtVersion)
+{
+#define CASE_QTVERSION(x) case ProjectPart::x: return QLatin1String(#x)
+ switch (qtVersion) {
+ CASE_QTVERSION(UnknownQt);
+ CASE_QTVERSION(NoQt);
+ CASE_QTVERSION(Qt4);
+ CASE_QTVERSION(Qt5);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_QTVERSION
+ return QString();
+}
+
+QString toString(const QList<ProjectFile> &projectFiles)
+{
+ QStringList filesList;
+ foreach (const ProjectFile &projectFile, projectFiles)
+ filesList << QDir::toNativeSeparators(projectFile.path);
+ qSort(filesList);
+ return filesList.join(QLatin1String("\n"));
+}
+
+QString toString(ProjectFile::Kind kind)
+{
+#define CASE_PROFECTFILEKIND(x) case ProjectFile::x: return QLatin1String(#x)
+ switch (kind) {
+ CASE_PROFECTFILEKIND(Unclassified);
+ CASE_PROFECTFILEKIND(CHeader);
+ CASE_PROFECTFILEKIND(CSource);
+ CASE_PROFECTFILEKIND(CXXHeader);
+ CASE_PROFECTFILEKIND(CXXSource);
+ CASE_PROFECTFILEKIND(ObjCHeader);
+ CASE_PROFECTFILEKIND(ObjCSource);
+ CASE_PROFECTFILEKIND(ObjCXXHeader);
+ CASE_PROFECTFILEKIND(ObjCXXSource);
+ CASE_PROFECTFILEKIND(CudaSource);
+ CASE_PROFECTFILEKIND(OpenCLSource);
+ // no default to get a compiler warning if anything is added
+ }
+#undef CASE_PROFECTFILEKIND
+ return QString();
+}
+
+QString toString(CPlusPlus::Kind kind)
+{
+ using namespace CPlusPlus;
+#define TOKEN(x) case x: return QLatin1String(#x)
+#define TOKEN_AND_ALIASES(x,y) case x: return QLatin1String(#x "/" #y)
+ switch (kind) {
+ TOKEN(T_EOF_SYMBOL);
+ TOKEN(T_ERROR);
+ TOKEN(T_CPP_COMMENT);
+ TOKEN(T_CPP_DOXY_COMMENT);
+ TOKEN(T_COMMENT);
+ TOKEN(T_DOXY_COMMENT);
+ TOKEN(T_IDENTIFIER);
+ TOKEN(T_NUMERIC_LITERAL);
+ TOKEN(T_CHAR_LITERAL);
+ TOKEN(T_WIDE_CHAR_LITERAL);
+ TOKEN(T_UTF16_CHAR_LITERAL);
+ TOKEN(T_UTF32_CHAR_LITERAL);
+ TOKEN(T_STRING_LITERAL);
+ TOKEN(T_WIDE_STRING_LITERAL);
+ TOKEN(T_UTF8_STRING_LITERAL);
+ TOKEN(T_UTF16_STRING_LITERAL);
+ TOKEN(T_UTF32_STRING_LITERAL);
+ TOKEN(T_RAW_STRING_LITERAL);
+ TOKEN(T_RAW_WIDE_STRING_LITERAL);
+ TOKEN(T_RAW_UTF8_STRING_LITERAL);
+ TOKEN(T_RAW_UTF16_STRING_LITERAL);
+ TOKEN(T_RAW_UTF32_STRING_LITERAL);
+ TOKEN(T_AT_STRING_LITERAL);
+ TOKEN(T_ANGLE_STRING_LITERAL);
+ TOKEN_AND_ALIASES(T_AMPER, T_BITAND);
+ TOKEN_AND_ALIASES(T_AMPER_AMPER, T_AND);
+ TOKEN_AND_ALIASES(T_AMPER_EQUAL, T_AND_EQ);
+ TOKEN(T_ARROW);
+ TOKEN(T_ARROW_STAR);
+ TOKEN_AND_ALIASES(T_CARET, T_XOR);
+ TOKEN_AND_ALIASES(T_CARET_EQUAL, T_XOR_EQ);
+ TOKEN(T_COLON);
+ TOKEN(T_COLON_COLON);
+ TOKEN(T_COMMA);
+ TOKEN(T_SLASH);
+ TOKEN(T_SLASH_EQUAL);
+ TOKEN(T_DOT);
+ TOKEN(T_DOT_DOT_DOT);
+ TOKEN(T_DOT_STAR);
+ TOKEN(T_EQUAL);
+ TOKEN(T_EQUAL_EQUAL);
+ TOKEN_AND_ALIASES(T_EXCLAIM, T_NOT);
+ TOKEN_AND_ALIASES(T_EXCLAIM_EQUAL, T_NOT_EQ);
+ TOKEN(T_GREATER);
+ TOKEN(T_GREATER_EQUAL);
+ TOKEN(T_GREATER_GREATER);
+ TOKEN(T_GREATER_GREATER_EQUAL);
+ TOKEN(T_LBRACE);
+ TOKEN(T_LBRACKET);
+ TOKEN(T_LESS);
+ TOKEN(T_LESS_EQUAL);
+ TOKEN(T_LESS_LESS);
+ TOKEN(T_LESS_LESS_EQUAL);
+ TOKEN(T_LPAREN);
+ TOKEN(T_MINUS);
+ TOKEN(T_MINUS_EQUAL);
+ TOKEN(T_MINUS_MINUS);
+ TOKEN(T_PERCENT);
+ TOKEN(T_PERCENT_EQUAL);
+ TOKEN_AND_ALIASES(T_PIPE, T_BITOR);
+ TOKEN_AND_ALIASES(T_PIPE_EQUAL, T_OR_EQ);
+ TOKEN_AND_ALIASES(T_PIPE_PIPE, T_OR);
+ TOKEN(T_PLUS);
+ TOKEN(T_PLUS_EQUAL);
+ TOKEN(T_PLUS_PLUS);
+ TOKEN(T_POUND);
+ TOKEN(T_POUND_POUND);
+ TOKEN(T_QUESTION);
+ TOKEN(T_RBRACE);
+ TOKEN(T_RBRACKET);
+ TOKEN(T_RPAREN);
+ TOKEN(T_SEMICOLON);
+ TOKEN(T_STAR);
+ TOKEN(T_STAR_EQUAL);
+ TOKEN_AND_ALIASES(T_TILDE, T_COMPL);
+ TOKEN(T_TILDE_EQUAL);
+ TOKEN(T_ALIGNAS);
+ TOKEN(T_ALIGNOF);
+ TOKEN_AND_ALIASES(T_ASM, T___ASM/T___ASM__);
+ TOKEN(T_AUTO);
+ TOKEN(T_BOOL);
+ TOKEN(T_BREAK);
+ TOKEN(T_CASE);
+ TOKEN(T_CATCH);
+ TOKEN(T_CHAR);
+ TOKEN(T_CHAR16_T);
+ TOKEN(T_CHAR32_T);
+ TOKEN(T_CLASS);
+ TOKEN_AND_ALIASES(T_CONST, T___CONST/T___CONST__);
+ TOKEN(T_CONST_CAST);
+ TOKEN(T_CONSTEXPR);
+ TOKEN(T_CONTINUE);
+ TOKEN_AND_ALIASES(T_DECLTYPE, T___DECLTYPE);
+ TOKEN(T_DEFAULT);
+ TOKEN(T_DELETE);
+ TOKEN(T_DO);
+ TOKEN(T_DOUBLE);
+ TOKEN(T_DYNAMIC_CAST);
+ TOKEN(T_ELSE);
+ TOKEN(T_ENUM);
+ TOKEN(T_EXPLICIT);
+ TOKEN(T_EXPORT);
+ TOKEN(T_EXTERN);
+ TOKEN(T_FALSE);
+ TOKEN(T_FLOAT);
+ TOKEN(T_FOR);
+ TOKEN(T_FRIEND);
+ TOKEN(T_GOTO);
+ TOKEN(T_IF);
+ TOKEN_AND_ALIASES(T_INLINE, T___INLINE/T___INLINE__);
+ TOKEN(T_INT);
+ TOKEN(T_LONG);
+ TOKEN(T_MUTABLE);
+ TOKEN(T_NAMESPACE);
+ TOKEN(T_NEW);
+ TOKEN(T_NOEXCEPT);
+ TOKEN(T_NULLPTR);
+ TOKEN(T_OPERATOR);
+ TOKEN(T_PRIVATE);
+ TOKEN(T_PROTECTED);
+ TOKEN(T_PUBLIC);
+ TOKEN(T_REGISTER);
+ TOKEN(T_REINTERPRET_CAST);
+ TOKEN(T_RETURN);
+ TOKEN(T_SHORT);
+ TOKEN(T_SIGNED);
+ TOKEN(T_SIZEOF);
+ TOKEN(T_STATIC);
+ TOKEN(T_STATIC_ASSERT);
+ TOKEN(T_STATIC_CAST);
+ TOKEN(T_STRUCT);
+ TOKEN(T_SWITCH);
+ TOKEN(T_TEMPLATE);
+ TOKEN(T_THIS);
+ TOKEN(T_THREAD_LOCAL);
+ TOKEN(T_THROW);
+ TOKEN(T_TRUE);
+ TOKEN(T_TRY);
+ TOKEN(T_TYPEDEF);
+ TOKEN(T_TYPEID);
+ TOKEN(T_TYPENAME);
+ TOKEN(T_UNION);
+ TOKEN(T_UNSIGNED);
+ TOKEN(T_USING);
+ TOKEN(T_VIRTUAL);
+ TOKEN(T_VOID);
+ TOKEN_AND_ALIASES(T_VOLATILE, T___VOLATILE/T___VOLATILE__);
+ TOKEN(T_WCHAR_T);
+ TOKEN(T_WHILE);
+ TOKEN_AND_ALIASES(T___ATTRIBUTE__, T___ATTRIBUTE);
+ TOKEN(T___THREAD);
+ TOKEN_AND_ALIASES(T___TYPEOF__, T_TYPEOF/T___TYPEOF);
+ TOKEN(T_AT_CATCH);
+ TOKEN(T_AT_CLASS);
+ TOKEN(T_AT_COMPATIBILITY_ALIAS);
+ TOKEN(T_AT_DEFS);
+ TOKEN(T_AT_DYNAMIC);
+ TOKEN(T_AT_ENCODE);
+ TOKEN(T_AT_END);
+ TOKEN(T_AT_FINALLY);
+ TOKEN(T_AT_IMPLEMENTATION);
+ TOKEN(T_AT_INTERFACE);
+ TOKEN(T_AT_NOT_KEYWORD);
+ TOKEN(T_AT_OPTIONAL);
+ TOKEN(T_AT_PACKAGE);
+ TOKEN(T_AT_PRIVATE);
+ TOKEN(T_AT_PROPERTY);
+ TOKEN(T_AT_PROTECTED);
+ TOKEN(T_AT_PROTOCOL);
+ TOKEN(T_AT_PUBLIC);
+ TOKEN(T_AT_REQUIRED);
+ TOKEN(T_AT_SELECTOR);
+ TOKEN(T_AT_SYNCHRONIZED);
+ TOKEN(T_AT_SYNTHESIZE);
+ TOKEN(T_AT_THROW);
+ TOKEN(T_AT_TRY);
+ TOKEN(T_EMIT);
+ TOKEN(T_SIGNAL);
+ TOKEN(T_SLOT);
+ TOKEN(T_Q_SIGNAL);
+ TOKEN(T_Q_SLOT);
+ TOKEN(T_Q_SIGNALS);
+ TOKEN(T_Q_SLOTS);
+ TOKEN(T_Q_FOREACH);
+ TOKEN(T_Q_D);
+ TOKEN(T_Q_Q);
+ TOKEN(T_Q_INVOKABLE);
+ TOKEN(T_Q_PROPERTY);
+ TOKEN(T_Q_PRIVATE_PROPERTY);
+ TOKEN(T_Q_INTERFACES);
+ TOKEN(T_Q_EMIT);
+ TOKEN(T_Q_ENUMS);
+ TOKEN(T_Q_FLAGS);
+ TOKEN(T_Q_PRIVATE_SLOT);
+ TOKEN(T_Q_DECLARE_INTERFACE);
+ TOKEN(T_Q_OBJECT);
+ TOKEN(T_Q_GADGET);
+ // no default to get a compiler warning if anything is added
+ }
+#undef TOKEN
+#undef TOKEN_AND_ALIASES
+ return QString();
+}
+
+QString partsForFile(const QString &fileName)
+{
+ const QList<ProjectPart::Ptr> parts
+ = CppModelManagerInterface::instance()->projectPart(fileName);
+ QString result;
+ foreach (const ProjectPart::Ptr &part, parts)
+ result += part->displayName + QLatin1Char(',');
+ if (result.endsWith(QLatin1Char(',')))
+ result.chop(1);
+ return result;
+}
+
+QString unresolvedFileNameWithDelimiters(const CPlusPlus::Document::Include &include)
+{
+ const QString unresolvedFileName = include.unresolvedFileName();
+ if (include.type() == CPlusPlus::Client::IncludeLocal)
+ return QLatin1Char('"') + unresolvedFileName + QLatin1Char('"');
+ return QLatin1Char('<') + unresolvedFileName + QLatin1Char('>');
+}
+
+QString pathListToString(const QStringList &pathList)
+{
+ QStringList result;
+ foreach (const QString &path, pathList)
+ result << QDir::toNativeSeparators(path);
+ return result.join(QLatin1String("\n"));
+}
+
+QList<CPlusPlus::Document::Ptr> snapshotToList(const CPlusPlus::Snapshot &snapshot)
+{
+ QList<CPlusPlus::Document::Ptr> documents;
+ CPlusPlus::Snapshot::const_iterator it = snapshot.begin(), end = snapshot.end();
+ for (; it != end; ++it)
+ documents.append(it.value());
+ return documents;
+}
+
+template <class T> void resizeColumns(QTreeView *view)
+{
+ for (int column = 0; column < T::ColumnCount - 1; ++column)
+ view->resizeColumnToContents(column);
+}
+
+TextEditor::BaseTextEditor *currentEditor()
+{
+ return qobject_cast<TextEditor::BaseTextEditor*>(Core::EditorManager::currentEditor());
+}
+
+QString fileInCurrentEditor()
+{
+ if (TextEditor::BaseTextEditor *editor = currentEditor())
+ return editor->document()->filePath();
+ return QString();
+}
+
+class DepthFinder : public CPlusPlus::SymbolVisitor {
+public:
+ DepthFinder() : m_symbol(0), m_depth(-1), m_foundDepth(-1), m_stop(false) {}
+
+ int operator()(const CPlusPlus::Document::Ptr &document, CPlusPlus::Symbol *symbol)
+ {
+ m_symbol = symbol;
+ accept(document->globalNamespace());
+ return m_foundDepth;
+ }
+
+ bool preVisit(CPlusPlus::Symbol *symbol)
+ {
+ if (m_stop)
+ return false;
+
+ if (symbol->asScope()) {
+ ++m_depth;
+ if (symbol == m_symbol) {
+ m_foundDepth = m_depth;
+ m_stop = true;
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ void postVisit(CPlusPlus::Symbol *symbol)
+ {
+ if (symbol->asScope())
+ --m_depth;
+ }
+
+private:
+ CPlusPlus::Symbol *m_symbol;
+ int m_depth;
+ int m_foundDepth;
+ bool m_stop;
+};
+
+class CppCodeModelInspectorDumper
+{
+public:
+ explicit CppCodeModelInspectorDumper(const CPlusPlus::Snapshot &globalSnapshot);
+ ~CppCodeModelInspectorDumper();
+
+ void dumpProjectInfos(const QList<CppModelManagerInterface::ProjectInfo> &projectInfos);
+ void dumpSnapshot(const CPlusPlus::Snapshot &snapshot, const QString &title,
+ bool isGlobalSnapshot = false);
+ void dumpWorkingCopy(const CppModelManagerInterface::WorkingCopy &workingCopy);
+
+private:
+ void dumpDocuments(const QList<CPlusPlus::Document::Ptr> &documents,
+ bool skipDetails = false);
+ static QByteArray indent(int level);
+
+ CPlusPlus::Snapshot m_globalSnapshot;
+ QFile m_logFile;
+ QTextStream m_out;
+};
+
+CppCodeModelInspectorDumper::CppCodeModelInspectorDumper(const CPlusPlus::Snapshot &globalSnapshot)
+ : m_globalSnapshot(globalSnapshot), m_out(stderr)
+{
+ const QString logFileName = QDir::tempPath()
+ + QString::fromLatin1("/qtc-codemodelinspection.txt");
+ m_logFile.setFileName(logFileName);
+ if (m_logFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ m_out << "Code model inspection log file is \"" << QDir::toNativeSeparators(logFileName)
+ << "\".\n";
+ m_out.setDevice(&m_logFile);
+ }
+ m_out << "*** START Code Model Inspection Report for ";
+ QString ideRevision;
+#ifdef IDE_REVISION
+ ideRevision = QLatin1String(" from revision ")
+ + QString::fromLatin1(Core::Constants::IDE_REVISION_STR).left(10);
+#endif
+ m_out << Core::ICore::versionString() << ideRevision << "\n";
+ m_out << "Note: This file contains vim fold markers (\"{{{n\"). "
+ "Make use of them via \":set foldmethod=marker\".\n";
+}
+
+CppCodeModelInspectorDumper::~CppCodeModelInspectorDumper()
+{
+ m_out << "*** END Code Model Inspection Report\n";
+}
+
+void CppCodeModelInspectorDumper::dumpProjectInfos(
+ const QList<CppModelManagerInterface::ProjectInfo> &projectInfos)
+{
+ const QByteArray i1 = indent(1);
+ const QByteArray i2 = indent(2);
+ const QByteArray i3 = indent(3);
+ const QByteArray i4 = indent(4);
+
+ m_out << "Projects loaded: " << projectInfos.size() << "{{{1\n";
+ foreach (const CppModelManagerInterface::ProjectInfo &info, projectInfos) {
+ const QPointer<ProjectExplorer::Project> project = info.project();
+ m_out << i1 << "Project " << project->displayName() << " (" << project->projectFilePath()
+ << "){{{2\n";
+
+ const QList<ProjectPart::Ptr> projectParts = info.projectParts();
+ foreach (const ProjectPart::Ptr &part, projectParts) {
+ QString projectName = QLatin1String("<None>");
+ QString projectFilePath = QLatin1String("<None>");
+ if (ProjectExplorer::Project *project = part->project) {
+ projectName = project->displayName();
+ projectFilePath = project->projectFilePath();
+ }
+ m_out << i2 << "Project Part \"" << part->projectFile << "\"{{{3\n";
+ m_out << i3 << "Project Part Name: " << part->displayName << "\n";
+ m_out << i3 << "Project Name : " << projectName << "\n";
+ m_out << i3 << "Project File : " << projectFilePath << "\n";
+ m_out << i3 << "C Version : " << toString(part->cVersion) << "\n";
+ m_out << i3 << "CXX Version : " << toString(part->cxxVersion) << "\n";
+ m_out << i3 << "CXX Extensions : " << toString(part->cxxExtensions) << "\n";
+ m_out << i3 << "Qt Version : " << toString(part->qtVersion) << "\n";
+
+ if (!part->files.isEmpty()) {
+ m_out << i3 << "Files:{{{4\n";
+ foreach (const ProjectFile &projectFile, part->files) {
+ m_out << i4 << toString(projectFile.kind) << ": " << projectFile.path
+ << "\n";
+ }
+ }
+
+ if (!part->toolchainDefines.isEmpty()) {
+ m_out << i3 << "Toolchain Defines:{{{4\n";
+ const QList<QByteArray> defineLines = part->toolchainDefines.split('\n');
+ foreach (const QByteArray &defineLine, defineLines)
+ m_out << i4 << defineLine << "\n";
+ }
+ if (!part->projectDefines.isEmpty()) {
+ m_out << i3 << "Project Defines:{{{4\n";
+ const QList<QByteArray> defineLines = part->projectDefines.split('\n');
+ foreach (const QByteArray &defineLine, defineLines)
+ m_out << i4 << defineLine << "\n";
+ }
+
+ if (!part->includePaths.isEmpty()) {
+ m_out << i3 << "Include Paths:{{{4\n";
+ foreach (const QString &includePath, part->includePaths)
+ m_out << i4 << includePath << "\n";
+ }
+
+ if (!part->frameworkPaths.isEmpty()) {
+ m_out << i3 << "Framework Paths:{{{4\n";
+ foreach (const QString &frameworkPath, part->frameworkPaths)
+ m_out << i4 << frameworkPath << "\n";
+ }
+
+ if (!part->precompiledHeaders.isEmpty()) {
+ m_out << i3 << "Precompiled Headers:{{{4\n";
+ foreach (const QString &precompiledHeader, part->precompiledHeaders)
+ m_out << i4 << precompiledHeader << "\n";
+ }
+ } // for part
+ } // for project Info
+}
+
+void CppCodeModelInspectorDumper::dumpSnapshot(const CPlusPlus::Snapshot &snapshot,
+ const QString &title, bool isGlobalSnapshot)
+{
+ m_out << "Snapshot \"" << title << "\"{{{1\n";
+
+ const QByteArray i1 = indent(1);
+ const QList<CPlusPlus::Document::Ptr> documents = snapshotToList(snapshot);
+
+ if (isGlobalSnapshot) {
+ if (!documents.isEmpty()) {
+ m_out << i1 << "Globally-Shared documents{{{2\n";
+ dumpDocuments(documents, false);
+ }
+ } else {
+ // Divide into shared and not shared
+ QList<CPlusPlus::Document::Ptr> globallyShared;
+ QList<CPlusPlus::Document::Ptr> notGloballyShared;
+ foreach (const CPlusPlus::Document::Ptr &document, documents) {
+ CPlusPlus::Document::Ptr globalDocument = m_globalSnapshot.document(document->fileName());
+ if (globalDocument && globalDocument->fingerprint() == document->fingerprint())
+ globallyShared.append(document);
+ else
+ notGloballyShared.append(document);
+ }
+
+ if (!notGloballyShared.isEmpty()) {
+ m_out << i1 << "Not-Globally-Shared documents:{{{2\n";
+ dumpDocuments(notGloballyShared);
+ }
+ if (!globallyShared.isEmpty()) {
+ m_out << i1 << "Globally-Shared documents{{{2\n";
+ dumpDocuments(globallyShared, true);
+ }
+ }
+}
+
+void CppCodeModelInspectorDumper::dumpWorkingCopy(
+ const CppModelManagerInterface::WorkingCopy &workingCopy)
+{
+ m_out << "Working Copy contains " << workingCopy.size() << " entries{{{1\n";
+
+ const QByteArray i1 = indent(1);
+ QHashIterator<QString, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
+ while (it.hasNext()) {
+ it.next();
+ const QString filePath = it.key();
+ unsigned sourcRevision = it.value().second;
+ m_out << i1 << "rev=" << sourcRevision << ", " << filePath << "\n";
+ }
+}
+
+void CppCodeModelInspectorDumper::dumpDocuments(const QList<CPlusPlus::Document::Ptr> &documents,
+ bool skipDetails)
+{
+ const QByteArray i2 = indent(2);
+ const QByteArray i3 = indent(3);
+ const QByteArray i4 = indent(4);
+ foreach (const CPlusPlus::Document::Ptr &document, documents) {
+ if (skipDetails) {
+ m_out << i2 << "\"" << document->fileName() << "\"\n";
+ continue;
+ }
+
+ m_out << i2 << "Document \"" << document->fileName() << "\"{{{3\n";
+ m_out << i3 << "Last Modified : " << toString(document->lastModified()) << "\n";
+ m_out << i3 << "Revision : " << toString(document->revision()) << "\n";
+ m_out << i3 << "Editor Revision: " << toString(document->editorRevision()) << "\n";
+ m_out << i3 << "Check Mode : " << toString(document->checkMode()) << "\n";
+ m_out << i3 << "Tokenized : " << toString(document->isTokenized()) << "\n";
+ m_out << i3 << "Parsed : " << toString(document->isParsed()) << "\n";
+ m_out << i3 << "Project Parts : " << partsForFile(document->fileName()) << "\n";
+
+ const QList<CPlusPlus::Document::Include> includes = document->unresolvedIncludes()
+ + document->resolvedIncludes();
+ if (!includes.isEmpty()) {
+ m_out << i3 << "Includes:{{{4\n";
+ foreach (const CPlusPlus::Document::Include &include, includes) {
+ m_out << i4 << "at line " << include.line() << ": "
+ << unresolvedFileNameWithDelimiters(include) << " ==> "
+ << include.resolvedFileName() << "\n";
+ }
+ }
+
+ const QList<CPlusPlus::Document::DiagnosticMessage> diagnosticMessages
+ = document->diagnosticMessages();
+ if (!diagnosticMessages.isEmpty()) {
+ m_out << i3 << "Diagnostic Messages:{{{4\n";
+ foreach (const CPlusPlus::Document::DiagnosticMessage &msg, diagnosticMessages) {
+ const CPlusPlus::Document::DiagnosticMessage::Level level
+ = static_cast<CPlusPlus::Document::DiagnosticMessage::Level>(msg.level());
+ m_out << i4 << "at " << msg.line() << ":" << msg.column() << ", " << toString(level)
+ << ": " << msg.text() << "\n";
+ }
+ }
+
+ const QList<CPlusPlus::Macro> macroDefinitions = document->definedMacros();
+ if (!macroDefinitions.isEmpty()) {
+ m_out << i3 << "(Un)Defined Macros:{{{4\n";
+ foreach (const CPlusPlus::Macro &macro, macroDefinitions)
+ m_out << i4 << "at line " << macro.line() << ": " << macro.toString() << "\n";
+ }
+
+ const QList<CPlusPlus::Document::MacroUse> macroUses = document->macroUses();
+ if (!macroUses.isEmpty()) {
+ m_out << i3 << "Macro Uses:{{{4\n";
+ foreach (const CPlusPlus::Document::MacroUse &use, macroUses) {
+ const QString type = use.isFunctionLike()
+ ? QLatin1String("function-like") : QLatin1String("object-like");
+ m_out << i4 << "at line " << use.beginLine() << ", "
+ << QString::fromUtf8(use.macro().name()) << ", begin=" << use.begin()
+ << ", end=" << use.end() << ", " << type << ", args="
+ << use.arguments().size() << "\n";
+ }
+ }
+
+ const QString source = QString::fromUtf8(document->utf8Source());
+ if (!source.isEmpty()) {
+ m_out << i4 << "Source:{{{4\n";
+ m_out << source;
+ m_out << "\n<<<EOF\n";
+ }
+ }
+}
+
+QByteArray CppCodeModelInspectorDumper::indent(int level)
+{
+ const QByteArray basicIndent(" ");
+ QByteArray indent = basicIndent;
+ while (level-- > 1)
+ indent += basicIndent;
+ return indent;
+}
+
+} // anonymous namespace
+
+namespace CppEditor {
+namespace Internal {
+
+// --- FilterableView -----------------------------------------------------------------------------
+
+class FilterableView : public QWidget
+{
+ Q_OBJECT
+public:
+ FilterableView(QWidget *parent);
+
+ void setModel(QAbstractItemModel *model);
+ QItemSelectionModel *selectionModel() const;
+ void selectIndex(const QModelIndex &index);
+ void resizeColumns(int columnCount);
+
+signals:
+ void filterChanged(const QString &filterText);
+
+public slots:
+ void clearFilter();
+
+private:
+ QTreeView *view;
+ QLineEdit *lineEdit;
+};
+
+FilterableView::FilterableView(QWidget *parent)
+ : QWidget(parent)
+{
+ view = new QTreeView(this);
+ view->setAlternatingRowColors(true);
+ view->setTextElideMode(Qt::ElideMiddle);
+ view->setSortingEnabled(true);
+
+ lineEdit = new QLineEdit(this);
+ lineEdit->setPlaceholderText(QLatin1String("File Path"));
+ QObject::connect(lineEdit, SIGNAL(textChanged(QString)), SIGNAL(filterChanged(QString)));
+
+ QLabel *label = new QLabel(QLatin1String("&Filter:"), this);
+ label->setBuddy(lineEdit);
+
+ QPushButton *clearButton = new QPushButton(QLatin1String("&Clear"), this);
+ QObject::connect(clearButton, SIGNAL(clicked()), SLOT(clearFilter()));
+
+ QHBoxLayout *filterBarLayout = new QHBoxLayout();
+ filterBarLayout->addWidget(label);
+ filterBarLayout->addWidget(lineEdit);
+ filterBarLayout->addWidget(clearButton);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainLayout->addWidget(view);
+ mainLayout->addLayout(filterBarLayout);
+
+ setLayout(mainLayout);
+}
+
+void FilterableView::setModel(QAbstractItemModel *model)
+{
+ view->setModel(model);
+}
+
+QItemSelectionModel *FilterableView::selectionModel() const
+{
+ return view->selectionModel();
+}
+
+void FilterableView::selectIndex(const QModelIndex &index)
+{
+ if (index.isValid()) {
+ view->selectionModel()->setCurrentIndex(index,
+ QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+ }
+}
+
+void FilterableView::resizeColumns(int columnCount)
+{
+ for (int column = 0; column < columnCount - 1; ++column)
+ view->resizeColumnToContents(column);
+}
+
+void FilterableView::clearFilter()
+{
+ lineEdit->clear();
+}
+
+// --- KeyValueModel ------------------------------------------------------------------------------
+
+class KeyValueModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ typedef QList<QPair<QString, QString> > Table;
+
+ KeyValueModel(QObject *parent);
+ void configure(const Table &table);
+ void clear();
+
+ enum Columns { KeyColumn, ValueColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ Table m_table;
+};
+
+KeyValueModel::KeyValueModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void KeyValueModel::configure(const Table &table)
+{
+ emit layoutAboutToBeChanged();
+ m_table = table;
+ emit layoutChanged();
+}
+
+void KeyValueModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_table.clear();
+ emit layoutChanged();
+}
+
+int KeyValueModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_table.size();
+}
+
+int KeyValueModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return KeyValueModel::ColumnCount;
+}
+
+QVariant KeyValueModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole) {
+ const int row = index.row();
+ const int column = index.column();
+ if (column == KeyColumn) {
+ return m_table.at(row).first;
+ } else if (column == ValueColumn) {
+ return m_table.at(row).second;
+ }
+ }
+ return QVariant();
+}
+
+QVariant KeyValueModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case KeyColumn:
+ return QLatin1String("Key");
+ case ValueColumn:
+ return QLatin1String("Value");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- SnapshotModel ------------------------------------------------------------------------------
+
+class SnapshotModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ SnapshotModel(QObject *parent);
+ void configure(const CPlusPlus::Snapshot &snapshot);
+ void setGlobalSnapshot(const CPlusPlus::Snapshot &snapshot);
+
+ QModelIndex indexForDocument(const QString &filePath);
+
+ enum Columns { SymbolCountColumn, SharedColumn, FilePathColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ QList<CPlusPlus::Document::Ptr> m_documents;
+ CPlusPlus::Snapshot m_globalSnapshot;
+};
+
+SnapshotModel::SnapshotModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void SnapshotModel::configure(const CPlusPlus::Snapshot &snapshot)
+{
+ emit layoutAboutToBeChanged();
+ m_documents = snapshotToList(snapshot);
+ emit layoutChanged();
+}
+
+void SnapshotModel::setGlobalSnapshot(const CPlusPlus::Snapshot &snapshot)
+{
+ m_globalSnapshot = snapshot;
+}
+
+QModelIndex SnapshotModel::indexForDocument(const QString &filePath)
+{
+ for (int i = 0, total = m_documents.size(); i < total; ++i) {
+ const CPlusPlus::Document::Ptr document = m_documents.at(i);
+ if (document->fileName() == filePath)
+ return index(i, FilePathColumn);
+ }
+ return QModelIndex();
+}
+
+int SnapshotModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_documents.size();
+}
+
+int SnapshotModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return SnapshotModel::ColumnCount;
+}
+
+QVariant SnapshotModel::data(const QModelIndex &index, int role) const
+{
+ if (role == Qt::DisplayRole) {
+ const int column = index.column();
+ CPlusPlus::Document::Ptr document = m_documents.at(index.row());
+ if (column == SymbolCountColumn) {
+ return document->control()->symbolCount();
+ } else if (column == SharedColumn) {
+ CPlusPlus::Document::Ptr globalDocument = m_globalSnapshot.document(document->fileName());
+ const bool isShared
+ = globalDocument && globalDocument->fingerprint() == document->fingerprint();
+ return toString(isShared);
+ } else if (column == FilePathColumn) {
+ return QDir::toNativeSeparators(document->fileName());
+ }
+ }
+ return QVariant();
+}
+
+QVariant SnapshotModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case SymbolCountColumn:
+ return QLatin1String("Symbols");
+ case SharedColumn:
+ return QLatin1String("Shared");
+ case FilePathColumn:
+ return QLatin1String("File Path");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- IncludesModel ------------------------------------------------------------------------------
+
+static bool includesSorter(const CPlusPlus::Document::Include &i1,
+ const CPlusPlus::Document::Include &i2)
+{
+ return i1.line() < i2.line();
+}
+
+class IncludesModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ IncludesModel(QObject *parent);
+ void configure(const QList<CPlusPlus::Document::Include> &includes);
+ void clear();
+
+ enum Columns { ResolvedOrNotColumn, LineNumberColumn, FilePathsColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ QList<CPlusPlus::Document::Include> m_includes;
+};
+
+IncludesModel::IncludesModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void IncludesModel::configure(const QList<CPlusPlus::Document::Include> &includes)
+{
+ emit layoutAboutToBeChanged();
+ m_includes = includes;
+ qStableSort(m_includes.begin(), m_includes.end(), includesSorter);
+ emit layoutChanged();
+}
+
+void IncludesModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_includes.clear();
+ emit layoutChanged();
+}
+
+int IncludesModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_includes.size();
+}
+
+int IncludesModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return IncludesModel::ColumnCount;
+}
+
+QVariant IncludesModel::data(const QModelIndex &index, int role) const
+{
+ if (role != Qt::DisplayRole && role != Qt::ForegroundRole)
+ return QVariant();
+
+ static const QBrush greenBrush(QColor(0, 139, 69));
+ static const QBrush redBrush(QColor(205, 38, 38));
+
+ const CPlusPlus::Document::Include include = m_includes.at(index.row());
+ const QString resolvedFileName = QDir::toNativeSeparators(include.resolvedFileName());
+ const bool isResolved = !resolvedFileName.isEmpty();
+
+ if (role == Qt::DisplayRole) {
+ const int column = index.column();
+ if (column == ResolvedOrNotColumn) {
+ return toString(isResolved);
+ } else if (column == LineNumberColumn) {
+ return include.line();
+ } else if (column == FilePathsColumn) {
+ return QVariant(unresolvedFileNameWithDelimiters(include) + QLatin1String(" --> ")
+ + resolvedFileName);
+ }
+ } else if (role == Qt::ForegroundRole) {
+ return isResolved ? greenBrush : redBrush;
+ }
+
+ return QVariant();
+}
+
+QVariant IncludesModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case ResolvedOrNotColumn:
+ return QLatin1String("Resolved");
+ case LineNumberColumn:
+ return QLatin1String("Line");
+ case FilePathsColumn:
+ return QLatin1String("File Paths");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- DiagnosticMessagesModel --------------------------------------------------------------------
+
+static bool diagnosticMessagesModelSorter(const CPlusPlus::Document::DiagnosticMessage &m1,
+ const CPlusPlus::Document::DiagnosticMessage &m2)
+{
+ return m1.line() < m2.line();
+}
+
+class DiagnosticMessagesModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ DiagnosticMessagesModel(QObject *parent);
+ void configure(const QList<CPlusPlus::Document::DiagnosticMessage> &messages);
+ void clear();
+
+ enum Columns { LevelColumn, LineColumnNumberColumn, MessageColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ QList<CPlusPlus::Document::DiagnosticMessage> m_messages;
+};
+
+DiagnosticMessagesModel::DiagnosticMessagesModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void DiagnosticMessagesModel::configure(
+ const QList<CPlusPlus::Document::DiagnosticMessage> &messages)
+{
+ emit layoutAboutToBeChanged();
+ m_messages = messages;
+ qStableSort(m_messages.begin(), m_messages.end(), diagnosticMessagesModelSorter);
+ emit layoutChanged();
+}
+
+void DiagnosticMessagesModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_messages.clear();
+ emit layoutChanged();
+}
+
+int DiagnosticMessagesModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_messages.size();
+}
+
+int DiagnosticMessagesModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return DiagnosticMessagesModel::ColumnCount;
+}
+
+QVariant DiagnosticMessagesModel::data(const QModelIndex &index, int role) const
+{
+ if (role != Qt::DisplayRole && role != Qt::ForegroundRole)
+ return QVariant();
+
+ static const QBrush yellowOrangeBrush(QColor(237, 145, 33));
+ static const QBrush redBrush(QColor(205, 38, 38));
+ static const QBrush darkRedBrushQColor(QColor(139, 0, 0));
+
+ const CPlusPlus::Document::DiagnosticMessage message = m_messages.at(index.row());
+ const CPlusPlus::Document::DiagnosticMessage::Level level
+ = static_cast<CPlusPlus::Document::DiagnosticMessage::Level>(message.level());
+
+ if (role == Qt::DisplayRole) {
+ const int column = index.column();
+ if (column == LevelColumn) {
+ return toString(level);
+ } else if (column == LineColumnNumberColumn) {
+ return QVariant(QString::number(message.line()) + QLatin1Char(':')
+ + QString::number(message.column()));
+ } else if (column == MessageColumn) {
+ return message.text();
+ }
+ } else if (role == Qt::ForegroundRole) {
+ switch (level) {
+ case CPlusPlus::Document::DiagnosticMessage::Warning:
+ return yellowOrangeBrush;
+ case CPlusPlus::Document::DiagnosticMessage::Error:
+ return redBrush;
+ case CPlusPlus::Document::DiagnosticMessage::Fatal:
+ return darkRedBrushQColor;
+ default:
+ return QVariant();
+ }
+ }
+
+ return QVariant();
+}
+
+QVariant DiagnosticMessagesModel::headerData(int section, Qt::Orientation orientation, int role)
+ const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case LevelColumn:
+ return QLatin1String("Level");
+ case LineColumnNumberColumn:
+ return QLatin1String("Line:Column");
+ case MessageColumn:
+ return QLatin1String("Message");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- MacrosModel --------------------------------------------------------------------------------
+
+class MacrosModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ MacrosModel(QObject *parent);
+ void configure(const QList<CPlusPlus::Macro> &macros);
+ void clear();
+
+ enum Columns { LineNumberColumn, MacroColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ QList<CPlusPlus::Macro> m_macros;
+};
+
+MacrosModel::MacrosModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void MacrosModel::configure(const QList<CPlusPlus::Macro> &macros)
+{
+ emit layoutAboutToBeChanged();
+ m_macros = macros;
+ emit layoutChanged();
+}
+
+void MacrosModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_macros.clear();
+ emit layoutChanged();
+}
+
+int MacrosModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_macros.size();
+}
+
+int MacrosModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return MacrosModel::ColumnCount;
+}
+
+QVariant MacrosModel::data(const QModelIndex &index, int role) const
+{
+ const int column = index.column();
+ if (role == Qt::DisplayRole || (role == Qt::ToolTipRole && column == MacroColumn)) {
+ const CPlusPlus::Macro macro = m_macros.at(index.row());
+ if (column == LineNumberColumn)
+ return macro.line();
+ else if (column == MacroColumn)
+ return macro.toString();
+ } else if (role == Qt::TextAlignmentRole) {
+ return Qt::AlignTop + Qt::AlignLeft;
+ }
+ return QVariant();
+}
+
+QVariant MacrosModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case LineNumberColumn:
+ return QLatin1String("Line");
+ case MacroColumn:
+ return QLatin1String("Macro");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- SymbolsModel -------------------------------------------------------------------------------
+
+class SymbolsModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ SymbolsModel(QObject *parent);
+ void configure(const CPlusPlus::Document::Ptr &document);
+ void clear();
+
+ enum Columns { SymbolColumn, LineNumberColumn, ColumnCount };
+
+ QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ QModelIndex parent(const QModelIndex &child) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ CPlusPlus::Document::Ptr m_document;
+};
+
+SymbolsModel::SymbolsModel(QObject *parent) : QAbstractItemModel(parent)
+{
+}
+
+void SymbolsModel::configure(const CPlusPlus::Document::Ptr &document)
+{
+ QTC_CHECK(document);
+ emit layoutAboutToBeChanged();
+ m_document = document;
+ emit layoutChanged();
+}
+
+void SymbolsModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_document.clear();
+ emit layoutChanged();
+}
+
+static CPlusPlus::Symbol *indexToSymbol(const QModelIndex &index)
+{
+ if (CPlusPlus::Symbol *symbol = static_cast<CPlusPlus::Symbol*>(index.internalPointer()))
+ return symbol;
+ return 0;
+}
+
+static CPlusPlus::Scope *indexToScope(const QModelIndex &index)
+{
+ if (CPlusPlus::Symbol *symbol = indexToSymbol(index))
+ return symbol->asScope();
+ return 0;
+}
+
+QModelIndex SymbolsModel::index(int row, int column, const QModelIndex &parent) const
+{
+ CPlusPlus::Scope *scope = 0;
+ if (parent.isValid())
+ scope = indexToScope(parent);
+ else if (m_document)
+ scope = m_document->globalNamespace();
+
+ if (scope) {
+ if ((unsigned)row < scope->memberCount())
+ return createIndex(row, column, scope->memberAt(row));
+ }
+
+ return QModelIndex();
+}
+
+QModelIndex SymbolsModel::parent(const QModelIndex &child) const
+{
+ if (!child.isValid())
+ return QModelIndex();
+
+ if (CPlusPlus::Symbol *symbol = indexToSymbol(child)) {
+ if (CPlusPlus::Scope *scope = symbol->enclosingScope()) {
+ const int row = DepthFinder()(m_document, scope);
+ return createIndex(row, 0, scope);
+ }
+ }
+
+ return QModelIndex();
+}
+
+int SymbolsModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid()) {
+ if (CPlusPlus::Scope *scope = indexToScope(parent))
+ return scope->memberCount();
+ } else {
+ if (m_document)
+ return m_document->globalNamespace()->memberCount();
+ }
+ return 0;
+}
+
+int SymbolsModel::columnCount(const QModelIndex &) const
+{
+ return ColumnCount;
+}
+
+QVariant SymbolsModel::data(const QModelIndex &index, int role) const
+{
+ const int column = index.column();
+ if (role == Qt::DisplayRole) {
+ CPlusPlus::Symbol *symbol = indexToSymbol(index);
+ if (!symbol)
+ return QVariant();
+ if (column == LineNumberColumn) {
+ return symbol->line();
+ } else if (column == SymbolColumn) {
+ QString name = CPlusPlus::Overview().prettyName(symbol->name());
+ if (name.isEmpty())
+ name = QLatin1String("<no name>");
+ return name;
+ }
+ }
+ return QVariant();
+}
+
+QVariant SymbolsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case SymbolColumn:
+ return QLatin1String("Symbol");
+ case LineNumberColumn:
+ return QLatin1String("Line");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- TokensModel --------------------------------------------------------------------------------
+
+class TokensModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ TokensModel(QObject *parent);
+ void configure(CPlusPlus::TranslationUnit *translationUnit);
+ void clear();
+
+ enum Columns { SpelledColumn, KindColumn, IndexColumn, OffsetColumn, LineColumnNumberColumn,
+ LengthColumn, GeneratedColumn, ExpandedColumn, WhiteSpaceColumn, NewlineColumn,
+ ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ struct TokenInfo {
+ CPlusPlus::Token token;
+ unsigned line;
+ unsigned column;
+ };
+ QList<TokenInfo> m_tokenInfos;
+};
+
+TokensModel::TokensModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void TokensModel::configure(CPlusPlus::TranslationUnit *translationUnit)
+{
+ if (!translationUnit)
+ return;
+
+ emit layoutAboutToBeChanged();
+ m_tokenInfos.clear();
+ for (int i = 0, total = translationUnit->tokenCount(); i < total; ++i) {
+ TokenInfo info;
+ info.token = translationUnit->tokenAt(i);
+ translationUnit->getPosition(info.token.offset, &info.line, &info.column);
+ m_tokenInfos.append(info);
+ }
+ emit layoutChanged();
+}
+
+void TokensModel::clear()
+{
+ emit layoutAboutToBeChanged();
+ m_tokenInfos.clear();
+ emit layoutChanged();
+}
+
+int TokensModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_tokenInfos.size();
+}
+
+int TokensModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return TokensModel::ColumnCount;
+}
+
+QVariant TokensModel::data(const QModelIndex &index, int role) const
+{
+ const int column = index.column();
+ if (role == Qt::DisplayRole) {
+ const TokenInfo info = m_tokenInfos.at(index.row());
+ const CPlusPlus::Token token = info.token;
+ if (column == SpelledColumn)
+ return QString::fromUtf8(token.spell());
+ else if (column == KindColumn)
+ return toString(static_cast<CPlusPlus::Kind>(token.kind()));
+ else if (column == IndexColumn)
+ return index.row();
+ else if (column == OffsetColumn)
+ return token.offset;
+ else if (column == LineColumnNumberColumn)
+ return QString::fromLatin1("%1:%2").arg(toString(info.line), toString(info.column));
+ else if (column == LengthColumn)
+ return toString(token.length());
+ else if (column == GeneratedColumn)
+ return toString(token.generated());
+ else if (column == ExpandedColumn)
+ return toString(token.expanded());
+ else if (column == WhiteSpaceColumn)
+ return toString(token.whitespace());
+ else if (column == NewlineColumn)
+ return toString(token.newline());
+ } else if (role == Qt::TextAlignmentRole) {
+ return Qt::AlignTop + Qt::AlignLeft;
+ }
+ return QVariant();
+}
+
+QVariant TokensModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case SpelledColumn:
+ return QLatin1String("Spelled");
+ case KindColumn:
+ return QLatin1String("Kind");
+ case IndexColumn:
+ return QLatin1String("Index");
+ case OffsetColumn:
+ return QLatin1String("Offset");
+ case LineColumnNumberColumn:
+ return QLatin1String("Line:Column");
+ case LengthColumn:
+ return QLatin1String("Length");
+ case GeneratedColumn:
+ return QLatin1String("Generated");
+ case ExpandedColumn:
+ return QLatin1String("Expanded");
+ case WhiteSpaceColumn:
+ return QLatin1String("Whitespace");
+ case NewlineColumn:
+ return QLatin1String("Newline");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- ProjectPartsModel --------------------------------------------------------------------------
+
+class ProjectPartsModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ ProjectPartsModel(QObject *parent);
+
+ void configure(const QList<CppModelManagerInterface::ProjectInfo> &projectInfos,
+ const ProjectPart::Ptr &currentEditorsProjectPart);
+
+ QModelIndex indexForCurrentEditorsProjectPart() const;
+ ProjectPart::Ptr projectPartForProjectFile(const QString &projectFilePath) const;
+
+ enum Columns { PartNameColumn, PartFilePathColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ QList<ProjectPart::Ptr> m_projectPartsList;
+ int m_currentEditorsProjectPartIndex;
+};
+
+ProjectPartsModel::ProjectPartsModel(QObject *parent)
+ : QAbstractListModel(parent), m_currentEditorsProjectPartIndex(-1)
+{
+}
+
+void ProjectPartsModel::configure(const QList<CppModelManagerInterface::ProjectInfo> &projectInfos,
+ const ProjectPart::Ptr &currentEditorsProjectPart)
+{
+ emit layoutAboutToBeChanged();
+ m_projectPartsList.clear();
+ foreach (const CppModelManagerInterface::ProjectInfo &info, projectInfos) {
+ foreach (const ProjectPart::Ptr &projectPart, info.projectParts()) {
+ if (!m_projectPartsList.contains(projectPart)) {
+ m_projectPartsList << projectPart;
+ if (projectPart == currentEditorsProjectPart)
+ m_currentEditorsProjectPartIndex = m_projectPartsList.size() - 1;
+ }
+ }
+ }
+ emit layoutChanged();
+}
+
+QModelIndex ProjectPartsModel::indexForCurrentEditorsProjectPart() const
+{
+ if (m_currentEditorsProjectPartIndex == -1)
+ return QModelIndex();
+ return createIndex(m_currentEditorsProjectPartIndex, PartFilePathColumn);
+}
+
+ProjectPart::Ptr ProjectPartsModel::projectPartForProjectFile(const QString &projectFilePath) const
+{
+ foreach (const ProjectPart::Ptr &part, m_projectPartsList) {
+ if (part->projectFile == projectFilePath)
+ return part;
+ }
+ return ProjectPart::Ptr();
+}
+
+int ProjectPartsModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_projectPartsList.size();
+}
+
+int ProjectPartsModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return ProjectPartsModel::ColumnCount;
+}
+
+QVariant ProjectPartsModel::data(const QModelIndex &index, int role) const
+{
+ const int row = index.row();
+ if (role == Qt::DisplayRole) {
+ const int column = index.column();
+ if (column == PartNameColumn)
+ return m_projectPartsList.at(row)->displayName;
+ else if (column == PartFilePathColumn)
+ return QDir::toNativeSeparators(m_projectPartsList.at(row)->projectFile);
+ }
+ return QVariant();
+}
+
+QVariant ProjectPartsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case PartNameColumn:
+ return QLatin1String("Name");
+ case PartFilePathColumn:
+ return QLatin1String("Project File Path");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- WorkingCopyModel ---------------------------------------------------------------------------
+
+class WorkingCopyModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ WorkingCopyModel(QObject *parent);
+
+ void configure(const CppModelManagerInterface::WorkingCopy &workingCopy);
+ QModelIndex indexForFile(const QString &filePath);
+
+ enum Columns { RevisionColumn, FilePathColumn, ColumnCount };
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
+private:
+ struct WorkingCopyEntry {
+ WorkingCopyEntry(const QString &filePath, const QByteArray &source, unsigned revision)
+ : filePath(filePath), source(source), revision(revision)
+ {}
+
+ QString filePath;
+ QByteArray source;
+ unsigned revision;
+ };
+
+ QList<WorkingCopyEntry> m_workingCopyList;
+};
+
+WorkingCopyModel::WorkingCopyModel(QObject *parent) : QAbstractListModel(parent)
+{
+}
+
+void WorkingCopyModel::configure(const CppModelManagerInterface::WorkingCopy &workingCopy)
+{
+ emit layoutAboutToBeChanged();
+ m_workingCopyList.clear();
+ QHashIterator<QString, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
+ while (it.hasNext()) {
+ it.next();
+ m_workingCopyList << WorkingCopyEntry(it.key(), it.value().first, it.value().second);
+ }
+ emit layoutChanged();
+}
+
+QModelIndex WorkingCopyModel::indexForFile(const QString &filePath)
+{
+ for (int i = 0, total = m_workingCopyList.size(); i < total; ++i) {
+ const WorkingCopyEntry entry = m_workingCopyList.at(i);
+ if (entry.filePath == filePath)
+ return index(i, FilePathColumn);
+ }
+ return QModelIndex();
+}
+
+int WorkingCopyModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return m_workingCopyList.size();
+}
+
+int WorkingCopyModel::columnCount(const QModelIndex &/*parent*/) const
+{
+ return WorkingCopyModel::ColumnCount;
+}
+
+QVariant WorkingCopyModel::data(const QModelIndex &index, int role) const
+{
+ const int row = index.row();
+ if (role == Qt::DisplayRole) {
+ const int column = index.column();
+ if (column == RevisionColumn)
+ return m_workingCopyList.at(row).revision;
+ else if (column == FilePathColumn)
+ return m_workingCopyList.at(row).filePath;
+ } else if (role == Qt::UserRole) {
+ return m_workingCopyList.at(row).source;
+ }
+ return QVariant();
+}
+
+QVariant WorkingCopyModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ switch (section) {
+ case RevisionColumn:
+ return QLatin1String("Revision");
+ case FilePathColumn:
+ return QLatin1String("File Path");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+// --- SnapshotInfo -------------------------------------------------------------------------------
+
+class SnapshotInfo
+{
+public:
+ enum Type { GlobalSnapshot, EditorSnapshot };
+ SnapshotInfo(const CPlusPlus::Snapshot &snapshot, Type type)
+ : snapshot(snapshot), type(type) {}
+
+ CPlusPlus::Snapshot snapshot;
+ Type type;
+};
+
+// --- CppCodeModelInspectorDialog ----------------------------------------------------------------
+
+CppCodeModelInspectorDialog::CppCodeModelInspectorDialog(QWidget *parent)
+ : QDialog(parent)
+ , m_ui(new Ui::CppCodeModelInspectorDialog)
+ , m_snapshotInfos(new QList<SnapshotInfo>())
+ , m_snapshotView(new FilterableView(this))
+ , m_snapshotModel(new SnapshotModel(this))
+ , m_proxySnapshotModel(new QSortFilterProxyModel(this))
+ , m_docGenericInfoModel(new KeyValueModel(this))
+ , m_docIncludesModel(new IncludesModel(this))
+ , m_docDiagnosticMessagesModel(new DiagnosticMessagesModel(this))
+ , m_docMacrosModel(new MacrosModel(this))
+ , m_docSymbolsModel(new SymbolsModel(this))
+ , m_docTokensModel(new TokensModel(this))
+ , m_projectPartsView(new FilterableView(this))
+ , m_projectPartsModel(new ProjectPartsModel(this))
+ , m_proxyProjectPartsModel(new QSortFilterProxyModel(this))
+ , m_partGenericInfoModel(new KeyValueModel(this))
+ , m_workingCopyView(new FilterableView(this))
+ , m_workingCopyModel(new WorkingCopyModel(this))
+ , m_proxyWorkingCopyModel(new QSortFilterProxyModel(this))
+{
+ m_ui->setupUi(this);
+ m_ui->snapshotSelectorAndViewLayout->addWidget(m_snapshotView);
+ m_ui->projectPartsSplitter->insertWidget(0, m_projectPartsView);
+ m_ui->workingCopySplitter->insertWidget(0, m_workingCopyView);
+
+ setAttribute(Qt::WA_DeleteOnClose);
+ connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()), SLOT(close()));
+
+ m_proxySnapshotModel->setSourceModel(m_snapshotModel);
+ m_proxySnapshotModel->setFilterKeyColumn(SnapshotModel::FilePathColumn);
+ m_snapshotView->setModel(m_proxySnapshotModel);
+ m_ui->docGeneralView->setModel(m_docGenericInfoModel);
+ m_ui->docIncludesView->setModel(m_docIncludesModel);
+ m_ui->docDiagnosticMessagesView->setModel(m_docDiagnosticMessagesModel);
+ m_ui->docDefinedMacrosView->setModel(m_docMacrosModel);
+ m_ui->docSymbolsView->setModel(m_docSymbolsModel);
+ m_ui->docTokensView->setModel(m_docTokensModel);
+
+ m_proxyProjectPartsModel->setSourceModel(m_projectPartsModel);
+ m_proxyProjectPartsModel->setFilterKeyColumn(ProjectPartsModel::PartFilePathColumn);
+ m_projectPartsView->setModel(m_proxyProjectPartsModel);
+ m_ui->partGeneralView->setModel(m_partGenericInfoModel);
+
+ m_proxyWorkingCopyModel->setSourceModel(m_workingCopyModel);
+ m_proxyWorkingCopyModel->setFilterKeyColumn(WorkingCopyModel::FilePathColumn);
+ m_workingCopyView->setModel(m_proxyWorkingCopyModel);
+
+ connect(m_snapshotView->selectionModel(),
+ SIGNAL(currentRowChanged(QModelIndex ,QModelIndex)),
+ SLOT(onDocumentSelected(QModelIndex, QModelIndex)));
+ connect(m_snapshotView, SIGNAL(filterChanged(QString)),
+ SLOT(onSnapshotFilterChanged(QString)));
+ connect(m_ui->snapshotSelector, SIGNAL(currentIndexChanged(int)),
+ SLOT(onSnapshotSelected(int)));
+ connect(m_ui->docSymbolsView, SIGNAL(expanded(QModelIndex)),
+ SLOT(onSymbolsViewExpandedOrCollapsed(QModelIndex)));
+ connect(m_ui->docSymbolsView, SIGNAL(collapsed(QModelIndex)),
+ SLOT(onSymbolsViewExpandedOrCollapsed(QModelIndex)));
+
+ connect(m_projectPartsView->selectionModel(),
+ SIGNAL(currentRowChanged(QModelIndex ,QModelIndex)),
+ SLOT(onProjectPartSelected(QModelIndex, QModelIndex)));
+ connect(m_projectPartsView, SIGNAL(filterChanged(QString)),
+ SLOT(onProjectPartFilterChanged(QString)));
+
+ connect(m_workingCopyView->selectionModel(),
+ SIGNAL(currentRowChanged(QModelIndex ,QModelIndex)),
+ SLOT(onWorkingCopyDocumentSelected(QModelIndex, QModelIndex)));
+ connect(m_workingCopyView, SIGNAL(filterChanged(QString)),
+ SLOT(onWorkingCopyFilterChanged(QString)));
+
+ connect(m_ui->refreshButton, SIGNAL(clicked()), SLOT(onRefreshRequested()));
+ connect(m_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
+
+ refresh();
+}
+
+CppCodeModelInspectorDialog::~CppCodeModelInspectorDialog()
+{
+ delete m_snapshotInfos;
+ delete m_ui;
+}
+
+void CppCodeModelInspectorDialog::onRefreshRequested()
+{
+ refresh();
+}
+
+void CppCodeModelInspectorDialog::onSnapshotFilterChanged(const QString &pattern)
+{
+ m_proxySnapshotModel->setFilterWildcard(pattern);
+}
+
+void CppCodeModelInspectorDialog::onSnapshotSelected(int row)
+{
+ if (row < 0 || row >= m_snapshotInfos->size())
+ return;
+
+ m_snapshotView->clearFilter();
+ const SnapshotInfo info = m_snapshotInfos->at(row);
+ m_snapshotModel->configure(info.snapshot);
+ m_snapshotView->resizeColumns(SnapshotModel::ColumnCount);
+
+ if (info.type == SnapshotInfo::GlobalSnapshot) {
+ // Select first document
+ const QModelIndex index = m_proxySnapshotModel->index(0, SnapshotModel::FilePathColumn);
+ m_snapshotView->selectIndex(index);
+ } else if (info.type == SnapshotInfo::EditorSnapshot) {
+ // Select first document, unless we can find the editor document
+ QModelIndex index = m_snapshotModel->indexForDocument(fileInCurrentEditor());
+ index = m_proxySnapshotModel->mapFromSource(index);
+ if (!index.isValid())
+ index = m_proxySnapshotModel->index(0, SnapshotModel::FilePathColumn);
+ m_snapshotView->selectIndex(index);
+ }
+}
+
+void CppCodeModelInspectorDialog::onDocumentSelected(const QModelIndex &current,
+ const QModelIndex &)
+{
+ if (current.isValid()) {
+ const QModelIndex index = m_proxySnapshotModel->index(current.row(),
+ SnapshotModel::FilePathColumn);
+ const QString filePath = QDir::fromNativeSeparators(
+ m_proxySnapshotModel->data(index, Qt::DisplayRole).toString());
+ const SnapshotInfo info = m_snapshotInfos->at(m_ui->snapshotSelector->currentIndex());
+ updateDocumentData(info.snapshot.document(filePath));
+ } else {
+ clearDocumentData();
+ }
+}
+
+void CppCodeModelInspectorDialog::onSymbolsViewExpandedOrCollapsed(const QModelIndex &)
+{
+ resizeColumns<SymbolsModel>(m_ui->docSymbolsView);
+}
+
+void CppCodeModelInspectorDialog::onProjectPartFilterChanged(const QString &pattern)
+{
+ m_proxyProjectPartsModel->setFilterWildcard(pattern);
+}
+
+void CppCodeModelInspectorDialog::onProjectPartSelected(const QModelIndex &current,
+ const QModelIndex &)
+{
+ if (current.isValid()) {
+ QModelIndex index = m_proxyProjectPartsModel->mapToSource(current);
+ if (index.isValid()) {
+ index = m_projectPartsModel->index(index.row(), ProjectPartsModel::PartFilePathColumn);
+ const QString projectFilePath = QDir::fromNativeSeparators(
+ m_projectPartsModel->data(index, Qt::DisplayRole).toString());
+ updateProjectPartData(m_projectPartsModel->projectPartForProjectFile(projectFilePath));
+ }
+ } else {
+ clearProjectPartData();
+ }
+}
+
+void CppCodeModelInspectorDialog::onWorkingCopyFilterChanged(const QString &pattern)
+{
+ m_proxyWorkingCopyModel->setFilterWildcard(pattern);
+}
+
+void CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected(const QModelIndex &current,
+ const QModelIndex &)
+{
+ if (current.isValid()) {
+ const QModelIndex index = m_proxyWorkingCopyModel->mapToSource(current);
+ if (index.isValid()) {
+ const QString source
+ = QString::fromUtf8(m_workingCopyModel->data(index, Qt::UserRole).toByteArray());
+ m_ui->workingCopySourceEdit->setPlainText(source);
+ }
+ } else {
+ m_ui->workingCopySourceEdit->setPlainText(QString());
+ }
+}
+
+void CppCodeModelInspectorDialog::refresh()
+{
+ CppModelManagerInterface *cmm = CppModelManagerInterface::instance();
+
+ const int oldSnapshotIndex = m_ui->snapshotSelector->currentIndex();
+ const bool selectEditorRelevant
+ = m_ui->selectEditorRelevantEntriesAfterRefreshCheckBox->isChecked();
+
+ // Snapshots and Documents
+ m_snapshotInfos->clear();
+ m_ui->snapshotSelector->clear();
+
+ const CPlusPlus::Snapshot globalSnapshot = cmm->snapshot();
+ CppCodeModelInspectorDumper dumper(globalSnapshot);
+ m_snapshotModel->setGlobalSnapshot(globalSnapshot);
+
+ m_snapshotInfos->append(SnapshotInfo(globalSnapshot, SnapshotInfo::GlobalSnapshot));
+ const QString globalSnapshotTitle
+ = QString::fromLatin1("Global/Indexing Snapshot (%1 Documents)").arg(globalSnapshot.size());
+ m_ui->snapshotSelector->addItem(globalSnapshotTitle);
+ dumper.dumpSnapshot(globalSnapshot, globalSnapshotTitle, /*isGlobalSnapshot=*/ true);
+
+ TextEditor::BaseTextEditor *editor = currentEditor();
+ CppEditorSupport *editorSupport = 0;
+ if (editor) {
+ editorSupport = cmm->cppEditorSupport(editor);
+ if (editorSupport) {
+ const CPlusPlus::Snapshot editorSnapshot = editorSupport->snapshotUpdater()->snapshot();
+ m_snapshotInfos->append(SnapshotInfo(editorSnapshot, SnapshotInfo::EditorSnapshot));
+ const QString editorSnapshotTitle
+ = QString::fromLatin1("Current Editor's Snapshot (%1 Documents)")
+ .arg(editorSnapshot.size());
+ dumper.dumpSnapshot(editorSnapshot, editorSnapshotTitle);
+ m_ui->snapshotSelector->addItem(editorSnapshotTitle);
+ }
+ CppEditor::Internal::CPPEditorWidget *cppEditorWidget
+ = qobject_cast<CppEditor::Internal::CPPEditorWidget *>(editor->editorWidget());
+ if (cppEditorWidget) {
+ SemanticInfo semanticInfo = cppEditorWidget->semanticInfo();
+ CPlusPlus::Snapshot snapshot;
+
+ // Add semantic info snapshot
+ snapshot = semanticInfo.snapshot;
+ m_snapshotInfos->append(SnapshotInfo(snapshot, SnapshotInfo::EditorSnapshot));
+ m_ui->snapshotSelector->addItem(
+ QString::fromLatin1("Current Editor's Semantic Info Snapshot (%1 Documents)")
+ .arg(snapshot.size()));
+
+ // Add a pseudo snapshot containing only the semantic info document since this document
+ // is not part of the semantic snapshot.
+ snapshot = CPlusPlus::Snapshot();
+ snapshot.insert(cppEditorWidget->semanticInfo().doc);
+ m_snapshotInfos->append(SnapshotInfo(snapshot, SnapshotInfo::EditorSnapshot));
+ const QString snapshotTitle
+ = QString::fromLatin1("Current Editor's Pseudo Snapshot with Semantic Info Document (%1 Documents)")
+ .arg(snapshot.size());
+ dumper.dumpSnapshot(snapshot, snapshotTitle);
+ m_ui->snapshotSelector->addItem(snapshotTitle);
+ }
+ }
+
+ int snapshotIndex = 0;
+ if (selectEditorRelevant) {
+ for (int i = 0, total = m_snapshotInfos->size(); i < total; ++i) {
+ const SnapshotInfo info = m_snapshotInfos->at(i);
+ if (info.type == SnapshotInfo::EditorSnapshot) {
+ snapshotIndex = i;
+ break;
+ }
+ }
+ } else if (oldSnapshotIndex < m_snapshotInfos->size()) {
+ snapshotIndex = oldSnapshotIndex;
+ }
+ m_ui->snapshotSelector->setCurrentIndex(snapshotIndex);
+ onSnapshotSelected(snapshotIndex);
+
+ // Project Parts
+ const ProjectPart::Ptr editorsProjectPart = editorSupport
+ ? editorSupport->snapshotUpdater()->currentProjectPart()
+ : ProjectPart::Ptr();
+
+ const QList<CppModelManagerInterface::ProjectInfo> projectInfos = cmm->projectInfos();
+ dumper.dumpProjectInfos(projectInfos);
+ m_projectPartsModel->configure(projectInfos, editorsProjectPart);
+ m_projectPartsView->resizeColumns(ProjectPartsModel::ColumnCount);
+ QModelIndex index = m_proxyProjectPartsModel->index(0, ProjectPartsModel::PartFilePathColumn);
+ if (index.isValid()) {
+ if (selectEditorRelevant && editorsProjectPart) {
+ QModelIndex editorPartIndex = m_projectPartsModel->indexForCurrentEditorsProjectPart();
+ editorPartIndex = m_proxyProjectPartsModel->mapFromSource(editorPartIndex);
+ if (editorPartIndex.isValid())
+ index = editorPartIndex;
+ }
+ m_projectPartsView->selectIndex(index);
+ }
+
+ // Working Copy
+ const CppModelManagerInterface::WorkingCopy workingCopy = cmm->workingCopy();
+ dumper.dumpWorkingCopy(workingCopy);
+ m_workingCopyModel->configure(workingCopy);
+ m_workingCopyView->resizeColumns(WorkingCopyModel::ColumnCount);
+ if (workingCopy.size() > 0) {
+ QModelIndex index = m_proxyWorkingCopyModel->index(0, WorkingCopyModel::FilePathColumn);
+ if (selectEditorRelevant) {
+ const QModelIndex eindex = m_workingCopyModel->indexForFile(fileInCurrentEditor());
+ if (eindex.isValid())
+ index = m_proxyWorkingCopyModel->mapFromSource(eindex);
+ }
+ m_workingCopyView->selectIndex(index);
+ }
+}
+
+enum DocumentTabs {
+ DocumentGeneralTab,
+ DocumentIncludesTab,
+ DocumentDiagnosticsTab,
+ DocumentDefinedMacrosTab,
+ DocumentPreprocessedSourceTab,
+ DocumentSymbolsTab,
+ DocumentTokensTab
+};
+
+static QString docTabName(int tabIndex, int numberOfEntries = -1)
+{
+ const char *names[] = {
+ "&General",
+ "&Includes",
+ "&Diagnostic Messages",
+ "(Un)Defined &Macros",
+ "P&reprocessed Source",
+ "&Symbols",
+ "&Tokens"
+ };
+ QString result = QLatin1String(names[tabIndex]);
+ if (numberOfEntries != -1)
+ result += QString::fromLatin1(" (%1)").arg(numberOfEntries);
+ return result;
+}
+
+void CppCodeModelInspectorDialog::clearDocumentData()
+{
+ m_docGenericInfoModel->clear();
+
+ m_ui->docTab->setTabText(DocumentIncludesTab, docTabName(DocumentIncludesTab));
+ m_docIncludesModel->clear();
+
+ m_ui->docTab->setTabText(DocumentDiagnosticsTab, docTabName(DocumentDiagnosticsTab));
+ m_docDiagnosticMessagesModel->clear();
+
+ m_ui->docTab->setTabText(DocumentDefinedMacrosTab, docTabName(DocumentDefinedMacrosTab));
+ m_docMacrosModel->clear();
+
+ m_ui->docPreprocessedSourceEdit->setPlainText(QString());
+
+ m_docSymbolsModel->clear();
+
+ m_ui->docTab->setTabText(DocumentTokensTab, docTabName(DocumentTokensTab));
+ m_docTokensModel->clear();
+}
+
+void CppCodeModelInspectorDialog::updateDocumentData(const CPlusPlus::Document::Ptr &document)
+{
+ QTC_ASSERT(document, return);
+
+ // General
+ KeyValueModel::Table table = KeyValueModel::Table()
+ << qMakePair(QString::fromLatin1("File Path"),
+ QDir::toNativeSeparators(document->fileName()))
+ << qMakePair(QString::fromLatin1("Last Modified"), toString(document->lastModified()))
+ << qMakePair(QString::fromLatin1("Revision"), toString(document->revision()))
+ << qMakePair(QString::fromLatin1("Editor Revision"), toString(document->editorRevision()))
+ << qMakePair(QString::fromLatin1("Check Mode"), toString(document->checkMode()))
+ << qMakePair(QString::fromLatin1("Tokenized"), toString(document->isTokenized()))
+ << qMakePair(QString::fromLatin1("Parsed"), toString(document->isParsed()))
+ << qMakePair(QString::fromLatin1("Project Parts"), partsForFile(document->fileName()))
+ ;
+ m_docGenericInfoModel->configure(table);
+ resizeColumns<KeyValueModel>(m_ui->docGeneralView);
+
+ // Includes
+ m_docIncludesModel->configure(document->resolvedIncludes() + document->unresolvedIncludes());
+ resizeColumns<IncludesModel>(m_ui->docIncludesView);
+ m_ui->docTab->setTabText(DocumentIncludesTab,
+ docTabName(DocumentIncludesTab, m_docIncludesModel->rowCount()));
+
+ // Diagnostic Messages
+ m_docDiagnosticMessagesModel->configure(document->diagnosticMessages());
+ resizeColumns<DiagnosticMessagesModel>(m_ui->docDiagnosticMessagesView);
+ m_ui->docTab->setTabText(DocumentDiagnosticsTab,
+ docTabName(DocumentDiagnosticsTab, m_docDiagnosticMessagesModel->rowCount()));
+
+ // Macros
+ m_docMacrosModel->configure(document->definedMacros());
+ resizeColumns<MacrosModel>(m_ui->docDefinedMacrosView);
+ m_ui->docTab->setTabText(DocumentDefinedMacrosTab,
+ docTabName(DocumentDefinedMacrosTab, m_docMacrosModel->rowCount()));
+
+ // Source
+ m_ui->docPreprocessedSourceEdit->setPlainText(QString::fromUtf8(document->utf8Source()));
+
+ // Symbols
+ m_docSymbolsModel->configure(document);
+ resizeColumns<SymbolsModel>(m_ui->docSymbolsView);
+
+ // Tokens
+ m_docTokensModel->configure(document->translationUnit());
+ resizeColumns<TokensModel>(m_ui->docTokensView);
+ m_ui->docTab->setTabText(DocumentTokensTab,
+ docTabName(DocumentTokensTab, m_docTokensModel->rowCount()));
+}
+
+enum ProjectPartTabs {
+ ProjectPartGeneralTab,
+ ProjectPartFilesTab,
+ ProjectPartDefinesTab,
+ ProjectPartIncludePathsTab,
+ ProjectPartFrameworkPathsTab,
+ ProjectPartPrecompiledHeadersTab
+};
+
+static QString partTabName(int tabIndex, int numberOfEntries = -1)
+{
+ const char *names[] = {
+ "&General",
+ "Project &Files",
+ "&Defines",
+ "&Include Paths",
+ "F&ramework Paths",
+ "Pre&compiled Headers"
+ };
+ QString result = QLatin1String(names[tabIndex]);
+ if (numberOfEntries != -1)
+ result += QString::fromLatin1(" (%1)").arg(numberOfEntries);
+ return result;
+}
+
+void CppCodeModelInspectorDialog::clearProjectPartData()
+{
+ m_partGenericInfoModel->clear();
+
+ m_ui->partProjectFilesEdit->setPlainText(QString());
+ m_ui->projectPartTab->setTabText(ProjectPartFilesTab, partTabName(ProjectPartFilesTab));
+
+ m_ui->partToolchainDefinesEdit->setPlainText(QString());
+ m_ui->partProjectDefinesEdit->setPlainText(QString());
+ m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab));
+
+ m_ui->partIncludePathsEdit->setPlainText(QString());
+ m_ui->projectPartTab->setTabText(ProjectPartIncludePathsTab,
+ partTabName(ProjectPartIncludePathsTab));
+
+ m_ui->partFrameworkPathsEdit->setPlainText(QString());
+ m_ui->projectPartTab->setTabText(ProjectPartFrameworkPathsTab,
+ partTabName(ProjectPartFrameworkPathsTab));
+
+ m_ui->partPrecompiledHeadersEdit->setPlainText(QString());
+ m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
+ partTabName(ProjectPartPrecompiledHeadersTab));
+}
+
+void CppCodeModelInspectorDialog::updateProjectPartData(const ProjectPart::Ptr &part)
+{
+ QTC_ASSERT(part, return);
+
+ // General
+ QString projectName = QLatin1String("<None>");
+ QString projectFilePath = QLatin1String("<None>");
+ if (ProjectExplorer::Project *project = part->project) {
+ projectName = project->displayName();
+ projectFilePath = project->projectFilePath();
+ }
+ KeyValueModel::Table table = KeyValueModel::Table()
+ << qMakePair(QString::fromLatin1("Project Part Name"), part->displayName)
+ << qMakePair(QString::fromLatin1("Project Part File"),
+ QDir::toNativeSeparators(part->projectFile))
+ << qMakePair(QString::fromLatin1("Project Name"), projectName)
+ << qMakePair(QString::fromLatin1("Project File"),
+ QDir::toNativeSeparators(projectFilePath))
+ << qMakePair(QString::fromLatin1("C Version"), toString(part->cVersion))
+ << qMakePair(QString::fromLatin1("CXX Version"), toString(part->cxxVersion))
+ << qMakePair(QString::fromLatin1("CXX Extensions"), toString(part->cxxExtensions))
+ << qMakePair(QString::fromLatin1("Qt Version"), toString(part->qtVersion))
+ ;
+ m_partGenericInfoModel->configure(table);
+ resizeColumns<KeyValueModel>(m_ui->partGeneralView);
+
+ // Project Files
+ m_ui->partProjectFilesEdit->setPlainText(toString(part->files));
+ m_ui->projectPartTab->setTabText(ProjectPartFilesTab,
+ partTabName(ProjectPartFilesTab, part->files.size()));
+
+ // Defines
+ const QList<QByteArray> defineLines = part->toolchainDefines.split('\n')
+ + part->projectDefines.split('\n');
+ int numberOfDefines = 0;
+ foreach (const QByteArray &line, defineLines) {
+ if (line.startsWith("#define "))
+ ++numberOfDefines;
+ }
+ m_ui->partToolchainDefinesEdit->setPlainText(QString::fromUtf8(part->toolchainDefines));
+ m_ui->partProjectDefinesEdit->setPlainText(QString::fromUtf8(part->projectDefines));
+ m_ui->projectPartTab->setTabText(ProjectPartDefinesTab,
+ partTabName(ProjectPartDefinesTab, numberOfDefines));
+
+ // Include Paths
+ m_ui->partIncludePathsEdit->setPlainText(pathListToString(part->includePaths));
+ m_ui->projectPartTab->setTabText(ProjectPartIncludePathsTab,
+ partTabName(ProjectPartIncludePathsTab, part->includePaths.size()));
+
+ // Framework Paths
+ m_ui->partFrameworkPathsEdit->setPlainText(pathListToString(part->frameworkPaths));
+ m_ui->projectPartTab->setTabText(ProjectPartFrameworkPathsTab,
+ partTabName(ProjectPartFrameworkPathsTab, part->frameworkPaths.size()));
+
+ // Precompiled Headers
+ m_ui->partPrecompiledHeadersEdit->setPlainText(pathListToString(part->precompiledHeaders));
+ m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
+ partTabName(ProjectPartPrecompiledHeadersTab, part->precompiledHeaders.size()));
+}
+
+bool CppCodeModelInspectorDialog::event(QEvent *e)
+{
+ if (e->type() == QEvent::ShortcutOverride) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(e);
+ if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
+ ke->accept();
+ close();
+ return false;
+ }
+ }
+ return QDialog::event(e);
+}
+
+} // namespace Internal
+} // namespace CppEditor
+
+#include "cppcodemodelinspectordialog.moc"
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.h b/src/plugins/cppeditor/cppcodemodelinspectordialog.h
new file mode 100644
index 0000000000..3348e03922
--- /dev/null
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef CPPCODEMODELINSPECTORDIALOG_H
+#define CPPCODEMODELINSPECTORDIALOG_H
+
+#include <cpptools/cppmodelmanagerinterface.h>
+
+#include <cplusplus/CppDocument.h>
+
+#include <QDialog>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QSortFilterProxyModel;
+class QModelIndex;
+namespace Ui { class CppCodeModelInspectorDialog; }
+QT_END_NAMESPACE
+
+namespace CppEditor {
+namespace Internal {
+
+class FilterableView;
+class SnapshotInfo;
+
+class DiagnosticMessagesModel;
+class IncludesModel;
+class KeyValueModel;
+class MacrosModel;
+class ProjectPartsModel;
+class SnapshotModel;
+class SymbolsModel;
+class TokensModel;
+class WorkingCopyModel;
+
+//
+// This dialog is for DEBUGGING PURPOSES and thus NOT TRANSLATED.
+//
+
+class CppCodeModelInspectorDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit CppCodeModelInspectorDialog(QWidget *parent = 0);
+ ~CppCodeModelInspectorDialog();
+
+private slots:
+ void onRefreshRequested();
+
+ void onSnapshotFilterChanged(const QString &pattern);
+ void onSnapshotSelected(int row);
+ void onDocumentSelected(const QModelIndex &current, const QModelIndex &);
+ void onSymbolsViewExpandedOrCollapsed(const QModelIndex &);
+
+ void onProjectPartFilterChanged(const QString &pattern);
+ void onProjectPartSelected(const QModelIndex &current, const QModelIndex &);
+
+ void onWorkingCopyFilterChanged(const QString &pattern);
+ void onWorkingCopyDocumentSelected(const QModelIndex &current, const QModelIndex &);
+
+private:
+ void refresh();
+
+ void clearDocumentData();
+ void updateDocumentData(const CPlusPlus::Document::Ptr &document);
+
+ void clearProjectPartData();
+ void updateProjectPartData(const CppTools::ProjectPart::Ptr &part);
+
+ bool event(QEvent *e);
+
+private:
+ Ui::CppCodeModelInspectorDialog *m_ui;
+
+ // Snapshots and Documents
+ QList<SnapshotInfo> *m_snapshotInfos;
+ FilterableView *m_snapshotView;
+ SnapshotModel *m_snapshotModel;
+ QSortFilterProxyModel *m_proxySnapshotModel;
+ KeyValueModel *m_docGenericInfoModel;
+ IncludesModel *m_docIncludesModel;
+ DiagnosticMessagesModel *m_docDiagnosticMessagesModel;
+ MacrosModel *m_docMacrosModel;
+ SymbolsModel *m_docSymbolsModel;
+ TokensModel *m_docTokensModel;
+
+ // Project Parts
+ FilterableView *m_projectPartsView;
+ ProjectPartsModel *m_projectPartsModel;
+ QSortFilterProxyModel *m_proxyProjectPartsModel;
+ KeyValueModel *m_partGenericInfoModel;
+
+ // Working Copy
+ FilterableView *m_workingCopyView;
+ WorkingCopyModel *m_workingCopyModel;
+ QSortFilterProxyModel *m_proxyWorkingCopyModel;
+};
+
+} // namespace Internal
+} // namespace CppEditor
+
+#endif // CPPCODEMODELINSPECTORDIALOG_H
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.ui b/src/plugins/cppeditor/cppcodemodelinspectordialog.ui
new file mode 100644
index 0000000000..fbe95c08a7
--- /dev/null
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.ui
@@ -0,0 +1,381 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CppCodeModelInspectorDialog</class>
+ <widget class="QDialog" name="CppCodeModelInspectorDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>818</width>
+ <height>756</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string notr="true">C++ Code Model Inspector</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string notr="true">&amp;Snapshots and Documents</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="snapshotSelectorAndViewLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="snapshotSelectorLabel">
+ <property name="text">
+ <string notr="true">Sn&amp;apshot:</string>
+ </property>
+ <property name="buddy">
+ <cstring>snapshotSelector</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="snapshotSelector">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>100</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QTabWidget" name="docTab">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_8">
+ <attribute name="title">
+ <string notr="true">&amp;General</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTreeView" name="docGeneralView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_7">
+ <attribute name="title">
+ <string notr="true">&amp;Includes</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTreeView" name="docIncludesView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_6">
+ <attribute name="title">
+ <string notr="true">&amp;Diagnostic Messages</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="QTreeView" name="docDiagnosticMessagesView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_4">
+ <attribute name="title">
+ <string notr="true">(Un)Defined &amp;Macros</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <widget class="QTreeView" name="docDefinedMacrosView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_5">
+ <attribute name="title">
+ <string notr="true">P&amp;reprocessed Source</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QPlainTextEdit" name="docPreprocessedSourceEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_9">
+ <attribute name="title">
+ <string notr="true">&amp;Symbols</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="QTreeView" name="docSymbolsView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_10">
+ <attribute name="title">
+ <string notr="true">&amp;Tokens</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_10">
+ <item>
+ <widget class="QTreeView" name="docTokensView">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string notr="true">&amp;Project Parts</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_12">
+ <item>
+ <widget class="QSplitter" name="projectPartsSplitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QTabWidget" name="projectPartTab">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_17">
+ <attribute name="title">
+ <string notr="true">&amp;General</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_9">
+ <item>
+ <widget class="QTreeView" name="partGeneralView"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_13">
+ <attribute name="title">
+ <string notr="true">Project &amp;Files</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_14">
+ <item>
+ <widget class="QPlainTextEdit" name="partProjectFilesEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_14">
+ <attribute name="title">
+ <string notr="true">&amp;Defines</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_19">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string notr="true">Toolchain Defines</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_13">
+ <item>
+ <widget class="QPlainTextEdit" name="partToolchainDefinesEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string notr="true">Project Defines</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_15">
+ <item>
+ <widget class="QPlainTextEdit" name="partProjectDefinesEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_15">
+ <attribute name="title">
+ <string notr="true">&amp;Include Paths</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_16">
+ <item>
+ <widget class="QPlainTextEdit" name="partIncludePathsEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="definesTab_2">
+ <attribute name="title">
+ <string notr="true">F&amp;ramework Paths</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_17">
+ <item>
+ <widget class="QPlainTextEdit" name="partFrameworkPathsEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_16">
+ <attribute name="title">
+ <string notr="true">Pre&amp;compiled Headers</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_18">
+ <item>
+ <widget class="QPlainTextEdit" name="partPrecompiledHeadersEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_3">
+ <attribute name="title">
+ <string notr="true">&amp;Working Copy</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_11">
+ <item>
+ <widget class="QSplitter" name="workingCopySplitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="childrenCollapsible">
+ <bool>true</bool>
+ </property>
+ <widget class="QPlainTextEdit" name="workingCopySourceEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QPushButton" name="refreshButton">
+ <property name="text">
+ <string notr="true">&amp;Refresh</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="selectEditorRelevantEntriesAfterRefreshCheckBox">
+ <property name="text">
+ <string notr="true">Select &amp;editor relevant entries after refresh</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton">
+ <property name="text">
+ <string notr="true">Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp
index ab8a947940..b1ffbc61a1 100644
--- a/src/plugins/cppeditor/cppdoxygen_test.cpp
+++ b/src/plugins/cppeditor/cppdoxygen_test.cpp
@@ -86,16 +86,14 @@ TestCase::TestCase(const QByteArray &input)
Utils::FileSaver srcSaver(fileName);
srcSaver.write(originalText);
srcSaver.finalize();
- CppTools::CppModelManagerInterface::instance()->updateSourceFiles(QStringList()<<fileName);
- // Wait for the parser in the future to give us the document
- while (true) {
- Snapshot s = CppTools::CppModelManagerInterface::instance()->snapshot();
- if (s.contains(fileName))
- break;
- QCoreApplication::processEvents();
- }
+ // Update Code Model
+ CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance();
+ mmi->updateSourceFiles(QStringList(fileName)).waitForFinished();
+ QCoreApplication::processEvents();
+ QVERIFY(mmi->snapshot().contains(fileName));
+ // Open Editor
editor = dynamic_cast<CPPEditor *>(EditorManager::openEditor(fileName));
QVERIFY(editor);
editorWidget = dynamic_cast<CPPEditorWidget *>(editor->editorWidget());
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index ce276c363b..376ec787b8 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1077,7 +1077,7 @@ void CPPEditorWidget::updateOutlineNow()
return;
const Snapshot snapshot = m_modelManager->snapshot();
- Document::Ptr document = snapshot.document(editorDocument()->filePath());
+ Document::Ptr document = snapshot.document(baseTextDocument()->filePath());
if (!document)
return;
@@ -1203,6 +1203,9 @@ void CPPEditorWidget::finishHighlightSymbolUsages()
if (m_highlighter.isCanceled())
return; // aborted
+ else if (m_lastSemanticInfo.doc.isNull())
+ return;
+
TextEditor::SyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter();
QTC_ASSERT(highlighter, return);
@@ -1669,7 +1672,7 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
// We can use the semanticInfo's snapshot (and avoid locking), but not its
// document, since it doesn't contain expanded macros.
- LookupContext context(semanticInfo.snapshot.document(editorDocument()->filePath()),
+ LookupContext context(semanticInfo.snapshot.document(baseTextDocument()->filePath()),
semanticInfo.snapshot);
SemanticInfo::LocalUseIterator it(semanticInfo.localUses);
@@ -1838,7 +1841,7 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
m_declDefLink = link;
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
- if (editorDocument() != targetDocument) {
+ if (baseTextDocument() != targetDocument) {
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
connect(baseTextDocument->document(), SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
@@ -1873,7 +1876,7 @@ void CPPEditorWidget::abortDeclDefLink()
Core::IDocument *targetDocument = Core::EditorManager::documentModel()->documentForFilePath(
m_declDefLink->targetFile->fileName());
- if (editorDocument() != targetDocument) {
+ if (baseTextDocument() != targetDocument) {
if (TextEditor::BaseTextDocument *baseTextDocument = qobject_cast<TextEditor::BaseTextDocument *>(targetDocument))
disconnect(baseTextDocument->document(), SIGNAL(contentsChanged()),
this, SLOT(abortDeclDefLink()));
diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro
index 6257e2c165..9cd0d80acb 100644
--- a/src/plugins/cppeditor/cppeditor.pro
+++ b/src/plugins/cppeditor/cppeditor.pro
@@ -1,37 +1,42 @@
DEFINES += CPPEDITOR_LIBRARY
include(../../qtcreatorplugin.pri)
-HEADERS += cppeditorplugin.h \
+
+HEADERS += \
cppautocompleter.h \
cppclasswizard.h \
+ cppcodemodelinspectordialog.h \
+ cppeditor.h \
+ cppeditor_global.h \
cppeditorconstants.h \
cppeditorenums.h \
- cppeditor_global.h \
- cppeditor.h \
+ cppeditorplugin.h \
cppelementevaluator.h \
cppfilewizard.h \
cppfollowsymbolundercursor.h \
cppfunctiondecldeflink.h \
- cpphighlighterfactory.h \
cpphighlighter.h \
+ cpphighlighterfactory.h \
cpphoverhandler.h \
+ cppincludehierarchy.h \
+ cppincludehierarchyitem.h \
+ cppincludehierarchymodel.h \
+ cppincludehierarchytreeview.h \
cppoutline.h \
+ cpppreprocessordialog.h \
+ cppquickfix.h \
cppquickfixassistant.h \
cppquickfixes.h \
- cppquickfix.h \
cppsnippetprovider.h \
cpptypehierarchy.h \
- cppincludehierarchy.h \
- cppincludehierarchymodel.h \
- cppincludehierarchyitem.h \
- cppincludehierarchytreeview.h \
cppvirtualfunctionassistprovider.h \
- cppvirtualfunctionproposalitem.h \
- cpppreprocessordialog.h
+ cppvirtualfunctionproposalitem.h
-SOURCES += cppeditorplugin.cpp \
+SOURCES += \
cppautocompleter.cpp \
cppclasswizard.cpp \
+ cppcodemodelinspectordialog.cpp \
cppeditor.cpp \
+ cppeditorplugin.cpp \
cppelementevaluator.cpp \
cppfilewizard.cpp \
cppfollowsymbolundercursor.cpp \
@@ -39,35 +44,36 @@ SOURCES += cppeditorplugin.cpp \
cpphighlighter.cpp \
cpphighlighterfactory.cpp \
cpphoverhandler.cpp \
+ cppincludehierarchy.cpp \
+ cppincludehierarchyitem.cpp \
+ cppincludehierarchymodel.cpp \
+ cppincludehierarchytreeview.cpp \
cppoutline.cpp \
- cppquickfixassistant.cpp \
+ cpppreprocessordialog.cpp \
cppquickfix.cpp \
+ cppquickfixassistant.cpp \
cppquickfixes.cpp \
cppsnippetprovider.cpp \
cpptypehierarchy.cpp \
- cppincludehierarchy.cpp \
- cppincludehierarchymodel.cpp \
- cppincludehierarchyitem.cpp \
- cppincludehierarchytreeview.cpp \
cppvirtualfunctionassistprovider.cpp \
- cppvirtualfunctionproposalitem.cpp \
- cpppreprocessordialog.cpp
+ cppvirtualfunctionproposalitem.cpp
-RESOURCES += cppeditor.qrc
+FORMS += \
+ cpppreprocessordialog.ui \
+ cppcodemodelinspectordialog.ui
-equals(TEST, 1) {
- HEADERS += cppquickfix_test_utils.h
+RESOURCES += \
+ cppeditor.qrc
+equals(TEST, 1) {
+ HEADERS += \
+ cppquickfix_test_utils.h
SOURCES += \
+ cppdoxygen_test.cpp \
+ cppincludehierarchy_test.cpp \
cppquickfix_test.cpp \
cppquickfix_test_utils.cpp \
- cppdoxygen_test.cpp \
fileandtokenactions_test.cpp \
- followsymbol_switchmethoddecldef_test.cpp \
- cppincludehierarchy_test.cpp
-
+ followsymbol_switchmethoddecldef_test.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
-
-FORMS += \
- cpppreprocessordialog.ui
diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs
index a92808d279..f8f9746e73 100644
--- a/src/plugins/cppeditor/cppeditor.qbs
+++ b/src/plugins/cppeditor/cppeditor.qbs
@@ -12,61 +12,38 @@ QtcPlugin {
Depends { name: "CPlusPlus" }
Depends { name: "TextEditor" }
Depends { name: "ProjectExplorer" }
+ Depends { name: "app_version_header" }
files: [
- "cppautocompleter.cpp",
- "cppautocompleter.h",
- "cppclasswizard.cpp",
- "cppclasswizard.h",
+ "cppautocompleter.cpp", "cppautocompleter.h",
+ "cppclasswizard.cpp", "cppclasswizard.h",
+ "cppcodemodelinspectordialog.cpp", "cppcodemodelinspectordialog.h", "cppcodemodelinspectordialog.ui",
+ "cppeditor.cpp", "cppeditor.h",
+ "cppeditor.qrc",
+ "cppeditor_global.h",
"cppeditorconstants.h",
- "cppeditor.cpp",
"cppeditorenums.h",
- "cppeditor_global.h",
- "cppeditor.h",
- "cppeditorplugin.cpp",
- "cppeditorplugin.h",
- "cppeditor.qrc",
- "cppelementevaluator.cpp",
- "cppelementevaluator.h",
- "cppfilewizard.cpp",
- "cppfilewizard.h",
- "cppfollowsymbolundercursor.cpp",
- "cppfollowsymbolundercursor.h",
- "cppfunctiondecldeflink.cpp",
- "cppfunctiondecldeflink.h",
- "cpphighlighter.cpp",
- "cpphighlighterfactory.cpp",
- "cpphighlighterfactory.h",
- "cpphighlighter.h",
- "cpphoverhandler.cpp",
- "cpphoverhandler.h",
- "cppincludehierarchy.cpp",
- "cppincludehierarchy.h",
- "cppincludehierarchyitem.cpp",
- "cppincludehierarchyitem.h",
- "cppincludehierarchymodel.cpp",
- "cppincludehierarchymodel.h",
- "cppincludehierarchytreeview.cpp",
- "cppincludehierarchytreeview.h",
- "cppoutline.cpp",
- "cppoutline.h",
- "cpppreprocessordialog.cpp",
- "cpppreprocessordialog.h",
- "cpppreprocessordialog.ui",
- "cppquickfixassistant.cpp",
- "cppquickfixassistant.h",
- "cppquickfix.cpp",
- "cppquickfixes.cpp",
- "cppquickfixes.h",
- "cppquickfix.h",
- "cppsnippetprovider.cpp",
- "cppsnippetprovider.h",
- "cpptypehierarchy.cpp",
- "cpptypehierarchy.h",
- "cppvirtualfunctionassistprovider.cpp",
- "cppvirtualfunctionassistprovider.h",
- "cppvirtualfunctionproposalitem.cpp",
- "cppvirtualfunctionproposalitem.h",
+ "cppeditorplugin.cpp", "cppeditorplugin.h",
+ "cppelementevaluator.cpp", "cppelementevaluator.h",
+ "cppfilewizard.cpp", "cppfilewizard.h",
+ "cppfollowsymbolundercursor.cpp", "cppfollowsymbolundercursor.h",
+ "cppfunctiondecldeflink.cpp", "cppfunctiondecldeflink.h",
+ "cpphighlighter.cpp", "cpphighlighter.h",
+ "cpphighlighterfactory.cpp", "cpphighlighterfactory.h",
+ "cpphoverhandler.cpp", "cpphoverhandler.h",
+ "cppincludehierarchy.cpp", "cppincludehierarchy.h",
+ "cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h",
+ "cppincludehierarchymodel.cpp", "cppincludehierarchymodel.h",
+ "cppincludehierarchytreeview.cpp", "cppincludehierarchytreeview.h",
+ "cppoutline.cpp", "cppoutline.h",
+ "cpppreprocessordialog.cpp", "cpppreprocessordialog.h", "cpppreprocessordialog.ui",
+ "cppquickfix.cpp", "cppquickfix.h",
+ "cppquickfixassistant.cpp", "cppquickfixassistant.h",
+ "cppquickfixes.cpp", "cppquickfixes.h",
+ "cppsnippetprovider.cpp", "cppsnippetprovider.h",
+ "cpptypehierarchy.cpp", "cpptypehierarchy.h",
+ "cppvirtualfunctionassistprovider.cpp", "cppvirtualfunctionassistprovider.h",
+ "cppvirtualfunctionproposalitem.cpp", "cppvirtualfunctionproposalitem.h",
]
Group {
@@ -74,12 +51,12 @@ QtcPlugin {
condition: project.testsEnabled
files: [
"cppdoxygen_test.cpp",
+ "cppincludehierarchy_test.cpp",
"cppquickfix_test.cpp",
"cppquickfix_test_utils.cpp",
"cppquickfix_test_utils.h",
"fileandtokenactions_test.cpp",
"followsymbol_switchmethoddecldef_test.cpp",
- "cppincludehierarchy_test.cpp",
]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h
index 378789f911..16e4d1f3d6 100644
--- a/src/plugins/cppeditor/cppeditorconstants.h
+++ b/src/plugins/cppeditor/cppeditorconstants.h
@@ -44,6 +44,7 @@ const char FIND_USAGES[] = "CppEditor.FindUsages";
const char OPEN_PREPROCESSOR_DIALOG[] = "CppEditor.OpenPreprocessorDialog";
const char M_REFACTORING_MENU_INSERTION_POINT[] = "CppEditor.RefactorGroup";
const char UPDATE_CODEMODEL[] = "CppEditor.UpdateCodeModel";
+const char INSPECT_CPP_CODEMODEL[] = "CppEditor.InspectCppCodeModel";
const int TYPE_HIERARCHY_PRIORITY = 700;
const char TYPE_HIERARCHY_ID[] = "CppEditor.TypeHierarchy";
diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp
index d7dd630a43..e4eadfb98e 100644
--- a/src/plugins/cppeditor/cppeditorplugin.cpp
+++ b/src/plugins/cppeditor/cppeditorplugin.cpp
@@ -42,6 +42,8 @@
#include "cppquickfixes.h"
#include "cpphighlighterfactory.h"
+#include "cppcodemodelinspectordialog.h"
+
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
@@ -78,6 +80,12 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
+ new TextEditor::TextEditorActionHandler(this, CppEditor::Constants::C_CPPEDITOR,
+ TextEditor::TextEditorActionHandler::Format
+ | TextEditor::TextEditorActionHandler::UnCommentSelection
+ | TextEditor::TextEditorActionHandler::UnCollapseAll
+ | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
+
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", CppEditor::Constants::CPP_SOURCE_MIMETYPE);
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", CppEditor::Constants::C_SOURCE_MIMETYPE);
@@ -98,7 +106,6 @@ IEditor *CppEditorFactory::createEditor(QWidget *parent)
CppEditorPlugin *CppEditorPlugin::m_instance = 0;
CppEditorPlugin::CppEditorPlugin() :
- m_actionHandler(0),
m_sortedOutline(false),
m_renameSymbolUnderCursorAction(0),
m_findUsagesAction(0),
@@ -112,7 +119,6 @@ CppEditorPlugin::CppEditorPlugin() :
CppEditorPlugin::~CppEditorPlugin()
{
- delete m_actionHandler;
m_instance = 0;
}
@@ -123,8 +129,6 @@ CppEditorPlugin *CppEditorPlugin::instance()
void CppEditorPlugin::initializeEditor(CPPEditorWidget *editor)
{
- m_actionHandler->setupActions(editor);
-
editor->setLanguageSettingsId(CppTools::Constants::CPP_SETTINGS_ID);
TextEditor::TextEditorSettings::initializeEditor(editor);
@@ -285,13 +289,10 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
connect(m_reparseExternallyChangedFiles, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
- m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
- TextEditor::TextEditorActionHandler::Format
- | TextEditor::TextEditorActionHandler::UnCommentSelection
- | TextEditor::TextEditorActionHandler::UnCollapseAll
- | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
-
- m_actionHandler->initializeActions();
+ QAction *inspectCppCodeModel = new QAction(tr("Debug: Inspect C++ Code Model"), this);
+ cmd = ActionManager::registerAction(inspectCppCodeModel, Constants::INSPECT_CPP_CODEMODEL, globalContext);
+ cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12")));
+ connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel()));
contextMenu->addSeparator(context);
@@ -306,9 +307,6 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
this, SLOT(onAllTasksFinished(Core::Id)));
- connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
- SLOT(currentEditorChanged(Core::IEditor*)));
-
readSettings();
return true;
}
@@ -390,13 +388,14 @@ void CppEditorPlugin::onAllTasksFinished(Core::Id type)
}
}
-void CppEditorPlugin::currentEditorChanged(IEditor *editor)
+void CppEditorPlugin::inspectCppCodeModel()
{
- if (!editor)
- return;
-
- if (CPPEditorWidget *editorWidget = currentCppEditorWidget())
- editorWidget->semanticRehighlight(/*force = */ true);
+ if (m_cppCodeModelInspectorDialog) {
+ ICore::raiseWindow(m_cppCodeModelInspectorDialog);
+ } else {
+ m_cppCodeModelInspectorDialog = new CppCodeModelInspectorDialog(ICore::mainWindow());
+ m_cppCodeModelInspectorDialog->show();
+ }
}
void CppEditorPlugin::openTypeHierarchy()
diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h
index c5bb0d4bf6..9bf3e13d10 100644
--- a/src/plugins/cppeditor/cppeditorplugin.h
+++ b/src/plugins/cppeditor/cppeditorplugin.h
@@ -38,7 +38,6 @@
#include <QAction>
namespace TextEditor {
-class TextEditorActionHandler;
class ITextEditor;
} // namespace TextEditor
@@ -46,6 +45,7 @@ namespace CppEditor {
namespace Internal {
class CPPEditorWidget;
+class CppCodeModelInspectorDialog;
class CppQuickFixCollector;
class CppQuickFixAssistProvider;
@@ -90,7 +90,7 @@ public slots:
private slots:
void onTaskStarted(Core::Id type);
void onAllTasksFinished(Core::Id type);
- void currentEditorChanged(Core::IEditor *editor);
+ void inspectCppCodeModel();
#ifdef WITH_TESTS
private slots:
@@ -207,9 +207,6 @@ private slots:
void test_quickfix_InsertVirtualMethods_implementationFile();
void test_quickfix_InsertVirtualMethods_BaseClassInNamespace();
- void test_functionhelper_virtualFunctions();
- void test_functionhelper_virtualFunctions_data();
-
// tests for "Include Hiererchy"
void test_includeHierarchyModel_simpleIncludes();
void test_includeHierarchyModel_simpleIncludedBy();
@@ -236,7 +233,6 @@ private:
static CppEditorPlugin *m_instance;
- TextEditor::TextEditorActionHandler *m_actionHandler;
bool m_sortedOutline;
QAction *m_renameSymbolUnderCursorAction;
QAction *m_findUsagesAction;
@@ -246,6 +242,8 @@ private:
CppQuickFixAssistProvider *m_quickFixProvider;
+ QPointer<CppCodeModelInspectorDialog> m_cppCodeModelInspectorDialog;
+
QPointer<TextEditor::ITextEditor> m_currentEditor;
};
diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp
index 75646085cc..56854dda0c 100644
--- a/src/plugins/cppeditor/cppelementevaluator.cpp
+++ b/src/plugins/cppeditor/cppelementevaluator.cpp
@@ -85,7 +85,7 @@ void CppElementEvaluator::execute()
return;
const Snapshot &snapshot = m_modelManager->snapshot();
- Document::Ptr doc = snapshot.document(m_editor->editorDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_editor->baseTextDocument()->filePath());
if (!doc)
return;
diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
index 19a5a3a5e5..a070022a26 100644
--- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
+++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
@@ -39,6 +39,7 @@
#include <cplusplus/SimpleLexer.h>
#include <cplusplus/TypeOfExpression.h>
#include <cpptools/cppmodelmanagerinterface.h>
+#include <cpptools/functionutils.h>
#include <cpptools/symbolfinder.h>
#include <texteditor/basetextdocumentlayout.h>
#include <utils/qtcassert.h>
@@ -128,11 +129,13 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
if (IdExpressionAST *idExpressionAST = m_baseExpressionAST->asIdExpression()) {
NameAST *name = idExpressionAST->name;
const bool nameIsQualified = name && name->asQualifiedName();
- result = !nameIsQualified && FunctionHelper::isVirtualFunction(function, m_snapshot);
+ result = !nameIsQualified && FunctionUtils::isVirtualFunction(
+ function, LookupContext(m_document, m_snapshot));
} else if (MemberAccessAST *memberAccessAST = m_baseExpressionAST->asMemberAccess()) {
NameAST *name = memberAccessAST->member_name;
const bool nameIsQualified = name && name->asQualifiedName();
- if (!nameIsQualified && FunctionHelper::isVirtualFunction(function, m_snapshot)) {
+ if (!nameIsQualified && FunctionUtils::isVirtualFunction(
+ function, LookupContext(m_document, m_snapshot))) {
TranslationUnit *unit = m_expressionDocument->translationUnit();
QTC_ASSERT(unit, return false);
m_accessTokenKind = unit->tokenKind(memberAccessAST->access_token);
@@ -541,7 +544,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
}
// Now we prefer the doc from the snapshot with macros expanded.
- Document::Ptr doc = snapshot.document(m_widget->editorDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_widget->baseTextDocument()->filePath());
if (!doc) {
doc = documentFromSemanticInfo;
if (!doc)
@@ -636,7 +639,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
- if (m_widget->editorDocument()->filePath() == fileName) {
+ if (m_widget->baseTextDocument()->filePath() == fileName) {
if (unsigned(lineNumber) == d->line()
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
result = r; // take the symbol under cursor.
diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp
index 3efde4c154..60d8c9a806 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy.cpp
@@ -142,12 +142,12 @@ void CppIncludeHierarchyWidget::perform()
return;
m_model->clear();
- m_model->buildHierarchy(m_editor, widget->editorDocument()->filePath());
+ m_model->buildHierarchy(m_editor, widget->baseTextDocument()->filePath());
if (m_model->isEmpty())
return;
- m_inspectedFile->setup(widget->editorDocument()->displayName(),
- widget->editorDocument()->filePath());
+ m_inspectedFile->setup(widget->baseTextDocument()->displayName(),
+ widget->baseTextDocument()->filePath());
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
diff --git a/src/plugins/cppeditor/cppincludehierarchy_test.cpp b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
index 7e641e7494..a5ee149f65 100644
--- a/src/plugins/cppeditor/cppincludehierarchy_test.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
@@ -67,20 +67,12 @@ public:
}
// Update Code Model
- m_cmm->updateSourceFiles(filePaths);
-
- // Wait for the parser in the future to give us the document
- QStringList filePathsNotYetInSnapshot(filePaths);
- forever {
- const Snapshot snapshot = m_cmm->snapshot();
- foreach (const QString &filePath, filePathsNotYetInSnapshot) {
- if (snapshot.contains(filePath))
- filePathsNotYetInSnapshot.removeOne(filePath);
- }
- if (filePathsNotYetInSnapshot.isEmpty())
- break;
- QCoreApplication::processEvents();
- }
+ m_cmm->updateSourceFiles(filePaths).waitForFinished();
+ QCoreApplication::processEvents();
+ const Snapshot snapshot = m_cmm->snapshot();
+ QVERIFY(!snapshot.isEmpty());
+ foreach (const QString &filePath, filePaths)
+ QVERIFY(snapshot.contains(filePath));
}
~TestCase()
diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index 16e22817a5..1f8d95490f 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -209,20 +209,12 @@ void TestCase::init(const QStringList &includePaths)
QStringList filePaths;
foreach (const TestDocumentPtr &testFile, testFiles)
filePaths << testFile->filePath();
- cmm->updateSourceFiles(filePaths);
-
- // Wait for the parser in the future to give us the document
- QStringList filePathsNotYetInSnapshot(filePaths);
- forever {
- Snapshot snapshot = cmm->snapshot();
- foreach (const QString &filePath, filePathsNotYetInSnapshot) {
- if (snapshot.contains(filePath))
- filePathsNotYetInSnapshot.removeOne(filePath);
- }
- if (filePathsNotYetInSnapshot.isEmpty())
- break;
- QCoreApplication::processEvents();
- }
+ cmm->updateSourceFiles(filePaths).waitForFinished();
+ QCoreApplication::processEvents();
+ const Snapshot snapshot = cmm->snapshot();
+ QVERIFY(!snapshot.isEmpty());
+ foreach (const QString &filePath, filePaths)
+ QVERIFY(snapshot.contains(filePath));
// Open Files
foreach (TestDocumentPtr testFile, testFiles) {
diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp
index 4ca8d0e0a6..5f299d9344 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.cpp
+++ b/src/plugins/cppeditor/cppquickfixassistant.cpp
@@ -87,7 +87,7 @@ const IAssistProvider *CppQuickFixAssistProcessor::provider() const
CppQuickFixAssistInterface::CppQuickFixAssistInterface(CPPEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
- editor->editorDocument()->filePath(), reason)
+ editor->baseTextDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot())
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index 9feaef149a..0dcb161b8d 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -158,10 +158,8 @@ InsertionLocation insertLocationForMethodDefinition(Symbol *symbol, const bool u
= locator.methodDefinition(symbol, useSymbolFinder, fileName);
for (int i = 0; i < list.count(); ++i) {
InsertionLocation location = list.at(i);
- if (location.isValid() && location.fileName() == fileName) {
+ if (location.isValid() && location.fileName() == fileName)
return location;
- break;
- }
}
// ...failed,
@@ -4769,11 +4767,11 @@ public:
? Qt::Checked : Qt::Unchecked;
for (Scope::iterator it = clazz->firstMember(); it != clazz->lastMember(); ++it) {
if (const Function *func = (*it)->type()->asFunctionType()) {
- if (!func->isVirtual())
+ // Filter virtual destructors
+ if (func->name()->asDestructorNameId())
continue;
- // Filter virtual destructors
- if (printer.prettyName(func->name()).startsWith(QLatin1Char('~')))
+ if (!func->isVirtual())
continue;
// Filter OQbject's
@@ -4917,16 +4915,12 @@ public:
switch (spec) {
case InsertionPointLocator::Private:
return InsertionPointLocator::PrivateSlot;
- break;
case InsertionPointLocator::Protected:
return InsertionPointLocator::ProtectedSlot;
- break;
case InsertionPointLocator::Public:
return InsertionPointLocator::PublicSlot;
- break;
default:
return spec;
- break;
}
}
return spec;
diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
index 1e0f45334f..a3f7048909 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
+++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
@@ -30,8 +30,8 @@
#include "cppvirtualfunctionassistprovider.h"
+#include "cppeditor.h"
#include "cppeditorconstants.h"
-#include "cppelementevaluator.h"
#include "cppvirtualfunctionproposalitem.h"
#include <cplusplus/Icons.h>
@@ -40,7 +40,9 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
+#include <cpptools/functionutils.h>
#include <cpptools/symbolfinder.h>
+#include <cpptools/typehierarchybuilder.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h>
#include <texteditor/codeassist/genericproposal.h>
@@ -48,11 +50,13 @@
#include <texteditor/codeassist/iassistinterface.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistproposal.h>
+#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
using namespace CPlusPlus;
using namespace CppEditor::Internal;
+using namespace CppTools;
using namespace TextEditor;
/// Activate current item with the same shortcut that is configured for Follow Symbol Under Cursor.
@@ -141,7 +145,7 @@ public:
if (!functionsClass)
return 0;
- const QList<Symbol *> overrides = FunctionHelper::overrides(
+ const QList<Symbol *> overrides = FunctionUtils::overrides(
m_params.function, functionsClass, m_params.staticClass, m_params.snapshot);
if (overrides.isEmpty())
return 0;
@@ -206,219 +210,3 @@ IAssistProcessor *VirtualFunctionAssistProvider::createProcessor() const
{
return new VirtualFunctionsAssistProcessor(m_params);
}
-
-enum VirtualType { Virtual, PureVirtual };
-
-static bool isVirtualFunction_helper(const Function *function,
- const Snapshot &snapshot,
- VirtualType virtualType)
-{
- if (!function)
- return false;
-
- if (virtualType == PureVirtual)
- return function->isPureVirtual();
-
- if (function->isVirtual())
- return true;
-
- const QString filePath = QString::fromUtf8(function->fileName(), function->fileNameLength());
- if (Document::Ptr document = snapshot.document(filePath)) {
- LookupContext context(document, snapshot);
- QList<LookupItem> results = context.lookup(function->name(), function->enclosingScope());
- if (!results.isEmpty()) {
- const bool isDestructor = function->name()->isDestructorNameId();
- foreach (const LookupItem &item, results) {
- if (Symbol *symbol = item.declaration()) {
- if (Function *functionType = symbol->type()->asFunctionType()) {
- if (functionType->name()->isDestructorNameId() != isDestructor)
- continue;
- if (functionType == function) // already tested
- continue;
- if (functionType->isFinal())
- return false;
- if (functionType->isVirtual())
- return true;
- }
- }
- }
- }
- }
-
- return false;
-}
-
-bool FunctionHelper::isVirtualFunction(const Function *function, const Snapshot &snapshot)
-{
- return isVirtualFunction_helper(function, snapshot, Virtual);
-}
-
-bool FunctionHelper::isPureVirtualFunction(const Function *function, const Snapshot &snapshot)
-{
- return isVirtualFunction_helper(function, snapshot, PureVirtual);
-}
-
-QList<Symbol *> FunctionHelper::overrides(Function *function, Class *functionsClass,
- Class *staticClass, const Snapshot &snapshot)
-{
- QList<Symbol *> result;
- QTC_ASSERT(function && functionsClass && staticClass, return result);
-
- FullySpecifiedType referenceType = function->type();
- const Name *referenceName = function->name();
- QTC_ASSERT(referenceName && referenceType.isValid(), return result);
-
- // Find overrides
- CppEditor::Internal::CppClass cppClass = CppClass(functionsClass);
- cppClass.lookupDerived(staticClass, snapshot);
-
- QList<CppClass> l;
- l << cppClass;
-
- while (!l.isEmpty()) {
- // Add derived
- CppClass clazz = l.takeFirst();
-
- QTC_ASSERT(clazz.declaration, continue);
- Class *c = clazz.declaration->asClass();
- QTC_ASSERT(c, continue);
-
- foreach (const CppClass &d, clazz.derived) {
- if (!l.contains(d))
- l << d;
- }
-
- // Check member functions
- for (int i = 0, total = c->memberCount(); i < total; ++i) {
- Symbol *candidate = c->memberAt(i);
- const Name *candidateName = candidate->name();
- const FullySpecifiedType candidateType = candidate->type();
- if (!candidateName || !candidateType.isValid())
- continue;
- if (candidateName->isEqualTo(referenceName) && candidateType.isEqualTo(referenceType))
- result << candidate;
- }
- }
-
- return result;
-}
-
-#ifdef WITH_TESTS
-#include "cppeditorplugin.h"
-
-#include <QList>
-#include <QTest>
-
-namespace CppEditor {
-namespace Internal {
-
-enum Virtuality
-{
- NotVirtual,
- Virtual,
- PureVirtual
-};
-typedef QList<Virtuality> VirtualityList;
-} // Internal namespace
-} // CppEditor namespace
-
-Q_DECLARE_METATYPE(CppEditor::Internal::Virtuality)
-Q_DECLARE_METATYPE(CppEditor::Internal::VirtualityList)
-
-namespace CppEditor {
-namespace Internal {
-
-void CppEditorPlugin::test_functionhelper_virtualFunctions()
-{
- // Create and parse document
- QFETCH(QByteArray, source);
- QFETCH(VirtualityList, virtualityList);
- Document::Ptr document = Document::create(QLatin1String("virtuals"));
- document->setUtf8Source(source);
- document->check(); // calls parse();
- QCOMPARE(document->diagnosticMessages().size(), 0);
- QVERIFY(document->translationUnit()->ast());
-
- // Iterate through Function symbols
- Snapshot snapshot;
- snapshot.insert(document);
- Control *control = document->translationUnit()->control();
- Symbol **end = control->lastSymbol();
- for (Symbol **it = control->firstSymbol(); it != end; ++it) {
- const CPlusPlus::Symbol *symbol = *it;
- if (const Function *function = symbol->asFunction()) {
- QTC_ASSERT(!virtualityList.isEmpty(), return);
- Virtuality virtuality = virtualityList.takeFirst();
- if (FunctionHelper::isVirtualFunction(function, snapshot)) {
- if (FunctionHelper::isPureVirtualFunction(function, snapshot))
- QCOMPARE(virtuality, PureVirtual);
- else
- QCOMPARE(virtuality, Virtual);
- } else {
- QCOMPARE(virtuality, NotVirtual);
- }
- }
- }
- QVERIFY(virtualityList.isEmpty());
-}
-
-void CppEditorPlugin::test_functionhelper_virtualFunctions_data()
-{
- typedef QByteArray _;
- QTest::addColumn<QByteArray>("source");
- QTest::addColumn<VirtualityList>("virtualityList");
-
- QTest::newRow("none")
- << _("struct None { void foo() {} };\n")
- << (VirtualityList() << NotVirtual);
-
- QTest::newRow("single-virtual")
- << _("struct V { virtual void foo() {} };\n")
- << (VirtualityList() << Virtual);
-
- QTest::newRow("single-pure-virtual")
- << _("struct PV { virtual void foo() = 0; };\n")
- << (VirtualityList() << PureVirtual);
-
- QTest::newRow("virtual-derived-with-specifier")
- << _("struct Base { virtual void foo() {} };\n"
- "struct Derived : Base { virtual void foo() {} };\n")
- << (VirtualityList() << Virtual << Virtual);
-
- QTest::newRow("virtual-derived-implicit")
- << _("struct Base { virtual void foo() {} };\n"
- "struct Derived : Base { void foo() {} };\n")
- << (VirtualityList() << Virtual << Virtual);
-
- QTest::newRow("not-virtual-then-virtual")
- << _("struct Base { void foo() {} };\n"
- "struct Derived : Base { virtual void foo() {} };\n")
- << (VirtualityList() << NotVirtual << Virtual);
-
- QTest::newRow("virtual-final-not-virtual")
- << _("struct Base { virtual void foo() {} };\n"
- "struct Derived : Base { void foo() final {} };\n"
- "struct Derived2 : Derived { void foo() {} };")
- << (VirtualityList() << Virtual << Virtual << NotVirtual);
-
- QTest::newRow("virtual-then-pure")
- << _("struct Base { virtual void foo() {} };\n"
- "struct Derived : Base { virtual void foo() = 0; };\n"
- "struct Derived2 : Derived { void foo() {} };")
- << (VirtualityList() << Virtual << PureVirtual << Virtual);
-
- QTest::newRow("virtual-virtual-final-not-virtual")
- << _("struct Base { virtual void foo() {} };\n"
- "struct Derived : Base { virtual void foo() final {} };\n"
- "struct Derived2 : Derived { void foo() {} };")
- << (VirtualityList() << Virtual << Virtual << NotVirtual);
-
- QTest::newRow("ctor-virtual-dtor")
- << _("struct Base { Base() {} virtual ~Base() {} };\n")
- << (VirtualityList() << NotVirtual << Virtual);
-}
-
-} // namespace Internal
-} // namespace CppEditor
-
-#endif
diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.h b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.h
index 3a99fc37f8..731f1efc5a 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.h
+++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.h
@@ -70,21 +70,6 @@ private:
Parameters m_params;
};
-class FunctionHelper
-{
-public:
- static bool isVirtualFunction(const CPlusPlus::Function *function,
- const CPlusPlus::Snapshot &snapshot);
-
- static bool isPureVirtualFunction(const CPlusPlus::Function *function,
- const CPlusPlus::Snapshot &snapshot);
-
- static QList<CPlusPlus::Symbol *> overrides(CPlusPlus::Function *function,
- CPlusPlus::Class *functionsClass,
- CPlusPlus::Class *staticClass,
- const CPlusPlus::Snapshot &snapshot);
-};
-
} // namespace Internal
} // namespace CppEditor
diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp
index 1dd403903f..984ea24e8f 100644
--- a/src/plugins/cppeditor/fileandtokenactions_test.cpp
+++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp
@@ -436,8 +436,7 @@ void InvokeCompletionTokenAction::run(CPPEditorWidget *editorWidget)
// editorWidget->setFocus();
QApplication::processEvents();
- BaseTextDocument *doc = qobject_cast<BaseTextDocument *>(editorWidget->editorDocument());
- TestActionsTestCase::undoChangesInDocument(doc);
+ TestActionsTestCase::undoChangesInDocument(editorWidget->baseTextDocument());
}
class RunAllQuickFixesTokenAction : public TestActionsTestCase::AbstractAction
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 5b7bf1655d..0451746fd0 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -309,21 +309,13 @@ void TestCase::init()
QStringList filePaths;
foreach (const TestDocumentPtr &testFile, m_testFiles)
filePaths << testFile->filePath();
- CppTools::CppModelManagerInterface::instance()->updateSourceFiles(filePaths);
-
- // Wait for the indexer to process all files.
- // All these files are "Fast Checked", that is the function bodies are not processed.
- QStringList filePathsNotYetInSnapshot(filePaths);
- forever {
- Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
- foreach (const QString &filePath, filePathsNotYetInSnapshot) {
- if (snapshot.contains(filePath))
- filePathsNotYetInSnapshot.removeOne(filePath);
- }
- if (filePathsNotYetInSnapshot.isEmpty())
- break;
- QCoreApplication::processEvents();
- }
+ CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance();
+ mmi->updateSourceFiles(filePaths).waitForFinished();
+ QCoreApplication::processEvents();
+ const Snapshot snapshot = mmi->snapshot();
+ QVERIFY(!snapshot.isEmpty());
+ foreach (const QString &filePath, filePaths)
+ QVERIFY(snapshot.contains(filePath));
// Open Files
foreach (TestDocumentPtr testFile, m_testFiles) {
diff --git a/src/plugins/cpptools/completionsettingspage.cpp b/src/plugins/cpptools/completionsettingspage.cpp
index 37ca2ed172..c72d60c9d3 100644
--- a/src/plugins/cpptools/completionsettingspage.cpp
+++ b/src/plugins/cpptools/completionsettingspage.cpp
@@ -56,67 +56,54 @@ CompletionSettingsPage::~CompletionSettingsPage()
delete m_page;
}
-QWidget *CompletionSettingsPage::createPage(QWidget *parent)
+QWidget *CompletionSettingsPage::widget()
{
- QWidget *w = new QWidget(parent);
- m_page = new Ui::CompletionSettingsPage;
- m_page->setupUi(w);
-
- const TextEditor::CompletionSettings &settings =
- TextEditor::TextEditorSettings::completionSettings();
-
- int caseSensitivityIndex = 0;
- switch (settings.m_caseSensitivity) {
- case TextEditor::CaseSensitive:
- caseSensitivityIndex = 0;
- break;
- case TextEditor::CaseInsensitive:
- caseSensitivityIndex = 1;
- break;
- case TextEditor::FirstLetterCaseSensitive:
- caseSensitivityIndex = 2;
- break;
+ if (!m_widget) {
+ QWidget *m_widget = new QWidget;
+ m_page = new Ui::CompletionSettingsPage;
+ m_page->setupUi(m_widget);
+
+ const TextEditor::CompletionSettings &settings =
+ TextEditor::TextEditorSettings::completionSettings();
+
+ int caseSensitivityIndex = 0;
+ switch (settings.m_caseSensitivity) {
+ case TextEditor::CaseSensitive:
+ caseSensitivityIndex = 0;
+ break;
+ case TextEditor::CaseInsensitive:
+ caseSensitivityIndex = 1;
+ break;
+ case TextEditor::FirstLetterCaseSensitive:
+ caseSensitivityIndex = 2;
+ break;
+ }
+
+ int completionTriggerIndex = 0;
+ switch (settings.m_completionTrigger) {
+ case TextEditor::ManualCompletion:
+ completionTriggerIndex = 0;
+ break;
+ case TextEditor::TriggeredCompletion:
+ completionTriggerIndex = 1;
+ break;
+ case TextEditor::AutomaticCompletion:
+ completionTriggerIndex = 2;
+ break;
+ }
+
+ m_page->caseSensitivity->setCurrentIndex(caseSensitivityIndex);
+ m_page->completionTrigger->setCurrentIndex(completionTriggerIndex);
+ m_page->autoInsertBrackets->setChecked(settings.m_autoInsertBrackets);
+ m_page->surroundSelectedText->setChecked(settings.m_surroundingAutoBrackets);
+ m_page->partiallyComplete->setChecked(settings.m_partiallyComplete);
+ m_page->spaceAfterFunctionName->setChecked(settings.m_spaceAfterFunctionName);
+ m_page->enableDoxygenCheckBox->setChecked(m_commentsSettings.m_enableDoxygen);
+ m_page->generateBriefCheckBox->setChecked(m_commentsSettings.m_generateBrief);
+ m_page->leadingAsterisksCheckBox->setChecked(m_commentsSettings.m_leadingAsterisks);
+ m_page->generateBriefCheckBox->setEnabled(m_page->enableDoxygenCheckBox->isChecked());
}
-
- int completionTriggerIndex = 0;
- switch (settings.m_completionTrigger) {
- case TextEditor::ManualCompletion:
- completionTriggerIndex = 0;
- break;
- case TextEditor::TriggeredCompletion:
- completionTriggerIndex = 1;
- break;
- case TextEditor::AutomaticCompletion:
- completionTriggerIndex = 2;
- break;
- }
-
- m_page->caseSensitivity->setCurrentIndex(caseSensitivityIndex);
- m_page->completionTrigger->setCurrentIndex(completionTriggerIndex);
- m_page->autoInsertBrackets->setChecked(settings.m_autoInsertBrackets);
- m_page->surroundSelectedText->setChecked(settings.m_surroundingAutoBrackets);
- m_page->partiallyComplete->setChecked(settings.m_partiallyComplete);
- m_page->spaceAfterFunctionName->setChecked(settings.m_spaceAfterFunctionName);
- m_page->enableDoxygenCheckBox->setChecked(m_commentsSettings.m_enableDoxygen);
- m_page->generateBriefCheckBox->setChecked(m_commentsSettings.m_generateBrief);
- m_page->leadingAsterisksCheckBox->setChecked(m_commentsSettings.m_leadingAsterisks);
-
- if (m_searchKeywords.isEmpty()) {
- QTextStream(&m_searchKeywords) << m_page->caseSensitivityLabel->text()
- << ' ' << m_page->autoInsertBrackets->text()
- << ' ' << m_page->surroundSelectedText->text()
- << ' ' << m_page->completionTriggerLabel->text()
- << ' ' << m_page->partiallyComplete->text()
- << ' ' << m_page->spaceAfterFunctionName->text()
- << ' ' << m_page->enableDoxygenCheckBox->text()
- << ' ' << m_page->generateBriefCheckBox->text()
- << ' ' << m_page->leadingAsterisksCheckBox->text();
- m_searchKeywords.remove(QLatin1Char('&'));
- }
-
- m_page->generateBriefCheckBox->setEnabled(m_page->enableDoxygenCheckBox->isChecked());
-
- return w;
+ return m_widget;
}
void CompletionSettingsPage::apply()
@@ -144,11 +131,6 @@ void CompletionSettingsPage::apply()
emit commentsSettingsChanged(m_commentsSettings);
}
-bool CompletionSettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
TextEditor::CaseSensitivity CompletionSettingsPage::caseSensitivity() const
{
switch (m_page->caseSensitivity->currentIndex()) {
@@ -175,6 +157,7 @@ TextEditor::CompletionTrigger CompletionSettingsPage::completionTrigger() const
void CompletionSettingsPage::finish()
{
+ delete m_widget;
if (!m_page) // page was never shown
return;
delete m_page;
diff --git a/src/plugins/cpptools/completionsettingspage.h b/src/plugins/cpptools/completionsettingspage.h
index 0a9bdd4afb..fc45922e3d 100644
--- a/src/plugins/cpptools/completionsettingspage.h
+++ b/src/plugins/cpptools/completionsettingspage.h
@@ -35,6 +35,8 @@
#include <texteditor/completionsettings.h>
#include <texteditor/texteditoroptionspage.h>
+#include <QPointer>
+
namespace CppTools {
namespace Internal {
@@ -52,10 +54,9 @@ public:
CompletionSettingsPage(QObject *parent);
~CompletionSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
const CommentsSettings &commentsSettings() const;
@@ -69,7 +70,7 @@ private:
bool requireCommentsSettingsUpdate() const;
Ui::CompletionSettingsPage *m_page;
- QString m_searchKeywords;
+ QPointer<QWidget> m_widget;
CommentsSettings m_commentsSettings;
};
diff --git a/src/plugins/cpptools/completionsettingspage.ui b/src/plugins/cpptools/completionsettingspage.ui
index b500f9095e..3ff7358375 100644
--- a/src/plugins/cpptools/completionsettingspage.ui
+++ b/src/plugins/cpptools/completionsettingspage.ui
@@ -107,7 +107,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="partiallyComplete">
<property name="toolTip">
- <string>Insert the common prefix of available completion items.</string>
+ <string>Inserts the common prefix of available completion items.</string>
</property>
<property name="text">
<string>Autocomplete common &amp;prefix</string>
@@ -120,7 +120,7 @@
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="autoInsertBrackets">
<property name="toolTip">
- <string>Automatically insert semicolons and closing brackets, parentheses, curly braces, and quotes when appropriate.</string>
+ <string>Automatically inserts semicolons and closing brackets, parentheses, curly braces, and quotes when appropriate.</string>
</property>
<property name="text">
<string>&amp;Automatically insert matching characters</string>
@@ -151,7 +151,7 @@
<item>
<widget class="QCheckBox" name="surroundSelectedText">
<property name="toolTip">
- <string>When typing a matching character and there is a text selection, instead of removing the selection, surround it with the corresponding characters.</string>
+ <string>When typing a matching character and there is a text selection, instead of removing the selection, surrounds it with the corresponding characters.</string>
</property>
<property name="text">
<string>Surround &amp;text selections</string>
@@ -205,7 +205,7 @@
<item>
<widget class="QCheckBox" name="enableDoxygenCheckBox">
<property name="toolTip">
- <string>Automatically create a Doxygen comment upon pressing enter after a /** or /*!</string>
+ <string>Automatically creates a Doxygen comment upon pressing enter after a /**, /*!, //! or ///</string>
</property>
<property name="text">
<string>Enable Doxygen blocks</string>
@@ -233,7 +233,7 @@
<item>
<widget class="QCheckBox" name="generateBriefCheckBox">
<property name="toolTip">
- <string>Generate a &lt;i&gt;brief&lt;/i&gt; command with an initial description for the corresponding declaration</string>
+ <string>Generates a &lt;i&gt;brief&lt;/i&gt; command with an initial description for the corresponding declaration</string>
</property>
<property name="text">
<string>Generate brief description</string>
@@ -245,7 +245,7 @@
<item>
<widget class="QCheckBox" name="leadingAsterisksCheckBox">
<property name="toolTip">
- <string>Add leading asterisks when continuing Qt (/*!) and Java (/**) style comments on new lines</string>
+ <string>Adds leading asterisks when continuing Qt (/*!) and Java (/**) style comments on new lines</string>
</property>
<property name="text">
<string>Add leading asterisks</string>
diff --git a/src/plugins/cpptools/cppcodemodelsettings.h b/src/plugins/cpptools/cppcodemodelsettings.h
index ef1f8d63e0..d1acc8331a 100644
--- a/src/plugins/cpptools/cppcodemodelsettings.h
+++ b/src/plugins/cpptools/cppcodemodelsettings.h
@@ -46,7 +46,7 @@ class CppCodeModelSettings
public:
enum PCHUsage {
PchUse_None = 1,
- PchUse_BuildSystem = 2,
+ PchUse_BuildSystem = 2
};
public:
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.cpp b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
index e5fd37824a..7202ea2828 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.cpp
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
@@ -101,23 +101,6 @@ void CppCodeModelSettingsWidget::applyToSettings() const
m_settings->toSettings(Core::ICore::settings());
}
-QString CppCodeModelSettingsWidget::searchKeywords() const
-{
- QString rc;
- QTextStream ts(&rc);
- ts << m_ui->theGroupBox->title()
- << ' ' << m_ui->cLabel->text()
- << ' ' << m_ui->cppLabel->text()
- << ' ' << m_ui->objcLabel->text()
- << ' ' << m_ui->objcppLabel->text()
- << ' ' << m_ui->anotherGroupBox->title()
- << ' ' << m_ui->ignorePCHCheckBox->text();
- foreach (const QString &mmsNames, m_settings->availableModelManagerSupportersByName().keys())
- ts << ' ' << mmsNames;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
bool CppCodeModelSettingsWidget::applyToSettings(QComboBox *chooser, const QString &mimeType) const
{
QString newId = chooser->itemData(chooser->currentIndex()).toString();
@@ -141,12 +124,12 @@ CppCodeModelSettingsPage::CppCodeModelSettingsPage(QSharedPointer<CppCodeModelSe
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON));
}
-QWidget *CppCodeModelSettingsPage::createPage(QWidget *parent)
+QWidget *CppCodeModelSettingsPage::widget()
{
- m_widget = new CppCodeModelSettingsWidget(parent);
- m_widget->setSettings(m_settings);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new CppCodeModelSettingsWidget;
+ m_widget->setSettings(m_settings);
+ }
return m_widget;
}
@@ -156,7 +139,7 @@ void CppCodeModelSettingsPage::apply()
m_widget->applyToSettings();
}
-bool CppCodeModelSettingsPage::matches(const QString &s) const
+void CppCodeModelSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.h b/src/plugins/cpptools/cppcodemodelsettingspage.h
index 310671e6be..a40bfda437 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.h
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.h
@@ -56,8 +56,6 @@ public:
void setSettings(const QSharedPointer<CppCodeModelSettings> &s);
void applyToSettings() const;
- QString searchKeywords() const;
-
private:
bool applyToSettings(QComboBox *chooser, const QString &mimeType) const;
void applyToWidget(QComboBox *chooser, const QString &mimeType) const;
@@ -73,15 +71,13 @@ public:
explicit CppCodeModelSettingsPage(QSharedPointer<CppCodeModelSettings> &settings,
QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &s) const;
+ void finish();
private:
const QSharedPointer<CppCodeModelSettings> m_settings;
QPointer<CppCodeModelSettingsWidget> m_widget;
- QString m_searchKeywords;
};
} // Internal namespace
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp
index ca94a0ec57..1b731b6ac8 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.cpp
+++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp
@@ -428,44 +428,6 @@ void CppCodeStylePreferencesWidget::slotCurrentPreferencesChanged(TextEditor::IC
updatePreview();
}
-QString CppCodeStylePreferencesWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui->tabSettingsWidget->searchKeywords()
- << sep << m_ui->indentBlockBraces->text()
- << sep << m_ui->indentBlockBody->text()
- << sep << m_ui->indentClassBraces->text()
- << sep << m_ui->indentEnumBraces->text()
- << sep << m_ui->indentNamespaceBraces->text()
- << sep << m_ui->indentNamespaceBody->text()
- << sep << m_ui->indentAccessSpecifiers->text()
- << sep << m_ui->indentDeclarationsRelativeToAccessSpecifiers->text()
- << sep << m_ui->indentFunctionBody->text()
- << sep << m_ui->indentFunctionBraces->text()
- << sep << m_ui->indentSwitchLabels->text()
- << sep << m_ui->indentCaseStatements->text()
- << sep << m_ui->indentCaseBlocks->text()
- << sep << m_ui->indentCaseBreak->text()
- << sep << m_ui->bindStarToIdentifier->text()
- << sep << m_ui->bindStarToTypeName->text()
- << sep << m_ui->bindStarToLeftSpecifier->text()
- << sep << m_ui->bindStarToRightSpecifier->text()
- << sep << m_ui->contentGroupBox->title()
- << sep << m_ui->bracesGroupBox->title()
- << sep << m_ui->switchGroupBox->title()
- << sep << m_ui->alignmentGroupBox->title()
- << sep << m_ui->pointerReferencesGroupBox->title()
- << sep << m_ui->extraPaddingConditions->text()
- << sep << m_ui->alignAssignments->text()
- ;
- for (int i = 0; i < m_ui->categoryTab->count(); i++)
- QTextStream(&rc) << sep << m_ui->categoryTab->tabText(i);
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged()
{
if (m_blockUpdates)
@@ -564,19 +526,20 @@ CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent) :
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON));
}
-QWidget *CppCodeStyleSettingsPage::createPage(QWidget *parent)
+QWidget *CppCodeStyleSettingsPage::widget()
{
- CppCodeStylePreferences *originalCodeStylePreferences
- = CppToolsSettings::instance()->cppCodeStyle();
- m_pageCppCodeStylePreferences = new CppCodeStylePreferences(m_widget);
- m_pageCppCodeStylePreferences->setDelegatingPool(originalCodeStylePreferences->delegatingPool());
- m_pageCppCodeStylePreferences->setCodeStyleSettings(originalCodeStylePreferences->codeStyleSettings());
- m_pageCppCodeStylePreferences->setCurrentDelegate(originalCodeStylePreferences->currentDelegate());
- // we set id so that it won't be possible to set delegate to the original prefs
- m_pageCppCodeStylePreferences->setId(originalCodeStylePreferences->id());
- m_widget = new CodeStyleEditor(TextEditorSettings::codeStyleFactory(CppTools::Constants::CPP_SETTINGS_ID),
- m_pageCppCodeStylePreferences, parent);
-
+ if (!m_widget) {
+ CppCodeStylePreferences *originalCodeStylePreferences
+ = CppToolsSettings::instance()->cppCodeStyle();
+ m_pageCppCodeStylePreferences = new CppCodeStylePreferences(m_widget);
+ m_pageCppCodeStylePreferences->setDelegatingPool(originalCodeStylePreferences->delegatingPool());
+ m_pageCppCodeStylePreferences->setCodeStyleSettings(originalCodeStylePreferences->codeStyleSettings());
+ m_pageCppCodeStylePreferences->setCurrentDelegate(originalCodeStylePreferences->currentDelegate());
+ // we set id so that it won't be possible to set delegate to the original prefs
+ m_pageCppCodeStylePreferences->setId(originalCodeStylePreferences->id());
+ m_widget = new CodeStyleEditor(TextEditorSettings::codeStyleFactory(CppTools::Constants::CPP_SETTINGS_ID),
+ m_pageCppCodeStylePreferences);
+ }
return m_widget;
}
@@ -601,9 +564,9 @@ void CppCodeStyleSettingsPage::apply()
}
}
-bool CppCodeStyleSettingsPage::matches(const QString &s) const
+void CppCodeStyleSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.h b/src/plugins/cpptools/cppcodestylesettingspage.h
index 8f83f3ef18..d42815edde 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.h
+++ b/src/plugins/cpptools/cppcodestylesettingspage.h
@@ -66,8 +66,6 @@ public:
void setCodeStyle(CppTools::CppCodeStylePreferences *codeStylePreferences);
- QString searchKeywords() const;
-
private slots:
void decorateEditors(const TextEditor::FontSettings &fontSettings);
void setVisualizeWhitespace(bool on);
@@ -95,13 +93,11 @@ class CppCodeStyleSettingsPage : public Core::IOptionsPage
public:
explicit CppCodeStyleSettingsPage(QWidget *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
CppCodeStylePreferences *m_pageCppCodeStylePreferences;
QPointer<TextEditor::CodeStyleEditor> m_widget;
};
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index d749a7d554..3f4883e099 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -101,7 +101,7 @@ public:
QStringList completions;
CppCompletionAssistInterface *ai
= new CppCompletionAssistInterface(editorWidget->document(), position,
- editorWidget->editorDocument()->filePath(),
+ editorWidget->baseTextDocument()->filePath(),
ExplicitlyInvoked, snapshot,
QStringList(), QStringList());
CppCompletionAssistProcessor processor;
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp
index 9de31210d8..48235be2d5 100644
--- a/src/plugins/cpptools/cppfilesettingspage.cpp
+++ b/src/plugins/cpptools/cppfilesettingspage.cpp
@@ -254,6 +254,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(QWidget *parent) :
foreach (const QString &suffix, headerMt.suffixes())
m_ui->headerSuffixComboBox->addItem(suffix);
m_ui->licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File);
+ m_ui->licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History"));
m_ui->licenseTemplatePathChooser->addButton(tr("Edit..."), this, SLOT(slotEdit()));
}
@@ -292,21 +293,6 @@ CppFileSettings CppFileSettingsWidget::settings() const
return rc;
}
-QString CppFileSettingsWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc) << m_ui->headersGroupBox->title()
- << ' ' << m_ui->headerSuffixLabel->text()
- << ' ' << m_ui->headerSearchPathsLabel->text()
- << ' ' << m_ui->sourcesGroupBox->title()
- << ' ' << m_ui->sourceSuffixLabel->text()
- << ' ' << m_ui->sourceSearchPathsLabel->text()
- << ' ' << m_ui->lowerCaseFileNamesCheckBox->text()
- << ' ' << m_ui->licenseTemplateLabel->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0)
{
const int index = cb->findText(text);
@@ -354,13 +340,13 @@ CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settin
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON));
}
-QWidget *CppFileSettingsPage::createPage(QWidget *parent)
+QWidget *CppFileSettingsPage::widget()
{
- m_widget = new CppFileSettingsWidget(parent);
- m_widget->setSettings(*m_settings);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new CppFileSettingsWidget;
+ m_widget->setSettings(*m_settings);
+ }
return m_widget;
}
@@ -377,9 +363,9 @@ void CppFileSettingsPage::apply()
}
}
-bool CppFileSettingsPage::matches(const QString &s) const
+void CppFileSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/cpptools/cppfilesettingspage.h b/src/plugins/cpptools/cppfilesettingspage.h
index 6fcf0dbc17..273749b1e8 100644
--- a/src/plugins/cpptools/cppfilesettingspage.h
+++ b/src/plugins/cpptools/cppfilesettingspage.h
@@ -80,8 +80,6 @@ public:
CppFileSettings settings() const;
void setSettings(const CppFileSettings &s);
- QString searchKeywords() const;
-
private slots:
void slotEdit();
@@ -98,15 +96,13 @@ public:
explicit CppFileSettingsPage(QSharedPointer<CppFileSettings> &settings,
QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
const QSharedPointer<CppFileSettings> m_settings;
QPointer<CppFileSettingsWidget> m_widget;
- QString m_searchKeywords;
};
} // namespace Internal
diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp
index 7b6c3ae274..02262ccf6c 100644
--- a/src/plugins/cpptools/cpplocatorfilter_test.cpp
+++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp
@@ -82,8 +82,8 @@ private:
virtual void doBeforeLocatorRun()
{
m_modelManager->updateSourceFiles(QStringList() << m_fileName).waitForFinished();
- QVERIFY(m_modelManager->snapshot().contains(m_fileName));
QCoreApplication::processEvents();
+ QVERIFY(m_modelManager->snapshot().contains(m_fileName));
}
virtual void doAfterLocatorRun()
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index bbe1a481aa..aad09a7f99 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -64,7 +64,8 @@ namespace CppTools {
uint qHash(const ProjectPart &p)
{
- uint h = qHash(p.defines) ^ p.cVersion ^ p.cxxVersion ^ p.cxxExtensions ^ p.qtVersion;
+ uint h = qHash(p.toolchainDefines) ^ qHash(p.projectDefines) ^ p.cVersion ^ p.cxxVersion
+ ^ p.cxxExtensions ^ p.qtVersion;
foreach (const QString &i, p.includePaths)
h ^= qHash(i);
@@ -78,7 +79,9 @@ uint qHash(const ProjectPart &p)
bool operator==(const ProjectPart &p1,
const ProjectPart &p2)
{
- if (p1.defines != p2.defines)
+ if (p1.toolchainDefines != p2.toolchainDefines)
+ return false;
+ if (p1.projectDefines != p2.projectDefines)
return false;
if (p1.cVersion != p2.cVersion)
return false;
@@ -363,6 +366,22 @@ QStringList CppModelManager::internalFrameworkPaths() const
return frameworkPaths;
}
+static void addUnique(const QList<QByteArray> &defs, QByteArray *macros, QSet<QByteArray> *alreadyIn)
+{
+ Q_ASSERT(macros);
+ Q_ASSERT(alreadyIn);
+
+ foreach (const QByteArray &def, defs) {
+ if (def.trimmed().isEmpty())
+ continue;
+ if (!alreadyIn->contains(def)) {
+ macros->append(def);
+ macros->append('\n');
+ alreadyIn->insert(def);
+ }
+ }
+}
+
QByteArray CppModelManager::internalDefinedMacros() const
{
QByteArray macros;
@@ -372,14 +391,8 @@ QByteArray CppModelManager::internalDefinedMacros() const
it.next();
const ProjectInfo pinfo = it.value();
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
- const QList<QByteArray> defs = part->defines.split('\n');
- foreach (const QByteArray &def, defs) {
- if (!alreadyIn.contains(def)) {
- macros += def;
- macros.append('\n');
- alreadyIn.insert(def);
- }
- }
+ addUnique(part->toolchainDefines.split('\n'), &macros, &alreadyIn);
+ addUnique(part->projectDefines.split('\n'), &macros, &alreadyIn);
}
}
return macros;
@@ -422,7 +435,8 @@ void CppModelManager::dumpModelManagerConfiguration()
qDebug() << "cxxExtensions:" << cxxExtensions;
qDebug() << "Qt version:" << part->qtVersion;
qDebug() << "precompiled header:" << part->precompiledHeaders;
- qDebug() << "defines:" << part->defines;
+ qDebug() << "toolchain defines:" << part->toolchainDefines;
+ qDebug() << "project defines:" << part->projectDefines;
qDebug() << "includes:" << part->includePaths;
qDebug() << "frameworkPaths:" << part->frameworkPaths;
qDebug() << "files:" << part->files;
@@ -802,7 +816,7 @@ ProjectPart::Ptr CppModelManager::fallbackProjectPart() const
{
ProjectPart::Ptr part(new ProjectPart);
- part->defines = m_definedMacros;
+ part->projectDefines = m_definedMacros;
part->includePaths = m_includePaths;
part->frameworkPaths = m_frameworkPaths;
part->cVersion = ProjectPart::C11;
diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h
index 3bddb955ad..431c08aa38 100644
--- a/src/plugins/cpptools/cppmodelmanager.h
+++ b/src/plugins/cpptools/cppmodelmanager.h
@@ -47,7 +47,6 @@ namespace TextEditor { class BaseTextEditorWidget; }
namespace CppTools {
class CppEditorSupport;
-class CppHighlightingSupportFactory;
namespace Internal {
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index a7a6aa222e..9e33466a06 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -200,6 +200,15 @@ private:
const QString &m_filePath;
};
+static QStringList updateProjectInfo(CppModelManager *modelManager, ModelManagerTestHelper *helper,
+ const ProjectInfo &projectInfo)
+{
+ helper->resetRefreshedSourceFiles();
+ modelManager->updateProjectInfo(projectInfo).waitForFinished();
+ QCoreApplication::processEvents();
+ return helper->waitForRefreshedSourceFiles();
+}
+
} // anonymous namespace
/// Check: The preprocessor cleans include and framework paths.
@@ -217,7 +226,7 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
- part->defines = QByteArray("#define OH_BEHAVE -1\n");
+ part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
part->includePaths = QStringList() << testDataDir.includeDir(false);
part->frameworkPaths = QStringList() << testDataDir.frameworksDir(false);
pi.appendProjectPart(part);
@@ -251,7 +260,7 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
- part->defines = QByteArray("#define OH_BEHAVE -1\n");
+ part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
part->includePaths << testDataDir.includeDir();
part->frameworkPaths << testDataDir.frameworksDir();
const QString &source = testDataDir.fileFromSourcesDir(
@@ -300,14 +309,12 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
- part->defines = QByteArray("#define OH_BEHAVE -1\n");
+ part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
part->includePaths = QStringList() << testDataDir.includeDir(false);
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part);
- mm->updateProjectInfo(pi);
-
- QStringList refreshedFiles = helper.waitForRefreshedSourceFiles();
+ QStringList refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp));
CPlusPlus::Snapshot snapshot = mm->snapshot();
@@ -320,12 +327,11 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
QVERIFY(macrosInHeaderBefore.first().name() == "test_modelmanager_refresh_h");
// Introduce a define that will enable another define once the document is reparsed.
- part->defines = QByteArray("#define TEST_DEFINE 1\n");
+ part->projectDefines = QByteArray("#define TEST_DEFINE 1\n");
pi.clearProjectParts();
pi.appendProjectPart(part);
- mm->updateProjectInfo(pi);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp));
@@ -377,7 +383,7 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
ProjectPart::Ptr part(new ProjectPart);
// Simulate project configuration change by having different defines each time.
defines += "\n#define ANOTHER_DEFINE";
- part->defines = defines;
+ part->projectDefines = defines;
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
part->files.append(ProjectFile(testHeader1, ProjectFile::CXXHeader));
@@ -385,11 +391,9 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part);
- mm->updateProjectInfo(pi);
-
- refreshedFiles = helper.waitForRefreshedSourceFiles();
-
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), 3);
+
QVERIFY(refreshedFiles.contains(testHeader1));
QVERIFY(refreshedFiles.contains(testHeader2));
QVERIFY(refreshedFiles.contains(testCpp));
@@ -432,8 +436,10 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
pi.appendProjectPart(part);
// Reindexing triggers a reparsing thread
+ helper.resetRefreshedSourceFiles();
QFuture<void> firstFuture = mm->updateProjectInfo(pi);
QVERIFY(firstFuture.isStarted() || firstFuture.isRunning());
+ firstFuture.waitForFinished();
const QStringList refreshedFiles = helper.waitForRefreshedSourceFiles();
QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp));
@@ -470,8 +476,7 @@ void CppToolsPlugin::test_modelmanager_refresh_added_and_purge_removed()
CPlusPlus::Snapshot snapshot;
QStringList refreshedFiles;
- mm->updateProjectInfo(pi);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), 2);
QVERIFY(refreshedFiles.contains(testHeader1));
@@ -490,8 +495,7 @@ void CppToolsPlugin::test_modelmanager_refresh_added_and_purge_removed()
newPart->files.append(ProjectFile(testHeader2, ProjectFile::CXXHeader));
pi.appendProjectPart(newPart);
- mm->updateProjectInfo(pi);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
// Only the added project file was reparsed
QCOMPARE(refreshedFiles.size(), 1);
@@ -530,8 +534,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
CPlusPlus::Snapshot snapshot;
QStringList refreshedFiles;
- mm->updateProjectInfo(pi);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), initialProjectFiles.size());
snapshot = mm->snapshot();
@@ -560,8 +563,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
pi.clearProjectParts();
pi.appendProjectPart(part);
- mm->updateProjectInfo(pi);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), finalProjectFiles.size());
snapshot = mm->snapshot();
@@ -618,8 +620,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
<< _("foo.cpp")
<< _("main.cpp"));
- mm->updateProjectInfo(project1.projectInfo);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, project1.projectInfo);
QCOMPARE(refreshedFiles.toSet(), project1.projectFiles.toSet());
const int snapshotSizeAfterProject1 = mm->snapshot().size();
@@ -633,8 +634,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
<< _("bar.cpp")
<< _("main.cpp"));
- mm->updateProjectInfo(project2.projectInfo);
- refreshedFiles = helper.waitForRefreshedSourceFiles();
+ refreshedFiles = updateProjectInfo(mm, &helper, project2.projectInfo);
QCOMPARE(refreshedFiles.toSet(), project2.projectFiles.toSet());
const int snapshotSizeAfterProject2 = mm->snapshot().size();
@@ -710,6 +710,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
const QString file = testDataDirectory.file(_("main.cpp"));
CppModelManager *mm = CppModelManager::instance();
+ helper.resetRefreshedSourceFiles();
// Open a file in the editor
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
@@ -740,6 +741,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
const QString file = testDataDirectory.file(_("main.cpp"));
CppModelManager *mm = CppModelManager::instance();
+ helper.resetRefreshedSourceFiles();
// Open a file in the editor
QCOMPARE(Core::EditorManager::documentModel()->openedDocuments().size(), 0);
@@ -750,6 +752,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
// Wait until the file is refreshed and check whether it is in the working copy
helper.waitForRefreshedSourceFiles();
+
QVERIFY(mm->workingCopy().contains(file));
// Run the garbage collector
@@ -810,7 +813,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->cxxVersion = ProjectPart::CXX11;
part1->qtVersion = ProjectPart::NoQt;
- part1->defines = QByteArray("#define SUB1\n");
+ part1->projectDefines = QByteArray("#define SUB1\n");
part1->includePaths = QStringList() << testDataDirectory.includeDir(false);
ProjectPart::Ptr part2(new ProjectPart);
@@ -818,17 +821,14 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->cxxVersion = ProjectPart::CXX11;
part2->qtVersion = ProjectPart::NoQt;
- part2->defines = QByteArray("#define SUB2\n");
+ part2->projectDefines = QByteArray("#define SUB2\n");
part2->includePaths = QStringList() << testDataDirectory.includeDir(false);
ProjectInfo pi = mm->projectInfo(project);
pi.appendProjectPart(part1);
pi.appendProjectPart(part2);
- mm->updateProjectInfo(pi);
-
- helper.waitForRefreshedSourceFiles();
-
+ updateProjectInfo(mm, &helper, pi);
QCOMPARE(mm->snapshot().size(), 4);
// Open a file in the editor
@@ -897,10 +897,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project_pch()
pi.appendProjectPart(part1);
pi.appendProjectPart(part2);
- mm->updateProjectInfo(pi);
-
- helper.waitForRefreshedSourceFiles();
-
+ updateProjectInfo(mm, &helper, pi);
QCOMPARE(mm->snapshot().size(), 4);
// Open a file in the editor
@@ -968,9 +965,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
pi.appendProjectPart(part1);
pi.appendProjectPart(part2);
- mm->updateProjectInfo(pi);
-
- helper.waitForRefreshedSourceFiles();
+ updateProjectInfo(mm, &helper, pi);
QCOMPARE(mm->snapshot().size(), 4);
diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp
index 31f1b55e18..3992c44bf5 100644
--- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp
+++ b/src/plugins/cpptools/cppmodelmanagerinterface.cpp
@@ -161,13 +161,7 @@ void ProjectPart::evaluateToolchain(const ToolChain *tc,
else
includePaths << header.path();
- const QByteArray macros = tc->predefinedMacros(cxxflags);
- if (!macros.isEmpty()) {
- if (!defines.isEmpty())
- defines += '\n';
- defines += macros;
- defines += '\n';
- }
+ toolchainDefines = tc->predefinedMacros(cxxflags);
}
static CppModelManagerInterface *g_instance = 0;
@@ -235,5 +229,6 @@ void CppModelManagerInterface::ProjectInfo::appendProjectPart(const ProjectPart:
// Update defines
if (!m_defines.isEmpty())
m_defines.append('\n');
- m_defines.append(part->defines);
+ m_defines.append(part->toolchainDefines);
+ m_defines.append(part->projectDefines);
}
diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h
index 2cc0cbae64..6848fb058e 100644
--- a/src/plugins/cpptools/cppmodelmanagerinterface.h
+++ b/src/plugins/cpptools/cppmodelmanagerinterface.h
@@ -56,7 +56,6 @@ class ModelManagerSupport;
class CppCompletionAssistProvider;
class CppEditorSupport;
class CppHighlightingSupport;
-class CppHighlightingSupportFactory;
class CppIndexingSupport;
class CPPTOOLS_EXPORT ProjectPart
@@ -106,7 +105,8 @@ public:
QString projectFile;
ProjectExplorer::Project *project;
QList<ProjectFile> files;
- QByteArray defines;
+ QByteArray projectDefines;
+ QByteArray toolchainDefines;
QStringList includePaths;
QStringList frameworkPaths;
QStringList precompiledHeaders;
diff --git a/src/plugins/cpptools/cppsnapshotupdater.cpp b/src/plugins/cpptools/cppsnapshotupdater.cpp
index 0a97a98fdf..fc97875c60 100644
--- a/src/plugins/cpptools/cppsnapshotupdater.cpp
+++ b/src/plugins/cpptools/cppsnapshotupdater.cpp
@@ -69,7 +69,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
}
if (m_projectPart) {
- configFile += m_projectPart->defines;
+ configFile += m_projectPart->toolchainDefines;
+ configFile += m_projectPart->projectDefines;
includePaths = m_projectPart->includePaths;
frameworkPaths = m_projectPart->frameworkPaths;
if (m_usePrecompiledHeaders)
diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro
index 9700ea853a..31faa0d5ad 100644
--- a/src/plugins/cpptools/cpptools.pro
+++ b/src/plugins/cpptools/cpptools.pro
@@ -1,129 +1,134 @@
-include(../../qtcreatorplugin.pri)
-
DEFINES += CPPTOOLS_LIBRARY
win32-msvc*:DEFINES += _SCL_SECURE_NO_WARNINGS
-HEADERS += completionsettingspage.h \
+include(../../qtcreatorplugin.pri)
+
+HEADERS += \
+ abstracteditorsupport.h \
+ builtinindexingsupport.h \
+ commentssettings.h \
+ completionsettingspage.h \
+ cppchecksymbols.h \
cppclassesfilter.h \
+ cppcodeformatter.h \
+ cppcodemodelsettings.h \
+ cppcodemodelsettingspage.h \
+ cppcodestylepreferences.h \
+ cppcodestylepreferencesfactory.h \
+ cppcodestylesettings.h \
+ cppcodestylesettingspage.h \
+ cppcompletionassist.h \
+ cppcompletionassistprovider.h \
cppcurrentdocumentfilter.h \
+ cppdoxygen.h \
+ cppfilesettingspage.h \
+ cppfindreferences.h \
cppfunctionsfilter.h \
+ cpphighlightingsupport.h \
+ cpphighlightingsupportinternal.h \
+ cppindexingsupport.h \
+ cpplocalsymbols.h \
+ cpplocatordata.h \
+ cpplocatorfilter.h \
cppmodelmanager.h \
cppmodelmanagerinterface.h \
- cpplocatorfilter.h \
+ cppmodelmanagersupport.h \
+ cppmodelmanagersupportinternal.h \
+ cpppointerdeclarationformatter.h \
+ cpppreprocessor.h \
+ cppprojectfile.h \
+ cppqtstyleindenter.h \
+ cpprefactoringchanges.h \
+ cppsemanticinfo.h \
+ cppsnapshotupdater.h \
cpptools_global.h \
cpptoolsconstants.h \
cpptoolseditorsupport.h \
- cppsnapshotupdater.h \
cpptoolsplugin.h \
- cppqtstyleindenter.h \
- searchsymbols.h \
- cppdoxygen.h \
- cppfilesettingspage.h \
- cppfindreferences.h \
- cppcodeformatter.h \
- symbolsfindfilter.h \
- insertionpointlocator.h \
- cpprefactoringchanges.h \
- abstracteditorsupport.h \
- cppcompletionassist.h \
- cppcodestylesettingspage.h \
- cpptoolssettings.h \
- cppcodestylesettings.h \
- cppcodestylepreferencesfactory.h \
- cppcodestylepreferences.h \
cpptoolsreuse.h \
+ cpptoolssettings.h \
doxygengenerator.h \
- commentssettings.h \
- symbolfinder.h \
- cppmodelmanagersupport.h \
- cpphighlightingsupport.h \
- cpphighlightingsupportinternal.h \
- cppchecksymbols.h \
- cpplocalsymbols.h \
- cppsemanticinfo.h \
- cppcompletionassistprovider.h \
- typehierarchybuilder.h \
- cppindexingsupport.h \
- builtinindexingsupport.h \
- cpppointerdeclarationformatter.h \
- cppprojectfile.h \
- cpppreprocessor.h \
+ functionutils.h \
includeutils.h \
- cpplocatordata.h \
- cppmodelmanagersupportinternal.h \
- cppcodemodelsettings.h \
- cppcodemodelsettingspage.h
+ insertionpointlocator.h \
+ searchsymbols.h \
+ symbolfinder.h \
+ symbolsfindfilter.h \
+ typehierarchybuilder.h
-SOURCES += completionsettingspage.cpp \
+SOURCES += \
+ abstracteditorsupport.cpp \
+ builtinindexingsupport.cpp \
+ commentssettings.cpp \
+ completionsettingspage.cpp \
+ cppchecksymbols.cpp \
cppclassesfilter.cpp \
+ cppcodeformatter.cpp \
+ cppcodemodelsettings.cpp \
+ cppcodemodelsettingspage.cpp \
+ cppcodestylepreferences.cpp \
+ cppcodestylepreferencesfactory.cpp \
+ cppcodestylesettings.cpp \
+ cppcodestylesettingspage.cpp \
+ cppcompletionassist.cpp \
+ cppcompletionassistprovider.cpp \
cppcurrentdocumentfilter.cpp \
- cppfunctionsfilter.cpp \
- cppmodelmanager.cpp \
- cppmodelmanagerinterface.cpp \
- cpplocatorfilter.cpp \
- cpptoolseditorsupport.cpp \
- cppsnapshotupdater.cpp \
- cpptoolsplugin.cpp \
- cppqtstyleindenter.cpp \
- searchsymbols.cpp \
cppdoxygen.cpp \
cppfilesettingspage.cpp \
- abstracteditorsupport.cpp \
cppfindreferences.cpp \
- cppcodeformatter.cpp \
- symbolsfindfilter.cpp \
- insertionpointlocator.cpp \
- cpprefactoringchanges.cpp \
- cppcompletionassist.cpp \
- cppcodestylesettingspage.cpp \
- cpptoolssettings.cpp \
- cppcodestylesettings.cpp \
- cppcodestylepreferencesfactory.cpp \
- cppcodestylepreferences.cpp \
- cpptoolsreuse.cpp \
- doxygengenerator.cpp \
- commentssettings.cpp \
- symbolfinder.cpp \
- cppmodelmanagersupport.cpp \
+ cppfunctionsfilter.cpp \
cpphighlightingsupport.cpp \
cpphighlightingsupportinternal.cpp \
- cppchecksymbols.cpp \
- cpplocalsymbols.cpp \
- cppsemanticinfo.cpp \
- cppcompletionassistprovider.cpp \
- typehierarchybuilder.cpp \
cppindexingsupport.cpp \
- builtinindexingsupport.cpp \
+ cpplocalsymbols.cpp \
+ cpplocatordata.cpp \
+ cpplocatorfilter.cpp \
+ cppmodelmanager.cpp \
+ cppmodelmanagerinterface.cpp \
+ cppmodelmanagersupport.cpp \
+ cppmodelmanagersupportinternal.cpp \
cpppointerdeclarationformatter.cpp \
- cppprojectfile.cpp \
cpppreprocessor.cpp \
+ cppprojectfile.cpp \
+ cppqtstyleindenter.cpp \
+ cpprefactoringchanges.cpp \
+ cppsemanticinfo.cpp \
+ cppsnapshotupdater.cpp \
+ cpptoolseditorsupport.cpp \
+ cpptoolsplugin.cpp \
+ cpptoolsreuse.cpp \
+ cpptoolssettings.cpp \
+ doxygengenerator.cpp \
+ functionutils.cpp \
includeutils.cpp \
- cpplocatordata.cpp \
- cppmodelmanagersupportinternal.cpp \
- cppcodemodelsettings.cpp \
- cppcodemodelsettingspage.cpp
+ insertionpointlocator.cpp \
+ searchsymbols.cpp \
+ symbolfinder.cpp \
+ symbolsfindfilter.cpp \
+ typehierarchybuilder.cpp
-FORMS += completionsettingspage.ui \
- cppfilesettingspage.ui \
+FORMS += \
+ completionsettingspage.ui \
+ cppcodemodelsettingspage.ui \
cppcodestylesettingspage.ui \
- cppcodemodelsettingspage.ui
+ cppfilesettingspage.ui
equals(TEST, 1) {
+ HEADERS += \
+ cpppreprocessertesthelper.h \
+ modelmanagertesthelper.h
+
SOURCES += \
cppcodegen_test.cpp \
cppcompletion_test.cpp \
+ cppheadersource_test.cpp \
+ cpplocatorfilter_test.cpp \
cppmodelmanager_test.cpp \
- modelmanagertesthelper.cpp \
cpppointerdeclarationformatter_test.cpp \
- cpplocatorfilter_test.cpp \
- symbolsearcher_test.cpp \
- cpppreprocessor_test.cpp \
cpppreprocessertesthelper.cpp \
- cppheadersource_test.cpp \
+ cpppreprocessor_test.cpp \
+ modelmanagertesthelper.cpp \
+ symbolsearcher_test.cpp \
typehierarchybuilder_test.cpp
- HEADERS += \
- cpppreprocessertesthelper.h \
- modelmanagertesthelper.h
-
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs
index e955c80e3a..721620b6f0 100644
--- a/src/plugins/cpptools/cpptools.qbs
+++ b/src/plugins/cpptools/cpptools.qbs
@@ -22,108 +22,57 @@ QtcPlugin {
}
files: [
- "abstracteditorsupport.cpp",
- "abstracteditorsupport.h",
- "commentssettings.cpp",
- "commentssettings.h",
- "completionsettingspage.cpp",
- "completionsettingspage.h",
- "completionsettingspage.ui",
- "cppchecksymbols.cpp",
- "cppchecksymbols.h",
- "cppclassesfilter.cpp",
- "cppclassesfilter.h",
- "cppcodeformatter.cpp",
- "cppcodeformatter.h",
- "cppcodestylepreferences.cpp",
- "cppcodestylepreferences.h",
- "cppcodestylepreferencesfactory.cpp",
- "cppcodestylepreferencesfactory.h",
- "cppcodestylesettings.cpp",
- "cppcodestylesettings.h",
- "cppcodestylesettingspage.cpp",
- "cppcodestylesettingspage.h",
- "cppcodestylesettingspage.ui",
- "cppcompletionassist.cpp",
- "cppcompletionassist.h",
- "cppcompletionassistprovider.cpp",
- "cppcompletionassistprovider.h",
- "cppcurrentdocumentfilter.cpp",
- "cppcurrentdocumentfilter.h",
- "cppdoxygen.cpp",
- "cppdoxygen.h",
- "cppfilesettingspage.cpp",
- "cppfilesettingspage.h",
- "cppfilesettingspage.ui",
- "cppfindreferences.cpp",
- "cppfindreferences.h",
- "cppfunctionsfilter.cpp",
- "cppfunctionsfilter.h",
- "cpphighlightingsupport.cpp",
- "cpphighlightingsupport.h",
- "cpphighlightingsupportinternal.cpp",
- "cpphighlightingsupportinternal.h",
- "cppindexingsupport.cpp",
- "cppindexingsupport.h",
- "cpplocalsymbols.cpp",
- "cpplocalsymbols.h",
- "cpplocatordata.cpp",
- "cpplocatordata.h",
- "cpplocatorfilter.cpp",
- "cpplocatorfilter.h",
- "cppmodelmanager.cpp",
- "cppmodelmanager.h",
- "cppmodelmanagersupport.h",
- "cppmodelmanagersupport.cpp",
- "cppmodelmanagersupportinternal.h",
- "cppmodelmanagersupportinternal.cpp",
- "cppmodelmanagerinterface.cpp",
- "cppmodelmanagerinterface.h",
- "cppqtstyleindenter.cpp",
- "cppqtstyleindenter.h",
- "cpppointerdeclarationformatter.cpp",
- "cpppointerdeclarationformatter.h",
- "cppprojectfile.cpp",
- "cppprojectfile.h",
- "cpprefactoringchanges.cpp",
- "cpprefactoringchanges.h",
- "cppsemanticinfo.cpp",
- "cppsemanticinfo.h",
+ "abstracteditorsupport.cpp", "abstracteditorsupport.h",
+ "builtinindexingsupport.cpp", "builtinindexingsupport.h",
+ "commentssettings.cpp", "commentssettings.h",
+ "completionsettingspage.cpp", "completionsettingspage.h", "completionsettingspage.ui",
+ "cppchecksymbols.cpp", "cppchecksymbols.h",
+ "cppclassesfilter.cpp", "cppclassesfilter.h",
+ "cppcodeformatter.cpp", "cppcodeformatter.h",
+ "cppcodemodelsettings.cpp", "cppcodemodelsettings.h",
+ "cppcodemodelsettingspage.cpp", "cppcodemodelsettingspage.h", "cppcodemodelsettingspage.ui",
+ "cppcodestylepreferences.cpp", "cppcodestylepreferences.h",
+ "cppcodestylepreferencesfactory.cpp", "cppcodestylepreferencesfactory.h",
+ "cppcodestylesettings.cpp", "cppcodestylesettings.h",
+ "cppcodestylesettingspage.cpp", "cppcodestylesettingspage.h", "cppcodestylesettingspage.ui",
+ "cppcompletionassist.cpp", "cppcompletionassist.h",
+ "cppcompletionassistprovider.cpp", "cppcompletionassistprovider.h",
+ "cppcurrentdocumentfilter.cpp", "cppcurrentdocumentfilter.h",
+ "cppdoxygen.cpp", "cppdoxygen.h",
+ "cppfilesettingspage.cpp", "cppfilesettingspage.h", "cppfilesettingspage.ui",
+ "cppfindreferences.cpp", "cppfindreferences.h",
+ "cppfunctionsfilter.cpp", "cppfunctionsfilter.h",
+ "cpphighlightingsupport.cpp", "cpphighlightingsupport.h",
+ "cpphighlightingsupportinternal.cpp", "cpphighlightingsupportinternal.h",
+ "cppindexingsupport.cpp", "cppindexingsupport.h",
+ "cpplocalsymbols.cpp", "cpplocalsymbols.h",
+ "cpplocatordata.cpp", "cpplocatordata.h",
+ "cpplocatorfilter.cpp", "cpplocatorfilter.h",
+ "cppmodelmanager.cpp", "cppmodelmanager.h",
+ "cppmodelmanagerinterface.cpp", "cppmodelmanagerinterface.h",
+ "cppmodelmanagersupport.cpp", "cppmodelmanagersupport.h",
+ "cppmodelmanagersupportinternal.cpp", "cppmodelmanagersupportinternal.h",
+ "cpppointerdeclarationformatter.cpp", "cpppointerdeclarationformatter.h",
+ "cpppreprocessor.cpp", "cpppreprocessor.h",
+ "cppprojectfile.cpp", "cppprojectfile.h",
+ "cppqtstyleindenter.cpp", "cppqtstyleindenter.h",
+ "cpprefactoringchanges.cpp", "cpprefactoringchanges.h",
+ "cppsemanticinfo.cpp", "cppsemanticinfo.h",
+ "cppsnapshotupdater.cpp", "cppsnapshotupdater.h",
"cpptools_global.h",
"cpptoolsconstants.h",
- "cpptoolseditorsupport.cpp",
- "cpptoolseditorsupport.h",
- "cpptoolsplugin.cpp",
- "cpptoolsplugin.h",
- "cpptoolsreuse.cpp",
- "cpptoolsreuse.h",
- "cpptoolssettings.cpp",
- "cpptoolssettings.h",
- "doxygengenerator.cpp",
- "doxygengenerator.h",
- "insertionpointlocator.cpp",
- "insertionpointlocator.h",
- "searchsymbols.cpp",
- "searchsymbols.h",
- "symbolfinder.cpp",
- "symbolfinder.h",
- "symbolsfindfilter.cpp",
- "symbolsfindfilter.h",
- "typehierarchybuilder.cpp",
- "typehierarchybuilder.h",
- "builtinindexingsupport.cpp",
- "builtinindexingsupport.h",
- "cpppreprocessor.cpp",
- "cpppreprocessor.h",
- "includeutils.cpp",
- "includeutils.h",
- "cppcodemodelsettings.cpp",
- "cppcodemodelsettings.h",
- "cppcodemodelsettingspage.cpp",
- "cppcodemodelsettingspage.h",
- "cppcodemodelsettingspage.ui",
- "cppsnapshotupdater.cpp",
- "cppsnapshotupdater.h",
+ "cpptoolseditorsupport.cpp", "cpptoolseditorsupport.h",
+ "cpptoolsplugin.cpp", "cpptoolsplugin.h",
+ "cpptoolsreuse.cpp", "cpptoolsreuse.h",
+ "cpptoolssettings.cpp", "cpptoolssettings.h",
+ "doxygengenerator.cpp", "doxygengenerator.h",
+ "functionutils.cpp", "functionutils.h",
+ "includeutils.cpp", "includeutils.h",
+ "insertionpointlocator.cpp", "insertionpointlocator.h",
+ "searchsymbols.cpp", "searchsymbols.h",
+ "symbolfinder.cpp", "symbolfinder.h",
+ "symbolsfindfilter.cpp", "symbolsfindfilter.h",
+ "typehierarchybuilder.cpp", "typehierarchybuilder.h",
]
Group {
@@ -133,14 +82,14 @@ QtcPlugin {
"cppcodegen_test.cpp",
"cppcompletion_test.cpp",
"cppheadersource_test.cpp",
+ "cpplocatorfilter_test.cpp",
"cppmodelmanager_test.cpp",
- "modelmanagertesthelper.cpp", "modelmanagertesthelper.h",
"cpppointerdeclarationformatter_test.cpp",
- "cpplocatorfilter_test.cpp",
- "symbolsearcher_test.cpp",
- "cpppreprocessor_test.cpp",
"cpppreprocessertesthelper.cpp", "cpppreprocessertesthelper.h",
- "typehierarchybuilder_test.cpp"
+ "cpppreprocessor_test.cpp",
+ "modelmanagertesthelper.cpp", "modelmanagertesthelper.h",
+ "symbolsearcher_test.cpp",
+ "typehierarchybuilder_test.cpp",
]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 85c304cad6..fc6b6204b5 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -186,7 +186,7 @@ QByteArray CppEditorSupport::contents() const
const int editorRev = editorRevision();
if (m_cachedContentsEditorRevision != editorRev && !m_fileIsBeingReloaded) {
m_cachedContentsEditorRevision = editorRev;
- m_cachedContents = m_textEditor->textDocument()->contents().toUtf8();
+ m_cachedContents = m_textEditor->textDocument()->plainText().toUtf8();
}
return m_cachedContents;
@@ -392,10 +392,14 @@ void CppEditorSupport::startHighlighting()
m_lastHighlightRevision = revision;
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
} else {
+ const unsigned revision = currentSource(false).revision;
+ if (m_lastHighlightRevision == revision)
+ return;
+
+ m_lastHighlightRevision = revision;
static const Document::Ptr dummyDoc;
static const Snapshot dummySnapshot;
m_highlighter = m_highlightingSupport->highlightingFuture(dummyDoc, dummySnapshot);
- m_lastHighlightRevision = editorRevision();
emit highlighterStarted(&m_highlighter, m_lastHighlightRevision);
}
}
@@ -407,7 +411,7 @@ void CppEditorSupport::onDiagnosticsChanged()
QList<Document::DiagnosticMessage> allDiagnostics;
{
QMutexLocker locker(&m_diagnosticsMutex);
- foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics.values())
+ foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics)
allDiagnostics.append(msgs);
}
diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h
index 94b30bf9e5..bb5cd9b3c6 100644
--- a/src/plugins/cpptools/cpptoolsplugin.h
+++ b/src/plugins/cpptools/cpptoolsplugin.h
@@ -204,6 +204,9 @@ private slots:
void test_cpppreprocessor_includes();
+ void test_functionutils_virtualFunctions();
+ void test_functionutils_virtualFunctions_data();
+
void test_modelmanager_paths_are_clean();
void test_modelmanager_framework_headers();
void test_modelmanager_refresh_also_includes_of_project_files();
diff --git a/src/plugins/cpptools/functionutils.cpp b/src/plugins/cpptools/functionutils.cpp
new file mode 100644
index 0000000000..fd7ae1d89c
--- /dev/null
+++ b/src/plugins/cpptools/functionutils.cpp
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "functionutils.h"
+
+#include "typehierarchybuilder.h"
+
+#include <cplusplus/CppDocument.h>
+#include <cplusplus/LookupContext.h>
+#include <cplusplus/Symbols.h>
+#include <utils/qtcassert.h>
+
+#include <QList>
+
+using namespace CPlusPlus;
+using namespace CppTools;
+
+enum VirtualType { Virtual, PureVirtual };
+
+static bool isVirtualFunction_helper(const Function *function,
+ const LookupContext &context,
+ VirtualType virtualType,
+ const Function **firstVirtual)
+{
+ enum { Unknown, False, True } res = Unknown;
+
+ if (firstVirtual)
+ *firstVirtual = 0;
+
+ if (!function)
+ return false;
+
+ if (virtualType == PureVirtual)
+ res = function->isPureVirtual() ? True : False;
+
+ if (function->isVirtual()) {
+ if (firstVirtual)
+ *firstVirtual = function;
+ if (res == Unknown)
+ res = True;
+ }
+
+ if (!firstVirtual && res != Unknown)
+ return res == True;
+
+ QList<LookupItem> results = context.lookup(function->name(), function->enclosingScope());
+ if (!results.isEmpty()) {
+ const bool isDestructor = function->name()->isDestructorNameId();
+ foreach (const LookupItem &item, results) {
+ if (Symbol *symbol = item.declaration()) {
+ if (Function *functionType = symbol->type()->asFunctionType()) {
+ if (functionType->name()->isDestructorNameId() != isDestructor)
+ continue;
+ if (functionType == function) // already tested
+ continue;
+ if (functionType->isFinal())
+ return res == True;
+ if (functionType->isVirtual()) {
+ if (!firstVirtual)
+ return true;
+ if (res == Unknown)
+ res = True;
+ *firstVirtual = functionType;
+ }
+ }
+ }
+ }
+ }
+
+ return res == True;
+}
+
+bool FunctionUtils::isVirtualFunction(const Function *function,
+ const LookupContext &context,
+ const Function **firstVirtual)
+{
+ return isVirtualFunction_helper(function, context, Virtual, firstVirtual);
+}
+
+bool FunctionUtils::isPureVirtualFunction(const Function *function,
+ const LookupContext &context,
+ const Function **firstVirtual)
+{
+ return isVirtualFunction_helper(function, context, PureVirtual, firstVirtual);
+}
+
+QList<Symbol *> FunctionUtils::overrides(Function *function, Class *functionsClass,
+ Class *staticClass, const Snapshot &snapshot)
+{
+ QList<Symbol *> result;
+ QTC_ASSERT(function && functionsClass && staticClass, return result);
+
+ FullySpecifiedType referenceType = function->type();
+ const Name *referenceName = function->name();
+ QTC_ASSERT(referenceName && referenceType.isValid(), return result);
+
+ // Find overrides
+ TypeHierarchyBuilder builder(staticClass, snapshot);
+ const TypeHierarchy &staticClassHierarchy = builder.buildDerivedTypeHierarchy();
+
+ QList<TypeHierarchy> l;
+ l.append(TypeHierarchy(functionsClass));
+ l.append(staticClassHierarchy);
+
+ while (!l.isEmpty()) {
+ // Add derived
+ const TypeHierarchy hierarchy = l.takeFirst();
+ QTC_ASSERT(hierarchy.symbol(), continue);
+ Class *c = hierarchy.symbol()->asClass();
+ QTC_ASSERT(c, continue);
+
+ foreach (const TypeHierarchy &t, hierarchy.hierarchy()) {
+ if (!l.contains(t))
+ l << t;
+ }
+
+ // Check member functions
+ for (int i = 0, total = c->memberCount(); i < total; ++i) {
+ Symbol *candidate = c->memberAt(i);
+ const Name *candidateName = candidate->name();
+ const FullySpecifiedType candidateType = candidate->type();
+ if (!candidateName || !candidateType.isValid())
+ continue;
+ if (candidateName->isEqualTo(referenceName) && candidateType.isEqualTo(referenceType))
+ result << candidate;
+ }
+ }
+
+ return result;
+}
+
+#ifdef WITH_TESTS
+#include "cpptoolsplugin.h"
+
+#include <QTest>
+
+namespace CppTools {
+namespace Internal {
+
+enum Virtuality
+{
+ NotVirtual,
+ Virtual,
+ PureVirtual
+};
+typedef QList<Virtuality> VirtualityList;
+} // Internal namespace
+} // CppTools namespace
+
+Q_DECLARE_METATYPE(CppTools::Internal::Virtuality)
+Q_DECLARE_METATYPE(CppTools::Internal::VirtualityList)
+Q_DECLARE_METATYPE(QList<int>)
+
+namespace CppTools {
+namespace Internal {
+
+void CppToolsPlugin::test_functionutils_virtualFunctions()
+{
+ // Create and parse document
+ QFETCH(QByteArray, source);
+ QFETCH(VirtualityList, virtualityList);
+ QFETCH(QList<int>, firstVirtualList);
+ Document::Ptr document = Document::create(QLatin1String("virtuals"));
+ document->setUtf8Source(source);
+ document->check(); // calls parse();
+ QCOMPARE(document->diagnosticMessages().size(), 0);
+ QVERIFY(document->translationUnit()->ast());
+ QList<const Function *> allFunctions;
+ const Function *firstVirtual = 0;
+
+ // Iterate through Function symbols
+ Snapshot snapshot;
+ snapshot.insert(document);
+ const LookupContext context(document, snapshot);
+ Control *control = document->translationUnit()->control();
+ Symbol **end = control->lastSymbol();
+ for (Symbol **it = control->firstSymbol(); it != end; ++it) {
+ if (const Function *function = (*it)->asFunction()) {
+ allFunctions.append(function);
+ QTC_ASSERT(!virtualityList.isEmpty(), return);
+ Virtuality virtuality = virtualityList.takeFirst();
+ QTC_ASSERT(!firstVirtualList.isEmpty(), return);
+ int firstVirtualIndex = firstVirtualList.takeFirst();
+ bool isVirtual = FunctionUtils::isVirtualFunction(function, context, &firstVirtual);
+ bool isPureVirtual = FunctionUtils::isPureVirtualFunction(function, context,
+ &firstVirtual);
+
+ // Test for regressions introduced by firstVirtual
+ QCOMPARE(FunctionUtils::isVirtualFunction(function, context), isVirtual);
+ QCOMPARE(FunctionUtils::isPureVirtualFunction(function, context), isPureVirtual);
+ if (isVirtual) {
+ if (isPureVirtual)
+ QCOMPARE(virtuality, PureVirtual);
+ else
+ QCOMPARE(virtuality, Virtual);
+ } else {
+ QEXPECT_FAIL("virtual-dtor-dtor", "Not implemented", Abort);
+ if (allFunctions.size() == 3)
+ QEXPECT_FAIL("dtor-virtual-dtor-dtor", "Not implemented", Abort);
+ QCOMPARE(virtuality, NotVirtual);
+ }
+ if (firstVirtualIndex == -1)
+ QVERIFY(!firstVirtual);
+ else
+ QCOMPARE(firstVirtual, allFunctions.at(firstVirtualIndex));
+ }
+ }
+ QVERIFY(virtualityList.isEmpty());
+ QVERIFY(firstVirtualList.isEmpty());
+}
+
+void CppToolsPlugin::test_functionutils_virtualFunctions_data()
+{
+ typedef QByteArray _;
+ QTest::addColumn<QByteArray>("source");
+ QTest::addColumn<VirtualityList>("virtualityList");
+ QTest::addColumn<QList<int> >("firstVirtualList");
+
+ QTest::newRow("none")
+ << _("struct None { void foo() {} };\n")
+ << (VirtualityList() << NotVirtual)
+ << (QList<int>() << -1);
+
+ QTest::newRow("single-virtual")
+ << _("struct V { virtual void foo() {} };\n")
+ << (VirtualityList() << Virtual)
+ << (QList<int>() << 0);
+
+ QTest::newRow("single-pure-virtual")
+ << _("struct PV { virtual void foo() = 0; };\n")
+ << (VirtualityList() << PureVirtual)
+ << (QList<int>() << 0);
+
+ QTest::newRow("virtual-derived-with-specifier")
+ << _("struct Base { virtual void foo() {} };\n"
+ "struct Derived : Base { virtual void foo() {} };\n")
+ << (VirtualityList() << Virtual << Virtual)
+ << (QList<int>() << 0 << 0);
+
+ QTest::newRow("virtual-derived-implicit")
+ << _("struct Base { virtual void foo() {} };\n"
+ "struct Derived : Base { void foo() {} };\n")
+ << (VirtualityList() << Virtual << Virtual)
+ << (QList<int>() << 0 << 0);
+
+ QTest::newRow("not-virtual-then-virtual")
+ << _("struct Base { void foo() {} };\n"
+ "struct Derived : Base { virtual void foo() {} };\n")
+ << (VirtualityList() << NotVirtual << Virtual)
+ << (QList<int>() << -1 << 1);
+
+ QTest::newRow("virtual-final-not-virtual")
+ << _("struct Base { virtual void foo() {} };\n"
+ "struct Derived : Base { void foo() final {} };\n"
+ "struct Derived2 : Derived { void foo() {} };")
+ << (VirtualityList() << Virtual << Virtual << NotVirtual)
+ << (QList<int>() << 0 << 0 << -1);
+
+ QTest::newRow("virtual-then-pure")
+ << _("struct Base { virtual void foo() {} };\n"
+ "struct Derived : Base { virtual void foo() = 0; };\n"
+ "struct Derived2 : Derived { void foo() {} };")
+ << (VirtualityList() << Virtual << PureVirtual << Virtual)
+ << (QList<int>() << 0 << 0 << 0);
+
+ QTest::newRow("virtual-virtual-final-not-virtual")
+ << _("struct Base { virtual void foo() {} };\n"
+ "struct Derived : Base { virtual void foo() final {} };\n"
+ "struct Derived2 : Derived { void foo() {} };")
+ << (VirtualityList() << Virtual << Virtual << NotVirtual)
+ << (QList<int>() << 0 << 0 << -1);
+
+ QTest::newRow("ctor-virtual-dtor")
+ << _("struct Base { Base() {} virtual ~Base() {} };\n")
+ << (VirtualityList() << NotVirtual << Virtual)
+ << (QList<int>() << -1 << 1);
+
+ QTest::newRow("virtual-dtor-dtor")
+ << _("struct Base { virtual ~Base() {} };\n"
+ "struct Derived : Base { ~Derived() {} };\n")
+ << (VirtualityList() << Virtual << Virtual)
+ << (QList<int>() << 0 << 0);
+
+ QTest::newRow("dtor-virtual-dtor-dtor")
+ << _("struct Base { ~Base() {} };\n"
+ "struct Derived : Base { virtual ~Derived() {} };\n"
+ "struct Derived2 : Derived { ~Derived2() {} };\n")
+ << (VirtualityList() << NotVirtual << Virtual << Virtual)
+ << (QList<int>() << -1 << 1 << 1);
+}
+
+} // namespace Internal
+} // namespace CppTools
+
+#endif
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp b/src/plugins/cpptools/functionutils.h
index 8069fbbcb7..d44231cc19 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp
+++ b/src/plugins/cpptools/functionutils.h
@@ -27,59 +27,42 @@
**
****************************************************************************/
-#include "qdeclarativecanvastimer_p.h"
+#ifndef FUNCTIONUTILS_H
+#define FUNCTIONUTILS_H
-#include <QJSEngine>
-#include <QJSValue>
-#include <qtimer.h>
+#include "cpptools_global.h"
QT_BEGIN_NAMESPACE
+template <class> class QList;
+QT_END_NAMESPACE
-Q_GLOBAL_STATIC(QList<CanvasTimer*> , activeTimers);
-
-CanvasTimer::CanvasTimer(QObject *parent, const QJSValue &data)
- : QTimer(parent), m_value(data)
-{
-}
-
-void CanvasTimer::handleTimeout()
-{
- Q_ASSERT(m_value.isCallable());
- m_value.call();
- if (isSingleShot())
- removeTimer(this);
-}
-
-void CanvasTimer::createTimer(QObject *parent, const QJSValue &val, long timeout, bool singleshot)
-{
+namespace CPlusPlus {
+class Class;
+class Function;
+class LookupContext;
+class Snapshot;
+class Symbol;
+} // namespace CPlusPlus
- CanvasTimer *timer = new CanvasTimer(parent, val);
- timer->setInterval(timeout);
- timer->setSingleShot(singleshot);
- connect(timer, SIGNAL(timeout()), timer, SLOT(handleTimeout()));
- activeTimers()->append(timer);
- timer->start();
-}
+namespace CppTools {
-void CanvasTimer::removeTimer(CanvasTimer *timer)
+class CPPTOOLS_EXPORT FunctionUtils
{
- activeTimers()->removeAll(timer);
- timer->deleteLater();
-}
+public:
+ static bool isVirtualFunction(const CPlusPlus::Function *function,
+ const CPlusPlus::LookupContext &context,
+ const CPlusPlus::Function **firstVirtual = 0);
-void CanvasTimer::removeTimer(const QJSValue &val)
-{
- if (!val.isCallable())
- return;
+ static bool isPureVirtualFunction(const CPlusPlus::Function *function,
+ const CPlusPlus::LookupContext &context,
+ const CPlusPlus::Function **firstVirtual = 0);
- for (int i = 0 ; i < activeTimers()->count() ; ++i) {
- CanvasTimer *timer = activeTimers()->at(i);
- if (timer->equals(val)) {
- removeTimer(timer);
- return;
- }
- }
-}
+ static QList<CPlusPlus::Symbol *> overrides(CPlusPlus::Function *function,
+ CPlusPlus::Class *functionsClass,
+ CPlusPlus::Class *staticClass,
+ const CPlusPlus::Snapshot &snapshot);
+};
-QT_END_NAMESPACE
+} // namespace CppTools
+#endif // FUNCTIONUTILS_H
diff --git a/src/plugins/cpptools/modelmanagertesthelper.cpp b/src/plugins/cpptools/modelmanagertesthelper.cpp
index 4d7590e130..6ca2648ccd 100644
--- a/src/plugins/cpptools/modelmanagertesthelper.cpp
+++ b/src/plugins/cpptools/modelmanagertesthelper.cpp
@@ -39,6 +39,7 @@ TestProject::TestProject(const QString &name, QObject *parent)
: m_name (name)
{
setParent(parent);
+ setId(Core::Id::fromString(name));
}
TestProject::~TestProject()
@@ -102,10 +103,14 @@ ModelManagerTestHelper::Project *ModelManagerTestHelper::createProject(const QSt
return tp;
}
-QStringList ModelManagerTestHelper::waitForRefreshedSourceFiles()
+void ModelManagerTestHelper::resetRefreshedSourceFiles()
{
+ m_lastRefreshedSourceFiles.clear();
m_refreshHappened = false;
+}
+QStringList ModelManagerTestHelper::waitForRefreshedSourceFiles()
+{
while (!m_refreshHappened)
QCoreApplication::processEvents();
diff --git a/src/plugins/cpptools/modelmanagertesthelper.h b/src/plugins/cpptools/modelmanagertesthelper.h
index d4ac671bc1..3f52924527 100644
--- a/src/plugins/cpptools/modelmanagertesthelper.h
+++ b/src/plugins/cpptools/modelmanagertesthelper.h
@@ -48,9 +48,6 @@ public:
virtual QString displayName() const
{ return m_name; }
- virtual Core::Id id() const
- { return Core::Id::fromString(m_name); }
-
virtual Core::IDocument *document() const
{ return 0; }
@@ -83,6 +80,7 @@ public:
Project *createProject(const QString &name);
+ void resetRefreshedSourceFiles();
QStringList waitForRefreshedSourceFiles();
void waitForFinishedGc();
diff --git a/src/plugins/cpptools/symbolsearcher_test.cpp b/src/plugins/cpptools/symbolsearcher_test.cpp
index c5529b7b46..f11bdbcb8e 100644
--- a/src/plugins/cpptools/symbolsearcher_test.cpp
+++ b/src/plugins/cpptools/symbolsearcher_test.cpp
@@ -101,12 +101,12 @@ public:
{
QVERIFY(m_indexingSupportToUse);
QVERIFY(m_modelManager->snapshot().isEmpty());
- m_modelManager->updateSourceFiles(QStringList() << m_testFile).waitForFinished();
+ m_modelManager->updateSourceFiles(QStringList(m_testFile)).waitForFinished();
+ QCoreApplication::processEvents();
QVERIFY(m_modelManager->snapshot().contains(m_testFile));
m_indexingSupportToRestore = m_modelManager->indexingSupport();
m_modelManager->setIndexingSupport(m_indexingSupportToUse);
- QCoreApplication::processEvents();
}
ResultDataList run(const SymbolSearcher::Parameters &searchParameters) const
diff --git a/src/plugins/cpptools/typehierarchybuilder.h b/src/plugins/cpptools/typehierarchybuilder.h
index 94d1151024..0820770de4 100644
--- a/src/plugins/cpptools/typehierarchybuilder.h
+++ b/src/plugins/cpptools/typehierarchybuilder.h
@@ -53,6 +53,9 @@ public:
CPlusPlus::Symbol *symbol() const;
const QList<TypeHierarchy> &hierarchy() const;
+ bool operator==(const TypeHierarchy &other) const
+ { return _symbol == other._symbol; }
+
private:
CPlusPlus::Symbol *_symbol;
QList<TypeHierarchy> _hierarchy;
diff --git a/src/plugins/cpptools/typehierarchybuilder_test.cpp b/src/plugins/cpptools/typehierarchybuilder_test.cpp
index 3bcfa05488..dbce776c6b 100644
--- a/src/plugins/cpptools/typehierarchybuilder_test.cpp
+++ b/src/plugins/cpptools/typehierarchybuilder_test.cpp
@@ -127,10 +127,13 @@ public:
// Parse files
m_modelManager->updateSourceFiles(filePaths).waitForFinished();
-
- // Get class for which to generate the hierarchy
+ QCoreApplication::processEvents();
const Snapshot snapshot = m_modelManager->snapshot();
QVERIFY(!snapshot.isEmpty());
+ foreach (const QString &filePath, filePaths)
+ QVERIFY(snapshot.contains(filePath));
+
+ // Get class for which to generate the hierarchy
const Document::Ptr firstDocument = snapshot.document(filePaths.first());
Class *clazz = FindFirstClassInDocument()(firstDocument);
QVERIFY(clazz);
diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp
index e2a3bb327c..85655f8aee 100644
--- a/src/plugins/cvs/checkoutwizard.cpp
+++ b/src/plugins/cvs/checkoutwizard.cpp
@@ -68,7 +68,7 @@ VcsBase::Command *CheckoutWizard::createCommand(const QList<QWizardPage*> &param
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
QTC_ASSERT(cwp, return 0);
const CvsSettings settings = CvsPlugin::instance()->settings();
- const QString binary = settings.cvsBinaryPath;
+ const QString binary = settings.binaryPath();
QStringList args;
const QString repository = cwp->repository();
args << QLatin1String("checkout") << repository;
diff --git a/src/plugins/cvs/cvs.pro b/src/plugins/cvs/cvs.pro
index 9ecb32b06e..be1d4af402 100644
--- a/src/plugins/cvs/cvs.pro
+++ b/src/plugins/cvs/cvs.pro
@@ -2,6 +2,7 @@ include(../../qtcreatorplugin.pri)
HEADERS += annotationhighlighter.h \
cvsplugin.h \
+ cvsclient.h \
cvscontrol.h \
settingspage.h \
cvseditor.h \
@@ -14,6 +15,7 @@ HEADERS += annotationhighlighter.h \
SOURCES += annotationhighlighter.cpp \
cvsplugin.cpp \
+ cvsclient.cpp \
cvscontrol.cpp \
settingspage.cpp \
cvseditor.cpp \
diff --git a/src/plugins/cvs/cvs.qbs b/src/plugins/cvs/cvs.qbs
index 8d858a7b24..a1021cfc6e 100644
--- a/src/plugins/cvs/cvs.qbs
+++ b/src/plugins/cvs/cvs.qbs
@@ -20,6 +20,8 @@ QtcPlugin {
"checkoutwizardpage.cpp",
"checkoutwizardpage.h",
"cvs.qrc",
+ "cvsclient.cpp",
+ "cvsclient.h",
"cvsconstants.h",
"cvscontrol.cpp",
"cvscontrol.h",
diff --git a/src/plugins/cvs/cvsclient.cpp b/src/plugins/cvs/cvsclient.cpp
new file mode 100644
index 0000000000..2dfe577e01
--- /dev/null
+++ b/src/plugins/cvs/cvsclient.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "cvsclient.h"
+#include "cvssettings.h"
+#include "cvsconstants.h"
+
+#include <vcsbase/vcsbaseplugin.h>
+#include <vcsbase/vcsbaseeditor.h>
+#include <vcsbase/vcsbaseconstants.h>
+#include <vcsbase/vcsbaseeditorparameterwidget.h>
+#include <utils/synchronousprocess.h>
+
+#include <QDir>
+#include <QFileInfo>
+#include <QTextStream>
+#include <QDebug>
+
+namespace Cvs {
+namespace Internal {
+
+class CvsDiffExitCodeInterpreter : public Utils::ExitCodeInterpreter
+{
+ Q_OBJECT
+public:
+ CvsDiffExitCodeInterpreter(QObject *parent) : Utils::ExitCodeInterpreter(parent) {}
+ Utils::SynchronousProcessResponse::Result interpretExitCode(int code) const;
+
+};
+
+Utils::SynchronousProcessResponse::Result CvsDiffExitCodeInterpreter::interpretExitCode(int code) const
+{
+ if (code < 0 || code > 2)
+ return Utils::SynchronousProcessResponse::FinishedError;
+ return Utils::SynchronousProcessResponse::Finished;
+}
+
+// Collect all parameters required for a diff to be able to associate them
+// with a diff editor and re-run the diff with parameters.
+struct CvsDiffParameters
+{
+ QString workingDir;
+ QStringList extraOptions;
+ QStringList files;
+};
+
+// Parameter widget controlling whitespace diff mode, associated with a parameter
+class CvsDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
+{
+ Q_OBJECT
+public:
+ explicit CvsDiffParameterWidget(CvsClient *client,
+ const CvsDiffParameters &p,
+ QWidget *parent = 0);
+ QStringList arguments() const;
+ void executeCommand();
+
+private:
+
+ CvsClient *m_client;
+ const CvsDiffParameters m_params;
+};
+
+CvsDiffParameterWidget::CvsDiffParameterWidget(CvsClient *client,
+ const CvsDiffParameters &p,
+ QWidget *parent)
+ : VcsBase::VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
+{
+ mapSetting(addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace")),
+ client->settings()->boolPointer(CvsSettings::diffIgnoreWhiteSpaceKey));
+ mapSetting(addToggleButton(QLatin1String("-B"), tr("Ignore Blank Lines")),
+ client->settings()->boolPointer(CvsSettings::diffIgnoreBlankLinesKey));
+}
+
+QStringList CvsDiffParameterWidget::arguments() const
+{
+ QStringList args;
+ args = m_client->settings()->stringValue(CvsSettings::diffOptionsKey).split(QLatin1Char(' '), QString::SkipEmptyParts);
+ args += VcsBaseEditorParameterWidget::arguments();
+ return args;
+}
+
+void CvsDiffParameterWidget::executeCommand()
+{
+ m_client->diff(m_params.workingDir, m_params.files, m_params.extraOptions);
+}
+
+CvsClient::CvsClient(CvsSettings *settings) :
+ VcsBase::VcsBaseClient(settings)
+{
+}
+
+CvsSettings *CvsClient::settings() const
+{
+ return dynamic_cast<CvsSettings *>(VcsBase::VcsBaseClient::settings());
+}
+
+Core::Id CvsClient::vcsEditorKind(VcsCommand cmd) const
+{
+ switch (cmd) {
+ case DiffCommand:
+ return "CVS Diff Editor"; // TODO: replace by string from cvsconstants.h
+ default:
+ return Core::Id();
+ }
+}
+
+Utils::ExitCodeInterpreter *CvsClient::exitCodeInterpreter(VcsCommand cmd, QObject *parent) const
+{
+ switch (cmd) {
+ case DiffCommand:
+ return new CvsDiffExitCodeInterpreter(parent);
+ default:
+ return 0;
+ }
+}
+
+void CvsClient::diff(const QString &workingDir, const QStringList &files,
+ const QStringList &extraOptions)
+{
+ VcsBaseClient::diff(workingDir, files, extraOptions);
+}
+
+QString CvsClient::findTopLevelForFile(const QFileInfo &file) const
+{
+ Q_UNUSED(file)
+ return QString();
+}
+
+QStringList CvsClient::revisionSpec(const QString &revision) const
+{
+ Q_UNUSED(revision)
+ return QStringList();
+}
+
+VcsBase::VcsBaseClient::StatusItem CvsClient::parseStatusLine(const QString &line) const
+{
+ Q_UNUSED(line)
+ return VcsBase::VcsBaseClient::StatusItem();
+}
+
+VcsBase::VcsBaseEditorParameterWidget *CvsClient::createDiffEditor(
+ const QString &workingDir, const QStringList &files, const QStringList &extraOptions)
+{
+ Q_UNUSED(extraOptions)
+ CvsDiffParameters p;
+ p.workingDir = workingDir;
+ p.files = files;
+ p.extraOptions = extraOptions;
+ return new CvsDiffParameterWidget(this, p);
+}
+
+} // namespace Internal
+} // namespace Cvs
+
+#include "cvsclient.moc"
diff --git a/src/plugins/debugger/lldblib/lldboptionspage.h b/src/plugins/cvs/cvsclient.h
index 81ebfaf28c..62ad232bcf 100644
--- a/src/plugins/debugger/lldblib/lldboptionspage.h
+++ b/src/plugins/cvs/cvsclient.h
@@ -27,54 +27,42 @@
**
****************************************************************************/
-#ifndef LLDBOPTIONSPAGE_H
-#define LLDBOPTIONSPAGE_H
+#ifndef CVSCLIENT_H
+#define CVSCLIENT_H
-#include <coreplugin/dialogs/ioptionspage.h>
-#include "ui_lldboptionspagewidget.h"
+#include "cvssettings.h"
+#include <vcsbase/vcsbaseclient.h>
-#include <QWidget>
-#include <QPointer>
-#include <QSharedPointer>
-#include <QSettings>
-
-namespace Debugger {
+namespace Cvs {
namespace Internal {
-class LldbOptionsPageWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit LldbOptionsPageWidget(QWidget *parent, QSettings *s);
-
-public slots:
- void save();
- void load();
+class CvsSettings;
-private:
- Ui::LldbOptionsPageWidget m_ui;
- QSettings *s;
-};
-
-class LldbOptionsPage : public Core::IOptionsPage
+class CvsClient : public VcsBase::VcsBaseClient
{
Q_OBJECT
public:
- LldbOptionsPage();
+ CvsClient(CvsSettings *settings);
+
+ CvsSettings *settings() const;
+ void diff(const QString &workingDir, const QStringList &files,
+ const QStringList &extraOptions = QStringList());
+ QString findTopLevelForFile(const QFileInfo &file) const;
+ QStringList revisionSpec(const QString &revision) const;
+ StatusItem parseStatusLine(const QString &line) const;
- // IOptionsPage
- QWidget *createPage(QWidget *parent);
- void apply();
- void finish();
- bool matches(const QString &) const;
+protected:
+ Utils::ExitCodeInterpreter *exitCodeInterpreter(VcsCommand cmd, QObject *parent) const;
+ Core::Id vcsEditorKind(VcsCommand cmd) const;
+ VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
+ const QStringList &files,
+ const QStringList &extraOptions);
private:
- QPointer<LldbOptionsPageWidget> m_widget;
};
} // namespace Internal
-} // namespace Debugger
+} // namespace Cvs
-#endif // LLDBOPTIONSPAGE_H
+#endif // CVSCLIENT_H
diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp
index b22e93eafe..be7a1b1d7f 100644
--- a/src/plugins/cvs/cvscontrol.cpp
+++ b/src/plugins/cvs/cvscontrol.cpp
@@ -55,7 +55,7 @@ Core::Id CvsControl::id() const
bool CvsControl::isConfigured() const
{
- const QString binary = m_plugin->settings().cvsBinaryPath;
+ const QString binary = m_plugin->settings().binaryPath();
if (binary.isEmpty())
return false;
QFileInfo fi(binary);
@@ -81,8 +81,9 @@ bool CvsControl::supportsOperation(Operation operation) const
return rc;
}
-Core::IVersionControl::OpenSupportMode CvsControl::openSupportMode() const
+Core::IVersionControl::OpenSupportMode CvsControl::openSupportMode(const QString &fileName) const
{
+ Q_UNUSED(fileName);
return OpenOptional;
}
diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h
index 7d1fac5607..65328dab3d 100644
--- a/src/plugins/cvs/cvscontrol.h
+++ b/src/plugins/cvs/cvscontrol.h
@@ -52,7 +52,7 @@ public:
bool isConfigured() const;
bool supportsOperation(Operation operation) const;
- OpenSupportMode openSupportMode() const;
+ OpenSupportMode openSupportMode(const QString &fileName) const;
bool vcsOpen(const QString &fileName);
bool vcsAdd(const QString &fileName);
bool vcsDelete(const QString &filename);
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 15826ba473..4c72fdc76f 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -31,6 +31,7 @@
#include "settingspage.h"
#include "cvseditor.h"
#include "cvssubmiteditor.h"
+#include "cvsclient.h"
#include "cvsconstants.h"
#include "cvscontrol.h"
#include "checkoutwizard.h"
@@ -192,6 +193,7 @@ CvsPlugin::CvsPlugin() :
CvsPlugin::~CvsPlugin()
{
+ delete m_client;
cleanCommitMessageFile();
}
@@ -234,7 +236,8 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage))
return false;
- m_settings.fromSettings(ICore::settings());
+ m_settings.readSettings(ICore::settings());
+ m_client = new CvsClient(&m_settings);
addAutoReleasedObject(new SettingsPage);
@@ -470,7 +473,8 @@ bool CvsPlugin::submitEditorAboutToClose()
editor->promptSubmit(tr("Closing CVS Editor"),
tr("Do you want to commit the change?"),
tr("The commit message check failed. Do you want to commit the change?"),
- &newSettings.promptToSubmit, !m_submitActionTriggered);
+ newSettings.boolPointer(CvsSettings::promptOnSubmitKey),
+ !m_submitActionTriggered);
m_submitActionTriggered = false;
switch (answer) {
case VcsBaseSubmitEditor::SubmitCanceled:
@@ -497,7 +501,7 @@ bool CvsPlugin::submitEditorAboutToClose()
void CvsPlugin::diffCommitFiles(const QStringList &files)
{
- cvsDiff(m_commitRepository, files);
+ m_client->diff(m_commitRepository, files);
}
static void setDiffBaseDirectory(IEditor *editor, const QString &db)
@@ -506,114 +510,6 @@ static void setDiffBaseDirectory(IEditor *editor, const QString &db)
ve->setWorkingDirectory(db);
}
-// Collect all parameters required for a diff to be able to associate them
-// with a diff editor and re-run the diff with parameters.
-struct CvsDiffParameters
-{
- QString workingDir;
- QStringList arguments;
- QStringList files;
-};
-
-// Parameter widget controlling whitespace diff mode, associated with a parameter
-// struct.
-class CvsDiffParameterWidget : public VcsBaseEditorParameterWidget
-{
- Q_OBJECT
-
-public:
- explicit CvsDiffParameterWidget(const CvsDiffParameters &p, QWidget *parent = 0);
-
-signals:
- void reRunDiff(const Cvs::Internal::CvsDiffParameters &);
-
-public slots:
- void triggerReRun();
-
-private:
- const CvsDiffParameters m_parameters;
-};
-
-CvsDiffParameterWidget::CvsDiffParameterWidget(const CvsDiffParameters &p, QWidget *parent) :
- VcsBaseEditorParameterWidget(parent), m_parameters(p)
-{
- setBaseArguments(p.arguments);
- addToggleButton(QLatin1String("-w"), tr("Ignore Whitespace"));
- addToggleButton(QLatin1String("-B"), tr("Ignore Blank Lines"));
- connect(this, SIGNAL(argumentsChanged()),
- this, SLOT(triggerReRun()));
-}
-
-void CvsDiffParameterWidget::triggerReRun()
-{
- CvsDiffParameters effectiveParameters = m_parameters;
- effectiveParameters.arguments = arguments();
- emit reRunDiff(effectiveParameters);
-}
-
-void CvsPlugin::cvsDiff(const QString &workingDir, const QStringList &files)
-{
- CvsDiffParameters p;
- p.workingDir = workingDir;
- p.files = files;
- p.arguments = m_settings.cvsDiffOptions.split(QLatin1Char(' '), QString::SkipEmptyParts);
- cvsDiff(p);
-}
-
-void CvsPlugin::cvsDiff(const Cvs::Internal::CvsDiffParameters &p)
-{
- if (Constants::debug)
- qDebug() << Q_FUNC_INFO << p.files;
- const QString source = VcsBaseEditorWidget::getSource(p.workingDir, p.files);
- QTextCodec *codec = VcsBaseEditorWidget::getCodec(p.workingDir, p.files);
- const QString id = VcsBaseEditorWidget::getTitleId(p.workingDir, p.files);
-
- QStringList args(QLatin1String("diff"));
- args.append(p.arguments);
- args.append(p.files);
-
- // CVS returns the diff exit code (1 if files differ), which is
- // undistinguishable from a "file not found" error, unfortunately.
- const CvsResponse response =
- runCvs(p.workingDir, args, m_settings.timeOutMS(), 0, codec);
- switch (response.result) {
- case CvsResponse::NonNullExitCode:
- case CvsResponse::Ok:
- break;
- case CvsResponse::OtherError:
- return;
- }
-
- QString output = fixDiffOutput(response.stdOut);
- if (output.isEmpty())
- output = tr("The files do not differ.");
- // diff of a single file? re-use an existing view if possible to support
- // the common usage pattern of continuously changing and diffing a file
- // Show in the same editor if diff has been executed before
- const QString tag = VcsBaseEditorWidget::editorTag(DiffOutput, p.workingDir, p.files);
- if (IEditor *existingEditor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
- existingEditor->document()->setContents(output.toUtf8());
- EditorManager::activateEditor(existingEditor);
- setDiffBaseDirectory(existingEditor, p.workingDir);
- return;
- }
- const QString title = QString::fromLatin1("cvs diff %1").arg(id);
- IEditor *editor = showOutputInEditor(title, output, DiffOutput, source, codec);
- VcsBaseEditorWidget::tagEditor(editor, tag);
- setDiffBaseDirectory(editor, p.workingDir);
- CvsEditor *diffEditorWidget = qobject_cast<CvsEditor*>(editor->widget());
- QTC_ASSERT(diffEditorWidget, return);
-
- // Wire up the parameter widget to trigger a re-run on
- // parameter change and 'revert' from inside the diff editor.
- CvsDiffParameterWidget *pw = new CvsDiffParameterWidget(p);
- connect(pw, SIGNAL(reRunDiff(Cvs::Internal::CvsDiffParameters)),
- this, SLOT(cvsDiff(Cvs::Internal::CvsDiffParameters)));
- connect(diffEditorWidget, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)),
- pw, SLOT(triggerReRun()));
- diffEditorWidget->setConfigurationWidget(pw);
-}
-
CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
{
IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID);
@@ -678,7 +574,7 @@ void CvsPlugin::revertAll()
QStringList args;
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel();
const CvsResponse revertResponse =
- runCvs(state.topLevel(), args, m_settings.timeOutMS(),
+ runCvs(state.topLevel(), args, m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.result == CvsResponse::Ok)
cvsVersionControl()->emitRepositoryChanged(state.topLevel());
@@ -693,7 +589,7 @@ void CvsPlugin::revertCurrentFile()
QStringList args;
args << QLatin1String("diff") << state.relativeCurrentFile();
const CvsResponse diffResponse =
- runCvs(state.currentFileTopLevel(), args, m_settings.timeOutMS(), 0);
+ runCvs(state.currentFileTopLevel(), args, m_settings.timeOutMs(), 0);
switch (diffResponse.result) {
case CvsResponse::Ok:
return; // Not modified, diff exit code 0
@@ -715,7 +611,7 @@ void CvsPlugin::revertCurrentFile()
args.clear();
args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile();
const CvsResponse revertResponse =
- runCvs(state.currentFileTopLevel(), args, m_settings.timeOutMS(),
+ runCvs(state.currentFileTopLevel(), args, m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.result == CvsResponse::Ok)
cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
@@ -726,7 +622,7 @@ void CvsPlugin::diffProject()
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
const QString relativeProject = state.relativeCurrentProject();
- cvsDiff(state.currentProjectTopLevel(),
+ m_client->diff(state.currentProjectTopLevel(),
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject));
}
@@ -734,7 +630,7 @@ void CvsPlugin::diffCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- cvsDiff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
+ m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void CvsPlugin::startCommitCurrentFile()
@@ -767,7 +663,7 @@ void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
// where we are, so, have stdout/stderr channels merged.
QStringList args = QStringList(QLatin1String("status"));
const CvsResponse response =
- runCvs(workingDir, args, m_settings.timeOutMS(), MergeOutputChannels);
+ runCvs(workingDir, args, m_settings.timeOutMs(), MergeOutputChannels);
if (response.result != CvsResponse::Ok)
return;
// Get list of added/modified/deleted files and purge out undesired ones
@@ -815,7 +711,7 @@ bool CvsPlugin::commit(const QString &messageFile,
args << QLatin1String("-F") << messageFile;
args.append(fileList);
const CvsResponse response =
- runCvs(m_commitRepository, args, m_settings.longTimeOutMS(),
+ runCvs(m_commitRepository, args, 10 * m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok ;
}
@@ -853,7 +749,7 @@ void CvsPlugin::filelog(const QString &workingDir,
args << QLatin1String("log");
args.append(file);
const CvsResponse response =
- runCvs(workingDir, args, m_settings.timeOutMS(),
+ runCvs(workingDir, args, m_settings.timeOutMs(),
SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok)
return;
@@ -887,7 +783,7 @@ bool CvsPlugin::update(const QString &topLevel, const QString &file)
if (!file.isEmpty())
args.append(file);
const CvsResponse response =
- runCvs(topLevel, args, m_settings.longTimeOutMS(),
+ runCvs(topLevel, args, 10 * m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
const bool ok = response.result == CvsResponse::Ok;
if (ok)
@@ -934,7 +830,7 @@ bool CvsPlugin::edit(const QString &topLevel, const QStringList &files)
QStringList args(QLatin1String("edit"));
args.append(files);
const CvsResponse response =
- runCvs(topLevel, args, m_settings.timeOutMS(),
+ runCvs(topLevel, args, m_settings.timeOutMs(),
ShowStdOutInLogWindow|SshPasswordPrompt);
return response.result == CvsResponse::Ok;
}
@@ -946,7 +842,7 @@ bool CvsPlugin::diffCheckModified(const QString &topLevel, const QStringList &fi
QStringList args(QLatin1String("-q"));
args << QLatin1String("diff");
args.append(files);
- const CvsResponse response = runCvs(topLevel, args, m_settings.timeOutMS(), 0);
+ const CvsResponse response = runCvs(topLevel, args, m_settings.timeOutMs(), 0);
if (response.result == CvsResponse::OtherError)
return false;
*modified = response.result == CvsResponse::NonNullExitCode;
@@ -974,7 +870,7 @@ bool CvsPlugin::unedit(const QString &topLevel, const QStringList &files)
args.append(QLatin1String("-y"));
args.append(files);
const CvsResponse response =
- runCvs(topLevel, args, m_settings.timeOutMS(),
+ runCvs(topLevel, args, m_settings.timeOutMs(),
ShowStdOutInLogWindow|SshPasswordPrompt);
return response.result == CvsResponse::Ok;
}
@@ -993,7 +889,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
args << QLatin1String("-r") << revision;
args << file;
const CvsResponse response =
- runCvs(workingDir, args, m_settings.timeOutMS(),
+ runCvs(workingDir, args, m_settings.timeOutMs(),
SshPasswordPrompt, codec);
if (response.result != CvsResponse::Ok)
return;
@@ -1022,7 +918,7 @@ bool CvsPlugin::status(const QString &topLevel, const QString &file, const QStri
if (!file.isEmpty())
args.append(file);
const CvsResponse response =
- runCvs(topLevel, args, m_settings.timeOutMS(), 0);
+ runCvs(topLevel, args, m_settings.timeOutMs(), 0);
const bool ok = response.result == CvsResponse::Ok;
if (ok)
showOutputInEditor(title, response.stdOut, OtherContent, topLevel, 0);
@@ -1047,7 +943,7 @@ void CvsPlugin::diffRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- cvsDiff(state.topLevel(), QStringList());
+ m_client->diff(state.topLevel(), QStringList());
}
void CvsPlugin::statusRepository()
@@ -1105,7 +1001,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
QStringList args;
args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file;
const CvsResponse logResponse =
- runCvs(toplevel, args, m_settings.timeOutMS(), SshPasswordPrompt);
+ runCvs(toplevel, args, m_settings.timeOutMs(), SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message;
return false;
@@ -1115,7 +1011,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
*errorMessage = msgLogParsingFailed();
return false;
}
- if (m_settings.describeByCommitId) {
+ if (m_settings.boolValue(CvsSettings::describeByCommitIdKey)) {
// Run a log command over the repo, filtering by the commit date
// and commit id, collecting all files touched by the commit.
const QString commitId = fileLog.front().revisions.front().commitId;
@@ -1127,7 +1023,7 @@ bool CvsPlugin::describe(const QString &toplevel, const QString &file, const
args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS);
const CvsResponse repoLogResponse =
- runCvs(toplevel, args, m_settings.longTimeOutMS(), SshPasswordPrompt);
+ runCvs(toplevel, args, 10 * m_settings.timeOutMs(), SshPasswordPrompt);
if (repoLogResponse.result != CvsResponse::Ok) {
*errorMessage = repoLogResponse.message;
return false;
@@ -1164,7 +1060,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
QStringList args(QLatin1String("log"));
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
const CvsResponse logResponse =
- runCvs(repositoryPath, args, m_settings.timeOutMS(), SshPasswordPrompt);
+ runCvs(repositoryPath, args, m_settings.timeOutMs(), SshPasswordPrompt);
if (logResponse.result != CvsResponse::Ok) {
*errorMessage = logResponse.message;
return false;
@@ -1177,11 +1073,11 @@ bool CvsPlugin::describe(const QString &repositoryPath,
if (!isFirstRevision(revision)) {
const QString previousRev = previousRevision(revision);
QStringList args(QLatin1String("diff"));
- args << m_settings.cvsDiffOptions << QLatin1String("-r") << previousRev
+ args << m_settings.stringValue(CvsSettings::diffOptionsKey) << QLatin1String("-r") << previousRev
<< QLatin1String("-r") << it->revisions.front().revision
<< it->file;
const CvsResponse diffResponse =
- runCvs(repositoryPath, args, m_settings.timeOutMS(), 0, codec);
+ runCvs(repositoryPath, args, m_settings.timeOutMs(), 0, codec);
switch (diffResponse.result) {
case CvsResponse::Ok:
case CvsResponse::NonNullExitCode: // Diff exit code != 0
@@ -1228,7 +1124,7 @@ CvsResponse CvsPlugin::runCvs(const QString &workingDirectory,
unsigned flags,
QTextCodec *outputCodec) const
{
- const QString executable = m_settings.cvsBinaryPath;
+ const QString executable = m_settings.binaryPath();
CvsResponse response;
if (executable.isEmpty()) {
response.result = CvsResponse::OtherError;
@@ -1300,7 +1196,7 @@ void CvsPlugin::setSettings(const CvsSettings &s)
{
if (s != m_settings) {
m_settings = s;
- m_settings.toSettings(ICore::settings());
+ m_settings.writeSettings(ICore::settings());
cvsVersionControl()->emitConfigurationChanged();
}
}
@@ -1316,7 +1212,7 @@ bool CvsPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
QStringList args;
args << QLatin1String("add") << rawFileName;
const CvsResponse response =
- runCvs(workingDir, args, m_settings.timeOutMS(),
+ runCvs(workingDir, args, m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok;
}
@@ -1326,7 +1222,7 @@ bool CvsPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
QStringList args;
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
const CvsResponse response =
- runCvs(workingDir, args, m_settings.timeOutMS(),
+ runCvs(workingDir, args, m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow);
return response.result == CvsResponse::Ok;
}
@@ -1372,7 +1268,7 @@ bool CvsPlugin::managesFile(const QString &workingDirectory, const QString &file
QStringList args;
args << QLatin1String("status") << fileName;
const CvsResponse response =
- runCvs(workingDirectory, args, m_settings.timeOutMS(), SshPasswordPrompt);
+ runCvs(workingDirectory, args, m_settings.timeOutMs(), SshPasswordPrompt);
if (response.result != CvsResponse::Ok)
return false;
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
@@ -1442,5 +1338,3 @@ void CvsPlugin::testLogResolving()
} // namespace Cvs
Q_EXPORT_PLUGIN(Cvs::Internal::CvsPlugin)
-
-#include "cvsplugin.moc"
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index 6d8f057b83..6d8eff2263 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -56,6 +56,7 @@ namespace Internal {
struct CvsDiffParameters;
class CvsSubmitEditor;
class CvsControl;
+class CvsClient;
struct CvsResponse
{
@@ -79,8 +80,6 @@ public:
bool initialize(const QStringList &arguments, QString *errorMessage);
- void cvsDiff(const QString &workingDir, const QStringList &files);
-
CvsSubmitEditor *openCVSSubmitEditor(const QString &fileName);
CvsSettings settings() const;
@@ -124,7 +123,6 @@ private slots:
void editCurrentFile();
void uneditCurrentFile();
void uneditCurrentRepository();
- void cvsDiff(const Cvs::Internal::CvsDiffParameters &p);
#ifdef WITH_TESTS
void testDiffFileResolving_data();
void testDiffFileResolving();
@@ -168,6 +166,8 @@ private:
inline CvsControl *cvsVersionControl() const;
CvsSettings m_settings;
+ CvsClient *m_client;
+
QString m_commitMessageFileName;
QString m_commitRepository;
diff --git a/src/plugins/cvs/cvssettings.cpp b/src/plugins/cvs/cvssettings.cpp
index 113057fc8d..e3b2828e2e 100644
--- a/src/plugins/cvs/cvssettings.cpp
+++ b/src/plugins/cvs/cvssettings.cpp
@@ -35,71 +35,34 @@
#include <QSettings>
#include <QTextStream>
-static const char groupC[] = "CVS";
-static const char commandKeyC[] = "Command";
-static const char rootC[] = "Root";
-static const char promptToSubmitKeyC[] = "PromptForSubmit";
-static const char diffOptionsKeyC[] = "DiffOptions";
-static const char describeByCommitIdKeyC[] = "DescribeByCommitId";
-static const char defaultDiffOptions[] = "-du";
-static const char timeOutKeyC[] = "TimeOut";
-
-enum { defaultTimeOutS = 30 };
-
-static QString defaultCommand()
-{
- return QLatin1String("cvs" QTC_HOST_EXE_SUFFIX);
-}
-
namespace Cvs {
namespace Internal {
-CvsSettings::CvsSettings() :
- cvsCommand(defaultCommand()),
- cvsDiffOptions(QLatin1String(defaultDiffOptions)),
- timeOutS(defaultTimeOutS),
- promptToSubmit(true),
- describeByCommitId(true)
-{
-}
+const QLatin1String CvsSettings::cvsRootKey("Root");
+const QLatin1String CvsSettings::diffOptionsKey("DiffOptions");
+const QLatin1String CvsSettings::describeByCommitIdKey("DescribeByCommitId");
+const QLatin1String CvsSettings::diffIgnoreWhiteSpaceKey("DiffIgnoreWhiteSpace");
+const QLatin1String CvsSettings::diffIgnoreBlankLinesKey("DiffIgnoreBlankLines");
-void CvsSettings::fromSettings(QSettings *settings)
+CvsSettings::CvsSettings()
{
- settings->beginGroup(QLatin1String(groupC));
- cvsCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
- cvsBinaryPath = Utils::Environment::systemEnvironment().searchInPath(cvsCommand);
- promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
- cvsRoot = settings->value(QLatin1String(rootC), QString()).toString();
- cvsDiffOptions = settings->value(QLatin1String(diffOptionsKeyC), QLatin1String(defaultDiffOptions)).toString();
- describeByCommitId = settings->value(QLatin1String(describeByCommitIdKeyC), true).toBool();
- timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
- settings->endGroup();
+ setSettingsGroup(QLatin1String("CVS"));
+ declareKey(binaryPathKey, QLatin1String("cvs" QTC_HOST_EXE_SUFFIX));
+ declareKey(cvsRootKey, QLatin1String(""));
+ declareKey(diffOptionsKey, QLatin1String("-du"));
+ declareKey(describeByCommitIdKey, true);
+ declareKey(diffIgnoreWhiteSpaceKey, false);
+ declareKey(diffIgnoreBlankLinesKey, false);
}
-void CvsSettings::toSettings(QSettings *settings) const
+int CvsSettings::timeOutMs() const
{
- settings->beginGroup(QLatin1String(groupC));
- settings->setValue(QLatin1String(commandKeyC), cvsCommand);
- settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
- settings->setValue(QLatin1String(rootC), cvsRoot);
- settings->setValue(QLatin1String(diffOptionsKeyC), cvsDiffOptions);
- settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
- settings->setValue(QLatin1String(describeByCommitIdKeyC), describeByCommitId);
- settings->endGroup();
-}
-
-bool CvsSettings::equals(const CvsSettings &s) const
-{
- return promptToSubmit == s.promptToSubmit
- && describeByCommitId == s.describeByCommitId
- && cvsCommand == s.cvsCommand
- && cvsRoot == s.cvsRoot
- && timeOutS == s.timeOutS
- && cvsDiffOptions == s.cvsDiffOptions;
+ return 1000 * intValue(timeoutKey);
}
QStringList CvsSettings::addOptions(const QStringList &args) const
{
+ const QString cvsRoot = stringValue(cvsRootKey);
if (cvsRoot.isEmpty())
return args;
@@ -110,5 +73,19 @@ QStringList CvsSettings::addOptions(const QStringList &args) const
return rc;
}
+void CvsSettings::readLegacySettings(const QSettings *settings)
+{
+ const QString keyRoot = settingsGroup() + QLatin1Char('/');
+ const QString oldBinaryPathKey = keyRoot + QLatin1String("Command");
+ const QString oldPromptOnSubmitKey = keyRoot + QLatin1String("PromptForSubmit");
+ const QString oldTimeoutKey = keyRoot + QLatin1String("TimeOut");
+ if (settings->contains(oldBinaryPathKey))
+ this->setValue(binaryPathKey, settings->value(oldBinaryPathKey).toString());
+ if (settings->contains(oldPromptOnSubmitKey))
+ this->setValue(promptOnSubmitKey, settings->value(oldPromptOnSubmitKey).toBool());
+ if (settings->contains(oldTimeoutKey))
+ this->setValue(timeoutKey, settings->value(oldTimeoutKey).toInt());
+}
+
} // namespace Internal
} // namespace Cvs
diff --git a/src/plugins/cvs/cvssettings.h b/src/plugins/cvs/cvssettings.h
index 4eb01fafca..25ff1cfb6a 100644
--- a/src/plugins/cvs/cvssettings.h
+++ b/src/plugins/cvs/cvssettings.h
@@ -30,44 +30,30 @@
#ifndef CVSSETTINGS_H
#define CVSSETTINGS_H
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-class QSettings;
-QT_END_NAMESPACE
+#include <vcsbase/vcsbaseclientsettings.h>
namespace Cvs {
namespace Internal {
-struct CvsSettings
+class CvsSettings : public VcsBase::VcsBaseClientSettings
{
- CvsSettings();
+public:
+ static const QLatin1String cvsRootKey;
+ static const QLatin1String diffOptionsKey;
+ static const QLatin1String describeByCommitIdKey;
+ static const QLatin1String diffIgnoreWhiteSpaceKey;
+ static const QLatin1String diffIgnoreBlankLinesKey;
- void fromSettings(QSettings *);
- void toSettings(QSettings *) const;
+ CvsSettings();
- int timeOutMS() const { return timeOutS * 1000; }
- int longTimeOutMS() const { return timeOutS * 10000; }
+ int timeOutMs() const;
- // Add common options to the command line
QStringList addOptions(const QStringList &args) const;
- bool equals(const CvsSettings &s) const;
-
- QString cvsCommand;
- QString cvsBinaryPath;
- QString cvsRoot;
- QString cvsDiffOptions;
- int timeOutS;
- bool promptToSubmit;
- bool describeByCommitId;
+protected:
+ void readLegacySettings(const QSettings *settings);
};
-inline bool operator==(const CvsSettings &p1, const CvsSettings &p2)
- { return p1.equals(p2); }
-inline bool operator!=(const CvsSettings &p1, const CvsSettings &p2)
- { return !p1.equals(p2); }
-
} // namespace Internal
} // namespace Cvs
diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp
index e5f051579e..baea514b4d 100644
--- a/src/plugins/cvs/settingspage.cpp
+++ b/src/plugins/cvs/settingspage.cpp
@@ -48,48 +48,30 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
{
m_ui.setupUi(this);
m_ui.commandPathChooser->setExpectedKind(PathChooser::ExistingCommand);
+ m_ui.commandPathChooser->setHistoryCompleter(QLatin1String("Cvs.Command.History"));
m_ui.commandPathChooser->setPromptDialogTitle(tr("CVS Command"));
}
CvsSettings SettingsPageWidget::settings() const
{
CvsSettings rc;
- rc.cvsCommand = m_ui.commandPathChooser->rawPath();
- rc.cvsBinaryPath = m_ui.commandPathChooser->path();
- rc.cvsRoot = m_ui.rootLineEdit->text();
- rc.cvsDiffOptions = m_ui.diffOptionsLineEdit->text();
- rc.timeOutS = m_ui.timeOutSpinBox->value();
- rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
- rc.describeByCommitId = m_ui.describeByCommitIdCheckBox->isChecked();
+ rc.setValue(CvsSettings::binaryPathKey, m_ui.commandPathChooser->rawPath());
+ rc.setValue(CvsSettings::cvsRootKey, m_ui.rootLineEdit->text());
+ rc.setValue(CvsSettings::diffOptionsKey, m_ui.diffOptionsLineEdit->text());
+ rc.setValue(CvsSettings::timeoutKey, m_ui.timeOutSpinBox->value());
+ rc.setValue(CvsSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
+ rc.setValue(CvsSettings::describeByCommitIdKey, m_ui.describeByCommitIdCheckBox->isChecked());
return rc;
}
void SettingsPageWidget::setSettings(const CvsSettings &s)
{
- m_ui.commandPathChooser->setPath(s.cvsCommand);
- m_ui.rootLineEdit->setText(s.cvsRoot);
- m_ui.diffOptionsLineEdit->setText(s.cvsDiffOptions);
- m_ui.timeOutSpinBox->setValue(s.timeOutS);
- m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
- m_ui.describeByCommitIdCheckBox->setChecked(s.describeByCommitId);
-}
-
-QString SettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.configGroupBox->title()
- << sep << m_ui.commandLabel->text()
- << sep << m_ui.rootLabel->text()
- << sep << m_ui.miscGroupBox->title()
- << sep << m_ui.timeOutLabel->text()
- << sep << m_ui.diffOptionsLabel->text()
- << sep << m_ui.promptToSubmitCheckBox->text()
- << sep << m_ui.describeByCommitIdCheckBox->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
+ m_ui.commandPathChooser->setPath(s.binaryPath());
+ m_ui.rootLineEdit->setText(s.stringValue(CvsSettings::cvsRootKey));
+ m_ui.diffOptionsLineEdit->setText(s.stringValue(CvsSettings::diffOptionsKey));
+ m_ui.timeOutSpinBox->setValue(s.intValue(CvsSettings::timeoutKey));
+ m_ui.promptToSubmitCheckBox->setChecked(s.boolValue(CvsSettings::promptOnSubmitKey));
+ m_ui.describeByCommitIdCheckBox->setChecked(s.boolValue(CvsSettings::describeByCommitIdKey));
}
SettingsPage::SettingsPage()
@@ -98,12 +80,12 @@ SettingsPage::SettingsPage()
setDisplayName(tr("CVS"));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
- m_widget->setSettings(CvsPlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsPageWidget;
+ m_widget->setSettings(CvsPlugin::instance()->settings());
+ }
return m_widget;
}
@@ -112,7 +94,7 @@ void SettingsPage::apply()
CvsPlugin::instance()->setSettings(m_widget->settings());
}
-bool SettingsPage::matches(const QString &s) const
+void SettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/cvs/settingspage.h b/src/plugins/cvs/settingspage.h
index ecd9c1d52d..2e6832f889 100644
--- a/src/plugins/cvs/settingspage.h
+++ b/src/plugins/cvs/settingspage.h
@@ -45,7 +45,7 @@ QT_END_NAMESPACE
namespace Cvs {
namespace Internal {
-struct CvsSettings;
+class CvsSettings;
class SettingsPageWidget : public QWidget
{
@@ -57,8 +57,6 @@ public:
CvsSettings settings() const;
void setSettings(const CvsSettings &);
- QString searchKeywords() const;
-
private:
Ui::SettingsPage m_ui;
};
@@ -71,14 +69,12 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() {}
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
- SettingsPageWidget *m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace Cvs
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index 91d11c4ceb..4d148706f3 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -170,6 +170,7 @@ BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
m_labelType->setBuddy(m_comboBoxType);
m_pathChooserFileName = new Utils::PathChooser(groupBoxBasic);
+ m_pathChooserFileName->setHistoryCompleter(QLatin1String("Debugger.Breakpoint.File.History"));
m_pathChooserFileName->setExpectedKind(Utils::PathChooser::File);
m_labelFileName = new QLabel(tr("&File name:"), groupBoxBasic);
m_labelFileName->setBuddy(m_pathChooserFileName);
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index a596dea1c0..ec8e6b764a 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -339,7 +339,6 @@ void addCdbOptionPages(QList<Core::IOptionsPage *> *opts)
CdbEngine::CdbEngine(const DebuggerStartParameters &sp) :
DebuggerEngine(sp),
- m_creatorExtPrefix("<qtcreatorcdbext>|"),
m_tokenPrefix("<token>"),
m_effectiveStartMode(NoStartMode),
m_accessible(false),
@@ -2554,11 +2553,12 @@ void CdbEngine::parseOutputLine(QByteArray line)
while (isCdbPrompt(line))
line.remove(0, CdbPromptLength);
// An extension notification (potentially consisting of several chunks)
- if (line.startsWith(m_creatorExtPrefix)) {
+ static const QByteArray creatorExtPrefix = "<qtcreatorcdbext>|";
+ if (line.startsWith(creatorExtPrefix)) {
// "<qtcreatorcdbext>|type_char|token|remainingChunks|serviceName|message"
- const char type = line.at(m_creatorExtPrefix.size());
+ const char type = line.at(creatorExtPrefix.size());
// integer token
- const int tokenPos = m_creatorExtPrefix.size() + 2;
+ const int tokenPos = creatorExtPrefix.size() + 2;
const int tokenEndPos = line.indexOf('|', tokenPos);
QTC_ASSERT(tokenEndPos != -1, return);
const int token = line.mid(tokenPos, tokenEndPos - tokenPos).toInt();
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index f9b4962f2c..d86c6c50fb 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -251,7 +251,6 @@ private:
unsigned parseStackTrace(const GdbMi &data, bool sourceStepInto);
void mergeStartParametersSourcePathMap();
- const QByteArray m_creatorExtPrefix;
const QByteArray m_tokenPrefix;
QProcess m_process;
diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp
index e3b6c4cd33..5f9e419737 100644
--- a/src/plugins/debugger/cdb/cdboptionspage.cpp
+++ b/src/plugins/debugger/cdb/cdboptionspage.cpp
@@ -198,22 +198,6 @@ QStringList CdbOptionsPageWidget::breakEvents() const
return m_breakEventWidget->breakEvents();
}
-static QString stripColon(QString s)
-{
- const int lastColon = s.lastIndexOf(QLatin1Char(':'));
- if (lastColon != -1)
- s.truncate(lastColon);
- return s;
-}
-
-QString CdbOptionsPageWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc) << stripColon(m_ui.additionalArgumentsLabel->text());
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
// ---------- CdbOptionsPage
CdbOptionsPage::CdbOptionsPage()
@@ -230,11 +214,10 @@ CdbOptionsPage::~CdbOptionsPage()
{
}
-QWidget *CdbOptionsPage::createPage(QWidget *parent)
+QWidget *CdbOptionsPage::widget()
{
- m_widget = new CdbOptionsPageWidget(parent);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget)
+ m_widget = new CdbOptionsPageWidget;
return m_widget;
}
@@ -248,13 +231,10 @@ void CdbOptionsPage::apply()
void CdbOptionsPage::finish()
{
- if (m_widget)
+ if (m_widget) {
m_widget->group.finish();
-}
-
-bool CdbOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
+ }
}
// ---------- CdbPathsPage
@@ -266,8 +246,6 @@ public:
Utils::SavedActionSet group;
// CdbPaths m_paths;
- QString m_searchKeywords;
-
CdbSymbolPathListEditor *m_symbolPathListEditor;
Utils::PathListEditor *m_sourcePathListEditor;
@@ -280,7 +258,6 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
QVBoxLayout *layout = new QVBoxLayout(this);
QString title = tr("Symbol Paths");
- m_searchKeywords.append(title);
QGroupBox* gbSymbolPath = new QGroupBox(this);
gbSymbolPath->setTitle(title);
QVBoxLayout *gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath);
@@ -288,7 +265,6 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) :
gbSymbolPathLayout->addWidget(m_symbolPathListEditor);
title = tr("Source Paths");
- m_searchKeywords.append(title);
QGroupBox* gbSourcePath = new QGroupBox(this);
gbSourcePath->setTitle(title);
QVBoxLayout *gbSourcePathLayout = new QVBoxLayout(gbSourcePath);
@@ -318,12 +294,10 @@ CdbPathsPage::~CdbPathsPage()
{
}
-QWidget *CdbPathsPage::createPage(QWidget *parent)
+QWidget *CdbPathsPage::widget()
{
if (!m_widget)
- m_widget = new CdbPathsPageWidget(parent);
- else
- m_widget->setParent(parent);
+ m_widget = new CdbPathsPageWidget;
return m_widget;
}
@@ -335,14 +309,10 @@ void CdbPathsPage::apply()
void CdbPathsPage::finish()
{
- if (m_widget)
+ if (m_widget) {
m_widget->group.finish();
-}
-
-bool CdbPathsPage::matches(const QString &searchKeyWord) const
-{
- return m_widget &&
- m_widget->m_searchKeywords.contains(searchKeyWord, Qt::CaseInsensitive);
+ delete m_widget;
+ }
}
} // namespace Internal
diff --git a/src/plugins/debugger/cdb/cdboptionspage.h b/src/plugins/debugger/cdb/cdboptionspage.h
index a84a703c73..ac1e7155ee 100644
--- a/src/plugins/debugger/cdb/cdboptionspage.h
+++ b/src/plugins/debugger/cdb/cdboptionspage.h
@@ -78,9 +78,8 @@ class CdbOptionsPageWidget : public QWidget
Q_OBJECT
public:
- explicit CdbOptionsPageWidget(QWidget *parent);
+ explicit CdbOptionsPageWidget(QWidget *parent = 0);
QStringList breakEvents() const;
- QString searchKeywords() const;
Utils::SavedActionSet group;
@@ -103,17 +102,15 @@ public:
virtual ~CdbOptionsPage();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
static const char *crtDbgReport;
private:
Utils::SavedActionSet group;
QPointer<CdbOptionsPageWidget> m_widget;
- QString m_searchKeywords;
};
class CdbPathsPage : public Core::IOptionsPage
@@ -127,10 +124,9 @@ public:
static CdbPathsPage *instance();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &searchKeyWord) const;
private:
QPointer<CdbPathsPageWidget> m_widget;
diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp
index b75581e001..ebf526c0f4 100644
--- a/src/plugins/debugger/commonoptionspage.cpp
+++ b/src/plugins/debugger/commonoptionspage.cpp
@@ -202,29 +202,6 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
}
}
-QString CommonOptionsPageWidget::searchKeyWords() const
-{
- QString rc;
- const QLatin1Char sep(' ');
- QTextStream stream(&rc);
- stream << sep << checkBoxUseAlternatingRowColors->text()
- << sep << checkBoxFontSizeFollowsEditor->text()
- << sep << checkBoxUseToolTipsInMainEditor->text()
- << sep << checkBoxListSourceFiles->text()
- << sep << checkBoxBreakpointsFullPath->text()
- << sep << checkBoxCloseBuffersOnExit->text()
- << sep << checkBoxSwitchModeOnExit->text()
- << sep << labelMaximalStackDepth->text()
- << sep << checkBoxBringToForegroundOnInterrrupt->text()
- << sep << checkBoxShowQmlObjectTree->text()
- << sep << checkBoxWarnOnReleaseBuilds->text();
- if (Utils::HostOsInfo::isWindowsHost())
- stream << sep << checkBoxRegisterForPostMortem->text();
-
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
GlobalDebuggerOptions CommonOptionsPageWidget::globalOptions() const
{
GlobalDebuggerOptions o;
@@ -274,22 +251,19 @@ void CommonOptionsPage::finish()
{
if (!m_group.isNull())
m_group->finish();
+ delete m_widget;
}
-QWidget *CommonOptionsPage::createPage(QWidget *parent)
+QWidget *CommonOptionsPage::widget()
{
if (m_group.isNull())
m_group = QSharedPointer<Utils::SavedActionSet>(new Utils::SavedActionSet);
- m_widget = new CommonOptionsPageWidget(m_group, parent);
- m_widget->setGlobalOptions(*m_options);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeyWords();
- return m_widget;
-}
-bool CommonOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ if (!m_widget) {
+ m_widget = new CommonOptionsPageWidget(m_group);
+ m_widget->setGlobalOptions(*m_options);
+ }
+ return m_widget;
}
QString CommonOptionsPage::msgSetBreakpointAtFunction(const char *function)
@@ -301,7 +275,7 @@ QString CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(const char *functio
const QString &hint)
{
QString result = QLatin1String("<html><head/><body>");
- result += tr("Always add a breakpoint on the <i>%1()</i> function.").arg(QLatin1String(function));
+ result += tr("Always adds a breakpoint on the <i>%1()</i> function.").arg(QLatin1String(function));
if (!hint.isEmpty()) {
result += QLatin1String("<br>");
result += hint;
@@ -334,57 +308,43 @@ void LocalsAndExpressionsOptionsPage::apply()
void LocalsAndExpressionsOptionsPage::finish()
{
m_group.finish();
+ delete m_widget;
}
-QWidget *LocalsAndExpressionsOptionsPage::createPage(QWidget *parent)
+QWidget *LocalsAndExpressionsOptionsPage::widget()
{
- QWidget *w = new QWidget(parent);
- m_ui.setupUi(w);
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
- m_group.clear();
- DebuggerCore *dc = debuggerCore();
+ m_group.clear();
+ DebuggerCore *dc = debuggerCore();
- m_group.insert(dc->action(UseDebuggingHelpers),
- m_ui.debuggingHelperGroupBox);
+ m_group.insert(dc->action(UseDebuggingHelpers),
+ m_ui.debuggingHelperGroupBox);
- m_group.insert(dc->action(UseCodeModel),
- m_ui.checkBoxUseCodeModel);
- m_ui.checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip());
+ m_group.insert(dc->action(UseCodeModel),
+ m_ui.checkBoxUseCodeModel);
+ m_ui.checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip());
- m_group.insert(dc->action(ShowThreadNames),
- m_ui.checkBoxShowThreadNames);
- m_group.insert(dc->action(ShowStdNamespace), m_ui.checkBoxShowStdNamespace);
- m_group.insert(dc->action(ShowQtNamespace), m_ui.checkBoxShowQtNamespace);
+ m_group.insert(dc->action(ShowThreadNames),
+ m_ui.checkBoxShowThreadNames);
+ m_group.insert(dc->action(ShowStdNamespace), m_ui.checkBoxShowStdNamespace);
+ m_group.insert(dc->action(ShowQtNamespace), m_ui.checkBoxShowQtNamespace);
#ifndef QT_DEBUG
#if 0
- cmd = am->registerAction(m_dumpLogAction,
- DUMP_LOG, globalcontext);
- //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
- cmd->setDefaultKeySequence(QKeySequence(QCoreApplication::translate("Debugger", "Ctrl+Shift+F11")));
- mdebug->addAction(cmd);
+ cmd = am->registerAction(m_dumpLogAction,
+ DUMP_LOG, globalcontext);
+ //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
+ cmd->setDefaultKeySequence(QKeySequence(QCoreApplication::translate("Debugger", "Ctrl+Shift+F11")));
+ mdebug->addAction(cmd);
#endif
#endif
-
- if (m_searchKeywords.isEmpty()) {
- QTextStream(&m_searchKeywords)
- << ' ' << m_ui.debuggingHelperGroupBox->title()
- << ' ' << m_ui.checkBoxUseCodeModel->text()
- << ' ' << m_ui.checkBoxShowThreadNames->text()
- << ' ' << m_ui.checkBoxShowStdNamespace->text()
- << ' ' << m_ui.checkBoxShowQtNamespace->text();
-
- m_searchKeywords.remove(QLatin1Char('&'));
}
- return w;
-}
-
-bool LocalsAndExpressionsOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ return m_widget;
}
-
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h
index c09d1ccde4..bb5464abf3 100644
--- a/src/plugins/debugger/commonoptionspage.h
+++ b/src/plugins/debugger/commonoptionspage.h
@@ -60,7 +60,6 @@ class CommonOptionsPageWidget : public QWidget
public:
explicit CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent = 0);
- QString searchKeyWords() const;
GlobalDebuggerOptions globalOptions() const;
void setGlobalOptions(const GlobalDebuggerOptions &go);
@@ -94,10 +93,9 @@ public:
~CommonOptionsPage();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
static QString msgSetBreakpointAtFunction(const char *function);
static QString msgSetBreakpointAtFunctionToolTip(const char *function,
@@ -106,7 +104,6 @@ public:
private:
const QSharedPointer<GlobalDebuggerOptions> m_options;
QSharedPointer<Utils::SavedActionSet> m_group;
- QString m_searchKeywords;
QPointer<CommonOptionsPageWidget> m_widget;
};
@@ -123,15 +120,14 @@ public:
LocalsAndExpressionsOptionsPage();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
private:
+ QPointer<QWidget> m_widget;
Ui::DebuggingHelperOptionPage m_ui;
Utils::SavedActionSet m_group;
- QString m_searchKeywords;
};
} // namespace Internal
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index 7798cf0bfe..c9f794d55d 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -151,7 +151,6 @@ include(cdb/cdb.pri)
include(gdb/gdb.pri)
include(pdb/pdb.pri)
include(lldb/lldb.pri)
-include(lldblib/lldbhost.pri)
include(qml/qml.pri)
include(namedemangler/namedemangler.pri)
diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs
index 709dc128c3..44a36b7588 100644
--- a/src/plugins/debugger/debugger.qbs
+++ b/src/plugins/debugger/debugger.qbs
@@ -132,16 +132,6 @@ QtcPlugin {
}
Group {
- name: "lldblib"
- id: lldblib
- prefix: "lldblib/"
- files: [
- "ipcenginehost.cpp", "ipcenginehost.h",
- "lldbenginehost.cpp", "lldbenginehost.h"
- ]
- }
-
- Group {
name: "pdb"
prefix: "pdb/"
files: ["pdbengine.cpp", "pdbengine.h"]
@@ -247,16 +237,6 @@ QtcPlugin {
]
}
- Group {
- name: "LLDBOptions"
- condition: qbs.targetOS.contains("osx")
- files: [
- "lldblib/lldboptionspage.cpp",
- "lldblib/lldboptionspage.h",
- "lldblib/lldboptionspagewidget.ui",
- ]
- }
-
Properties {
condition: qbs.targetOS.contains("windows")
cpp.dynamicLibraries: [
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 19bc0fe994..4e5a6e4c4f 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -190,14 +190,12 @@ enum DebuggerEngineType
PdbEngineType = 0x008,
QmlEngineType = 0x020,
QmlCppEngineType = 0x040,
- LldbLibEngineType = 0x080,
LldbEngineType = 0x100,
AllEngineTypes = GdbEngineType
| CdbEngineType
| PdbEngineType
| QmlEngineType
| QmlCppEngineType
- | LldbLibEngineType
| LldbEngineType
};
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index b1db49211d..f52b345c24 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -279,6 +279,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->debuginfoPathChooser->setToolTip(tr(
"Base path for external debug information and debug sources. "
"If empty, $SYSROOT/usr/lib/debug will be chosen."));
+ d->debuginfoPathChooser->setHistoryCompleter(QLatin1String("Debugger.DebugLocation.History"));
QFrame *line = new QFrame(this);
line->setFrameShape(QFrame::HLine);
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index ab3828f477..31be135731 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1045,7 +1045,7 @@ void DebuggerEnginePrivate::doFinishDebugger()
void DebuggerEnginePrivate::setRemoteSetupState(RemoteSetupState state)
{
- bool allowedTransition = true;
+ bool allowedTransition = false;
if (m_remoteSetupState == RemoteSetupNone) {
if (state == RemoteSetupRequested)
allowedTransition = true;
diff --git a/src/plugins/debugger/debuggeritem.cpp b/src/plugins/debugger/debuggeritem.cpp
index c620e250bf..b3ced58f0a 100644
--- a/src/plugins/debugger/debuggeritem.cpp
+++ b/src/plugins/debugger/debuggeritem.cpp
@@ -47,6 +47,7 @@ static const char DEBUGGER_INFORMATION_DISPLAYNAME[] = "DisplayName";
static const char DEBUGGER_INFORMATION_ID[] = "Id";
static const char DEBUGGER_INFORMATION_ENGINETYPE[] = "EngineType";
static const char DEBUGGER_INFORMATION_AUTODETECTED[] = "AutoDetected";
+static const char DEBUGGER_INFORMATION_AUTODETECTION_SOURCE[] = "AutoDetectionSource";
static const char DEBUGGER_INFORMATION_ABIS[] = "Abis";
namespace Debugger {
@@ -74,6 +75,7 @@ DebuggerItem::DebuggerItem(const QVariantMap &data)
m_id = data.value(QLatin1String(DEBUGGER_INFORMATION_ID)).toString();
m_displayName = data.value(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME)).toString();
m_isAutoDetected = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), false).toBool();
+ m_autoDetectionSource = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE)).toString();
m_engineType = DebuggerEngineType(data.value(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE),
static_cast<int>(NoEngineType)).toInt());
@@ -185,6 +187,7 @@ QVariantMap DebuggerItem::toMap() const
data.insert(QLatin1String(DEBUGGER_INFORMATION_COMMAND), m_command.toUserOutput());
data.insert(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE), int(m_engineType));
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), m_isAutoDetected);
+ data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE), m_autoDetectionSource);
data.insert(QLatin1String(DEBUGGER_INFORMATION_ABIS), abiNames());
return data;
}
@@ -209,6 +212,11 @@ void DebuggerItem::setAutoDetected(bool isAutoDetected)
m_isAutoDetected = isAutoDetected;
}
+void DebuggerItem::setAutoDetectionSource(const QString &autoDetectionSource)
+{
+ m_autoDetectionSource = autoDetectionSource;
+}
+
void DebuggerItem::setAbis(const QList<ProjectExplorer::Abi> &abis)
{
m_abis = abis;
diff --git a/src/plugins/debugger/debuggeritem.h b/src/plugins/debugger/debuggeritem.h
index c7d9d70777..e6c13a661f 100644
--- a/src/plugins/debugger/debuggeritem.h
+++ b/src/plugins/debugger/debuggeritem.h
@@ -79,6 +79,9 @@ public:
bool isAutoDetected() const { return m_isAutoDetected; }
void setAutoDetected(bool isAutoDetected);
+ QString autoDetectionSource() const { return m_autoDetectionSource; }
+ void setAutoDetectionSource(const QString &autoDetectionSource);
+
QList<ProjectExplorer::Abi> abis() const { return m_abis; }
void setAbis(const QList<ProjectExplorer::Abi> &abis);
void setAbi(const ProjectExplorer::Abi &abi);
@@ -99,6 +102,7 @@ private:
DebuggerEngineType m_engineType;
Utils::FileName m_command;
bool m_isAutoDetected;
+ QString m_autoDetectionSource;
QList<ProjectExplorer::Abi> m_abis;
friend class Internal::DebuggerItemConfigWidget;
diff --git a/src/plugins/debugger/debuggeroptionspage.cpp b/src/plugins/debugger/debuggeroptionspage.cpp
index bd0b8d2916..1bf5718872 100644
--- a/src/plugins/debugger/debuggeroptionspage.cpp
+++ b/src/plugins/debugger/debuggeroptionspage.cpp
@@ -217,63 +217,61 @@ DebuggerOptionsPage::DebuggerOptionsPage()
setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
-QWidget *DebuggerOptionsPage::createPage(QWidget *parent)
+QWidget *DebuggerOptionsPage::widget()
{
- m_configWidget = new QWidget(parent);
-
- m_addButton = new QPushButton(tr("Add"), m_configWidget);
- m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
- m_delButton = new QPushButton(tr("Remove"), m_configWidget);
-
- m_container = new DetailsWidget(m_configWidget);
- m_container->setState(DetailsWidget::NoSummary);
- m_container->setVisible(false);
-
- m_model = new DebuggerItemModel(parent);
-
- m_debuggerView = new QTreeView(m_configWidget);
- m_debuggerView->setModel(m_model);
- m_debuggerView->setUniformRowHeights(true);
- m_debuggerView->setSelectionMode(QAbstractItemView::SingleSelection);
- m_debuggerView->setSelectionBehavior(QAbstractItemView::SelectRows);
- m_debuggerView->expandAll();
-
- QHeaderView *header = m_debuggerView->header();
- header->setStretchLastSection(false);
- header->setResizeMode(0, QHeaderView::ResizeToContents);
- header->setResizeMode(1, QHeaderView::ResizeToContents);
- header->setResizeMode(2, QHeaderView::Stretch);
-
- QVBoxLayout *buttonLayout = new QVBoxLayout();
- buttonLayout->setSpacing(6);
- buttonLayout->setContentsMargins(0, 0, 0, 0);
- buttonLayout->addWidget(m_addButton);
- buttonLayout->addWidget(m_cloneButton);
- buttonLayout->addWidget(m_delButton);
- buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
-
- QVBoxLayout *verticalLayout = new QVBoxLayout();
- verticalLayout->addWidget(m_debuggerView);
- verticalLayout->addWidget(m_container);
-
- QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
- horizontalLayout->addLayout(verticalLayout);
- horizontalLayout->addLayout(buttonLayout);
-
- connect(m_debuggerView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(debuggerSelectionChanged()));
-
- connect(m_addButton, SIGNAL(clicked()), this, SLOT(addDebugger()), Qt::QueuedConnection);
- connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneDebugger()), Qt::QueuedConnection);
- connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeDebugger()), Qt::QueuedConnection);
-
- m_searchKeywords = tr("Debuggers");
-
- m_itemConfigWidget = new DebuggerItemConfigWidget(m_model);
- m_container->setWidget(m_itemConfigWidget);
-
- updateState();
-
+ if (!m_configWidget) {
+ m_configWidget = new QWidget;
+
+ m_addButton = new QPushButton(tr("Add"), m_configWidget);
+ m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
+ m_delButton = new QPushButton(tr("Remove"), m_configWidget);
+
+ m_container = new DetailsWidget(m_configWidget);
+ m_container->setState(DetailsWidget::NoSummary);
+ m_container->setVisible(false);
+
+ m_debuggerView = new QTreeView(m_configWidget);
+ m_model = new DebuggerItemModel(m_debuggerView);
+ m_debuggerView->setModel(m_model);
+ m_debuggerView->setUniformRowHeights(true);
+ m_debuggerView->setSelectionMode(QAbstractItemView::SingleSelection);
+ m_debuggerView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_debuggerView->expandAll();
+
+ QHeaderView *header = m_debuggerView->header();
+ header->setStretchLastSection(false);
+ header->setResizeMode(0, QHeaderView::ResizeToContents);
+ header->setResizeMode(1, QHeaderView::ResizeToContents);
+ header->setResizeMode(2, QHeaderView::Stretch);
+
+ QVBoxLayout *buttonLayout = new QVBoxLayout();
+ buttonLayout->setSpacing(6);
+ buttonLayout->setContentsMargins(0, 0, 0, 0);
+ buttonLayout->addWidget(m_addButton);
+ buttonLayout->addWidget(m_cloneButton);
+ buttonLayout->addWidget(m_delButton);
+ buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout();
+ verticalLayout->addWidget(m_debuggerView);
+ verticalLayout->addWidget(m_container);
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
+ horizontalLayout->addLayout(verticalLayout);
+ horizontalLayout->addLayout(buttonLayout);
+
+ connect(m_debuggerView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SLOT(debuggerSelectionChanged()));
+
+ connect(m_addButton, SIGNAL(clicked()), this, SLOT(addDebugger()), Qt::QueuedConnection);
+ connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneDebugger()), Qt::QueuedConnection);
+ connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeDebugger()), Qt::QueuedConnection);
+
+ m_itemConfigWidget = new DebuggerItemConfigWidget(m_model);
+ m_container->setWidget(m_itemConfigWidget);
+
+ updateState();
+ }
return m_configWidget;
}
@@ -322,10 +320,10 @@ void DebuggerOptionsPage::removeDebugger()
void DebuggerOptionsPage::finish()
{
- // Deleted by settingsdialog.
- m_configWidget = 0;
+ delete m_configWidget;
// Children of m_configWidget.
+ m_model = 0;
m_container = 0;
m_debuggerView = 0;
m_addButton = 0;
@@ -333,11 +331,6 @@ void DebuggerOptionsPage::finish()
m_delButton = 0;
}
-bool DebuggerOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void DebuggerOptionsPage::debuggerSelectionChanged()
{
QTC_ASSERT(m_container, return);
diff --git a/src/plugins/debugger/debuggeroptionspage.h b/src/plugins/debugger/debuggeroptionspage.h
index 29089b4f52..683054b801 100644
--- a/src/plugins/debugger/debuggeroptionspage.h
+++ b/src/plugins/debugger/debuggeroptionspage.h
@@ -34,6 +34,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
#include <QWidget>
QT_BEGIN_NAMESPACE
@@ -97,10 +98,9 @@ class DebuggerOptionsPage : public Core::IOptionsPage
public:
DebuggerOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
private slots:
void debuggerSelectionChanged();
@@ -111,8 +111,7 @@ private slots:
void removeDebugger();
private:
- QWidget *m_configWidget;
- QString m_searchKeywords;
+ QPointer<QWidget> m_configWidget;
DebuggerItemModel *m_model;
DebuggerItemConfigWidget *m_itemConfigWidget;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index a68df5c9c0..f1a02a89d3 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -684,7 +684,7 @@ static bool currentTextEditorPosition(ContextData *data)
data->fileName = document->filePath();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
int lineNumber = textEditor->currentLine();
- QString line = textEditor->textDocument()->contents()
+ QString line = textEditor->textDocument()->plainText()
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
data->address = DisassemblerLine::addressFromDisassemblyLine(line);
} else {
@@ -1843,7 +1843,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
ITextEditorDocument *document = editor->textDocument();
args.fileName = document->filePath();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
- QString line = document->contents()
+ QString line = document->plainText()
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
BreakpointResponse needle;
needle.type = BreakpointByAddress;
@@ -1956,7 +1956,7 @@ void DebuggerPluginPrivate::toggleBreakpoint()
QTC_ASSERT(textEditor, return);
const int lineNumber = textEditor->currentLine();
if (textEditor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
- QString line = textEditor->textDocument()->contents()
+ QString line = textEditor->textDocument()->plainText()
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
toggleBreakpointByAddress(address);
@@ -2013,7 +2013,7 @@ void DebuggerPluginPrivate::requestMark(ITextEditor *editor,
return;
if (editor->property("DisassemblerView").toBool()) {
- QString line = editor->textDocument()->contents()
+ QString line = editor->textDocument()->plainText()
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
toggleBreakpointByAddress(address);
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 59c2158dcf..db2c5b7f5a 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -75,7 +75,6 @@ DebuggerEngine *createGdbEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createPdbEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createQmlEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp, QString *error);
-DebuggerEngine *createLldbLibEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createLldbEngine(const DebuggerStartParameters &sp);
static const char *engineTypeName(DebuggerEngineType et)
@@ -93,8 +92,6 @@ static const char *engineTypeName(DebuggerEngineType et)
return "QML engine";
case Debugger::QmlCppEngineType:
return "QML C++ engine";
- case Debugger::LldbLibEngineType:
- return "LLDB binary engine";
case Debugger::LldbEngineType:
return "LLDB command line engine";
case Debugger::AllEngineTypes:
@@ -518,8 +515,6 @@ DebuggerEngine *DebuggerRunControlFactory::createEngine(DebuggerEngineType et,
return createQmlEngine(sp);
case LldbEngineType:
return createLldbEngine(sp);
- case LldbLibEngineType:
- return createLldbLibEngine(sp);
case QmlCppEngineType:
return createQmlCppEngine(sp, errorMessage);
default:
diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
index 2080d92d38..9587762294 100644
--- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
+++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp
@@ -244,6 +244,7 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
// Edit part
m_targetChooser->setExpectedKind(PathChooser::ExistingDirectory);
+ m_targetChooser->setHistoryCompleter(QLatin1String("Debugger.MappingTarget.History"));
connect(m_sourceLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(slotEditSourceFieldChanged()));
connect(m_targetChooser, SIGNAL(changed(QString)),
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index 3dd14440bb..95bda62afd 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -192,7 +192,7 @@ void DisassemblerAgent::resetLocation()
if (d->resetLocationScheduled) {
d->resetLocationScheduled = false;
if (d->locationMark)
- d->editor->markableInterface()->removeMark(d->locationMark);
+ d->editor->textDocument()->markableInterface()->removeMark(d->locationMark);
}
}
@@ -346,14 +346,14 @@ void DisassemblerAgent::updateLocationMarker()
int lineNumber = contents.lineForAddress(d->location.address());
if (d->location.needsMarker()) {
if (d->locationMark)
- d->editor->markableInterface()->removeMark(d->locationMark);
+ d->editor->textDocument()->markableInterface()->removeMark(d->locationMark);
delete d->locationMark;
d->locationMark = 0;
if (lineNumber) {
d->locationMark = new ITextMark(lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon());
d->locationMark->setPriority(TextEditor::ITextMark::HighPriority);
- d->editor->markableInterface()->addMark(d->locationMark);
+ d->editor->textDocument()->markableInterface()->addMark(d->locationMark);
}
}
@@ -379,7 +379,7 @@ void DisassemblerAgent::updateBreakpointMarkers()
const DisassemblerLines contents = d->contentsAtCurrentLocation();
foreach (TextEditor::ITextMark *marker, d->breakpointMarks)
- d->editor->markableInterface()->removeMark(marker);
+ d->editor->textDocument()->markableInterface()->removeMark(marker);
qDeleteAll(d->breakpointMarks);
d->breakpointMarks.clear();
foreach (BreakpointModelId id, ids) {
@@ -393,7 +393,7 @@ void DisassemblerAgent::updateBreakpointMarkers()
marker->setIcon(handler->icon(id));
marker->setPriority(ITextMark::NormalPriority);
d->breakpointMarks.append(marker);
- d->editor->markableInterface()->addMark(marker);
+ d->editor->textDocument()->markableInterface()->addMark(marker);
}
}
diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp
index f0efdd3477..8823face49 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.cpp
+++ b/src/plugins/debugger/gdb/gdboptionspage.cpp
@@ -54,7 +54,7 @@ namespace Internal {
class GdbOptionsPageWidget : public QWidget
{
public:
- explicit GdbOptionsPageWidget(QWidget *parent);
+ explicit GdbOptionsPageWidget(QWidget *parent = 0);
QGroupBox *groupBoxGeneral;
QLabel *labelGdbWatchdogTimeout;
@@ -83,7 +83,6 @@ public:
//QLineEdit *lineEditSelectedPluginBreakpointsPattern;
Utils::SavedActionSet group;
- QString searchKeywords;
};
GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
@@ -297,19 +296,6 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
// setEnabled(dc->action(SelectedPluginBreakpoints)->value().toBool());
//connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
// lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
-
- const QLatin1Char sep(' ');
- QTextStream(&searchKeywords)
- << sep << groupBoxGeneral->title()
- << sep << checkBoxLoadGdbInit->text()
- << sep << checkBoxLoadGdbDumpers->text()
- << sep << checkBoxUseDynamicType->text()
- << sep << labelGdbWatchdogTimeout->text()
- << sep << checkBoxSkipKnownFrames->text()
- << sep << checkBoxUseMessageBoxForSignals->text()
- << sep << checkBoxAdjustBreakpointLocations->text();
- ;
- searchKeywords.remove(QLatin1Char('&'));
}
GdbOptionsPage::GdbOptionsPage()
@@ -325,9 +311,10 @@ GdbOptionsPage::~GdbOptionsPage()
{
}
-QWidget *GdbOptionsPage::createPage(QWidget *parent)
+QWidget *GdbOptionsPage::widget()
{
- m_widget = new GdbOptionsPageWidget(parent);
+ if (!m_widget)
+ m_widget = new GdbOptionsPageWidget;
return m_widget;
}
@@ -339,13 +326,10 @@ void GdbOptionsPage::apply()
void GdbOptionsPage::finish()
{
- if (m_widget)
+ if (m_widget) {
m_widget->group.finish();
-}
-
-bool GdbOptionsPage::matches(const QString &s) const
-{
- return m_widget && m_widget->searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
+ }
}
/////////////////////////////////////////////////////////////////////////
@@ -357,7 +341,7 @@ bool GdbOptionsPage::matches(const QString &s) const
class GdbOptionsPageWidget2 : public QWidget
{
public:
- explicit GdbOptionsPageWidget2(QWidget *parent);
+ explicit GdbOptionsPageWidget2(QWidget *parent = 0);
QGroupBox *groupBoxDangerous;
QLabel *labelDangerous;
@@ -371,7 +355,6 @@ public:
QCheckBox *checkBoxMultiInferior;
Utils::SavedActionSet group;
- QString searchKeywords;
};
GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
@@ -398,7 +381,7 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr(
"Use common locations for debug information"));
checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr(
- "<html><head/><body>Add common paths to locations "
+ "<html><head/><body>Adds common paths to locations "
"of debug information such as <i>/usr/src/debug</i> "
"when starting GDB.</body></html>"));
@@ -418,7 +401,7 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
- "<html><head/><body><p>Enable stepping backwards.</p><p>"
+ "<html><head/><body><p>Enables stepping backwards.</p><p>"
"<b>Note:</b> This feature is very slow and unstable on the GDB side. "
"It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>"));
@@ -426,14 +409,14 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
checkBoxAttemptQuickStart = new QCheckBox(groupBoxDangerous);
checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
checkBoxAttemptQuickStart->setToolTip(GdbOptionsPage::tr(
- "<html><head/><body>Postpone reading debug information as long as possible. "
+ "<html><head/><body>Postpones reading debug information as long as possible. "
"This can result in faster startup times at the price of not being able to "
"set breakpoints by file and number.</body></html>"));
checkBoxMultiInferior = new QCheckBox(groupBoxDangerous);
checkBoxMultiInferior->setText(GdbOptionsPage::tr("Debug all children"));
checkBoxMultiInferior->setToolTip(GdbOptionsPage::tr(
- "<html><head/><body>Keep debugging all children after a fork."
+ "<html><head/><body>Keeps debugging all children after a fork."
"</body></html>"));
@@ -460,16 +443,6 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
group.insert(dc->action(AttemptQuickStart), checkBoxAttemptQuickStart);
group.insert(dc->action(MultiInferior), checkBoxMultiInferior);
group.insert(dc->action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
-
- const QLatin1Char sep(' ');
- QTextStream(&searchKeywords)
- << sep << groupBoxDangerous->title()
- << sep << checkBoxTargetAsync->text()
- << sep << checkBoxEnableReverseDebugging->text()
- << sep << checkBoxAttemptQuickStart->text()
- << sep << checkBoxMultiInferior->text()
- ;
- searchKeywords.remove(QLatin1Char('&'));
}
GdbOptionsPage2::GdbOptionsPage2()
@@ -485,9 +458,10 @@ GdbOptionsPage2::~GdbOptionsPage2()
{
}
-QWidget *GdbOptionsPage2::createPage(QWidget *parent)
+QWidget *GdbOptionsPage2::widget()
{
- m_widget = new GdbOptionsPageWidget2(parent);
+ if (!m_widget)
+ m_widget = new GdbOptionsPageWidget2;
return m_widget;
}
@@ -499,13 +473,10 @@ void GdbOptionsPage2::apply()
void GdbOptionsPage2::finish()
{
- if (m_widget)
+ if (m_widget) {
m_widget->group.finish();
-}
-
-bool GdbOptionsPage2::matches(const QString &s) const
-{
- return m_widget && m_widget->searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
+ }
}
} // namespace Internal
diff --git a/src/plugins/debugger/gdb/gdboptionspage.h b/src/plugins/debugger/gdb/gdboptionspage.h
index 29387f82c2..915834d1e9 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.h
+++ b/src/plugins/debugger/gdb/gdboptionspage.h
@@ -46,10 +46,9 @@ class GdbOptionsPage : public Core::IOptionsPage
public:
GdbOptionsPage();
~GdbOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
private:
QPointer<GdbOptionsPageWidget> m_widget;
@@ -63,10 +62,9 @@ class GdbOptionsPage2 : public Core::IOptionsPage
public:
GdbOptionsPage2();
~GdbOptionsPage2();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
private:
QPointer<GdbOptionsPageWidget2> m_widget;
diff --git a/src/plugins/debugger/lldblib/guest/README b/src/plugins/debugger/lldblib/guest/README
deleted file mode 100644
index be9d4fbee7..0000000000
--- a/src/plugins/debugger/lldblib/guest/README
+++ /dev/null
@@ -1,31 +0,0 @@
-LLDB Guest Engine
-
-You can use the LLDB debugger from the LLVM project with the Qt Creator debugger
-plugin on Mac OS.
-
-For the Qt Creator build to pick up the LLDB Guest Engine,
-you must download the LLDB debugger and configure it
-to be included in the Qt Creator build.
-
-To debug an application, Qt Creator must access the memory of the application.
-On Mac OS X, this requires code signing.
-
-To enable LLDB debugger support in Qt Creator:
-
-1. To download the LLDB debugger, enter the following command:
- svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
-
-2. To sign the code, follow the instructions in lldb/docs/code-signing.txt.
-
-3. To open LLDB in Xcode for building, enter the following command:
- open lldb.xcodeproj
- then select the Release target and press the build button.
-
-4. In Xcode, press the build button.
-
-5. type the following to have the qt creator build system find your lldb build:
- export WITH_LLDB=/path/to/lldb
-
-6. To rebuild Qt Creator, change back to the top level directory of
- the Qt Creator source, and enter the following command:
- qmake -r && make
diff --git a/src/plugins/debugger/lldblib/guest/lldbengineguest.cpp b/src/plugins/debugger/lldblib/guest/lldbengineguest.cpp
deleted file mode 100644
index 7a5cd176e1..0000000000
--- a/src/plugins/debugger/lldblib/guest/lldbengineguest.cpp
+++ /dev/null
@@ -1,761 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#define QT_NO_CAST_FROM_ASCII
-
-#include "lldbengineguest.h"
-
-#include "debuggeractions.h"
-#include "debuggerconstants.h"
-#include "debuggerdialogs.h"
-#include "debuggerplugin.h"
-#include "debuggerstringutils.h"
-
-#include "breakhandler.h"
-#include "breakpoint.h"
-#include "moduleshandler.h"
-#include "registerhandler.h"
-#include "stackhandler.h"
-#include "watchhandler.h"
-#include "watchutils.h"
-#include "threadshandler.h"
-
-#include <utils/qtcassert.h>
-#include <QDebug>
-#include <QProcess>
-#include <QFileInfo>
-#include <QThread>
-#include <QMutexLocker>
-
-#include <lldb/API/LLDB.h>
-
-#define DEBUG_FUNC_ENTER \
- showMessage(QString(QLatin1String("LLDB guest engine: %1 ")) \
- .arg(QLatin1String(Q_FUNC_INFO))); \
- qDebug("%s", Q_FUNC_INFO)
-
-#define SYNC_INFERIOR_OR(x) if (m_running) { x; }
-
-
-namespace Debugger {
-namespace Internal {
-
-void LldbEventListener::listen(lldb::SBListener *listener)
-{
- while (true) {
- lldb::SBEvent event;
- if (listener->WaitForEvent(1000, event))
- emit lldbEvent(&event);
- }
-}
-
-LldbEngineGuest::LldbEngineGuest()
- : IPCEngineGuest()
- , m_running (false)
- , m_worker (new LldbEventListener)
- , m_lldb (new lldb::SBDebugger)
- , m_target (new lldb::SBTarget)
- , m_process (new lldb::SBProcess)
- , m_listener(new lldb::SBListener("bla"))
- , m_relistFrames (false)
-#if defined(HAVE_LLDB_PRIVATE)
- , py (new PythonLLDBToGdbMiHack)
-#endif
-{
- qRegisterMetaType<lldb::SBListener *>("lldb::SBListener *");
- qRegisterMetaType<lldb::SBEvent *>("lldb::SBEvent *");
-
- m_worker->moveToThread(&m_wThread);
- connect(m_worker, SIGNAL(lldbEvent(lldb::SBEvent*)), this,
- SLOT(lldbEvent(lldb::SBEvent*)), Qt::BlockingQueuedConnection);
- m_wThread.start();
- setObjectName(QLatin1String("LLDBEngineGuest"));
-}
-
-LldbEngineGuest::~LldbEngineGuest()
-{
- delete m_lldb;
- delete m_target;
- delete m_process;
- delete m_listener;
-}
-
-
-void LldbEngineGuest::nuke()
-{
- ::exit(4);
-}
-
-void LldbEngineGuest::setupEngine()
-{
- DEBUG_FUNC_ENTER;
-
- lldb::SBDebugger::Initialize();
-
- *m_lldb = lldb::SBDebugger::Create();
- m_lldb->Initialize();
- if (m_lldb->IsValid())
- notifyEngineSetupOk();
- else
- notifyEngineSetupFailed();
-
-}
-
-void LldbEngineGuest::setupInferior(const QString &executable,
- const QStringList &args, const QStringList &env)
-{
- DEBUG_FUNC_ENTER;
-
- foreach (const QString &s, args) {
- m_arguments.append(s.toLocal8Bit());
- }
- foreach (const QString &s, env) {
- m_environment.append(s.toLocal8Bit());
- }
-
- qDebug("creating target for %s", executable.toLocal8Bit().data());
- showStatusMessage(QLatin1String("starting ") + executable);
- *m_target = m_lldb->CreateTarget(executable.toLocal8Bit().data());
- if (!m_target->IsValid()) {
- notifyInferiorSetupFailed();
- return;
- }
- DEBUG_FUNC_ENTER;
-
- const char **argp = new const char *[m_arguments.count() + 1];
- argp[m_arguments.count()] = 0;
- for (int i = 0; i < m_arguments.count(); i++) {
- argp[i] = m_arguments[i].data();
- }
-
- const char **envp = new const char *[m_environment.count() + 1];
- envp[m_environment.count()] = 0;
- for (int i = 0; i < m_environment.count(); i++) {
- envp[i] = m_environment[i].data();
- }
- lldb::SBError err;
- *m_process = m_target->Launch(argp, envp, NULL, NULL, true, err);
-
- if (!err.Success()) {
- showMessage(QString::fromLocal8Bit(err.GetCString()));
- qDebug() << err.GetCString();
- notifyInferiorSetupFailed();
- }
-
- /*
- * note, the actual string ptrs are still valid. They are in m_environment.
- * They probably leak. Considered the marvelous API, there is not much we can do
- */
- delete [] envp;
-
- if (!m_process->IsValid())
- notifyEngineRunFailed();
- QTC_ASSERT(m_listener->IsValid(), qDebug() << false);
- m_listener->StartListeningForEvents(m_process->GetBroadcaster(), UINT32_MAX);
- QMetaObject::invokeMethod(m_worker, "listen", Qt::QueuedConnection,
- Q_ARG(lldb::SBListener *, m_listener));
- notifyInferiorSetupOk();
-}
-
-void LldbEngineGuest::runEngine()
-{
- DEBUG_FUNC_ENTER;
- m_process->Continue();
-}
-
-void LldbEngineGuest::shutdownInferior()
-{
- DEBUG_FUNC_ENTER;
- m_process->Kill();
-}
-
-void LldbEngineGuest::shutdownEngine()
-{
- DEBUG_FUNC_ENTER;
- m_currentFrame = lldb::SBFrame();
- m_currentThread = lldb::SBThread();
- m_breakpoints.clear();
- m_localesCache.clear();
-
- /*
- * this leaks. However, Terminate is broken and lldb leaks anyway
- * We should kill the engine guest process
- */
-
- *m_lldb = lldb::SBDebugger();
- // leakd.Terminate();
- notifyEngineShutdownOk();
-}
-
-void LldbEngineGuest::detachDebugger()
-{
- DEBUG_FUNC_ENTER;
-}
-
-void LldbEngineGuest::executeStep()
-{
- DEBUG_FUNC_ENTER;
-
- if (!m_currentThread.IsValid())
- return;
- m_currentThread.StepInto();
-}
-
-void LldbEngineGuest::executeStepOut()
-{
- DEBUG_FUNC_ENTER;
-
- if (!m_currentThread.IsValid())
- return;
- m_currentThread.StepOut();
-}
-
-void LldbEngineGuest::executeNext()
-{
- DEBUG_FUNC_ENTER;
-
- if (!m_currentThread.IsValid())
- return;
- m_currentThread.StepOver();
-}
-
-void LldbEngineGuest::executeStepI()
-{
- DEBUG_FUNC_ENTER;
-
- if (!m_currentThread.IsValid())
- return;
- m_currentThread.StepInstruction(false);
-}
-
-void LldbEngineGuest::executeNextI()
-{
- DEBUG_FUNC_ENTER;
-
- if (!m_currentThread.IsValid())
- return;
- m_currentThread.StepInstruction(true);
-}
-
-void LldbEngineGuest::continueInferior()
-{
- DEBUG_FUNC_ENTER;
-
- notifyInferiorRunRequested();
- m_process->Continue();
- showStatusMessage(QLatin1String("resuming inferior"));
-}
-void LldbEngineGuest::interruptInferior()
-{
- DEBUG_FUNC_ENTER;
-
- m_process->Stop();
- notifyInferiorStopOk();
- m_relistFrames = true;
- updateThreads();
-}
-
-void LldbEngineGuest::executeRunToLine(const ContextData &data);
-{
- DEBUG_FUNC_ENTER;
-
- // TODO
- Q_UNUSED(data);
-}
-
-void LldbEngineGuest::executeRunToFunction(const QString &functionName)
-{
- DEBUG_FUNC_ENTER;
-
- // TODO
- Q_UNUSED(functionName);
-}
-void LldbEngineGuest::executeJumpToLine(const ContextData &data);
-{
- DEBUG_FUNC_ENTER;
-
- // TODO
- Q_UNUSED(data);
-}
-
-void LldbEngineGuest::activateFrame(qint64 token)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(showMessage(QLatin1String(
- "activateFrame called while inferior running")); return);
-
- currentFrameChanged(token);
- m_localesCache.clear();
-
- lldb::SBFrame fr = m_currentThread.GetFrameAtIndex(token);
- m_currentFrame = fr;
- lldb::SBSymbolContext context = fr.GetSymbolContext(lldb::eSymbolContextEverything);
- lldb::SBValueList values = fr.GetVariables(true, true, false, true);
- QList<WatchData> wd;
- QByteArray iname = "local";
- for (uint i = 0; i < values.GetSize(); i++) {
- lldb::SBValue v = values.GetValueAtIndex(i);
- if (!v.IsInScope(fr))
- continue;
- getWatchDataR(v, 1, iname, wd);
- }
- updateWatchData(true, wd);
-}
-
-void LldbEngineGuest::requestUpdateWatchData(const Internal::WatchData &data,
- const Internal::WatchUpdateFlags &)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(return);
-
- lldb::SBValue v = m_localesCache.value(QString::fromUtf8(data.iname));
- QList<WatchData> wd;
- for (uint j = 0; j < v.GetNumChildren(); j++) {
- lldb::SBValue vv = v.GetChildAtIndex(j);
- getWatchDataR(vv, 1, data.iname, wd);
- }
- updateWatchData(false, wd);
-}
-
-void LldbEngineGuest::getWatchDataR(lldb::SBValue v, int level,
- const QByteArray &p_iname, QList<WatchData> &wd)
-{
- QByteArray iname = p_iname + '.' + QByteArray(v.GetName());
- m_localesCache.insert(QString::fromLocal8Bit(iname), v);
-
-#if defined(HAVE_LLDB_PRIVATE)
- wd += py->expand(p_iname, v, m_currentFrame, *m_process);
-#else
- WatchData d;
- d.name = QString::fromLocal8Bit(v.GetName());
- d.iname = iname;
- d.type = QByteArray(v.GetTypeName()).trimmed();
- d.value = (QString::fromLocal8Bit(v.GetValue(m_currentFrame)));
- d.hasChildren = v.GetNumChildren();
- d.state = WatchData::State(0);
- wd.append(d);
-#endif
-
- if (--level > 0) {
- for (uint j = 0; j < v.GetNumChildren(); j++) {
- lldb::SBValue vv = v.GetChildAtIndex(j);
- getWatchDataR(vv, level, iname, wd);
- }
- }
-}
-
-void LldbEngineGuest::disassemble(quint64 pc)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(return);
-
- if (!m_currentThread.IsValid())
- return;
- for (uint j = 0; j < m_currentThread.GetNumFrames(); j++) {
- lldb::SBFrame fr = m_currentThread.GetFrameAtIndex(j);
- if (pc == fr.GetPCAddress().GetLoadAddress(*m_target)) {
- QString linesStr = QString::fromLocal8Bit(fr.Disassemble());
- DisassemblerLines lines;
- foreach (const QString &lineStr, linesStr.split(QLatin1Char('\n'))) {
- lines.appendLine(DisassemblerLine(lineStr));
- }
- disassembled(pc, lines);
- }
- }
-}
-void LldbEngineGuest::fetchFrameSource(qint64 frame)
-{
- QFile f(m_frame_to_file.value(frame));
- f.open(QFile::ReadOnly);
- frameSourceFetched(frame, QFileInfo(m_frame_to_file.value(frame)).fileName()
- , QString::fromLocal8Bit(f.readAll()));
-}
-
-void LldbEngineGuest::addBreakpoint(BreakpointId id,
- const Internal::BreakpointParameters &bp_)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(notifyAddBreakpointFailed(id); return);
-
- Internal::BreakpointParameters bp(bp_);
-
- lldb::SBBreakpoint llbp = m_target->BreakpointCreateByLocation(
- bp.fileName.toLocal8Bit().constData(), bp.lineNumber);
- if (llbp.IsValid()) {
- m_breakpoints.insert(id, llbp);
-
- llbp.SetIgnoreCount(bp.ignoreCount);
- bp.ignoreCount = llbp.GetIgnoreCount();
- bp.enabled = llbp.IsEnabled();
-
- lldb::SBBreakpointLocation location = llbp.GetLocationAtIndex(0);
- if (location.IsValid()) {
- bp.address = location.GetLoadAddress();
-
- // FIXME get those from lldb
- bp.lineNumber = bp.lineNumber;
- bp.fileName = bp.fileName;
- notifyAddBreakpointOk(id);
- showMessage(QLatin1String("[BB] ok."));
- notifyBreakpointAdjusted(id, bp);
- } else {
- m_breakpoints.take(id);
- showMessage(QLatin1String("[BB] failed. cant resolve yet"));
-// notifyAddBreakpointFailed(id);
-// notifyAddBreakpointOk(id);
- }
- } else {
- showMessage(QLatin1String("[BB] failed. dunno."));
- notifyAddBreakpointFailed(id);
- }
-}
-
-void LldbEngineGuest::removeBreakpoint(BreakpointId id)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(notifyRemoveBreakpointFailed(id); return);
-
- lldb::SBBreakpoint llbp = m_breakpoints.take(id);
- llbp.SetEnabled(false);
- notifyRemoveBreakpointOk(id);
-}
-
-void LldbEngineGuest::changeBreakpoint(BreakpointId id,
- const Internal::BreakpointParameters &bp)
-{
- DEBUG_FUNC_ENTER;
-
- // TODO
- Q_UNUSED(id);
- Q_UNUSED(bp);
-}
-
-void LldbEngineGuest::selectThread(qint64 token)
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(return);
-
- m_frame_to_file.clear();
- for (uint i = 0; i < m_process->GetNumThreads(); i++) {
- lldb::SBThread t = m_process->GetThreadAtIndex(i);
- if (t.GetThreadID() == token) {
- m_currentThread = t;
- StackFrames frames;
- int firstResolvableFrame = -1;
- for (uint j = 0; j < t.GetNumFrames(); j++) {
- lldb::SBFrame fr = t.GetFrameAtIndex(j);
- if (!fr.IsValid()) {
- qDebug("warning: frame %i is garbage", j);
- continue;
- }
- lldb::SBSymbolContext context =
- fr.GetSymbolContext(lldb::eSymbolContextEverything);
- lldb::SBSymbol sym = fr.GetSymbol();
- lldb::SBFunction func = fr.GetFunction();
- lldb::SBCompileUnit tu = fr.GetCompileUnit();
- lldb::SBModule module = fr.GetModule();
- lldb::SBBlock block = fr.GetBlock();
- lldb::SBBlock fblock = fr.GetFrameBlock();
- lldb::SBLineEntry le = fr.GetLineEntry();
- lldb::SBValueList values = fr.GetVariables(true, true, true, false);
-#if 0
- qDebug()<<"\tframe "<<fr.GetFrameID();
- qDebug() << "\t\tPC: " << ("0x" + QByteArray::number(
- fr.GetPCAddress().GetLoadAddress(*m_target), 16)).data();
- qDebug() << "\t\tFP: " << ("0x" + QByteArray::number(fr.GetFP(), 16)).data();
- qDebug() << "\t\tSP: " << ("0x" + QByteArray::number(fr.GetSP(), 16)).data();
- qDebug() << "\t\tsymbol: " << sym.IsValid() << sym.GetName() << sym.GetMangledName();
- qDebug() << "\t\tfunction:" << func.IsValid();
- qDebug() << "\t\ttu: " << tu.IsValid();
- if (tu.IsValid())
-
- qDebug() << "\t\tmodule: " << module.IsValid() << module.GetFileSpec().IsValid()
- << module.GetFileSpec().GetFilename();
- qDebug() << "\t\tblock: " << block.IsValid() << block.GetInlinedName();
- qDebug() << "\t\tfblock: " << block.IsValid() << block.GetInlinedName();
- qDebug() << "\t\tle: " << le.IsValid() << le.GetLine()<<le.GetColumn();
- qDebug() << "\t\tvalues: "<<values.IsValid() << values.GetSize();
- qDebug() << "\t\tcontext: " << context.IsValid();
- qDebug() << "\t\t\tmodule: " << context.GetModule().IsValid();
- qDebug() << "\t\t\tfunction: " << context.GetFunction().IsValid();
- qDebug() << "\t\t\tblock: " << context.GetBlock().IsValid();
- qDebug() << "\t\t\tle: " << context.GetLineEntry().IsValid();
- qDebug() << "\t\t\tsymbol: " << context.GetSymbol().IsValid();
-// qDebug() << "\t\tdisassemly -->\n" << fr.Disassemble() << "<--";
-#endif
-
- QString sourceFile;
- QString sourceFilePath;
- int lineNumber = 0;
- if (le.IsValid()) {
- lineNumber = le.GetLine();
- if (le.GetFileSpec().IsValid()) {
- sourceFile = QString::fromLocal8Bit(le.GetFileSpec().GetFilename());
- sourceFilePath = QString::fromLocal8Bit(le.GetFileSpec().GetDirectory())
- + QLatin1String("/") + sourceFile;
- if (firstResolvableFrame < 0)
- firstResolvableFrame = j;
- }
- }
- sourceFilePath = QFileInfo(sourceFilePath).canonicalFilePath();
-
- QString functionName;
- if (func.IsValid())
- functionName = QString::fromLocal8Bit(func.GetName());
- else
- functionName = QString::fromLocal8Bit(sym.GetName());
-
- StackFrame frame;
- frame.level = fr.GetFrameID();
- if (func.IsValid())
- frame.function = QString::fromLocal8Bit(func.GetName());
- else
- frame.function = QString::fromLocal8Bit(sym.GetName());
- frame.from = QString::fromLocal8Bit(module.GetFileSpec().GetFilename());
- frame.address = fr.GetPCAddress().GetLoadAddress(*m_target);
- frame.line = lineNumber;
- frame.file = sourceFilePath;
- frame.usable = QFileInfo(frame.file).isReadable();
- frames.append(frame);
- m_frame_to_file.insert(j, frame.file);
- }
- currentThreadChanged(token);
- listFrames(frames);
- activateFrame(firstResolvableFrame > -1 ? firstResolvableFrame : 0);
- return;
- }
- }
-}
-
-void LldbEngineGuest::updateThreads()
-{
- DEBUG_FUNC_ENTER;
- SYNC_INFERIOR_OR(return);
-
- /* There is no way to find the StopReason of a _process_
- * We try to emulate gdb here, by assuming there must be exactly one 'guilty' thread.
- * However, if there are no threads at all, it must be that the process
- * no longer exists. Let's tear down the whole session.
- */
- if (m_process->GetNumThreads() < 1) {
- notifyEngineSpontaneousShutdown();
- m_process->Kill();
- m_process->Destroy();
- }
-
- Threads threads;
- for (uint i = 0; i < m_process->GetNumThreads(); i++) {
- lldb::SBThread t = m_process->GetThreadAtIndex(i);
- if (!t.IsValid()) {
- qDebug("warning: thread %i is garbage", i);
- continue;
- }
- ThreadData thread;
- thread.id = t.GetThreadID();
- thread.targetId = QString::number(t.GetThreadID());
- thread.core.clear();
- thread.state = QString::number(t.GetStopReason());
-
- switch (t.GetStopReason()) {
- case lldb::eStopReasonInvalid:
- case lldb::eStopReasonNone:
- case lldb::eStopReasonTrace:
- thread.state = QLatin1String("running");
- break;
- case lldb::eStopReasonBreakpoint:
- case lldb::eStopReasonWatchpoint:
- showStatusMessage(QLatin1String("hit breakpoint"));
- thread.state = QLatin1String("hit breakpoint");
- if (m_currentThread.GetThreadID() != t.GetThreadID()) {
- m_currentThread = t;
- currentThreadChanged(t.GetThreadID());
- m_relistFrames = true;
- }
- break;
- case lldb::eStopReasonSignal:
- showStatusMessage(QLatin1String("stopped"));
- thread.state = QLatin1String("stopped");
- if (m_currentThread.GetThreadID() != t.GetThreadID()) {
- m_currentThread = t;
- currentThreadChanged(t.GetThreadID());
- m_relistFrames = true;
- }
- break;
- case lldb::eStopReasonException:
- showStatusMessage(QLatin1String("application crashed."));
- thread.state = QLatin1String("crashed");
- if (m_currentThread.GetThreadID() != t.GetThreadID()) {
- m_currentThread = t;
- currentThreadChanged(t.GetThreadID());
- m_relistFrames = true;
- }
- break;
- case lldb::eStopReasonPlanComplete:
- thread.state = QLatin1String("crazy things happened");
- break;
- };
-
- thread.lineNumber = 0;
- thread.name = QString::fromLocal8Bit(t.GetName());
-
- lldb::SBFrame fr = t.GetFrameAtIndex(0);
- if (!fr.IsValid()) {
- qDebug("warning: frame 0 is garbage");
- continue;
- }
- lldb::SBSymbolContext context = fr.GetSymbolContext(lldb::eSymbolContextEverything);
- lldb::SBSymbol sym = fr.GetSymbol();
- lldb::SBFunction func = fr.GetFunction();
- lldb::SBLineEntry le = fr.GetLineEntry();
- QString sourceFile;
- QString sourceFilePath;
- int lineNumber = 0;
- if (le.IsValid()) {
- lineNumber = le.GetLine();
- if (le.GetFileSpec().IsValid()) {
- sourceFile = QString::fromLocal8Bit(le.GetFileSpec().GetFilename());
- sourceFilePath = QString::fromLocal8Bit(le.GetFileSpec().GetDirectory())
- + QLatin1String("/") + sourceFile;
- }
- }
- QString functionName;
- if (func.IsValid())
- functionName = QString::fromLocal8Bit(func.GetName());
- else
- functionName = QString::fromLocal8Bit(sym.GetName());
-
- lldb::SBValueList values = fr.GetVariables(true, true, false, false);
- thread.fileName = sourceFile;
- thread.function = functionName;
- thread.address = fr.GetPCAddress().GetLoadAddress(*m_target);
- thread.lineNumber = lineNumber;
- threads.append(thread);
- }
- listThreads(threads);
- if (m_relistFrames) {
- selectThread(m_currentThread.GetThreadID());
- m_relistFrames = false;
- }
-}
-
-void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev)
-{
- qDebug() << "lldbevent" << ev->GetType() <<
- m_process->GetState() << (int)state();
-
- uint32_t etype = ev->GetType();
- switch (etype) {
- // ProcessEvent
- case 1:
- switch (m_process->GetState()) {
- case lldb::eStateRunning: // 5
- if (!m_running)
- m_running = true;
- notifyInferiorPid(m_process->GetProcessID());
- switch (state()) {
- case EngineRunRequested:
- notifyEngineRunAndInferiorRunOk();
- break;
- case InferiorRunRequested:
- notifyInferiorRunOk();
- break;
- case InferiorStopOk:
- notifyInferiorRunRequested();
- notifyInferiorRunOk();
- break;
- default:
- break;
- }
- break;
- case lldb::eStateExited: // 9
- if (m_running)
- m_running = false;
- switch (state()) {
- case InferiorShutdownRequested:
- notifyInferiorShutdownOk();
- break;
- case InferiorRunOk:
- m_relistFrames = true;
- updateThreads();
- notifyEngineSpontaneousShutdown();
- m_process->Kill();
- m_process->Destroy();
- break;
- default:
- updateThreads();
- break;
- }
- break;
- case lldb::eStateStopped: // 4
- if (m_running)
- m_running = false;
- switch (state()) {
- case InferiorShutdownRequested:
- notifyInferiorShutdownOk();
- break;
- case InferiorRunOk:
- m_relistFrames = true;
- updateThreads();
- notifyInferiorSpontaneousStop();
- // fall
- default:
- m_relistFrames = true;
- updateThreads();
- break;
- }
- break;
- case lldb::eStateCrashed: // 7
- if (m_running)
- m_running = false;
- switch (state()) {
- case InferiorShutdownRequested:
- notifyInferiorShutdownOk();
- break;
- case InferiorRunOk:
- m_relistFrames = true;
- updateThreads();
- notifyInferiorSpontaneousStop();
- break;
- default:
- break;
- }
- break;
- default:
- qDebug("unexpected ProcessEvent");
- break;
- }
- break;
- default:
- break;
- };
-}
-
-
-} // namespace Internal
-} // namespace Debugger
diff --git a/src/plugins/debugger/lldblib/guest/lldbengineguest.h b/src/plugins/debugger/lldblib/guest/lldbengineguest.h
deleted file mode 100644
index c11ac3f0a3..0000000000
--- a/src/plugins/debugger/lldblib/guest/lldbengineguest.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef DEBUGGER_LLDBENGINE_GUEST_H
-#define DEBUGGER_LLDBENGINE_GUEST_H
-
-#include "ipcengineguest.h"
-
-#include <QQueue>
-#include <QVariant>
-#include <QThread>
-#include <QStringList>
-
-#include <lldb/API/LLDB.h>
-
-#if defined(HAVE_LLDB_PRIVATE)
-#include "pygdbmiemu.h"
-#endif
-
-Q_DECLARE_METATYPE (lldb::SBListener *)
-Q_DECLARE_METATYPE (lldb::SBEvent *)
-
-namespace Debugger {
-namespace Internal {
-
-class LldbEventListener : public QObject
-{
-Q_OBJECT
-public slots:
- void listen(lldb::SBListener *listener);
-signals:
- // lldb API uses non thread safe implicit sharing with no explicit copy feature
- // additionally the scope is undefined, hence this signal needs to be connected BlockingQueued
- // whutever, works for now.
- void lldbEvent(lldb::SBEvent *ev);
-};
-
-
-class LldbEngineGuest : public IPCEngineGuest
-{
- Q_OBJECT
-
-public:
- explicit LldbEngineGuest();
- ~LldbEngineGuest();
-
- void nuke();
- void setupEngine();
- void setupInferior(const QString &executable, const QStringList &arguments,
- const QStringList &environment);
- void runEngine();
- void shutdownInferior();
- void shutdownEngine();
- void detachDebugger();
- void executeStep();
- void executeStepOut() ;
- void executeNext();
- void executeStepI();
- void executeNextI();
- void continueInferior();
- void interruptInferior();
- void executeRunToLine(const ContextData &data);
- void executeRunToFunction(const QString &functionName);
- void executeJumpToLine(const ContextData &data);
- void activateFrame(qint64);
- void selectThread(qint64);
- void disassemble(quint64 pc);
- void addBreakpoint(BreakpointModelId id, const BreakpointParameters &bp);
- void removeBreakpoint(BreakpointModelId id);
- void changeBreakpoint(BreakpointModelId id, const BreakpointParameters &bp);
- void requestUpdateWatchData(const WatchData &data,
- const WatchUpdateFlags &flags);
- void fetchFrameSource(qint64 frame);
-
-private:
- bool m_running;
-
- QList<QByteArray> m_arguments;
- QList<QByteArray> m_environment;
- QThread m_wThread;
- LldbEventListener *m_worker;
- lldb::SBDebugger *m_lldb;
- lldb::SBTarget *m_target;
- lldb::SBProcess *m_process;
- lldb::SBListener *m_listener;
-
- lldb::SBFrame m_currentFrame;
- lldb::SBThread m_currentThread;
- bool m_relistFrames;
- QHash<QString, lldb::SBValue> m_localesCache;
- QHash<BreakpointModelId, lldb::SBBreakpoint> m_breakpoints;
- QHash<qint64, QString> m_frame_to_file;
-
- void updateThreads();
- void getWatchDataR(lldb::SBValue v, int level,
- const QByteArray &p_iname, QList<WatchData> &wd);
-
-#if defined(HAVE_LLDB_PRIVATE)
- PythonLLDBToGdbMiHack * py;
-#endif
-
-private slots:
- void lldbEvent(lldb::SBEvent *ev);
-};
-
-} // namespace Internal
-} // namespace Debugger
-
-#endif // DEBUGGER_LLDBENGINE_H
-#define SYNC_INFERIOR
diff --git a/src/plugins/debugger/lldblib/guest/main.cpp b/src/plugins/debugger/lldblib/guest/main.cpp
deleted file mode 100644
index 9803a490f8..0000000000
--- a/src/plugins/debugger/lldblib/guest/main.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "lldbengineguest.h"
-
-#include <QLocalSocket>
-#include <QCoreApplication>
-#include <QSocketNotifier>
-#include <QQueue>
-
-#include <cstdio>
-
-// #define DO_STDIO_DEBUG 1
-#ifdef DO_STDIO_DEBUG
-#define D_STDIO0(x) qDebug(x)
-#define D_STDIO1(x,a1) qDebug(x,a1)
-#define D_STDIO2(x,a1,a2) qDebug(x,a1,a2)
-#define D_STDIO3(x,a1,a2,a3) qDebug(x,a1,a2,a3)
-#else
-#define D_STDIO0(x)
-#define D_STDIO1(x,a1)
-#define D_STDIO2(x,a1,a2)
-#define D_STDIO3(x,a1,a2,a3)
-#endif
-
-class Stdio : public QIODevice
-{
- Q_OBJECT
-public:
- QSocketNotifier notify;
- Stdio()
- : QIODevice()
- , notify(fileno(stdin), QSocketNotifier::Read)
- , buckethead(0)
- {
- setvbuf(stdin , NULL , _IONBF , 0);
- setvbuf(stdout , NULL , _IONBF , 0);
- setOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
- connect(&notify, SIGNAL(activated(int)), this, SLOT(activated()));
- }
- virtual qint64 bytesAvailable () const
- {
- qint64 r = QIODevice::bytesAvailable();
- foreach (const QByteArray &bucket, buckets)
- r += bucket.size();
- r-= buckethead;
- return r;
- }
-
- virtual qint64 readData (char * data, qint64 maxSize)
- {
- D_STDIO1("readData %lli",maxSize);
- qint64 size = maxSize;
- while (size > 0) {
- if (!buckets.size()) {
- D_STDIO1("done prematurely with %lli", maxSize - size);
- return maxSize - size;
- }
- QByteArray &bucket = buckets.head();
- if ((size + buckethead) >= bucket.size()) {
- int d = bucket.size() - buckethead;
- D_STDIO3("read (over bucket) d: %i buckethead: %i bucket.size(): %i",
- d, buckethead, bucket.size());
- memcpy(data, bucket.data() + buckethead, d);
- data += d;
- size -= d;
- buckets.dequeue();
- buckethead = 0;
- } else {
- D_STDIO1("read (in bucket) size: %lli", size);
- memcpy(data, bucket.data() + buckethead, size);
- data += size;
- buckethead += size;
- size = 0;
- }
- }
- D_STDIO1("done with %lli",(maxSize - size));
- return maxSize - size;
- }
-
- virtual qint64 writeData (const char * data, qint64 maxSize)
- {
- return ::write(fileno(stdout), data, maxSize);
- }
-
- QQueue<QByteArray> buckets;
- int buckethead;
-
-private slots:
- void activated()
- {
- QByteArray a;
- a.resize(1000);
- int ret = ::read(fileno(stdin), a.data(), 1000);
- if (ret == 0)
- ::exit(0);
- assert(ret <= 1000);
- D_STDIO1("activated %i", ret);
- a.resize(ret);
- buckets.enqueue(a);
- emit readyRead();
- }
-};
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
- qDebug() << "guest engine operational";
-
- Debugger::Internal::LldbEngineGuest lldb;
-
-
- Stdio stdio;
- lldb.setHostDevice(&stdio);
-
- return app.exec();
-}
-
-extern "C" {
-extern const unsigned char lldbVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:lldb PROJECT:lldb-26" "\n";
-extern const double lldbVersionNumber __attribute__ ((used)) = (double)26.;
-extern const double LLDBVersionNumber __attribute__ ((used)) = (double)26.;
-}
-
-#include "main.moc"
diff --git a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.plist b/src/plugins/debugger/lldblib/guest/qtcreator-lldb.plist
deleted file mode 100644
index c0a3b2beaf..0000000000
--- a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.plist
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleIdentifier</key>
- <string>org.qt-project.qtcreator-lldb</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>Qt Creator LLDB Guest</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>SecTaskAccess</key>
- <array>
- <string>allowed</string>
- <string>safe</string>
- </array>
-</dict>
-</plist>
diff --git a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pri b/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pri
deleted file mode 100644
index f44c3e9c84..0000000000
--- a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-WITH_LLDB = $$(WITH_LLDB)
-macx: !isEmpty(WITH_LLDB) : SUBDIRS += $$PWD/qtcreator-lldb.pro
diff --git a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pro b/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pro
deleted file mode 100644
index b6f5437284..0000000000
--- a/src/plugins/debugger/lldblib/guest/qtcreator-lldb.pro
+++ /dev/null
@@ -1,61 +0,0 @@
-WITH_LLDB = $$(WITH_LLDB)
-
-!macx: error (This can only be built on mac)
-!exists($${WITH_LLDB}/include/lldb/lldb-enumerations.h): error(please see the README for build instructions)
-
-QT = core network
-
-include(../../../../../qtcreator.pri)
-TEMPLATE = app
-CONFIG -= app_bundle
-CONFIG += debug
-TARGET = qtcreator-lldb
-DEPENDPATH += . .. ../.. ../../..
-INCLUDEPATH += . .. ../.. ../../..
-DESTDIR = $$IDE_LIBEXEC_PATH
-
-MOC_DIR=.tmp
-OBJECTS_DIR=.tmp
-
-HEADERS += ../ipcengineguest.h \
- ../debuggerstreamops.h \
- ../breakpoint.h \
- ../watchdata.h \
- ../stackframe.h \
- ../disassemblerlines.h \
- lldbengineguest.h
-
-SOURCES += ../ipcengineguest.cpp \
- ../debuggerstreamops.cpp \
- ../breakpoint.cpp \
- ../watchdata.cpp \
- ../stackframe.cpp \
- ../disassemblerlines.cpp \
- lldbengineguest.cpp \
- main.cpp
-
-
-LIBS += -sectcreate __TEXT __info_plist $$PWD/qtcreator-lldb.plist
-
-POSTL = rm -rf \'$${IDE_LIBEXEC_PATH}/LLDB.framework\' $$escape_expand(\\n\\t) \
- $$QMAKE_COPY_DIR $${WITH_LLDB}/build/Release/* \'$$IDE_LIBEXEC_PATH\' $$escape_expand(\\n\\t) \
- install_name_tool -change '@rpath/LLDB.framework/Versions/A/LLDB' '@executable_path/LLDB.framework/Versions/A/LLDB' $(TARGET) $$escape_expand(\\n\\t) \
- codesign -s lldb_codesign $(TARGET)
-
-!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
-QMAKE_POST_LINK = $$POSTL $$QMAKE_POST_LINK
-silent:QMAKE_POST_LINK = @echo signing $@ && $$QMAKE_POST_LINK
-
-LIBS += -framework Security -framework Python
-
-DEFINES += __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS
-
-INCLUDEPATH += $${WITH_LLDB}/include $${WITH_LLDB}/llvm/include/
-LIBS += -F$${WITH_LLDB}/build/Release -framework LLDB
-
-# include (lldb.pri)
-# DEFINES += HAVE_LLDB_PRIVATE
-# HEADERS += pygdbmiemu.h
-# SOURCES += pygdbmiemu.cpp
-
-
diff --git a/src/plugins/debugger/lldblib/ipcengineguest.cpp b/src/plugins/debugger/lldblib/ipcengineguest.cpp
deleted file mode 100644
index 50ebae4177..0000000000
--- a/src/plugins/debugger/lldblib/ipcengineguest.cpp
+++ /dev/null
@@ -1,637 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "ipcengineguest.h"
-#include "ipcenginehost.h"
-#include "breakpoint.h"
-#include "stackframe.h"
-#include "threaddata.h"
-#include "debuggerstreamops.h"
-
-#include <utils/qtcassert.h>
-
-#include <QLocalSocket>
-
-#include <QSysInfo>
-#include <QDebug>
-#include <QFileInfo>
-#include <QTimer>
-
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::LittleEndian)
-#else
-#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::BigEndian)
-#endif
-
-namespace Debugger {
-namespace Internal {
-
-IPCEngineGuest::IPCEngineGuest()
- : QObject()
- , m_local_host(0)
- , m_nextMessagePayloadSize(0)
- , m_cookie(1)
- , m_device(0)
-{
-}
-
-IPCEngineGuest::~IPCEngineGuest()
-{
-}
-
-void IPCEngineGuest::setLocalHost(IPCEngineHost *host)
-{
- m_local_host = host;
-}
-
-void IPCEngineGuest::setHostDevice(QIODevice *device)
-{
- if (m_device) {
- disconnect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
- delete m_device;
- }
- m_device = device;
- if (m_device)
- connect(m_device, SIGNAL(readyRead()), SLOT(readyRead()));
-}
-
-void IPCEngineGuest::rpcCall(Function f, QByteArray payload)
-{
-#if 0
- if (m_local_host) {
- QMetaObject::invokeMethod(m_local_host,
- "rpcCallback",
- Qt::QueuedConnection,
- Q_ARG(quint64, f),
- Q_ARG(QByteArray, payload));
- } else
-#endif
- if (m_device) {
- {
- QDataStream s(m_device);
- SET_NATIVE_BYTE_ORDER(s);
- s << m_cookie++;
- s << quint64(f);
- s << quint64(payload.size());
- }
- m_device->write(payload);
- m_device->putChar('T');
- QLocalSocket *sock = qobject_cast<QLocalSocket *>(m_device);
- if (sock)
- sock->flush();
- }
-}
-
-void IPCEngineGuest::readyRead()
-{
- if (!m_nextMessagePayloadSize) {
- if (quint64(m_device->bytesAvailable()) < 3 * sizeof(quint64))
- return;
- QDataStream s(m_device);
- SET_NATIVE_BYTE_ORDER(s);
- s >> m_nextMessageCookie;
- s >> m_nextMessageFunction;
- s >> m_nextMessagePayloadSize;
- m_nextMessagePayloadSize += 1; // terminator and "got header" marker
- }
-
- quint64 ba = m_device->bytesAvailable();
- if (ba < m_nextMessagePayloadSize)
- return;
-
- qint64 rrr = m_nextMessagePayloadSize;
- QByteArray payload = m_device->read(rrr);
- if (quint64(payload.size()) != m_nextMessagePayloadSize || !payload.endsWith('T')) {
- qDebug("IPC Error: corrupted frame");
- showMessage(QLatin1String("[guest] IPC Error: corrupted frame"), LogError);
- nuke();
- return;
- }
- payload.chop(1);
- rpcCallback(m_nextMessageFunction, payload);
- m_nextMessagePayloadSize = 0;
-
- if (quint64(m_device->bytesAvailable ()) >= 3 * sizeof(quint64))
- QTimer::singleShot(0, this, SLOT(readyRead()));
-}
-
-void IPCEngineGuest::rpcCallback(quint64 f, QByteArray payload)
-{
- switch (f) {
- default:
- qDebug("IPC Error: unhandled id in host to guest call");
- showMessage(QLatin1String("IPC Error: unhandled id in host to guest call"), LogError);
- nuke();
- break;
- case IPCEngineHost::SetupIPC:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- int version;
- s >> version;
- Q_ASSERT(version == 1);
- }
- break;
- case IPCEngineHost::StateChanged:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 st;
- s >> st;
- m_state = (DebuggerState)st;
- }
- break;
- case IPCEngineHost::SetupEngine:
- setupEngine();
- break;
- case IPCEngineHost::SetupInferior:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- QString executable;
- QStringList arguments;
- QStringList environment;
- s >> executable;
- s >> arguments;
- s >> environment;
- setupInferior(executable, arguments, environment);
- }
- break;
- case IPCEngineHost::RunEngine:
- runEngine();
- break;
- case IPCEngineHost::ShutdownInferior:
- shutdownInferior();
- break;
- case IPCEngineHost::ShutdownEngine:
- shutdownEngine();
- break;
- case IPCEngineHost::DetachDebugger:
- detachDebugger();
- break;
- case IPCEngineHost::ExecuteStep:
- executeStep();
- break;
- case IPCEngineHost::ExecuteStepOut:
- executeStepOut();
- break;
- case IPCEngineHost::ExecuteNext:
- executeNext();
- break;
- case IPCEngineHost::ExecuteStepI:
- executeStepI();
- break;
- case IPCEngineHost::ExecuteNextI:
- executeNextI();
- break;
- case IPCEngineHost::ContinueInferior:
- continueInferior();
- break;
- case IPCEngineHost::InterruptInferior:
- interruptInferior();
- break;
- case IPCEngineHost::ExecuteRunToLine:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- ContextData data;
- s >> data.fileName;
- s >> data.lineNumber;
- executeRunToLine(data);
- }
- break;
- case IPCEngineHost::ExecuteRunToFunction:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- QString functionName;
- s >> functionName;
- executeRunToFunction(functionName);
- }
- break;
- case IPCEngineHost::ExecuteJumpToLine:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- ContextData data;
- s >> data.fileName;
- s >> data.lineNumber;
- executeJumpToLine(data);
- }
- break;
- case IPCEngineHost::ActivateFrame:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 id;
- s >> id;
- activateFrame(id);
- }
- break;
- case IPCEngineHost::SelectThread:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 id;
- s >> id;
- selectThread(id);
- }
- break;
- case IPCEngineHost::Disassemble:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 pc;
- s >> pc;
- disassemble(pc);
- }
- break;
- case IPCEngineHost::AddBreakpoint:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- BreakpointModelId id;
- BreakpointParameters d;
- s >> id;
- s >> d;
- addBreakpoint(id, d);
- }
- break;
- case IPCEngineHost::RemoveBreakpoint:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- BreakpointModelId id;
- s >> id;
- removeBreakpoint(id);
- }
- break;
- case IPCEngineHost::ChangeBreakpoint:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- BreakpointModelId id;
- BreakpointParameters d;
- s >> id;
- s >> d;
- changeBreakpoint(id, d);
- }
- break;
- case IPCEngineHost::RequestUpdateWatchData:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- WatchData data;
- s >> data;
- requestUpdateWatchData(data);
- }
- break;
- case IPCEngineHost::FetchFrameSource:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- qint64 id;
- s >> id;
- fetchFrameSource(id);
- }
- break;
- };
-}
-
-DebuggerState IPCEngineGuest::state() const
-{
- return m_state;
-}
-
-void IPCEngineGuest::notifyEngineSetupOk()
-{
- rpcCall(NotifyEngineSetupOk);
-}
-
-void IPCEngineGuest::notifyEngineSetupFailed()
-{
- rpcCall(NotifyEngineSetupFailed);
-}
-
-void IPCEngineGuest::notifyEngineRunFailed()
-{
- rpcCall(NotifyEngineRunFailed);
-}
-
-void IPCEngineGuest::notifyInferiorSetupOk()
-{
- rpcCall(NotifyInferiorSetupOk);
-}
-
-void IPCEngineGuest::notifyInferiorSetupFailed()
-{
- rpcCall(NotifyInferiorSetupFailed);
-}
-
-void IPCEngineGuest::notifyEngineRunAndInferiorRunOk()
-{
- rpcCall(NotifyEngineRunAndInferiorRunOk);
-}
-
-void IPCEngineGuest::notifyEngineRunAndInferiorStopOk()
-{
- rpcCall(NotifyEngineRunAndInferiorStopOk);
-}
-
-void IPCEngineGuest::notifyInferiorRunRequested()
-{
- rpcCall(NotifyInferiorRunRequested);
-}
-
-void IPCEngineGuest::notifyInferiorRunOk()
-{
- rpcCall(NotifyInferiorRunOk);
-}
-
-void IPCEngineGuest::notifyInferiorRunFailed()
-{
- rpcCall(NotifyInferiorRunFailed);
-}
-
-void IPCEngineGuest::notifyInferiorStopOk()
-{
- rpcCall(NotifyInferiorStopOk);
-}
-
-void IPCEngineGuest::notifyInferiorSpontaneousStop()
-{
- rpcCall(NotifyInferiorSpontaneousStop);
-}
-
-void IPCEngineGuest::notifyInferiorStopFailed()
-{
- rpcCall(NotifyInferiorStopFailed);
-}
-
-void IPCEngineGuest::notifyInferiorExited()
-{
- rpcCall(NotifyInferiorExited);
-}
-
-void IPCEngineGuest::notifyInferiorShutdownOk()
-{
- rpcCall(NotifyInferiorShutdownOk);
-}
-
-void IPCEngineGuest::notifyInferiorShutdownFailed()
-{
- rpcCall(NotifyInferiorShutdownFailed);
-}
-
-void IPCEngineGuest::notifyEngineSpontaneousShutdown()
-{
- rpcCall(NotifyEngineSpontaneousShutdown);
-}
-
-void IPCEngineGuest::notifyEngineShutdownOk()
-{
- rpcCall(NotifyEngineShutdownOk);
-}
-
-void IPCEngineGuest::notifyEngineShutdownFailed()
-{
- rpcCall(NotifyEngineShutdownFailed);
-}
-
-void IPCEngineGuest::notifyInferiorIll()
-{
- rpcCall(NotifyInferiorIll);
-}
-
-void IPCEngineGuest::notifyEngineIll()
-{
- rpcCall(NotifyEngineIll);
-}
-
-void IPCEngineGuest::notifyInferiorPid(qint64 pid)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << pid;
- }
- rpcCall(NotifyInferiorPid, p);
-}
-
-void IPCEngineGuest::showStatusMessage(const QString &msg, quint64 timeout)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << msg;
- s << (qint64)timeout;
- }
- rpcCall(ShowStatusMessage, p);
-}
-
-void IPCEngineGuest::showMessage(const QString &msg, quint16 channel, quint64 timeout)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << msg;
- s << (qint64)channel;
- s << (qint64)timeout;
- }
- rpcCall(ShowMessage, p);
-}
-
-void IPCEngineGuest::currentFrameChanged(qint64 osid)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << osid;
- }
- rpcCall(CurrentFrameChanged, p);
-}
-
-void IPCEngineGuest::currentThreadChanged(qint64 osid)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << osid;
- }
- rpcCall(CurrentThreadChanged, p);
-}
-
-void IPCEngineGuest::listFrames(const StackFrames &frames)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << frames;
- }
- rpcCall(ListFrames, p);
-}
-
-void IPCEngineGuest::listThreads(const Threads &threads)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << threads;
- }
- rpcCall(ListThreads, p);
-}
-
-void IPCEngineGuest::disassembled(quint64 pc, const DisassemblerLines &da)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << pc;
- s << da;
- }
- rpcCall(Disassembled, p);
-}
-
-void IPCEngineGuest::notifyAddBreakpointOk(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyAddBreakpointOk, p);
-}
-
-void IPCEngineGuest::notifyAddBreakpointFailed(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyAddBreakpointFailed, p);
-}
-
-void IPCEngineGuest::notifyRemoveBreakpointOk(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyRemoveBreakpointOk, p);
-}
-
-void IPCEngineGuest::notifyRemoveBreakpointFailed(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyRemoveBreakpointFailed, p);
-}
-
-void IPCEngineGuest::notifyChangeBreakpointOk(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyChangeBreakpointOk, p);
-}
-
-void IPCEngineGuest::notifyChangeBreakpointFailed(BreakpointModelId id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(NotifyChangeBreakpointFailed, p);
-}
-
-void IPCEngineGuest::notifyBreakpointAdjusted(BreakpointModelId id,
- const BreakpointParameters &bp)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id << bp;
- }
- rpcCall(NotifyBreakpointAdjusted, p);
-}
-
-void IPCEngineGuest::updateWatchData(bool fullCycle, const QList<WatchData> &wd)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << fullCycle;
- s << quint64(wd.count());
- for (int i = 0; i < wd.count(); ++i)
- s << wd.at(i);
- }
- rpcCall(UpdateWatchData, p);
-}
-
-void IPCEngineGuest::frameSourceFetched(qint64 id, const QString &name, const QString &source)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- s << name;
- s << source;
- }
- rpcCall(FrameSourceFetched, p);
-}
-
-} // namespace Internal
-} // namespace Debugger
-
-
diff --git a/src/plugins/debugger/lldblib/ipcengineguest.h b/src/plugins/debugger/lldblib/ipcengineguest.h
deleted file mode 100644
index 505328aa85..0000000000
--- a/src/plugins/debugger/lldblib/ipcengineguest.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef IPCENGINEGUEST_H
-#define IPCENGINEGUEST_H
-
-#include <debugger/breakhandler.h>
-#include <debugger/debuggerengine.h>
-#include <debugger/disassemblerlines.h>
-#include <debugger/stackhandler.h>
-#include <debugger/threadshandler.h>
-
-#include <QQueue>
-#include <QThread>
-#include <QVariant>
-
-namespace Debugger {
-namespace Internal {
-
-class IPCEngineHost;
-class IPCEngineGuest : public QObject
-{
- Q_OBJECT
-
-public:
- IPCEngineGuest();
- virtual ~IPCEngineGuest();
-
- void setLocalHost(IPCEngineHost *);
- void setHostDevice(QIODevice *);
-
- virtual void nuke() = 0;
- virtual void setupEngine() = 0;
- virtual void setupInferior(const QString &executeable,
- const QStringList &arguments, const QStringList &environment) = 0;
- virtual void runEngine() = 0;
- virtual void shutdownInferior() = 0;
- virtual void shutdownEngine() = 0;
- virtual void detachDebugger() = 0;
- virtual void executeStep() = 0;
- virtual void executeStepOut() = 0;
- virtual void executeNext() = 0;
- virtual void executeStepI() = 0;
- virtual void executeNextI() = 0;
- virtual void continueInferior() = 0;
- virtual void interruptInferior() = 0;
- virtual void executeRunToLine(const ContextData &data) = 0;
- virtual void executeRunToFunction(const QString &functionName) = 0;
- virtual void executeJumpToLine(const ContextData &data) = 0;
- virtual void activateFrame(qint64 token) = 0;
- virtual void selectThread(qint64 token) = 0;
- virtual void disassemble(quint64 pc) = 0;
- virtual void addBreakpoint(BreakpointModelId id, const BreakpointParameters &bp) = 0;
- virtual void removeBreakpoint(BreakpointModelId id) = 0;
- virtual void changeBreakpoint(BreakpointModelId id, const BreakpointParameters &bp) = 0;
- virtual void requestUpdateWatchData(const WatchData &data,
- const WatchUpdateFlags & flags = WatchUpdateFlags()) = 0;
- virtual void fetchFrameSource(qint64 frame) = 0;
-
- enum Function
- {
- NotifyEngineSetupOk = 1,
- NotifyEngineSetupFailed = 2,
- NotifyEngineRunFailed = 3,
- NotifyInferiorSetupOk = 4,
- NotifyInferiorSetupFailed = 5,
- NotifyEngineRunAndInferiorRunOk = 6,
- NotifyEngineRunAndInferiorStopOk = 7,
- NotifyInferiorRunRequested = 8,
- NotifyInferiorRunOk = 9,
- NotifyInferiorRunFailed = 10,
- NotifyInferiorStopOk = 11,
- NotifyInferiorSpontaneousStop = 12,
- NotifyInferiorStopFailed = 13,
- NotifyInferiorExited = 14,
- NotifyInferiorShutdownOk = 15,
- NotifyInferiorShutdownFailed = 16,
- NotifyEngineSpontaneousShutdown = 17,
- NotifyEngineShutdownOk = 18,
- NotifyEngineShutdownFailed = 19,
- NotifyInferiorIll = 20,
- NotifyEngineIll = 21,
- NotifyInferiorPid = 22,
- ShowStatusMessage = 23,
- ShowMessage = 24,
- CurrentFrameChanged = 25,
- CurrentThreadChanged = 26,
- ListFrames = 27,
- ListThreads = 28,
- Disassembled = 29,
- NotifyAddBreakpointOk = 30,
- NotifyAddBreakpointFailed = 31,
- NotifyRemoveBreakpointOk = 32,
- NotifyRemoveBreakpointFailed = 33,
- NotifyChangeBreakpointOk = 34,
- NotifyChangeBreakpointFailed = 35,
- NotifyBreakpointAdjusted = 36,
- UpdateWatchData = 47,
- FrameSourceFetched = 48
- };
- Q_ENUMS(Function)
-
- DebuggerState state() const;
- void notifyEngineSetupOk();
- void notifyEngineSetupFailed();
- void notifyEngineRunFailed();
- void notifyInferiorSetupOk();
- void notifyInferiorSetupFailed();
- void notifyEngineRunAndInferiorRunOk();
- void notifyEngineRunAndInferiorStopOk();
- void notifyInferiorRunRequested();
- void notifyInferiorRunOk();
- void notifyInferiorRunFailed();
- void notifyInferiorStopOk();
- void notifyInferiorSpontaneousStop();
- void notifyInferiorStopFailed();
- void notifyInferiorExited();
- void notifyInferiorShutdownOk();
- void notifyInferiorShutdownFailed();
- void notifyEngineSpontaneousShutdown();
- void notifyEngineShutdownOk();
- void notifyEngineShutdownFailed();
- void notifyInferiorIll();
- void notifyEngineIll();
- void notifyInferiorPid(qint64 pid);
- void showMessage(const QString &msg, quint16 channel = LogDebug, quint64 timeout = quint64(-1));
- void showStatusMessage(const QString &msg, quint64 timeout = quint64(-1));
-
- void currentFrameChanged(qint64 token);
- void currentThreadChanged(qint64 token);
- void listFrames(const StackFrames &);
- void listThreads(const Threads &);
- void disassembled(quint64 pc, const DisassemblerLines &da);
-
- void notifyAddBreakpointOk(BreakpointModelId id);
- void notifyAddBreakpointFailed(BreakpointModelId id);
- void notifyRemoveBreakpointOk(BreakpointModelId id);
- void notifyRemoveBreakpointFailed(BreakpointModelId id);
- void notifyChangeBreakpointOk(BreakpointModelId id);
- void notifyChangeBreakpointFailed(BreakpointModelId id);
- void notifyBreakpointAdjusted(BreakpointModelId id, const BreakpointParameters &bp);
-
- void updateWatchData(bool fullCycle, const QList<WatchData> &);
-
- void frameSourceFetched(qint64 frame, const QString &name, const QString &sourceCode);
-
- void rpcCall(Function f, QByteArray payload = QByteArray());
-public slots:
- void rpcCallback(quint64 f, QByteArray payload = QByteArray());
-private slots:
- void readyRead();
-private:
- IPCEngineHost *m_local_host;
- quint64 m_nextMessageCookie;
- quint64 m_nextMessageFunction;
- quint64 m_nextMessagePayloadSize;
- quint64 m_cookie;
- QIODevice *m_device;
- DebuggerState m_state;
-};
-
-} // namespace Internal
-} // namespace Debugger
-
-#endif // IPCENGINEGUEST_H
diff --git a/src/plugins/debugger/lldblib/ipcenginehost.cpp b/src/plugins/debugger/lldblib/ipcenginehost.cpp
deleted file mode 100644
index da48218ee3..0000000000
--- a/src/plugins/debugger/lldblib/ipcenginehost.cpp
+++ /dev/null
@@ -1,661 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "ipcenginehost.h"
-
-#include "ipcengineguest.h"
-#include <debugger/debuggerstartparameters.h>
-#include <debugger/breakhandler.h>
-#include <debugger/breakpoint.h>
-#include <debugger/disassemblerlines.h>
-#include <debugger/moduleshandler.h>
-#include <debugger/registerhandler.h>
-#include <debugger/stackhandler.h>
-#include <debugger/watchhandler.h>
-#include <debugger/watchutils.h>
-#include <debugger/threadshandler.h>
-#include <debugger/disassembleragent.h>
-#include <debugger/memoryagent.h>
-#include <debugger/debuggerstreamops.h>
-#include <debugger/debuggercore.h>
-
-#include <utils/qtcassert.h>
-
-#include <QSysInfo>
-#include <QDebug>
-#include <QFileInfo>
-#include <QTimer>
-#include <QLocalSocket>
-
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::LittleEndian)
-#else
-#define SET_NATIVE_BYTE_ORDER(x) x.setByteOrder(QDataStream::BigEndian)
-#endif
-
-namespace Debugger {
-namespace Internal {
-
-IPCEngineHost::IPCEngineHost (const DebuggerStartParameters &startParameters)
- : DebuggerEngine(startParameters)
- , m_localGuest(0)
- , m_nextMessagePayloadSize(0)
- , m_cookie(1)
- , m_device(0)
-{
- connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)), SLOT(m_stateChanged(Debugger::DebuggerState)));
-}
-
-IPCEngineHost::~IPCEngineHost()
-{
- delete m_device;
-}
-
-void IPCEngineHost::setLocalGuest(IPCEngineGuest *guest)
-{
- m_localGuest = guest;
-}
-
-void IPCEngineHost::setGuestDevice(QIODevice *device)
-{
- if (m_device) {
- disconnect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
- delete m_device;
- }
- m_device = device;
- if (m_device)
- connect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
-}
-
-void IPCEngineHost::setupEngine()
-{
- QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
- rpcCall(SetupEngine);
-}
-
-void IPCEngineHost::setupInferior()
-{
- QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << QFileInfo(startParameters().executable).absoluteFilePath();
- s << startParameters().processArgs;
- s << startParameters().environment.toStringList();
- }
- rpcCall(SetupInferior, p);
-}
-
-void IPCEngineHost::runEngine()
-{
- QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
- rpcCall(RunEngine);
-}
-
-void IPCEngineHost::shutdownInferior()
-{
- QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
- rpcCall(ShutdownInferior);
-}
-
-void IPCEngineHost::shutdownEngine()
-{
- rpcCall(ShutdownEngine);
-}
-
-void IPCEngineHost::detachDebugger()
-{
- rpcCall(DetachDebugger);
-}
-
-void IPCEngineHost::executeStep()
-{
- rpcCall(ExecuteStep);
-}
-
-void IPCEngineHost::executeStepOut()
-{
- rpcCall(ExecuteStepOut);
-}
-
-void IPCEngineHost::executeNext()
-{
- rpcCall(ExecuteNext);
-}
-
-void IPCEngineHost::executeStepI()
-{
- rpcCall(ExecuteStepI);
-}
-
-void IPCEngineHost::executeNextI()
-{
- rpcCall(ExecuteNextI);
-}
-
-void IPCEngineHost::continueInferior()
-{
- QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
- resetLocation();
- rpcCall(ContinueInferior);
-}
-
-void IPCEngineHost::interruptInferior()
-{
- QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
- rpcCall(InterruptInferior);
-}
-
-void IPCEngineHost::executeRunToLine(const ContextData &data)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << data.fileName;
- s << quint64(data.lineNumber);
- }
- rpcCall(ExecuteRunToLine, p);
-}
-
-void IPCEngineHost::executeRunToFunction(const QString &functionName)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << functionName;
- }
- rpcCall(ExecuteRunToFunction, p);
-}
-
-void IPCEngineHost::executeJumpToLine(const ContextData &data)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << data.fileName;
- s << quint64(data.lineNumber);
- }
- rpcCall(ExecuteJumpToLine, p);
-}
-
-void IPCEngineHost::activateFrame(int index)
-{
- resetLocation();
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << quint64(index);
- }
- rpcCall(ActivateFrame, p);
-}
-
-void IPCEngineHost::selectThread(ThreadId id)
-{
- resetLocation();
- QTC_ASSERT(id.isValid(), return);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id.raw();
- }
- rpcCall(SelectThread, p);
-}
-
-void IPCEngineHost::fetchDisassembler(DisassemblerAgent *v)
-{
- quint64 address = v->location().address();
- m_frameToDisassemblerAgent.insert(address, v);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << address;
- }
- rpcCall(Disassemble, p);
-}
-
-void IPCEngineHost::insertBreakpoint(BreakpointModelId id)
-{
- breakHandler()->notifyBreakpointInsertProceeding(id);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- s << breakHandler()->breakpointData(id);
- }
- rpcCall(AddBreakpoint, p);
-}
-
-void IPCEngineHost::removeBreakpoint(BreakpointModelId id)
-{
- breakHandler()->notifyBreakpointRemoveProceeding(id);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(RemoveBreakpoint, p);
-}
-
-void IPCEngineHost::changeBreakpoint(BreakpointModelId id)
-{
- breakHandler()->notifyBreakpointChangeProceeding(id);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- s << breakHandler()->breakpointData(id);
- }
- rpcCall(RemoveBreakpoint, p);
-}
-
-void IPCEngineHost::updateWatchData(const WatchData &data,
- const WatchUpdateFlags &flags)
-{
- Q_UNUSED(flags);
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << data;
- }
- rpcCall(RequestUpdateWatchData, p);
-}
-
-void IPCEngineHost::fetchFrameSource(qint64 id)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << id;
- }
- rpcCall(FetchFrameSource, p);
-}
-
-void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
-{
- switch (f) {
- default: {
- showMessage(QLatin1String("IPC Error: unhandled id in guest to host call"));
- const QString logMessage = tr("Fatal engine shutdown. Incompatible binary or IPC error.");
- showMessage(logMessage, LogError);
- showStatusMessage(logMessage);
- }
- nuke();
- break;
- case IPCEngineGuest::NotifyEngineSetupOk:
- notifyEngineSetupOk();
- break;
- case IPCEngineGuest::NotifyEngineSetupFailed:
- notifyEngineSetupFailed();
- break;
- case IPCEngineGuest::NotifyEngineRunFailed:
- notifyEngineRunFailed();
- break;
- case IPCEngineGuest::NotifyInferiorSetupOk:
- attemptBreakpointSynchronization();
- notifyInferiorSetupOk();
- break;
- case IPCEngineGuest::NotifyInferiorSetupFailed:
- notifyInferiorSetupFailed();
- break;
- case IPCEngineGuest::NotifyEngineRunAndInferiorRunOk:
- notifyEngineRunAndInferiorRunOk();
- break;
- case IPCEngineGuest::NotifyEngineRunAndInferiorStopOk:
- notifyEngineRunAndInferiorStopOk();
- break;
- case IPCEngineGuest::NotifyInferiorRunRequested:
- notifyInferiorRunRequested();
- break;
- case IPCEngineGuest::NotifyInferiorRunOk:
- notifyInferiorRunOk();
- break;
- case IPCEngineGuest::NotifyInferiorRunFailed:
- notifyInferiorRunFailed();
- break;
- case IPCEngineGuest::NotifyInferiorStopOk:
- notifyInferiorStopOk();
- break;
- case IPCEngineGuest::NotifyInferiorSpontaneousStop:
- notifyInferiorSpontaneousStop();
- break;
- case IPCEngineGuest::NotifyInferiorStopFailed:
- notifyInferiorStopFailed();
- break;
- case IPCEngineGuest::NotifyInferiorExited:
- notifyInferiorExited();
- break;
- case IPCEngineGuest::NotifyInferiorShutdownOk:
- notifyInferiorShutdownOk();
- break;
- case IPCEngineGuest::NotifyInferiorShutdownFailed:
- notifyInferiorShutdownFailed();
- break;
- case IPCEngineGuest::NotifyEngineSpontaneousShutdown:
- notifyEngineSpontaneousShutdown();
- break;
- case IPCEngineGuest::NotifyEngineShutdownOk:
- notifyEngineShutdownOk();
- break;
- case IPCEngineGuest::NotifyEngineShutdownFailed:
- notifyEngineShutdownFailed();
- break;
- case IPCEngineGuest::NotifyInferiorIll:
- notifyInferiorIll();
- break;
- case IPCEngineGuest::NotifyEngineIll:
- notifyEngineIll();
- break;
- case IPCEngineGuest::NotifyInferiorPid:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 pid;
- s >> pid;
- notifyInferiorPid(pid);
- }
- break;
- case IPCEngineGuest::ShowStatusMessage:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- QString msg;
- qint64 timeout;
- s >> msg;
- s >> timeout;
- showStatusMessage(msg, timeout);
- }
- break;
- case IPCEngineGuest::ShowMessage:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- QString msg;
- qint16 channel;
- qint64 timeout;
- s >> msg;
- s >> channel;
- s >> timeout;
- showMessage(msg, channel, timeout);
- }
- break;
- case IPCEngineGuest::CurrentFrameChanged:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 token;
- s >> token;
-
- resetLocation();
- StackHandler *sh = stackHandler();
- sh->setCurrentIndex(token);
- if (!sh->currentFrame().isUsable() || QFileInfo(sh->currentFrame().file).exists())
- gotoLocation(Location(sh->currentFrame(), true));
- else if (!m_sourceAgents.contains(sh->currentFrame().file))
- fetchFrameSource(token);
- foreach (SourceAgent *agent, m_sourceAgents.values())
- agent->updateLocationMarker();
- }
- break;
- case IPCEngineGuest::CurrentThreadChanged:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 token;
- s >> token;
- threadsHandler()->setCurrentThread(ThreadId(token));
- }
- break;
- case IPCEngineGuest::ListFrames:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- StackFrames frames;
- s >> frames;
- stackHandler()->setFrames(frames);
- }
- break;
- case IPCEngineGuest::ListThreads:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- Threads threads;
- s >> threads;
- threadsHandler()->setThreads(threads);
- }
- break;
- case IPCEngineGuest::Disassembled:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 pc;
- DisassemblerLines lines;
- s >> pc;
- s >> lines;
- DisassemblerAgent *view = m_frameToDisassemblerAgent.take(pc);
- if (view)
- view->setContents(lines);
- }
- break;
- case IPCEngineGuest::UpdateWatchData:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- bool fullCycle;
- qint64 count;
- QList<WatchData> wd;
- s >> fullCycle;
- s >> count;
- for (qint64 i = 0; i < count; ++i) {
- WatchData d;
- s >> d;
- wd.append(d);
- }
- WatchHandler *wh = watchHandler();
- if (!wh)
- break;
- wh->insertData(wd);
- }
- break;
- case IPCEngineGuest::NotifyAddBreakpointOk:
- {
- attemptBreakpointSynchronization();
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointInsertOk(id);
- }
- break;
- case IPCEngineGuest::NotifyAddBreakpointFailed:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointInsertFailed(id);
- }
- break;
- case IPCEngineGuest::NotifyRemoveBreakpointOk:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointRemoveOk(id);
- }
- break;
- case IPCEngineGuest::NotifyRemoveBreakpointFailed:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointRemoveFailed(id);
- }
- break;
- case IPCEngineGuest::NotifyChangeBreakpointOk:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointChangeOk(id);
- }
- break;
- case IPCEngineGuest::NotifyChangeBreakpointFailed:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 d;
- s >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(d);
- breakHandler()->notifyBreakpointChangeFailed(id);
- }
- break;
- case IPCEngineGuest::NotifyBreakpointAdjusted:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- quint64 dd;
- BreakpointParameters d;
- s >> dd >> d;
- BreakpointModelId id = BreakpointModelId::fromInternalId(dd);
- breakHandler()->notifyBreakpointAdjusted(id, d);
- }
- break;
- case IPCEngineGuest::FrameSourceFetched:
- {
- QDataStream s(payload);
- SET_NATIVE_BYTE_ORDER(s);
- qint64 token;
- QString path;
- QString source;
- s >> token >> path >> source;
- SourceAgent *agent = new SourceAgent(this);
- agent->setSourceProducerName(startParameters().connParams.host);
- agent->setContent(path, source);
- m_sourceAgents.insert(path, agent);
- agent->updateLocationMarker();
- }
- break;
- }
-}
-
-void IPCEngineHost::m_stateChanged(Debugger::DebuggerState state)
-{
- QByteArray p;
- {
- QDataStream s(&p, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << (qint64)state;
- }
- rpcCall(StateChanged, p);
-
-}
-
-void IPCEngineHost::rpcCall(Function f, QByteArray payload)
-{
- if (m_localGuest) {
- QMetaObject::invokeMethod(m_localGuest,
- "rpcCallback",
- Qt::QueuedConnection,
- Q_ARG(quint64, f),
- Q_ARG(QByteArray, payload));
- } else if (m_device) {
- QByteArray header;
- {
- QDataStream s(&header, QIODevice::WriteOnly);
- SET_NATIVE_BYTE_ORDER(s);
- s << m_cookie++;
- s << (quint64) f;
- s << (quint64) payload.size();
- }
- m_device->write(header);
- m_device->write(payload);
- m_device->putChar('T');
- QLocalSocket *sock = qobject_cast<QLocalSocket *>(m_device);
- if (sock)
- sock->flush();
- }
-}
-
-void IPCEngineHost::readyRead()
-{
- QDataStream s(m_device);
- SET_NATIVE_BYTE_ORDER(s);
- if (!m_nextMessagePayloadSize) {
- if (quint64(m_device->bytesAvailable ()) < 3 * sizeof(quint64))
- return;
- s >> m_nextMessageCookie;
- s >> m_nextMessageFunction;
- s >> m_nextMessagePayloadSize;
- m_nextMessagePayloadSize += 1; // Terminator and "got header" marker.
- }
-
- quint64 ba = m_device->bytesAvailable();
- if (ba < m_nextMessagePayloadSize)
- return;
-
- QByteArray payload = m_device->read(m_nextMessagePayloadSize - 1);
-
- char terminator;
- m_device->getChar(&terminator);
- if (terminator != 'T') {
- showStatusMessage(tr("Fatal engine shutdown. Incompatible binary or IPC error."));
- showMessage(QLatin1String("IPC Error: terminator missing"));
- nuke();
- return;
- }
- rpcCallback(m_nextMessageFunction, payload);
- m_nextMessagePayloadSize = 0;
- if (quint64(m_device->bytesAvailable()) >= 3 * sizeof(quint64))
- QTimer::singleShot(0, this, SLOT(readyRead()));
-}
-
-} // namespace Internal
-} // namespace Debugger
-
-
diff --git a/src/plugins/debugger/lldblib/ipcenginehost.h b/src/plugins/debugger/lldblib/ipcenginehost.h
deleted file mode 100644
index 92f847ca44..0000000000
--- a/src/plugins/debugger/lldblib/ipcenginehost.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef DEBUGGER_IPCENGINE_HOST_H
-#define DEBUGGER_IPCENGINE_HOST_H
-
-#include <debugger/debuggerengine.h>
-#include <debugger/threadshandler.h>
-#include <debugger/stackhandler.h>
-#include <debugger/breakhandler.h>
-#include <debugger/sourceagent.h>
-
-#include <QQueue>
-#include <QVariant>
-#include <QThread>
-
-namespace Debugger {
-namespace Internal {
-
-class IPCEngineGuest;
-class IPCEngineHost : public DebuggerEngine
-{
- Q_OBJECT
-
-public:
- explicit IPCEngineHost(const DebuggerStartParameters &startParameters);
- ~IPCEngineHost();
-
- // use either one
- void setLocalGuest(IPCEngineGuest *);
- void setGuestDevice(QIODevice *);
-
- enum Function
- {
- SetupIPC = 1,
- StateChanged = 2,
- SetupEngine = 3,
- SetupInferior = 4,
- RunEngine = 5,
- ShutdownInferior = 6,
- ShutdownEngine = 7,
- DetachDebugger = 8,
- ExecuteStep = 9,
- ExecuteStepOut = 10,
- ExecuteNext = 11,
- ExecuteStepI = 12,
- ExecuteNextI = 13,
- ContinueInferior = 14,
- InterruptInferior = 15,
- ExecuteRunToLine = 16,
- ExecuteRunToFunction = 17,
- ExecuteJumpToLine = 18,
- ActivateFrame = 19,
- SelectThread = 20,
- Disassemble = 21,
- AddBreakpoint = 22,
- RemoveBreakpoint = 23,
- ChangeBreakpoint = 24,
- RequestUpdateWatchData = 25,
- FetchFrameSource = 26
- };
- Q_ENUMS(Function)
-
- void setupEngine();
- void setupInferior();
- void runEngine();
- void shutdownInferior();
- void shutdownEngine();
- void detachDebugger();
- void executeStep();
- void executeStepOut() ;
- void executeNext();
- void executeStepI();
- void executeNextI();
- void continueInferior();
- void interruptInferior();
- void executeRunToLine(const ContextData &data);
- void executeRunToFunction(const QString &functionName);
- void executeJumpToLine(const ContextData &data);
- void activateFrame(int index);
- void selectThread(ThreadId index);
- void fetchDisassembler(DisassemblerAgent *);
- bool acceptsBreakpoint(BreakpointModelId) const { return true; } // FIXME
- void insertBreakpoint(BreakpointModelId id);
- void removeBreakpoint(BreakpointModelId id);
- void changeBreakpoint(BreakpointModelId id);
- void updateWatchData(const WatchData &data,
- const WatchUpdateFlags &flags = WatchUpdateFlags());
- void fetchFrameSource(qint64 id);
- bool hasCapability(unsigned) const { return false; }
-
- void rpcCall(Function f, QByteArray payload = QByteArray());
-protected:
- virtual void nuke() = 0;
-public slots:
- void rpcCallback(quint64 f, QByteArray payload = QByteArray());
-private slots:
- void m_stateChanged(Debugger::DebuggerState state);
- void readyRead();
-private:
- IPCEngineGuest *m_localGuest;
- quint64 m_nextMessageCookie;
- quint64 m_nextMessageFunction;
- quint64 m_nextMessagePayloadSize;
- quint64 m_cookie;
- QIODevice *m_device;
- QHash<quint64, DisassemblerAgent *> m_frameToDisassemblerAgent;
- QHash<QString, SourceAgent *> m_sourceAgents;
-};
-
-} // namespace Internal
-} // namespace Debugger
-
-#endif // DEBUGGER_LLDBENGINE_H
diff --git a/src/plugins/debugger/lldblib/lldbenginehost.cpp b/src/plugins/debugger/lldblib/lldbenginehost.cpp
deleted file mode 100644
index 538ba66e12..0000000000
--- a/src/plugins/debugger/lldblib/lldbenginehost.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "lldbenginehost.h"
-
-#include <debugger/debuggerstartparameters.h>
-#include <debugger/debuggeractions.h>
-#include <debugger/debuggerconstants.h>
-#include <debugger/debuggerdialogs.h>
-#include <debugger/debuggerplugin.h>
-#include <debugger/debuggerstringutils.h>
-
-#include <debugger/breakhandler.h>
-#include <debugger/breakpoint.h>
-#include <debugger/moduleshandler.h>
-#include <debugger/registerhandler.h>
-#include <debugger/stackhandler.h>
-#include <debugger/watchhandler.h>
-#include <debugger/watchutils.h>
-#include <debugger/threadshandler.h>
-#include <debugger/disassembleragent.h>
-#include <debugger/memoryagent.h>
-
-#include <coreplugin/icore.h>
-#include <utils/qtcassert.h>
-
-#include <QDebug>
-#include <QProcess>
-#include <QFileInfo>
-#include <QThread>
-#include <QCoreApplication>
-
-namespace Debugger {
-namespace Internal {
-
-SshIODevice::SshIODevice(QSsh::SshRemoteProcessRunner *r)
- : runner(r)
- , buckethead(0)
-{
- setOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
- connect (runner, SIGNAL(processStarted()), this, SLOT(processStarted()));
- connect(runner, SIGNAL(readyReadStandardOutput()), this, SLOT(outputAvailable()));
- connect(runner, SIGNAL(readyReadStandardError()), this, SLOT(errorOutputAvailable()));
-}
-
-SshIODevice::~SshIODevice()
-{
- delete runner;
-}
-
-qint64 SshIODevice::bytesAvailable () const
-{
- qint64 r = QIODevice::bytesAvailable();
- foreach (const QByteArray &bucket, buckets)
- r += bucket.size();
- r-= buckethead;
- return r;
-}
-qint64 SshIODevice::writeData (const char * data, qint64 maxSize)
-{
- if (proc == 0) {
- startupbuffer += QByteArray::fromRawData(data, maxSize);
- return maxSize;
- }
- proc->write(data, maxSize);
- return maxSize;
-}
-qint64 SshIODevice::readData (char * data, qint64 maxSize)
-{
- if (proc == 0)
- return 0;
- qint64 size = maxSize;
- while (size > 0) {
- if (!buckets.size())
- return maxSize - size;
- QByteArray &bucket = buckets.head();
- if ((size + buckethead) >= bucket.size()) {
- int d = bucket.size() - buckethead;
- memcpy(data, bucket.data() + buckethead, d);
- data += d;
- size -= d;
- buckets.dequeue();
- buckethead = 0;
- } else {
- memcpy(data, bucket.data() + buckethead, size);
- data += size;
- buckethead += size;
- size = 0;
- }
- }
- return maxSize - size;
-}
-
-void SshIODevice::processStarted()
-{
- runner->writeDataToProcess(startupbuffer);
-}
-
-void SshIODevice::outputAvailable()
-{
- buckets.enqueue(runner->readAllStandardOutput());
- emit readyRead();
-}
-
-void SshIODevice::errorOutputAvailable()
-{
- fprintf(stderr, "%s", runner->readAllStandardError().data());
-}
-
-
-LldbEngineHost::LldbEngineHost(const DebuggerStartParameters &startParameters)
- :IPCEngineHost(startParameters), m_ssh(0)
-{
- showMessage(QLatin1String("setting up coms"));
- setObjectName(QLatin1String("LLDBEngine"));
-
- if (startParameters.startMode == StartRemoteEngine)
- {
- m_guestProcess = 0;
- QSsh::SshRemoteProcessRunner * const runner = new QSsh::SshRemoteProcessRunner;
- connect (runner, SIGNAL(connectionError(QSsh::SshError)),
- this, SLOT(sshConnectionError(QSsh::SshError)));
- runner->run(startParameters.serverStartScript.toUtf8(), startParameters.connParams);
- setGuestDevice(new SshIODevice(runner));
- } else {
- m_guestProcess = new QProcess(this);
-
- connect(m_guestProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
- this, SLOT(finished(int,QProcess::ExitStatus)));
-
- connect(m_guestProcess, SIGNAL(readyReadStandardError()), this,
- SLOT(stderrReady()));
-
-
- QString a = Core::ICore::resourcePath() + QLatin1String("/qtcreator-lldb");
- if (getenv("QTC_LLDB_GUEST") != 0)
- a = QString::fromLocal8Bit(getenv("QTC_LLDB_GUEST"));
-
- showStatusMessage(QString(QLatin1String("starting %1")).arg(a));
-
- m_guestProcess->start(a, QStringList(), QIODevice::ReadWrite | QIODevice::Unbuffered);
- m_guestProcess->setReadChannel(QProcess::StandardOutput);
-
- if (!m_guestProcess->waitForStarted()) {
- showStatusMessage(tr("qtcreator-lldb failed to start: %1").arg(m_guestProcess->errorString()));
- notifyEngineSpontaneousShutdown();
- return;
- }
-
- setGuestDevice(m_guestProcess);
- }
-}
-
-LldbEngineHost::~LldbEngineHost()
-{
- showMessage(QLatin1String("tear down qtcreator-lldb"));
-
- if (m_guestProcess) {
- disconnect(m_guestProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
- this, SLOT(finished(int,QProcess::ExitStatus)));
-
-
- m_guestProcess->terminate();
- m_guestProcess->kill();
- }
- if (m_ssh && m_ssh->isProcessRunning()) {
- // TODO: openssh doesn't do that
-
- m_ssh->sendSignalToProcess(QSsh::SshRemoteProcess::KillSignal);
- }
-}
-
-void LldbEngineHost::nuke()
-{
- stderrReady();
- showMessage(QLatin1String("Nuke engaged. Bug in Engine/IPC or incompatible IPC versions. "), LogError);
- showStatusMessage(tr("Fatal engine shutdown. Consult debugger log for details."));
- m_guestProcess->terminate();
- m_guestProcess->kill();
- notifyEngineSpontaneousShutdown();
-}
-void LldbEngineHost::sshConnectionError(QSsh::SshError e)
-{
- showStatusMessage(tr("SSH connection error: %1").arg(e));
-}
-
-void LldbEngineHost::finished(int, QProcess::ExitStatus status)
-{
- showMessage(QString(QLatin1String("guest went bye bye. exit status: %1 and code: %2"))
- .arg(status).arg(m_guestProcess->exitCode()), LogError);
- nuke();
-}
-
-void LldbEngineHost::stderrReady()
-{
- fprintf(stderr,"%s", m_guestProcess->readAllStandardError().data());
-}
-
-DebuggerEngine *createLldbLibEngine(const DebuggerStartParameters &startParameters)
-{
- return new LldbEngineHost(startParameters);
-}
-
-} // namespace Internal
-} // namespace Debugger
-
diff --git a/src/plugins/debugger/lldblib/lldbhost.pri b/src/plugins/debugger/lldblib/lldbhost.pri
deleted file mode 100644
index 0e9297d7e3..0000000000
--- a/src/plugins/debugger/lldblib/lldbhost.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-WITH_LLDB = $$(WITH_LLDB)
-
-HEADERS += $$PWD/ipcenginehost.h \
- $$PWD/lldbenginehost.h
-
-SOURCES += $$PWD/ipcenginehost.cpp \
- $$PWD/lldbenginehost.cpp
-
-INCLUDEPATH+=
-
-FORMS +=
-
-RESOURCES +=
-
-!isEmpty(WITH_LLDB) {
- DEFINES += WITH_LLDB
- HEADERS += $$PWD/lldboptionspage.h
- SOURCES += $$PWD/lldboptionspage.cpp
- FORMS += $$PWD/lldboptionspagewidget.ui
-}
diff --git a/src/plugins/debugger/lldblib/lldboptionspage.cpp b/src/plugins/debugger/lldblib/lldboptionspage.cpp
deleted file mode 100644
index 5ce79b33ad..0000000000
--- a/src/plugins/debugger/lldblib/lldboptionspage.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "lldboptionspage.h"
-#include <debugger/debuggerconstants.h>
-#include <debugger/debuggerinternalconstants.h>
-
-#include <coreplugin/icore.h>
-
-#include <QCoreApplication>
-#include <QUrl>
-#include <QTextStream>
-#include <QMessageBox>
-#include <QDesktopServices>
-
-namespace Debugger {
-namespace Internal {
-
-LldbOptionsPageWidget::LldbOptionsPageWidget(QWidget *parent, QSettings *s_)
- : QWidget(parent)
- , s(s_)
-{
- m_ui.setupUi(this);
- load();
-}
-
-void LldbOptionsPageWidget::save()
-{
- s->beginGroup(QLatin1String("LLDB"));
- s->setValue(QLatin1String("enabled"), m_ui.enableLldb->isChecked ());
- s->setValue(QLatin1String("gdbEmu"), m_ui.gdbEmu->isChecked ());
- s->endGroup();
-}
-
-void LldbOptionsPageWidget::load()
-{
- s->beginGroup(QLatin1String("LLDB"));
- m_ui.enableLldb->setChecked(s->value(QLatin1String("enabled"), false).toBool());
- m_ui.gdbEmu->setChecked(s->value(QLatin1String("gdbEmu"), true).toBool());
- s->endGroup();
-}
-
-// ---------- LldbOptionsPage
-LldbOptionsPage::LldbOptionsPage()
-{
- // m_options->fromSettings(Core::ICore::settings());
- setId("F.Lldb");
- setDisplayName(tr("LLDB"));
- setCategory(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("Debugger", Constants::DEBUGGER_SETTINGS_TR_CATEGORY));
- setCategoryIcon(QLatin1String(Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
-}
-
-QWidget *LldbOptionsPage::createPage(QWidget *parent)
-{
- m_widget = new LldbOptionsPageWidget(parent, Core::ICore::settings());
- return m_widget;
-}
-
-void LldbOptionsPage::apply()
-{
- if (!m_widget)
- return;
- m_widget->save();
-}
-
-void LldbOptionsPage::finish()
-{
-}
-
-bool LldbOptionsPage::matches(const QString &s) const
-{
- return QString(s.toLower()).contains(QLatin1String("lldb"));
-}
-
-void addLldbOptionPages(QList<Core::IOptionsPage *> *opts)
-{
- opts->push_back(new LldbOptionsPage);
-}
-
-
-} // namespace Internal
-} // namespace Debugger
diff --git a/src/plugins/debugger/lldblib/lldboptionspagewidget.ui b/src/plugins/debugger/lldblib/lldboptionspagewidget.ui
deleted file mode 100644
index 78e77699f0..0000000000
--- a/src/plugins/debugger/lldblib/lldboptionspagewidget.ui
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Debugger::Internal::LldbOptionsPageWidget</class>
- <widget class="QWidget" name="Debugger::Internal::LldbOptionsPageWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>522</width>
- <height>512</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout"/>
- </item>
- <item>
- <widget class="QGroupBox" name="enableLldb">
- <property name="title">
- <string>Enable LLDB</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="gdbEmu">
- <property name="text">
- <string>Use GDB Python dumpers</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>203</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp
index 8a07d6c6c8..e283f63b52 100644
--- a/src/plugins/debugger/loadcoredialog.cpp
+++ b/src/plugins/debugger/loadcoredialog.cpp
@@ -236,14 +236,17 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
d->forceLocalLabel->setBuddy(d->forceLocalCheckBox);
d->localExecFileName = new PathChooser(this);
+ d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable"));
d->localExecFileName->setExpectedKind(PathChooser::File);
d->localExecFileName->setPromptDialogTitle(tr("Select Executable"));
d->localCoreFileName = new PathChooser(this);
+ d->localCoreFileName->setHistoryCompleter(QLatin1String("Debugger.CoreFile.History"));
d->localCoreFileName->setExpectedKind(PathChooser::File);
d->localCoreFileName->setPromptDialogTitle(tr("Select Core File"));
d->overrideStartScriptFileName = new PathChooser(this);
+ d->overrideStartScriptFileName->setHistoryCompleter(QLatin1String("Debugger.StartupScript.History"));
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
diff --git a/src/plugins/debugger/localsandexpressionsoptionspage.ui b/src/plugins/debugger/localsandexpressionsoptionspage.ui
index ce60b3dfbd..d2b320ddaa 100644
--- a/src/plugins/debugger/localsandexpressionsoptionspage.ui
+++ b/src/plugins/debugger/localsandexpressionsoptionspage.ui
@@ -60,7 +60,7 @@
<item>
<widget class="QCheckBox" name="checkBoxShowStdNamespace">
<property name="toolTip">
- <string>Show 'std::' prefix for types from the standard library.</string>
+ <string>Shows 'std::' prefix for types from the standard library.</string>
</property>
<property name="text">
<string>Show &quot;std::&quot; namespace for types</string>
@@ -70,7 +70,7 @@
<item>
<widget class="QCheckBox" name="checkBoxShowQtNamespace">
<property name="toolTip">
- <string>Show Qt namespace prefix for Qt types. This is only relevant if Qt was configured with '-qtnamespace'.</string>
+ <string>Shows Qt namespace prefix for Qt types. This is only relevant if Qt was configured with '-qtnamespace'.</string>
</property>
<property name="text">
<string>Show Qt's namespace for types</string>
diff --git a/src/plugins/debugger/qml/qmllivetextpreview.cpp b/src/plugins/debugger/qml/qmllivetextpreview.cpp
index 55fe7148f4..081b91fb76 100644
--- a/src/plugins/debugger/qml/qmllivetextpreview.cpp
+++ b/src/plugins/debugger/qml/qmllivetextpreview.cpp
@@ -713,7 +713,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
- Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
+ Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
@@ -734,7 +734,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
{
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
- Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
+ Core::InfoBar *infoBar = editor->baseTextDocument()->infoBar();
infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
}
}
diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
index 93e06d10b8..06aa3b2b49 100644
--- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
+++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
@@ -56,6 +56,7 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
QFormLayout *formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_chooser->setHistoryCompleter(QLatin1String("Debugger.CdbCacheDir.History"));
m_chooser->setMinimumWidth(400);
formLayout->addRow(tr("Path:"), m_chooser);
diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp
index 210528bf13..d944a20b1c 100644
--- a/src/plugins/debugger/sourceagent.cpp
+++ b/src/plugins/debugger/sourceagent.cpp
@@ -137,7 +137,7 @@ void SourceAgent::updateLocationMarker()
QTC_ASSERT(d->editor, return);
if (d->locationMark)
- d->editor->markableInterface()->removeMark(d->locationMark);
+ d->editor->textDocument()->markableInterface()->removeMark(d->locationMark);
delete d->locationMark;
d->locationMark = 0;
if (d->engine->stackHandler()->currentFrame().file == d->path) {
@@ -145,7 +145,7 @@ void SourceAgent::updateLocationMarker()
d->locationMark = new TextEditor::ITextMark(lineNumber);
d->locationMark->setIcon(debuggerCore()->locationMarkIcon());
d->locationMark->setPriority(TextEditor::ITextMark::HighPriority);
- d->editor->markableInterface()->addMark(d->locationMark);
+ d->editor->textDocument()->markableInterface()->addMark(d->locationMark);
QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget());
QTC_ASSERT(plainTextEdit, return);
QTextCursor tc = plainTextEdit->textCursor();
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 23a149dab5..84c50ec6d6 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -1230,8 +1230,10 @@ QStringList WatchModel::typeFormatList(const WatchData &data) const
<< tr("Local 8bit string")
<< tr("UTF16 string")
<< tr("UCS4 string")
- << tr("Array of 10 items")
- << tr("Array of 1000 items");
+ << tr("Array of %1 items").arg(10)
+ << tr("Array of %1 items").arg(100)
+ << tr("Array of %1 items").arg(1000)
+ << tr("Array of %1 items").arg(10000);
if (data.type.contains("char[") || data.type.contains("char ["))
return QStringList()
<< tr("Latin1 string")
diff --git a/src/plugins/designer/cpp/cppsettingspage.cpp b/src/plugins/designer/cpp/cppsettingspage.cpp
index cc24f2ca89..d9ce8aa8c7 100644
--- a/src/plugins/designer/cpp/cppsettingspage.cpp
+++ b/src/plugins/designer/cpp/cppsettingspage.cpp
@@ -89,18 +89,6 @@ void CppSettingsPageWidget::setUiEmbedding(int v)
}
}
-QString CppSettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc) << m_ui.ptrAggregationRadioButton->text()
- << ' ' << m_ui.aggregationButton->text()
- << ' ' << m_ui.multipleInheritanceButton->text()
- << ' ' << m_ui.retranslateCheckBox->text()
- << ' ' << m_ui.includeQtModuleCheckBox->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
// ---------- CppSettingsPage
CppSettingsPage::CppSettingsPage(QObject *parent) : Core::IOptionsPage(parent)
{
@@ -112,12 +100,12 @@ CppSettingsPage::CppSettingsPage(QObject *parent) : Core::IOptionsPage(parent)
setCategoryIcon(QLatin1String(Designer::Constants::SETTINGS_CATEGORY_ICON));
}
-QWidget *CppSettingsPage::createPage(QWidget *parent)
+QWidget *CppSettingsPage::widget()
{
- m_widget = new CppSettingsPageWidget(parent);
- m_widget->setParameters(m_parameters);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new CppSettingsPageWidget;
+ m_widget->setParameters(m_parameters);
+ }
return m_widget;
}
@@ -134,11 +122,7 @@ void CppSettingsPage::apply()
void CppSettingsPage::finish()
{
-}
-
-bool CppSettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/designer/cpp/cppsettingspage.h b/src/plugins/designer/cpp/cppsettingspage.h
index 647c7d7d19..a5a9137bef 100644
--- a/src/plugins/designer/cpp/cppsettingspage.h
+++ b/src/plugins/designer/cpp/cppsettingspage.h
@@ -49,8 +49,6 @@ public:
FormClassWizardGenerationParameters parameters() const;
void setParameters(const FormClassWizardGenerationParameters &p);
- QString searchKeywords() const;
-
private:
int uiEmbedding() const;
void setUiEmbedding(int);
@@ -63,15 +61,13 @@ class CppSettingsPage : public Core::IOptionsPage
public:
explicit CppSettingsPage(QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
private:
QPointer<CppSettingsPageWidget> m_widget;
FormClassWizardGenerationParameters m_parameters;
- QString m_searchKeywords;
};
} // namespace Internal
diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h
index a2f0549d86..a8a80dae52 100644
--- a/src/plugins/designer/formwindoweditor.h
+++ b/src/plugins/designer/formwindoweditor.h
@@ -39,7 +39,6 @@ class QDesignerFormWindowInterface;
QT_END_NAMESPACE
namespace TextEditor {
- class BaseTextDocument;
class PlainTextEditor;
}
diff --git a/src/plugins/designer/gotoslot_test.cpp b/src/plugins/designer/gotoslot_test.cpp
index c4a9cb6466..c8b4d851f0 100644
--- a/src/plugins/designer/gotoslot_test.cpp
+++ b/src/plugins/designer/gotoslot_test.cpp
@@ -67,19 +67,6 @@ public:
{}
};
-QString expectedContentsForFile(const QString &filePath)
-{
- QFileInfo fi(filePath);
- const QString referenceFileName = QLatin1String("reference_") + fi.fileName();
- const QString referenceFilePath = fi.dir().absoluteFilePath(referenceFileName);
-
- Utils::FileReader fileReader;
- const bool isFetchOk = fileReader.fetch(referenceFilePath);
- if (isFetchOk)
- return QString::fromUtf8(fileReader.data());
- return QString();
-}
-
class DocumentContainsFunctionDefinition: protected SymbolVisitor
{
public:
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 9fc0bd8d11..ef40045b38 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -350,7 +350,7 @@ static Document::Ptr addDefinition(const Snapshot &docTable,
//! \todo use the InsertionPointLocator to insert at the correct place.
// (we'll have to extend that class first to do definition insertions)
- const QString contents = editable->textDocument()->contents();
+ const QString contents = editable->textDocument()->plainText();
int column;
editable->convertPosition(contents.length(), line, &column);
editable->gotoLine(*line, column);
diff --git a/src/plugins/designer/settingspage.cpp b/src/plugins/designer/settingspage.cpp
index 7fe793f94c..0d8e4095e5 100644
--- a/src/plugins/designer/settingspage.cpp
+++ b/src/plugins/designer/settingspage.cpp
@@ -51,10 +51,13 @@ SettingsPage::SettingsPage(QDesignerOptionsPageInterface *designerPage) :
setCategoryIcon(QLatin1String(Designer::Constants::SETTINGS_CATEGORY_ICON));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
m_initialized = true;
- return m_designerPage->createPage(parent);
+ if (!m_widget)
+ m_widget = m_designerPage->createPage(0);
+ return m_widget;
+
}
void SettingsPage::apply()
@@ -67,6 +70,7 @@ void SettingsPage::finish()
{
if (m_initialized)
m_designerPage->finish();
+ delete m_widget;
}
SettingsPageProvider::SettingsPageProvider(QObject *parent)
@@ -87,3 +91,43 @@ QList<Core::IOptionsPage *> SettingsPageProvider::pages() const
}
return FormEditorW::instance()->optionsPages();
}
+
+bool SettingsPageProvider::matches(const QString &searchKeyWord) const
+{
+ // to avoid fully initializing designer when typing something in the options' filter edit
+ // we hardcode matching of UI text from the designer pages, which are taken if the designer pages
+ // were not yet loaded
+ // luckily linguist cannot resolve the translated texts, so we do not end up with duplicate
+ // translatable strings for Qt Creator
+ static const struct { const char *context; const char *value; } uitext[] = {
+ {"EmbeddedOptionsPage", "Embedded Design"},
+ {"EmbeddedOptionsPage", "Device Profiles"},
+ {"FormEditorOptionsPage", "Forms"},
+ {"FormEditorOptionsPage", "Preview Zoom"},
+ {"FormEditorOptionsPage", "Default Zoom"},
+ {"FormEditorOptionsPage", "Default Grid"},
+ {"qdesigner_internal::GridPanel", "Visible"},
+ {"qdesigner_internal::GridPanel", "Snap"},
+ {"qdesigner_internal::GridPanel", "Reset"},
+ {"qdesigner_internal::GridPanel", "Grid"},
+ {"qdesigner_internal::GridPanel", "Grid &X"},
+ {"qdesigner_internal::GridPanel", "Grid &Y"},
+ {"PreviewConfigurationWidget", "Print/Preview Configuration"},
+ {"PreviewConfigurationWidget", "Style"},
+ {"PreviewConfigurationWidget", "Style sheet"},
+ {"PreviewConfigurationWidget", "Device skin"},
+ {"TemplateOptionsPage", "Template Paths"},
+ {"qdesigner_internal::TemplateOptionsWidget", "Additional Template Paths"}
+ };
+ static const size_t itemCount = sizeof(uitext)/sizeof(uitext[0]);
+ if (m_keywords.isEmpty()) {
+ m_keywords.reserve(itemCount);
+ for (size_t i = 0; i < itemCount; ++i)
+ m_keywords << QCoreApplication::translate(uitext[i].context, uitext[i].value).remove(QLatin1Char('&'));
+ }
+ foreach (const QString &key, m_keywords) {
+ if (key.contains(searchKeyWord, Qt::CaseInsensitive))
+ return true;
+ }
+ return false;
+}
diff --git a/src/plugins/designer/settingspage.h b/src/plugins/designer/settingspage.h
index 3df347e546..deeff2ca91 100644
--- a/src/plugins/designer/settingspage.h
+++ b/src/plugins/designer/settingspage.h
@@ -32,6 +32,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
QT_BEGIN_NAMESPACE
class QDesignerOptionsPageInterface;
QT_END_NAMESPACE
@@ -48,13 +50,14 @@ class SettingsPage : public Core::IOptionsPage
public:
explicit SettingsPage(QDesignerOptionsPageInterface *designerPage);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
QDesignerOptionsPageInterface *m_designerPage;
bool m_initialized;
+ QPointer<QWidget> m_widget;
};
class SettingsPageProvider : public Core::IOptionsPageProvider
@@ -65,9 +68,11 @@ public:
SettingsPageProvider(QObject *parent = 0);
QList<Core::IOptionsPage *> pages() const;
+ bool matches(const QString &searchKeyWord) const;
private:
mutable bool m_initialized;
+ mutable QStringList m_keywords;
};
} // namespace Internal
diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp
index c87685e1ea..1f0ea56a0f 100644
--- a/src/plugins/fakevim/fakevim_test.cpp
+++ b/src/plugins/fakevim/fakevim_test.cpp
@@ -1902,6 +1902,19 @@ void FakeVimPlugin::test_vim_letter_case()
KEYS("2gUU", " " X "ABC" N "DEF");
KEYS("u", " " X "abc" N "def");
KEYS("<c-r>", " " X "ABC" N "DEF");
+
+ // undo, redo and dot command
+ data.setText(" abcde" N " fgh" N " ijk");
+ KEYS("3l" "<C-V>2l2j" "U", " a" X "BCDe" N " fGH" N " iJK");
+ KEYS("u", " a" X "bcde" N " fgh" N " ijk");
+ KEYS("<C-R>", " a" X "BCDe" N " fGH" N " iJK");
+ KEYS("u", " a" X "bcde" N " fgh" N " ijk");
+ KEYS("h.", " " X "ABCde" N " FGH" N " IJK");
+ KEYS("u", " " X "abcde" N " fgh" N " ijk");
+ KEYS("h.", " " X " ABcde" N " FGh" N " IJk");
+ KEYS("u", " " X " abcde" N " fgh" N " ijk");
+ KEYS("j.", " abcde" N " " X " FGh" N " IJk");
+ KEYS("u", " abcde" N " " X " fgh" N " ijk");
}
void FakeVimPlugin::test_vim_code_autoindent()
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index ed6513da0a..8d247ccda0 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -705,6 +705,33 @@ static void setClipboardData(const QString &content, RangeMode mode,
clipboard->setMimeData(data, clipboardMode);
}
+static QByteArray toLocalEncoding(const QString &text)
+{
+ return HostOsInfo::isWindowsHost() ? QString(text).replace(_("\n"), _("\r\n")).toLocal8Bit()
+ : text.toLocal8Bit();
+}
+
+static QString fromLocalEncoding(const QByteArray &data)
+{
+ return HostOsInfo::isWindowsHost() ? QString::fromLocal8Bit(data).replace(_("\n"), _("\r\n"))
+ : QString::fromLocal8Bit(data);
+}
+
+static QString getProcessOutput(const QString &command, const QString &input)
+{
+ QProcess proc;
+ proc.start(command);
+ proc.waitForStarted();
+ proc.write(toLocalEncoding(input));
+ proc.closeWriteChannel();
+
+ // FIXME: Process should be interruptable by user.
+ // Solution is to create a QObject for each process and emit finished state.
+ proc.waitForFinished();
+
+ return fromLocalEncoding(proc.readAllStandardOutput());
+}
+
static const QMap<QString, int> &vimKeyNames()
{
static QMap<QString, int> k;
@@ -816,6 +843,11 @@ QString Range::toString() const
.arg(rangemode);
}
+bool Range::isValid() const
+{
+ return beginPos >= 0 && endPos >= 0;
+}
+
QDebug operator<<(QDebug ts, const Range &range)
{
return ts << '[' << range.beginPos << ',' << range.endPos << ']';
@@ -4239,7 +4271,9 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
g.submode = CapitalZSubMode;
} else if ((input.is('~') || input.is('u') || input.is('U'))) {
g.movetype = MoveExclusive;
+ pushUndoState();
if (isVisualMode()) {
+ setDotCommand(visualDotCommand() + QString::number(count()) + input.raw());
if (isVisualLineMode())
g.rangemode = RangeLineMode;
else if (isVisualBlockMode())
@@ -4253,7 +4287,6 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
g.submode = UpCaseSubMode;
finishMovement();
} else if (g.gflag || (input.is('~') && hasConfig(ConfigTildeOp))) {
- pushUndoState();
if (atEndOfLine())
moveLeft();
setAnchor();
@@ -5049,9 +5082,6 @@ bool FakeVimHandler::Private::parseExCommmand(QString *line, ExCommand *cmd)
if (line->isEmpty())
return false;
- // remove leading colons and spaces
- line->remove(QRegExp(_("^\\s*(:+\\s*)*")));
-
// parse range first
if (!parseLineRange(line, cmd))
return false;
@@ -5104,6 +5134,15 @@ bool FakeVimHandler::Private::parseExCommmand(QString *line, ExCommand *cmd)
bool FakeVimHandler::Private::parseLineRange(QString *line, ExCommand *cmd)
{
+ // remove leading colons and spaces
+ line->remove(QRegExp(_("^\\s*(:+\\s*)*")));
+
+ // special case ':!...' (use invalid range)
+ if (line->startsWith(QLatin1Char('!'))) {
+ cmd->range = Range();
+ return true;
+ }
+
// FIXME: that seems to be different for %w and %s
if (line->startsWith(QLatin1Char('%')))
line->replace(0, 1, _("1,$"));
@@ -5666,22 +5705,15 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
if (!cmd.cmd.isEmpty() || !cmd.hasBang)
return false;
- setCurrentRange(cmd.range);
- int targetPosition = firstPositionInLine(lineForPosition(cmd.range.beginPos));
- QString command = QString(cmd.cmd.mid(1) + QLatin1Char(' ') + cmd.args).trimmed();
- QString text = selectText(cmd.range);
- QProcess proc;
- proc.start(command);
- proc.waitForStarted();
- if (HostOsInfo::isWindowsHost())
- text.replace(_("\n"), _("\r\n"));
- proc.write(text.toUtf8());
- proc.closeWriteChannel();
- proc.waitForFinished();
- QString result = QString::fromUtf8(proc.readAllStandardOutput());
- if (text.isEmpty()) {
- emit q->extraInformationChanged(result);
- } else {
+ bool replaceText = cmd.range.isValid();
+ const QString command = QString(cmd.cmd.mid(1) + QLatin1Char(' ') + cmd.args).trimmed();
+ const QString input = replaceText ? selectText(cmd.range) : QString();
+
+ const QString result = getProcessOutput(command, input);
+
+ if (replaceText) {
+ setCurrentRange(cmd.range);
+ int targetPosition = firstPositionInLine(lineForPosition(cmd.range.beginPos));
beginEditBlock();
removeText(currentRange());
insertText(result);
@@ -5690,8 +5722,11 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
leaveVisualMode();
//qDebug() << "FILTER: " << command;
showMessage(MessageInfo, FakeVimHandler::tr("%n lines filtered.", 0,
- text.count(QLatin1Char('\n'))));
+ input.count(QLatin1Char('\n'))));
+ } else if (!result.isEmpty()) {
+ emit q->extraInformationChanged(result);
}
+
return true;
}
diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h
index 3af38bd8b7..e6a1320b5a 100644
--- a/src/plugins/fakevim/fakevimhandler.h
+++ b/src/plugins/fakevim/fakevimhandler.h
@@ -52,6 +52,7 @@ struct Range
Range();
Range(int b, int e, RangeMode m = RangeCharMode);
QString toString() const;
+ bool isValid() const;
int beginPos;
int endPos;
diff --git a/src/plugins/fakevim/fakevimoptions.ui b/src/plugins/fakevim/fakevimoptions.ui
index 8974f2ae0c..6f5d21d6b1 100644
--- a/src/plugins/fakevim/fakevimoptions.ui
+++ b/src/plugins/fakevim/fakevimoptions.ui
@@ -92,7 +92,7 @@
<item row="6" column="1">
<widget class="QCheckBox" name="checkBoxPassControlKey">
<property name="toolTip">
- <string>Pass key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.</string>
+ <string>Passes key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.</string>
</property>
<property name="text">
<string>Pass control key</string>
@@ -123,7 +123,7 @@
<item row="7" column="0">
<widget class="QCheckBox" name="checkBoxPassKeys">
<property name="toolTip">
- <string>Let Qt Creator handle some key presses in insert mode so that code can be properly completed and expanded.</string>
+ <string>Lets Qt Creator handle some key presses in insert mode so that code can be properly completed and expanded.</string>
</property>
<property name="text">
<string>Pass keys in insert mode</string>
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index b94bfe697c..7dddb52914 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -87,6 +87,7 @@
#include <QFileDialog>
#include <QtPlugin>
#include <QObject>
+#include <QPointer>
#include <QSettings>
#include <QStackedWidget>
#include <QTextStream>
@@ -234,10 +235,9 @@ public:
setCategoryIcon(_(SETTINGS_CATEGORY_FAKEVIM_ICON));
}
- QWidget *createPage(QWidget *parent);
- void apply() { m_group.apply(ICore::settings()); }
- void finish() { m_group.finish(); }
- virtual bool matches(const QString &) const;
+ QWidget *widget();
+ void apply();
+ void finish();
private slots:
void copyTextEditorSettings();
@@ -248,113 +248,98 @@ private slots:
private:
friend class DebuggerPlugin;
+ QPointer<QWidget> m_widget;
Ui::FakeVimOptionPage m_ui;
- QString m_searchKeywords;
Utils::SavedActionSet m_group;
};
-QWidget *FakeVimOptionPage::createPage(QWidget *parent)
-{
- QWidget *w = new QWidget(parent);
- m_ui.setupUi(w);
- const QString vimrcDefault = Utils::HostOsInfo::isAnyUnixHost() ?
- QLatin1String("$HOME/.vimrc") : QLatin1String("%USERPROFILE%\\_vimrc");
- m_ui.lineEditVimRcPath->setPlaceholderText(tr("Default: %1").arg(vimrcDefault));
-
- m_group.clear();
- m_group.insert(theFakeVimSetting(ConfigUseFakeVim),
- m_ui.checkBoxUseFakeVim);
- m_group.insert(theFakeVimSetting(ConfigReadVimRc),
- m_ui.checkBoxReadVimRc);
- m_group.insert(theFakeVimSetting(ConfigVimRcPath),
- m_ui.lineEditVimRcPath);
-
- m_group.insert(theFakeVimSetting(ConfigExpandTab),
- m_ui.checkBoxExpandTab);
- m_group.insert(theFakeVimSetting(ConfigHlSearch),
- m_ui.checkBoxHlSearch);
- m_group.insert(theFakeVimSetting(ConfigShiftWidth),
- m_ui.spinBoxShiftWidth);
- m_group.insert(theFakeVimSetting(ConfigShowMarks),
- m_ui.checkBoxShowMarks);
-
- m_group.insert(theFakeVimSetting(ConfigSmartTab),
- m_ui.checkBoxSmartTab);
- m_group.insert(theFakeVimSetting(ConfigStartOfLine),
- m_ui.checkBoxStartOfLine);
- m_group.insert(theFakeVimSetting(ConfigPassKeys),
- m_ui.checkBoxPassKeys);
- m_group.insert(theFakeVimSetting(ConfigTabStop),
- m_ui.spinBoxTabStop);
- m_group.insert(theFakeVimSetting(ConfigScrollOff),
- m_ui.spinBoxScrollOff);
- m_group.insert(theFakeVimSetting(ConfigBackspace),
- m_ui.lineEditBackspace);
- m_group.insert(theFakeVimSetting(ConfigIsKeyword),
- m_ui.lineEditIsKeyword);
-
- m_group.insert(theFakeVimSetting(ConfigPassControlKey),
- m_ui.checkBoxPassControlKey);
- m_group.insert(theFakeVimSetting(ConfigAutoIndent),
- m_ui.checkBoxAutoIndent);
- m_group.insert(theFakeVimSetting(ConfigSmartIndent),
- m_ui.checkBoxSmartIndent);
-
- m_group.insert(theFakeVimSetting(ConfigIncSearch),
- m_ui.checkBoxIncSearch);
- m_group.insert(theFakeVimSetting(ConfigUseCoreSearch),
- m_ui.checkBoxUseCoreSearch);
- m_group.insert(theFakeVimSetting(ConfigSmartCase),
- m_ui.checkBoxSmartCase);
- m_group.insert(theFakeVimSetting(ConfigIgnoreCase),
- m_ui.checkBoxIgnoreCase);
- m_group.insert(theFakeVimSetting(ConfigWrapScan),
- m_ui.checkBoxWrapScan);
-
- m_group.insert(theFakeVimSetting(ConfigShowCmd),
- m_ui.checkBoxShowCmd);
-
- connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
- SLOT(copyTextEditorSettings()));
- connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
- SLOT(setQtStyle()));
- connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
- SLOT(setPlainStyle()));
- connect(m_ui.pushButtonVimRcPath, SIGNAL(clicked()),
- SLOT(openVimRc()));
- connect(m_ui.checkBoxReadVimRc, SIGNAL(stateChanged(int)),
- SLOT(updateVimRcWidgets()));
- updateVimRcWidgets();
-
- if (m_searchKeywords.isEmpty()) {
- QLatin1Char sep(' ');
- QTextStream(&m_searchKeywords)
- << sep << m_ui.checkBoxUseFakeVim->text()
- << sep << m_ui.checkBoxReadVimRc->text()
- << sep << m_ui.checkBoxAutoIndent->text()
- << sep << m_ui.checkBoxSmartIndent->text()
- << sep << m_ui.checkBoxExpandTab->text()
- << sep << m_ui.checkBoxSmartTab->text()
- << sep << m_ui.checkBoxHlSearch->text()
- << sep << m_ui.checkBoxIncSearch->text()
- << sep << m_ui.checkBoxStartOfLine->text()
- << sep << m_ui.checkBoxUseCoreSearch->text()
- << sep << m_ui.checkBoxSmartCase->text()
- << sep << m_ui.checkBoxShowMarks->text()
- << sep << m_ui.checkBoxPassControlKey->text()
- << sep << m_ui.checkBoxPassKeys->text()
- << sep << m_ui.checkBoxIgnoreCase->text()
- << sep << m_ui.checkBoxWrapScan->text()
- << sep << m_ui.checkBoxShowCmd->text()
- << sep << m_ui.labelShiftWidth->text()
- << sep << m_ui.labelTabulator->text()
- << sep << m_ui.labelBackspace->text()
- << sep << m_ui.labelIsKeyword->text()
- << sep << m_ui.labelScrollOff->text()
- << sep << m_ui.lineEditVimRcPath->text();
- m_searchKeywords.remove(QLatin1Char('&'));
+QWidget *FakeVimOptionPage::widget()
+{
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
+ const QString vimrcDefault = Utils::HostOsInfo::isAnyUnixHost() ?
+ QLatin1String("$HOME/.vimrc") : QLatin1String("%USERPROFILE%\\_vimrc");
+ m_ui.lineEditVimRcPath->setPlaceholderText(tr("Default: %1").arg(vimrcDefault));
+
+ m_group.clear();
+ m_group.insert(theFakeVimSetting(ConfigUseFakeVim),
+ m_ui.checkBoxUseFakeVim);
+ m_group.insert(theFakeVimSetting(ConfigReadVimRc),
+ m_ui.checkBoxReadVimRc);
+ m_group.insert(theFakeVimSetting(ConfigVimRcPath),
+ m_ui.lineEditVimRcPath);
+
+ m_group.insert(theFakeVimSetting(ConfigExpandTab),
+ m_ui.checkBoxExpandTab);
+ m_group.insert(theFakeVimSetting(ConfigHlSearch),
+ m_ui.checkBoxHlSearch);
+ m_group.insert(theFakeVimSetting(ConfigShiftWidth),
+ m_ui.spinBoxShiftWidth);
+ m_group.insert(theFakeVimSetting(ConfigShowMarks),
+ m_ui.checkBoxShowMarks);
+
+ m_group.insert(theFakeVimSetting(ConfigSmartTab),
+ m_ui.checkBoxSmartTab);
+ m_group.insert(theFakeVimSetting(ConfigStartOfLine),
+ m_ui.checkBoxStartOfLine);
+ m_group.insert(theFakeVimSetting(ConfigPassKeys),
+ m_ui.checkBoxPassKeys);
+ m_group.insert(theFakeVimSetting(ConfigTabStop),
+ m_ui.spinBoxTabStop);
+ m_group.insert(theFakeVimSetting(ConfigScrollOff),
+ m_ui.spinBoxScrollOff);
+ m_group.insert(theFakeVimSetting(ConfigBackspace),
+ m_ui.lineEditBackspace);
+ m_group.insert(theFakeVimSetting(ConfigIsKeyword),
+ m_ui.lineEditIsKeyword);
+
+ m_group.insert(theFakeVimSetting(ConfigPassControlKey),
+ m_ui.checkBoxPassControlKey);
+ m_group.insert(theFakeVimSetting(ConfigAutoIndent),
+ m_ui.checkBoxAutoIndent);
+ m_group.insert(theFakeVimSetting(ConfigSmartIndent),
+ m_ui.checkBoxSmartIndent);
+
+ m_group.insert(theFakeVimSetting(ConfigIncSearch),
+ m_ui.checkBoxIncSearch);
+ m_group.insert(theFakeVimSetting(ConfigUseCoreSearch),
+ m_ui.checkBoxUseCoreSearch);
+ m_group.insert(theFakeVimSetting(ConfigSmartCase),
+ m_ui.checkBoxSmartCase);
+ m_group.insert(theFakeVimSetting(ConfigIgnoreCase),
+ m_ui.checkBoxIgnoreCase);
+ m_group.insert(theFakeVimSetting(ConfigWrapScan),
+ m_ui.checkBoxWrapScan);
+
+ m_group.insert(theFakeVimSetting(ConfigShowCmd),
+ m_ui.checkBoxShowCmd);
+
+ connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
+ SLOT(copyTextEditorSettings()));
+ connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
+ SLOT(setQtStyle()));
+ connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
+ SLOT(setPlainStyle()));
+ connect(m_ui.pushButtonVimRcPath, SIGNAL(clicked()),
+ SLOT(openVimRc()));
+ connect(m_ui.checkBoxReadVimRc, SIGNAL(stateChanged(int)),
+ SLOT(updateVimRcWidgets()));
+ updateVimRcWidgets();
+
}
- return w;
+ return m_widget;
+}
+
+void FakeVimOptionPage::apply()
+{
+ m_group.apply(ICore::settings());
+}
+
+void FakeVimOptionPage::finish()
+{
+ m_group.finish();
+ delete m_widget;
}
void FakeVimOptionPage::copyTextEditorSettings()
@@ -411,11 +396,6 @@ void FakeVimOptionPage::updateVimRcWidgets()
m_ui.pushButtonVimRcPath->setEnabled(enabled);
}
-bool FakeVimOptionPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
//const char *FAKEVIM_CONTEXT = "FakeVim";
///////////////////////////////////////////////////////////////////////
@@ -441,7 +421,7 @@ public:
setCategoryIcon(_(SETTINGS_CATEGORY_FAKEVIM_ICON));
}
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void initialize();
ExCommandMap &exCommandMap();
ExCommandMap &defaultExCommandMap();
@@ -457,9 +437,9 @@ private:
FakeVimPluginPrivate *m_q;
};
-QWidget *FakeVimExCommandsPage::createPage(QWidget *parent)
+QWidget *FakeVimExCommandsPage::widget()
{
- QWidget *w = CommandMappings::createPage(parent);
+ QWidget *w = CommandMappings::widget();
setPageTitle(tr("Ex Command Mapping"));
setTargetHeader(tr("Ex Trigger Expression"));
setTargetLabelText(tr("Regular expression:"));
@@ -666,37 +646,41 @@ public:
void apply();
void finish() {}
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void initialize() {}
UserCommandMap &userCommandMap();
UserCommandMap &defaultUserCommandMap();
private:
FakeVimPluginPrivate *m_q;
+ QPointer<QGroupBox> m_widget;
};
-QWidget *FakeVimUserCommandsPage::createPage(QWidget *parent)
+QWidget *FakeVimUserCommandsPage::widget()
{
- QGroupBox *box = new QGroupBox(parent);
-
- FakeVimUserCommandsModel *model = new FakeVimUserCommandsModel(m_q);
- QTreeView *widget = new QTreeView;
- widget->setModel(model);
- widget->resizeColumnToContents(0);
+ if (!m_widget) {
+ m_widget = new QGroupBox;
- FakeVimUserCommandsDelegate *delegate = new FakeVimUserCommandsDelegate(widget);
- widget->setItemDelegateForColumn(1, delegate);
+ FakeVimUserCommandsModel *model = new FakeVimUserCommandsModel(m_q);
+ QTreeView *widget = new QTreeView;
+ model->setParent(widget);
+ widget->setModel(model);
+ widget->resizeColumnToContents(0);
- QGridLayout *layout = new QGridLayout(box);
- layout->addWidget(widget, 0, 0);
- box->setLayout(layout);
+ FakeVimUserCommandsDelegate *delegate = new FakeVimUserCommandsDelegate(widget);
+ widget->setItemDelegateForColumn(1, delegate);
- return box;
+ QGridLayout *layout = new QGridLayout(m_widget);
+ layout->addWidget(widget, 0, 0);
+ m_widget->setLayout(layout);
+ }
+ return m_widget;
}
void FakeVimUserCommandsPage::apply()
{
//m_q->writeSettings();
+ delete m_widget;
}
diff --git a/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp b/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp
index be2dba58b7..1efe079f6a 100644
--- a/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp
+++ b/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp
@@ -31,10 +31,10 @@
#include "genericprojectwizard.h"
#include "genericprojectconstants.h"
-#include "selectablefilesmodel.h"
#include <coreplugin/mimedatabase.h>
#include <coreplugin/icore.h>
+#include <projectexplorer/selectablefilesmodel.h>
#include <QVBoxLayout>
#include <QLineEdit>
@@ -117,12 +117,12 @@ void FilesSelectionWizardPage::initializePage()
{
m_view->setModel(0);
delete m_model;
- m_model = new SelectableFilesModel(m_genericProjectWizardDialog->path(), this);
+ m_model = new ProjectExplorer::SelectableFilesModel(this);
connect(m_model, SIGNAL(parsingProgress(QString)),
this, SLOT(parsingProgress(QString)));
connect(m_model, SIGNAL(parsingFinished()),
this, SLOT(parsingFinished()));
- m_model->startParsing();
+ m_model->startParsing(m_genericProjectWizardDialog->path());
m_hideFilesFilterLabel->setVisible(false);
m_hideFilesfilterLineEdit->setVisible(false);
@@ -139,7 +139,6 @@ void FilesSelectionWizardPage::initializePage()
void FilesSelectionWizardPage::cleanupPage()
{
m_model->cancel();
- m_model->waitForFinished();
}
void FilesSelectionWizardPage::parsingProgress(const QString &text)
diff --git a/src/plugins/genericprojectmanager/filesselectionwizardpage.h b/src/plugins/genericprojectmanager/filesselectionwizardpage.h
index 0d9c36348a..8085944830 100644
--- a/src/plugins/genericprojectmanager/filesselectionwizardpage.h
+++ b/src/plugins/genericprojectmanager/filesselectionwizardpage.h
@@ -39,11 +39,14 @@ class QTreeView;
class QLineEdit;
QT_END_NAMESPACE
+namespace ProjectExplorer {
+ class SelectableFilesModel;
+}
+
namespace GenericProjectManager {
namespace Internal {
class GenericProjectWizardDialog;
-class SelectableFilesModel;
class FilesSelectionWizardPage : public QWizardPage
{
@@ -68,7 +71,7 @@ private:
void createApplyButton(QVBoxLayout *layout);
GenericProjectWizardDialog *m_genericProjectWizardDialog;
- SelectableFilesModel *m_model;
+ ProjectExplorer::SelectableFilesModel *m_model;
QLabel *m_hideFilesFilterLabel;
QLineEdit *m_hideFilesfilterLineEdit;
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index ad39fa8f05..d12f2f2497 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -69,6 +69,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName)
{
+ setId(Constants::GENERICPROJECT_ID);
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
@@ -264,7 +265,7 @@ void GenericProject::refresh(RefreshOptions options)
}
part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11
- part->defines += m_defines;
+ part->projectDefines += m_defines;
// ### add _defines.
@@ -357,11 +358,6 @@ QString GenericProject::displayName() const
return m_projectName;
}
-Id GenericProject::id() const
-{
- return Id(Constants::GENERICPROJECT_ID);
-}
-
IDocument *GenericProject::document() const
{
return m_creatorIDocument;
diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h
index 70d1f09608..91a2a53eff 100644
--- a/src/plugins/genericprojectmanager/genericproject.h
+++ b/src/plugins/genericprojectmanager/genericproject.h
@@ -60,7 +60,6 @@ public:
QString configFileName() const;
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
@@ -82,9 +81,6 @@ public:
void refresh(RefreshOptions options);
- QStringList includePaths() const;
- void setIncludePaths(const QStringList &includePaths);
-
QByteArray defines() const;
QStringList projectIncludePaths() const;
QStringList files() const;
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
index 287ce30563..531cd516a5 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
@@ -50,20 +50,21 @@ namespace Internal {
//
////////////////////////////////////////////////////////////////////////////////////////
-ProjectFilesFactory::ProjectFilesFactory(Manager *manager, TextEditorActionHandler *handler)
- : Core::IEditorFactory(manager),
- m_actionHandler(handler)
+ProjectFilesFactory::ProjectFilesFactory(Manager *manager)
+ : Core::IEditorFactory(manager)
{
setId(Constants::FILES_EDITOR_ID);
setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor"));
addMimeType(Constants::FILES_MIMETYPE);
addMimeType(Constants::INCLUDES_MIMETYPE);
addMimeType(Constants::CONFIG_MIMETYPE);
+ new TextEditor::TextEditorActionHandler(this, Constants::C_FILESEDITOR);
+
}
Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
{
- ProjectFilesEditorWidget *ed = new ProjectFilesEditorWidget(parent, this, m_actionHandler);
+ ProjectFilesEditorWidget *ed = new ProjectFilesEditorWidget(parent, this);
TextEditorSettings::initializeEditor(ed);
return ed->editor();
}
@@ -94,8 +95,7 @@ Core::IEditor *ProjectFilesEditor::duplicate(QWidget *parent)
{
ProjectFilesEditorWidget *parentEditor = qobject_cast<ProjectFilesEditorWidget *>(editorWidget());
ProjectFilesEditorWidget *editor = new ProjectFilesEditorWidget(parent,
- parentEditor->factory(),
- parentEditor->actionHandler());
+ parentEditor->factory());
TextEditorSettings::initializeEditor(editor);
return editor->editor();
}
@@ -106,16 +106,12 @@ Core::IEditor *ProjectFilesEditor::duplicate(QWidget *parent)
//
////////////////////////////////////////////////////////////////////////////////////////
-ProjectFilesEditorWidget::ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory,
- TextEditorActionHandler *handler)
+ProjectFilesEditorWidget::ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory)
: BaseTextEditorWidget(parent),
- m_factory(factory),
- m_actionHandler(handler)
+ m_factory(factory)
{
QSharedPointer<BaseTextDocument> doc(new BaseTextDocument());
setBaseTextDocument(doc);
-
- handler->setupActions(this);
}
ProjectFilesFactory *ProjectFilesEditorWidget::factory() const
@@ -123,11 +119,6 @@ ProjectFilesFactory *ProjectFilesEditorWidget::factory() const
return m_factory;
}
-TextEditorActionHandler *ProjectFilesEditorWidget::actionHandler() const
-{
- return m_actionHandler;
-}
-
BaseTextEditor *ProjectFilesEditorWidget::createEditor()
{
return new ProjectFilesEditor(this);
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
index 75014f8060..61cd858cde 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
@@ -35,10 +35,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
-namespace TextEditor {
-class TextEditorActionHandler;
-}
-
namespace GenericProjectManager {
namespace Internal {
@@ -52,12 +48,9 @@ class ProjectFilesFactory: public Core::IEditorFactory
Q_OBJECT
public:
- ProjectFilesFactory(Manager *manager, TextEditor::TextEditorActionHandler *handler);
+ ProjectFilesFactory(Manager *manager);
Core::IEditor *createEditor(QWidget *parent);
-
-private:
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
class ProjectFilesEditor : public TextEditor::BaseTextEditor
@@ -77,16 +70,13 @@ class ProjectFilesEditorWidget : public TextEditor::BaseTextEditorWidget
Q_OBJECT
public:
- ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory,
- TextEditor::TextEditorActionHandler *handler);
+ ProjectFilesEditorWidget(QWidget *parent, ProjectFilesFactory *factory);
ProjectFilesFactory *factory() const;
- TextEditor::TextEditorActionHandler *actionHandler() const;
TextEditor::BaseTextEditor *createEditor();
private:
ProjectFilesFactory *m_factory;
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.pro b/src/plugins/genericprojectmanager/genericprojectmanager.pro
index 65528bcb6c..3ccecd9f86 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.pro
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.pro
@@ -10,7 +10,6 @@ HEADERS = genericproject.h \
pkgconfigtool.h \
genericmakestep.h \
genericbuildconfiguration.h \
- selectablefilesmodel.h \
filesselectionwizardpage.h
SOURCES = genericproject.cpp \
genericprojectplugin.cpp \
@@ -21,7 +20,6 @@ SOURCES = genericproject.cpp \
pkgconfigtool.cpp \
genericmakestep.cpp \
genericbuildconfiguration.cpp \
- selectablefilesmodel.cpp \
filesselectionwizardpage.cpp
RESOURCES += genericproject.qrc
FORMS += genericmakestep.ui
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
index 70386b06ca..707264924e 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
@@ -39,7 +39,5 @@ QtcPlugin {
"genericprojectwizard.h",
"pkgconfigtool.cpp",
"pkgconfigtool.h",
- "selectablefilesmodel.cpp",
- "selectablefilesmodel.h",
]
}
diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
index 7bd6773f53..19d20e704b 100644
--- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
@@ -237,6 +237,7 @@ QList<ProjectNode::ProjectAction> GenericProjectNode::supportedActions(Node *nod
return QList<ProjectAction>()
<< AddNewFile
<< AddExistingFile
+ << AddExistingDirectory
<< RemoveFile
<< Rename;
}
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
index 08695a063b..713c9be771 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
@@ -36,7 +36,6 @@
#include "genericprojectfileseditor.h"
#include "genericmakestep.h"
#include "genericproject.h"
-#include "selectablefilesmodel.h"
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
@@ -45,10 +44,9 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/selectablefilesmodel.h>
-#include <texteditor/texteditoractionhandler.h>
-
#include <QtPlugin>
#include <QDebug>
@@ -76,10 +74,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
Manager *manager = new Manager;
- TextEditor::TextEditorActionHandler *actionHandler =
- new TextEditor::TextEditorActionHandler(Constants::C_FILESEDITOR);
-
- m_projectFilesEditorFactory = new ProjectFilesFactory(manager, actionHandler);
+ m_projectFilesEditorFactory = new ProjectFilesFactory(manager);
addObject(m_projectFilesEditorFactory);
addAutoReleasedObject(manager);
@@ -115,7 +110,7 @@ void GenericProjectPlugin::updateContextMenu(ProjectExplorer::Project *project,
void GenericProjectPlugin::editFiles()
{
GenericProject *genericProject = static_cast<GenericProject *>(m_contextMenuProject);
- SelectableFilesDialog sfd(QFileInfo(genericProject->projectFilePath()).path(), genericProject->files(),
+ ProjectExplorer::SelectableFilesDialogEditFiles sfd(QFileInfo(genericProject->projectFilePath()).path(), genericProject->files(),
Core::ICore::mainWindow());
if (sfd.exec() == QDialog::Accepted)
genericProject->setFiles(sfd.selectedFiles());
diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp
index 9fadf16934..09e21ba2c8 100644
--- a/src/plugins/git/branchdialog.cpp
+++ b/src/plugins/git/branchdialog.cpp
@@ -38,11 +38,14 @@
#include "stashdialog.h" // Label helpers
#include <utils/qtcassert.h>
+#include <utils/execmenu.h>
#include <vcsbase/vcsbaseoutputwindow.h>
+#include <QAction>
#include <QItemSelectionModel>
#include <QMessageBox>
#include <QList>
+#include <QMenu>
#include <QDebug>
@@ -321,8 +324,18 @@ void BranchDialog::merge()
const QString branch = m_model->fullName(idx, true);
GitClient *client = GitPlugin::instance()->gitClient();
+ bool allowFastForward = true;
+ if (client->isFastForwardMerge(m_repository, branch)) {
+ QMenu popup;
+ QAction *fastForward = popup.addAction(tr("Fast-Forward"));
+ popup.addAction(tr("No Fast-Forward"));
+ QAction *chosen = Utils::execMenuAtWidget(&popup, m_ui->mergeButton);
+ if (!chosen)
+ return;
+ allowFastForward = (chosen == fastForward);
+ }
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
- client->synchronousMerge(m_repository, branch);
+ client->synchronousMerge(m_repository, branch, allowFastForward);
}
void BranchDialog::rebase()
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index 8859af24e7..92ded4aeef 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -156,6 +156,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
detailsLayout->addWidget(m_detailsBrowser);
m_repositoryChooser->setExpectedKind(Utils::PathChooser::Directory);
+ m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
QHBoxLayout *repoPathLayout = new QHBoxLayout;
repoPathLayout->addWidget(m_repositoryChooserLabel);
repoPathLayout->addWidget(m_repositoryChooser);
diff --git a/src/plugins/git/gerrit/gerritoptionspage.cpp b/src/plugins/git/gerrit/gerritoptionspage.cpp
index 456b1edf6d..b457232982 100644
--- a/src/plugins/git/gerrit/gerritoptionspage.cpp
+++ b/src/plugins/git/gerrit/gerritoptionspage.cpp
@@ -55,12 +55,13 @@ GerritOptionsPage::~GerritOptionsPage()
delete m_widget;
}
-QWidget *GerritOptionsPage::createPage(QWidget *parent)
+QWidget *GerritOptionsPage::widget()
{
- GerritOptionsWidget *gow = new GerritOptionsWidget(parent);
- gow->setParameters(*m_parameters);
- m_widget = gow;
- return gow;
+ if (!m_widget) {
+ m_widget = new GerritOptionsWidget;
+ m_widget->setParameters(*m_parameters);
+ }
+ return m_widget;
}
void GerritOptionsPage::apply()
@@ -78,9 +79,9 @@ void GerritOptionsPage::apply()
}
}
-bool GerritOptionsPage::matches(const QString &s) const
+void GerritOptionsPage::finish()
{
- return s.contains(QLatin1String("gerrit"), Qt::CaseInsensitive);
+ delete m_widget;
}
GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
@@ -99,9 +100,11 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
formLayout->addRow(tr("&User:"), m_userLineEdit);
m_sshChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_sshChooser->setCommandVersionArguments(QStringList(QLatin1String("-V")));
+ m_sshChooser->setHistoryCompleter(QLatin1String("Git.SshCommand.History"));
formLayout->addRow(tr("&ssh:"), m_sshChooser);
formLayout->addRow(tr("&Repository:"), m_repositoryChooser);
m_repositoryChooser->setToolTip(tr("Default repository where patches will be applied."));
+ m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
formLayout->addRow(tr("Pr&ompt:"), m_promptPathCheckBox);
m_promptPathCheckBox->setToolTip(tr("If checked, user will always be\n"
"asked to confirm the repository path."));
diff --git a/src/plugins/git/gerrit/gerritoptionspage.h b/src/plugins/git/gerrit/gerritoptionspage.h
index 02a3131a1a..5fd241ecb6 100644
--- a/src/plugins/git/gerrit/gerritoptionspage.h
+++ b/src/plugins/git/gerrit/gerritoptionspage.h
@@ -78,10 +78,9 @@ public:
QObject *parent = 0);
~GerritOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
const QSharedPointer<GerritParameters> &m_parameters;
diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp
index 26aa107d84..bfb06b38bd 100644
--- a/src/plugins/git/gerrit/gerritpushdialog.cpp
+++ b/src/plugins/git/gerrit/gerritpushdialog.cpp
@@ -40,6 +40,23 @@
namespace Gerrit {
namespace Internal {
+class PushItemDelegate : public Git::Internal::IconItemDelegate
+{
+public:
+ PushItemDelegate(Git::Internal::LogChangeWidget *widget)
+ : IconItemDelegate(widget, QLatin1String(":/git/images/arrowup.png"))
+ {
+ }
+
+protected:
+ bool hasIcon(int row) const
+ {
+ return row >= currentRow();
+ }
+};
+
+
+
GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &reviewerList, QWidget *parent) :
QDialog(parent),
m_workingDir(workingDir),
@@ -55,6 +72,8 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
if (!m_ui->commitView->init(workingDir, QString(), false))
return;
+ PushItemDelegate *delegate = new PushItemDelegate(m_ui->commitView);
+ delegate->setParent(this);
QString earliestCommit = m_ui->commitView->earliestCommit();
if (earliestCommit.isEmpty())
return;
diff --git a/src/plugins/git/git.qrc b/src/plugins/git/git.qrc
index 3371b45cd8..15b93521a3 100644
--- a/src/plugins/git/git.qrc
+++ b/src/plugins/git/git.qrc
@@ -2,6 +2,7 @@
<qresource prefix="/git">
<file>images/git.png</file>
<file>images/gitorious.png</file>
+ <file>images/arrowup.png</file>
<file>Git.mimetypes.xml</file>
</qresource>
</RCC>
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index b6a1d9045a..6842489a82 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -36,6 +36,8 @@
#include "gitsubmiteditor.h"
#include "gitversioncontrol.h"
#include "mergetool.h"
+#include "branchadddialog.h"
+#include "gerrit/gerritplugin.h"
#include <vcsbase/submitfilemodel.h>
@@ -987,11 +989,9 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const
QString &res = repoDirCache[repositoryDir];
if (!res.isEmpty())
return res;
- QByteArray outputText;
- QStringList arguments;
- arguments << QLatin1String("rev-parse") << QLatin1String("--git-dir");
- fullySynchronousGit(repositoryDir, arguments, &outputText, 0, false);
- res = QString::fromLocal8Bit(outputText.trimmed());
+
+ synchronousRevParseCmd(repositoryDir, QLatin1String("--git-dir"), &res);
+
if (!QDir(res).isAbsolute())
res.prepend(repositoryDir + QLatin1Char('/'));
return res;
@@ -1554,12 +1554,10 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
{
QByteArray outputText;
QByteArray errorText;
- QStringList arguments;
- arguments << QLatin1String("checkout") << ref;
+ QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText,
VcsBasePlugin::ExpectRepoChanges);
- const QString output = commandOutputFromLocal8Bit(outputText);
- outputWindow()->append(output);
+ outputWindow()->append(commandOutputFromLocal8Bit(outputText));
if (!rc) {
msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
return false;
@@ -1568,6 +1566,67 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
return true;
}
+/* method used to setup arguments for checkout, in case user wants to create local branch */
+QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory,
+ const QString &ref)
+{
+ QStringList arguments(QLatin1String("checkout"));
+ arguments << ref;
+
+ QStringList localBranches = synchronousRepositoryBranches(workingDirectory);
+
+ if (localBranches.contains(ref))
+ return arguments;
+
+ if (QMessageBox::question(Core::ICore::mainWindow(), tr("Create Local Branch"),
+ tr("Would you like to create local branch?"),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
+ return arguments;
+ }
+
+ if (synchronousCurrentLocalBranch(workingDirectory).isEmpty())
+ localBranches.removeFirst();
+
+ QString refSha;
+ if (!synchronousRevParseCmd(workingDirectory, ref, &refSha))
+ return arguments;
+
+ QString output;
+ QStringList forEachRefArgs(QLatin1String("refs/remotes/"));
+ forEachRefArgs << QLatin1String("--format=%(objectname) %(refname:short)");
+ if (!synchronousForEachRefCmd(workingDirectory, forEachRefArgs, &output))
+ return arguments;
+
+ QString remoteBranch;
+ const QString head(QLatin1String("/HEAD"));
+
+ foreach (const QString &singleRef, output.split(QLatin1Char('\n'))) {
+ if (singleRef.startsWith(refSha)) {
+ // branch name might be origin/foo/HEAD
+ if (!singleRef.endsWith(head) || singleRef.count(QLatin1Char('/')) > 1) {
+ remoteBranch = singleRef.mid(refSha.length() + 1);
+ if (remoteBranch == ref)
+ break;
+ }
+ }
+ }
+
+ BranchAddDialog branchAddDialog(localBranches, true, Core::ICore::mainWindow());
+ branchAddDialog.setTrackedBranchName(remoteBranch, true);
+
+ if (branchAddDialog.exec() != QDialog::Accepted)
+ return arguments;
+
+ arguments.removeLast();
+ arguments << QLatin1String("-b") << branchAddDialog.branchName();
+ if (branchAddDialog.track())
+ arguments << QLatin1String("--track") << remoteBranch;
+ else
+ arguments << QLatin1String("--no-track") << ref;
+
+ return arguments;
+}
+
void GitClient::reset(const QString &workingDirectory, const QString &argument, const QString &commit)
{
QStringList arguments;
@@ -1957,25 +2016,28 @@ QString GitClient::synchronousTopic(const QString &workingDirectory)
return data.topic = remoteBranch.isEmpty() ? tr("Detached HEAD") : remoteBranch;
}
+bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
+ QString *output, QString *errorMessage) const
+{
+ QStringList arguments(QLatin1String("rev-parse"));
+ arguments << ref;
+ QByteArray outputText;
+ QByteArray errorText;
+ const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText,
+ VcsBasePlugin::SuppressCommandLogging);
+ *output = commandOutputFromLocal8Bit(outputText.trimmed());
+ if (!rc)
+ msgCannotRun(arguments, workingDirectory, errorText, errorMessage);
+
+ return rc;
+}
+
// Retrieve head revision
QString GitClient::synchronousTopRevision(const QString &workingDirectory, QString *errorMessageIn)
{
- QByteArray outputTextData;
- QByteArray errorText;
- QStringList arguments;
- QString errorMessage;
- // get revision
- arguments << QLatin1String("rev-parse") << QLatin1String(HEAD);
- if (!fullySynchronousGit(workingDirectory, arguments, &outputTextData, &errorText,
- VcsBasePlugin::SuppressCommandLogging)) {
- errorMessage = tr("Cannot retrieve top revision of \"%1\": %2")
- .arg(QDir::toNativeSeparators(workingDirectory), commandOutputFromLocal8Bit(errorText));
+ QString revision;
+ if (!synchronousRevParseCmd(workingDirectory, QLatin1String(HEAD), &revision, errorMessageIn))
return QString();
- }
- QString revision = commandOutputFromLocal8Bit(outputTextData);
- revision.remove(QLatin1Char('\n'));
- if (revision.isEmpty() && !errorMessage.isEmpty())
- msgCannotRun(errorMessage, errorMessageIn);
return revision;
}
@@ -2044,6 +2106,17 @@ bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &c
return !outputText.isEmpty();
}
+bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch)
+{
+ QStringList arguments;
+ QByteArray outputText;
+ arguments << QLatin1String("merge-base") << QLatin1String(HEAD) << branch;
+ fullySynchronousGit(workingDirectory, arguments, &outputText, 0,
+ VcsBasePlugin::SuppressCommandLogging);
+ return commandOutputFromLocal8Bit(outputText).trimmed()
+ == synchronousTopRevision(workingDirectory);
+}
+
// Format an entry in a one-liner for selection list using git log.
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format)
@@ -2468,12 +2541,13 @@ QProcessEnvironment GitClient::processEnvironment() const
return environment;
}
-bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command, StashFlag flag)
+bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command,
+ StashFlag flag, PushAction pushAction)
{
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
QTC_ASSERT(!repoDirectory.isEmpty(), return false);
StashInfo &stashInfo = m_stashInfo[repoDirectory];
- return stashInfo.init(repoDirectory, command, flag);
+ return stashInfo.init(repoDirectory, command, flag, pushAction);
}
GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
@@ -2968,6 +3042,11 @@ bool GitClient::getCommitData(const QString &workingDirectory,
commitData.commitEncoding = readConfigValue(workingDirectory, QLatin1String("i18n.commitEncoding"));
+ // Set default commit encoding to 'UTF-8', when it's not set,
+ // to solve displaying error of commit log with non-latin characters.
+ if (commitData.commitEncoding.isEmpty())
+ commitData.commitEncoding = QLatin1String("UTF-8");
+
// Get the commit template or the last commit message
switch (commitData.commitType) {
case AmendCommit: {
@@ -3417,12 +3496,15 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
executeGit(workingDirectory, arguments, 0, true);
}
-bool GitClient::synchronousMerge(const QString &workingDirectory, const QString &branch)
+bool GitClient::synchronousMerge(const QString &workingDirectory, const QString &branch,
+ bool allowFastForward)
{
QString command = QLatin1String("merge");
- QStringList arguments;
+ QStringList arguments(command);
- arguments << command << branch;
+ if (!allowFastForward)
+ arguments << QLatin1String("--no-ff");
+ arguments << branch;
return executeAndHandleConflicts(workingDirectory, arguments, command);
}
@@ -3734,15 +3816,17 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
}
GitClient::StashInfo::StashInfo() :
- m_client(GitPlugin::instance()->gitClient())
+ m_client(GitPlugin::instance()->gitClient()),
+ m_pushAction(NoPush)
{
}
bool GitClient::StashInfo::init(const QString &workingDirectory, const QString &command,
- StashFlag flag)
+ StashFlag flag, PushAction pushAction)
{
m_workingDir = workingDirectory;
m_flags = flag;
+ m_pushAction = pushAction;
QString errorMessage;
QString statusOutput;
switch (m_client->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
@@ -3841,6 +3925,13 @@ void GitClient::StashInfo::end()
if (m_client->stashNameFromMessage(m_workingDir, m_message, &stashName))
m_client->stashPop(m_workingDir, stashName);
}
+
+ if (m_pushAction == NormalPush)
+ m_client->push(m_workingDir);
+ else if (m_pushAction == PushToGerrit)
+ GitPlugin::instance()->gerritPlugin()->push(m_workingDir);
+
+ m_pushAction = NoPush;
m_stashResult = NotStashed;
}
} // namespace Internal
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 26a300fd43..69f11e9553 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -31,6 +31,7 @@
#define GITCLIENT_H
#include "gitsettings.h"
+#include "commitdata.h"
#include <coreplugin/editormanager/ieditor.h>
@@ -110,7 +111,8 @@ public:
enum StashResult { StashUnchanged, StashCanceled, StashFailed,
Stashed, NotStashed /* User did not want it */ };
- bool init(const QString &workingDirectory, const QString &command, StashFlag flag = Default);
+ bool init(const QString &workingDirectory, const QString &command,
+ StashFlag flag = Default, PushAction pushAction = NoPush);
bool stashingFailed() const;
void end();
StashResult result() const { return m_stashResult; }
@@ -125,6 +127,7 @@ public:
QString m_workingDir;
GitClient *m_client;
StashFlag m_flags;
+ PushAction m_pushAction;
};
static const char *stashNamePrefix;
@@ -177,9 +180,10 @@ public:
QString revision = QString(), QString *errorMessage = 0,
bool revertStaging = true);
// Checkout branch
- bool synchronousCheckout(const QString &workingDirectory, const QString &ref, QString *errorMessage);
- bool synchronousCheckout(const QString &workingDirectory, const QString &ref)
- { return synchronousCheckout(workingDirectory, ref, 0); }
+ bool synchronousCheckout(const QString &workingDirectory, const QString &ref,
+ QString *errorMessage = 0);
+
+ QStringList setupCheckoutArguments(const QString &workingDirectory, const QString &ref);
void updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt);
// Do a stash and return identier.
@@ -232,19 +236,23 @@ public:
bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
QString *errorMessage = 0);
QString synchronousTopic(const QString &workingDirectory);
+ bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
+ QString *output, QString *errorMessage = 0) const;
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0);
void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QString &precedes, QString &follows);
QStringList synchronousBranchesForCommit(const QString &workingDirectory,
const QString &revision);
bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
+ bool isFastForwardMerge(const QString &workingDirectory, const QString &branch);
bool cloneRepository(const QString &directory, const QByteArray &url);
QString vcsGetRepositoryURL(const QString &directory);
void fetch(const QString &workingDirectory, const QString &remote);
bool synchronousPull(const QString &workingDirectory, bool rebase);
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
- bool synchronousMerge(const QString &workingDirectory, const QString &branch);
+ bool synchronousMerge(const QString &workingDirectory, const QString &branch,
+ bool allowFastForward = true);
bool canRebase(const QString &workingDirectory) const;
void rebase(const QString &workingDirectory, const QString &baseBranch);
bool synchronousRevert(const QString &workingDirectory, const QString &commit);
@@ -315,7 +323,8 @@ public:
QProcessEnvironment processEnvironment() const;
- bool beginStashScope(const QString &workingDirectory, const QString &command, StashFlag flag = Default);
+ bool beginStashScope(const QString &workingDirectory, const QString &command,
+ StashFlag flag = Default, PushAction pushAction = NoPush);
StashInfo &stashInfo(const QString &workingDirectory);
void endStashScope(const QString &workingDirectory);
bool isValidRevision(const QString &revision) const;
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index 4f0b8314c6..2ea783b30f 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -278,9 +278,9 @@ void GitEditor::init()
VcsBase::VcsBaseEditorWidget::init();
Core::Id editorId = editor()->id();
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID)
- new GitSubmitHighlighter(baseTextDocument().data());
+ new GitSubmitHighlighter(baseTextDocument());
else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID)
- new GitRebaseHighlighter(baseTextDocument().data());
+ new GitRebaseHighlighter(baseTextDocument());
}
void GitEditor::addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk)
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 45bf783147..ae52a8a085 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -60,6 +60,7 @@
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/vcsmanager.h>
+#include <coreplugin/coreconstants.h>
#include <utils/qtcassert.h>
#include <utils/parameteraction.h>
@@ -802,6 +803,33 @@ void GitPlugin::undoUnstagedFileChanges()
undoFileChanges(false);
}
+class ResetItemDelegate : public LogItemDelegate
+{
+public:
+ ResetItemDelegate(LogChangeWidget *widget) : LogItemDelegate(widget) {}
+ void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
+ {
+ if (index.row() < currentRow())
+ option->font.setStrikeOut(true);
+ LogItemDelegate::initStyleOption(option, index);
+ }
+};
+
+class RebaseItemDelegate : public IconItemDelegate
+{
+public:
+ RebaseItemDelegate(LogChangeWidget *widget)
+ : IconItemDelegate(widget, QLatin1String(Core::Constants::ICON_UNDO))
+ {
+ }
+
+protected:
+ bool hasIcon(int row) const
+ {
+ return row <= currentRow();
+ }
+};
+
void GitPlugin::resetRepository()
{
if (!ensureAllDocumentsSaved())
@@ -811,6 +839,7 @@ void GitPlugin::resetRepository()
QString topLevel = state.topLevel();
LogChangeDialog dialog(true, Core::ICore::mainWindow());
+ ResetItemDelegate delegate(dialog.widget());
dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel)));
if (dialog.runDialog(topLevel))
m_gitClient->reset(topLevel, dialog.resetFlag(), dialog.commit());
@@ -825,14 +854,13 @@ void GitPlugin::startRebase()
const QString topLevel = state.topLevel();
if (topLevel.isEmpty() || !m_gitClient->canRebase(topLevel))
return;
- if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i")))
- return;
LogChangeDialog dialog(false, Core::ICore::mainWindow());
+ RebaseItemDelegate delegate(dialog.widget());
dialog.setWindowTitle(tr("Interactive Rebase"));
- if (dialog.runDialog(topLevel, QString(), false))
+ if (!dialog.runDialog(topLevel, QString(), false))
+ return;
+ if (m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i")))
m_gitClient->interactiveRebase(topLevel, dialog.commit(), false);
- else
- m_gitClient->endStashScope(topLevel);
}
void GitPlugin::startChangeRelatedAction()
@@ -863,24 +891,22 @@ void GitPlugin::startChangeRelatedAction()
if (!ensureAllDocumentsSaved())
return;
- bool (GitClient::*commandFunction)(const QString&, const QString&);
+
switch (dialog.command()) {
case CherryPick:
- commandFunction = &GitClient::synchronousCherryPick;
+ m_gitClient->synchronousCherryPick(workingDirectory, change);
break;
case Revert:
- commandFunction = &GitClient::synchronousRevert;
+ m_gitClient->synchronousRevert(workingDirectory, change);
break;
case Checkout:
if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Checkout")))
return;
- commandFunction = &GitClient::synchronousCheckout;
+ m_gitClient->synchronousCheckout(workingDirectory, change);
break;
default:
return;
}
-
- (m_gitClient->*commandFunction)(workingDirectory, change);
}
void GitPlugin::stageFile()
@@ -1103,8 +1129,10 @@ bool GitPlugin::submitEditorAboutToClose()
return false;
cleanCommitMessageFile();
if (commitType == FixupCommit) {
- if (!m_gitClient->beginStashScope(m_submitRepository, QLatin1String("Rebase-fixup"), NoPrompt))
+ if (!m_gitClient->beginStashScope(m_submitRepository, QLatin1String("Rebase-fixup"),
+ NoPrompt, editor->panelData().pushAction)) {
return false;
+ }
m_gitClient->interactiveRebase(m_submitRepository, amendSHA1, true);
} else {
m_gitClient->continueCommandIfNeeded(m_submitRepository);
@@ -1477,6 +1505,11 @@ GitClient *GitPlugin::gitClient() const
return m_gitClient;
}
+Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const
+{
+ return m_gerritPlugin;
+}
+
#ifdef WITH_TESTS
#include <QTest>
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index f451834f30..f72de8c4a3 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -99,6 +99,7 @@ public:
void setSettings(const GitSettings &s);
GitClient *gitClient() const;
+ Gerrit::Internal::GerritPlugin *gerritPlugin() const;
public slots:
void startCommit();
diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp
index 50cffe06b7..03c4fcffee 100644
--- a/src/plugins/git/gitsubmiteditorwidget.cpp
+++ b/src/plugins/git/gitsubmiteditorwidget.cpp
@@ -109,7 +109,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
setPanelData(data);
setPanelInfo(info);
- if (enablePush && commitType != FixupCommit) {
+ if (enablePush) {
QMenu *menu = new QMenu(this);
menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot()));
menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot()));
diff --git a/src/plugins/git/images/arrowup.png b/src/plugins/git/images/arrowup.png
new file mode 100644
index 0000000000..5cdbc6ed9e
--- /dev/null
+++ b/src/plugins/git/images/arrowup.png
Binary files differ
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp
index e09e5267f7..a52e1b7e9f 100644
--- a/src/plugins/git/logchangedialog.cpp
+++ b/src/plugins/git/logchangedialog.cpp
@@ -33,6 +33,8 @@
#include <vcsbase/vcsbaseoutputwindow.h>
+#include <utils/qtcassert.h>
+
#include <QTreeView>
#include <QLabel>
#include <QPushButton>
@@ -41,6 +43,7 @@
#include <QItemSelectionModel>
#include <QVBoxLayout>
#include <QComboBox>
+#include <QPainter>
namespace Git {
namespace Internal {
@@ -55,6 +58,7 @@ enum Columns
LogChangeWidget::LogChangeWidget(QWidget *parent)
: QTreeView(parent)
, m_model(new QStandardItemModel(0, ColumnCount, this))
+ , m_hasCustomDelegate(false)
{
QStringList headers;
headers << tr("Sha1")<< tr("Subject");
@@ -104,6 +108,12 @@ QString LogChangeWidget::earliestCommit() const
return QString();
}
+void LogChangeWidget::setItemDelegate(QAbstractItemDelegate *delegate)
+{
+ QTreeView::setItemDelegate(delegate);
+ m_hasCustomDelegate = true;
+}
+
void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
{
if (index.isValid()) {
@@ -113,6 +123,26 @@ void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
}
}
+void LogChangeWidget::selectionChanged(const QItemSelection &selected,
+ const QItemSelection &deselected)
+{
+ QTreeView::selectionChanged(selected, deselected);
+ if (!m_hasCustomDelegate)
+ return;
+ const QModelIndexList previousIndexes = deselected.indexes();
+ if (previousIndexes.isEmpty())
+ return;
+ const QModelIndex current = currentIndex();
+ int row = current.row();
+ int previousRow = previousIndexes.first().row();
+ if (row < previousRow)
+ qSwap(row, previousRow);
+ for (int r = previousRow; r <= row; ++r) {
+ update(current.sibling(r, 0));
+ update(current.sibling(r, 1));
+ }
+}
+
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote)
{
const QString currentCommit = this->commit();
@@ -234,5 +264,40 @@ QString LogChangeDialog::resetFlag() const
return m_resetTypeComboBox->itemData(m_resetTypeComboBox->currentIndex()).toString();
}
+LogChangeWidget *LogChangeDialog::widget() const
+{
+ return m_widget;
+}
+
+LogItemDelegate::LogItemDelegate(LogChangeWidget *widget) : m_widget(widget)
+{
+ m_widget->setItemDelegate(this);
+}
+
+int LogItemDelegate::currentRow() const
+{
+ return m_widget->commitIndex();
+}
+
+IconItemDelegate::IconItemDelegate(LogChangeWidget *widget, const QString &icon)
+ : LogItemDelegate(widget)
+ , m_icon(icon)
+{
+}
+
+void IconItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ QStyleOptionViewItem o = option;
+ if (index.column() == 0 && hasIcon(index.row())) {
+ const QSize size = option.decorationSize;
+ painter->save();
+ painter->drawPixmap(o.rect.x(), o.rect.y(), m_icon.pixmap(size.width(), size.height()));
+ painter->restore();
+ o.rect.translate(size.width(), 0);
+ }
+ QStyledItemDelegate::paint(painter, o, index);
+}
+
} // namespace Internal
} // namespace Git
diff --git a/src/plugins/git/logchangedialog.h b/src/plugins/git/logchangedialog.h
index 22f6641b73..9996c2f5bb 100644
--- a/src/plugins/git/logchangedialog.h
+++ b/src/plugins/git/logchangedialog.h
@@ -31,6 +31,8 @@
#define LOGCHANGEDDIALOG_H
#include <QDialog>
+#include <QIcon>
+#include <QStyledItemDelegate>
#include <QTreeView>
QT_BEGIN_NAMESPACE
@@ -57,6 +59,7 @@ public:
QString commit() const;
int commitIndex() const;
QString earliestCommit() const;
+ void setItemDelegate(QAbstractItemDelegate *delegate);
signals:
void doubleClicked(const QString &commit);
@@ -65,10 +68,12 @@ private slots:
void emitDoubleClicked(const QModelIndex &index);
private:
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
bool populateLog(const QString &repository, const QString &commit, bool includeRemote);
const QStandardItem *currentItem(int column = 0) const;
QStandardItemModel *m_model;
+ bool m_hasCustomDelegate;
};
class LogChangeDialog : public QDialog
@@ -83,6 +88,7 @@ public:
QString commit() const;
int commitIndex() const;
QString resetFlag() const;
+ LogChangeWidget *widget() const;
private:
LogChangeWidget *m_widget;
@@ -90,6 +96,31 @@ private:
QComboBox *m_resetTypeComboBox;
};
+class LogItemDelegate : public QStyledItemDelegate
+{
+protected:
+ LogItemDelegate(LogChangeWidget *widget);
+
+ int currentRow() const;
+
+private:
+ LogChangeWidget *m_widget;
+};
+
+class IconItemDelegate : public LogItemDelegate
+{
+public:
+ IconItemDelegate(LogChangeWidget *widget, const QString &icon);
+
+ virtual bool hasIcon(int row) const = 0;
+
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+
+private:
+ QIcon m_icon;
+};
+
} // namespace Internal
} // namespace Git
diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp
index 075ad9ba44..a2dd6caab1 100644
--- a/src/plugins/git/settingspage.cpp
+++ b/src/plugins/git/settingspage.cpp
@@ -61,6 +61,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.winHomeCheckBox->setVisible(false);
}
m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui.repBrowserCommandPathChooser->setHistoryCompleter(QLatin1String("Git.RepoCommand.History"));
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
}
@@ -90,25 +91,6 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
m_ui.repBrowserCommandPathChooser->setPath(s.stringValue(GitSettings::repositoryBrowserCmd));
}
-QString SettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.pathlabel->text()
- << sep << m_ui.winHomeCheckBox->text()
- << sep << m_ui.groupBox->title()
- << sep << m_ui.logCountLabel->text()
- << sep << m_ui.timeoutLabel->text()
- << sep << m_ui.gitkGroupBox->title()
- << sep << m_ui.gitkOptionsLabel->text()
- << sep << m_ui.repBrowserGroupBox->title()
- << sep << m_ui.repBrowserCommandLabel->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
// -------- SettingsPage
SettingsPage::SettingsPage() :
m_widget(0)
@@ -117,12 +99,12 @@ SettingsPage::SettingsPage() :
setDisplayName(tr("Git"));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
- m_widget->setSettings(GitPlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsPageWidget;
+ m_widget->setSettings(GitPlugin::instance()->settings());
+ }
return m_widget;
}
@@ -141,9 +123,9 @@ void SettingsPage::apply()
GitPlugin::instance()->setSettings(newSettings);
}
-bool SettingsPage::matches(const QString &s) const
+void SettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
}
diff --git a/src/plugins/git/settingspage.h b/src/plugins/git/settingspage.h
index 18e70f473b..d7fe845fad 100644
--- a/src/plugins/git/settingspage.h
+++ b/src/plugins/git/settingspage.h
@@ -30,12 +30,13 @@
#ifndef SETTINGSPAGE_H
#define SETTINGSPAGE_H
-#include <QWidget>
-
#include <vcsbase/vcsbaseoptionspage.h>
#include "ui_settingspage.h"
+#include <QPointer>
+#include <QWidget>
+
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
@@ -53,8 +54,6 @@ public:
GitSettings settings() const;
void setSettings(const GitSettings &);
- QString searchKeywords() const;
-
private:
Ui::SettingsPage m_ui;
};
@@ -66,14 +65,13 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
QString m_searchKeywords;
- SettingsPageWidget* m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index f7cdc00336..3b20a3be18 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -157,7 +157,7 @@ GLSLTextEditorWidget::GLSLTextEditorWidget(QWidget *parent) :
connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
- new Highlighter(baseTextDocument().data());
+ new Highlighter(baseTextDocument());
// if (m_modelManager) {
// m_semanticHighlighter->setModelManager(m_modelManager);
@@ -191,7 +191,7 @@ Core::IEditor *GLSLEditorEditable::duplicate(QWidget *parent)
{
GLSLTextEditorWidget *newEditor = new GLSLTextEditorWidget(parent);
newEditor->duplicateFrom(editorWidget());
- GLSLEditorPlugin::initializeEditor(newEditor);
+ TextEditor::TextEditorSettings::initializeEditor(newEditor);
return newEditor->editor();
}
diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp
index 5afdfe65cb..a6bfc4e143 100644
--- a/src/plugins/glsleditor/glsleditorfactory.cpp
+++ b/src/plugins/glsleditor/glsleditorfactory.cpp
@@ -37,6 +37,8 @@
#include <extensionsystem/pluginspec.h>
#include <coreplugin/icore.h>
+#include <texteditor/texteditoractionhandler.h>
+#include <texteditor/texteditorsettings.h>
#include <QCoreApplication>
#include <QSettings>
@@ -54,12 +56,17 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
+ new TextEditor::TextEditorActionHandler(this, Constants::C_GLSLEDITOR_ID,
+ TextEditor::TextEditorActionHandler::Format
+ | TextEditor::TextEditorActionHandler::UnCommentSelection
+ | TextEditor::TextEditorActionHandler::UnCollapseAll);
+
}
Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
{
GLSLTextEditorWidget *rc = new GLSLTextEditorWidget(parent);
- GLSLEditorPlugin::initializeEditor(rc);
+ TextEditor::TextEditorSettings::initializeEditor(rc);
return rc->editor();
}
diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp
index 43b30df305..41a3f5db2d 100644
--- a/src/plugins/glsleditor/glsleditorplugin.cpp
+++ b/src/plugins/glsleditor/glsleditorplugin.cpp
@@ -48,9 +48,7 @@
#include <projectexplorer/taskhub.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorconstants.h>
-#include <texteditor/texteditorsettings.h>
#include <texteditor/textfilewizard.h>
-#include <texteditor/texteditoractionhandler.h>
#include <utils/qtcassert.h>
#include <glsl/glslengine.h>
@@ -77,7 +75,6 @@ class GLSLEditorPluginPrivate
public:
GLSLEditorPluginPrivate() :
m_editor(0),
- m_actionHandler(0),
m_glsl_120_frag(0),
m_glsl_120_vert(0),
m_glsl_120_common(0),
@@ -88,7 +85,6 @@ public:
~GLSLEditorPluginPrivate()
{
- delete m_actionHandler;
delete m_glsl_120_frag;
delete m_glsl_120_vert;
delete m_glsl_120_common;
@@ -98,7 +94,6 @@ public:
}
GLSLEditorFactory *m_editor;
- TextEditor::TextEditorActionHandler *m_actionHandler;
QPointer<TextEditor::ITextEditor> m_currentTextEditable;
GLSLEditorPlugin::InitFile *m_glsl_120_frag;
@@ -145,12 +140,6 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
addAutoReleasedObject(new GLSLCompletionAssistProvider);
- dd->m_actionHandler = new TextEditorActionHandler(Constants::C_GLSLEDITOR_ID,
- TextEditorActionHandler::Format
- | TextEditorActionHandler::UnCommentSelection
- | TextEditorActionHandler::UnCollapseAll);
- dd->m_actionHandler->initializeActions();
-
ActionContainer *contextMenu = ActionManager::createMenu(GLSLEditor::Constants::M_CONTEXT);
ActionContainer *glslToolsMenu = ActionManager::createMenu(Id(Constants::M_TOOLS_GLSL));
glslToolsMenu->setOnAllDisabledBehavior(ActionContainer::Hide);
@@ -245,13 +234,6 @@ ExtensionSystem::IPlugin::ShutdownFlag GLSLEditorPlugin::aboutToShutdown()
return IPlugin::aboutToShutdown();
}
-void GLSLEditorPlugin::initializeEditor(GLSLTextEditorWidget *editor)
-{
- QTC_CHECK(m_instance);
- dd->m_actionHandler->setupActions(editor);
- TextEditorSettings::initializeEditor(editor);
-}
-
static QByteArray glslFile(const QString &fileName)
{
QFile file(ICore::resourcePath() + QLatin1String("/glsl/") + fileName);
diff --git a/src/plugins/glsleditor/glsleditorplugin.h b/src/plugins/glsleditor/glsleditorplugin.h
index 882f01800a..f9974bc17b 100644
--- a/src/plugins/glsleditor/glsleditorplugin.h
+++ b/src/plugins/glsleditor/glsleditorplugin.h
@@ -52,8 +52,6 @@ public:
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
- static void initializeEditor(GLSLTextEditorWidget *editor);
-
struct InitFile
{
InitFile(GLSL::Engine *engine = 0, GLSL::TranslationUnitAST *ast = 0)
diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp
index 627aaab13f..36fdda46b0 100644
--- a/src/plugins/help/docsettingspage.cpp
+++ b/src/plugins/help/docsettingspage.cpp
@@ -50,27 +50,26 @@ DocSettingsPage::DocSettingsPage()
setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
}
-QWidget *DocSettingsPage::createPage(QWidget *parent)
+QWidget *DocSettingsPage::widget()
{
- QWidget *widget = new QWidget(parent);
- m_ui.setupUi(widget);
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
- connect(m_ui.addButton, SIGNAL(clicked()), this, SLOT(addDocumentation()));
- connect(m_ui.removeButton, SIGNAL(clicked()), this, SLOT(removeDocumentation()));
+ connect(m_ui.addButton, SIGNAL(clicked()), this, SLOT(addDocumentation()));
+ connect(m_ui.removeButton, SIGNAL(clicked()), this, SLOT(removeDocumentation()));
- m_ui.docsListWidget->installEventFilter(this);
+ m_ui.docsListWidget->installEventFilter(this);
- const QStringList nameSpaces = HelpManager::registeredNamespaces();
- foreach (const QString &nameSpace, nameSpaces) {
- addItem(nameSpace, HelpManager::fileFromNamespace(nameSpace));
- m_filesToRegister.insert(nameSpace, HelpManager::fileFromNamespace(nameSpace));
- }
-
- m_filesToUnregister.clear();
+ const QStringList nameSpaces = HelpManager::registeredNamespaces();
+ foreach (const QString &nameSpace, nameSpaces) {
+ addItem(nameSpace, HelpManager::fileFromNamespace(nameSpace));
+ m_filesToRegister.insert(nameSpace, HelpManager::fileFromNamespace(nameSpace));
+ }
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_ui.groupBox->title();
- return widget;
+ m_filesToUnregister.clear();
+ }
+ return m_widget;
}
void DocSettingsPage::addDocumentation()
@@ -155,9 +154,9 @@ void DocSettingsPage::apply()
m_filesToUnregister.clear();
}
-bool DocSettingsPage::matches(const QString &s) const
+void DocSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
bool DocSettingsPage::eventFilter(QObject *object, QEvent *event)
diff --git a/src/plugins/help/docsettingspage.h b/src/plugins/help/docsettingspage.h
index 337db8f7b7..ed93f9ec7a 100644
--- a/src/plugins/help/docsettingspage.h
+++ b/src/plugins/help/docsettingspage.h
@@ -33,6 +33,8 @@
#include "ui_docsettingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Help {
namespace Internal {
@@ -43,10 +45,9 @@ class DocSettingsPage : public Core::IOptionsPage
public:
DocSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() {}
- bool matches(const QString &s) const;
+ void finish();
private slots:
void addDocumentation();
@@ -59,8 +60,8 @@ private:
private:
Ui::DocSettingsPage m_ui;
+ QPointer<QWidget> m_widget;
- QString m_searchKeywords;
QString m_recentDialogPath;
typedef QHash<QString, QString> NameSpaceToPathHash;
diff --git a/src/plugins/help/filtersettingspage.cpp b/src/plugins/help/filtersettingspage.cpp
index f97cdfa879..351ddd5453 100644
--- a/src/plugins/help/filtersettingspage.cpp
+++ b/src/plugins/help/filtersettingspage.cpp
@@ -51,29 +51,26 @@ FilterSettingsPage::FilterSettingsPage()
setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
}
-QWidget *FilterSettingsPage::createPage(QWidget *parent)
+QWidget *FilterSettingsPage::widget()
{
- QWidget *widget = new QWidget(parent);
- m_ui.setupUi(widget);
-
- updateFilterPage();
-
- connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
- this, SLOT(updateFilterMap()));
- connect(m_ui.filterWidget,
- SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
- SLOT(updateAttributes(QListWidgetItem*)));
- connect(m_ui.filterAddButton, SIGNAL(clicked()), this, SLOT(addFilter()));
- connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this,
- SLOT(removeFilter()));
- connect(HelpManager::instance(), SIGNAL(documentationChanged()),
- this, SLOT(updateFilterPage()));
-
- if (m_searchKeywords.isEmpty()) {
- m_searchKeywords = m_ui.filterGroupBox->title() + QLatin1Char(' ')
- + m_ui.attributesGroupBox->title();
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
+
+ updateFilterPage();
+
+ connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
+ this, SLOT(updateFilterMap()));
+ connect(m_ui.filterWidget,
+ SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
+ SLOT(updateAttributes(QListWidgetItem*)));
+ connect(m_ui.filterAddButton, SIGNAL(clicked()), this, SLOT(addFilter()));
+ connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this,
+ SLOT(removeFilter()));
+ connect(HelpManager::instance(), SIGNAL(documentationChanged()),
+ this, SLOT(updateFilterPage()));
}
- return widget;
+ return m_widget;
}
void FilterSettingsPage::updateFilterPage()
@@ -230,11 +227,7 @@ void FilterSettingsPage::finish()
{
disconnect(HelpManager::instance(), SIGNAL(documentationChanged()),
this, SLOT(updateFilterPage()));
-}
-
-bool FilterSettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
QString FilterSettingsPage::msgFilterLabel(const QString &filter) const
diff --git a/src/plugins/help/filtersettingspage.h b/src/plugins/help/filtersettingspage.h
index 3d20d19521..33634b0d25 100644
--- a/src/plugins/help/filtersettingspage.h
+++ b/src/plugins/help/filtersettingspage.h
@@ -33,6 +33,8 @@
#include "ui_filtersettingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Help {
namespace Internal {
@@ -43,10 +45,9 @@ class FilterSettingsPage : public Core::IOptionsPage
public:
FilterSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
signals:
void filtersChanged();
@@ -64,12 +65,12 @@ private:
private:
QString msgFilterLabel(const QString &filter) const;
Ui::FilterSettingsPage m_ui;
+ QPointer<QWidget> m_widget;
typedef QMap<QString, QStringList> FilterMap;
FilterMap m_filterMap;
FilterMap m_filterMapBackup;
- QString m_searchKeywords;
QStringList m_removedFilters;
};
diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp
index 43ac9b1aed..53848cff7c 100644
--- a/src/plugins/help/generalsettingspage.cpp
+++ b/src/plugins/help/generalsettingspage.cpp
@@ -72,59 +72,54 @@ GeneralSettingsPage::GeneralSettingsPage()
setCategoryIcon(QLatin1String(Help::Constants::HELP_CATEGORY_ICON));
}
-QWidget *GeneralSettingsPage::createPage(QWidget *parent)
+QWidget *GeneralSettingsPage::widget()
{
- QWidget *widget = new QWidget(parent);
- m_ui = new Ui::GeneralSettingsPage;
- m_ui->setupUi(widget);
- m_ui->sizeComboBox->setEditable(false);
- m_ui->styleComboBox->setEditable(false);
-
- m_font = qvariant_cast<QFont>(HelpManager::customValue(QLatin1String("font"), m_font));
-
- updateFontSize();
- updateFontStyle();
- updateFontFamily();
-
- m_homePage = HelpManager::customValue(QLatin1String("HomePage"), QString())
- .toString();
- if (m_homePage.isEmpty()) {
- m_homePage = HelpManager::customValue(QLatin1String("DefaultHomePage"),
- Help::Constants::AboutBlank).toString();
- }
- m_ui->homePageLineEdit->setText(m_homePage);
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui = new Ui::GeneralSettingsPage;
+ m_ui->setupUi(m_widget);
+ m_ui->sizeComboBox->setEditable(false);
+ m_ui->styleComboBox->setEditable(false);
+
+ m_font = qvariant_cast<QFont>(HelpManager::customValue(QLatin1String("font"), m_font));
+
+ updateFontSize();
+ updateFontStyle();
+ updateFontFamily();
+
+ m_homePage = HelpManager::customValue(QLatin1String("HomePage"), QString())
+ .toString();
+ if (m_homePage.isEmpty()) {
+ m_homePage = HelpManager::customValue(QLatin1String("DefaultHomePage"),
+ Help::Constants::AboutBlank).toString();
+ }
+ m_ui->homePageLineEdit->setText(m_homePage);
- m_startOption = HelpManager::customValue(QLatin1String("StartOption"),
- Help::Constants::ShowLastPages).toInt();
- m_ui->helpStartComboBox->setCurrentIndex(m_startOption);
+ m_startOption = HelpManager::customValue(QLatin1String("StartOption"),
+ Help::Constants::ShowLastPages).toInt();
+ m_ui->helpStartComboBox->setCurrentIndex(m_startOption);
- m_contextOption = HelpManager::customValue(QLatin1String("ContextHelpOption"),
- Help::Constants::SideBySideIfPossible).toInt();
- m_ui->contextHelpComboBox->setCurrentIndex(m_contextOption);
+ m_contextOption = HelpManager::customValue(QLatin1String("ContextHelpOption"),
+ Help::Constants::SideBySideIfPossible).toInt();
+ m_ui->contextHelpComboBox->setCurrentIndex(m_contextOption);
- connect(m_ui->currentPageButton, SIGNAL(clicked()), this, SLOT(setCurrentPage()));
- connect(m_ui->blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage()));
- connect(m_ui->defaultPageButton, SIGNAL(clicked()), this, SLOT(setDefaultPage()));
+ connect(m_ui->currentPageButton, SIGNAL(clicked()), this, SLOT(setCurrentPage()));
+ connect(m_ui->blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage()));
+ connect(m_ui->defaultPageButton, SIGNAL(clicked()), this, SLOT(setDefaultPage()));
- HelpViewer *viewer = CentralWidget::instance()->currentHelpViewer();
- if (!viewer)
- m_ui->currentPageButton->setEnabled(false);
+ HelpViewer *viewer = CentralWidget::instance()->currentHelpViewer();
+ if (!viewer)
+ m_ui->currentPageButton->setEnabled(false);
- m_ui->errorLabel->setVisible(false);
- connect(m_ui->importButton, SIGNAL(clicked()), this, SLOT(importBookmarks()));
- connect(m_ui->exportButton, SIGNAL(clicked()), this, SLOT(exportBookmarks()));
+ m_ui->errorLabel->setVisible(false);
+ connect(m_ui->importButton, SIGNAL(clicked()), this, SLOT(importBookmarks()));
+ connect(m_ui->exportButton, SIGNAL(clicked()), this, SLOT(exportBookmarks()));
- if (m_searchKeywords.isEmpty()) {
- QTextStream(&m_searchKeywords) << ' ' << m_ui->contextHelpLabel->text()
- << ' ' << m_ui->startPageLabel->text() << ' ' << m_ui->homePageLabel->text();
- m_searchKeywords.remove(QLatin1Char('&'));
+ m_returnOnClose = HelpManager::customValue(QLatin1String("ReturnOnClose"),
+ false).toBool();
+ m_ui->m_returnOnClose->setChecked(m_returnOnClose);
}
-
- m_returnOnClose = HelpManager::customValue(QLatin1String("ReturnOnClose"),
- false).toBool();
- m_ui->m_returnOnClose->setChecked(m_returnOnClose);
-
- return widget;
+ return m_widget;
}
void GeneralSettingsPage::apply()
@@ -342,13 +337,9 @@ int GeneralSettingsPage::closestPointSizeIndex(int desiredPointSize) const
return closestIndex;
}
-bool GeneralSettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void GeneralSettingsPage::finish()
{
+ delete m_widget;
if (!m_ui) // page was never shown
return;
delete m_ui;
diff --git a/src/plugins/help/generalsettingspage.h b/src/plugins/help/generalsettingspage.h
index 70fb588b96..06fdd45b9f 100644
--- a/src/plugins/help/generalsettingspage.h
+++ b/src/plugins/help/generalsettingspage.h
@@ -33,6 +33,8 @@
#include "ui_generalsettingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Help {
namespace Internal {
@@ -45,10 +47,9 @@ class GeneralSettingsPage : public Core::IOptionsPage
public:
GeneralSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
signals:
void fontChanged();
@@ -79,7 +80,7 @@ private:
int m_startOption;
bool m_returnOnClose;
- QString m_searchKeywords;
+ QPointer<QWidget> m_widget;
Ui::GeneralSettingsPage *m_ui;
};
diff --git a/src/plugins/ios/iosdeploystep.h b/src/plugins/ios/iosdeploystep.h
index e74a5c0bbb..05485b0b66 100644
--- a/src/plugins/ios/iosdeploystep.h
+++ b/src/plugins/ios/iosdeploystep.h
@@ -51,26 +51,6 @@ namespace Internal {
class IosDeviceConfigListModel;
class IosPackageCreationStep;
-class DeployItem
-{
-public:
- DeployItem(const QString &_localFileName,
- unsigned int _localTimeStamp,
- const QString &_remoteFileName,
- bool _needsStrip)
- : localFileName(_localFileName),
- remoteFileName(_remoteFileName),
- localTimeStamp(_localTimeStamp),
- remoteTimeStamp(0),
- needsStrip(_needsStrip)
- {}
- QString localFileName;
- QString remoteFileName;
- unsigned int localTimeStamp;
- unsigned int remoteTimeStamp;
- bool needsStrip;
-};
-
class IosDeployStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
diff --git a/src/plugins/ios/iossettingspage.cpp b/src/plugins/ios/iossettingspage.cpp
index f1a61e7aeb..de5766878e 100644
--- a/src/plugins/ios/iossettingspage.cpp
+++ b/src/plugins/ios/iossettingspage.cpp
@@ -48,16 +48,10 @@ IosSettingsPage::IosSettingsPage(QObject *parent)
setCategoryIcon(QLatin1String(Constants::IOS_SETTINGS_CATEGORY_ICON));
}
-bool IosSettingsPage::matches(const QString &searchKeyWord) const
+QWidget *IosSettingsPage::widget()
{
- return m_keywords.contains(searchKeyWord, Qt::CaseInsensitive);
-}
-
-QWidget *IosSettingsPage::createPage(QWidget *parent)
-{
- m_widget = new IosSettingsWidget(parent);
- if (m_keywords.isEmpty())
- m_keywords = m_widget->searchKeywords();
+ if (!m_widget)
+ m_widget = new IosSettingsWidget;
return m_widget;
}
@@ -69,6 +63,7 @@ void IosSettingsPage::apply()
void IosSettingsPage::finish()
{
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/ios/iossettingspage.h b/src/plugins/ios/iossettingspage.h
index 96ee190905..6dbd5beaa4 100644
--- a/src/plugins/ios/iossettingspage.h
+++ b/src/plugins/ios/iossettingspage.h
@@ -31,6 +31,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Ios {
namespace Internal {
@@ -43,14 +45,12 @@ class IosSettingsPage : public Core::IOptionsPage
public:
explicit IosSettingsPage(QObject *parent = 0);
- bool matches(const QString &searchKeyWord) const;
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- QString m_keywords;
- IosSettingsWidget *m_widget;
+ QPointer<IosSettingsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/ios/iossettingswidget.cpp b/src/plugins/ios/iossettingswidget.cpp
index b4e7e44eb3..87f0e805a8 100644
--- a/src/plugins/ios/iossettingswidget.cpp
+++ b/src/plugins/ios/iossettingswidget.cpp
@@ -65,14 +65,6 @@ IosSettingsWidget::~IosSettingsWidget()
delete m_ui;
}
-QString IosSettingsWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc) << m_ui->deviceAskCheckBox->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void IosSettingsWidget::initGui()
{
m_ui->setupUi(this);
diff --git a/src/plugins/ios/iossettingswidget.h b/src/plugins/ios/iossettingswidget.h
index 58b8fc7c60..7d22a645d6 100644
--- a/src/plugins/ios/iossettingswidget.h
+++ b/src/plugins/ios/iossettingswidget.h
@@ -48,11 +48,10 @@ class IosSettingsWidget : public QWidget
Q_OBJECT
public:
// Todo: This would be so much simpler if it just used Utils::PathChooser!!!
- IosSettingsWidget(QWidget *parent);
+ IosSettingsWidget(QWidget *parent = 0);
~IosSettingsWidget();
void saveSettings();
- QString searchKeywords() const;
private slots:
diff --git a/src/plugins/locator/settingspage.cpp b/src/plugins/locator/settingspage.cpp
index a12d3052d7..86d84a5281 100644
--- a/src/plugins/locator/settingspage.cpp
+++ b/src/plugins/locator/settingspage.cpp
@@ -45,7 +45,7 @@ using namespace Locator;
using namespace Locator::Internal;
SettingsPage::SettingsPage(LocatorPlugin *plugin)
- : m_plugin(plugin), m_page(0)
+ : m_plugin(plugin), m_widget(0)
{
setId(Constants::FILTER_OPTIONS_PAGE);
setDisplayName(QCoreApplication::translate("Locator", Locator::Constants::FILTER_OPTIONS_PAGE));
@@ -54,33 +54,30 @@ SettingsPage::SettingsPage(LocatorPlugin *plugin)
setCategoryIcon(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE_ICON));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
-
- m_page = new QWidget(parent);
- m_ui.setupUi(m_page);
- m_ui.refreshInterval->setToolTip(m_ui.refreshIntervalLabel->toolTip());
- connect(m_ui.filterList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
- this, SLOT(updateButtonStates()));
- connect(m_ui.filterList, SIGNAL(itemActivated(QListWidgetItem*)),
- this, SLOT(configureFilter(QListWidgetItem*)));
- connect(m_ui.editButton, SIGNAL(clicked()),
- this, SLOT(configureFilter()));
- connect(m_ui.addButton, SIGNAL(clicked()),
- this, SLOT(addCustomFilter()));
- connect(m_ui.removeButton, SIGNAL(clicked()),
- this, SLOT(removeCustomFilter()));
-
- m_ui.refreshInterval->setValue(m_plugin->refreshInterval());
- m_filters = m_plugin->filters();
- m_customFilters = m_plugin->customFilters();
- saveFilterStates();
- updateFilterList();
- if (m_searchKeywords.isEmpty()) {
- m_searchKeywords = m_ui.refreshIntervalLabel->text();
- m_searchKeywords.remove(QLatin1Char('&'));
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
+ m_ui.refreshInterval->setToolTip(m_ui.refreshIntervalLabel->toolTip());
+ connect(m_ui.filterList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
+ this, SLOT(updateButtonStates()));
+ connect(m_ui.filterList, SIGNAL(itemActivated(QListWidgetItem*)),
+ this, SLOT(configureFilter(QListWidgetItem*)));
+ connect(m_ui.editButton, SIGNAL(clicked()),
+ this, SLOT(configureFilter()));
+ connect(m_ui.addButton, SIGNAL(clicked()),
+ this, SLOT(addCustomFilter()));
+ connect(m_ui.removeButton, SIGNAL(clicked()),
+ this, SLOT(removeCustomFilter()));
+
+ m_ui.refreshInterval->setValue(m_plugin->refreshInterval());
+ m_filters = m_plugin->filters();
+ m_customFilters = m_plugin->customFilters();
+ saveFilterStates();
+ updateFilterList();
}
- return m_page;
+ return m_widget;
}
void SettingsPage::apply()
@@ -114,6 +111,7 @@ void SettingsPage::finish()
m_filters.clear();
m_customFilters.clear();
m_refreshFilters.clear();
+ delete m_widget;
}
void SettingsPage::requestRefresh()
@@ -174,7 +172,7 @@ void SettingsPage::configureFilter(QListWidgetItem *item)
if (!filter->isConfigurable())
return;
bool needsRefresh = false;
- filter->openConfigDialog(m_page, needsRefresh);
+ filter->openConfigDialog(m_widget, needsRefresh);
if (needsRefresh && !m_refreshFilters.contains(filter))
m_refreshFilters.append(filter);
updateFilterList();
@@ -184,7 +182,7 @@ void SettingsPage::addCustomFilter()
{
ILocatorFilter *filter = new DirectoryFilter;
bool needsRefresh = false;
- if (filter->openConfigDialog(m_page, needsRefresh)) {
+ if (filter->openConfigDialog(m_widget, needsRefresh)) {
m_filters.append(filter);
m_addedFilters.append(filter);
m_customFilters.append(filter);
@@ -210,8 +208,3 @@ void SettingsPage::removeCustomFilter()
}
updateFilterList();
}
-
-bool SettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
diff --git a/src/plugins/locator/settingspage.h b/src/plugins/locator/settingspage.h
index 7cd2ec71ee..61d22eb85d 100644
--- a/src/plugins/locator/settingspage.h
+++ b/src/plugins/locator/settingspage.h
@@ -32,10 +32,11 @@
#include "ui_settingspage.h"
-#include <QHash>
-
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QHash>
+#include <QPointer>
+
QT_BEGIN_NAMESPACE
class QListWidgetItem;
QT_END_NAMESPACE
@@ -55,10 +56,9 @@ class SettingsPage : public Core::IOptionsPage
public:
explicit SettingsPage(LocatorPlugin *plugin);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
private slots:
void updateButtonStates();
@@ -74,14 +74,13 @@ private:
Ui::SettingsWidget m_ui;
LocatorPlugin *m_plugin;
- QWidget *m_page;
+ QPointer<QWidget> m_widget;
QList<ILocatorFilter *> m_filters;
QList<ILocatorFilter *> m_addedFilters;
QList<ILocatorFilter *> m_removedFilters;
QList<ILocatorFilter *> m_customFilters;
QList<ILocatorFilter *> m_refreshFilters;
QHash<ILocatorFilter *, QByteArray> m_filterStates;
- QString m_searchKeywords;
};
} // namespace Internal
diff --git a/src/plugins/macros/macrooptionspage.cpp b/src/plugins/macros/macrooptionspage.cpp
index 97220d054c..754ede9bb4 100644
--- a/src/plugins/macros/macrooptionspage.cpp
+++ b/src/plugins/macros/macrooptionspage.cpp
@@ -53,9 +53,10 @@ MacroOptionsPage::MacroOptionsPage(QObject *parent)
TextEditor::Constants::TEXT_EDITOR_SETTINGS_TR_CATEGORY));
}
-QWidget *MacroOptionsPage::createPage(QWidget *parent)
+QWidget *MacroOptionsPage::widget()
{
- m_widget = new MacroOptionsWidget(parent);
+ if (!m_widget)
+ m_widget = new MacroOptionsWidget;
return m_widget;
}
@@ -67,5 +68,5 @@ void MacroOptionsPage::apply()
void MacroOptionsPage::finish()
{
- // Nothing to do
+ delete m_widget;
}
diff --git a/src/plugins/macros/macrooptionspage.h b/src/plugins/macros/macrooptionspage.h
index a1b3575744..62819ab487 100644
--- a/src/plugins/macros/macrooptionspage.h
+++ b/src/plugins/macros/macrooptionspage.h
@@ -32,6 +32,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Macros {
namespace Internal {
@@ -45,12 +47,12 @@ public:
MacroOptionsPage(QObject *parent = 0);
// IOptionsPage implementation
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- Internal::MacroOptionsWidget *m_widget;
+ QPointer<MacroOptionsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/mercurial/optionspage.cpp b/src/plugins/mercurial/optionspage.cpp
index 79e5ca41ad..ca272b9e27 100644
--- a/src/plugins/mercurial/optionspage.cpp
+++ b/src/plugins/mercurial/optionspage.cpp
@@ -68,37 +68,17 @@ void OptionsPageWidget::setSettings(const MercurialSettings &s)
m_ui.timeout->setValue(s.intValue(MercurialSettings::timeoutKey));
}
-QString OptionsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.configGroupBox->title()
- << sep << m_ui.mercurialCommandLabel->text()
- << sep << m_ui.userGroupBox->title()
- << sep << m_ui.defaultUsernameLabel->text()
- << sep << m_ui.defaultEmailLabel->text()
- << sep << m_ui.miscGroupBox->title()
- << sep << m_ui.showLogEntriesLabel->text()
- << sep << m_ui.timeoutSecondsLabel->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
OptionsPage::OptionsPage()
{
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
setDisplayName(tr("Mercurial"));
}
-QWidget *OptionsPage::createPage(QWidget *parent)
+QWidget *OptionsPage::widget()
{
if (!optionsPageWidget)
- optionsPageWidget = new OptionsPageWidget(parent);
+ optionsPageWidget = new OptionsPageWidget;
optionsPageWidget->setSettings(MercurialPlugin::settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = optionsPageWidget->searchKeywords();
return optionsPageWidget;
}
@@ -115,7 +95,7 @@ void OptionsPage::apply()
}
}
-bool OptionsPage::matches(const QString &s) const
+void OptionsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete optionsPageWidget;
}
diff --git a/src/plugins/mercurial/optionspage.h b/src/plugins/mercurial/optionspage.h
index ff55161a7c..acad34a9e6 100644
--- a/src/plugins/mercurial/optionspage.h
+++ b/src/plugins/mercurial/optionspage.h
@@ -51,7 +51,6 @@ public:
MercurialSettings settings() const;
void setSettings(const MercurialSettings &s);
- QString searchKeywords() const;
private:
Ui::OptionsPage m_ui;
@@ -65,16 +64,14 @@ class OptionsPage : public VcsBase::VcsBaseOptionsPage
public:
OptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &s) const;
+ void finish();
signals:
void settingsChanged();
private:
- QString m_searchKeywords;
QPointer<OptionsPageWidget> optionsPageWidget;
};
diff --git a/src/plugins/perforce/perforceversioncontrol.cpp b/src/plugins/perforce/perforceversioncontrol.cpp
index e406d84b60..58f87b8032 100644
--- a/src/plugins/perforce/perforceversioncontrol.cpp
+++ b/src/plugins/perforce/perforceversioncontrol.cpp
@@ -82,8 +82,9 @@ bool PerforceVersionControl::supportsOperation(Operation operation) const
return false;
}
-Core::IVersionControl::OpenSupportMode PerforceVersionControl::openSupportMode() const
+Core::IVersionControl::OpenSupportMode PerforceVersionControl::openSupportMode(const QString &fileName) const
{
+ Q_UNUSED(fileName);
return OpenOptional;
}
diff --git a/src/plugins/perforce/perforceversioncontrol.h b/src/plugins/perforce/perforceversioncontrol.h
index 38aed32304..96f74542f5 100644
--- a/src/plugins/perforce/perforceversioncontrol.h
+++ b/src/plugins/perforce/perforceversioncontrol.h
@@ -51,7 +51,7 @@ public:
bool isConfigured() const;
bool supportsOperation(Operation operation) const;
- OpenSupportMode openSupportMode() const;
+ OpenSupportMode openSupportMode(const QString &fileName) const;
bool vcsOpen(const QString &fileName);
SettingsFlags settingsFlags() const;
bool vcsAdd(const QString &fileName);
diff --git a/src/plugins/perforce/settingspage.cpp b/src/plugins/perforce/settingspage.cpp
index 7c159d4791..e4a9a4f4de 100644
--- a/src/plugins/perforce/settingspage.cpp
+++ b/src/plugins/perforce/settingspage.cpp
@@ -48,6 +48,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
m_ui.setupUi(this);
m_ui.errorLabel->clear();
m_ui.pathChooser->setPromptDialogTitle(tr("Perforce Command"));
+ m_ui.pathChooser->setHistoryCompleter(QLatin1String("Perforce.Command.History"));
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
connect(m_ui.testPushButton, SIGNAL(clicked()), this, SLOT(slotTest()));
}
@@ -142,12 +143,12 @@ SettingsPage::SettingsPage()
setDisplayName(tr("Perforce"));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
- m_widget->setSettings(PerforcePlugin::settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsPageWidget;
+ m_widget->setSettings(PerforcePlugin::settings());
+ }
return m_widget;
}
@@ -156,7 +157,7 @@ void SettingsPage::apply()
PerforcePlugin::setSettings(m_widget->settings());
}
-bool SettingsPage::matches(const QString &s) const
+void SettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/perforce/settingspage.h b/src/plugins/perforce/settingspage.h
index bf12f86541..d4eba73bd3 100644
--- a/src/plugins/perforce/settingspage.h
+++ b/src/plugins/perforce/settingspage.h
@@ -49,7 +49,7 @@ class SettingsPageWidget : public QWidget
Q_OBJECT
public:
- explicit SettingsPageWidget(QWidget *parent);
+ explicit SettingsPageWidget(QWidget *parent = 0);
void setSettings(const PerforceSettings &);
Settings settings() const;
@@ -75,14 +75,12 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
- SettingsPageWidget* m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 31ea3da18a..45b49e8803 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -87,5 +87,3 @@ SUBDIRS += debugger/dumper.pro
linux-* {
SUBDIRS += debugger/ptracepreload.pro
}
-
-include (debugger/lldblib/guest/qtcreator-lldb.pri)
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp
index 74917d06d7..2e19f51803 100644
--- a/src/plugins/projectexplorer/appoutputpane.cpp
+++ b/src/plugins/projectexplorer/appoutputpane.cpp
@@ -101,7 +101,7 @@ void TabWidget::slotContextMenuRequested(const QPoint &pos)
}
AppOutputPane::RunControlTab::RunControlTab(RunControl *rc, Core::OutputWindow *w) :
- runControl(rc), window(w), asyncClosing(false), behavivorOnOutput(Flash)
+ runControl(rc), window(w), asyncClosing(false), behaviorOnOutput(Flash)
{
}
@@ -364,7 +364,7 @@ void AppOutputPane::appendMessage(RunControl *rc, const QString &out, Utils::Out
Core::OutputWindow *window = m_runControlTabs.at(index).window;
window->appendMessage(out, format);
if (format != Utils::NormalMessageFormat) {
- if (m_runControlTabs.at(index).behavivorOnOutput == Flash)
+ if (m_runControlTabs.at(index).behaviorOnOutput == Flash)
flash();
else
popup(NoModeSwitch);
@@ -377,11 +377,11 @@ void AppOutputPane::showTabFor(RunControl *rc)
m_tabWidget->setCurrentIndex(tabWidgetIndexOf(indexOf(rc)));
}
-void AppOutputPane::setBehaviorOnOutput(RunControl *rc, AppOutputPane::BehavivorOnOutput mode)
+void AppOutputPane::setBehaviorOnOutput(RunControl *rc, AppOutputPane::BehaviorOnOutput mode)
{
const int index = indexOf(rc);
if (index != -1)
- m_runControlTabs[index].behavivorOnOutput = mode;
+ m_runControlTabs[index].behaviorOnOutput = mode;
}
void AppOutputPane::reRunRunControl()
diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h
index af9dc3fa0b..883385bf71 100644
--- a/src/plugins/projectexplorer/appoutputpane.h
+++ b/src/plugins/projectexplorer/appoutputpane.h
@@ -60,7 +60,7 @@ public:
CloseTabWithPrompt
};
- enum BehavivorOnOutput {
+ enum BehaviorOnOutput {
Flash,
Popup
};
@@ -86,7 +86,7 @@ public:
void createNewOutputWindow(RunControl *rc);
void showTabFor(RunControl *rc);
- void setBehaviorOnOutput(RunControl *rc, BehavivorOnOutput mode);
+ void setBehaviorOnOutput(RunControl *rc, BehaviorOnOutput mode);
bool aboutToClose() const;
bool closeTabs(CloseTabMode mode);
@@ -130,7 +130,7 @@ private:
Core::OutputWindow *window;
// Is the run control stopping asynchronously, close the tab once it finishes
bool asyncClosing;
- BehavivorOnOutput behavivorOnOutput;
+ BehaviorOnOutput behaviorOnOutput;
};
bool isRunning() const;
diff --git a/src/plugins/projectexplorer/clangparser.h b/src/plugins/projectexplorer/clangparser.h
index 3734ef8978..23ff723f51 100644
--- a/src/plugins/projectexplorer/clangparser.h
+++ b/src/plugins/projectexplorer/clangparser.h
@@ -37,7 +37,7 @@
namespace ProjectExplorer {
-class ClangParser : public ProjectExplorer::GccParser
+class PROJECTEXPLORER_EXPORT ClangParser : public ProjectExplorer::GccParser
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/customtoolchain.cpp b/src/plugins/projectexplorer/customtoolchain.cpp
index 98b881d74a..e01179e9c6 100644
--- a/src/plugins/projectexplorer/customtoolchain.cpp
+++ b/src/plugins/projectexplorer/customtoolchain.cpp
@@ -501,7 +501,9 @@ CustomToolChainConfigWidget::CustomToolChainConfigWidget(CustomToolChain *tc) :
m_cxx11Flags->setToolTip(tr("Comma-separated list of flags that turn on C++11 support."));
m_mkspecs->setToolTip(tr("Comma-separated list of mkspecs."));
m_compilerCommand->setExpectedKind(PathChooser::ExistingCommand);
+ m_compilerCommand->setHistoryCompleter(QLatin1String("PE.ToolChainCommand.History"));
m_makeCommand->setExpectedKind(PathChooser::ExistingCommand);
+ m_makeCommand->setHistoryCompleter(QLatin1String("PE.MakeCommand.History"));
m_mainLayout->addRow(tr("&Compiler path:"), m_compilerCommand);
m_mainLayout->addRow(tr("&Make path:"), m_makeCommand);
m_mainLayout->addRow(tr("&ABI:"), m_abiWidget);
diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
index dc9e218d71..0382cedcef 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
@@ -336,6 +336,7 @@ QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName,
pathChooser->setExpectedKind(Utils::PathChooser::Command);
else if (expectedKind == QLatin1String("any"))
pathChooser->setExpectedKind(Utils::PathChooser::Any);
+ pathChooser->setHistoryCompleter(QString::fromLatin1("PE.Custom.") + m_parameters->id + QLatin1Char('.') + field.name);
registerField(fieldName, pathChooser, "path", SIGNAL(changed(QString)));
// Connect to completeChanged() for derived classes that reimplement isComplete()
@@ -523,6 +524,7 @@ CustomWizardPage::CustomWizardPage(const QSharedPointer<CustomWizardContext> &ct
CustomWizardFieldPage(ctx, parameters, parent),
m_pathChooser(new Utils::PathChooser)
{
+ m_pathChooser->setHistoryCompleter(QLatin1String("PE.ProjectDir.History"));
addRow(tr("Path:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(validChanged()), this, SIGNAL(completeChanged()));
}
diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
index 8cb99a3d93..bcc0f5a785 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
@@ -587,6 +587,7 @@ CustomWizardParameters::ParseResult
if (!booleanAttributeValue(reader, wizardEnabledAttributeC, true))
return ParseDisabled;
bp->id = attributeValue(reader, idAttributeC);
+ id = bp->id;
bp->category = attributeValue(reader, categoryAttributeC);
bp->kind = kindAttribute(reader);
bp->requiredFeatures = requiredFeatures(reader);
diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.h b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
index cd531d2b74..de871f5b35 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardparameters.h
+++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
@@ -111,6 +111,7 @@ public:
Core::IWizard::Data *bp, QString *errorMessage);
QString toString() const;
+ QString id;
QString directory;
QString klass;
QList<CustomWizardFile> files;
diff --git a/src/plugins/projectexplorer/devicesupport/deviceapplicationrunner.cpp b/src/plugins/projectexplorer/devicesupport/deviceapplicationrunner.cpp
index be3ba91a5f..b336e0535b 100644
--- a/src/plugins/projectexplorer/devicesupport/deviceapplicationrunner.cpp
+++ b/src/plugins/projectexplorer/devicesupport/deviceapplicationrunner.cpp
@@ -35,7 +35,6 @@
#include <utils/environment.h>
#include <utils/qtcassert.h>
-#include <QCoreApplication>
#include <QStringList>
#include <QTimer>
@@ -101,8 +100,7 @@ void DeviceApplicationRunner::start(const IDevice::ConstPtr &device,
}
if (command.isEmpty()) {
- emit reportError(QCoreApplication::translate("RemoteLinux::RemoteLinuxRunConfiguration",
- "Don't know what to run.")); // FIXME: Transitional message for 3.0.
+ emit reportError(tr("Cannot run: No command given."));
setFinished();
return;
}
diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp
index 13aa949d8f..b9f15fd514 100644
--- a/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicesettingspage.cpp
@@ -48,16 +48,10 @@ DeviceSettingsPage::DeviceSettingsPage(QObject *parent)
setCategoryIcon(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
}
-bool DeviceSettingsPage::matches(const QString &searchKeyWord) const
+QWidget *DeviceSettingsPage::widget()
{
- return m_keywords.contains(searchKeyWord, Qt::CaseInsensitive);
-}
-
-QWidget *DeviceSettingsPage::createPage(QWidget *parent)
-{
- m_widget = new DeviceSettingsWidget(parent);
- if (m_keywords.isEmpty())
- m_keywords = m_widget->searchKeywords();
+ if (!m_widget)
+ m_widget = new DeviceSettingsWidget;
return m_widget;
}
@@ -68,6 +62,7 @@ void DeviceSettingsPage::apply()
void DeviceSettingsPage::finish()
{
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingspage.h b/src/plugins/projectexplorer/devicesupport/devicesettingspage.h
index 676b8e2b56..93f5957c4f 100644
--- a/src/plugins/projectexplorer/devicesupport/devicesettingspage.h
+++ b/src/plugins/projectexplorer/devicesupport/devicesettingspage.h
@@ -31,6 +31,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace ProjectExplorer {
namespace Internal {
@@ -43,14 +45,12 @@ class DeviceSettingsPage : public Core::IOptionsPage
public:
DeviceSettingsPage(QObject *parent = 0);
- bool matches(const QString &searchKeyWord) const;
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- QString m_keywords;
- DeviceSettingsWidget *m_widget;
+ QPointer<DeviceSettingsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h
index c953fb9a95..1a4d2b4b63 100644
--- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h
+++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.h
@@ -55,7 +55,7 @@ class DeviceSettingsWidget : public QWidget
{
Q_OBJECT
public:
- DeviceSettingsWidget(QWidget *parent);
+ DeviceSettingsWidget(QWidget *parent = 0);
~DeviceSettingsWidget();
void saveSettings();
diff --git a/src/plugins/projectexplorer/gccparser.h b/src/plugins/projectexplorer/gccparser.h
index 015b53f053..bd9609c386 100644
--- a/src/plugins/projectexplorer/gccparser.h
+++ b/src/plugins/projectexplorer/gccparser.h
@@ -38,7 +38,7 @@
namespace ProjectExplorer {
-class GccParser : public ProjectExplorer::IOutputParser
+class PROJECTEXPLORER_EXPORT GccParser : public ProjectExplorer::IOutputParser
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 45fb926236..df2e4803aa 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -852,6 +852,7 @@ GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) :
const QStringList gnuVersionArgs = QStringList(QLatin1String("--version"));
m_compilerCommand->setExpectedKind(PathChooser::ExistingCommand);
m_compilerCommand->setCommandVersionArguments(gnuVersionArgs);
+ m_compilerCommand->setHistoryCompleter(QLatin1String("PE.Gcc.Command.History"));
m_mainLayout->addRow(tr("&Compiler path:"), m_compilerCommand);
m_platformCodeGenFlagsLineEdit = new QLineEdit(this);
m_platformCodeGenFlagsLineEdit->setText(QtcProcess::joinArgs(tc->platformCodeGenFlags()));
diff --git a/src/plugins/projectexplorer/importwidget.cpp b/src/plugins/projectexplorer/importwidget.cpp
index e7e631f6cf..f50fb90357 100644
--- a/src/plugins/projectexplorer/importwidget.cpp
+++ b/src/plugins/projectexplorer/importwidget.cpp
@@ -59,6 +59,7 @@ ImportWidget::ImportWidget(QWidget *parent) :
layout->addWidget(m_pathChooser);
m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_pathChooser->setHistoryCompleter(QLatin1String("SourceDir.History"));
QPushButton *importButton = new QPushButton(tr("Import"), widget);
layout->addWidget(importButton);
diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp
index 7d16bc23a7..844ae4e388 100644
--- a/src/plugins/projectexplorer/kit.cpp
+++ b/src/plugins/projectexplorer/kit.cpp
@@ -49,6 +49,7 @@ namespace {
const char ID_KEY[] = "PE.Profile.Id";
const char DISPLAYNAME_KEY[] = "PE.Profile.Name";
const char AUTODETECTED_KEY[] = "PE.Profile.AutoDetected";
+const char AUTODETECTIONSOURCE_KEY[] = "PE.Profile.AutoDetectionSource";
const char SDK_PROVIDED_KEY[] = "PE.Profile.SDK";
const char DATA_KEY[] = "PE.Profile.Data";
const char ICON_KEY[] = "PE.Profile.Icon";
@@ -71,6 +72,7 @@ public:
m_id(id),
m_nestedBlockingLevel(0),
m_autodetected(false),
+ m_autoDetectionSource(QString()),
m_sdkProvided(false),
m_isValid(true),
m_hasWarning(false),
@@ -89,6 +91,7 @@ public:
Id m_id;
int m_nestedBlockingLevel;
bool m_autodetected;
+ QString m_autoDetectionSource;
bool m_sdkProvided;
bool m_isValid;
bool m_hasWarning;
@@ -124,6 +127,7 @@ Kit::Kit(const QVariantMap &data) :
d->m_id = Id::fromSetting(data.value(QLatin1String(ID_KEY)));
d->m_autodetected = data.value(QLatin1String(AUTODETECTED_KEY)).toBool();
+ d->m_autoDetectionSource = data.value(QLatin1String(AUTODETECTIONSOURCE_KEY)).toString();
// if we don't have that setting assume that autodetected implies sdk
QVariant value = data.value(QLatin1String(SDK_PROVIDED_KEY));
@@ -197,6 +201,7 @@ void Kit::copyFrom(const Kit *k)
d->m_iconPath = k->d->m_iconPath;
d->m_icon = k->d->m_icon;
d->m_autodetected = k->d->m_autodetected;
+ d->m_autoDetectionSource = k->d->m_autoDetectionSource;
d->m_displayName = k->d->m_displayName;
d->m_mustNotify = true;
d->m_mustNotifyAboutDisplayName = true;
@@ -321,6 +326,11 @@ bool Kit::isAutoDetected() const
return d->m_autodetected;
}
+QString Kit::autoDetectionSource() const
+{
+ return d->m_autoDetectionSource;
+}
+
bool Kit::isSdkProvided() const
{
return d->m_sdkProvided;
@@ -418,11 +428,12 @@ QVariantMap Kit::toMap() const
data.insert(QLatin1String(ID_KEY), QString::fromLatin1(d->m_id.name()));
data.insert(QLatin1String(DISPLAYNAME_KEY), d->m_displayName);
data.insert(QLatin1String(AUTODETECTED_KEY), d->m_autodetected);
+ data.insert(QLatin1String(AUTODETECTIONSOURCE_KEY), d->m_autoDetectionSource);
data.insert(QLatin1String(SDK_PROVIDED_KEY), d->m_sdkProvided);
data.insert(QLatin1String(ICON_KEY), d->m_iconPath.toString());
QStringList mutableInfo;
- foreach (const Core::Id &id, d->m_mutable.values())
+ foreach (const Core::Id &id, d->m_mutable)
mutableInfo << id.toString();
data.insert(QLatin1String(MUTABLE_INFO_KEY), mutableInfo);
@@ -496,6 +507,11 @@ void Kit::setAutoDetected(bool detected)
d->m_autodetected = detected;
}
+void Kit::setAutoDetectionSource(const QString &autoDetectionSource)
+{
+ d->m_autoDetectionSource = autoDetectionSource;
+}
+
void Kit::setSdkProvided(bool sdkProvided)
{
d->m_sdkProvided = sdkProvided;
diff --git a/src/plugins/projectexplorer/kit.h b/src/plugins/projectexplorer/kit.h
index 0bd64ccf7a..14002ce025 100644
--- a/src/plugins/projectexplorer/kit.h
+++ b/src/plugins/projectexplorer/kit.h
@@ -76,6 +76,7 @@ public:
QString fileSystemFriendlyName() const;
bool isAutoDetected() const;
+ QString autoDetectionSource() const;
bool isSdkProvided() const;
Core::Id id() const;
@@ -102,6 +103,7 @@ public:
// Note: Stickyness is *not* saved!
void setAutoDetected(bool detected);
+ void setAutoDetectionSource(const QString &autoDetectionSource);
void makeSticky();
void setSticky(Core::Id id, bool b);
void makeUnSticky();
diff --git a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp
index 7c5ac9bcad..4e62dcc149 100644
--- a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp
+++ b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp
@@ -61,6 +61,7 @@ SysRootInformationConfigWidget::SysRootInformationConfigWidget(Kit *k, const Kit
{
m_chooser = new Utils::PathChooser;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_chooser->setHistoryCompleter(QLatin1String("PE.SysRoot.History"));
m_chooser->setFileName(SysRootKitInformation::sysRoot(k));
connect(m_chooser, SIGNAL(changed(QString)), this, SLOT(pathWasChanged()));
}
diff --git a/src/plugins/projectexplorer/kitoptionspage.cpp b/src/plugins/projectexplorer/kitoptionspage.cpp
index a39b5b70df..51b3a91354 100644
--- a/src/plugins/projectexplorer/kitoptionspage.cpp
+++ b/src/plugins/projectexplorer/kitoptionspage.cpp
@@ -59,76 +59,75 @@ KitOptionsPage::KitOptionsPage() :
setCategoryIcon(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
-QWidget *KitOptionsPage::createPage(QWidget *parent)
+QWidget *KitOptionsPage::widget()
{
- m_configWidget = new QWidget(parent);
+ if (!m_configWidget) {
+ m_configWidget = new QWidget;
- m_kitsView = new QTreeView(m_configWidget);
- m_kitsView->setUniformRowHeights(true);
- m_kitsView->header()->setStretchLastSection(true);
- m_kitsView->setSizePolicy(m_kitsView->sizePolicy().horizontalPolicy(),
+ m_kitsView = new QTreeView(m_configWidget);
+ m_kitsView->setUniformRowHeights(true);
+ m_kitsView->header()->setStretchLastSection(true);
+ m_kitsView->setSizePolicy(m_kitsView->sizePolicy().horizontalPolicy(),
QSizePolicy::Ignored);
- m_addButton = new QPushButton(tr("Add"), m_configWidget);
- m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
- m_delButton = new QPushButton(tr("Remove"), m_configWidget);
- m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget);
-
- QVBoxLayout *buttonLayout = new QVBoxLayout();
- buttonLayout->setSpacing(6);
- buttonLayout->setContentsMargins(0, 0, 0, 0);
- buttonLayout->addWidget(m_addButton);
- buttonLayout->addWidget(m_cloneButton);
- buttonLayout->addWidget(m_delButton);
- buttonLayout->addWidget(m_makeDefaultButton);
- buttonLayout->addStretch();
-
- QHBoxLayout *horizontalLayout = new QHBoxLayout();
- horizontalLayout->addWidget(m_kitsView);
- horizontalLayout->addLayout(buttonLayout);
-
- QVBoxLayout *verticalLayout = new QVBoxLayout(m_configWidget);
- verticalLayout->addLayout(horizontalLayout);
-
- m_model = new Internal::KitModel(verticalLayout);
- connect(m_model, SIGNAL(kitStateChanged()), this, SLOT(updateState()));
- verticalLayout->setStretch(0, 1);
- verticalLayout->setStretch(1, 0);
-
- m_kitsView->setModel(m_model);
- m_kitsView->header()->setResizeMode(0, QHeaderView::Stretch);
- m_kitsView->expandAll();
-
- m_selectionModel = m_kitsView->selectionModel();
- connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(kitSelectionChanged()));
- connect(KitManager::instance(), SIGNAL(kitAdded(ProjectExplorer::Kit*)),
- this, SLOT(kitSelectionChanged()));
- connect(KitManager::instance(), SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
- this, SLOT(kitSelectionChanged()));
- connect(KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
- this, SLOT(kitSelectionChanged()));
-
- // Set up add menu:
- connect(m_addButton, SIGNAL(clicked()), this, SLOT(addNewKit()));
- connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneKit()));
- connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeKit()));
- connect(m_makeDefaultButton, SIGNAL(clicked()), this, SLOT(makeDefaultKit()));
-
- m_searchKeywords = tr("Kits");
-
- updateState();
-
- if (m_toShow) {
- QModelIndex index = m_model->indexOf(m_toShow);
- m_selectionModel->select(index,
- QItemSelectionModel::Clear
- | QItemSelectionModel::SelectCurrent
- | QItemSelectionModel::Rows);
- m_kitsView->scrollTo(index);
+ m_addButton = new QPushButton(tr("Add"), m_configWidget);
+ m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
+ m_delButton = new QPushButton(tr("Remove"), m_configWidget);
+ m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget);
+
+ QVBoxLayout *buttonLayout = new QVBoxLayout();
+ buttonLayout->setSpacing(6);
+ buttonLayout->setContentsMargins(0, 0, 0, 0);
+ buttonLayout->addWidget(m_addButton);
+ buttonLayout->addWidget(m_cloneButton);
+ buttonLayout->addWidget(m_delButton);
+ buttonLayout->addWidget(m_makeDefaultButton);
+ buttonLayout->addStretch();
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout();
+ horizontalLayout->addWidget(m_kitsView);
+ horizontalLayout->addLayout(buttonLayout);
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout(m_configWidget);
+ verticalLayout->addLayout(horizontalLayout);
+
+ m_model = new Internal::KitModel(verticalLayout);
+ connect(m_model, SIGNAL(kitStateChanged()), this, SLOT(updateState()));
+ verticalLayout->setStretch(0, 1);
+ verticalLayout->setStretch(1, 0);
+
+ m_kitsView->setModel(m_model);
+ m_kitsView->header()->setResizeMode(0, QHeaderView::Stretch);
+ m_kitsView->expandAll();
+
+ m_selectionModel = m_kitsView->selectionModel();
+ connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SLOT(kitSelectionChanged()));
+ connect(KitManager::instance(), SIGNAL(kitAdded(ProjectExplorer::Kit*)),
+ this, SLOT(kitSelectionChanged()));
+ connect(KitManager::instance(), SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
+ this, SLOT(kitSelectionChanged()));
+ connect(KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
+ this, SLOT(kitSelectionChanged()));
+
+ // Set up add menu:
+ connect(m_addButton, SIGNAL(clicked()), this, SLOT(addNewKit()));
+ connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneKit()));
+ connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeKit()));
+ connect(m_makeDefaultButton, SIGNAL(clicked()), this, SLOT(makeDefaultKit()));
+
+ updateState();
+
+ if (m_toShow) {
+ QModelIndex index = m_model->indexOf(m_toShow);
+ m_selectionModel->select(index,
+ QItemSelectionModel::Clear
+ | QItemSelectionModel::SelectCurrent
+ | QItemSelectionModel::Rows);
+ m_kitsView->scrollTo(index);
+ }
+ m_toShow = 0;
}
- m_toShow = 0;
-
return m_configWidget;
}
@@ -145,18 +144,13 @@ void KitOptionsPage::finish()
m_model = 0;
}
- m_configWidget = 0; // deleted by settingsdialog
+ delete m_configWidget;
m_selectionModel = 0; // child of m_configWidget
m_kitsView = 0; // child of m_configWidget
m_currentWidget = 0; // deleted by the model
m_toShow = 0;
}
-bool KitOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void KitOptionsPage::showKit(Kit *k)
{
m_toShow = k;
diff --git a/src/plugins/projectexplorer/kitoptionspage.h b/src/plugins/projectexplorer/kitoptionspage.h
index 8022f82b8a..477a0e9c77 100644
--- a/src/plugins/projectexplorer/kitoptionspage.h
+++ b/src/plugins/projectexplorer/kitoptionspage.h
@@ -35,6 +35,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QModelIndex>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QItemSelectionModel;
@@ -59,10 +60,9 @@ class PROJECTEXPLORER_EXPORT KitOptionsPage : public Core::IOptionsPage
public:
KitOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
void showKit(Kit *k);
@@ -83,8 +83,7 @@ private:
QPushButton *m_delButton;
QPushButton *m_makeDefaultButton;
- QWidget *m_configWidget;
- QString m_searchKeywords;
+ QPointer<QWidget> m_configWidget;
Internal::KitModel *m_model;
QItemSelectionModel *m_selectionModel;
diff --git a/src/plugins/projectexplorer/msvcparser.h b/src/plugins/projectexplorer/msvcparser.h
index e67547d53c..a54c554c2a 100644
--- a/src/plugins/projectexplorer/msvcparser.h
+++ b/src/plugins/projectexplorer/msvcparser.h
@@ -38,7 +38,7 @@
namespace ProjectExplorer {
-class MsvcParser : public ProjectExplorer::IOutputParser
+class PROJECTEXPLORER_EXPORT MsvcParser : public ProjectExplorer::IOutputParser
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/osparser.h b/src/plugins/projectexplorer/osparser.h
index ccc4364ca0..1ccbea39d8 100644
--- a/src/plugins/projectexplorer/osparser.h
+++ b/src/plugins/projectexplorer/osparser.h
@@ -38,7 +38,7 @@
namespace ProjectExplorer {
-class OsParser : public ProjectExplorer::IOutputParser
+class PROJECTEXPLORER_EXPORT OsParser : public ProjectExplorer::IOutputParser
{
Q_OBJECT
diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp
index 93114501f7..fd55ec46cd 100644
--- a/src/plugins/projectexplorer/processstep.cpp
+++ b/src/plugins/projectexplorer/processstep.cpp
@@ -236,6 +236,7 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step)
{
m_ui.setupUi(this);
m_ui.command->setExpectedKind(Utils::PathChooser::Command);
+ m_ui.command->setHistoryCompleter(QLatin1String("PE.ProcessStepCommand.History"));
m_ui.workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
BuildConfiguration *bc = m_step->buildConfiguration();
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 070e967fbe..d43a9c20c0 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -84,6 +84,7 @@ public:
ProjectPrivate();
~ProjectPrivate();
+ Core::Id m_id;
QList<Target *> m_targets;
Target *m_activeTarget;
EditorConfiguration *m_editorConfiguration;
@@ -112,6 +113,12 @@ Project::~Project()
delete d;
}
+Core::Id Project::id() const
+{
+ QTC_CHECK(d->m_id.isValid());
+ return d->m_id;
+}
+
QString Project::projectFilePath() const
{
return document()->filePath();
@@ -262,6 +269,11 @@ bool Project::setupTarget(Target *t)
return true;
}
+void Project::setId(Core::Id id)
+{
+ d->m_id = id;
+}
+
Target *Project::restoreTarget(const QVariantMap &data)
{
Core::Id id = idFromMap(data);
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 962512c7b1..8a0560af5c 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -73,7 +73,7 @@ public:
virtual ~Project();
virtual QString displayName() const = 0;
- virtual Core::Id id() const = 0;
+ Core::Id id() const;
virtual Core::IDocument *document() const = 0;
virtual IProjectManager *projectManager() const = 0;
@@ -161,6 +161,7 @@ protected:
virtual bool fromMap(const QVariantMap &map);
virtual bool setupTarget(Target *t);
+ void setId(Core::Id id);
void setProjectContext(Core::Context context);
void setProjectLanguages(Core::Context language);
void addProjectLanguage(Core::Id id);
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 413f49d12b..8200a58b30 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -76,6 +76,7 @@
#include "miniprojecttargetselector.h"
#include "taskhub.h"
#include "customtoolchain.h"
+#include "selectablefilesmodel.h"
#include <projectexplorer/customwizard/customwizard.h>
#include "devicesupport/desktopdevice.h"
#include "devicesupport/desktopdevicefactory.h"
@@ -199,6 +200,7 @@ struct ProjectExplorerPluginPrivate {
QAction *m_cancelBuildAction;
QAction *m_addNewFileAction;
QAction *m_addExistingFilesAction;
+ QAction *m_addExistingDirectoryAction;
QAction *m_addNewSubprojectAction;
QAction *m_removeFileAction;
QAction *m_removeProjectAction;
@@ -539,7 +541,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_openWithMenu->setTitle(tr("Open With"));
connect(d->m_openWithMenu, SIGNAL(triggered(QAction*)),
- DocumentManager::instance(), SLOT(slotExecuteOpenWithMenuAction(QAction*)));
+ DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
//
// Separators
@@ -796,6 +798,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
+ // add existing directory action
+ d->m_addExistingDirectoryAction = new QAction(tr("Add Existing Directory..."), this);
+ cmd = Core::ActionManager::registerAction(d->m_addExistingDirectoryAction,
+ ProjectExplorer::Constants::ADDEXISTINGDIRECTORY,
+ projecTreeContext);
+ mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
+ msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
+ mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
+
// new subproject action
d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this);
cmd = ActionManager::registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT,
@@ -963,6 +974,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(d->m_closeAllProjects, SIGNAL(triggered()), this, SLOT(closeAllProjects()));
connect(d->m_addNewFileAction, SIGNAL(triggered()), this, SLOT(addNewFile()));
connect(d->m_addExistingFilesAction, SIGNAL(triggered()), this, SLOT(addExistingFiles()));
+ connect(d->m_addExistingDirectoryAction, SIGNAL(triggered()), this, SLOT(addExistingDirectory()));
connect(d->m_addNewSubprojectAction, SIGNAL(triggered()), this, SLOT(addNewSubproject()));
connect(d->m_removeProjectAction, SIGNAL(triggered()), this, SLOT(removeProject()));
connect(d->m_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
@@ -1373,8 +1385,10 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
}
if (const MimeType mt = MimeDatabase::findByFile(QFileInfo(fileName))) {
+ bool foundProjectManager = false;
foreach (IProjectManager *manager, projectManagers) {
if (manager->mimeType() == mt.type()) {
+ foundProjectManager = true;
QString tmp;
if (Project *pro = manager->openProject(filePath, &tmp)) {
if (pro->restoreSettings()) {
@@ -1385,6 +1399,8 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
setCurrentNode(pro->rootProjectNode());
openedPro += pro;
} else {
+ appendError(errorString, tr("Failed opening project '%1': Settings could not be restored")
+ .arg(QDir::toNativeSeparators(fileName)));
delete pro;
}
}
@@ -1393,6 +1409,14 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
break;
}
}
+ if (!foundProjectManager) {
+ appendError(errorString, tr("Failed opening project '%1': No plugin can open project type '%2'.")
+ .arg(QDir::toNativeSeparators(fileName))
+ .arg((mt.type())));
+ }
+ } else {
+ appendError(errorString, tr("Failed opening project '%1': Unknown project type.")
+ .arg(QDir::toNativeSeparators(fileName)));
}
SessionManager::reportProjectLoadingProgress();
}
@@ -2632,6 +2656,7 @@ void ProjectExplorerPlugin::invalidateProject(Project *project)
void ProjectExplorerPlugin::updateContextMenuActions()
{
d->m_addExistingFilesAction->setEnabled(false);
+ d->m_addExistingDirectoryAction->setEnabled(false);
d->m_addNewFileAction->setEnabled(false);
d->m_addNewSubprojectAction->setEnabled(false);
d->m_removeFileAction->setEnabled(false);
@@ -2639,6 +2664,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
d->m_renameFileAction->setEnabled(false);
d->m_addExistingFilesAction->setVisible(true);
+ d->m_addExistingDirectoryAction->setVisible(true);
d->m_removeFileAction->setVisible(true);
d->m_deleteFileAction->setVisible(true);
d->m_runActionContextMenu->setVisible(false);
@@ -2676,6 +2702,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
&& actions.contains(ProjectNode::AddSubProject));
d->m_addExistingFilesAction->setEnabled(actions.contains(ProjectNode::AddExistingFile));
+ d->m_addExistingDirectoryAction->setEnabled(actions.contains(ProjectNode::AddExistingDirectory));
d->m_renameFileAction->setEnabled(actions.contains(ProjectNode::Rename));
} else if (qobject_cast<FileNode*>(d->m_currentNode)) {
// Enable and show remove / delete in magic ways:
@@ -2785,6 +2812,17 @@ void ProjectExplorerPlugin::addExistingFiles()
addExistingFiles(fileNames);
}
+void ProjectExplorerPlugin::addExistingDirectory()
+{
+ QTC_ASSERT(d->m_currentNode, return);
+
+ const QString path = QFileInfo(d->m_currentNode->path()).absolutePath();
+ SelectableFilesDialogAddDirectory dialog(path, QStringList(), Core::ICore::mainWindow());
+
+ if (dialog.exec() == QDialog::Accepted)
+ addExistingFiles(dialog.selectedFiles());
+}
+
void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths)
{
ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode->projectNode());
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 2c24bda6a2..fbb4d5fba7 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -186,6 +186,7 @@ private slots:
void addNewFile();
void addExistingFiles();
+ void addExistingDirectory();
void addNewSubproject();
void removeProject();
void openFile();
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 16eee949d3..03daf8b229 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -141,7 +141,8 @@ HEADERS += projectexplorer.h \
projectmacroexpander.h \
customparser.h \
customparserconfigdialog.h \
- ipotentialkit.h
+ ipotentialkit.h \
+ selectablefilesmodel.h
SOURCES += projectexplorer.cpp \
abi.cpp \
@@ -269,7 +270,8 @@ SOURCES += projectexplorer.cpp \
projectmacroexpander.cpp \
customparser.cpp \
customparserconfigdialog.cpp \
- ipotentialkit.cpp
+ ipotentialkit.cpp \
+ selectablefilesmodel.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 357a4c5351..1a10feb66d 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -121,6 +121,7 @@ QtcPlugin {
"runconfiguration.cpp", "runconfiguration.h",
"runconfigurationmodel.cpp", "runconfigurationmodel.h",
"runsettingspropertiespage.cpp", "runsettingspropertiespage.h",
+ "selectablefilesmodel.cpp", "selectablefilesmodel.h",
"session.cpp", "session.h",
"sessiondialog.cpp", "sessiondialog.h", "sessiondialog.ui",
"settingsaccessor.cpp", "settingsaccessor.h",
@@ -141,7 +142,7 @@ QtcPlugin {
"toolchainmanager.cpp", "toolchainmanager.h",
"toolchainoptionspage.cpp", "toolchainoptionspage.h",
"unconfiguredprojectpanel.cpp", "unconfiguredprojectpanel.h",
- "vcsannotatetaskhandler.cpp", "vcsannotatetaskhandler.h",
+ "vcsannotatetaskhandler.cpp", "vcsannotatetaskhandler.h"
]
}
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index 45db16556e..f0b8f3f59d 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -69,6 +69,7 @@ const char RUNCONTEXTMENU[] = "ProjectExplorer.RunContextMenu";
const char STOP[] = "ProjectExplorer.Stop";
const char ADDNEWFILE[] = "ProjectExplorer.AddNewFile";
const char ADDEXISTINGFILES[] = "ProjectExplorer.AddExistingFiles";
+const char ADDEXISTINGDIRECTORY[] = "ProjectExplorer.AddExistingDirectory";
const char ADDNEWSUBPROJECT[] = "ProjectExplorer.AddNewSubproject";
const char REMOVEPROJECT[] = "ProjectExplorer.RemoveProject";
const char OPENFILE[] = "ProjectExplorer.OpenFile";
@@ -245,6 +246,12 @@ const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
const char VAR_CURRENTSESSION_PREFIX[] = "CurrentSession";
const char VAR_CURRENTSESSION_NAME[] = "CurrentSession:Name";
+const char HIDE_FILE_FILTER_SETTING[] = "GenericProject/FileFilter";
+const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes; *.autosave";
+
+const char SHOW_FILE_FILTER_SETTING[] = "GenericProject/ShowFileFilter";
+const char SHOW_FILE_FILTER_DEFAULT[] = "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++; *.h; *.hh; *.hpp; *.hxx;";
+
// Unconfigured Panel
const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
index 6ad0591fed..b43cb45db1 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
@@ -150,29 +150,6 @@ void ProjectExplorerSettingsWidget::updateResetButton()
m_ui.resetButton->setEnabled(buildDirectory() != QLatin1String(Core::Constants::DEFAULT_BUILD_DIRECTORY));
}
-QString ProjectExplorerSettingsWidget::searchKeywords() const
-{
- if (m_searchKeywords.isEmpty()) {
- QLatin1Char sep(' ');
- m_searchKeywords = m_ui.directoryGroupBox->title()
- + sep + m_ui.currentDirectoryRadioButton->text()
- + sep + m_ui.directoryRadioButton->text()
- + sep + m_ui.buildAndRunGroupBox->title()
- + sep + m_ui.saveAllFilesCheckBox->text()
- + sep + m_ui.buildProjectBeforeDeployCheckBox->text()
- + sep + m_ui.deployProjectBeforeRunCheckBox->text()
- + sep + m_ui.showCompileOutputCheckBox->text()
- + sep + m_ui.cleanOldAppOutputCheckBox->text()
- + sep + m_ui.mergeStdErrAndStdOutCheckBox->text()
- + sep + m_ui.mergeStdErrAndStdOutCheckBox->toolTip()
- + sep + m_ui.wrapAppOutputCheckBox->text()
- + sep + m_ui.jomLabel->text()
- ;
- m_searchKeywords.remove(QLatin1Char('&'));
- }
- return m_searchKeywords;
-}
-
// ------------------ ProjectExplorerSettingsPage
ProjectExplorerSettingsPage::ProjectExplorerSettingsPage()
{
@@ -188,15 +165,15 @@ ProjectExplorerSettingsPage::~ProjectExplorerSettingsPage()
{
}
-QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent)
+QWidget *ProjectExplorerSettingsPage::widget()
{
- m_widget = new ProjectExplorerSettingsWidget(parent);
- m_widget->setSettings(ProjectExplorerPlugin::projectExplorerSettings());
- m_widget->setProjectsDirectory(Core::DocumentManager::projectsDirectory());
- m_widget->setUseProjectsDirectory(Core::DocumentManager::useProjectsDirectory());
- m_widget->setBuildDirectory(Core::DocumentManager::buildDirectory());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new ProjectExplorerSettingsWidget;
+ m_widget->setSettings(ProjectExplorerPlugin::projectExplorerSettings());
+ m_widget->setProjectsDirectory(Core::DocumentManager::projectsDirectory());
+ m_widget->setUseProjectsDirectory(Core::DocumentManager::useProjectsDirectory());
+ m_widget->setBuildDirectory(Core::DocumentManager::buildDirectory());
+ }
return m_widget;
}
@@ -212,12 +189,7 @@ void ProjectExplorerSettingsPage::apply()
void ProjectExplorerSettingsPage::finish()
{
- // Nothing to do
-}
-
-bool ProjectExplorerSettingsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.h b/src/plugins/projectexplorer/projectexplorersettingspage.h
index 38b99181f4..2dbc211753 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.h
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.h
@@ -59,8 +59,6 @@ public:
QString buildDirectory() const;
void setBuildDirectory(const QString &bd);
- QString searchKeywords() const;
-
private slots:
void slotDirectoryButtonGroupChanged();
void resetDefaultBuildDirectory();
@@ -70,7 +68,6 @@ private:
void setJomVisible(bool);
Ui::ProjectExplorerSettingsPageUi m_ui;
- mutable QString m_searchKeywords;
QUuid m_environmentId;
};
@@ -82,13 +79,11 @@ public:
ProjectExplorerSettingsPage();
~ProjectExplorerSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
private:
- QString m_searchKeywords;
QPointer<ProjectExplorerSettingsWidget> m_widget;
};
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index 424a877d80..fe5edc905a 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -184,6 +184,9 @@ public:
// the file is added
AddNewFile,
AddExistingFile,
+ // Add files, which match user defined filters,
+ // from an existing directory and its subdirectories
+ AddExistingDirectory,
// Removes a file from the project, optionally also
// delete it on disc
RemoveFile,
diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp b/src/plugins/projectexplorer/selectablefilesmodel.cpp
index 60deb9da16..926f935f17 100644
--- a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp
+++ b/src/plugins/projectexplorer/selectablefilesmodel.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "selectablefilesmodel.h"
-#include "genericprojectconstants.h"
+#include "projectexplorerconstants.h"
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
@@ -41,19 +41,14 @@
#include <QPushButton>
#include <QTreeView>
#include <QDir>
+#include <utils/pathchooser.h>
-namespace GenericProjectManager {
-namespace Internal {
+namespace ProjectExplorer {
-SelectableFilesModel::SelectableFilesModel(const QString &baseDir, QObject *parent)
- : QAbstractItemModel(parent), m_root(0), m_baseDir(baseDir), m_allFiles(true)
+SelectableFilesModel::SelectableFilesModel(QObject *parent)
+ : QAbstractItemModel(parent), m_root(0), m_allFiles(true)
{
- // Dummy tree
- m_root = new Tree;
- m_root->name = QLatin1String("/");
- m_root->parent = 0;
- m_root->fullPath = m_baseDir;
- m_root->isDir = true;
+ connect(&m_watcher, SIGNAL(finished()), this, SLOT(buildTreeFinished()));
}
void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files)
@@ -68,27 +63,26 @@ void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files)
m_allFiles = false;
}
-void SelectableFilesModel::init()
+void SelectableFilesModel::startParsing(const QString &baseDir)
{
-}
+ m_watcher.cancel();
+ m_watcher.waitForFinished();
-void SelectableFilesModel::startParsing()
-{
+ m_baseDir = baseDir;
// Build a tree in a future
m_rootForFuture = new Tree;
m_rootForFuture->name = QLatin1String("/");
m_rootForFuture->parent = 0;
- m_rootForFuture->fullPath = m_baseDir;
+ m_rootForFuture->fullPath = baseDir;
m_rootForFuture->isDir = true;
- connect(&m_watcher, SIGNAL(finished()), this, SLOT(buildTreeFinished()));
m_watcher.setFuture(QtConcurrent::run(&SelectableFilesModel::run, this));
}
void SelectableFilesModel::run(QFutureInterface<void> &fi)
{
m_futureCount = 0;
- buildTree(m_baseDir, m_rootForFuture, fi);
+ buildTree(m_baseDir, m_rootForFuture, fi, 5);
}
void SelectableFilesModel::buildTreeFinished()
@@ -101,14 +95,10 @@ void SelectableFilesModel::buildTreeFinished()
emit parsingFinished();
}
-void SelectableFilesModel::waitForFinished()
-{
- m_watcher.waitForFinished();
-}
-
void SelectableFilesModel::cancel()
{
m_watcher.cancel();
+ m_watcher.waitForFinished();
}
bool SelectableFilesModel::filter(Tree *t)
@@ -141,8 +131,10 @@ bool SelectableFilesModel::filter(Tree *t)
return false;
}
-void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFutureInterface<void> &fi)
+void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFutureInterface<void> &fi, int symlinkDepth)
{
+ if (symlinkDepth == 0)
+ return;
const QFileInfoList fileInfoList = QDir(baseDir).entryInfoList(QDir::Files |
QDir::Dirs |
QDir::NoDotAndDotDot);
@@ -156,14 +148,12 @@ void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFuture
}
++m_futureCount;
if (fileInfo.isDir()) {
- if (fileInfo.isSymLink())
- continue;
Tree *t = new Tree;
t->parent = tree;
t->name = fileInfo.fileName();
t->fullPath = fileInfo.filePath();
t->isDir = true;
- buildTree(fileInfo.filePath(), t, fi);
+ buildTree(fileInfo.filePath(), t, fi, symlinkDepth - fileInfo.isSymLink());
allChecked &= t->checked == Qt::Checked;
allUnchecked &= t->checked == Qt::Unchecked;
tree->childDirectories.append(t);
@@ -193,11 +183,15 @@ void SelectableFilesModel::buildTree(const QString &baseDir, Tree *tree, QFuture
SelectableFilesModel::~SelectableFilesModel()
{
+ m_watcher.cancel();
+ m_watcher.waitForFinished();
deleteTree(m_root);
}
void SelectableFilesModel::deleteTree(Tree *tree)
{
+ if (!tree)
+ return;
foreach (Tree *t, tree->childDirectories)
deleteTree(t);
foreach (Tree *t, tree->files)
@@ -234,6 +228,8 @@ QModelIndex SelectableFilesModel::parent(const QModelIndex &child) const
{
if (!child.isValid())
return QModelIndex();
+ if (!child.internalPointer())
+ return QModelIndex();
Tree *parent = static_cast<Tree *>(child.internalPointer())->parent;
if (!parent)
return QModelIndex();
@@ -398,6 +394,22 @@ void SelectableFilesModel::applyFilter(const QString &showFilesfilter, const QSt
applyFilter(createIndex(0, 0, m_root));
}
+void SelectableFilesModel::selectAllFiles()
+{
+ selectAllFiles(m_root);
+}
+
+void SelectableFilesModel::selectAllFiles(Tree *root)
+{
+ root->checked = Qt::Checked;
+
+ foreach (Tree *t, root->childDirectories)
+ selectAllFiles(t);
+
+ foreach (Tree *t, root->visibleFiles)
+ t->checked = Qt::Checked;
+}
+
Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
{
bool allChecked = true;
@@ -511,10 +523,10 @@ Qt::CheckState SelectableFilesModel::applyFilter(const QModelIndex &index)
}
//////////
-// SelectableFilesDialog
+// SelectableFilesDialogs
//////////
-SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringList files, QWidget *parent)
+SelectableFilesDialogEditFiles::SelectableFilesDialogEditFiles(const QString &path, const QStringList files, QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *layout = new QVBoxLayout();
@@ -527,7 +539,7 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL
createHideFileFilterControls(layout);
createApplyButton(layout);
- m_selectableFilesModel = new SelectableFilesModel(path, this);
+ m_selectableFilesModel = new SelectableFilesModel(this);
m_selectableFilesModel->setInitialMarkedFiles(files);
m_view->setModel(m_selectableFilesModel);
m_view->setMinimumSize(500, 400);
@@ -556,10 +568,10 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL
connect(m_selectableFilesModel, SIGNAL(parsingFinished()),
this, SLOT(parsingFinished()));
- m_selectableFilesModel->startParsing();
+ m_selectableFilesModel->startParsing(path);
}
-void SelectableFilesDialog::createHideFileFilterControls(QVBoxLayout *layout)
+void SelectableFilesDialogEditFiles::createHideFileFilterControls(QVBoxLayout *layout)
{
QHBoxLayout *hbox = new QHBoxLayout;
m_hideFilesFilterLabel = new QLabel;
@@ -576,7 +588,7 @@ void SelectableFilesDialog::createHideFileFilterControls(QVBoxLayout *layout)
layout->addLayout(hbox);
}
-void SelectableFilesDialog::createShowFileFilterControls(QVBoxLayout *layout)
+void SelectableFilesDialogEditFiles::createShowFileFilterControls(QVBoxLayout *layout)
{
QHBoxLayout *hbox = new QHBoxLayout;
m_showFilesFilterLabel = new QLabel;
@@ -593,7 +605,7 @@ void SelectableFilesDialog::createShowFileFilterControls(QVBoxLayout *layout)
layout->addLayout(hbox);
}
-void SelectableFilesDialog::createApplyButton(QVBoxLayout *layout)
+void SelectableFilesDialogEditFiles::createApplyButton(QVBoxLayout *layout)
{
QHBoxLayout *hbox = new QHBoxLayout;
@@ -608,18 +620,17 @@ void SelectableFilesDialog::createApplyButton(QVBoxLayout *layout)
connect(m_applyFilterButton, SIGNAL(clicked()), this, SLOT(applyFilter()));
}
-SelectableFilesDialog::~SelectableFilesDialog()
+SelectableFilesDialogEditFiles::~SelectableFilesDialogEditFiles()
{
m_selectableFilesModel->cancel();
- m_selectableFilesModel->waitForFinished();
}
-void SelectableFilesDialog::parsingProgress(const QString &fileName)
+void SelectableFilesDialogEditFiles::parsingProgress(const QString &fileName)
{
m_progressLabel->setText(tr("Generating file list...\n\n%1").arg(fileName));
}
-void SelectableFilesDialog::parsingFinished()
+void SelectableFilesDialogEditFiles::parsingFinished()
{
m_hideFilesFilterLabel->show();
m_hideFilesfilterLineEdit->show();
@@ -642,7 +653,7 @@ void SelectableFilesDialog::parsingFinished()
}
}
-void SelectableFilesDialog::smartExpand(const QModelIndex &index)
+void SelectableFilesDialogEditFiles::smartExpand(const QModelIndex &index)
{
if (m_view->model()->data(index, Qt::CheckStateRole) == Qt::PartiallyChecked) {
m_view->expand(index);
@@ -652,12 +663,12 @@ void SelectableFilesDialog::smartExpand(const QModelIndex &index)
}
}
-QStringList SelectableFilesDialog::selectedFiles() const
+QStringList SelectableFilesDialogEditFiles::selectedFiles() const
{
return m_selectableFilesModel->selectedFiles();
}
-void SelectableFilesDialog::applyFilter()
+void SelectableFilesDialogEditFiles::applyFilter()
{
const QString showFilesFilter = m_showFilesfilterLineEdit->text();
Core::ICore::settings()->setValue(QLatin1String(Constants::SHOW_FILE_FILTER_SETTING), showFilesFilter);
@@ -668,7 +679,70 @@ void SelectableFilesDialog::applyFilter()
m_selectableFilesModel->applyFilter(showFilesFilter, hideFilesFilter);
}
-} // namespace Internal
-} // namespace GenericProjectManager
+SelectableFilesDialogAddDirectory::SelectableFilesDialogAddDirectory(const QString &path,
+ const QStringList files, QWidget *parent) :
+ SelectableFilesDialogEditFiles(path, files, parent)
+{
+ setWindowTitle(tr("Add Existing Directory"));
+
+ connect(m_selectableFilesModel, SIGNAL(parsingFinished()), this, SLOT(parsingFinished()));
+
+ createPathChooser(static_cast<QVBoxLayout*>(layout()), path);
+}
+
+void SelectableFilesDialogAddDirectory::createPathChooser(QVBoxLayout *layout, const QString &path)
+{
+ QHBoxLayout *hbox = new QHBoxLayout;
+
+ m_pathChooser = new Utils::PathChooser;
+ m_pathChooser->setPath(path);
+ m_pathChooser->setHistoryCompleter(QLatin1String("PE.AddToProjectDir.History"));
+ m_sourceDirectoryLabel = new QLabel(tr("Source directory:"));
+ hbox->addWidget(m_sourceDirectoryLabel);
+
+ hbox->addWidget(m_pathChooser);
+ layout->insertLayout(0, hbox);
+
+ m_startParsingButton = new QPushButton(tr("Start Parsing"));
+ hbox->addWidget(m_startParsingButton);
+
+ connect(m_pathChooser, SIGNAL(validChanged(bool)), this, SLOT(validityOfDirectoryChanged(bool)));
+ connect(m_startParsingButton, SIGNAL(clicked()), this, SLOT(startParsing()));
+}
+
+void SelectableFilesDialogAddDirectory::validityOfDirectoryChanged(bool validState)
+{
+ m_startParsingButton->setEnabled(validState);
+}
+
+void SelectableFilesDialogAddDirectory::parsingFinished()
+{
+ m_selectableFilesModel->selectAllFiles();
+ m_selectableFilesModel->applyFilter(m_showFilesfilterLineEdit->text(),
+ m_hideFilesfilterLineEdit->text());
+
+ setWidgetsEnabled(true);
+}
+
+void SelectableFilesDialogAddDirectory::startParsing()
+{
+ setWidgetsEnabled(false);
+
+ m_selectableFilesModel->startParsing(m_pathChooser->path());
+}
+
+void SelectableFilesDialogAddDirectory::setWidgetsEnabled(bool enabled)
+{
+ m_hideFilesfilterLineEdit->setEnabled(enabled);
+ m_showFilesfilterLineEdit->setEnabled(enabled);
+ m_applyFilterButton->setEnabled(enabled);
+ m_view->setEnabled(enabled);
+ m_pathChooser->setEnabled(enabled);
+ m_startParsingButton->setVisible(enabled);
+
+ m_progressLabel->setVisible(!enabled);
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.h b/src/plugins/projectexplorer/selectablefilesmodel.h
index fcd09beb5d..a009e2e52e 100644
--- a/src/plugins/genericprojectmanager/selectablefilesmodel.h
+++ b/src/plugins/projectexplorer/selectablefilesmodel.h
@@ -37,13 +37,15 @@
#include <QDialog>
#include <QTreeView>
#include <QLabel>
+#include "projectexplorer_export.h"
+
+namespace Utils { class PathChooser; }
QT_BEGIN_NAMESPACE
class QVBoxLayout;
QT_END_NAMESPACE
-namespace GenericProjectManager {
-namespace Internal {
+namespace ProjectExplorer {
struct Tree
{
@@ -81,12 +83,12 @@ struct Glob
}
};
-class SelectableFilesModel : public QAbstractItemModel
+class PROJECTEXPLORER_EXPORT SelectableFilesModel : public QAbstractItemModel
{
Q_OBJECT
public:
- SelectableFilesModel(const QString &baseDir, QObject *parent);
+ SelectableFilesModel(QObject *parent);
~SelectableFilesModel();
void setInitialMarkedFiles(const QStringList &files);
@@ -104,12 +106,12 @@ public:
QStringList selectedPaths() const;
QStringList preservedFiles() const;
- // only call this once
- void startParsing();
- void waitForFinished();
+ void startParsing(const QString &baseDir);
void cancel();
void applyFilter(const QString &selectFilesfilter, const QString &hideFilesfilter);
+ void selectAllFiles();
+
signals:
void parsingFinished();
void parsingProgress(const QString &filename);
@@ -121,14 +123,14 @@ private:
QList<Glob> parseFilter(const QString &filter);
Qt::CheckState applyFilter(const QModelIndex &index);
bool filter(Tree *t);
- void init();
void run(QFutureInterface<void> &fi);
void collectFiles(Tree *root, QStringList *result) const;
void collectPaths(Tree *root, QStringList *result) const;
- void buildTree(const QString &baseDir, Tree *tree, QFutureInterface<void> &fi);
+ void buildTree(const QString &baseDir, Tree *tree, QFutureInterface<void> &fi, int symlinkDepth);
void deleteTree(Tree *tree);
void propagateUp(const QModelIndex &index);
void propagateDown(const QModelIndex &index);
+ void selectAllFiles(Tree *root);
Tree *m_root;
// Used in the future thread need to all not used after calling startParsing
QString m_baseDir;
@@ -143,13 +145,13 @@ private:
QList<Glob> m_showFilesFilter;
};
-class SelectableFilesDialog : public QDialog
+class PROJECTEXPLORER_EXPORT SelectableFilesDialogEditFiles : public QDialog
{
Q_OBJECT
public:
- SelectableFilesDialog(const QString &path, const QStringList files, QWidget *parent);
- ~SelectableFilesDialog();
+ SelectableFilesDialogEditFiles(const QString &path, const QStringList files, QWidget *parent);
+ ~SelectableFilesDialogEditFiles();
QStringList selectedFiles() const;
private slots:
@@ -157,11 +159,12 @@ private slots:
void parsingProgress(const QString &fileName);
void parsingFinished();
-private:
+protected:
void smartExpand(const QModelIndex &index);
void createShowFileFilterControls(QVBoxLayout *layout);
void createHideFileFilterControls(QVBoxLayout *layout);
void createApplyButton(QVBoxLayout *layout);
+
SelectableFilesModel *m_selectableFilesModel;
QLabel *m_hideFilesFilterLabel;
@@ -177,8 +180,28 @@ private:
QLabel *m_progressLabel;
};
-} // namespace Internal
-} // namespace GenericProjectManager
+class SelectableFilesDialogAddDirectory : public SelectableFilesDialogEditFiles
+{
+ Q_OBJECT
+
+public:
+ SelectableFilesDialogAddDirectory(const QString &path, const QStringList files, QWidget *parent);
+
+private slots:
+ void validityOfDirectoryChanged(bool validState);
+ void parsingFinished();
+ void startParsing();
+
+private:
+ Utils::PathChooser *m_pathChooser;
+ QLabel *m_sourceDirectoryLabel;
+ QPushButton *m_startParsingButton;
+
+ void setWidgetsEnabled(bool enabled);
+ void createPathChooser(QVBoxLayout *layout, const QString &path);
+};
+
+} // namespace ProjectExplorer
#endif // SELECTABLEFILESMODEL_H
diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp
index d09f83f562..6a9ecd4c95 100644
--- a/src/plugins/projectexplorer/targetselector.cpp
+++ b/src/plugins/projectexplorer/targetselector.cpp
@@ -116,13 +116,13 @@ void TargetSelector::menuAboutToHide()
updateButtons();
}
-void TargetSelector::insertTarget(int index, const QString &name)
+void TargetSelector::insertTarget(int index, int subIndex, const QString &name)
{
QTC_ASSERT(index >= 0 && index <= m_targets.count(), return);
Target target;
target.name = name;
- target.currentSubIndex = 0;
+ target.currentSubIndex = subIndex;
m_targets.insert(index, target);
diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h
index 415e27c03b..f25f4f1de4 100644
--- a/src/plugins/projectexplorer/targetselector.h
+++ b/src/plugins/projectexplorer/targetselector.h
@@ -70,7 +70,7 @@ public:
void setTargetMenu(QMenu *menu);
public:
- void insertTarget(int index, const QString &name);
+ void insertTarget(int index, int subIndex, const QString &name);
void renameTarget(int index, const QString &name);
void removeTarget(int index);
void setCurrentIndex(int index);
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index 95a99377a0..780398e302 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -181,9 +181,7 @@ void TargetSettingsPanelWidget::setupUi()
// Now set the correct target
int index = m_targets.indexOf(m_project->activeTarget());
m_selector->setCurrentIndex(index);
- m_selector->setCurrentSubIndex(0);
-
- currentTargetChanged(index, 0);
+ currentTargetChanged(index, m_selector->currentSubIndex());
connect(m_selector, SIGNAL(currentChanged(int,int)),
this, SLOT(currentTargetChanged(int,int)));
@@ -488,7 +486,9 @@ void TargetSettingsPanelWidget::targetAdded(ProjectExplorer::Target *target)
if (m_targets.count() == pos ||
m_targets.at(pos)->displayName() > target->displayName()) {
m_targets.insert(pos, target);
- m_selector->insertTarget(pos, target->displayName());
+ m_selector->insertTarget(pos, m_project->hasActiveBuildSettings() ? 0 : 1,
+ target->displayName());
+
break;
}
}
diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp
index 88c53616a0..a83e228c97 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.cpp
+++ b/src/plugins/projectexplorer/targetsettingswidget.cpp
@@ -83,9 +83,9 @@ TargetSettingsWidget::~TargetSettingsWidget()
delete ui;
}
-void TargetSettingsWidget::insertTarget(int index, const QString &name)
+void TargetSettingsWidget::insertTarget(int index, int subIndex, const QString &name)
{
- m_targetSelector->insertTarget(index, name);
+ m_targetSelector->insertTarget(index, subIndex, name);
}
void TargetSettingsWidget::renameTarget(int index, const QString &name)
diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h
index 1b678c4a20..808e62a93e 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.h
+++ b/src/plugins/projectexplorer/targetsettingswidget.h
@@ -62,7 +62,7 @@ public:
int currentSubIndex() const;
public:
- void insertTarget(int index, const QString &name);
+ void insertTarget(int index, int subIndex, const QString &name);
void renameTarget(int index, const QString &name);
void removeTarget(int index);
void setCurrentIndex(int index);
diff --git a/src/plugins/projectexplorer/targetsetuppage.cpp b/src/plugins/projectexplorer/targetsetuppage.cpp
index b47da13ed3..c91d80b9ca 100644
--- a/src/plugins/projectexplorer/targetsetuppage.cpp
+++ b/src/plugins/projectexplorer/targetsetuppage.cpp
@@ -246,7 +246,7 @@ void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
bool TargetSetupPage::isComplete() const
{
- foreach (TargetSetupWidget *widget, m_widgets.values())
+ foreach (TargetSetupWidget *widget, m_widgets)
if (widget->isKitSelected())
return true;
return false;
@@ -275,7 +275,7 @@ void TargetSetupPage::setupWidgets()
void TargetSetupPage::reset()
{
- foreach (TargetSetupWidget *widget, m_widgets.values()) {
+ foreach (TargetSetupWidget *widget, m_widgets) {
Kit *k = widget->kit();
if (!k)
continue;
@@ -386,7 +386,7 @@ void TargetSetupPage::handleKitUpdate(Kit *k)
void TargetSetupPage::selectAtLeastOneKit()
{
bool atLeastOneKitSelected = false;
- foreach (TargetSetupWidget *w, m_widgets.values()) {
+ foreach (TargetSetupWidget *w, m_widgets) {
if (w->isKitSelected()) {
atLeastOneKitSelected = true;
break;
@@ -514,7 +514,7 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
bool TargetSetupPage::setupProject(Project *project)
{
QList<const BuildInfo *> toSetUp; // Pointers are managed by the widgets!
- foreach (TargetSetupWidget *widget, m_widgets.values()) {
+ foreach (TargetSetupWidget *widget, m_widgets) {
if (!widget->isKitSelected())
continue;
diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp
index 239e1f3e4e..7dc9c59811 100644
--- a/src/plugins/projectexplorer/targetsetupwidget.cpp
+++ b/src/plugins/projectexplorer/targetsetupwidget.cpp
@@ -180,6 +180,7 @@ void TargetSetupWidget::addBuildInfo(BuildInfo *info, bool isImport)
pathChooser->setExpectedKind(Utils::PathChooser::Directory);
pathChooser->setFileName(info->buildDirectory);
pathChooser->setEnabled(info->supportsShadowBuild);
+ pathChooser->setHistoryCompleter(QLatin1String("BuildDir.History"));
pathChooser->setReadOnly(!info->supportsShadowBuild || isImport);
m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp
index 9f6796e1b8..a0a2079de3 100644
--- a/src/plugins/projectexplorer/task.cpp
+++ b/src/plugins/projectexplorer/task.cpp
@@ -32,6 +32,19 @@
namespace ProjectExplorer
{
+static QString taskTypeIcon(Task::TaskType t)
+{
+ switch (t) {
+ case Task::Warning:
+ return QLatin1String(":/projectexplorer/images/compile_warning.png");
+ case Task::Error:
+ return QLatin1String(":/projectexplorer/images/compile_error.png");
+ case Task::Unknown:
+ break;
+ }
+ return QString();
+}
+
unsigned int Task::s_nextId = 1;
/*!
@@ -44,9 +57,11 @@ Task::Task() : taskId(0), type(Unknown), line(-1)
{ }
Task::Task(TaskType type_, const QString &description_,
- const Utils::FileName &file_, int line_, Core::Id category_) :
+ const Utils::FileName &file_, int line_, Core::Id category_,
+ const Utils::FileName &iconFile) :
taskId(s_nextId), type(type_), description(description_),
- file(file_), line(line_), movedLine(line_), category(category_)
+ file(file_), line(line_), movedLine(line_), category(category_),
+ icon(iconFile.isEmpty() ? taskTypeIcon(type_) : iconFile.toString())
{
++s_nextId;
}
@@ -70,6 +85,7 @@ void Task::clear()
movedLine = -1;
category = Core::Id();
type = Task::Unknown;
+ icon = QIcon();
}
//
diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h
index 98782b201d..b387743027 100644
--- a/src/plugins/projectexplorer/task.h
+++ b/src/plugins/projectexplorer/task.h
@@ -54,7 +54,8 @@ public:
Task();
Task(TaskType type, const QString &description,
- const Utils::FileName &file, int line, Core::Id category);
+ const Utils::FileName &file, int line, Core::Id category,
+ const Utils::FileName &iconName = Utils::FileName());
bool isNull() const;
void clear();
@@ -66,6 +67,7 @@ public:
int line;
int movedLine; // contains a line number if the line was moved in the editor
Core::Id category;
+ QIcon icon;
void addMark(TextEditor::BaseTextMark *mark);
// Having a QList<QTextLayout::FormatRange> in Task isn't that great
diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
index 1cc702050b..fe9b0e1d4a 100644
--- a/src/plugins/projectexplorer/taskhub.cpp
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -115,9 +115,8 @@ void TaskHub::addTask(Task::TaskType type, const QString &description, Core::Id
void TaskHub::addTask(Task task)
{
if (task.line != -1 && !task.file.isEmpty()) {
- bool visible = (task.type == Task::Warning || task.type == Task::Error);
- TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible);
- mark->setIcon(taskTypeIcon(task.type));
+ TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, !task.icon.isNull());
+ mark->setIcon(task.icon);
mark->setPriority(TextEditor::ITextMark::LowPriority);
task.addMark(mark);
emit m_instance->taskAdded(task);
@@ -167,16 +166,3 @@ void TaskHub::requestPopup()
emit m_instance->popupRequested(Core::IOutputPane::NoModeSwitch);
}
-QIcon TaskHub::taskTypeIcon(Task::TaskType t)
-{
- switch (t) {
- case Task::Warning:
- return m_instance->m_warningIcon;
- case Task::Error:
- return m_instance->m_errorIcon;
- case Task::Unknown:
- break;
- }
- return QIcon();
-}
-
diff --git a/src/plugins/projectexplorer/taskhub.h b/src/plugins/projectexplorer/taskhub.h
index 0c4f82e772..f47ea795e6 100644
--- a/src/plugins/projectexplorer/taskhub.h
+++ b/src/plugins/projectexplorer/taskhub.h
@@ -66,8 +66,6 @@ public:
static void requestPopup();
- static QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t);
-
signals:
void categoryAdded(Core::Id categoryId, const QString &displayName, bool visible);
void taskAdded(const ProjectExplorer::Task &task);
diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp
index ff32130e79..fd73b60118 100644
--- a/src/plugins/projectexplorer/taskmodel.cpp
+++ b/src/plugins/projectexplorer/taskmodel.cpp
@@ -255,7 +255,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
else if (role == TaskModel::Category)
return m_tasks.at(index.row()).category.uniqueIdentifier();
else if (role == TaskModel::Icon)
- return TaskHub::taskTypeIcon(m_tasks.at(index.row()).type);
+ return m_tasks.at(index.row()).icon;
else if (role == TaskModel::Task_t)
return QVariant::fromValue(task(index));
return QVariant();
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index 6ce327ee0a..08206252d2 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -261,9 +261,9 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
- d->m_filterWarningsButton = createFilterButton(TaskHub::taskTypeIcon(Task::Warning),
- tr("Show Warnings"),
- this, SLOT(setShowWarnings(bool)));
+ d->m_filterWarningsButton = createFilterButton(
+ QIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")),
+ tr("Show Warnings"), this, SLOT(setShowWarnings(bool)));
d->m_categoriesButton = new QToolButton;
d->m_categoriesButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp
index 44b1a82191..7222a3ae0c 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.cpp
+++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp
@@ -450,92 +450,81 @@ ToolChainOptionsPage::ToolChainOptionsPage() :
setCategoryIcon(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
-QWidget *ToolChainOptionsPage::createPage(QWidget *parent)
-{
- // Actual page setup:
- m_configWidget = new QWidget(parent);
-
- m_toolChainView = new QTreeView(m_configWidget);
- m_toolChainView->setUniformRowHeights(true);
- m_toolChainView->header()->setStretchLastSection(false);
-
- m_addButton = new QPushButton(tr("Add"), m_configWidget);
- m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
- m_delButton = new QPushButton(tr("Remove"), m_configWidget);
-
- m_container = new Utils::DetailsWidget(m_configWidget);
- m_container->setState(Utils::DetailsWidget::NoSummary);
- m_container->setVisible(false);
-
- QVBoxLayout *buttonLayout = new QVBoxLayout();
- buttonLayout->setSpacing(6);
- buttonLayout->setContentsMargins(0, 0, 0, 0);
- buttonLayout->addWidget(m_addButton);
- buttonLayout->addWidget(m_cloneButton);
- buttonLayout->addWidget(m_delButton);
- buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
-
- QVBoxLayout *verticalLayout = new QVBoxLayout();
- verticalLayout->addWidget(m_toolChainView);
- verticalLayout->addWidget(m_container);
-
- QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
- horizontalLayout->addLayout(verticalLayout);
- horizontalLayout->addLayout(buttonLayout);
- Q_ASSERT(!m_model);
- m_model = new ToolChainModel(m_configWidget);
-
- connect(m_model, SIGNAL(toolChainStateChanged()), this, SLOT(updateState()));
-
- m_toolChainView->setModel(m_model);
- m_toolChainView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
- m_toolChainView->header()->setResizeMode(1, QHeaderView::Stretch);
- m_toolChainView->expandAll();
-
- m_selectionModel = m_toolChainView->selectionModel();
- connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(toolChainSelectionChanged()));
- connect(ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
- this, SLOT(toolChainSelectionChanged()));
-
- // Get toolchainfactories:
- m_factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
-
- // Set up add menu:
- QMenu *addMenu = new QMenu(m_addButton);
- QSignalMapper *mapper = new QSignalMapper(addMenu);
- connect(mapper, SIGNAL(mapped(QObject*)), this, SLOT(createToolChain(QObject*)));
-
- foreach (ToolChainFactory *factory, m_factories) {
- if (factory->canCreate()) {
- QAction *action = new QAction(addMenu);
- action->setText(factory->displayName());
- connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
- mapper->setMapping(action, static_cast<QObject *>(factory));
-
- addMenu->addAction(action);
+QWidget *ToolChainOptionsPage::widget()
+{
+ if (!m_configWidget) {
+ // Actual page setup:
+ m_configWidget = new QWidget;
+
+ m_toolChainView = new QTreeView(m_configWidget);
+ m_toolChainView->setUniformRowHeights(true);
+ m_toolChainView->header()->setStretchLastSection(false);
+
+ m_addButton = new QPushButton(tr("Add"), m_configWidget);
+ m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
+ m_delButton = new QPushButton(tr("Remove"), m_configWidget);
+
+ m_container = new Utils::DetailsWidget(m_configWidget);
+ m_container->setState(Utils::DetailsWidget::NoSummary);
+ m_container->setVisible(false);
+
+ QVBoxLayout *buttonLayout = new QVBoxLayout();
+ buttonLayout->setSpacing(6);
+ buttonLayout->setContentsMargins(0, 0, 0, 0);
+ buttonLayout->addWidget(m_addButton);
+ buttonLayout->addWidget(m_cloneButton);
+ buttonLayout->addWidget(m_delButton);
+ buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout();
+ verticalLayout->addWidget(m_toolChainView);
+ verticalLayout->addWidget(m_container);
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
+ horizontalLayout->addLayout(verticalLayout);
+ horizontalLayout->addLayout(buttonLayout);
+ Q_ASSERT(!m_model);
+ m_model = new ToolChainModel(m_configWidget);
+
+ connect(m_model, SIGNAL(toolChainStateChanged()), this, SLOT(updateState()));
+
+ m_toolChainView->setModel(m_model);
+ m_toolChainView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
+ m_toolChainView->header()->setResizeMode(1, QHeaderView::Stretch);
+ m_toolChainView->expandAll();
+
+ m_selectionModel = m_toolChainView->selectionModel();
+ connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SLOT(toolChainSelectionChanged()));
+ connect(ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
+ this, SLOT(toolChainSelectionChanged()));
+
+ // Get toolchainfactories:
+ m_factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
+
+ // Set up add menu:
+ QMenu *addMenu = new QMenu(m_addButton);
+ QSignalMapper *mapper = new QSignalMapper(addMenu);
+ connect(mapper, SIGNAL(mapped(QObject*)), this, SLOT(createToolChain(QObject*)));
+
+ foreach (ToolChainFactory *factory, m_factories) {
+ if (factory->canCreate()) {
+ QAction *action = new QAction(addMenu);
+ action->setText(factory->displayName());
+ connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
+ mapper->setMapping(action, static_cast<QObject *>(factory));
+
+ addMenu->addAction(action);
+ }
}
- }
- connect(m_cloneButton, SIGNAL(clicked()), mapper, SLOT(map()));
- mapper->setMapping(m_cloneButton, static_cast<QObject *>(0));
-
- m_addButton->setMenu(addMenu);
-
- connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeToolChain()));
+ connect(m_cloneButton, SIGNAL(clicked()), mapper, SLOT(map()));
+ mapper->setMapping(m_cloneButton, static_cast<QObject *>(0));
- // setup keywords:
- if (m_searchKeywords.isEmpty()) {
- QLatin1Char sep(' ');
- QTextStream stream(&m_searchKeywords);
- stream << tr("Compilers");
- foreach (ToolChainFactory *f, m_factories)
- stream << sep << f->displayName();
+ m_addButton->setMenu(addMenu);
- m_searchKeywords.remove(QLatin1Char('&'));
+ connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeToolChain()));
+ updateState();
}
-
- updateState();
-
return m_configWidget;
}
@@ -550,8 +539,7 @@ void ToolChainOptionsPage::finish()
disconnect(ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
this, SLOT(toolChainSelectionChanged()));
- // delete by settingsdialog;
- m_configWidget = 0;
+ delete m_configWidget;
// children of m_configWidget
m_model = 0;
@@ -563,11 +551,6 @@ void ToolChainOptionsPage::finish()
m_delButton = 0;
}
-bool ToolChainOptionsPage::matches(const QString &s) const
-{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void ToolChainOptionsPage::toolChainSelectionChanged()
{
if (!m_container)
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.h b/src/plugins/projectexplorer/toolchainoptionspage.h
index 19b365dca4..4c3186c675 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.h
+++ b/src/plugins/projectexplorer/toolchainoptionspage.h
@@ -33,6 +33,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QAbstractItemModel>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QItemSelectionModel;
@@ -117,10 +118,9 @@ class ToolChainOptionsPage : public Core::IOptionsPage
public:
ToolChainOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
private slots:
void toolChainSelectionChanged();
@@ -131,8 +131,7 @@ private slots:
private:
QModelIndex currentIndex() const;
- QWidget *m_configWidget;
- QString m_searchKeywords;
+ QPointer<QWidget> m_configWidget;
ToolChainModel *m_model;
QList<ToolChainFactory *> m_factories;
diff --git a/src/plugins/pythoneditor/pythoneditor.cpp b/src/plugins/pythoneditor/pythoneditor.cpp
index 6afb318e7b..9719b66513 100644
--- a/src/plugins/pythoneditor/pythoneditor.cpp
+++ b/src/plugins/pythoneditor/pythoneditor.cpp
@@ -62,7 +62,7 @@ Core::IEditor *PythonEditor::duplicate(QWidget *parent)
{
EditorWidget *widget = new EditorWidget(parent);
widget->duplicateFrom(editorWidget());
- PythonEditorPlugin::initializeEditor(widget);
+ TextEditor::TextEditorSettings::initializeEditor(widget);
return widget->editor();
}
diff --git a/src/plugins/pythoneditor/pythoneditorfactory.cpp b/src/plugins/pythoneditor/pythoneditorfactory.cpp
index 2851d611af..4837e02419 100644
--- a/src/plugins/pythoneditor/pythoneditorfactory.cpp
+++ b/src/plugins/pythoneditor/pythoneditorfactory.cpp
@@ -34,6 +34,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
#include <QDebug>
@@ -47,12 +48,17 @@ EditorFactory::EditorFactory(QObject *parent)
setId(Constants::C_PYTHONEDITOR_ID);
setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME));
addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
+ new TextEditor::TextEditorActionHandler(this,
+ Constants::C_PYTHONEDITOR_ID,
+ TextEditor::TextEditorActionHandler::Format
+ | TextEditor::TextEditorActionHandler::UnCommentSelection
+ | TextEditor::TextEditorActionHandler::UnCollapseAll);
}
Core::IEditor *EditorFactory::createEditor(QWidget *parent)
{
EditorWidget *widget = new EditorWidget(parent);
- PythonEditorPlugin::initializeEditor(widget);
+ TextEditor::TextEditorSettings::initializeEditor(widget);
return widget->editor();
}
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index 856c0677a7..97b17d06ea 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -43,7 +43,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorconstants.h>
-#include <texteditor/texteditorsettings.h>
#include <QtPlugin>
#include <QCoreApplication>
@@ -198,7 +197,6 @@ static void copyIdentifiers(const char * const words[], size_t bytesCount, QSet<
PythonEditorPlugin::PythonEditorPlugin()
: m_factory(0)
- , m_actionHandler(0)
{
m_instance = this;
copyIdentifiers(LIST_OF_PYTHON_KEYWORDS, sizeof(LIST_OF_PYTHON_KEYWORDS), m_keywords);
@@ -223,13 +221,6 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
addObject(m_factory);
// Initialize editor actions handler
- m_actionHandler.reset(new TextEditor::TextEditorActionHandler(
- C_PYTHONEDITOR_ID,
- TextEditor::TextEditorActionHandler::Format
- | TextEditor::TextEditorActionHandler::UnCommentSelection
- | TextEditor::TextEditorActionHandler::UnCollapseAll));
- m_actionHandler->initializeActions();
-
// Add MIME overlay icons (these icons displayed at Project dock panel)
const QIcon icon = QIcon::fromTheme(QLatin1String(C_PY_MIME_ICON));
if (!icon.isNull())
@@ -247,12 +238,6 @@ void PythonEditorPlugin::extensionsInitialized()
{
}
-void PythonEditorPlugin::initializeEditor(EditorWidget *widget)
-{
- instance()->m_actionHandler->setupActions(widget);
- TextEditor::TextEditorSettings::initializeEditor(widget);
-}
-
QSet<QString> PythonEditorPlugin::keywords()
{
return instance()->m_keywords;
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.h b/src/plugins/pythoneditor/pythoneditorplugin.h
index f6c730cb69..895a94e2f5 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.h
+++ b/src/plugins/pythoneditor/pythoneditorplugin.h
@@ -31,9 +31,7 @@
#define PYTHONEDITOR_PLUGIN_H
#include <extensionsystem/iplugin.h>
-#include <texteditor/texteditoractionhandler.h>
#include <QSet>
-#include <QScopedPointer>
namespace PythonEditor {
namespace Internal {
@@ -57,7 +55,6 @@ public:
virtual bool initialize(const QStringList &arguments, QString *errorMessage);
virtual void extensionsInitialized();
static PythonEditorPlugin *instance() { return m_instance; }
- static void initializeEditor(EditorWidget *widget);
static QSet<QString> keywords();
static QSet<QString> magics();
@@ -66,7 +63,6 @@ public:
private:
static PythonEditorPlugin *m_instance;
EditorFactory *m_factory;
- QScopedPointer<TextEditor::TextEditorActionHandler> m_actionHandler;
QSet<QString> m_keywords;
QSet<QString> m_magics;
QSet<QString> m_builtins;
diff --git a/src/plugins/pythoneditor/pythoneditorwidget.cpp b/src/plugins/pythoneditor/pythoneditorwidget.cpp
index a8588e3e07..2323002d23 100644
--- a/src/plugins/pythoneditor/pythoneditorwidget.cpp
+++ b/src/plugins/pythoneditor/pythoneditorwidget.cpp
@@ -59,7 +59,7 @@ EditorWidget::EditorWidget(QWidget *parent)
setCodeFoldingSupported(true);
setIndenter(new PythonIndenter());
- new PythonHighlighter(baseTextDocument().data());
+ new PythonHighlighter(baseTextDocument());
}
EditorWidget::~EditorWidget()
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
index 66e7802111..c087d334a6 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
@@ -50,6 +50,7 @@
static const char QBS_CONFIG[] = "Qbs.Configuration";
static const char QBS_DRY_RUN[] = "Qbs.DryRun";
static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
+static const char QBS_CHECK_TIMESTAMPS[] = "Qbs.CheckTimestamps";
static const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs";
// --------------------------------------------------------------------
@@ -69,6 +70,7 @@ QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) :
{
setDisplayName(tr("Qbs Build"));
setQbsConfiguration(QVariantMap());
+ m_qbsBuildOptions.setForceTimestampCheck(true);
}
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other) :
@@ -194,6 +196,11 @@ bool QbsBuildStep::keepGoing() const
return m_qbsBuildOptions.keepGoing();
}
+bool QbsBuildStep::checkTimestamps() const
+{
+ return m_qbsBuildOptions.forceTimestampCheck();
+}
+
int QbsBuildStep::maxJobs() const
{
if (m_qbsBuildOptions.maxJobCount() > 0)
@@ -209,6 +216,7 @@ bool QbsBuildStep::fromMap(const QVariantMap &map)
setQbsConfiguration(map.value(QLatin1String(QBS_CONFIG)).toMap());
m_qbsBuildOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
m_qbsBuildOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
+ m_qbsBuildOptions.setForceTimestampCheck(map.value(QLatin1String(QBS_CHECK_TIMESTAMPS), true).toBool());
m_qbsBuildOptions.setMaxJobCount(map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt());
return true;
}
@@ -219,6 +227,7 @@ QVariantMap QbsBuildStep::toMap() const
map.insert(QLatin1String(QBS_CONFIG), m_qbsConfiguration);
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun());
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing());
+ map.insert(QLatin1String(QBS_CHECK_TIMESTAMPS), m_qbsBuildOptions.forceTimestampCheck());
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount());
return map;
}
@@ -333,6 +342,14 @@ void QbsBuildStep::setKeepGoing(bool kg)
emit qbsBuildOptionsChanged();
}
+void QbsBuildStep::setCheckTimestamps(bool ts)
+{
+ if (m_qbsBuildOptions.forceTimestampCheck() == ts)
+ return;
+ m_qbsBuildOptions.setForceTimestampCheck(ts);
+ emit qbsBuildOptionsChanged();
+}
+
void QbsBuildStep::setMaxJobs(int jobcount)
{
if (m_qbsBuildOptions.maxJobCount() == jobcount)
@@ -362,6 +379,8 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) :
this, SLOT(changeBuildVariant(int)));
connect(m_ui->dryRunCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeDryRun(bool)));
connect(m_ui->keepGoingCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeKeepGoing(bool)));
+ connect(m_ui->checkTimestampCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(changeCheckTimestamps(bool)));
connect(m_ui->jobSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeJobCount(int)));
connect(m_ui->propertyEdit, SIGNAL(propertiesChanged()), this, SLOT(changeProperties()));
connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)),
@@ -386,6 +405,7 @@ void QbsBuildStepConfigWidget::updateState()
if (!m_ignoreChange) {
m_ui->dryRunCheckBox->setChecked(m_step->dryRun());
m_ui->keepGoingCheckBox->setChecked(m_step->keepGoing());
+ m_ui->checkTimestampCheckBox->setChecked(m_step->checkTimestamps());
m_ui->jobSpinBox->setValue(m_step->maxJobs());
updatePropertyEdit(m_step->qbsConfiguration());
m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->isQmlDebuggingEnabled());
@@ -402,6 +422,8 @@ void QbsBuildStepConfigWidget::updateState()
command += QLatin1String("--dry-run ");
if (m_step->keepGoing())
command += QLatin1String("--keep-going ");
+ if (m_step->checkTimestamps())
+ command += QLatin1String("--check-timestamps ");
command += QString::fromLatin1("--jobs %1 ").arg(m_step->maxJobs());
command += QString::fromLatin1("%1 profile:%2").arg(buildVariant, m_step->profile());
@@ -480,6 +502,13 @@ void QbsBuildStepConfigWidget::changeKeepGoing(bool kg)
m_ignoreChange = false;
}
+void QbsBuildStepConfigWidget::changeCheckTimestamps(bool ts)
+{
+ m_ignoreChange = true;
+ m_step->setCheckTimestamps(ts);
+ m_ignoreChange = false;
+}
+
void QbsBuildStepConfigWidget::changeJobCount(int count)
{
m_ignoreChange = true;
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h
index f1ec50f67b..ba123fb5e8 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstep.h
+++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h
@@ -65,6 +65,7 @@ public:
bool dryRun() const;
bool keepGoing() const;
+ bool checkTimestamps() const;
int maxJobs() const;
QString buildVariant() const;
@@ -93,6 +94,7 @@ private:
void setDryRun(bool dr);
void setKeepGoing(bool kg);
+ void setCheckTimestamps(bool ts);
void setMaxJobs(int jobcount);
QVariantMap m_qbsConfiguration;
@@ -129,6 +131,7 @@ private slots:
void changeBuildVariant(int);
void changeDryRun(bool dr);
void changeKeepGoing(bool kg);
+ void changeCheckTimestamps(bool ts);
void changeJobCount(int count);
void changeProperties();
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
index d527af4f96..52767a8103 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
+++ b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui
@@ -168,6 +168,13 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="checkTimestampCheckBox">
+ <property name="text">
+ <string>Check timestamps</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="checkBoxSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
index 57d30690cc..844b28d460 100644
--- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
@@ -276,6 +276,7 @@ QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) :
m_ui->installRootChooser->setPromptDialogTitle(tr("Qbs Install Prefix"));
m_ui->installRootChooser->setExpectedKind(Utils::PathChooser::Directory);
+ m_ui->installRootChooser->setHistoryCompleter(QLatin1String("Qbs.InstallRoot.History"));
connect(m_ui->installRootChooser, SIGNAL(changed(QString)), this, SLOT(changeInstallRoot()));
connect(m_ui->removeFirstCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeRemoveFirst(bool)));
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index cfb50e3454..29340aae58 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -102,6 +102,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
{
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
+ setId(Constants::PROJECT_ID);
setProjectContext(Context(Constants::PROJECT_ID));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
@@ -111,7 +112,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
this, SLOT(targetWasAdded(ProjectExplorer::Target*)));
connect(this, SIGNAL(environmentChanged()), this, SLOT(delayParsing()));
- connect(&m_parsingDelay, SIGNAL(timeout()), this, SLOT(parseCurrentBuildConfiguration()));
+ connect(&m_parsingDelay, SIGNAL(timeout()), this, SLOT(startParsing()));
updateDocuments(QSet<QString>() << fileName);
@@ -140,11 +141,6 @@ QString QbsProject::displayName() const
return m_projectName;
}
-Id QbsProject::id() const
-{
- return Constants::PROJECT_ID;
-}
-
IDocument *QbsProject::document() const
{
foreach (IDocument *doc, m_qbsDocuments) {
@@ -361,6 +357,11 @@ void QbsProject::buildConfigurationChanged(BuildConfiguration *bc)
}
}
+void QbsProject::startParsing()
+{
+ parseCurrentBuildConfiguration(false);
+}
+
void QbsProject::delayParsing()
{
m_parsingDelay.start();
@@ -372,10 +373,13 @@ void QbsProject::delayForcedParsing()
delayParsing();
}
-void QbsProject::parseCurrentBuildConfiguration()
+void QbsProject::parseCurrentBuildConfiguration(bool force)
{
m_parsingDelay.stop();
+ if (!m_forceParsing)
+ m_forceParsing = force;
+
if (!activeTarget())
return;
QbsBuildConfiguration *bc = qobject_cast<QbsBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
@@ -639,7 +643,7 @@ void QbsProject::updateCppCodeModel(const qbs::ProjectData &prj)
part->includePaths += grpIncludePaths;
part->frameworkPaths += grpFrameworkPaths;
part->precompiledHeaders = QStringList(pch);
- part->defines += grpDefines;
+ part->projectDefines += grpDefines;
pinfo.appendProjectPart(part);
}
}
diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h
index 1a8d9232d8..d113684a93 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.h
+++ b/src/plugins/qbsprojectmanager/qbsproject.h
@@ -74,7 +74,6 @@ public:
~QbsProject();
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
QbsManager *projectManager() const;
@@ -91,6 +90,7 @@ public:
QString profileForTarget(const ProjectExplorer::Target *t) const;
bool isParsing() const;
bool hasParseResult() const;
+ void parseCurrentBuildConfiguration(bool force);
Utils::FileName defaultBuildDirectory() const;
static Utils::FileName defaultBuildDirectory(const QString &path);
@@ -102,7 +102,6 @@ public:
public slots:
void invalidate();
- void parseCurrentBuildConfiguration();
void delayParsing();
void delayForcedParsing();
@@ -118,6 +117,7 @@ private slots:
void targetWasAdded(ProjectExplorer::Target *t);
void changeActiveTarget(ProjectExplorer::Target *t);
void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
+ void startParsing();
private:
bool fromMap(const QVariantMap &map);
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
index 47e40a1f22..3b8da1c508 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
@@ -36,7 +36,6 @@ HEADERS = \
qbsprojectmanagerplugin.h \
qbspropertylineedit.h \
qbsrunconfiguration.h \
- qbsstep.h \
qbsconstants.h
SOURCES = \
@@ -55,8 +54,7 @@ SOURCES = \
qbsprojectmanager.cpp \
qbsprojectmanagerplugin.cpp \
qbspropertylineedit.cpp \
- qbsrunconfiguration.cpp \
- qbsstep.cpp
+ qbsrunconfiguration.cpp
FORMS = \
qbsbuildstepconfigwidget.ui \
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
index af2759e317..b4e8ab2420 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
@@ -96,9 +96,7 @@ QtcPlugin {
"qbspropertylineedit.cpp",
"qbspropertylineedit.h",
"qbsrunconfiguration.cpp",
- "qbsrunconfiguration.h",
- "qbsstep.cpp",
- "qbsstep.h"
+ "qbsrunconfiguration.h"
]
}
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index f02597b715..070d424886 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -405,7 +405,7 @@ void QbsProjectManagerPlugin::buildProducts(QbsProject *project, const QStringLi
void QbsProjectManagerPlugin::reparseCurrentProject()
{
if (m_currentProject)
- m_currentProject->parseCurrentBuildConfiguration();
+ m_currentProject->parseCurrentBuildConfiguration(true);
}
} // namespace Internal
diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
index de1dda1c5f..db63e584ab 100644
--- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
+++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
@@ -376,6 +376,7 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QW
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
m_workingDirectoryEdit = new Utils::PathChooser(this);
+ m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("WorkingDir.History"));
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
ProjectExplorer::EnvironmentAspect *aspect
= m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
diff --git a/src/plugins/qbsprojectmanager/qbsstep.cpp b/src/plugins/qbsprojectmanager/qbsstep.cpp
deleted file mode 100644
index b4aee3534e..0000000000
--- a/src/plugins/qbsprojectmanager/qbsstep.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "qbsstep.h"
-
-#include "qbsbuildconfiguration.h"
-#include "qbsparser.h"
-#include "qbsproject.h"
-#include "qbsprojectmanagerconstants.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/kit.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/target.h>
-#include <utils/qtcassert.h>
-
-#include <qbs.h>
-
-#include <QTimer>
-
-// --------------------------------------------------------------------
-// Constants:
-// --------------------------------------------------------------------
-
-static const char QBS_DRY_RUN[] = "Qbs.DryRun";
-static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
-static const char QBS_MAXJOBCOUNT[] = "Qbs.MaxJobs";
-
-namespace QbsProjectManager {
-namespace Internal {
-
-// --------------------------------------------------------------------
-// QbsStep:
-// --------------------------------------------------------------------
-
-QbsStep::QbsStep(ProjectExplorer::BuildStepList *bsl, Core::Id id) :
- ProjectExplorer::BuildStep(bsl, id),
- m_job(0)
-{
- m_qbsBuildOptions.setMaxJobCount(QbsManager::preferences()->jobs());
-}
-
-QbsStep::QbsStep(ProjectExplorer::BuildStepList *bsl, const QbsStep *other) :
- ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)),
- m_qbsBuildOptions(other->m_qbsBuildOptions), m_job(0)
-{ }
-
-QbsBuildConfiguration *QbsStep::currentBuildConfiguration() const
-{
- QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
- if (!bc)
- bc = static_cast<QbsBuildConfiguration *>(target()->activeBuildConfiguration());
- return bc;
-}
-
-QbsStep::~QbsStep()
-{
- cancel();
- m_job->deleteLater();
- m_job = 0;
-}
-
-bool QbsStep::init()
-{
- if (static_cast<QbsProject *>(project())->isParsing() || m_job)
- return false;
-
- if (!currentBuildConfiguration())
- return false;
-
- return true;
-}
-
-void QbsStep::run(QFutureInterface<bool> &fi)
-{
- m_fi = &fi;
-
- m_job = createJob();
-
- if (!m_job) {
- jobDone(false);
- return;
- }
-
- m_progressBase = 0;
-
- connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(jobDone(bool)));
- connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)),
- this, SLOT(handleTaskStarted(QString,int)));
- connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)),
- this, SLOT(handleProgress(int)));
-}
-
-QFutureInterface<bool> *QbsStep::future() const
-{
- return m_fi;
-}
-
-bool QbsStep::runInGuiThread() const
-{
- return true;
-}
-
-void QbsStep::cancel()
-{
- if (m_job)
- m_job->cancel();
-}
-
-bool QbsStep::dryRun() const
-{
- return m_qbsBuildOptions.dryRun();
-}
-
-bool QbsStep::keepGoing() const
-{
- return m_qbsBuildOptions.keepGoing();
-}
-
-int QbsStep::maxJobs() const
-{
- return m_qbsBuildOptions.maxJobCount();
-}
-
-bool QbsStep::fromMap(const QVariantMap &map)
-{
- if (!ProjectExplorer::BuildStep::fromMap(map))
- return false;
-
- m_qbsBuildOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
- m_qbsBuildOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
- m_qbsBuildOptions.setMaxJobCount(map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt());
-
- if (m_qbsBuildOptions.maxJobCount() <= 0)
- m_qbsBuildOptions.setMaxJobCount(QbsManager::preferences()->jobs());
-
- return true;
-}
-
-QVariantMap QbsStep::toMap() const
-{
- QVariantMap map = ProjectExplorer::BuildStep::toMap();
- map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun());
- map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing());
- map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount());
- return map;
-}
-
-void QbsStep::jobDone(bool success)
-{
- // Report errors:
- if (m_job) {
- foreach (const qbs::ErrorItem &item, m_job->error().items())
- createTaskAndOutput(ProjectExplorer::Task::Error, item.description(),
- item.codeLocation().fileName(), item.codeLocation().line());
- m_job->deleteLater();
- m_job = 0;
- }
-
- QTC_ASSERT(m_fi, return);
- m_fi->reportResult(success);
- m_fi = 0; // do not delete, it is not ours
-
- emit finished();
-}
-
-void QbsStep::handleTaskStarted(const QString &desciption, int max)
-{
- Q_UNUSED(desciption);
- QTC_ASSERT(m_fi, return);
-
- m_progressBase = m_fi->progressValue();
- m_fi->setProgressRange(0, m_progressBase + max);
-}
-
-void QbsStep::handleProgress(int value)
-{
- QTC_ASSERT(m_fi, return);
- m_fi->setProgressValue(m_progressBase + value);
-}
-
-void QbsStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message,
- const QString &file, int line)
-{
- emit addTask(ProjectExplorer::Task(type, message,
- Utils::FileName::fromString(file), line,
- ProjectExplorer::Constants::TASK_CATEGORY_COMPILE));
- emit addOutput(message, NormalOutput);
-}
-
-void QbsStep::setDryRun(bool dr)
-{
- if (m_qbsBuildOptions.dryRun() == dr)
- return;
- m_qbsBuildOptions.setDryRun(dr);
- emit qbsBuildOptionsChanged();
-}
-
-void QbsStep::setKeepGoing(bool kg)
-{
- if (m_qbsBuildOptions.keepGoing() == kg)
- return;
- m_qbsBuildOptions.setKeepGoing(kg);
- emit qbsBuildOptionsChanged();
-}
-
-void QbsStep::setMaxJobs(int jobcount)
-{
- if (m_qbsBuildOptions.maxJobCount() == jobcount)
- return;
- m_qbsBuildOptions.setMaxJobCount(jobcount);
- emit qbsBuildOptionsChanged();
-}
-
-} // namespace Internal
-} // namespace QbsProjectManager
diff --git a/src/plugins/qbsprojectmanager/qbsstep.h b/src/plugins/qbsprojectmanager/qbsstep.h
deleted file mode 100644
index 3728f237b1..0000000000
--- a/src/plugins/qbsprojectmanager/qbsstep.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef QBSSTEP_H
-#define QBSSTEP_H
-
-#include "qbsbuildconfiguration.h"
-
-#include <projectexplorer/buildstep.h>
-#include <projectexplorer/task.h>
-
-#include <qbs.h>
-
-namespace QbsProjectManager {
-namespace Internal {
-
-class QbsStepConfigWidget;
-
-class QbsStep : public ProjectExplorer::BuildStep
-{
- Q_OBJECT
-
-public:
- ~QbsStep();
-
- bool init();
-
- void run(QFutureInterface<bool> &fi);
-
- QFutureInterface<bool> *future() const;
-
- bool runInGuiThread() const;
- void cancel();
-
- bool dryRun() const;
- bool keepGoing() const;
- int maxJobs() const;
- QString buildVariant() const;
-
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-
-signals:
- void qbsBuildOptionsChanged();
-
-private slots:
- virtual void jobDone(bool success);
- void handleTaskStarted(const QString &desciption, int max);
- void handleProgress(int value);
-
-protected:
- QbsStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
- QbsStep(ProjectExplorer::BuildStepList *bsl, const QbsStep *other);
-
- QbsBuildConfiguration *currentBuildConfiguration() const;
-
- virtual qbs::AbstractJob *createJob() = 0;
-
- void createTaskAndOutput(ProjectExplorer::Task::TaskType type,
- const QString &message, const QString &file, int line);
-
- qbs::AbstractJob *job() const { return m_job; }
- qbs::BuildOptions buildOptions() const { return m_qbsBuildOptions; }
-
-private:
- void setDryRun(bool dr);
- void setKeepGoing(bool kg);
- void setMaxJobs(int jobcount);
-
- qbs::BuildOptions m_qbsBuildOptions;
-
- QFutureInterface<bool> *m_fi;
- qbs::AbstractJob *m_job;
- int m_progressBase;
-
- friend class QbsStepConfigWidget;
-};
-
-} // namespace Internal
-} // namespace QbsProjectManager
-
-#endif // QBSSTEP_H
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp
index 2e950d0a14..9e2936d267 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp
@@ -40,6 +40,7 @@ ClassDefinition::ClassDefinition(QWidget *parent) :
{
m_ui.setupUi(this);
m_ui.iconPathChooser->setExpectedKind(Utils::PathChooser::File);
+ m_ui.iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History"));
m_ui.iconPathChooser->setPromptDialogTitle(tr("Select Icon"));
m_ui.iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)"));
}
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
index e71eec89e0..6e20bd54db 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
@@ -217,6 +217,7 @@ DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQm
m_workingDirectoryEdit = new PathChooser(this);
m_workingDirectoryEdit->setExpectedKind(PathChooser::Directory);
+ m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("WorkingDir.History"));
m_workingDirectoryEdit->setPath(m_qmakeRunConfiguration->baseWorkingDirectory());
m_workingDirectoryEdit->setBaseDirectory(m_qmakeRunConfiguration->target()->project()->projectDirectory());
EnvironmentAspect *aspect = qmakeRunConfiguration->extraAspect<EnvironmentAspect>();
diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
index 8a144ef622..75c0d28e75 100644
--- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
+++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
@@ -620,6 +620,9 @@ NonInternalLibraryDetailsController::NonInternalLibraryDetailsController(
setLibraryComboBoxVisible(false);
setLibraryPathChooserVisible(true);
+ libraryDetailsWidget()->libraryPathChooser
+ ->setHistoryCompleter(QLatin1String("Qmake.LibDir.History"));
+
if (creatorPlatform() == CreatorWindows) {
libraryDetailsWidget()->libraryPathChooser->setPromptDialogFilter(
QLatin1String("Library file (*.lib lib*.a)"));
diff --git a/src/plugins/qmakeprojectmanager/makestep.cpp b/src/plugins/qmakeprojectmanager/makestep.cpp
index 73d9e3a739..e53f9de1bb 100644
--- a/src/plugins/qmakeprojectmanager/makestep.cpp
+++ b/src/plugins/qmakeprojectmanager/makestep.cpp
@@ -326,7 +326,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
m_ui->makePathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->makePathChooser->setBaseDirectory(Utils::PathChooser::homePath());
-
+ m_ui->makePathChooser->setHistoryCompleter(QLatin1String("PE.MakeCommand.History"));
const QString &makeCmd = m_makeStep->makeCommand();
m_ui->makePathChooser->setPath(makeCmd);
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp
index 230cff4440..3c94b1dfe2 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp
@@ -61,8 +61,7 @@ ProFileEditor::ProFileEditor(ProFileEditorWidget *editor)
Core::IEditor *ProFileEditor::duplicate(QWidget *parent)
{
- ProFileEditorWidget *ret = new ProFileEditorWidget(parent, qobject_cast<ProFileEditorWidget*>(editorWidget())->factory(),
- qobject_cast<ProFileEditorWidget*>(editorWidget())->actionHandler());
+ ProFileEditorWidget *ret = new ProFileEditorWidget(parent, qobject_cast<ProFileEditorWidget*>(editorWidget())->factory());
ret->duplicateFrom(editorWidget());
TextEditor::TextEditorSettings::initializeEditor(ret);
return ret->editor();
@@ -82,15 +81,13 @@ TextEditor::CompletionAssistProvider *ProFileEditor::completionAssistProvider()
// ProFileEditorWidget
//
-ProFileEditorWidget::ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah)
- : BaseTextEditorWidget(parent), m_factory(factory), m_ah(ah)
+ProFileEditorWidget::ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory)
+ : BaseTextEditorWidget(parent), m_factory(factory)
{
QSharedPointer<ProFileDocument> doc(new ProFileDocument());
doc->setMimeType(QLatin1String(Constants::PROFILE_MIMETYPE));
setBaseTextDocument(doc);
- ah->setupActions(this);
-
baseTextDocument()->setSyntaxHighlighter(new ProFileHighlighter);
m_commentDefinition.clearCommentStyles();
m_commentDefinition.singleLine = QLatin1Char('#');
@@ -170,7 +167,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
}
}
- QDir dir(QFileInfo(editorDocument()->filePath()).absolutePath());
+ QDir dir(QFileInfo(baseTextDocument()->filePath()).absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h
index 4976ebd081..1f5425e3f0 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.h
+++ b/src/plugins/qmakeprojectmanager/profileeditor.h
@@ -34,11 +34,6 @@
#include <texteditor/basetexteditor.h>
#include <utils/uncommentselection.h>
-namespace TextEditor {
-class FontSettings;
-class TextEditorActionHandler;
-}
-
namespace QmakeProjectManager {
namespace Internal {
@@ -63,11 +58,9 @@ class ProFileEditorWidget : public TextEditor::BaseTextEditorWidget
Q_OBJECT
public:
- ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory,
- TextEditor::TextEditorActionHandler *ah);
+ ProFileEditorWidget(QWidget *parent, ProFileEditorFactory *factory);
ProFileEditorFactory *factory() { return m_factory; }
- TextEditor::TextEditorActionHandler *actionHandler() const { return m_ah; }
void unCommentSelection();
@@ -79,7 +72,6 @@ protected:
private:
ProFileEditorFactory *m_factory;
- TextEditor::TextEditorActionHandler *m_ah;
Utils::CommentDefinition m_commentDefinition;
};
diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp b/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp
index 3f75d5809d..13860e4519 100644
--- a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp
@@ -35,6 +35,7 @@
#include <qtsupport/qtsupportconstants.h>
#include <coreplugin/fileiconprovider.h>
+#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
#include <QCoreApplication>
@@ -42,15 +43,17 @@
using namespace QmakeProjectManager;
using namespace QmakeProjectManager::Internal;
-ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager, TextEditor::TextEditorActionHandler *handler) :
- m_manager(manager),
- m_actionHandler(handler)
+ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) :
+ m_manager(manager)
{
setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME));
addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
+ new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR,
+ TextEditor::TextEditorActionHandler::UnCommentSelection
+ | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro");
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pri");
@@ -59,7 +62,7 @@ ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager, TextEditor::Te
Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent)
{
- ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this, m_actionHandler);
+ ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this);
TextEditor::TextEditorSettings::initializeEditor(editor);
return editor->editor();
}
diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.h b/src/plugins/qmakeprojectmanager/profileeditorfactory.h
index 07a2e5e21c..2d7814b3ee 100644
--- a/src/plugins/qmakeprojectmanager/profileeditorfactory.h
+++ b/src/plugins/qmakeprojectmanager/profileeditorfactory.h
@@ -32,8 +32,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
-namespace TextEditor { class TextEditorActionHandler; }
-
namespace QmakeProjectManager {
class QmakeManager;
@@ -45,7 +43,7 @@ class ProFileEditorFactory : public Core::IEditorFactory
Q_OBJECT
public:
- ProFileEditorFactory(QmakeManager *parent, TextEditor::TextEditorActionHandler *handler);
+ ProFileEditorFactory(QmakeManager *parent);
Core::IEditor *createEditor(QWidget *parent);
@@ -53,7 +51,6 @@ public:
private:
QmakeManager *m_manager;
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index 80608630c9..eb3a187bb6 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -865,7 +865,7 @@ QList<ProjectNode::ProjectAction> QmakePriFileNode::supportedActions(Node *node)
addExistingFiles = addExistingFiles && !deploysFolder(node->path());
if (addExistingFiles)
- actions << AddExistingFile;
+ actions << AddExistingFile << AddExistingDirectory;
break;
}
diff --git a/src/plugins/qmakeprojectmanager/qmakeparser.cpp b/src/plugins/qmakeprojectmanager/qmakeparser.cpp
index 100d9a80cb..a64c4c9f61 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparser.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparser.cpp
@@ -33,7 +33,6 @@
#include <projectexplorer/projectexplorerconstants.h>
using namespace QmakeProjectManager;
-using namespace QmakeProjectManager::Internal;
using ProjectExplorer::Task;
QMakeParser::QMakeParser() : m_error(QLatin1String("^(.+):(\\d+):\\s(.+)$"))
diff --git a/src/plugins/qmakeprojectmanager/qmakeparser.h b/src/plugins/qmakeprojectmanager/qmakeparser.h
index 68b73aa15e..e37ee76791 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparser.h
+++ b/src/plugins/qmakeprojectmanager/qmakeparser.h
@@ -30,14 +30,15 @@
#ifndef QMAKEPARSER_H
#define QMAKEPARSER_H
+#include "qmakeprojectmanager_global.h"
+
#include <projectexplorer/ioutputparser.h>
#include <QRegExp>
namespace QmakeProjectManager {
-namespace Internal {
-class QMakeParser : public ProjectExplorer::IOutputParser
+class QMAKEPROJECTMANAGER_EXPORT QMakeParser : public ProjectExplorer::IOutputParser
{
Q_OBJECT
@@ -49,7 +50,6 @@ private:
QRegExp m_error;
};
-} // namesapce Internal
} // namespace QmakeProjectManager
#endif // QMAKEPARSER_H
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 3901ba14e1..7da38ea3f9 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -343,6 +343,7 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
m_centralizedFolderWatcher(0),
m_activeTarget(0)
{
+ setId(Constants::QMAKEPROJECT_ID);
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -527,7 +528,7 @@ void QmakeProject::updateCppCodeModel()
SysRootKitInformation::sysRoot(k));
// part->defines
- part->defines += pro->cxxDefines();
+ part->projectDefines += pro->cxxDefines();
// part->includePaths, part->frameworkPaths
part->includePaths.append(pro->variableValue(IncludePathVar));
@@ -890,11 +891,6 @@ QString QmakeProject::displayName() const
return QFileInfo(projectFilePath()).completeBaseName();
}
-Core::Id QmakeProject::id() const
-{
- return Core::Id(Constants::QMAKEPROJECT_ID);
-}
-
Core::IDocument *QmakeProject::document() const
{
return m_fileInfo;
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h
index fbab9a573f..74d9bb9fc9 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.h
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.h
@@ -76,7 +76,6 @@ public:
virtual ~QmakeProject();
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
QmakeManager *qmakeProjectManager() const;
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
index 82292aea24..ca6be8d091 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
@@ -67,6 +67,7 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_ui->shadowBuildDirEdit->setHistoryCompleter(QLatin1String("BuildDir.History"));
m_ui->shadowBuildDirEdit->setEnvironment(bc->environment());
m_ui->shadowBuildDirEdit->setBaseDirectory(bc->target()->project()->projectDirectory());
bool isShadowBuild = bc->isShadowBuild();
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
index e1d49e8015..75140ea413 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
@@ -143,7 +143,7 @@ void QmakeManager::addLibrary()
ProFileEditorWidget *editor =
qobject_cast<ProFileEditorWidget*>(Core::EditorManager::currentEditor()->widget());
if (editor)
- addLibrary(editor->editorDocument()->filePath(), editor);
+ addLibrary(editor->baseTextDocument()->filePath(), editor);
}
void QmakeManager::addLibraryContextMenu()
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index b5763e5d14..00f2ca4ba9 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -111,12 +111,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
m_qmakeProjectManager = new QmakeManager(this);
addObject(m_qmakeProjectManager);
- TextEditor::TextEditorActionHandler *editorHandler
- = new TextEditor::TextEditorActionHandler(Constants::C_PROFILEEDITOR,
- TextEditor::TextEditorActionHandler::UnCommentSelection
- | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
-
- m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager, editorHandler);
+ m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager);
ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation);
diff --git a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h b/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h
index 50326eb78a..fba657b0c1 100644
--- a/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h
+++ b/src/plugins/qmakeprojectmanager/wizards/abstractmobileapp.h
@@ -121,6 +121,7 @@ public:
static const QString DeploymentPriFileName;
protected:
AbstractMobileApp();
+ virtual QByteArray generateProFile(QString *errorMessage) const;
static QString templatesRoot();
static void insertParameter(QString &line, const QString &parameter);
@@ -146,7 +147,6 @@ protected:
private:
QByteArray generateDesktopFile(QString *errorMessage, int fileType) const;
QByteArray generateMainCpp(QString *errorMessage) const;
- QByteArray generateProFile(QString *errorMessage) const;
virtual QByteArray generateFileExtended(int fileType,
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const = 0;
diff --git a/src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp b/src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp
index 45c7278efe..c83dc67a00 100644
--- a/src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/html5appwizardpages.cpp
@@ -45,6 +45,7 @@ Html5AppWizardOptionsPage::Html5AppWizardOptionsPage(QWidget *parent)
{
d->ui.setupUi(this);
d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
+ d->ui.importLineEdit->setHistoryCompleter(QLatin1String("Qmake.Html.History"));
d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.html"));
d->ui.importLineEdit->setPromptDialogTitle(tr("Select HTML File"));
connect(d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
index 169afe0cac..b5833254dd 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.cpp
@@ -44,6 +44,11 @@
namespace QmakeProjectManager {
namespace Internal {
+static QString qtQuickApplicationViewerDirectory()
+{
+ return Core::ICore::resourcePath() + QLatin1String("/templates/shared/qtquickapplicationviewer/");
+}
+
static QString templateRootDirectory()
{
return Core::ICore::resourcePath() + QLatin1String("/templates/qtquick/");
@@ -208,11 +213,11 @@ QString QtQuickApp::pathExtended(int fileType) const
case MainQmlDeployed: return qmlSubDir + mainQmlFile;
case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
case AppViewerPri: return pathBase + appViewerTargetSubDir + fileName(AppViewerPri);
- case AppViewerPriOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerPri);
+ case AppViewerPriOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerPri);
case AppViewerCpp: return pathBase + appViewerTargetSubDir + fileName(AppViewerCpp);
- case AppViewerCppOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerCpp);
+ case AppViewerCppOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerCpp);
case AppViewerH: return pathBase + appViewerTargetSubDir + fileName(AppViewerH);
- case AppViewerHOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerH);
+ case AppViewerHOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerH);
case QmlDirProFileRelative: return QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
default: qFatal("QtQuickApp::pathExtended() needs more work");
}
@@ -294,6 +299,13 @@ QString QtQuickApp::appViewerOriginSubDir() const
return appViewerBaseName() + QLatin1Char('/');
}
+QByteArray QtQuickApp::generateProFile(QString *errorMessage) const
+{
+ QByteArray proFileContent = AbstractMobileApp::generateProFile(errorMessage);
+ proFileContent.replace("../../shared/qtquickapplicationviewer/", "");
+ return proFileContent;
+}
+
QByteArray QtQuickApp::generateFileExtended(int fileType,
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
{
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
index e421a42dcb..b7381ed465 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
+++ b/src/plugins/qmakeprojectmanager/wizards/qtquickapp.h
@@ -95,7 +95,9 @@ public:
static const int StubVersion;
protected:
- virtual QString appViewerBaseName() const;
+ virtual QByteArray generateProFile(QString *errorMessage) const;
+
+ QString appViewerBaseName() const;
QString fileName(ExtendedFileType type) const;
QString appViewerOriginSubDir() const;
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index 677d13bd81..53a95fa0b9 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -86,6 +86,19 @@ QRectF FormEditorItem::boundingRect() const
return m_paintedBoundingRect;
}
+QPainterPath FormEditorItem::shape() const
+{
+ QPainterPath painterPath;
+ painterPath.addRect(m_boundingRect);
+
+ return painterPath;
+}
+
+bool FormEditorItem::contains(const QPointF &point) const
+{
+ return m_boundingRect.contains(point);
+}
+
void FormEditorItem::updateGeometry()
{
prepareGeometryChange();
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.h b/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
index ddc5c76b40..3890c0d924 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
@@ -90,6 +90,8 @@ public:
FormEditorItem *parentItem() const;
QRectF boundingRect() const;
+ QPainterPath shape() const;
+ bool contains(const QPointF &point) const;
void updateGeometry();
void updateVisibilty();
diff --git a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
index 16364c9dd2..dd1ebe2b0c 100644
--- a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
@@ -46,20 +46,20 @@ SelectionIndicator::~SelectionIndicator()
void SelectionIndicator::show()
{
- foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values())
+ foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash)
item->show();
}
void SelectionIndicator::hide()
{
- foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values())
+ foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash)
item->hide();
}
void SelectionIndicator::clear()
{
if (m_layerItem) {
- foreach (QGraphicsItem *item, m_indicatorShapeHash.values()) {
+ foreach (QGraphicsItem *item, m_indicatorShapeHash) {
m_layerItem->scene()->removeItem(item);
delete item;
}
@@ -120,7 +120,7 @@ void SelectionIndicator::setCursor(const QCursor &cursor)
{
m_cursor = cursor;
- foreach (QGraphicsItem *item, m_indicatorShapeHash.values())
+ foreach (QGraphicsItem *item, m_indicatorShapeHash)
item->setCursor(cursor);
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index afa42fda07..33c4333618 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -151,7 +151,11 @@ void PropertyEditorValue::setValue(const QVariant &value)
if (m_value.isValid())
emit valueChangedQml();
emit isBoundChanged();
+}
+QString PropertyEditorValue::enumeration() const
+{
+ return m_value.value<QmlDesigner::Enumeration>().nameToString();
}
QString PropertyEditorValue::expression() const
@@ -267,6 +271,13 @@ void PropertyEditorValue::resetValue()
}
}
+void PropertyEditorValue::setEnumeration(const QString &scope, const QString &name)
+{
+ QmlDesigner::Enumeration newEnumeration(scope, name);
+
+ setValueWithEmit(QVariant::fromValue(newEnumeration));
+}
+
void PropertyEditorValue::registerDeclarativeTypes()
{
qmlRegisterType<PropertyEditorValue>("HelperWidgets",2,0,"PropertyEditorValue");
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
index ee48d23001..bcdc64a978 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.h
@@ -36,6 +36,7 @@
#include <QQmlPropertyMap>
#include <QtQml>
#include <modelnode.h>
+#include <enumeration.h>
class PropertyEditorValue;
@@ -78,6 +79,7 @@ class PropertyEditorValue : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValueWithEmit NOTIFY valueChangedQml)
+ Q_PROPERTY(QVariant enumeration READ enumeration NOTIFY valueChangedQml)
Q_PROPERTY(QString expression READ expression WRITE setExpressionWithEmit NOTIFY expressionChanged FINAL)
Q_PROPERTY(QString valueToString READ valueToString NOTIFY valueChangedQml FINAL)
Q_PROPERTY(bool isInModel READ isInModel NOTIFY valueChangedQml FINAL)
@@ -96,6 +98,8 @@ public:
void setValueWithEmit(const QVariant &value);
void setValue(const QVariant &value);
+ QString enumeration() const;
+
QString expression() const;
void setExpressionWithEmit(const QString &expression);
void setExpression(const QString &expression);
@@ -125,6 +129,7 @@ public:
public slots:
void resetValue();
+ void setEnumeration(const QString &scope, const QString &name);
signals:
void valueChanged(const QString &name, const QVariant&);
diff --git a/src/plugins/qmldesigner/designercore/designercore-lib.pri b/src/plugins/qmldesigner/designercore/designercore-lib.pri
index 686867037e..32f2200bca 100644
--- a/src/plugins/qmldesigner/designercore/designercore-lib.pri
+++ b/src/plugins/qmldesigner/designercore/designercore-lib.pri
@@ -13,6 +13,7 @@ include (instances/instances.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/commands/commands.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/container/container.pri)
+include (../../../../share/qtcreator/qml/qmlpuppet/types/types.pri)
SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/rewriterview.cpp \
diff --git a/src/plugins/qmldesigner/designercore/include/variantproperty.h b/src/plugins/qmldesigner/designercore/include/variantproperty.h
index 79a19515f5..958dddeb9a 100644
--- a/src/plugins/qmldesigner/designercore/include/variantproperty.h
+++ b/src/plugins/qmldesigner/designercore/include/variantproperty.h
@@ -32,6 +32,7 @@
#include "qmldesignercorelib_global.h"
#include "abstractproperty.h"
+#include "enumeration.h"
QT_BEGIN_NAMESPACE
class QTextStream;
@@ -55,7 +56,12 @@ public:
void setValue(const QVariant &value);
QVariant value() const;
+ void setEnumeration(const EnumerationName &enumerationName);
+ Enumeration enumeration() const;
+ bool holdsEnumeration() const;
+
void setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value);
+ void setDynamicTypeNameAndEnumeration(const TypeName &type, const EnumerationName &enumerationName);
VariantProperty();
VariantProperty(const VariantProperty &property, AbstractView *view);
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index fa4ca76686..58c1f6f2f4 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -126,6 +126,20 @@ QString NodeInstanceServerProxy::creatorQmlPuppetPath()
return applicationPath;
}
+bool NodeInstanceServerProxy::checkPuppetVersion(const QString &qmlPuppetPath)
+{
+ QProcess qmlPuppetVersionProcess;
+ qmlPuppetVersionProcess.start(qmlPuppetPath, QStringList() << "--version");
+ qmlPuppetVersionProcess.waitForReadyRead(6000);
+
+ QByteArray versionString = qmlPuppetVersionProcess.readAll();
+
+ bool canConvert;
+ unsigned int versionNumber = versionString.toUInt(&canConvert);
+
+ return canConvert && versionNumber == 2;
+}
+
NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus, const QString &pathToQt)
: NodeInstanceServerInterface(nodeInstanceView),
m_localServer(new QLocalServer(this)),
@@ -175,86 +189,89 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
#endif
if (QFileInfo(applicationPath).exists()) {
- m_qmlPuppetEditorProcess = new QProcess;
- m_qmlPuppetEditorProcess->setProcessEnvironment(environment);
- m_qmlPuppetEditorProcess->setObjectName("EditorProcess");
- connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
- connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill()));
- bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty();
- if (fowardQmlpuppetOutput) {
- m_qmlPuppetEditorProcess->setProcessChannelMode(QProcess::MergedChannels);
- connect(m_qmlPuppetEditorProcess.data(), SIGNAL(readyRead()), this, SLOT(printEditorProcessOutput()));
- }
- m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster");
-
- if (runModus == NormalModus) {
- m_qmlPuppetPreviewProcess = new QProcess;
- m_qmlPuppetPreviewProcess->setProcessEnvironment(environment);
- m_qmlPuppetPreviewProcess->setObjectName("PreviewProcess");
- connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
- connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill()));
+ if (checkPuppetVersion(applicationPath)) {
+ m_qmlPuppetEditorProcess = new QProcess;
+ m_qmlPuppetEditorProcess->setProcessEnvironment(environment);
+ m_qmlPuppetEditorProcess->setObjectName("EditorProcess");
+ connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill()));
+ bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty();
if (fowardQmlpuppetOutput) {
- m_qmlPuppetPreviewProcess->setProcessChannelMode(QProcess::MergedChannels);
- connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(readyRead()), this, SLOT(printPreviewProcessOutput()));
+ m_qmlPuppetEditorProcess->setProcessChannelMode(QProcess::MergedChannels);
+ connect(m_qmlPuppetEditorProcess.data(), SIGNAL(readyRead()), this, SLOT(printEditorProcessOutput()));
}
- m_qmlPuppetPreviewProcess->start(applicationPath, QStringList() << socketToken << "previewmode" << "-graphicssystem raster");
+ m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster");
+
+ if (runModus == NormalModus) {
+ m_qmlPuppetPreviewProcess = new QProcess;
+ m_qmlPuppetPreviewProcess->setProcessEnvironment(environment);
+ m_qmlPuppetPreviewProcess->setObjectName("PreviewProcess");
+ connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill()));
+ if (fowardQmlpuppetOutput) {
+ m_qmlPuppetPreviewProcess->setProcessChannelMode(QProcess::MergedChannels);
+ connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(readyRead()), this, SLOT(printPreviewProcessOutput()));
+ }
+ m_qmlPuppetPreviewProcess->start(applicationPath, QStringList() << socketToken << "previewmode" << "-graphicssystem raster");
+
+ m_qmlPuppetRenderProcess = new QProcess;
+ m_qmlPuppetRenderProcess->setProcessEnvironment(environment);
+ m_qmlPuppetRenderProcess->setObjectName("RenderProcess");
+ connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetRenderProcess.data(), SLOT(kill()));
+ if (fowardQmlpuppetOutput) {
+ m_qmlPuppetRenderProcess->setProcessChannelMode(QProcess::MergedChannels);
+ connect(m_qmlPuppetRenderProcess.data(), SIGNAL(readyRead()), this, SLOT(printRenderProcessOutput()));
+ }
+ m_qmlPuppetRenderProcess->start(applicationPath, QStringList() << socketToken << "rendermode" << "-graphicssystem raster");
- m_qmlPuppetRenderProcess = new QProcess;
- m_qmlPuppetRenderProcess->setProcessEnvironment(environment);
- m_qmlPuppetRenderProcess->setObjectName("RenderProcess");
- connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
- connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetRenderProcess.data(), SLOT(kill()));
- if (fowardQmlpuppetOutput) {
- m_qmlPuppetRenderProcess->setProcessChannelMode(QProcess::MergedChannels);
- connect(m_qmlPuppetRenderProcess.data(), SIGNAL(readyRead()), this, SLOT(printRenderProcessOutput()));
}
- m_qmlPuppetRenderProcess->start(applicationPath, QStringList() << socketToken << "rendermode" << "-graphicssystem raster");
- }
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));
- connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));
+ if (m_qmlPuppetEditorProcess->waitForStarted(10000)) {
+ connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int)), m_qmlPuppetEditorProcess.data(),SLOT(deleteLater()));
- if (m_qmlPuppetEditorProcess->waitForStarted(10000)) {
- connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int)), m_qmlPuppetEditorProcess.data(),SLOT(deleteLater()));
+ if (runModus == NormalModus) {
+ m_qmlPuppetPreviewProcess->waitForStarted();
+ connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int)), m_qmlPuppetPreviewProcess.data(),SLOT(deleteLater()));
- if (runModus == NormalModus) {
- m_qmlPuppetPreviewProcess->waitForStarted();
- connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int)), m_qmlPuppetPreviewProcess.data(),SLOT(deleteLater()));
+ m_qmlPuppetRenderProcess->waitForStarted();
+ connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int)), m_qmlPuppetRenderProcess.data(),SLOT(deleteLater()));
+ }
- m_qmlPuppetRenderProcess->waitForStarted();
- connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int)), m_qmlPuppetRenderProcess.data(),SLOT(deleteLater()));
- }
+ if (!m_localServer->hasPendingConnections())
+ m_localServer->waitForNewConnection(10000);
- if (!m_localServer->hasPendingConnections())
- m_localServer->waitForNewConnection(10000);
+ m_firstSocket = m_localServer->nextPendingConnection();
+ connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
- m_firstSocket = m_localServer->nextPendingConnection();
- connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
+ if (runModus == NormalModus) {
+ if (!m_localServer->hasPendingConnections())
+ m_localServer->waitForNewConnection(10000);
- if (runModus == NormalModus) {
- if (!m_localServer->hasPendingConnections())
- m_localServer->waitForNewConnection(10000);
+ m_secondSocket = m_localServer->nextPendingConnection();
+ connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
- m_secondSocket = m_localServer->nextPendingConnection();
- connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
+ if (!m_localServer->hasPendingConnections())
+ m_localServer->waitForNewConnection(10000);
- if (!m_localServer->hasPendingConnections())
- m_localServer->waitForNewConnection(10000);
+ m_thirdSocket = m_localServer->nextPendingConnection();
+ connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream()));
+ }
- m_thirdSocket = m_localServer->nextPendingConnection();
- connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream()));
+ } else {
+ QMessageBox::warning(0, tr("Cannot Start QML Puppet Executable"),
+ tr("The executable of the QML Puppet process (%1) cannot be started. "
+ "Please check your installation. "
+ "QML Puppet is a process which runs in the background to render the items.").
+ arg(applicationPath));
}
+ m_localServer->close();
} else {
- QMessageBox::warning(0, tr("Cannot Start QML Puppet Executable"),
- tr("The executable of the QML Puppet process (%1) cannot be started. "
- "Please check your installation. "
- "QML Puppet is a process which runs in the background to render the items.").
- arg(applicationPath));
+ QMessageBox::warning(0, tr("Wrong QML Puppet Executable Version"), tr("The QML Puppet version is incompatible with the Qt Creator version."));
}
-
- m_localServer->close();
-
} else {
QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"), missingQmlPuppetErrorMessage(applicationPath));
}
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
index 2b724f37c7..df4e1e1a69 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
@@ -79,6 +79,8 @@ protected:
QString qmlPuppetApplicationName() const;
QString macOSBundlePath(const QString &path) const;
QString creatorQmlPuppetPath();
+ static bool checkPuppetVersion(const QString &qmlPuppetPath);
+
signals:
void processCrashed();
diff --git a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
index 4fa4a8b82b..8e7d5015b9 100644
--- a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
@@ -113,9 +113,8 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
if (false) {
}
- if (variantProperty.parentModelNode().metaInfo().isValid() &&
- variantProperty.parentModelNode().metaInfo().propertyIsEnumType(variantProperty.name())) {
- return variantProperty.parentModelNode().metaInfo().propertyEnumScope(variantProperty.name()) + '.' + stringValue;
+ if (variantProperty.holdsEnumeration()) {
+ return variantProperty.enumeration().toString();
} else {
switch (value.type()) {
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
index 7b0b170d23..8335cb02ad 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
@@ -40,6 +40,7 @@
#include "variantproperty.h"
#include "signalhandlerproperty.h"
#include "nodemetainfo.h"
+#include "enumeration.h"
#include <qmljs/qmljsevaluate.h>
#include <qmljs/qmljslink.h>
@@ -565,7 +566,7 @@ public:
if (astValueList.count() == 2 //Check for global Qt enums
&& astValueList.first() == QLatin1String("Qt")
&& globalQtEnums().contains(astValueList.last()))
- return QVariant(astValueList.last());
+ return QVariant::fromValue(Enumeration(astValue));
ExpressionStatement *eStmt = cast<ExpressionStatement *>(rhs);
if (!eStmt || !eStmt->expression)
@@ -607,7 +608,7 @@ public:
return QVariant();
if (rhsCppComponentValue->getEnum(lhsPropertyTypeName).hasKey(rhsValueName))
- return QVariant(rhsValueName);
+ return QVariant::fromValue(Enumeration(astValue));
else
return QVariant();
}
diff --git a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp
index 40423adf95..c21d30bad3 100644
--- a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp
+++ b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp
@@ -89,6 +89,21 @@ QVariant VariantProperty::value() const
return QVariant();
}
+void VariantProperty::setEnumeration(const EnumerationName &enumerationName)
+{
+ setValue(QVariant::fromValue(Enumeration(enumerationName)));
+}
+
+Enumeration VariantProperty::enumeration() const
+{
+ return value().value<Enumeration>();
+}
+
+bool VariantProperty::holdsEnumeration() const
+{
+ return value().canConvert<Enumeration>();
+}
+
void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value)
{
Internal::WriteLocker locker(model());
@@ -111,7 +126,12 @@ void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVa
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isVariantProperty())
model()->d->removeProperty(internalNode()->property(name()));
- model()->d->setDynamicVariantProperty(internalNode(), name(), type, value);
+ model()->d->setDynamicVariantProperty(internalNode(), name(), type, value);
+}
+
+void VariantProperty::setDynamicTypeNameAndEnumeration(const TypeName &type, const EnumerationName &enumerationName)
+{
+ setDynamicTypeNameAndValue(type, QVariant::fromValue(Enumeration(enumerationName)));
}
QDebug operator<<(QDebug debug, const VariantProperty &VariantProperty)
diff --git a/src/plugins/qmldesigner/settingspage.cpp b/src/plugins/qmldesigner/settingspage.cpp
index 3cf0e6cc0e..4b25f9f207 100644
--- a/src/plugins/qmldesigner/settingspage.cpp
+++ b/src/plugins/qmldesigner/settingspage.cpp
@@ -73,18 +73,6 @@ void SettingsPageWidget::setSettings(const DesignerSettings &designerSettings)
m_ui.designerEnableDebuggerCheckBox->setChecked(designerSettings.enableDebugView);
}
-QString SettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc)
- << ' ' << m_ui.snapMarginLabel->text()
- << ' ' << m_ui.itemSpacingLabel->text()
- << ' ' << m_ui.canvasWidthLabel->text()
- << ' ' << m_ui.canvasHeightLabel->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void SettingsPageWidget::debugViewEnabledToggled(bool b)
{
if (b && ! m_ui.designerShowDebuggerCheckBox->isChecked())
@@ -102,12 +90,12 @@ SettingsPage::SettingsPage() :
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_QML_ICON));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
- m_widget->setSettings(QmlDesignerPlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsPageWidget;
+ m_widget->setSettings(QmlDesignerPlugin::instance()->settings());
+ }
return m_widget;
}
@@ -118,7 +106,7 @@ void SettingsPage::apply()
QmlDesignerPlugin::instance()->setSettings(m_widget->settings());
}
-bool SettingsPage::matches(const QString &s) const
+void SettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/qmldesigner/settingspage.h b/src/plugins/qmldesigner/settingspage.h
index 78a143a068..2dc8417725 100644
--- a/src/plugins/qmldesigner/settingspage.h
+++ b/src/plugins/qmldesigner/settingspage.h
@@ -35,6 +35,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
#include <QWidget>
QT_BEGIN_NAMESPACE
@@ -57,8 +58,6 @@ public:
DesignerSettings settings() const;
void setSettings(const DesignerSettings &designerSettings);
- QString searchKeywords() const;
-
public slots:
void debugViewEnabledToggled(bool b);
@@ -74,14 +73,12 @@ class SettingsPage : public Core::IOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
- SettingsPageWidget* m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/qmldesigner/settingspage.ui b/src/plugins/qmldesigner/settingspage.ui
index 124950c424..528f621d13 100644
--- a/src/plugins/qmldesigner/settingspage.ui
+++ b/src/plugins/qmldesigner/settingspage.ui
@@ -58,7 +58,7 @@
<item row="0" column="1">
<widget class="QCheckBox" name="designerWarningsCheckBox">
<property name="toolTip">
- <string>Warn about QML features which are not properly supported by the Qt Quick Designer</string>
+ <string>Warns about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features in the Qt Quick Designer</string>
@@ -68,7 +68,7 @@
<item row="1" column="1">
<widget class="QCheckBox" name="designerWarningsInEditorCheckBox">
<property name="toolTip">
- <string>Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer</string>
+ <string>Also warns in the code editor about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features of Qt Quick Designer in the code editor</string>
diff --git a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp
index ebd55d1712..4158a6819f 100644
--- a/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentnamedialog.cpp
@@ -66,6 +66,7 @@ void ComponentNameDialog::go(QString *proposedName,
d.ui->componentNameEdit->setForceFirstCapitalLetter(true);
d.ui->componentNameEdit->setText(*proposedName);
d.ui->pathEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ d.ui->pathEdit->setHistoryCompleter(QLatin1String("QmlJs.Component.History"));
d.ui->pathEdit->setPath(*proposedPath);
if (QDialog::Accepted == d.exec()) {
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index dc0b419a0a..d038aa2eb9 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -46,6 +46,7 @@
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljsutils.h>
+#include <qmljstools/qmljstoolsconstants.h>
#include <qmljstools/qmljsindenter.h>
#include <qmljstools/qmljsqtstylecodeformatter.h>
@@ -466,6 +467,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) :
setCodeFoldingSupported(true);
setIndenter(new Indenter);
setAutoCompleter(new AutoCompleter);
+ setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
m_updateDocumentTimer = new QTimer(this);
m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
@@ -583,7 +585,7 @@ IEditor *QmlJSEditor::duplicate(QWidget *parent)
{
QmlJSTextEditorWidget *newEditor = new QmlJSTextEditorWidget(parent);
newEditor->duplicateFrom(editorWidget());
- QmlJSEditorPlugin::instance()->initializeEditor(newEditor);
+ TextEditor::TextEditorSettings::initializeEditor(newEditor);
return newEditor->editor();
}
@@ -608,7 +610,7 @@ void QmlJSTextEditorWidget::reparseDocumentNow()
{
m_updateDocumentTimer->stop();
- const QString fileName = editorDocument()->filePath();
+ const QString fileName = baseTextDocument()->filePath();
m_modelManager->updateSourceFiles(QStringList() << fileName, false);
}
@@ -650,7 +652,7 @@ static void appendExtraSelectionsForMessages(
void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
{
- if (editorDocument()->filePath() != doc->fileName())
+ if (baseTextDocument()->filePath() != doc->fileName())
return;
if (doc->editorRevision() != editorRevision()) {
@@ -682,7 +684,7 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc)
void QmlJSTextEditorWidget::modificationChanged(bool changed)
{
if (!changed && m_modelManager)
- m_modelManager->fileChangedOnDisk(editorDocument()->filePath());
+ m_modelManager->fileChangedOnDisk(baseTextDocument()->filePath());
}
void QmlJSTextEditorWidget::jumpToOutlineElement(int /*index*/)
@@ -973,10 +975,6 @@ void QmlJSTextEditorWidget::setSelectedElements()
emit selectedElementsChanged(offsets, wordAtCursor);
}
-void QmlJSTextEditorWidget::updateFileName()
-{
-}
-
void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditorWidget::setFontSettings(fs);
@@ -1058,8 +1056,6 @@ void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
connect(m_outlineCombo, SIGNAL(activated(int)), this, SLOT(jumpToOutlineElement(int)));
connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
- connect(editorDocument(), SIGNAL(changed()), this, SLOT(updateFileName()));
-
editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
}
@@ -1148,12 +1144,12 @@ TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const Q
void QmlJSTextEditorWidget::findUsages()
{
- m_findReferences->findUsages(editorDocument()->filePath(), textCursor().position());
+ m_findReferences->findUsages(baseTextDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::renameUsages()
{
- m_findReferences->renameUsages(editorDocument()->filePath(), textCursor().position());
+ m_findReferences->renameUsages(baseTextDocument()->filePath(), textCursor().position());
}
void QmlJSTextEditorWidget::showContextPane()
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index 5ce152d3d3..e91087506b 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -142,7 +142,6 @@ private slots:
void updateOutlineIndexNow();
void updateCursorPositionNow();
void showTextMarker();
- void updateFileName();
void updateUses();
void updateUsesNow();
diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp
index 4a2efa6053..5909fde6e7 100644
--- a/src/plugins/qmljseditor/qmljseditorfactory.cpp
+++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp
@@ -34,6 +34,8 @@
#include "qmljseditorplugin.h"
#include <qmljstools/qmljstoolsconstants.h>
+#include <texteditor/texteditoractionhandler.h>
+#include <texteditor/texteditorsettings.h>
#include <QCoreApplication>
@@ -52,12 +54,18 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
+ new TextEditor::TextEditorActionHandler(this, Constants::C_QMLJSEDITOR_ID,
+ TextEditor::TextEditorActionHandler::Format
+ | TextEditor::TextEditorActionHandler::UnCommentSelection
+ | TextEditor::TextEditorActionHandler::UnCollapseAll
+ | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
+
}
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
{
QmlJSTextEditorWidget *rc = new QmlJSTextEditorWidget(parent);
- QmlJSEditorPlugin::instance()->initializeEditor(rc);
+ TextEditor::TextEditorSettings::initializeEditor(rc);
return rc->editor();
}
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp
index 0bc0ffdba0..27e1468b69 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.cpp
+++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp
@@ -62,9 +62,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/texteditorconstants.h>
-#include <texteditor/texteditorsettings.h>
#include <texteditor/textfilewizard.h>
-#include <texteditor/texteditoractionhandler.h>
#include <utils/qtcassert.h>
#include <utils/json.h>
@@ -95,7 +93,6 @@ QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0;
QmlJSEditorPlugin::QmlJSEditorPlugin() :
m_modelManager(0),
m_editor(0),
- m_actionHandler(0),
m_quickFixAssistProvider(0),
m_reformatFileAction(0),
m_currentEditor(0),
@@ -109,7 +106,6 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() :
QmlJSEditorPlugin::~QmlJSEditorPlugin()
{
removeObject(m_editor);
- delete m_actionHandler;
m_instance = 0;
}
@@ -165,13 +161,6 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
wizard->setId(QLatin1String("Z.Js"));
addAutoReleasedObject(wizard);
- m_actionHandler = new TextEditor::TextEditorActionHandler(Constants::C_QMLJSEDITOR_ID,
- TextEditor::TextEditorActionHandler::Format
- | TextEditor::TextEditorActionHandler::UnCommentSelection
- | TextEditor::TextEditorActionHandler::UnCollapseAll
- | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
- m_actionHandler->initializeActions();
-
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT);
Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
@@ -262,16 +251,6 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSEditorPlugin::aboutToShutdown()
return IPlugin::aboutToShutdown();
}
-void QmlJSEditorPlugin::initializeEditor(QmlJSTextEditorWidget *editor)
-{
- QTC_CHECK(m_instance);
-
- m_actionHandler->setupActions(editor);
-
- editor->setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
- TextEditor::TextEditorSettings::initializeEditor(editor);
-}
-
Utils::JsonSchemaManager *QmlJSEditorPlugin::jsonManager() const
{
return m_jsonManager.data();
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h
index 45f2240123..b75230d940 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.h
+++ b/src/plugins/qmljseditor/qmljseditorplugin.h
@@ -42,10 +42,6 @@ namespace Utils {
class JsonSchemaManager;
}
-namespace TextEditor {
-class TextEditorActionHandler;
-} // namespace TextEditor
-
namespace Core {
class Command;
class ActionContainer;
@@ -92,8 +88,6 @@ public:
QmlJSQuickFixAssistProvider *quickFixAssistProvider() const;
- void initializeEditor(QmlJSTextEditorWidget *editor);
-
Utils::JsonSchemaManager *jsonManager() const;
public Q_SLOTS:
@@ -115,7 +109,6 @@ private:
QmlJS::ModelManagerInterface *m_modelManager;
QmlJSEditorFactory *m_editor;
- TextEditor::TextEditorActionHandler *m_actionHandler;
QmlJSQuickFixAssistProvider *m_quickFixAssistProvider;
QmlTaskManager *m_qmlTaskManager;
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
index 29a1a86185..ff3db87373 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
@@ -48,7 +48,7 @@ using namespace Internal;
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(),
- editor->editorDocument()->filePath(), reason)
+ editor->baseTextDocument()->filePath(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(m_editor, m_semanticInfo.document))
diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
index ffafb7a8fe..5ed7cc50b3 100644
--- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
@@ -568,7 +568,7 @@ void SemanticHighlighter::applyResults(int from, int to)
if (m_startRevision != m_editor->editorRevision())
return;
- TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
+ TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
QTC_ASSERT(baseTextDocument, return);
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
QTC_ASSERT(highlighter, return);
@@ -584,7 +584,7 @@ void SemanticHighlighter::finished()
if (m_startRevision != m_editor->editorRevision())
return;
- TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument().data();
+ TextEditor::BaseTextDocument *baseTextDocument = m_editor->baseTextDocument();
QTC_ASSERT(baseTextDocument, return);
TextEditor::SyntaxHighlighter *highlighter = qobject_cast<TextEditor::SyntaxHighlighter *>(baseTextDocument->syntaxHighlighter());
QTC_ASSERT(highlighter, return);
diff --git a/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp b/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp
index 59d0b858ea..c79be8a96f 100644
--- a/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp
+++ b/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp
@@ -101,16 +101,6 @@ void QuickToolBarSettingsPageWidget::setSettings(const QuickToolBarSettings &s)
m_ui.textEditHelperCheckBoxPin->setChecked(s.pinContextPane);
}
-QString QuickToolBarSettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QTextStream(&rc)
- << ' ' << m_ui.textEditHelperCheckBox->text()
- << ' ' << m_ui.textEditHelperCheckBoxPin->text();
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
QuickToolBarSettings QuickToolBarSettings::get()
{
QuickToolBarSettings settings;
@@ -129,12 +119,12 @@ QuickToolBarSettingsPage::QuickToolBarSettingsPage() :
setCategoryIcon(QLatin1String(QmlDesigner::Constants::SETTINGS_CATEGORY_QML_ICON));
}
-QWidget *QuickToolBarSettingsPage::createPage(QWidget *parent)
+QWidget *QuickToolBarSettingsPage::widget()
{
- m_widget = new QuickToolBarSettingsPageWidget(parent);
- m_widget->setSettings(QuickToolBarSettings::get());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new QuickToolBarSettingsPageWidget;
+ m_widget->setSettings(QuickToolBarSettings::get());
+ }
return m_widget;
}
@@ -145,7 +135,7 @@ void QuickToolBarSettingsPage::apply()
m_widget->settings().set();
}
-bool QuickToolBarSettingsPage::matches(const QString &s) const
+void QuickToolBarSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/qmljseditor/quicktoolbarsettingspage.h b/src/plugins/qmljseditor/quicktoolbarsettingspage.h
index db5ca870e9..059b916e58 100644
--- a/src/plugins/qmljseditor/quicktoolbarsettingspage.h
+++ b/src/plugins/qmljseditor/quicktoolbarsettingspage.h
@@ -33,6 +33,7 @@
#include "ui_quicktoolbarsettingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
#include <QWidget>
QT_BEGIN_NAMESPACE
@@ -76,7 +77,6 @@ public:
QuickToolBarSettings settings() const;
void setSettings(const QuickToolBarSettings &);
- QString searchKeywords() const;
static QuickToolBarSettings get();
private:
@@ -91,14 +91,12 @@ class QuickToolBarSettingsPage : public Core::IOptionsPage
public:
QuickToolBarSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
- QuickToolBarSettingsPageWidget* m_widget;
+ QPointer<QuickToolBarSettingsPageWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
index b0dcc8a60d..1ba76f43c7 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
@@ -95,17 +95,6 @@ void QmlJSCodeStylePreferencesWidget::setPreferences(TextEditor::ICodeStylePrefe
}
-QString QmlJSCodeStylePreferencesWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui->tabPreferencesWidget->searchKeywords()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSettings &fontSettings)
{
const ISnippetProvider *provider = 0;
@@ -171,18 +160,19 @@ QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage(/*QSharedPointer<CppFileS
setCategoryIcon(QLatin1String(QmlDesigner::Constants::SETTINGS_CATEGORY_QML_ICON));
}
-QWidget *QmlJSCodeStyleSettingsPage::createPage(QWidget *parent)
+QWidget *QmlJSCodeStyleSettingsPage::widget()
{
- TextEditor::SimpleCodeStylePreferences *originalTabPreferences
- = QmlJSToolsSettings::globalCodeStyle();
- m_pageTabPreferences = new TextEditor::SimpleCodeStylePreferences(m_widget);
- m_pageTabPreferences->setDelegatingPool(originalTabPreferences->delegatingPool());
- m_pageTabPreferences->setTabSettings(originalTabPreferences->tabSettings());
- m_pageTabPreferences->setCurrentDelegate(originalTabPreferences->currentDelegate());
- m_pageTabPreferences->setId(originalTabPreferences->id());
- m_widget = new CodeStyleEditor(TextEditorSettings::codeStyleFactory(QmlJSTools::Constants::QML_JS_SETTINGS_ID),
- m_pageTabPreferences, parent);
-
+ if (!m_widget) {
+ TextEditor::SimpleCodeStylePreferences *originalTabPreferences
+ = QmlJSToolsSettings::globalCodeStyle();
+ m_pageTabPreferences = new TextEditor::SimpleCodeStylePreferences(m_widget);
+ m_pageTabPreferences->setDelegatingPool(originalTabPreferences->delegatingPool());
+ m_pageTabPreferences->setTabSettings(originalTabPreferences->tabSettings());
+ m_pageTabPreferences->setCurrentDelegate(originalTabPreferences->currentDelegate());
+ m_pageTabPreferences->setId(originalTabPreferences->id());
+ m_widget = new CodeStyleEditor(TextEditorSettings::codeStyleFactory(QmlJSTools::Constants::QML_JS_SETTINGS_ID),
+ m_pageTabPreferences);
+ }
return m_widget;
}
@@ -203,9 +193,9 @@ void QmlJSCodeStyleSettingsPage::apply()
}
}
-bool QmlJSCodeStyleSettingsPage::matches(const QString &s) const
+void QmlJSCodeStyleSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.h b/src/plugins/qmljstools/qmljscodestylesettingspage.h
index 7f95bd654a..53b78e9cb2 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.h
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.h
@@ -61,7 +61,6 @@ public:
~QmlJSCodeStylePreferencesWidget();
void setPreferences(TextEditor::ICodeStylePreferences *preferences);
- QString searchKeywords() const;
private slots:
void decorateEditor(const TextEditor::FontSettings &fontSettings);
@@ -82,13 +81,11 @@ class QmlJSCodeStyleSettingsPage : public Core::IOptionsPage
public:
explicit QmlJSCodeStyleSettingsPage(QWidget *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
TextEditor::ICodeStylePreferences *m_pageTabPreferences;
QPointer<TextEditor::CodeStyleEditor> m_widget;
};
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index 2c7469d1f4..36324371c4 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -329,7 +329,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const
if (TextEditor::BaseTextDocument *textDocument = qobject_cast<TextEditor::BaseTextDocument *>(document)) {
// TODO the language should be a property on the document, not the editor
if (documentModel->editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS))
- workingCopy.insert(key, textDocument->contents(), textDocument->document()->revision());
+ workingCopy.insert(key, textDocument->plainText(), textDocument->document()->revision());
}
}
diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
index 6df98dbbd6..35b59e2172 100644
--- a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
+++ b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
@@ -41,7 +41,6 @@ void AbstractTimelineModel::setModelManager(QmlProfilerModelManager *modelManage
{
m_modelManager = modelManager;
connect(modelManager->simpleModel(),SIGNAL(changed()),this,SLOT(dataChanged()));
- connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
m_modelId = modelManager->registerModelProxy();
}
@@ -79,5 +78,24 @@ int AbstractTimelineModel::getBindingLoopDest(int index) const
return -1;
}
+void AbstractTimelineModel::dataChanged()
+{
+ switch (m_modelManager->state()) {
+ case QmlProfilerDataState::ProcessingData:
+ loadData();
+ break;
+ case QmlProfilerDataState::ClearingData:
+ clear();
+ break;
+ default:
+ break;
+ }
+
+ emit stateChanged();
+ emit dataAvailable();
+ emit emptyChanged();
+ emit expandedChanged();
+}
+
}
diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.h b/src/plugins/qmlprofiler/abstracttimelinemodel.h
index 0efcd60631..8ee6c51eba 100644
--- a/src/plugins/qmlprofiler/abstracttimelinemodel.h
+++ b/src/plugins/qmlprofiler/abstracttimelinemodel.h
@@ -79,6 +79,10 @@ public:
virtual int getEventType(int index) const = 0;
virtual int getEventCategory(int index) const = 0;
virtual int getEventRow(int index) const = 0;
+
+ virtual void loadData() = 0;
+ virtual void clear() = 0;
+
Q_INVOKABLE virtual qint64 getDuration(int index) const = 0;
Q_INVOKABLE virtual qint64 getStartTime(int index) const = 0;
Q_INVOKABLE virtual qint64 getEndTime(int index) const = 0;
@@ -106,6 +110,9 @@ signals:
protected:
QmlProfilerModelManager *m_modelManager;
int m_modelId;
+
+protected slots:
+ void dataChanged();
};
}
diff --git a/src/plugins/qmlprofiler/canvas/canvas.pri b/src/plugins/qmlprofiler/canvas/canvas.pri
deleted file mode 100644
index 2960e94527..0000000000
--- a/src/plugins/qmlprofiler/canvas/canvas.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-HEADERS += $$PWD/qdeclarativecontext2d_p.h \
- $$PWD/qdeclarativecanvas_p.h \
- $$PWD/qmlprofilercanvas.h \
- $$PWD/qdeclarativecanvastimer_p.h
-
-SOURCES += $$PWD/qdeclarativecontext2d.cpp \
- $$PWD/qdeclarativecanvas.cpp \
- $$PWD/qmlprofilercanvas.cpp \
- $$PWD/qdeclarativecanvastimer.cpp
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
deleted file mode 100644
index 4611d7096b..0000000000
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "qdeclarativecanvas_p.h"
-#include "qdeclarativecanvastimer_p.h"
-#include "qdeclarativecontext2d_p.h"
-
-#include <qpainter.h>
-
-QT_BEGIN_NAMESPACE
-
-Canvas::Canvas(QQuickPaintedItem *parent)
- : QQuickPaintedItem(parent),
- m_context(new Context2D(this)),
- m_canvasWidth(0),
- m_canvasHeight(0),
- m_fillMode(Canvas::Stretch),
- m_color(Qt::white)
-{
-}
-
-
-void Canvas::componentComplete()
-{
- if (m_canvasWidth == 0 && m_canvasHeight == 0)
- m_context->setSize(width(), height());
- else
- m_context->setSize(m_canvasWidth, m_canvasHeight);
-
- connect(m_context, SIGNAL(changed()), this, SLOT(requestPaint()));
- emit init();
- QQuickItem::componentComplete();
-}
-
-void Canvas::paint(QPainter *painter)
-{
- m_context->setInPaint(true);
- emit paint();
-
- bool oldAA = painter->testRenderHint(QPainter::Antialiasing);
- bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform);
- if (smooth())
- painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, smooth());
-
- if (m_context->pixmap().isNull()) {
- painter->fillRect(0, 0, width(), height(), m_color);
- } else if (width() != m_context->pixmap().width() || height() != m_context->pixmap().height()) {
- if (m_fillMode>= Tile) {
- if (m_fillMode== Tile) {
- painter->drawTiledPixmap(QRectF(0,0,width(),height()), m_context->pixmap());
- } else {
- qreal widthScale = width() / qreal(m_context->pixmap().width());
- qreal heightScale = height() / qreal(m_context->pixmap().height());
-
- QTransform scale;
- if (m_fillMode== TileVertically) {
- scale.scale(widthScale, 1.0);
- QTransform old = painter->transform();
- painter->setWorldTransform(scale * old);
- painter->drawTiledPixmap(QRectF(0,0,m_context->pixmap().width(),height()), m_context->pixmap());
- painter->setWorldTransform(old);
- } else {
- scale.scale(1.0, heightScale);
- QTransform old = painter->transform();
- painter->setWorldTransform(scale * old);
- painter->drawTiledPixmap(QRectF(0,0,width(),m_context->pixmap().height()), m_context->pixmap());
- painter->setWorldTransform(old);
- }
- }
- } else {
- qreal widthScale = width() / qreal(m_context->pixmap().width());
- qreal heightScale = height() / qreal(m_context->pixmap().height());
-
- QTransform scale;
-
- if (m_fillMode== PreserveAspectFit) {
- if (widthScale <= heightScale) {
- heightScale = widthScale;
- scale.translate(0, (height() - heightScale * m_context->pixmap().height()) / 2);
- } else if (heightScale < widthScale) {
- widthScale = heightScale;
- scale.translate((width() - widthScale * m_context->pixmap().width()) / 2, 0);
- }
- } else if (m_fillMode== PreserveAspectCrop) {
- if (widthScale < heightScale) {
- widthScale = heightScale;
- scale.translate((width() - widthScale * m_context->pixmap().width()) / 2, 0);
- } else if (heightScale < widthScale) {
- heightScale = widthScale;
- scale.translate(0, (height() - heightScale * m_context->pixmap().height()) / 2);
- }
- }
- if (clip()) {
- painter->save();
- painter->setClipRect(boundingRect(), Qt::IntersectClip);
- }
- scale.scale(widthScale, heightScale);
- QTransform old = painter->transform();
- painter->setWorldTransform(scale * old);
- painter->drawPixmap(0, 0, m_context->pixmap());
- painter->setWorldTransform(old);
- if (clip())
- painter->restore();
- }
- } else {
- painter->drawPixmap(0, 0, m_context->pixmap());
- }
-
- if (smooth()) {
- painter->setRenderHint(QPainter::Antialiasing, oldAA);
- painter->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth);
- }
- m_context->setInPaint(false);
-}
-
-Context2D *Canvas::getContext(const QString &contextId)
-{
- if (contextId == QLatin1String("2d"))
- return m_context;
- qDebug("Canvas:requesting unsupported context");
- return 0;
-}
-
-void Canvas::requestPaint()
-{
- update();
-}
-
-void Canvas::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- if (m_canvasWidth == 0 && m_canvasHeight == 0
- && newGeometry.width() > 0 && newGeometry.height() > 0) {
- m_context->setSize(width(), height());
- }
- QQuickItem::geometryChanged(newGeometry, oldGeometry);
-}
-
-void Canvas::setCanvasWidth(int newWidth)
-{
- if (m_canvasWidth != newWidth) {
- m_canvasWidth = newWidth;
- m_context->setSize(m_canvasWidth, m_canvasHeight);
- emit canvasWidthChanged();
- }
-}
-
-void Canvas::setCanvasHeight(int newHeight)
-{
- if (m_canvasHeight != newHeight) {
- m_canvasHeight = newHeight;
- m_context->setSize(m_canvasWidth, m_canvasHeight);
- emit canvasHeightChanged();
- }
-}
-
-void Canvas::setFillMode(FillMode mode)
-{
- if (m_fillMode == mode)
- return;
-
- m_fillMode = mode;
- update();
- emit fillModeChanged();
-}
-
-QColor Canvas::color()
-{
- return m_color;
-}
-
-void Canvas::setColor(const QColor &color)
-{
- if (m_color !=color) {
- m_color = color;
- colorChanged();
- }
-}
-
-Canvas::FillMode Canvas::fillMode() const
-{
- return m_fillMode;
-}
-
-bool Canvas::save(const QString &filename) const
-{
- return m_context->pixmap().save(filename);
-}
-
-CanvasImage *Canvas::toImage() const
-{
- return new CanvasImage(m_context->pixmap());
-}
-
-void Canvas::setTimeout(const QJSValue &handler, long timeout)
-{
- if (handler.isCallable())
- CanvasTimer::createTimer(this, handler, timeout, true);
-}
-
-void Canvas::setInterval(const QJSValue &handler, long interval)
-{
- if (handler.isCallable())
- CanvasTimer::createTimer(this, handler, interval, false);
-}
-
-void Canvas::clearTimeout(const QJSValue &handler)
-{
- CanvasTimer::removeTimer(handler);
-}
-
-void Canvas::clearInterval(const QJSValue &handler)
-{
- CanvasTimer::removeTimer(handler);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
deleted file mode 100644
index 3f4fd8b0dd..0000000000
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECANVAS_P_H
-#define QDECLARATIVECANVAS_P_H
-
-#include <QQuickPaintedItem>
-
-#include "qdeclarativecontext2d_p.h"
-#include "qdeclarativecanvastimer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class Canvas : public QQuickPaintedItem
-{
- Q_OBJECT
-
- Q_ENUMS(FillMode)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged);
- Q_PROPERTY(int canvasWidth READ canvasWidth WRITE setCanvasWidth NOTIFY canvasWidthChanged);
- Q_PROPERTY(int canvasHeight READ canvasHeight WRITE setCanvasHeight NOTIFY canvasHeightChanged);
- Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
-
-public:
- Canvas(QQuickPaintedItem *parent = 0);
- enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally };
-
-
- void paint(QPainter *);
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- void setCanvasWidth(int newWidth);
- int canvasWidth() {return m_canvasWidth;}
-
- void setCanvasHeight(int canvasHeight);
- int canvasHeight() {return m_canvasHeight;}
-
- void componentComplete();
-
-
-public Q_SLOTS:
- Context2D *getContext(const QString & = QLatin1String("2d"));
- void requestPaint();
-
- FillMode fillMode() const;
- void setFillMode(FillMode);
-
- QColor color();
- void setColor(const QColor &);
-
- // Save current canvas to disk
- bool save(const QString& filename) const;
-
- // Timers
- void setInterval(const QJSValue &handler, long timeout);
- void setTimeout(const QJSValue &handler, long timeout);
- void clearInterval(const QJSValue &handler);
- void clearTimeout(const QJSValue &handler);
-
-Q_SIGNALS:
- void fillModeChanged();
- void canvasWidthChanged();
- void canvasHeightChanged();
- void colorChanged();
- void init();
- void paint();
-
-private:
- // Return canvas contents as a drawable image
- CanvasImage *toImage() const;
- Context2D *m_context;
- int m_canvasWidth;
- int m_canvasHeight;
- FillMode m_fillMode;
- QColor m_color;
-
- friend class Context2D;
-};
-
-QT_END_NAMESPACE
-
-#endif //QDECLARATIVECANVAS_P_H
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
deleted file mode 100644
index f006657bfc..0000000000
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
+++ /dev/null
@@ -1,1134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "qdeclarativecontext2d_p.h"
-
-#include "qdeclarativecanvas_p.h"
-
-#include <qdebug.h>
-#include <math.h>
-
-#include <qgraphicsitem.h>
-#include <qapplication.h>
-#include <qgraphicseffect.h>
-
-#include <QImage>
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-
-static const double Q_PI = 3.14159265358979323846; // pi
-
-class CustomDropShadowEffect : public QGraphicsDropShadowEffect
-{
-public:
- void draw(QPainter *painter) { QGraphicsDropShadowEffect::draw(painter);}
- void drawSource(QPainter *painter) { QGraphicsDropShadowEffect::drawSource(painter);}
-};
-
-// Note, this is exported but in a private header as qtopengl depends on it.
-// But it really should be considered private API
-void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0);
-void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
-
-#define DEGREES(t) ((t) * 180.0 / Q_PI)
-
-#define qClamp(val, min, max) qMin(qMax(val, min), max)
-static QList<qreal> parseNumbersList(QString::const_iterator &itr)
-{
- QList<qreal> points;
- QString temp;
- while ((*itr).isSpace())
- ++itr;
- while ((*itr).isNumber() ||
- (*itr) == QLatin1Char('-') || (*itr) == QLatin1Char('+') || (*itr) == QLatin1Char('.')) {
- temp.clear();
-
- if ((*itr) == QLatin1Char('-'))
- temp += *itr++;
- else if ((*itr) == QLatin1Char('+'))
- temp += *itr++;
- while ((*itr).isDigit())
- temp += *itr++;
- if ((*itr) == QLatin1Char('.'))
- temp += *itr++;
- while ((*itr).isDigit())
- temp += *itr++;
- while ((*itr).isSpace())
- ++itr;
- if ((*itr) == QLatin1Char(','))
- ++itr;
- points.append(temp.toDouble());
- //eat spaces
- while ((*itr).isSpace())
- ++itr;
- }
-
- return points;
-}
-
-QColor colorFromString(const QString &name)
-{
- QString::const_iterator itr = name.constBegin();
- QList<qreal> compo;
- if (name.startsWith(QLatin1String("rgba("))) {
- ++itr; ++itr; ++itr; ++itr; ++itr;
- compo = parseNumbersList(itr);
- if (compo.size() != 4)
- return QColor();
- //alpha seems to be always between 0-1
- compo[3] *= 255;
- return QColor((int)compo[0], (int)compo[1],
- (int)compo[2], (int)compo[3]);
- } else if (name.startsWith(QLatin1String("rgb("))) {
- ++itr; ++itr; ++itr; ++itr;
- compo = parseNumbersList(itr);
- if (compo.size() != 3)
- return QColor();
- return QColor((int)qClamp(compo[0], qreal(0), qreal(255)),
- (int)qClamp(compo[1], qreal(0), qreal(255)),
- (int)qClamp(compo[2], qreal(0), qreal(255)));
- } else if (name.startsWith(QLatin1String("hsla("))) {
- ++itr; ++itr; ++itr; ++itr; ++itr;
- compo = parseNumbersList(itr);
- if (compo.size() != 4)
- return QColor();
- return QColor::fromHslF(compo[0], compo[1],
- compo[2], compo[3]);
- } else if (name.startsWith(QLatin1String("hsl("))) {
- ++itr; ++itr; ++itr; ++itr; ++itr;
- compo = parseNumbersList(itr);
- if (compo.size() != 3)
- return QColor();
- return QColor::fromHslF(compo[0], compo[1],
- compo[2]);
- } else {
- //QRgb color;
- //CSSParser::parseColor(name, color);
- return QColor(name);
- }
-}
-
-
-static QPainter::CompositionMode compositeOperatorFromString(const QString &compositeOperator)
-{
- if (compositeOperator == QLatin1String("source-over"))
- return QPainter::CompositionMode_SourceOver;
- else if (compositeOperator == QLatin1String("source-out"))
- return QPainter::CompositionMode_SourceOut;
- else if (compositeOperator == QLatin1String("source-in"))
- return QPainter::CompositionMode_SourceIn;
- else if (compositeOperator == QLatin1String("source-atop"))
- return QPainter::CompositionMode_SourceAtop;
- else if (compositeOperator == QLatin1String("destination-atop"))
- return QPainter::CompositionMode_DestinationAtop;
- else if (compositeOperator == QLatin1String("destination-in"))
- return QPainter::CompositionMode_DestinationIn;
- else if (compositeOperator == QLatin1String("destination-out"))
- return QPainter::CompositionMode_DestinationOut;
- else if (compositeOperator == QLatin1String("destination-over"))
- return QPainter::CompositionMode_DestinationOver;
- else if (compositeOperator == QLatin1String("darker"))
- return QPainter::CompositionMode_SourceOver;
- else if (compositeOperator == QLatin1String("lighter"))
- return QPainter::CompositionMode_SourceOver;
- else if (compositeOperator == QLatin1String("copy"))
- return QPainter::CompositionMode_Source;
- else if (compositeOperator == QLatin1String("xor"))
- return QPainter::CompositionMode_Xor;
-
- return QPainter::CompositionMode_SourceOver;
-}
-
-static QString compositeOperatorToString(QPainter::CompositionMode op)
-{
- switch (op) {
- case QPainter::CompositionMode_SourceOver:
- return QLatin1String("source-over");
- case QPainter::CompositionMode_DestinationOver:
- return QLatin1String("destination-over");
- case QPainter::CompositionMode_Clear:
- return QLatin1String("clear");
- case QPainter::CompositionMode_Source:
- return QLatin1String("source");
- case QPainter::CompositionMode_Destination:
- return QLatin1String("destination");
- case QPainter::CompositionMode_SourceIn:
- return QLatin1String("source-in");
- case QPainter::CompositionMode_DestinationIn:
- return QLatin1String("destination-in");
- case QPainter::CompositionMode_SourceOut:
- return QLatin1String("source-out");
- case QPainter::CompositionMode_DestinationOut:
- return QLatin1String("destination-out");
- case QPainter::CompositionMode_SourceAtop:
- return QLatin1String("source-atop");
- case QPainter::CompositionMode_DestinationAtop:
- return QLatin1String("destination-atop");
- case QPainter::CompositionMode_Xor:
- return QLatin1String("xor");
- case QPainter::CompositionMode_Plus:
- return QLatin1String("plus");
- case QPainter::CompositionMode_Multiply:
- return QLatin1String("multiply");
- case QPainter::CompositionMode_Screen:
- return QLatin1String("screen");
- case QPainter::CompositionMode_Overlay:
- return QLatin1String("overlay");
- case QPainter::CompositionMode_Darken:
- return QLatin1String("darken");
- case QPainter::CompositionMode_Lighten:
- return QLatin1String("lighten");
- case QPainter::CompositionMode_ColorDodge:
- return QLatin1String("color-dodge");
- case QPainter::CompositionMode_ColorBurn:
- return QLatin1String("color-burn");
- case QPainter::CompositionMode_HardLight:
- return QLatin1String("hard-light");
- case QPainter::CompositionMode_SoftLight:
- return QLatin1String("soft-light");
- case QPainter::CompositionMode_Difference:
- return QLatin1String("difference");
- case QPainter::CompositionMode_Exclusion:
- return QLatin1String("exclusion");
- default:
- break;
- }
- return QString();
-}
-
-void Context2D::save()
-{
- m_stateStack.push(m_state);
-}
-
-
-void Context2D::restore()
-{
- if (!m_stateStack.isEmpty()) {
- m_state = m_stateStack.pop();
- m_state.flags = AllIsFullOfDirt;
- }
-}
-
-
-void Context2D::scale(qreal x, qreal y)
-{
- m_state.matrix.scale(x, y);
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-
-void Context2D::rotate(qreal angle)
-{
- m_state.matrix.rotate(DEGREES(angle));
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-
-void Context2D::translate(qreal x, qreal y)
-{
- m_state.matrix.translate(x, y);
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-
-void Context2D::transform(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy)
-{
- QMatrix mat(m11, m12,
- m21, m22,
- dx, dy);
- m_state.matrix *= mat;
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-
-void Context2D::setTransform(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy)
-{
- QMatrix mat(m11, m12,
- m21, m22,
- dx, dy);
- m_state.matrix = mat;
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-
-QString Context2D::globalCompositeOperation() const
-{
- return compositeOperatorToString(m_state.globalCompositeOperation);
-}
-
-void Context2D::setGlobalCompositeOperation(const QString &op)
-{
- QPainter::CompositionMode mode =
- compositeOperatorFromString(op);
- m_state.globalCompositeOperation = mode;
- m_state.flags |= DirtyGlobalCompositeOperation;
-}
-
-QVariant Context2D::strokeStyle() const
-{
- return m_state.strokeStyle;
-}
-
-void Context2D::setStrokeStyle(const QVariant &style)
-{
- CanvasGradient * gradient= qobject_cast<CanvasGradient*>(style.value<QObject*>());
- if (gradient) {
- m_state.strokeStyle = gradient->value();
- } else {
- QColor color = colorFromString(style.toString());
- m_state.strokeStyle = color;
- }
- m_state.flags |= DirtyStrokeStyle;
-}
-
-QVariant Context2D::fillStyle() const
-{
- return m_state.fillStyle;
-}
-
-void Context2D::setFillStyle(const QVariant &style)
-{
- CanvasGradient * gradient= qobject_cast<CanvasGradient*>(style.value<QObject*>());
- if (gradient) {
- m_state.fillStyle = gradient->value();
- } else {
- QColor color = colorFromString(style.toString());
- m_state.fillStyle = color;
- }
- m_state.flags |= DirtyFillStyle;
-}
-
-qreal Context2D::globalAlpha() const
-{
- return m_state.globalAlpha;
-}
-
-void Context2D::setGlobalAlpha(qreal alpha)
-{
- m_state.globalAlpha = alpha;
- m_state.flags |= DirtyGlobalAlpha;
-}
-
-CanvasImage *Context2D::createImage(const QString &url)
-{
- return new CanvasImage(url);
-}
-
-CanvasGradient *Context2D::createLinearGradient(qreal x0, qreal y0,
- qreal x1, qreal y1)
-{
- QLinearGradient g(x0, y0, x1, y1);
- return new CanvasGradient(g);
-}
-
-
-CanvasGradient *Context2D::createRadialGradient(qreal x0, qreal y0,
- qreal r0, qreal x1,
- qreal y1, qreal r1)
-{
- QRadialGradient g(QPointF(x1, y1), r0+r1, QPointF(x0, y0));
- return new CanvasGradient(g);
-}
-
-qreal Context2D::lineWidth() const
-{
- return m_state.lineWidth;
-}
-
-void Context2D::setLineWidth(qreal w)
-{
- m_state.lineWidth = w;
- m_state.flags |= DirtyLineWidth;
-}
-
-QString Context2D::lineCap() const
-{
- switch (m_state.lineCap) {
- case Qt::FlatCap:
- return QLatin1String("butt");
- case Qt::SquareCap:
- return QLatin1String("square");
- case Qt::RoundCap:
- return QLatin1String("round");
- default: ;
- }
- return QString();
-}
-
-void Context2D::setLineCap(const QString &capString)
-{
- Qt::PenCapStyle style;
- if (capString == QLatin1String("round"))
- style = Qt::RoundCap;
- else if (capString == QLatin1String("square"))
- style = Qt::SquareCap;
- else //if (capString == QLatin1String("butt"))
- style = Qt::FlatCap;
- m_state.lineCap = style;
- m_state.flags |= DirtyLineCap;
-}
-
-QString Context2D::lineJoin() const
-{
- switch (m_state.lineJoin) {
- case Qt::RoundJoin:
- return QLatin1String("round");
- case Qt::BevelJoin:
- return QLatin1String("bevel");
- case Qt::MiterJoin:
- return QLatin1String("miter");
- default: ;
- }
- return QString();
-}
-
-void Context2D::setLineJoin(const QString &joinString)
-{
- Qt::PenJoinStyle style;
- if (joinString == QLatin1String("round"))
- style = Qt::RoundJoin;
- else if (joinString == QLatin1String("bevel"))
- style = Qt::BevelJoin;
- else //if (joinString == "miter")
- style = Qt::MiterJoin;
- m_state.lineJoin = style;
- m_state.flags |= DirtyLineJoin;
-}
-
-qreal Context2D::miterLimit() const
-{
- return m_state.miterLimit;
-}
-
-void Context2D::setMiterLimit(qreal m)
-{
- m_state.miterLimit = m;
- m_state.flags |= DirtyMiterLimit;
-}
-
-void Context2D::setShadowOffsetX(qreal x)
-{
- if (m_state.shadowOffsetX == x)
- return;
- m_state.shadowOffsetX = x;
- updateShadowBuffer();
- if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0)
- endPainting();
- m_state.flags |= DirtyShadowOffsetX;
-}
-
-const QList<Context2D::MouseArea> &Context2D::mouseAreas() const
-{
- return m_mouseAreas;
-}
-
-void Context2D::updateShadowBuffer() {
- if (m_shadowbuffer.isNull() || m_shadowbuffer.width() != m_width+m_state.shadowOffsetX ||
- m_shadowbuffer.height() != m_height+m_state.shadowOffsetY) {
- m_shadowbuffer = QImage(m_width+m_state.shadowOffsetX, m_height+m_state.shadowOffsetY, QImage::Format_ARGB32);
- m_shadowbuffer.fill(Qt::transparent);
- }
-}
-
-void Context2D::setShadowOffsetY(qreal y)
-{
- if (m_state.shadowOffsetY == y)
- return;
- m_state.shadowOffsetY = y;
- updateShadowBuffer();
- if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0)
- endPainting();
-
- m_state.flags |= DirtyShadowOffsetY;
-}
-
-void Context2D::setShadowBlur(qreal b)
-{
- if (m_state.shadowBlur == b)
- return;
- m_state.shadowBlur = b;
- updateShadowBuffer();
- if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0)
- endPainting();
- m_state.flags |= DirtyShadowBlur;
-}
-
-void Context2D::setShadowColor(const QString &str)
-{
- m_state.shadowColor = colorFromString(str);
- if (m_painter.device() == &m_shadowbuffer && m_state.shadowBlur>0)
- endPainting();
- m_state.flags |= DirtyShadowColor;
-}
-
-QString Context2D::textBaseline()
-{
- switch (m_state.textBaseline) {
- case Context2D::Alphabetic:
- return QLatin1String("alphabetic");
- case Context2D::Hanging:
- return QLatin1String("hanging");
- case Context2D::Bottom:
- return QLatin1String("bottom");
- case Context2D::Top:
- return QLatin1String("top");
- case Context2D::Middle:
- return QLatin1String("middle");
- default:
- Q_ASSERT("invalid value");
- return QLatin1String("start");
- }
-}
-
-void Context2D::setTextBaseline(const QString &baseline)
-{
- if (baseline==QLatin1String("alphabetic")) {
- m_state.textBaseline = Context2D::Alphabetic;
- } else if (baseline == QLatin1String("hanging")) {
- m_state.textBaseline = Context2D::Hanging;
- } else if (baseline == QLatin1String("top")) {
- m_state.textBaseline = Context2D::Top;
- } else if (baseline == QLatin1String("bottom")) {
- m_state.textBaseline = Context2D::Bottom;
- } else if (baseline == QLatin1String("middle")) {
- m_state.textBaseline = Context2D::Middle;
- } else {
- m_state.textBaseline = Context2D::Alphabetic;
- qWarning() << (QLatin1String("Context2D: invalid baseline:") + baseline);
- }
- m_state.flags |= DirtyTextBaseline;
-}
-
-QString Context2D::textAlign()
-{
- switch (m_state.textAlign) {
- case Context2D::Left:
- return QLatin1String("left");
- case Context2D::Right:
- return QLatin1String("right");
- case Context2D::Center:
- return QLatin1String("center");
- case Context2D::Start:
- return QLatin1String("start");
- case Context2D::End:
- return QLatin1String("end");
- default:
- Q_ASSERT("invalid value");
- qWarning() << ("Context2D::invalid textAlign");
- return QLatin1String("start");
- }
-}
-
-void Context2D::setTextAlign(const QString &baseline)
-{
- if (baseline==QLatin1String("start")) {
- m_state.textAlign = Context2D::Start;
- } else if (baseline == QLatin1String("end")) {
- m_state.textAlign = Context2D::End;
- } else if (baseline == QLatin1String("left")) {
- m_state.textAlign = Context2D::Left;
- } else if (baseline == QLatin1String("right")) {
- m_state.textAlign = Context2D::Right;
- } else if (baseline == QLatin1String("center")) {
- m_state.textAlign = Context2D::Center;
- } else {
- m_state.textAlign= Context2D::Start;
- qWarning("Context2D: invalid text align");
- }
- // ### alphabetic, ideographic, hanging
- m_state.flags |= DirtyTextBaseline;
-}
-
-void Context2D::setFont(const QString &fontString)
-{
- QFont font;
- // ### this is simplified and incomplete
- QStringList tokens = fontString.split(QLatin1Char(QLatin1Char(' ')));
- foreach (const QString &token, tokens) {
- if (token == QLatin1String("italic")) {
- font.setItalic(true);
- } else if (token == QLatin1String("bold")) {
- font.setBold(true);
- } else if (token.endsWith(QLatin1String("px"))) {
- QString number = token;
- number.remove(QLatin1String("px"));
-#ifdef Q_OS_MACX
- // compensating the extra antialias space with bigger fonts
- // this class is only used by the QML Profiler
- // not much harm can be inflicted by this dirty hack
- font.setPointSizeF(number.trimmed().toFloat()*4.0f/3.0f);
-#else
- font.setPointSizeF(number.trimmed().toFloat());
-#endif
- } else {
- font.setFamily(token);
- }
- }
- m_state.font = font;
- m_state.flags |= DirtyFont;
-}
-
-QString Context2D::font()
-{
- return m_state.font.toString();
-}
-
-qreal Context2D::shadowOffsetX() const
-{
- return m_state.shadowOffsetX;
-}
-
-qreal Context2D::shadowOffsetY() const
-{
- return m_state.shadowOffsetY;
-}
-
-
-qreal Context2D::shadowBlur() const
-{
- return m_state.shadowBlur;
-}
-
-
-QString Context2D::shadowColor() const
-{
- return m_state.shadowColor.name();
-}
-
-
-void Context2D::clearRect(qreal x, qreal y, qreal w, qreal h)
-{
- beginPainting();
- m_painter.save();
- m_painter.setMatrix(worldMatrix(), false);
- m_painter.setCompositionMode(QPainter::CompositionMode_Source);
- QColor fillColor = parent()->property("color").value<QColor>();
-
- m_painter.fillRect(QRectF(x, y, w, h), fillColor);
- m_painter.restore();
- scheduleChange();
-}
-
-void Context2D::fillRect(qreal x, qreal y, qreal w, qreal h)
-{
- beginPainting();
- m_painter.save();
- m_painter.setMatrix(worldMatrix(), false);
- m_painter.fillRect(QRectF(x, y, w, h), m_painter.brush());
- m_painter.restore();
- scheduleChange();
-}
-
-int Context2D::baseLineOffset(Context2D::TextBaseLine value, const QFontMetrics &metrics)
-{
- int offset = 0;
- switch (value) {
- case Context2D::Top:
- break;
- case Context2D::Alphabetic:
- case Context2D::Middle:
- case Context2D::Hanging:
- offset = metrics.ascent();
- break;
- case Context2D::Bottom:
- offset = metrics.height();
- break;
- }
- return offset;
-}
-
-int Context2D::textAlignOffset(Context2D::TextAlign value, const QFontMetrics &metrics, const QString &text)
-{
- int offset = 0;
- if (value == Context2D::Start)
- value = qApp->layoutDirection() == Qt::LeftToRight ? Context2D::Left : Context2D::Right;
- else if (value == Context2D::End)
- value = qApp->layoutDirection() == Qt::LeftToRight ? Context2D::Right: Context2D::Left;
- switch (value) {
- case Context2D::Center:
- offset = metrics.width(text)/2;
- break;
- case Context2D::Right:
- offset = metrics.width(text);
- case Context2D::Left:
- default:
- break;
- }
- return offset;
-}
-
-void Context2D::fillText(const QString &text, qreal x, qreal y)
-{
- beginPainting();
- m_painter.save();
- m_painter.setPen(QPen(m_state.fillStyle, m_state.lineWidth));
- m_painter.setMatrix(worldMatrix(), false);
- QFont font;
- font.setBold(true);
- m_painter.setFont(m_state.font);
- int yoffset = baseLineOffset(m_state.textBaseline, m_painter.fontMetrics());
- int xoffset = textAlignOffset(m_state.textAlign, m_painter.fontMetrics(), text);
- QTextOption opt; // Adjust baseLine etc
- m_painter.drawText(QRectF(x-xoffset, y-yoffset, QWIDGETSIZE_MAX, m_painter.fontMetrics().height()), text, opt);
- m_painter.restore();
- endPainting();
- scheduleChange();
-}
-
-void Context2D::strokeText(const QString &text, qreal x, qreal y)
-{
- beginPainting();
- m_painter.save();
- m_painter.setPen(QPen(m_state.fillStyle,0));
- m_painter.setMatrix(worldMatrix(), false);
-
- QPainterPath textPath;
- QFont font = m_state.font;
- font.setStyleStrategy(QFont::ForceOutline);
- m_painter.setFont(font);
- const QFontMetrics &metrics = m_painter.fontMetrics();
- int yoffset = baseLineOffset(m_state.textBaseline, metrics);
- int xoffset = textAlignOffset(m_state.textAlign, metrics, text);
- textPath.addText(x-xoffset, y-yoffset+metrics.ascent(), font, text);
- m_painter.strokePath(textPath, QPen(m_state.fillStyle, m_state.lineWidth));
- m_painter.restore();
- endPainting();
- scheduleChange();
-}
-
-void Context2D::strokeRect(qreal x, qreal y, qreal w, qreal h)
-{
- QPainterPath path;
- path.addRect(x, y, w, h);
- beginPainting();
- m_painter.save();
- m_painter.setMatrix(worldMatrix(), false);
- m_painter.strokePath(path, m_painter.pen());
- m_painter.restore();
- scheduleChange();
-}
-
-void Context2D::mouseArea(qreal x, qreal y, qreal w, qreal h, const QJSValue &callback,
- const QJSValue &data)
-{
- MouseArea a = { callback, data, QRectF(x, y, w, h), m_state.matrix };
- m_mouseAreas << a;
-}
-
-void Context2D::beginPath()
-{
- m_path = QPainterPath();
-}
-
-
-void Context2D::closePath()
-{
- m_path.closeSubpath();
-}
-
-
-void Context2D::moveTo(qreal x, qreal y)
-{
- QPointF pt = worldMatrix().map(QPointF(x, y));
- m_path.moveTo(pt);
-}
-
-
-void Context2D::lineTo(qreal x, qreal y)
-{
- QPointF pt = worldMatrix().map(QPointF(x, y));
- m_path.lineTo(pt);
-}
-
-
-void Context2D::quadraticCurveTo(qreal cpx, qreal cpy, qreal x, qreal y)
-{
- QPointF cp = worldMatrix().map(QPointF(cpx, cpy));
- QPointF xy = worldMatrix().map(QPointF(x, y));
- m_path.quadTo(cp, xy);
-}
-
-
-void Context2D::bezierCurveTo(qreal cp1x, qreal cp1y,
- qreal cp2x, qreal cp2y, qreal x, qreal y)
-{
- QPointF cp1 = worldMatrix().map(QPointF(cp1x, cp1y));
- QPointF cp2 = worldMatrix().map(QPointF(cp2x, cp2y));
- QPointF end = worldMatrix().map(QPointF(x, y));
- m_path.cubicTo(cp1, cp2, end);
-}
-
-
-void Context2D::arcTo(qreal x1, qreal y1, qreal x2, qreal y2, qreal radius)
-{
- //FIXME: this is surely busted
- QPointF st = worldMatrix().map(QPointF(x1, y1));
- QPointF end = worldMatrix().map(QPointF(x2, y2));
- m_path.arcTo(st.x(), st.y(),
- end.x()-st.x(), end.y()-st.y(),
- radius, 90);
-}
-
-
-void Context2D::rect(qreal x, qreal y, qreal w, qreal h)
-{
- QPainterPath path; path.addRect(x, y, w, h);
- path = worldMatrix().map(path);
- m_path.addPath(path);
-}
-
-void Context2D::arc(qreal xc, qreal yc, qreal radius,
- qreal sar, qreal ear,
- bool anticlockwise)
-{
- //### HACK
- // In Qt we don't switch the coordinate system for degrees
- // and still use the 0,0 as bottom left for degrees so we need
- // to switch
- sar = -sar;
- ear = -ear;
- anticlockwise = !anticlockwise;
- //end hack
-
- float sa = DEGREES(sar);
- float ea = DEGREES(ear);
-
- double span = 0;
-
- double xs = xc - radius;
- double ys = yc - radius;
- double width = radius*2;
- double height = radius*2;
-
- if (!anticlockwise && (ea < sa))
- span += 360;
- else if (anticlockwise && (sa < ea))
- span -= 360;
-
- //### this is also due to switched coordinate system
- // we would end up with a 0 span instead of 360
- if (!(qFuzzyCompare(span + (ea - sa) + 1, 1) &&
- qFuzzyCompare(qAbs(span), 360))) {
- span += ea - sa;
- }
-
- QPainterPath path;
- path.moveTo(QPointF(xc + radius * cos(sar),
- yc - radius * sin(sar)));
-
- path.arcTo(xs, ys, width, height, sa, span);
- path = worldMatrix().map(path);
- m_path.addPath(path);
-}
-
-
-void Context2D::fill()
-{
- beginPainting();
- m_painter.fillPath(m_path, m_painter.brush());
- scheduleChange();
-}
-
-
-void Context2D::stroke()
-{
- beginPainting();
- m_painter.save();
- m_painter.setMatrix(worldMatrix(), false);
- QPainterPath tmp = worldMatrix().inverted().map(m_path);
- m_painter.strokePath(tmp, m_painter.pen());
- m_painter.restore();
- scheduleChange();
-}
-
-
-void Context2D::clip()
-{
- m_state.clipPath = m_path;
- m_state.flags |= DirtyClippingRegion;
-}
-
-
-bool Context2D::isPointInPath(qreal x, qreal y) const
-{
- return m_path.contains(QPointF(x, y));
-}
-
-
-ImageData Context2D::getImageData(qreal sx, qreal sy, qreal sw, qreal sh)
-{
- Q_UNUSED(sx);
- Q_UNUSED(sy);
- Q_UNUSED(sw);
- Q_UNUSED(sh);
- return ImageData();
-}
-
-
-void Context2D::putImageData(ImageData image, qreal dx, qreal dy)
-{
- Q_UNUSED(image);
- Q_UNUSED(dx);
- Q_UNUSED(dy);
-}
-
-Context2D::Context2D(QObject *parent)
- : QObject(parent), m_changeTimerId(-1), m_width(0), m_height(0), m_inPaint(false)
-{
- reset();
-}
-
-void Context2D::setupPainter()
-{
- m_painter.setRenderHint(QPainter::Antialiasing, true);
- if ((m_state.flags & DirtyClippingRegion) && !m_state.clipPath.isEmpty())
- m_painter.setClipPath(m_state.clipPath);
- if (m_state.flags & DirtyFillStyle)
- m_painter.setBrush(m_state.fillStyle);
- if (m_state.flags & DirtyGlobalAlpha)
- m_painter.setOpacity(m_state.globalAlpha);
- if (m_state.flags & DirtyGlobalCompositeOperation)
- m_painter.setCompositionMode(m_state.globalCompositeOperation);
- if (m_state.flags & MDirtyPen) {
- QPen pen = m_painter.pen();
- if (m_state.flags & DirtyStrokeStyle)
- pen.setBrush(m_state.strokeStyle);
- if (m_state.flags & DirtyLineWidth)
- pen.setWidthF(m_state.lineWidth);
- if (m_state.flags & DirtyLineCap)
- pen.setCapStyle(m_state.lineCap);
- if (m_state.flags & DirtyLineJoin)
- pen.setJoinStyle(m_state.lineJoin);
- if (m_state.flags & DirtyMiterLimit)
- pen.setMiterLimit(m_state.miterLimit);
- m_painter.setPen(pen);
- }
-}
-
-void Context2D::beginPainting()
-{
- if (m_pixmap.width() != m_width || m_pixmap.height() != m_height) {
- if (m_painter.isActive())
- m_painter.end();
- m_pixmap = QPixmap(m_width, m_height);
- m_pixmap.fill(parent()->property("color").value<QColor>());
- }
-
- if (m_state.shadowBlur > 0 && m_painter.device() != &m_shadowbuffer) {
- if (m_painter.isActive())
- m_painter.end();
- updateShadowBuffer();
- m_painter.begin(&m_shadowbuffer);
- m_painter.setViewport(m_state.shadowOffsetX,
- m_state.shadowOffsetY,
- m_shadowbuffer.width(),
- m_shadowbuffer.height());
- m_shadowbuffer.fill(Qt::transparent);
- }
-
- if (!m_painter.isActive()) {
- m_painter.begin(&m_pixmap);
- m_painter.setRenderHint(QPainter::Antialiasing);
- if (!m_state.clipPath.isEmpty())
- m_painter.setClipPath(m_state.clipPath);
- m_painter.setBrush(m_state.fillStyle);
- m_painter.setOpacity(m_state.globalAlpha);
- QPen pen;
- pen.setBrush(m_state.strokeStyle);
- if (pen.style() == Qt::NoPen)
- pen.setStyle(Qt::SolidLine);
- pen.setCapStyle(m_state.lineCap);
- pen.setJoinStyle(m_state.lineJoin);
- pen.setWidthF(m_state.lineWidth);
- pen.setMiterLimit(m_state.miterLimit);
- m_painter.setPen(pen);
- } else {
- setupPainter();
- m_state.flags = 0;
- }
-}
-
-void Context2D::endPainting()
-{
- if (m_state.shadowBlur > 0) {
- QImage alphaChannel = m_shadowbuffer.alphaChannel();
-
- qt_blurImage(alphaChannel, m_state.shadowBlur, false, 1);
-
- QRect imageRect = m_shadowbuffer.rect();
-
- if (m_shadowColorIndexBuffer.isEmpty() || m_shadowColorBuffer != m_state.shadowColor) {
- m_shadowColorIndexBuffer.clear();
- m_shadowColorBuffer = m_state.shadowColor;
-
- for (int i = 0; i < 256; ++i) {
- m_shadowColorIndexBuffer << qRgba(qRound(255 * m_state.shadowColor.redF()),
- qRound(255 * m_state.shadowColor.greenF()),
- qRound(255 * m_state.shadowColor.blueF()),
- i);
- }
- }
- alphaChannel.setColorTable(m_shadowColorIndexBuffer);
-
- if (m_painter.isActive())
- m_painter.end();
-
- m_painter.begin(&m_pixmap);
-
- // draw the blurred drop shadow...
- m_painter.save();
- QTransform tf = m_painter.transform();
- m_painter.translate(0, imageRect.height());
- m_painter.rotate(-90);
- m_painter.drawImage(0, 0, alphaChannel);
- m_painter.setTransform(tf);
- m_painter.restore();
-
- // draw source
- m_painter.drawImage(-m_state.shadowOffsetX, -m_state.shadowOffsetY, m_shadowbuffer.copy());
- m_painter.end();
- }
-}
-
-void Context2D::clear()
-{
- m_painter.fillRect(QRect(QPoint(0,0), size()), Qt::white);
-}
-
-void Context2D::reset()
-{
- m_stateStack.clear();
- m_state.matrix = QMatrix();
- m_state.clipPath = QPainterPath();
- m_state.strokeStyle = Qt::black;
- m_state.fillStyle = Qt::black;
- m_state.globalAlpha = 1.0;
- m_state.lineWidth = 1;
- m_state.lineCap = Qt::FlatCap;
- m_state.lineJoin = Qt::MiterJoin;
- m_state.miterLimit = 10;
- m_state.shadowOffsetX = 0;
- m_state.shadowOffsetY = 0;
- m_state.shadowBlur = 0;
- m_state.shadowColor = qRgba(0, 0, 0, 0);
- m_state.globalCompositeOperation = QPainter::CompositionMode_SourceOver;
- m_state.font = QFont();
- m_state.textAlign = Start;
- m_state.textBaseline = Alphabetic;
- m_state.flags = AllIsFullOfDirt;
- m_mouseAreas.clear();
- clear();
-}
-
-void Context2D::drawImage(const QVariant &var, qreal sx, qreal sy,
- qreal sw = 0, qreal sh = 0)
-{
- CanvasImage *image = qobject_cast<CanvasImage*>(var.value<QObject*>());
- if (!image) {
- Canvas *canvas = qobject_cast<Canvas*>(var.value<QObject*>());
- if (canvas)
- image = canvas->toImage();
- }
- if (image) {
- beginPainting();
- if (sw == sh && sh == 0)
- m_painter.drawPixmap(QPointF(sx, sy), image->value());
- else
- m_painter.drawPixmap(QRect(sx, sy, sw, sh), image->value());
-
- scheduleChange();
- }
-}
-
-void Context2D::setSize(int width, int height)
-{
- endPainting();
- m_width = width;
- m_height = height;
-
- scheduleChange();
-}
-
-void Context2D::setSize(const QSize &size)
-{
- setSize(size.width(), size.height());
-}
-
-QSize Context2D::size() const
-{
- return m_pixmap.size();
-}
-
-QPoint Context2D::painterTranslate() const
-{
- return m_painterTranslate;
-}
-
-void Context2D::setPainterTranslate(const QPoint &translate)
-{
- m_painterTranslate = translate;
- m_state.flags |= DirtyTransformationMatrix;
-}
-
-void Context2D::scheduleChange()
-{
- QMetaObject::invokeMethod(this, "onScheduleChange", Qt::QueuedConnection, Q_ARG(int, 0));
-}
-
-void Context2D::onScheduleChange(int interval)
-{
- if (m_changeTimerId == -1 && !m_inPaint)
- m_changeTimerId = startTimer(interval);
-}
-
-void Context2D::timerEvent(QTimerEvent *e)
-{
- if (e->timerId() == m_changeTimerId) {
- killTimer(m_changeTimerId);
- m_changeTimerId = -1;
- endPainting();
- emit changed();
- } else {
- QObject::timerEvent(e);
- }
-}
-
-QMatrix Context2D::worldMatrix() const
-{
- QMatrix mat;
- mat.translate(m_painterTranslate.x(), m_painterTranslate.y());
- mat *= m_state.matrix;
- return mat;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
deleted file mode 100644
index cd84e1fa2b..0000000000
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
+++ /dev/null
@@ -1,326 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECONTEXT2D_P_H
-#define QDECLARATIVECONTEXT2D_P_H
-
-#include <qpainter.h>
-#include <qpainterpath.h>
-#include <qpixmap.h>
-#include <qstring.h>
-#include <qstack.h>
-#include <qmetatype.h>
-#include <qcoreevent.h>
-#include <qvariant.h>
-
-#include <QJSValue>
-
-QT_BEGIN_NAMESPACE
-
-QColor colorFromString(const QString &name);
-
-class CanvasGradient : public QObject
-{
- Q_OBJECT
-public:
- CanvasGradient(const QGradient &gradient) : m_gradient(gradient) {}
-
-public slots:
- QGradient value() { return m_gradient; }
- void addColorStop(float pos, const QString &color) { m_gradient.setColorAt(pos, colorFromString(color));}
-
-public:
- QGradient m_gradient;
-};
-
-class CanvasImage: public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString src READ src WRITE setSrc NOTIFY sourceChanged)
- Q_PROPERTY(int width READ width)
- Q_PROPERTY(int height READ height)
-
-public:
- CanvasImage() {}
- CanvasImage(const QString &url) : m_image(url), m_src(url) {}
- CanvasImage(const QPixmap &pixmap) {m_image = pixmap;}
-
-public slots:
- int width() { return m_image.width(); }
- int height() { return m_image.height(); }
- QPixmap &value() { return m_image; }
- QString src() { return m_src; }
- void setSrc(const QString &src) { m_src = src; m_image.load(src); emit sourceChanged();}
-signals:
- void sourceChanged();
-
-private:
- QPixmap m_image;
- QString m_src;
-};
-
-
-class ImageData {
-};
-
-class Context2D : public QObject
-{
- Q_OBJECT
- // compositing
- Q_PROPERTY(qreal globalAlpha READ globalAlpha WRITE setGlobalAlpha)
- Q_PROPERTY(QString globalCompositeOperation READ globalCompositeOperation WRITE setGlobalCompositeOperation)
- Q_PROPERTY(QVariant strokeStyle READ strokeStyle WRITE setStrokeStyle)
- Q_PROPERTY(QVariant fillStyle READ fillStyle WRITE setFillStyle)
- // line caps/joins
- Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth)
- Q_PROPERTY(QString lineCap READ lineCap WRITE setLineCap)
- Q_PROPERTY(QString lineJoin READ lineJoin WRITE setLineJoin)
- Q_PROPERTY(qreal miterLimit READ miterLimit WRITE setMiterLimit)
- // shadows
- Q_PROPERTY(qreal shadowOffsetX READ shadowOffsetX WRITE setShadowOffsetX)
- Q_PROPERTY(qreal shadowOffsetY READ shadowOffsetY WRITE setShadowOffsetY)
- Q_PROPERTY(qreal shadowBlur READ shadowBlur WRITE setShadowBlur)
- Q_PROPERTY(QString shadowColor READ shadowColor WRITE setShadowColor)
- // fonts
- Q_PROPERTY(QString font READ font WRITE setFont)
- Q_PROPERTY(QString textBaseline READ textBaseline WRITE setTextBaseline)
- Q_PROPERTY(QString textAlign READ textAlign WRITE setTextAlign)
-
- enum TextBaseLine { Alphabetic=0, Top, Middle, Bottom, Hanging};
- enum TextAlign { Start=0, End, Left, Right, Center};
-
-public:
- Context2D(QObject *parent = 0);
- void setSize(int width, int height);
- void setSize(const QSize &size);
- QSize size() const;
-
- QPoint painterTranslate() const;
- void setPainterTranslate(const QPoint &);
-
- void scheduleChange();
- void timerEvent(QTimerEvent *e);
-
- void clear();
- void reset();
-
- QPixmap pixmap() { return m_pixmap; }
-
- // compositing
- qreal globalAlpha() const; // (default 1.0)
- QString globalCompositeOperation() const; // (default over)
- QVariant strokeStyle() const; // (default black)
- QVariant fillStyle() const; // (default black)
-
- void setGlobalAlpha(qreal alpha);
- void setGlobalCompositeOperation(const QString &op);
- void setStrokeStyle(const QVariant &style);
- void setFillStyle(const QVariant &style);
-
- // line caps/joins
- qreal lineWidth() const; // (default 1)
- QString lineCap() const; // "butt", "round", "square" (default "butt")
- QString lineJoin() const; // "round", "bevel", "miter" (default "miter")
- qreal miterLimit() const; // (default 10)
-
- void setLineWidth(qreal w);
- void setLineCap(const QString &s);
- void setLineJoin(const QString &s);
- void setMiterLimit(qreal m);
-
- void setFont(const QString &font);
- QString font();
- void setTextBaseline(const QString &font);
- QString textBaseline();
- void setTextAlign(const QString &font);
- QString textAlign();
-
- // shadows
- qreal shadowOffsetX() const; // (default 0)
- qreal shadowOffsetY() const; // (default 0)
- qreal shadowBlur() const; // (default 0)
- QString shadowColor() const; // (default black)
-
- void setShadowOffsetX(qreal x);
- void setShadowOffsetY(qreal y);
- void setShadowBlur(qreal b);
- void setShadowColor(const QString &str);
-
- struct MouseArea {
- QJSValue callback;
- QJSValue data;
- QRectF rect;
- QMatrix matrix;
- };
- const QList<MouseArea> &mouseAreas() const;
-
-public slots:
- void save(); // push state on state stack
- void restore(); // pop state stack and restore state
-
- void fillText(const QString &text, qreal x, qreal y);
- void strokeText(const QString &text, qreal x, qreal y);
-
- void setInPaint(bool val){m_inPaint = val;}
- void scale(qreal x, qreal y);
- void rotate(qreal angle);
- void translate(qreal x, qreal y);
- void transform(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy);
- void setTransform(qreal m11, qreal m12, qreal m21, qreal m22,
- qreal dx, qreal dy);
-
- CanvasGradient *createLinearGradient(qreal x0, qreal y0,
- qreal x1, qreal y1);
- CanvasGradient *createRadialGradient(qreal x0, qreal y0,
- qreal r0, qreal x1,
- qreal y1, qreal r1);
-
- // rects
- void clearRect(qreal x, qreal y, qreal w, qreal h);
- void fillRect(qreal x, qreal y, qreal w, qreal h);
- void strokeRect(qreal x, qreal y, qreal w, qreal h);
-
- // mouse
- void mouseArea(qreal x, qreal y, qreal w, qreal h, const QJSValue &, const QJSValue & = QJSValue());
-
- // path API
- void beginPath();
- void closePath();
- void moveTo(qreal x, qreal y);
- void lineTo(qreal x, qreal y);
- void quadraticCurveTo(qreal cpx, qreal cpy, qreal x, qreal y);
- void bezierCurveTo(qreal cp1x, qreal cp1y,
- qreal cp2x, qreal cp2y, qreal x, qreal y);
- void arcTo(qreal x1, qreal y1, qreal x2, qreal y2, qreal radius);
- void rect(qreal x, qreal y, qreal w, qreal h);
- void arc(qreal x, qreal y, qreal radius,
- qreal startAngle, qreal endAngle,
- bool anticlockwise);
- void fill();
- void stroke();
- void clip();
- bool isPointInPath(qreal x, qreal y) const;
-
- CanvasImage *createImage(const QString &url);
-
- // drawing images (no overloads due to QTBUG-11604)
- void drawImage(const QVariant &var, qreal dx, qreal dy, qreal dw, qreal dh);
-
- // pixel manipulation
- ImageData getImageData(qreal sx, qreal sy, qreal sw, qreal sh);
- void putImageData(ImageData image, qreal dx, qreal dy);
- void endPainting();
-
-private slots:
- void onScheduleChange(int interval);
-
-signals:
- void changed();
-
-private:
- void setupPainter();
- void beginPainting();
- void updateShadowBuffer();
-
- int m_changeTimerId;
- QPainterPath m_path;
-
- enum DirtyFlag {
- DirtyTransformationMatrix = 0x00001,
- DirtyClippingRegion = 0x00002,
- DirtyStrokeStyle = 0x00004,
- DirtyFillStyle = 0x00008,
- DirtyGlobalAlpha = 0x00010,
- DirtyLineWidth = 0x00020,
- DirtyLineCap = 0x00040,
- DirtyLineJoin = 0x00080,
- DirtyMiterLimit = 0x00100,
- MDirtyPen = DirtyStrokeStyle
- | DirtyLineWidth
- | DirtyLineCap
- | DirtyLineJoin
- | DirtyMiterLimit,
- DirtyShadowOffsetX = 0x00200,
- DirtyShadowOffsetY = 0x00400,
- DirtyShadowBlur = 0x00800,
- DirtyShadowColor = 0x01000,
- DirtyGlobalCompositeOperation = 0x2000,
- DirtyFont = 0x04000,
- DirtyTextAlign = 0x08000,
- DirtyTextBaseline = 0x10000,
- AllIsFullOfDirt = 0xfffff
- };
-
- struct State {
- State() : flags(0) {}
- QMatrix matrix;
- QPainterPath clipPath;
- QBrush strokeStyle;
- QBrush fillStyle;
- qreal globalAlpha;
- qreal lineWidth;
- Qt::PenCapStyle lineCap;
- Qt::PenJoinStyle lineJoin;
- qreal miterLimit;
- qreal shadowOffsetX;
- qreal shadowOffsetY;
- qreal shadowBlur;
- QColor shadowColor;
- QPainter::CompositionMode globalCompositeOperation;
- QFont font;
- Context2D::TextAlign textAlign;
- Context2D::TextBaseLine textBaseline;
- int flags;
- };
-
- int baseLineOffset(Context2D::TextBaseLine value, const QFontMetrics &metrics);
- int textAlignOffset(Context2D::TextAlign value, const QFontMetrics &metrics, const QString &string);
-
- QMatrix worldMatrix() const;
-
- QPoint m_painterTranslate;
- State m_state;
- QStack<State> m_stateStack;
- QPixmap m_pixmap;
- QList<MouseArea> m_mouseAreas;
- QImage m_shadowbuffer;
- QVector<QRgb> m_shadowColorIndexBuffer;
- QColor m_shadowColorBuffer;
- QPainter m_painter;
- int m_width, m_height;
- bool m_inPaint;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(CanvasImage*)
-Q_DECLARE_METATYPE(CanvasGradient*)
-
-#endif // QDECLARATIVECONTEXT2D_P_H
diff --git a/src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp b/src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
deleted file mode 100644
index 3503807896..0000000000
--- a/src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "qmlprofilercanvas.h"
-
-#include "qdeclarativecontext2d_p.h"
-
-#include <qpixmap.h>
-#include <qpainter.h>
-
-namespace QmlProfiler {
-namespace Internal {
-
-QmlProfilerCanvas::QmlProfilerCanvas()
- : m_context2d(new Context2D(this))
-{
- setAcceptedMouseButtons(Qt::LeftButton);
- m_drawTimer.setSingleShot(true);
- connect(&m_drawTimer, SIGNAL(timeout()), this, SLOT(draw()));
-
- m_drawTimer.start();
-}
-
-void QmlProfilerCanvas::requestPaint()
-{
- if (m_context2d->size().width() != width()
- || m_context2d->size().height() != height()) {
- m_drawTimer.start();
- } else {
- update();
- }
-}
-
-void QmlProfilerCanvas::requestRedraw()
-{
- m_drawTimer.start();
-}
-
-// called from GUI thread. Draws into m_context2d.
-void QmlProfilerCanvas::draw()
-{
- QMutexLocker lock(&m_pixmapMutex);
- m_context2d->reset();
- m_context2d->setSize(width(), height());
-
- if (width() > 0 && height() > 0)
- emit drawRegion(m_context2d, QRect(0, 0, width(), height()));
- update();
-}
-
-// called from OpenGL thread. Renders m_context2d into OpenGL buffer.
-void QmlProfilerCanvas::paint(QPainter *p)
-{
- QMutexLocker lock(&m_pixmapMutex);
- p->drawPixmap(0, 0, m_context2d->pixmap());
-}
-
-void QmlProfilerCanvas::componentComplete()
-{
- const QMetaObject *metaObject = this->metaObject();
- int propertyCount = metaObject->propertyCount();
- int requestPaintMethod = metaObject->indexOfMethod("requestPaint()");
- for (int ii = QmlProfilerCanvas::staticMetaObject.propertyCount(); ii < propertyCount; ++ii) {
- QMetaProperty p = metaObject->property(ii);
- if (p.hasNotifySignal())
- QMetaObject::connect(this, p.notifySignalIndex(), this, requestPaintMethod, 0, 0);
- }
- QQuickItem::componentComplete();
- requestRedraw();
-}
-
-void QmlProfilerCanvas::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- QQuickItem::geometryChanged(newGeometry, oldGeometry);
- requestRedraw();
-}
-
-}
-}
diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
index f8cc12d859..5837918344 100644
--- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml
+++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
@@ -47,7 +47,7 @@ Item {
onExpandedChanged: {
qmlProfilerModelProxy.setExpanded(modelIndex, categoryIndex, expanded);
- backgroundMarks.requestRedraw();
+ backgroundMarks.requestPaint();
getDescriptions();
updateHeight();
}
diff --git a/src/plugins/qmlprofiler/qml/Detail.qml b/src/plugins/qmlprofiler/qml/Detail.qml
index 361b7bc6c7..0db79f9247 100644
--- a/src/plugins/qmlprofiler/qml/Detail.qml
+++ b/src/plugins/qmlprofiler/qml/Detail.qml
@@ -28,32 +28,9 @@
****************************************************************************/
import QtQuick 2.1
-import Monitor 1.0
-Item {
- id: detail
- property string label
- property string content
-
- height: childrenRect.height+2
- width: childrenRect.width
- Item {
- id: guideline
- x: 70
- width: 5
- }
- Text {
- y: 1
- id: lbl
- text: label
- font.pixelSize: 12
- font.bold: true
- }
- Text {
- text: content
- font.pixelSize: 12
- anchors.baseline: lbl.baseline
- anchors.left: guideline.right
- textFormat: Text.PlainText
- }
+Text {
+ font.pixelSize: 12
+ font.bold: index % 2 === 0
+ textFormat: Text.PlainText
}
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index c7e12a3de7..9fd5e778a3 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -169,28 +169,6 @@ Rectangle {
view.selectPrev();
}
- function updateZoomCentered(centerX, relativeFactor)
- {
- var min_length = 1e5; // 0.1 ms
- var windowLength = view.endTime - view.startTime;
- if (windowLength < min_length)
- windowLength = min_length;
- var newWindowLength = windowLength * relativeFactor;
-
- if (newWindowLength > qmlProfilerModelProxy.traceDuration()) {
- newWindowLength = qmlProfilerModelProxy.traceDuration();
- relativeFactor = newWindowLength / windowLength;
- }
- if (newWindowLength < min_length) {
- newWindowLength = min_length;
- relativeFactor = newWindowLength / windowLength;
- }
-
- var fixedPoint = (centerX - flick.x) * windowLength / flick.width + view.startTime;
- var startTime = fixedPoint - relativeFactor*(fixedPoint - view.startTime);
- zoomControl.setRange(startTime, startTime + newWindowLength);
- }
-
function recenter( centerPoint ) {
var windowLength = view.endTime - view.startTime;
var newStart = Math.floor(centerPoint - windowLength/2);
@@ -215,21 +193,10 @@ Rectangle {
}
- function wheelZoom(wheelCenter, wheelDelta) {
- if (qmlProfilerModelProxy.traceEndTime() > qmlProfilerModelProxy.traceStartTime() &&
- wheelDelta !== 0) {
- if (wheelDelta>0)
- updateZoomCentered(wheelCenter, 1/1.2);
- else
- updateZoomCentered(wheelCenter, 1.2);
- }
- }
-
function hideRangeDetails() {
rangeDetails.visible = false;
rangeDetails.duration = "";
rangeDetails.label = "";
- //rangeDetails.type = "";
rangeDetails.file = "";
rangeDetails.line = -1;
rangeDetails.column = 0;
diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml
index 2168ea79ad..51d1fdb1f6 100644
--- a/src/plugins/qmlprofiler/qml/Overview.qml
+++ b/src/plugins/qmlprofiler/qml/Overview.qml
@@ -31,9 +31,10 @@ import QtQuick 2.1
import Monitor 1.0
import "Overview.js" as Plotter
-Canvas2D {
+Canvas {
id: canvas
objectName: "Overview"
+ contextType: "2d"
// ***** properties
height: 50
@@ -45,7 +46,7 @@ Canvas2D {
function clearDisplay()
{
dataReady = false;
- requestRedraw();
+ requestPaint();
}
function updateRange() {
@@ -84,18 +85,18 @@ Canvas2D {
target: qmlProfilerModelProxy
onDataAvailable: {
dataReady = true;
- requestRedraw();
+ requestPaint();
}
}
// ***** slots
- onDrawRegion: {
+ onPaint: {
Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy;
if (dataReady) {
- Plotter.plot(canvas, ctxt, region);
+ Plotter.plot(canvas, context, region);
} else {
- Plotter.drawGraph(canvas, ctxt, region) //just draw the background
+ Plotter.drawGraph(canvas, context, region) //just draw the background
}
}
diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml
index 89802c3b2e..862de0f4a3 100644
--- a/src/plugins/qmlprofiler/qml/RangeDetails.qml
+++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml
@@ -43,7 +43,7 @@ Item {
property bool locked: view.selectionLocked
- width: col.width + 45
+ width: col.width + 25
height: col.height + 30
z: 1
visible: false
@@ -68,7 +68,8 @@ Item {
rangeDetails.dialogTitle = eventData[0]["title"];
for (var i = 1; i < eventData.length; i++) {
for (var k in eventData[i]) {
- eventInfo.append({"key": k, "value":eventData[i][k]});
+ eventInfo.append({"content" : k});
+ eventInfo.append({"content" : eventData[i][k]})
}
}
rangeDetails.visible = true;
@@ -163,16 +164,17 @@ Item {
border.color: "#a0a0a0"
//details
- Column {
+ Grid {
id: col
x: 10
y: 5
+ spacing: 5
+ columns: 2
Repeater {
model: eventInfo
Detail {
- label: key
- content: value
+ text: content
}
}
}
@@ -211,7 +213,7 @@ Item {
Text {
id: closeIcon
- x: col.width + 30
+ x: col.width + 10
y: 4
text:"X"
color: "white"
diff --git a/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml b/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml
index 4dfaee3651..57cc783db0 100644
--- a/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml
+++ b/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml
@@ -38,7 +38,7 @@ Item {
property string duration
property bool showDuration
- width: 170
+ width: Math.max(150, col.width + 25)
height: col.height + 30
z: 1
visible: false
@@ -126,23 +126,25 @@ Item {
y: 20
border.width: 1
border.color: "#a0a0a0"
- Column {
+ Grid {
id: col
x: 10
y: 5
- Detail {
- label: qsTr("Start")
- content: selectionRangeDetails.startTime
- }
- Detail {
- label: qsTr("End")
- visible: selectionRangeDetails.showDuration
- content: selectionRangeDetails.endTime
- }
- Detail {
- label: qsTr("Duration")
- visible: selectionRangeDetails.showDuration
- content: selectionRangeDetails.duration
+ spacing: 5
+ columns: 2
+
+ Repeater {
+ model: [
+ qsTr("Start"),
+ startTime,
+ showDuration ? qsTr("End") : "",
+ showDuration ? endTime : "",
+ showDuration ? qsTr("Duration") : "",
+ showDuration ? duration : ""
+ ]
+ Detail {
+ text: modelData
+ }
}
}
}
diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
index c7340cfa39..97c469f5d3 100644
--- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml
+++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
@@ -30,9 +30,10 @@
import QtQuick 2.1
import Monitor 1.0
-Canvas2D {
+Canvas {
id: timeDisplay
objectName: "TimeDisplay"
+ contextType: "2d"
property real startTime : 0
property real endTime : 0
@@ -43,13 +44,13 @@ Canvas2D {
onRangeChanged: {
startTime = zoomControl.startTime();
endTime = zoomControl.endTime();
- requestRedraw();
+ requestPaint();
}
}
- onDrawRegion: {
- ctxt.fillStyle = "white";
- ctxt.fillRect(0, 0, width, height);
+ onPaint: {
+ context.fillStyle = "white";
+ context.fillRect(0, 0, width, height);
var totalTime = endTime - startTime;
var spacing = width / totalTime;
@@ -67,50 +68,50 @@ Canvas2D {
var initialColor = Math.floor(realStartTime/timePerBlock) % 2;
- ctxt.fillStyle = "#000000";
- ctxt.font = "8px sans-serif";
+ context.fillStyle = "#000000";
+ context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) {
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
- ctxt.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
- ctxt.fillRect(x, 0, pixelsPerBlock, height);
+ context.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
+ context.fillRect(x, 0, pixelsPerBlock, height);
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(x, 0);
- ctxt.lineTo(x, height);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(x, 0);
+ context.lineTo(x, height);
+ context.stroke();
- ctxt.fillStyle = "#000000";
- ctxt.fillText(prettyPrintTime(ii*timePerBlock + realStartTime), x + 5, height/2 + 5);
+ context.fillStyle = "#000000";
+ context.fillText(prettyPrintTime(ii*timePerBlock + realStartTime), x + 5, height/2 + 5);
}
- ctxt.strokeStyle = "#525252";
- ctxt.beginPath();
- ctxt.moveTo(0, height-1);
- ctxt.lineTo(width, height-1);
- ctxt.stroke();
+ context.strokeStyle = "#525252";
+ context.beginPath();
+ context.moveTo(0, height-1);
+ context.lineTo(width, height-1);
+ context.stroke();
// gradient borders
var gradientDark = "rgba(0, 0, 0, 0.53125)";
var gradientClear = "rgba(0, 0, 0, 0)";
- var grad = ctxt.createLinearGradient(0, 0, 0, 6);
+ var grad = context.createLinearGradient(0, 0, 0, 6);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(0, 0, width, 6);
+ context.fillStyle = grad;
+ context.fillRect(0, 0, width, 6);
- grad = ctxt.createLinearGradient(0, 0, 6, 0);
+ grad = context.createLinearGradient(0, 0, 6, 0);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(0, 0, 6, height);
+ context.fillStyle = grad;
+ context.fillRect(0, 0, 6, height);
- grad = ctxt.createLinearGradient(width, 0, width-6, 0);
+ grad = context.createLinearGradient(width, 0, width-6, 0);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(width-6, 0, 6, height);
+ context.fillStyle = grad;
+ context.fillRect(width-6, 0, 6, height);
}
function prettyPrintTime( t )
diff --git a/src/plugins/qmlprofiler/qml/TimeMarks.qml b/src/plugins/qmlprofiler/qml/TimeMarks.qml
index 433d35578f..2cef16edf4 100644
--- a/src/plugins/qmlprofiler/qml/TimeMarks.qml
+++ b/src/plugins/qmlprofiler/qml/TimeMarks.qml
@@ -30,9 +30,10 @@
import QtQuick 2.1
import Monitor 1.0
-Canvas2D {
- id: timeDisplay
+Canvas {
+ id: timeMarks
objectName: "TimeMarks"
+ contextType: "2d"
property real startTime
property real endTime
@@ -40,11 +41,13 @@ Canvas2D {
Connections {
target: labels
- onHeightChanged: { requestRedraw(); }
+ onHeightChanged: requestPaint()
}
- onDrawRegion: {
- drawBackgroundBars( ctxt, region );
+ onYChanged: requestPaint()
+
+ onPaint: {
+ drawBackgroundBars( context, region );
var totalTime = endTime - startTime;
var spacing = width / totalTime;
@@ -63,23 +66,23 @@ Canvas2D {
var lineStart = y < 0 ? -y : 0;
var lineEnd = Math.min(height, labels.height - y);
- ctxt.fillStyle = "#000000";
- ctxt.font = "8px sans-serif";
+ context.fillStyle = "#000000";
+ context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) {
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(x, lineStart);
- ctxt.lineTo(x, lineEnd);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(x, lineStart);
+ context.lineTo(x, lineEnd);
+ context.stroke();
- ctxt.strokeStyle = "#CCCCCC";
+ context.strokeStyle = "#CCCCCC";
for (var jj=1; jj < 5; jj++) {
var xx = Math.floor(ii*pixelsPerBlock + jj*pixelsPerSection - realStartPos);
- ctxt.beginPath();
- ctxt.moveTo(xx, lineStart);
- ctxt.lineTo(xx, lineEnd);
- ctxt.stroke();
+ context.beginPath();
+ context.moveTo(xx, lineStart);
+ context.lineTo(xx, lineEnd);
+ context.stroke();
}
}
}
@@ -88,19 +91,19 @@ Canvas2D {
if (startTime !== start || endTime !== end) {
startTime = start;
endTime = end;
- requestRedraw();
+ requestPaint();
}
}
- function drawBackgroundBars( ctxt, region ) {
+ function drawBackgroundBars( context, region ) {
var colorIndex = true;
// row background
var backgroundOffset = y < 0 ? -y : -(y % (2 * root.singleRowHeight));
for (var currentY= backgroundOffset; currentY < Math.min(height, labels.height - y); currentY += root.singleRowHeight) {
- ctxt.fillStyle = colorIndex ? "#f0f0f0" : "white";
- ctxt.strokeStyle = colorIndex ? "#f0f0f0" : "white";
- ctxt.fillRect(0, currentY, width, root.singleRowHeight);
+ context.fillStyle = colorIndex ? "#f0f0f0" : "white";
+ context.strokeStyle = colorIndex ? "#f0f0f0" : "white";
+ context.fillRect(0, currentY, width, root.singleRowHeight);
colorIndex = !colorIndex;
}
@@ -112,18 +115,18 @@ Canvas2D {
if (cumulatedHeight < y)
continue;
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(0, cumulatedHeight - y);
- ctxt.lineTo(width, cumulatedHeight - y);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(0, cumulatedHeight - y);
+ context.lineTo(width, cumulatedHeight - y);
+ context.stroke();
}
}
// bottom
if (height > labels.height - y) {
- ctxt.fillStyle = "#f5f5f5";
- ctxt.fillRect(0, labels.height - y, width, Math.min(height - labels.height + y, labelsTail.height));
+ context.fillStyle = "#f5f5f5";
+ context.fillRect(0, labels.height - y, width, Math.min(height - labels.height + y, labelsTail.height));
}
}
}
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro
index 8be8423533..aa23d616c8 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.pro
+++ b/src/plugins/qmlprofiler/qmlprofiler.pro
@@ -3,7 +3,6 @@ DEFINES += QMLPROFILER_LIBRARY
QT += network qml quick
include(../../qtcreatorplugin.pri)
-include(canvas/canvas.pri)
SOURCES += \
qmlprofilerplugin.cpp \
@@ -31,7 +30,8 @@ SOURCES += \
qmlprofilertracefile.cpp \
abstracttimelinemodel.cpp \
timelinemodelaggregator.cpp \
- qmlprofilerpainteventsmodelproxy.cpp
+ qmlprofilerpainteventsmodelproxy.cpp \
+ sortedtimelinemodel.cpp
HEADERS += \
qmlprofilerconstants.h \
@@ -62,7 +62,8 @@ HEADERS += \
qmlprofilertracefile.h \
abstracttimelinemodel.h \
timelinemodelaggregator.h \
- qmlprofilerpainteventsmodelproxy.h
+ qmlprofilerpainteventsmodelproxy.h \
+ sortedtimelinemodel.h
RESOURCES += \
qml/qmlprofiler.qrc
diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs
index 507ce1093e..018019c49a 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.qbs
+++ b/src/plugins/qmlprofiler/qmlprofiler.qbs
@@ -50,23 +50,13 @@ QtcPlugin {
"qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h",
"qv8profilerdatamodel.cpp", "qv8profilerdatamodel.h",
"qv8profilereventview.h", "qv8profilereventview.cpp",
+ "sortedtimelinemodel.h", "sortedtimelinemodel.cpp",
"timelinemodelaggregator.cpp", "timelinemodelaggregator.h",
"timelinerenderer.cpp", "timelinerenderer.h",
]
}
Group {
- name: "Canvas"
- prefix: "canvas/"
- files: [
- "qdeclarativecanvas.cpp", "qdeclarativecanvas_p.h",
- "qdeclarativecanvastimer.cpp", "qdeclarativecanvastimer_p.h",
- "qdeclarativecontext2d.cpp", "qdeclarativecontext2d_p.h",
- "qmlprofilercanvas.cpp", "qmlprofilercanvas.h"
- ]
- }
-
- Group {
name: "QML"
prefix: "qml/"
files: [
diff --git a/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp
index f7f3e3053f..3b4cda3385 100644
--- a/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp
@@ -96,7 +96,7 @@ void QmlProfilerEventsModelProxy::limitToRange(qint64 rangeStart, qint64 rangeEn
void QmlProfilerEventsModelProxy::dataChanged()
{
- if (d->modelManager->state() == QmlProfilerDataState::Empty)
+ if (d->modelManager->state() == QmlProfilerDataState::ClearingData)
clear();
else
loadData();
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index 82af434a31..6fd51ef788 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
@@ -57,6 +57,9 @@ void QmlProfilerDataState::setState(QmlProfilerDataState::State state)
return;
switch (state) {
+ case ClearingData:
+ QTC_ASSERT(m_state == Done || m_state == Empty, /**/);
+ break;
case Empty:
// if it's not empty, complain but go on
QTC_ASSERT(m_modelManager->isEmpty(), /**/);
@@ -345,6 +348,7 @@ QmlProfilerDataState::State QmlProfilerModelManager::state() const
void QmlProfilerModelManager::clear()
{
+ setState(QmlProfilerDataState::ClearingData);
for (int i = 0; i < d->partialCounts.count(); i++)
d->partialCounts[i] = 0;
d->progress = 0;
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
index f814ec432c..6b48e82a4d 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
@@ -52,6 +52,7 @@ public:
Empty,
AcquiringData,
ProcessingData,
+ ClearingData,
Done
};
diff --git a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
index 9cc160b1a5..09c7f552f2 100644
--- a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
@@ -30,6 +30,7 @@
#include "qmlprofilerpainteventsmodelproxy.h"
#include "qmlprofilermodelmanager.h"
#include "qmlprofilersimplemodel.h"
+#include "sortedtimelinemodel.h"
#include <QCoreApplication>
#include <QVector>
@@ -49,7 +50,7 @@ struct CategorySpan {
int contractedRows;
};
-class PaintEventsModelProxy::PaintEventsModelProxyPrivate
+class PaintEventsModelProxy::PaintEventsModelProxyPrivate : public SortedTimelineModel<QmlPaintEventData>
{
public:
PaintEventsModelProxyPrivate(PaintEventsModelProxy *qq) : q(qq) {}
@@ -58,7 +59,6 @@ public:
QString displayTime(double time);
void computeAnimationCountLimit();
- QVector <PaintEventsModelProxy::QmlPaintEventData> eventList;
int minAnimationCount;
int maxAnimationCount;
bool expanded;
@@ -94,49 +94,15 @@ QString PaintEventsModelProxy::name() const
return QLatin1String("PaintEventsModelProxy");
}
-const QVector<PaintEventsModelProxy::QmlPaintEventData> PaintEventsModelProxy::getData() const
-{
- return d->eventList;
-}
-
-const QVector<PaintEventsModelProxy::QmlPaintEventData> PaintEventsModelProxy::getData(qint64 fromTime, qint64 toTime) const
-{
- int fromIndex = findFirstIndex(fromTime);
- int toIndex = findLastIndex(toTime);
- if (fromIndex != -1 && toIndex > fromIndex)
- return d->eventList.mid(fromIndex, toIndex - fromIndex + 1);
- else
- return QVector<PaintEventsModelProxy::QmlPaintEventData>();
-}
-
void PaintEventsModelProxy::clear()
{
- d->eventList.clear();
+ d->SortedTimelineModel::clear();
d->minAnimationCount = 1;
d->maxAnimationCount = 1;
d->expanded = false;
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
}
-void PaintEventsModelProxy::dataChanged()
-{
- if (m_modelManager->state() == QmlProfilerDataState::ProcessingData)
- loadData();
-
- if (m_modelManager->state() == QmlProfilerDataState::Empty)
- clear();
-
- emit stateChanged();
- emit dataAvailable();
- emit emptyChanged();
- emit expandedChanged();
-}
-
-bool compareStartTimes(const PaintEventsModelProxy::QmlPaintEventData &t1, const PaintEventsModelProxy::QmlPaintEventData &t2)
-{
- return t1.startTime < t2.startTime;
-}
-
bool PaintEventsModelProxy::eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const
{
return (event.eventType == QmlDebug::Painting && event.bindingType == QmlDebug::AnimationFrame);
@@ -151,6 +117,11 @@ void PaintEventsModelProxy::loadData()
// collect events
const QVector<QmlProfilerSimpleModel::QmlEventData> referenceList = simpleModel->getEvents();
+
+ QmlPaintEventData lastEvent;
+ qint64 lastStartTime = -1;
+ qint64 lastDuration = -1;
+
foreach (const QmlProfilerSimpleModel::QmlEventData &event, referenceList) {
if (!eventAccepted(event))
continue;
@@ -165,30 +136,29 @@ void PaintEventsModelProxy::loadData()
// the duration of the events is estimated from the framerate
// we need to correct it before appending a new event
- if (d->eventList.count() > 0) {
- QmlPaintEventData *lastEvent = &d->eventList[d->eventList.count()-1];
- if (lastEvent->startTime + lastEvent->duration >= realStartTime) {
+ if (lastStartTime != -1) {
+ if (lastStartTime + lastDuration >= realStartTime) {
// 1 nanosecond less to prevent overlap
- lastEvent->duration = realStartTime - lastEvent->startTime - 1;
- lastEvent->framerate = 1e9/lastEvent->duration;
+ lastDuration = realStartTime - lastStartTime - 1;
+ lastEvent.framerate = 1e9 / lastDuration;
}
}
- QmlPaintEventData newEvent = {
- realStartTime,
- estimatedDuration,
- (int)event.numericData1,
- (int)event.numericData2
- };
+ d->insert(lastStartTime, lastDuration, lastEvent);
- d->eventList.append(newEvent);
+ lastEvent.framerate = (int)event.numericData1;
+ lastEvent.animationcount = (int)event.numericData2;
+ lastStartTime = realStartTime;
+ lastDuration = estimatedDuration;
- m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), referenceList.count());
+ m_modelManager->modelProxyCountUpdated(m_modelId, d->count(), referenceList.count());
}
- d->computeAnimationCountLimit();
+ if (lastStartTime != -1)
+ d->insert(lastStartTime, lastDuration, lastEvent);
- qSort(d->eventList.begin(), d->eventList.end(), compareStartTimes);
+ d->computeAnimationCountLimit();
+ d->computeNesting();
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
@@ -204,12 +174,12 @@ bool PaintEventsModelProxy::isEmpty() const
int PaintEventsModelProxy::count() const
{
- return d->eventList.count();
+ return d->count();
}
qint64 PaintEventsModelProxy::lastTimeMark() const
{
- return d->eventList.last().startTime + d->eventList.last().duration;
+ return d->lastEndTime();
}
bool PaintEventsModelProxy::expanded(int ) const
@@ -247,53 +217,17 @@ const QString PaintEventsModelProxy::categoryLabel(int categoryIndex) const
int PaintEventsModelProxy::findFirstIndex(qint64 startTime) const
{
- return findFirstIndexNoParents(startTime);
+ return d->findFirstIndex(startTime);
}
int PaintEventsModelProxy::findFirstIndexNoParents(qint64 startTime) const
{
- if (d->eventList.isEmpty())
- return -1;
- if (d->eventList.count() == 1 || d->eventList.first().startTime+d->eventList.first().duration >= startTime)
- return 0;
- else
- if (d->eventList.last().startTime+d->eventList.last().duration <= startTime)
- return -1;
-
- int fromIndex = 0;
- int toIndex = d->eventList.count()-1;
- while (toIndex - fromIndex > 1) {
- int midIndex = (fromIndex + toIndex)/2;
- if (d->eventList[midIndex].startTime + d->eventList[midIndex].duration < startTime)
- fromIndex = midIndex;
- else
- toIndex = midIndex;
- }
- return toIndex;
+ return d->findFirstIndexNoParents(startTime);
}
int PaintEventsModelProxy::findLastIndex(qint64 endTime) const
{
- if (d->eventList.isEmpty())
- return -1;
- if (d->eventList.first().startTime >= endTime)
- return -1;
- if (d->eventList.count() == 1)
- return 0;
- if (d->eventList.last().startTime <= endTime)
- return d->eventList.count()-1;
-
- int fromIndex = 0;
- int toIndex = d->eventList.count()-1;
- while (toIndex - fromIndex > 1) {
- int midIndex = (fromIndex + toIndex)/2;
- if (d->eventList[midIndex].startTime < endTime)
- fromIndex = midIndex;
- else
- toIndex = midIndex;
- }
-
- return fromIndex;
+ return d->findLastIndex(endTime);
}
int PaintEventsModelProxy::getEventType(int index) const
@@ -317,17 +251,17 @@ int PaintEventsModelProxy::getEventRow(int index) const
qint64 PaintEventsModelProxy::getDuration(int index) const
{
- return d->eventList[index].duration;
+ return d->range(index).duration;
}
qint64 PaintEventsModelProxy::getStartTime(int index) const
{
- return d->eventList[index].startTime;
+ return d->range(index).start;
}
qint64 PaintEventsModelProxy::getEndTime(int index) const
{
- return d->eventList[index].startTime + d->eventList[index].duration;
+ return d->range(index).start + d->range(index).duration;
}
int PaintEventsModelProxy::getEventId(int index) const
@@ -339,7 +273,7 @@ int PaintEventsModelProxy::getEventId(int index) const
QColor PaintEventsModelProxy::getColor(int index) const
{
- double fpsFraction = d->eventList[index].framerate / 60.0;
+ double fpsFraction = d->range(index).framerate / 60.0;
if (fpsFraction > 1.0)
fpsFraction = 1.0;
if (fpsFraction < 0.0)
@@ -352,7 +286,7 @@ float PaintEventsModelProxy::getHeight(int index) const
float scale = d->maxAnimationCount - d->minAnimationCount;
float fraction = 1.0f;
if (scale > 1)
- fraction = (float)(d->eventList[index].animationcount -
+ fraction = (float)(d->range(index).animationcount -
d->minAnimationCount) / scale;
return fraction * 0.85f + 0.15f;
@@ -388,14 +322,14 @@ void PaintEventsModelProxy::PaintEventsModelProxyPrivate::computeAnimationCountL
{
minAnimationCount = 1;
maxAnimationCount = 1;
- if (eventList.isEmpty())
+ if (count() == 0)
return;
- for (int i=0; i < eventList.count(); i++) {
- if (eventList[i].animationcount < minAnimationCount)
- minAnimationCount = eventList[i].animationcount;
- if (eventList[i].animationcount > maxAnimationCount)
- maxAnimationCount = eventList[i].animationcount;
+ for (int i=0; i < count(); i++) {
+ if (range(i).animationcount < minAnimationCount)
+ minAnimationCount = range(i).animationcount;
+ else if (range(i).animationcount > maxAnimationCount)
+ maxAnimationCount = range(i).animationcount;
}
}
@@ -414,21 +348,21 @@ const QVariantList PaintEventsModelProxy::getEventDetails(int index) const
// duration
{
QVariantMap valuePair;
- valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->eventList[index].duration)));
+ valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->range(index).duration)));
result << valuePair;
}
// duration
{
QVariantMap valuePair;
- valuePair.insert(QCoreApplication::translate(trContext, "Framerate:"), QVariant(QString::fromLatin1("%1 FPS").arg(d->eventList[index].framerate)));
+ valuePair.insert(QCoreApplication::translate(trContext, "Framerate:"), QVariant(QString::fromLatin1("%1 FPS").arg(d->range(index).framerate)));
result << valuePair;
}
// duration
{
QVariantMap valuePair;
- valuePair.insert(QCoreApplication::translate(trContext, "Animations:"), QVariant(QString::fromLatin1("%1").arg(d->eventList[index].animationcount)));
+ valuePair.insert(QCoreApplication::translate(trContext, "Animations:"), QVariant(QString::fromLatin1("%1").arg(d->range(index).animationcount)));
result << valuePair;
}
diff --git a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
index 4be60850ef..e4bcf0e268 100644
--- a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
+++ b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
@@ -56,8 +56,6 @@ class PaintEventsModelProxy : public AbstractTimelineModel
public:
struct QmlPaintEventData {
- qint64 startTime;
- qint64 duration;
int framerate;
int animationcount;
};
@@ -70,8 +68,6 @@ public:
QStringList categoryTitles() const;
QString name() const;
- const QVector<QmlPaintEventData> getData() const;
- const QVector<QmlPaintEventData> getData(qint64 fromTime, qint64 toTime) const;
void loadData();
Q_INVOKABLE int count() const;
void clear();
@@ -108,8 +104,6 @@ public:
private slots:
bool eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const;
-protected slots:
- void dataChanged();
private:
class PaintEventsModelProxyPrivate;
diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
index e6a280aadd..11d05081c6 100644
--- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
@@ -30,6 +30,7 @@
#include "qmlprofilertimelinemodelproxy.h"
#include "qmlprofilermodelmanager.h"
#include "qmlprofilersimplemodel.h"
+#include "sortedtimelinemodel.h"
#include <QCoreApplication>
#include <QVector>
@@ -51,7 +52,7 @@ struct CategorySpan {
bool empty;
};
-class BasicTimelineModel::BasicTimelineModelPrivate
+class BasicTimelineModel::BasicTimelineModelPrivate : public SortedTimelineModel<BasicTimelineModel::QmlRangeEventStartInstance>
{
public:
BasicTimelineModelPrivate(BasicTimelineModel *qq) : q(qq) {}
@@ -61,7 +62,6 @@ public:
void prepare();
void computeNestingContracted();
void computeExpandedLevels();
- void buildEndTimeList();
void findBindingLoops();
void computeRowStarts();
@@ -69,8 +69,6 @@ public:
QVector <BasicTimelineModel::QmlRangeEventData> eventDict;
QVector <QString> eventHashes;
- QVector <BasicTimelineModel::QmlRangeEventStartInstance> startTimeData;
- QVector <BasicTimelineModel::QmlRangeEventEndInstance> endTimeData;
QVector <CategorySpan> categorySpan;
BasicTimelineModel *q;
@@ -104,46 +102,16 @@ QString BasicTimelineModel::name() const
return QLatin1String("BasicTimelineModel");
}
-const QVector<BasicTimelineModel::QmlRangeEventStartInstance> BasicTimelineModel::getData() const
-{
- return d->startTimeData;
-}
-
-const QVector<BasicTimelineModel::QmlRangeEventStartInstance> BasicTimelineModel::getData(qint64 fromTime, qint64 toTime) const
-{
- int fromIndex = findFirstIndex(fromTime);
- int toIndex = findLastIndex(toTime);
- if (fromIndex != -1 && toIndex > fromIndex)
- return d->startTimeData.mid(fromIndex, toIndex - fromIndex + 1);
- else
- return QVector<BasicTimelineModel::QmlRangeEventStartInstance>();
-}
-
void BasicTimelineModel::clear()
{
+ d->SortedTimelineModel::clear();
d->eventDict.clear();
d->eventHashes.clear();
- d->startTimeData.clear();
- d->endTimeData.clear();
d->categorySpan.clear();
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
}
-void BasicTimelineModel::dataChanged()
-{
- if (m_modelManager->state() == QmlProfilerDataState::ProcessingData)
- loadData();
-
- if (m_modelManager->state() == QmlProfilerDataState::Empty)
- clear();
-
- emit stateChanged();
- emit dataAvailable();
- emit emptyChanged();
- emit expandedChanged();
-}
-
void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
{
categorySpan.clear();
@@ -153,16 +121,6 @@ void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
}
}
-bool compareStartTimes(const BasicTimelineModel::QmlRangeEventStartInstance&t1, const BasicTimelineModel::QmlRangeEventStartInstance &t2)
-{
- return t1.startTime < t2.startTime;
-}
-
-bool compareEndTimes(const BasicTimelineModel::QmlRangeEventEndInstance &t1, const BasicTimelineModel::QmlRangeEventEndInstance &t2)
-{
- return t1.endTime < t2.endTime;
-}
-
bool BasicTimelineModel::eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const
{
// only accept Qt4.x Painting events
@@ -205,42 +163,30 @@ void BasicTimelineModel::loadData()
}
// store starttime-based instance
- QmlRangeEventStartInstance eventStartInstance = {
- event.startTime,
- event.duration,
- d->eventHashes.indexOf(eventHash), // event id
- QmlDebug::Constants::QML_MIN_LEVEL, // displayRowExpanded;
- QmlDebug::Constants::QML_MIN_LEVEL, // displayRowCollapsed;
- 1,
- -1 // bindingLoopHead
- };
- d->startTimeData.append(eventStartInstance);
-
- m_modelManager->modelProxyCountUpdated(m_modelId, d->startTimeData.count(), eventList.count() * 7);
+ d->insert(event.startTime, event.duration, QmlRangeEventStartInstance(d->eventHashes.indexOf(eventHash)));
+
+ m_modelManager->modelProxyCountUpdated(m_modelId, d->count(), eventList.count() * 6);
}
- qSort(d->startTimeData.begin(), d->startTimeData.end(), compareStartTimes);
+ m_modelManager->modelProxyCountUpdated(m_modelId, 2, 6);
- m_modelManager->modelProxyCountUpdated(m_modelId, 2, 7);
+ // compute range nesting
+ d->computeNesting();
// compute nestingLevel - nonexpanded
d->computeNestingContracted();
- m_modelManager->modelProxyCountUpdated(m_modelId, 3, 7);
+ m_modelManager->modelProxyCountUpdated(m_modelId, 3, 6);
// compute nestingLevel - expanded
d->computeExpandedLevels();
- m_modelManager->modelProxyCountUpdated(m_modelId, 4, 7);
+ m_modelManager->modelProxyCountUpdated(m_modelId, 4, 6);
- // populate endtimelist
- d->buildEndTimeList();
-
- m_modelManager->modelProxyCountUpdated(m_modelId, 5, 7);
d->findBindingLoops();
- m_modelManager->modelProxyCountUpdated(m_modelId, 6, 7);
+ m_modelManager->modelProxyCountUpdated(m_modelId, 5, 6);
d->computeRowStarts();
@@ -252,15 +198,10 @@ void BasicTimelineModel::loadData()
void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
{
int i;
- int eventCount = startTimeData.count();
+ int eventCount = count();
- QHash<int, qint64> endtimesPerLevel;
QList<int> nestingLevels;
QList< QHash<int, qint64> > endtimesPerNestingLevel;
- int level = QmlDebug::Constants::QML_MIN_LEVEL;
- endtimesPerLevel[QmlDebug::Constants::QML_MIN_LEVEL] = 0;
- int lastBaseEventIndex = 0;
- qint64 lastBaseEventEndTime = q->m_modelManager->traceTime()->startTime();
for (i = 0; i < QmlDebug::MaximumQmlEventType; i++) {
nestingLevels << QmlDebug::Constants::QML_MIN_LEVEL;
@@ -270,18 +211,9 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
}
for (i = 0; i < eventCount; i++) {
- qint64 st = startTimeData[i].startTime;
+ qint64 st = ranges[i].start;
int type = q->getEventType(i);
- // general level
- if (endtimesPerLevel[level] > st) {
- level++;
- } else {
- while (level > QmlDebug::Constants::QML_MIN_LEVEL && endtimesPerLevel[level-1] <= st)
- level--;
- }
- endtimesPerLevel[level] = st + startTimeData[i].duration;
-
// per type
if (endtimesPerNestingLevel[type][nestingLevels[type]] > st) {
nestingLevels[type]++;
@@ -291,67 +223,42 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
nestingLevels[type]--;
}
endtimesPerNestingLevel[type][nestingLevels[type]] =
- st + startTimeData[i].duration;
-
- startTimeData[i].displayRowCollapsed = nestingLevels[type];
+ st + ranges[i].duration;
- if (level == QmlDebug::Constants::QML_MIN_LEVEL) {
- if (lastBaseEventEndTime < startTimeData[i].startTime) {
- lastBaseEventIndex = i;
- lastBaseEventEndTime = startTimeData[i].startTime + startTimeData[i].duration;
- }
- }
- startTimeData[i].baseEventIndex = lastBaseEventIndex;
+ ranges[i].displayRowCollapsed = nestingLevels[type];
}
// nestingdepth
for (i = 0; i < eventCount; i++) {
int eventType = q->getEventType(i);
categorySpan[eventType].empty = false;
- if (categorySpan[eventType].contractedRows <= startTimeData[i].displayRowCollapsed)
- categorySpan[eventType].contractedRows = startTimeData[i].displayRowCollapsed + 1;
+ if (categorySpan[eventType].contractedRows <= ranges[i].displayRowCollapsed)
+ categorySpan[eventType].contractedRows = ranges[i].displayRowCollapsed + 1;
}
}
void BasicTimelineModel::BasicTimelineModelPrivate::computeExpandedLevels()
{
QHash<int, int> eventRow;
- int eventCount = startTimeData.count();
+ int eventCount = count();
for (int i = 0; i < eventCount; i++) {
- int eventId = startTimeData[i].eventId;
+ int eventId = ranges[i].eventId;
int eventType = eventDict[eventId].eventType;
if (!eventRow.contains(eventId)) {
categorySpan[eventType].empty = false;
eventRow[eventId] = categorySpan[eventType].expandedRows++;
}
- startTimeData[i].displayRowExpanded = eventRow[eventId];
+ ranges[i].displayRowExpanded = eventRow[eventId];
}
}
-void BasicTimelineModel::BasicTimelineModelPrivate::buildEndTimeList()
-{
- endTimeData.clear();
-
- int eventCount = startTimeData.count();
- for (int i = 0; i < eventCount; i++) {
- BasicTimelineModel::QmlRangeEventEndInstance endInstance = {
- i,
- startTimeData[i].startTime + startTimeData[i].duration
- };
-
- endTimeData << endInstance;
- }
-
- qSort(endTimeData.begin(), endTimeData.end(), compareEndTimes);
-}
-
void BasicTimelineModel::BasicTimelineModelPrivate::findBindingLoops()
{
typedef QPair<QString, int> CallStackEntry;
QStack<CallStackEntry> callStack;
- for (int i = 0; i < startTimeData.size(); ++i) {
- QmlRangeEventStartInstance *event = &startTimeData[i];
+ for (int i = 0; i < count(); ++i) {
+ Range *event = &ranges[i];
BasicTimelineModel::QmlRangeEventData data = eventDict.at(event->eventId);
@@ -363,14 +270,14 @@ void BasicTimelineModel::BasicTimelineModelPrivate::findBindingLoops()
continue;
const QString eventHash = eventHashes.at(event->eventId);
- const QmlRangeEventStartInstance *potentialParent = callStack.isEmpty()
- ? 0 : &startTimeData[callStack.top().second];
+ const Range *potentialParent = callStack.isEmpty()
+ ? 0 : &ranges[callStack.top().second];
while (potentialParent
- && !(potentialParent->startTime + potentialParent->duration > event->startTime)) {
+ && !(potentialParent->start + potentialParent->duration > event->start)) {
callStack.pop();
potentialParent = callStack.isEmpty() ? 0
- : &startTimeData[callStack.top().second];
+ : &ranges[callStack.top().second];
}
// check whether event is already in stack
@@ -406,12 +313,12 @@ bool BasicTimelineModel::isEmpty() const
int BasicTimelineModel::count() const
{
- return d->startTimeData.count();
+ return d->count();
}
qint64 BasicTimelineModel::lastTimeMark() const
{
- return d->startTimeData.last().startTime + d->startTimeData.last().duration;
+ return d->lastEndTime();
}
bool BasicTimelineModel::expanded(int category) const
@@ -464,95 +371,22 @@ const QString BasicTimelineModel::categoryLabel(int categoryIndex) const
int BasicTimelineModel::findFirstIndex(qint64 startTime) const
{
- int candidate = -1;
- // in the "endtime" list, find the first event that ends after startTime
- if (d->endTimeData.isEmpty())
- return -1;
- if (d->endTimeData.count() == 1 || d->endTimeData.first().endTime >= startTime)
- candidate = 0;
- else
- if (d->endTimeData.last().endTime <= startTime)
- return -1;
-
- if (candidate == -1)
- {
- int fromIndex = 0;
- int toIndex = d->endTimeData.count()-1;
- while (toIndex - fromIndex > 1) {
- int midIndex = (fromIndex + toIndex)/2;
- if (d->endTimeData[midIndex].endTime < startTime)
- fromIndex = midIndex;
- else
- toIndex = midIndex;
- }
-
- candidate = toIndex;
- }
-
- int eventIndex = d->endTimeData[candidate].startTimeIndex;
- return d->startTimeData[eventIndex].baseEventIndex;
-
+ return d->findFirstIndex(startTime);
}
int BasicTimelineModel::findFirstIndexNoParents(qint64 startTime) const
{
- int candidate = -1;
- // in the "endtime" list, find the first event that ends after startTime
- if (d->endTimeData.isEmpty())
- return -1;
- if (d->endTimeData.count() == 1 || d->endTimeData.first().endTime >= startTime)
- candidate = 0;
- else
- if (d->endTimeData.last().endTime <= startTime)
- return -1;
-
- if (candidate == -1) {
- int fromIndex = 0;
- int toIndex = d->endTimeData.count()-1;
- while (toIndex - fromIndex > 1) {
- int midIndex = (fromIndex + toIndex)/2;
- if (d->endTimeData[midIndex].endTime < startTime)
- fromIndex = midIndex;
- else
- toIndex = midIndex;
- }
-
- candidate = toIndex;
- }
-
- int ndx = d->endTimeData[candidate].startTimeIndex;
-
- return ndx;
+ return d->findFirstIndexNoParents(startTime);
}
int BasicTimelineModel::findLastIndex(qint64 endTime) const
{
- // in the "starttime" list, find the last event that starts before endtime
- if (d->startTimeData.isEmpty())
- return -1;
- if (d->startTimeData.first().startTime >= endTime)
- return -1;
- if (d->startTimeData.count() == 1)
- return 0;
- if (d->startTimeData.last().startTime <= endTime)
- return d->startTimeData.count()-1;
-
- int fromIndex = 0;
- int toIndex = d->startTimeData.count()-1;
- while (toIndex - fromIndex > 1) {
- int midIndex = (fromIndex + toIndex)/2;
- if (d->startTimeData[midIndex].startTime < endTime)
- fromIndex = midIndex;
- else
- toIndex = midIndex;
- }
-
- return fromIndex;
+ return d->findLastIndex(endTime);
}
int BasicTimelineModel::getEventType(int index) const
{
- return d->eventDict[d->startTimeData[index].eventId].eventType;
+ return d->eventDict[d->range(index).eventId].eventType;
}
int BasicTimelineModel::getEventCategory(int index) const
@@ -567,34 +401,34 @@ int BasicTimelineModel::getEventCategory(int index) const
int BasicTimelineModel::getEventRow(int index) const
{
if (d->categorySpan[getEventType(index)].expanded)
- return d->startTimeData[index].displayRowExpanded + d->categorySpan[getEventType(index)].rowStart;
+ return d->range(index).displayRowExpanded + d->categorySpan[getEventType(index)].rowStart;
else
- return d->startTimeData[index].displayRowCollapsed + d->categorySpan[getEventType(index)].rowStart;
+ return d->range(index).displayRowCollapsed + d->categorySpan[getEventType(index)].rowStart;
}
qint64 BasicTimelineModel::getDuration(int index) const
{
- return d->startTimeData[index].duration;
+ return d->range(index).duration;
}
qint64 BasicTimelineModel::getStartTime(int index) const
{
- return d->startTimeData[index].startTime;
+ return d->range(index).start;
}
qint64 BasicTimelineModel::getEndTime(int index) const
{
- return d->startTimeData[index].startTime + d->startTimeData[index].duration;
+ return d->range(index).start + d->range(index).duration;
}
int BasicTimelineModel::getEventId(int index) const
{
- return d->startTimeData[index].eventId;
+ return d->range(index).eventId;
}
int BasicTimelineModel::getBindingLoopDest(int index) const
{
- return d->startTimeData[index].bindingLoopHead;
+ return d->range(index).bindingLoopHead;
}
QColor BasicTimelineModel::getColor(int index) const
@@ -655,7 +489,7 @@ const QVariantList BasicTimelineModel::getEventDetails(int index) const
// duration
{
QVariantMap valuePair;
- valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->startTimeData[index].duration)));
+ valuePair.insert(QCoreApplication::translate(trContext, "Duration:"), QVariant(d->displayTime(d->range(index).duration)));
result << valuePair;
}
diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
index 3ffcf707ff..bdb5bf5745 100644
--- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
+++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
@@ -65,22 +65,20 @@ public:
};
struct QmlRangeEventStartInstance {
- qint64 startTime;
- qint64 duration;
+ QmlRangeEventStartInstance(int eventId = -1) :
+ eventId(eventId),
+ displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL),
+ displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL),
+ bindingLoopHead(-1) {}
+
int eventId;
// not-expanded, per type
int displayRowExpanded;
int displayRowCollapsed;
- int baseEventIndex; // used by findfirstindex
int bindingLoopHead;
};
- struct QmlRangeEventEndInstance {
- int startTimeIndex;
- qint64 endTime;
- };
-
BasicTimelineModel(QObject *parent = 0);
~BasicTimelineModel();
@@ -89,8 +87,6 @@ public:
QStringList categoryTitles() const;
QString name() const;
- const QVector<QmlRangeEventStartInstance> getData() const;
- const QVector<QmlRangeEventStartInstance> getData(qint64 fromTime, qint64 toTime) const;
void loadData();
Q_INVOKABLE int count() const;
void clear();
@@ -131,8 +127,6 @@ public:
private slots:
bool eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const;
-protected slots:
- void dataChanged();
private:
class BasicTimelineModelPrivate;
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 5fbb3307b5..555d5572e3 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -41,9 +41,6 @@
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
-#include "canvas/qdeclarativecontext2d_p.h"
-#include "canvas/qmlprofilercanvas.h"
-
#include <utils/fancymainwindow.h>
#include <utils/fileinprojectfinder.h>
#include <utils/qtcassert.h>
@@ -119,9 +116,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_profilerState = 0;
d->m_viewContainer = 0;
- qmlRegisterType<QmlProfilerCanvas>("Monitor", 1, 0, "Canvas2D");
- qmlRegisterType<Context2D>();
- qmlRegisterType<CanvasGradient>();
qmlRegisterType<TimelineRenderer>("Monitor", 1, 0,"TimelineRenderer");
d->m_profilerState = new QmlProfilerStateManager(this);
@@ -528,6 +522,8 @@ void QmlProfilerTool::profilerDataModelStateChanged()
{
switch (d->m_profilerModelManager->state()) {
case QmlProfilerDataState::Empty :
+ break;
+ case QmlProfilerDataState::ClearingData :
clearDisplay();
break;
case QmlProfilerDataState::AcquiringData :
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
index 395be21696..baa674bb8d 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -474,7 +474,8 @@ void QmlProfilerTraceView::setAppKilled()
void QmlProfilerTraceView::profilerDataModelStateChanged()
{
switch (d->m_modelManager->state()) {
- case QmlProfilerDataState::Empty:
+ case QmlProfilerDataState::Empty: break;
+ case QmlProfilerDataState::ClearingData:
emit enableToolbar(false);
break;
case QmlProfilerDataState::AcquiringData: break;
diff --git a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
index fd45bc0e47..6ce3e54d15 100644
--- a/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
+++ b/src/plugins/qmlprofiler/qv8profilerdatamodel.cpp
@@ -138,7 +138,7 @@ bool QV8ProfilerDataModel::isEmpty() const
QV8EventData *QV8ProfilerDataModel::v8EventDescription(int eventId) const
{
- foreach (QV8EventData *event, d->v8EventHash.values()) {
+ foreach (QV8EventData *event, d->v8EventHash) {
if (event->eventId == eventId)
return event;
}
@@ -235,7 +235,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
if (!v8EventHash.isEmpty()) {
double totalTimes = v8MeasuredTime;
double selfTimes = 0;
- foreach (QV8EventData *v8event, v8EventHash.values()) {
+ foreach (const QV8EventData *v8event, v8EventHash) {
selfTimes += v8event->selfTime;
}
@@ -261,7 +261,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
*v8EventHash[rootEventHash] = v8RootEvent;
}
- foreach (QV8EventData *v8event, v8EventHash.values()) {
+ foreach (QV8EventData *v8event, v8EventHash) {
v8event->totalPercent = v8event->totalTime * 100.0 / totalTimes;
v8event->SelfTimeInPercent = v8event->selfTime * 100.0 / selfTimes;
}
@@ -300,7 +300,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
{
stream.writeStartElement(QLatin1String("v8profile")); // v8 profiler output
stream.writeAttribute(QLatin1String("totalTime"), QString::number(d->v8MeasuredTime));
- foreach (QV8EventData *v8event, d->v8EventHash.values()) {
+ foreach (const QV8EventData *v8event, d->v8EventHash) {
stream.writeStartElement(QLatin1String("event"));
stream.writeAttribute(QLatin1String("index"),
QString::number(
@@ -319,7 +319,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
QStringList childrenIndexes;
QStringList childrenTimes;
QStringList parentTimes;
- foreach (QV8EventSub *v8child, v8event->childrenHash.values()) {
+ foreach (const QV8EventSub *v8child, v8event->childrenHash) {
childrenIndexes << QString::number(v8child->reference->eventId);
childrenTimes << QString::number(v8child->totalTime);
parentTimes << QString::number(v8child->totalTime);
@@ -468,7 +468,7 @@ void QV8ProfilerDataModel::load(QXmlStreamReader &stream)
}
}
// store v8 events
- foreach (QV8EventData *storedV8Event, v8eventBuffer.values()) {
+ foreach (QV8EventData *storedV8Event, v8eventBuffer) {
storedV8Event->eventHashStr =
getHashStringForV8Event(
storedV8Event->displayName, storedV8Event->functionName);
diff --git a/src/plugins/qmlprofiler/sortedtimelinemodel.cpp b/src/plugins/qmlprofiler/sortedtimelinemodel.cpp
new file mode 100644
index 0000000000..567c44981f
--- /dev/null
+++ b/src/plugins/qmlprofiler/sortedtimelinemodel.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+/*!
+ \class QmlProfiler::SortedTimelineModel
+ \brief Sorted model for timeline data
+
+ The SortedTimelineModel lets you keep any kind of range data sorted by
+ both start and end times, so that visible ranges can easily be computed.
+*/
+
+/*!
+ \fn SortedTimelineModel::clear()
+ Clears the ranges and their end times.
+*/
+
+/*!
+ \fn int SortedTimelineModel::count() const
+ Returns the number of ranges in the model.
+*/
+
+/*!
+ \fn qint64 SortedTimelineModel::firstStartTime() const
+ Returns the begin of the first range in the model.
+*/
+
+/*!
+ \fn qint64 SortedTimelineModel::lastEndTime() const
+ Returns the end of the last range in the model.
+*/
+
+/*!
+ \fn const SortedTimelineModel<Data>::Range &SortedTimelineModel::range(int index) const
+ Returns the range data at the specified index.
+*/
+
+/*!
+ \fn Data &SortedTimelineModel::data(int index)
+ Returns modifiable user data for the range at the specified index.
+*/
+
+/*!
+ \fn int SortedTimelineModel::insert(qint64 startTime, qint64 duration, const Data &item)
+ Inserts the given data at the given time position and returns its index.
+*/
+
+/*!
+ \fn int SortedTimelineModel::insertStart(qint64 startTime, const Data &item)
+ Inserts the given data as range start at the given time position and
+ returns its index. The range end isn't set.
+*/
+
+/*!
+ \fn int SortedTimelineModel::insertEnd(int index, qint64 duration)
+ Adds a range end for the given start index.
+*/
+
+/*!
+ \fn int SortedTimelineModel::findFirstIndexNoParents(qint64 startTime) const
+ Looks up the first range with an end time greater than the given time and
+ returns its index. If no such range is found it returns -1.
+*/
+
+/*!
+ \fn int SortedTimelineModel::findFirstIndex(qint64 startTime) const
+ Looks up the first range with an end time greater than the given time and
+ returns its parent's index. If no such range is found it returns -1. If there
+ is no parent it returns the found range's index. The parent of a range is the
+ range with the lowest start time that completely covers the child range.
+ "Completely covers" means:
+ parent.startTime <= child.startTime && parent.endTime >= child.endTime
+*/
+
+/*!
+ \fn int SortedTimelineModel::findLastIndex(qint64 endTime) const
+ Looks up the last range with a start time smaller than the given time and
+ returns its index. If no such range is found it returns -1.
+*/
+
+/*!
+ \fn void computeNesting()
+ Compute all ranges' parents.
+ \sa findFirstIndex
+*/
diff --git a/src/plugins/qmlprofiler/sortedtimelinemodel.h b/src/plugins/qmlprofiler/sortedtimelinemodel.h
new file mode 100644
index 0000000000..80f78f2fe2
--- /dev/null
+++ b/src/plugins/qmlprofiler/sortedtimelinemodel.h
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef SORTEDTIMELINEMODEL_H
+#define SORTEDTIMELINEMODEL_H
+
+#include <QVector>
+#include <QLinkedList>
+
+namespace QmlProfiler {
+
+template<class Data>
+class SortedTimelineModel {
+public:
+ struct Range : public Data {
+ Range() : Data(), start(-1), duration(-1), parent(-1) {}
+ Range(qint64 start, qint64 duration, const Data &item) :
+ Data(item), start(start), duration(duration), parent(-1) {}
+ qint64 start;
+ qint64 duration;
+ int parent;
+ inline qint64 timestamp() const {return start;}
+ };
+
+ struct RangeEnd {
+ RangeEnd() : startIndex(-1), end(-1) {}
+ RangeEnd(int startIndex, qint64 end) :
+ startIndex(startIndex), end(end) {}
+ int startIndex;
+ qint64 end;
+ inline qint64 timestamp() const {return end;}
+ };
+
+ void clear()
+ {
+ ranges.clear();
+ endTimes.clear();
+ }
+
+ inline int count() const { return ranges.count(); }
+
+ inline qint64 lastEndTime() const { return endTimes.last().end; }
+ inline qint64 firstStartTime() const { return ranges.first().start; }
+
+ inline const Range &range(int index) { return ranges[index]; }
+ inline Data &data(int index) { return ranges[index]; }
+
+ inline int insert(qint64 startTime, qint64 duration, const Data &item)
+ {
+ /* Doing insert-sort here is preferable as most of the time the times will actually be
+ * presorted in the right way. So usually this will just result in appending. */
+ int index = insertSorted(ranges, Range(startTime, duration, item));
+ insertSorted(endTimes, RangeEnd(index, startTime + duration));
+ return index;
+ }
+
+ inline int insertStart(qint64 startTime, const Data &item)
+ {
+ return insertSorted(ranges, Range(startTime, 0, item));
+ }
+
+ inline void insertEnd(int index, qint64 duration)
+ {
+ ranges[index].duration = duration;
+ insertSorted(endTimes, RangeEnd(index, ranges[index].start + duration));
+ }
+
+ inline int findFirstIndex(qint64 startTime) const
+ {
+ int index = findFirstIndexNoParents(startTime);
+ if (index == -1)
+ return -1;
+ int parent = ranges[index].parent;
+ return parent == -1 ? index : parent;
+ }
+
+ inline int findFirstIndexNoParents(qint64 startTime) const
+ {
+ // in the "endtime" list, find the first event that ends after startTime
+ if (endTimes.isEmpty())
+ return -1;
+ if (endTimes.count() == 1 || endTimes.first().end >= startTime)
+ return endTimes.first().startIndex;
+ if (endTimes.last().end <= startTime)
+ return -1;
+
+ return endTimes[lowerBound(endTimes, startTime) + 1].startIndex;
+ }
+
+ inline int findLastIndex(qint64 endTime) const
+ {
+ // in the "starttime" list, find the last event that starts before endtime
+ if (ranges.isEmpty() || ranges.first().start >= endTime)
+ return -1;
+ if (ranges.count() == 1)
+ return 0;
+ if (ranges.last().start <= endTime)
+ return ranges.count() - 1;
+
+ return lowerBound(ranges, endTime);
+ }
+
+ inline void computeNesting()
+ {
+ QLinkedList<int> parents;
+ for (int range = 0; range != count(); ++range) {
+ Range &current = ranges[range];
+ for (QLinkedList<int>::iterator parent = parents.begin(); parent != parents.end();) {
+ qint64 parentEnd = ranges[*parent].start + ranges[*parent].duration;
+ if (parentEnd < current.start) {
+ parent = parents.erase(parent);
+ } else if (parentEnd >= current.start + current.duration) {
+ current.parent = *parent;
+ break;
+ } else {
+ ++parent;
+ }
+ }
+ parents.append(range);
+ }
+ }
+
+protected:
+ template<typename RangeDelimiter>
+ static inline int insertSorted(QVector<RangeDelimiter> &container, const RangeDelimiter &item)
+ {
+ for (int i = container.count();;) {
+ if (i == 0) {
+ container.prepend(item);
+ return 0;
+ }
+ if (container[--i].timestamp() <= item.timestamp()) {
+ container.insert(++i, item);
+ return i;
+ }
+ }
+ }
+
+ template<typename RangeDelimiter>
+ static inline int lowerBound(const QVector<RangeDelimiter> container, qint64 time)
+ {
+ int fromIndex = 0;
+ int toIndex = container.count() - 1;
+ while (toIndex - fromIndex > 1) {
+ int midIndex = (fromIndex + toIndex)/2;
+ if (container[midIndex].timestamp() < time)
+ fromIndex = midIndex;
+ else
+ toIndex = midIndex;
+ }
+
+ return fromIndex;
+ }
+
+ QVector<Range> ranges;
+ QVector<RangeEnd> endTimes;
+};
+
+}
+
+#endif
diff --git a/src/plugins/qmlprojectmanager/qmlapp.cpp b/src/plugins/qmlprojectmanager/qmlapp.cpp
index 39fd652911..3e774f94c3 100644
--- a/src/plugins/qmlprojectmanager/qmlapp.cpp
+++ b/src/plugins/qmlprojectmanager/qmlapp.cpp
@@ -154,7 +154,6 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
static const QLatin1String tag_template("template");
static const QLatin1String tag_displayName("displayname");
static const QLatin1String tag_description("description");
- static const QLatin1String attribute_id("id");
static const QLatin1String attribute_featuresRequired("featuresRequired");
static const QLatin1String attribute_openEditor("openeditor");
static const QLatin1String attribute_priority("priority");
@@ -169,9 +168,6 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
if (reader.attributes().hasAttribute(attribute_priority))
info->priority = reader.attributes().value(attribute_priority).toString();
- if (reader.attributes().hasAttribute(attribute_id))
- info->wizardId = reader.attributes().value(attribute_id).toString();
-
if (reader.attributes().hasAttribute(attribute_featuresRequired))
info->featuresRequired = reader.attributes().value(attribute_featuresRequired).toString();
diff --git a/src/plugins/qmlprojectmanager/qmlapp.h b/src/plugins/qmlprojectmanager/qmlapp.h
index 9dd566689b..a47bedc6c1 100644
--- a/src/plugins/qmlprojectmanager/qmlapp.h
+++ b/src/plugins/qmlprojectmanager/qmlapp.h
@@ -47,7 +47,6 @@ public:
QString displayName;
QString description;
QString openFile;
- QString wizardId;
QString featuresRequired;
QString priority;
};
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 10d495c467..7d72d08846 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -111,6 +111,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
m_modelManager(QmlJS::ModelManagerInterface::instance()),
m_activeTarget(0)
{
+ setId("QmlProjectManager.QmlProject");
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
@@ -324,11 +325,6 @@ QString QmlProject::displayName() const
return m_projectName;
}
-Id QmlProject::id() const
-{
- return "QmlProjectManager.QmlProject";
-}
-
IDocument *QmlProject::document() const
{
return m_file;
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index 8e931a9a02..faa060664f 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -61,7 +61,6 @@ public:
QString filesFileName() const;
QString displayName() const;
- Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
diff --git a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
index bbf8165091..d35faf01b9 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
@@ -176,7 +176,11 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> QmlProjectNode::supportedActi
QList<ProjectAction> actions;
actions.append(AddNewFile);
actions.append(EraseFile);
- actions.append(Rename);
+ if (node->nodeType() == ProjectExplorer::FileNodeType) {
+ ProjectExplorer::FileNode *fileNode = static_cast<ProjectExplorer::FileNode *>(node);
+ if (fileNode->fileType() != ProjectExplorer::ProjectFileType)
+ actions.append(Rename);
+ }
return actions;
}
diff --git a/src/plugins/qnx/bardescriptoreditorfactory.cpp b/src/plugins/qnx/bardescriptoreditorfactory.cpp
index 5d9a6cdbef..5cba705085 100644
--- a/src/plugins/qnx/bardescriptoreditorfactory.cpp
+++ b/src/plugins/qnx/bardescriptoreditorfactory.cpp
@@ -44,8 +44,8 @@ using namespace Qnx::Internal;
class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler
{
public:
- BarDescriptorActionHandler()
- : TextEditor::TextEditorActionHandler(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT)
+ BarDescriptorActionHandler(QObject *parent)
+ : TextEditor::TextEditorActionHandler(parent, Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT)
{
}
protected:
@@ -58,20 +58,15 @@ protected:
BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
: Core::IEditorFactory(parent)
- , m_actionHandler(new BarDescriptorActionHandler)
{
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
setDisplayName(tr("Bar descriptor editor"));
addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
-}
-
-BarDescriptorEditorFactory::~BarDescriptorEditorFactory()
-{
- delete m_actionHandler;
+ new BarDescriptorActionHandler(this);
}
Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent)
{
- BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(parent, m_actionHandler);
+ BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(parent);
return editorWidget->editor();
}
diff --git a/src/plugins/qnx/bardescriptoreditorfactory.h b/src/plugins/qnx/bardescriptoreditorfactory.h
index ed5a012d6a..fac30e7920 100644
--- a/src/plugins/qnx/bardescriptoreditorfactory.h
+++ b/src/plugins/qnx/bardescriptoreditorfactory.h
@@ -34,10 +34,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
-namespace TextEditor {
-class TextEditorActionHandler;
-}
-
namespace Qnx {
namespace Internal {
@@ -47,12 +43,8 @@ class BarDescriptorEditorFactory : public Core::IEditorFactory
public:
explicit BarDescriptorEditorFactory(QObject *parent = 0);
- ~BarDescriptorEditorFactory();
Core::IEditor *createEditor(QWidget *parent);
-
-private:
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp
index 5d069112a8..0d3ceb65af 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.cpp
+++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp
@@ -45,18 +45,15 @@
#include <projectexplorer/iprojectproperties.h>
#include <projectexplorer/projectwindow.h>
#include <texteditor/plaintexteditor.h>
-#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h>
using namespace Qnx;
using namespace Qnx::Internal;
-BarDescriptorEditorWidget::BarDescriptorEditorWidget(
- QWidget *parent, TextEditor::TextEditorActionHandler *handler)
+BarDescriptorEditorWidget::BarDescriptorEditorWidget(QWidget *parent)
: QStackedWidget(parent)
, m_editor(0)
- , m_handler(handler)
, m_dirty(false)
{
Core::IContext *myContext = new Core::IContext(this);
@@ -161,7 +158,6 @@ void BarDescriptorEditorWidget::initSourcePage()
addWidget(m_xmlSourceWidget);
TextEditor::TextEditorSettings::initializeEditor(m_xmlSourceWidget);
- m_handler->setupActions(m_xmlSourceWidget);
m_xmlSourceWidget->configure(QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE));
connect(m_xmlSourceWidget, SIGNAL(textChanged()), this, SLOT(setDirty()));
}
@@ -224,7 +220,7 @@ TextEditor::BaseTextEditorWidget *BarDescriptorEditorWidget::sourceWidget() cons
void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
{
- Core::IDocument *doc = m_xmlSourceWidget->editorDocument();
+ Core::IDocument *doc = m_xmlSourceWidget->baseTextDocument();
if (doc) {
doc->setFilePath(filePath);
// setFilePath() call leads to a textChanged() signal emitted
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.h b/src/plugins/qnx/bardescriptoreditorwidget.h
index 8e5edc69e6..4f1314d5e9 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.h
+++ b/src/plugins/qnx/bardescriptoreditorwidget.h
@@ -46,7 +46,6 @@ class PanelsWidget;
namespace TextEditor {
class PlainTextEditorWidget;
-class TextEditorActionHandler;
class BaseTextEditorWidget;
}
@@ -67,7 +66,7 @@ class BarDescriptorEditorWidget : public QStackedWidget
Q_OBJECT
public:
- explicit BarDescriptorEditorWidget(QWidget *parent, TextEditor::TextEditorActionHandler *handler);
+ explicit BarDescriptorEditorWidget(QWidget *parent);
Core::IEditor *editor() const;
@@ -107,7 +106,6 @@ private:
mutable Core::IEditor *m_editor;
- TextEditor::TextEditorActionHandler *m_handler;
bool m_dirty;
// New UI
diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp b/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp
new file mode 100644
index 0000000000..3094913a8d
--- /dev/null
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstep.cpp
@@ -0,0 +1,156 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+**
+** Contact: BlackBerry (qt@blackberry.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberrycheckdebugtokenstep.h"
+
+#include "blackberrycheckdebugtokenstepconfigwidget.h"
+#include "blackberrydeviceinformation.h"
+#include "qnxconstants.h"
+
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <projectexplorer/task.h>
+#include <ssh/sshconnection.h>
+
+#include <qeventloop.h>
+
+using namespace Qnx;
+using namespace Qnx::Internal;
+
+BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl) :
+ ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID))
+ , m_deviceInfo(0)
+ , m_eventLoop(0)
+{
+ setDisplayName(tr("Check Debug Token"));
+}
+
+BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs) :
+ ProjectExplorer::BuildStep(bsl, bs)
+ , m_deviceInfo(0)
+ , m_eventLoop(0)
+{
+ setDisplayName(tr("Check Debug Token"));
+}
+
+void BlackBerryCheckDebugTokenStep::checkDeviceInfo(int status)
+{
+ // Skip debug token check for internal non secure devices and simulators
+ if (m_deviceInfo->isProductionDevice() && !m_deviceInfo->isSimulator()) {
+ if (status != BlackBerryDeviceInformation::Success) {
+ switch (status) {
+ case BlackBerryDeviceInformation::AuthenticationFailed:
+ raiseError(tr("Authentication failed."));
+ break;
+ case BlackBerryDeviceInformation::NoRouteToHost:
+ raiseError(tr("Cannot connect to device."));
+ break;
+ case BlackBerryDeviceInformation::DevelopmentModeDisabled:
+ raiseError(tr("Device is not in the development mode."));
+ break;
+ case BlackBerryDeviceInformation::InferiorProcessTimedOut:
+ raiseError(tr("Timeout querying device information."));
+ break;
+ case BlackBerryDeviceInformation::FailedToStartInferiorProcess:
+ raiseError(tr("Failed to query device information."));
+ break;
+ case BlackBerryDeviceInformation::InferiorProcessCrashed:
+ raiseError(tr("Process to query device information has crashed."));
+ break;
+ default:
+ raiseError(tr("Cannot query device information."));
+ break;
+ }
+ m_eventLoop->exit(false);
+ return;
+ }
+
+ if (!m_deviceInfo->debugTokenValid()) {
+ raiseError(m_deviceInfo->debugTokenValidationError());
+ m_eventLoop->exit(false);
+ return;
+ }
+ }
+
+ m_eventLoop->exit(true);
+}
+
+void BlackBerryCheckDebugTokenStep::emitOutputInfo()
+{
+ emit addOutput(tr("Checking debug token..."), BuildStep::MessageOutput);
+}
+
+bool BlackBerryCheckDebugTokenStep::init()
+{
+ m_device = BlackBerryDeviceConfiguration::device(target()->kit());
+ if (!m_device)
+ return false;
+
+ if (m_device->sshParameters().host.isEmpty()) {
+ raiseError(tr("No hostname specified for the device"));
+ return false;
+ }
+
+ return true;
+}
+
+void BlackBerryCheckDebugTokenStep::run(QFutureInterface<bool> &fi)
+{
+ m_eventLoop = new QEventLoop;
+ m_deviceInfo = new BlackBerryDeviceInformation;
+
+ connect(m_deviceInfo, SIGNAL(started()), this, SLOT(emitOutputInfo()));
+ connect(m_deviceInfo, SIGNAL(finished(int)), this, SLOT(checkDeviceInfo(int)), Qt::DirectConnection);
+ m_deviceInfo->setDeviceTarget(m_device->sshParameters().host, m_device->sshParameters().password);
+
+ bool returnValue = m_eventLoop->exec();
+
+ delete m_eventLoop;
+ m_eventLoop = 0;
+
+ delete m_deviceInfo;
+ m_deviceInfo = 0;
+
+ return fi.reportResult(returnValue);
+}
+
+ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDebugTokenStep::createConfigWidget()
+{
+ return new BlackBerryCheckDebugTokenConfigWidget();
+}
+
+void BlackBerryCheckDebugTokenStep::raiseError(const QString &errorMessage)
+{
+ emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
+ emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
+ ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
+}
diff --git a/src/plugins/qnx/blackberrycheckdebugtokenstep.h b/src/plugins/qnx/blackberrycheckdebugtokenstep.h
new file mode 100644
index 0000000000..84152499fe
--- /dev/null
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstep.h
@@ -0,0 +1,77 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+**
+** Contact: BlackBerry (qt@blackberry.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
+#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
+
+#include "blackberrydeviceconfiguration.h"
+
+#include <projectexplorer/buildstep.h>
+
+QT_BEGIN_NAMESPACE
+class QEventLoop;
+QT_END_NAMESPACE
+
+namespace Qnx {
+namespace Internal {
+
+class BlackBerryDeviceInformation;
+class BlackBerryCheckDebugTokenStep : public ProjectExplorer::BuildStep
+{
+ Q_OBJECT
+ friend class BlackBerryCheckDebugTokenStepFactory;
+
+public:
+ explicit BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl);
+
+ bool init();
+ void run(QFutureInterface<bool> &fi);
+ ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
+
+ void raiseError(const QString& error);
+
+protected:
+ BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs);
+
+protected slots:
+ void checkDeviceInfo(int status);
+ void emitOutputInfo();
+
+private:
+ BlackBerryDeviceInformation *m_deviceInfo;
+ BlackBerryDeviceConfiguration::ConstPtr m_device;
+ QEventLoop *m_eventLoop;
+};
+
+} // namespace Internal
+} // namespace Qnx
+
+#endif // QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
diff --git a/src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.cpp b/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp
index a6bb9fbfad..de372497bd 100644
--- a/src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.cpp
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.cpp
@@ -29,27 +29,27 @@
**
****************************************************************************/
-#include "blackberrycheckdevmodestepconfigwidget.h"
+#include "blackberrycheckdebugtokenstepconfigwidget.h"
using namespace Qnx;
using namespace Qnx::Internal;
-BlackBerryCheckDevModeStepConfigWidget::BlackBerryCheckDevModeStepConfigWidget() :
+BlackBerryCheckDebugTokenConfigWidget::BlackBerryCheckDebugTokenConfigWidget() :
ProjectExplorer::BuildStepConfigWidget()
{
}
-QString BlackBerryCheckDevModeStepConfigWidget::displayName() const
+QString BlackBerryCheckDebugTokenConfigWidget::displayName() const
{
- return tr("<b>Check development mode</b>");
+ return tr("<b>Check debug token</b>");
}
-QString BlackBerryCheckDevModeStepConfigWidget::summaryText() const
+QString BlackBerryCheckDebugTokenConfigWidget::summaryText() const
{
return displayName();
}
-bool BlackBerryCheckDevModeStepConfigWidget::showWidget() const
+bool BlackBerryCheckDebugTokenConfigWidget::showWidget() const
{
return false;
}
diff --git a/src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.h b/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h
index cf14780666..f092754172 100644
--- a/src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.h
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstepconfigwidget.h
@@ -29,19 +29,19 @@
**
****************************************************************************/
-#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
-#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
+#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
+#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
-class BlackBerryCheckDevModeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
+class BlackBerryCheckDebugTokenConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
- explicit BlackBerryCheckDevModeStepConfigWidget();
+ explicit BlackBerryCheckDebugTokenConfigWidget();
QString displayName() const;
QString summaryText() const;
diff --git a/src/plugins/qnx/blackberrycheckdevmodestepfactory.cpp b/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp
index 58d69de160..3185f2c306 100644
--- a/src/plugins/qnx/blackberrycheckdevmodestepfactory.cpp
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.cpp
@@ -29,9 +29,9 @@
**
****************************************************************************/
-#include "blackberrycheckdevmodestepfactory.h"
+#include "blackberrycheckdebugtokenstepfactory.h"
-#include "blackberrycheckdevmodestep.h"
+#include "blackberrycheckdebugtokenstep.h"
#include "blackberrydeviceconfigurationfactory.h"
#include "qnxconstants.h"
@@ -43,12 +43,12 @@
using namespace Qnx;
using namespace Qnx::Internal;
-BlackBerryCheckDevModeStepFactory::BlackBerryCheckDevModeStepFactory(QObject *parent) :
+BlackBerryCheckDebugTokenStepFactory::BlackBerryCheckDebugTokenStepFactory(QObject *parent) :
ProjectExplorer::IBuildStepFactory(parent)
{
}
-QList<Core::Id> BlackBerryCheckDevModeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
+QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
return QList<Core::Id>();
@@ -57,52 +57,52 @@ QList<Core::Id> BlackBerryCheckDevModeStepFactory::availableCreationIds(ProjectE
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return QList<Core::Id>();
- return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID);
+ return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID);
}
-QString BlackBerryCheckDevModeStepFactory::displayNameForId(const Core::Id id) const
+QString BlackBerryCheckDebugTokenStepFactory::displayNameForId(const Core::Id id) const
{
- if (id == Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID)
- return tr("Check Development Mode");
+ if (id == Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID)
+ return tr("Check Debug Token");
return QString();
}
-bool BlackBerryCheckDevModeStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
+bool BlackBerryCheckDebugTokenStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
-ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
+ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
- return new BlackBerryCheckDevModeStep(parent);
+ return new BlackBerryCheckDebugTokenStep(parent);
}
-bool BlackBerryCheckDevModeStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
+bool BlackBerryCheckDebugTokenStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
-ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
+ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
- BlackBerryCheckDevModeStep *bs = new BlackBerryCheckDevModeStep(parent);
+ BlackBerryCheckDebugTokenStep *bs = new BlackBerryCheckDebugTokenStep(parent);
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
-bool BlackBerryCheckDevModeStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
+bool BlackBerryCheckDebugTokenStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
{
return canCreate(parent, product->id());
}
-ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
+ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
{
if (!canClone(parent, product))
return 0;
- return new BlackBerryCheckDevModeStep(parent, static_cast<BlackBerryCheckDevModeStep *>(product));
+ return new BlackBerryCheckDebugTokenStep(parent, static_cast<BlackBerryCheckDebugTokenStep *>(product));
}
diff --git a/src/plugins/qnx/blackberrycheckdevmodestepfactory.h b/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h
index f028fd9a7c..36683130e2 100644
--- a/src/plugins/qnx/blackberrycheckdevmodestepfactory.h
+++ b/src/plugins/qnx/blackberrycheckdebugtokenstepfactory.h
@@ -29,19 +29,19 @@
**
****************************************************************************/
-#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
-#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
+#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
+#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
-class BlackBerryCheckDevModeStepFactory : public ProjectExplorer::IBuildStepFactory
+class BlackBerryCheckDebugTokenStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
- explicit BlackBerryCheckDevModeStepFactory(QObject *parent = 0);
+ explicit BlackBerryCheckDebugTokenStepFactory(QObject *parent = 0);
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(const Core::Id id) const;
diff --git a/src/plugins/qnx/blackberrycheckdevmodestep.cpp b/src/plugins/qnx/blackberrycheckdevmodestep.cpp
deleted file mode 100644
index 93e45087f9..0000000000
--- a/src/plugins/qnx/blackberrycheckdevmodestep.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-**
-** Contact: BlackBerry (qt@blackberry.com)
-** Contact: KDAB (info@kdab.com)
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** 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, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "blackberrycheckdevmodestep.h"
-
-#include "blackberrycheckdevmodestepconfigwidget.h"
-#include "blackberrydeviceconfiguration.h"
-#include "qnxconstants.h"
-
-#include <projectexplorer/buildconfiguration.h>
-#include <projectexplorer/target.h>
-#include <ssh/sshconnection.h>
-
-using namespace Qnx;
-using namespace Qnx::Internal;
-
-BlackBerryCheckDevModeStep::BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl) :
- BlackBerryAbstractDeployStep(bsl, Core::Id(Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID))
-{
- setDisplayName(tr("Check Development Mode"));
-}
-
-BlackBerryCheckDevModeStep::BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDevModeStep *bs) :
- BlackBerryAbstractDeployStep(bsl, bs)
-{
- setDisplayName(tr("Check Development Mode"));
-}
-
-bool BlackBerryCheckDevModeStep::init()
-{
- if (!BlackBerryAbstractDeployStep::init())
- return false;
-
- QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
- if (deployCmd.isEmpty()) {
- raiseError(tr("Could not find command '%1' in the build environment")
- .arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)));
- return false;
- }
-
- BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
- QString deviceHost = device ? device->sshParameters().host : QString();
- if (deviceHost.isEmpty()) {
- raiseError(tr("No hostname specified for device"));
- return false;
- }
-
- QStringList args;
- args << QLatin1String("-listDeviceInfo");
- args << deviceHost;
- if (!device->sshParameters().password.isEmpty()) {
- args << QLatin1String("-password");
- args << device->sshParameters().password;
- }
-
- addCommand(deployCmd, args);
-
- return true;
-}
-
-ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDevModeStep::createConfigWidget()
-{
- return new BlackBerryCheckDevModeStepConfigWidget();
-}
-
-QString BlackBerryCheckDevModeStep::password() const
-{
- BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
- return device ? device->sshParameters().password : QString();
-}
-
-void BlackBerryCheckDevModeStep::processStarted(const ProjectExplorer::ProcessParameters &params)
-{
- QString arguments = params.prettyArguments();
- if (!password().isEmpty()) {
- const QString passwordLine = QLatin1String(" -password ") + password();
- const QString hiddenPasswordLine = QLatin1String(" -password <hidden>");
- arguments.replace(passwordLine, hiddenPasswordLine);
- }
-
- emitOutputInfo(params, arguments);
-}
diff --git a/src/plugins/qnx/blackberryconfiguration.cpp b/src/plugins/qnx/blackberryconfiguration.cpp
index 9125b07a62..3ddf893d99 100644
--- a/src/plugins/qnx/blackberryconfiguration.cpp
+++ b/src/plugins/qnx/blackberryconfiguration.cpp
@@ -33,7 +33,8 @@
#include "blackberryqtversion.h"
#include "qnxtoolchain.h"
-#include "qnxutils.h"
+
+#include <utils/qtcassert.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/kitmanager.h>
@@ -50,6 +51,8 @@
#include <debugger/debuggeritemmanager.h>
#include <debugger/debuggerkitinformation.h>
+#include <coreplugin/icore.h>
+
#include <QFileInfo>
#include <QDir>
#include <QMessageBox>
@@ -62,14 +65,30 @@ using namespace Debugger;
namespace Qnx {
namespace Internal {
-BlackBerryConfiguration::BlackBerryConfiguration(const FileName &ndkEnvFile, bool isAutoDetected,
- const QString &displayName)
+BlackBerryConfiguration::BlackBerryConfiguration(const NdkInstallInformation &ndkInstallInfo)
+ : m_isAutoDetected(true)
+{
+ QString envFilePath = QnxUtils::envFilePath(ndkInstallInfo.path, ndkInstallInfo.version);
+ QTC_ASSERT(!envFilePath.isEmpty(), return);
+ m_ndkEnvFile = Utils::FileName::fromString(envFilePath);
+ m_displayName = ndkInstallInfo.name;
+ m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
+ QString sep = QString::fromLatin1("/qnx6");
+ // The QNX_TARGET value is using Unix-like separator on all platforms.
+ m_targetName = ndkInstallInfo.target.split(sep).first().split(QLatin1Char('/')).last();
+ m_qnxHost = ndkInstallInfo.host;
+ m_sysRoot = FileName::fromString(ndkInstallInfo.target);
+ m_version = BlackBerryVersionNumber(ndkInstallInfo.version);
+ ctor();
+}
+
+BlackBerryConfiguration::BlackBerryConfiguration(const FileName &ndkEnvFile)
+ : m_isAutoDetected(false)
{
- Q_ASSERT(!QFileInfo(ndkEnvFile.toString()).isDir());
+ QTC_ASSERT(!QFileInfo(ndkEnvFile.toString()).isDir(), return);
m_ndkEnvFile = ndkEnvFile;
- m_isAutoDetected = isAutoDetected;
- QString ndkPath = ndkEnvFile.parentDir().toString();
- m_displayName = displayName.isEmpty() ? ndkPath.split(QDir::separator()).last() : displayName;
+ QString ndkPath = m_ndkEnvFile.parentDir().toString();
+ m_displayName = ndkPath.split(QDir::separator()).last();
m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
QString ndkTarget;
@@ -89,6 +108,15 @@ BlackBerryConfiguration::BlackBerryConfiguration(const FileName &ndkEnvFile, boo
if (QDir(ndkTarget).exists())
m_sysRoot = FileName::fromString(ndkTarget);
+ m_version = BlackBerryVersionNumber::fromNdkEnvFileName(QFileInfo(m_ndkEnvFile.toString()).baseName());
+ if (m_version.isEmpty())
+ m_version = BlackBerryVersionNumber::fromTargetName(m_targetName);
+
+ ctor();
+}
+
+void BlackBerryConfiguration::ctor()
+{
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qmake")));
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qt5/qmake")));
FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qcc")));
@@ -131,6 +159,11 @@ QString BlackBerryConfiguration::qnxHost() const
return m_qnxHost;
}
+BlackBerryVersionNumber BlackBerryConfiguration::version() const
+{
+ return m_version;
+}
+
bool BlackBerryConfiguration::isAutoDetected() const
{
return m_isAutoDetected;
@@ -138,7 +171,13 @@ bool BlackBerryConfiguration::isAutoDetected() const
bool BlackBerryConfiguration::isActive() const
{
- return !findRegisteredQtVersions().isEmpty();
+ foreach (Kit *kit, KitManager::kits()) {
+ if (kit->isAutoDetected() &&
+ kit->autoDetectionSource() == m_ndkEnvFile.toString())
+ return true;
+ }
+
+ return false;
}
bool BlackBerryConfiguration::isValid() const
@@ -246,6 +285,7 @@ Kit *BlackBerryConfiguration::createKit(
kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON)));
kit->setAutoDetected(true);
+ kit->setAutoDetectionSource(m_ndkEnvFile.toString());
kit->setMutable(DeviceKitInformation::id(), true);
kit->setSticky(QtKitInformation::id(), true);
@@ -278,7 +318,7 @@ bool BlackBerryConfiguration::activate()
if (!m_simulatorDebugger.isEmpty())
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Simulator.");
- QMessageBox::warning(0, tr("Cannot Set up BB10 Configuration"),
+ QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Set up BB10 Configuration"),
errorMessage, QMessageBox::Ok);
return false;
}
@@ -339,50 +379,24 @@ bool BlackBerryConfiguration::activate()
return true;
}
-QList<BaseQtVersion *> BlackBerryConfiguration::findRegisteredQtVersions() const
-{
- QList<BaseQtVersion *> versions;
- foreach (BaseQtVersion *version, QtVersionManager::versions()) {
- if (version->type() == QLatin1String(Constants::QNX_BB_QT)) {
- QnxAbstractQtVersion *qnxVersion = dynamic_cast<QnxAbstractQtVersion *>(version);
- if (qnxVersion && qnxVersion->isAutodetected()
- && (qnxVersion->qmakeCommand() == qmake4BinaryFile()
- || qnxVersion->qmakeCommand() == qmake5BinaryFile()))
- versions << qnxVersion;
- }
- }
- return versions;
-}
-
void BlackBerryConfiguration::deactivate()
{
- QList<BaseQtVersion *> versions = findRegisteredQtVersions();
- QList<ToolChain *> toolChains;
foreach (Kit *kit, KitManager::kits()) {
- if (kit->isAutoDetected()) {
+ if (kit->isAutoDetected() &&
+ kit->autoDetectionSource() == ndkEnvFile().toString()) {
BaseQtVersion *version = QtKitInformation::qtVersion(kit);
- if (versions.contains(version)) {
- ToolChain *toolChain = ToolChainKitInformation::toolChain(kit);
- if (toolChain)
- toolChains << toolChain;
- KitManager::deregisterKit(kit);
- }
+ ToolChain *toolChain = ToolChainKitInformation::toolChain(kit);
+ const DebuggerItem *debugger = DebuggerKitInformation::debugger(kit);
+ if (version)
+ QtVersionManager::removeVersion(version);
+ if (toolChain)
+ ToolChainManager::deregisterToolChain(toolChain);
+ if (debugger)
+ DebuggerItemManager::deregisterDebugger(debugger->id());
+
+ KitManager::deregisterKit(kit);
}
}
-
- foreach (const DebuggerItem &item, DebuggerItemManager::debuggers())
- if (item.isAutoDetected() &&
- (item.command() == m_simulatorDebugger || item.command() == m_deviceDebugger))
- DebuggerItemManager::deregisterDebugger(item.id());
-
- foreach (ToolChain *toolChain, ToolChainManager::toolChains())
- if (toolChain->isAutoDetected()
- && (toolChains.contains(toolChain) || toolChain->compilerCommand() == m_gccCompiler))
- ToolChainManager::deregisterToolChain(toolChain);
-
- foreach (BaseQtVersion *version, versions)
- QtVersionManager::removeVersion(version);
-
}
} // namespace Internal
diff --git a/src/plugins/qnx/blackberryconfiguration.h b/src/plugins/qnx/blackberryconfiguration.h
index 1b31d186b3..8bc2c4ee1c 100644
--- a/src/plugins/qnx/blackberryconfiguration.h
+++ b/src/plugins/qnx/blackberryconfiguration.h
@@ -32,6 +32,8 @@
#ifndef BLACKBERRYCONFIGURATIONS_H
#define BLACKBERRYCONFIGURATIONS_H
+#include "qnxutils.h"
+#include "blackberryversionnumber.h"
#include "qnxconstants.h"
#include <utils/environment.h>
@@ -60,13 +62,15 @@ class BlackBerryConfiguration
{
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::BlackBerryConfiguration)
public:
- BlackBerryConfiguration(const Utils::FileName &ndkEnvFile, bool isAutoDetected, const QString &displayName = QString());
+ BlackBerryConfiguration(const NdkInstallInformation &ndkInstallInfo);
+ BlackBerryConfiguration(const Utils::FileName &ndkEnvFile);
bool activate();
void deactivate();
QString ndkPath() const;
QString displayName() const;
QString targetName() const;
QString qnxHost() const;
+ BlackBerryVersionNumber version() const;
bool isAutoDetected() const;
bool isActive() const;
bool isValid() const;
@@ -84,6 +88,7 @@ private:
QString m_targetName;
QString m_qnxHost;
bool m_isAutoDetected;
+ BlackBerryVersionNumber m_version;
Utils::FileName m_ndkEnvFile;
Utils::FileName m_qmake4BinaryFile;
Utils::FileName m_qmake5BinaryFile;
@@ -93,6 +98,7 @@ private:
Utils::FileName m_sysRoot;
QList<Utils::EnvironmentItem> m_qnxEnv;
+ void ctor();
QnxAbstractQtVersion* createQtVersion(
const Utils::FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName);
QnxToolChain* createToolChain(
@@ -102,7 +108,6 @@ private:
ProjectExplorer::Kit* createKit(
QnxAbstractQtVersion* version, QnxToolChain* toolChain,
const QVariant &debuggerItemId);
- QList<QtSupport::BaseQtVersion *> findRegisteredQtVersions() const;
};
} // namespace Internal
diff --git a/src/plugins/qnx/blackberryconfigurationmanager.cpp b/src/plugins/qnx/blackberryconfigurationmanager.cpp
index 7af64cc3d0..2725c13cd2 100644
--- a/src/plugins/qnx/blackberryconfigurationmanager.cpp
+++ b/src/plugins/qnx/blackberryconfigurationmanager.cpp
@@ -49,6 +49,8 @@
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtkitinformation.h>
+#include <debugger/debuggerkitinformation.h>
+
#include <QMessageBox>
#include <QFileInfo>
@@ -61,11 +63,15 @@ namespace {
const QLatin1String SettingsGroup("BlackBerryConfiguration");
const QLatin1String NDKLocationKey("NDKLocation"); // For 10.1 NDK support (< QTC 3.0)
const QLatin1String NDKEnvFileKey("NDKEnvFile");
-const QLatin1String CertificateGroup("Certificates");
const QLatin1String ManualNDKsGroup("ManualNDKs");
const QLatin1String ActiveNDKsGroup("ActiveNDKs");
}
+static bool sortConfigurationsByVersion(const BlackBerryConfiguration *a, const BlackBerryConfiguration *b)
+{
+ return a->version() > b->version();
+}
+
BlackBerryConfigurationManager::BlackBerryConfigurationManager(QObject *parent)
:QObject(parent)
{
@@ -90,8 +96,7 @@ void BlackBerryConfigurationManager::loadManualConfigurations()
ndkEnvPath = QnxUtils::envFilePath(ndkPath);
}
- BlackBerryConfiguration *config = new BlackBerryConfiguration(Utils::FileName::fromString(ndkEnvPath),
- false);
+ BlackBerryConfiguration *config = new BlackBerryConfiguration(Utils::FileName::fromString(ndkEnvPath));
if (!addConfiguration(config))
delete config;
@@ -106,9 +111,7 @@ void BlackBerryConfigurationManager::loadAutoDetectedConfigurations()
{
QStringList activePaths = activeConfigurationNdkEnvPaths();
foreach (const NdkInstallInformation &ndkInfo, QnxUtils::installedNdks()) {
- QString envFilePath = QnxUtils::envFilePath(ndkInfo.path, ndkInfo.version);
- BlackBerryConfiguration *config = new BlackBerryConfiguration(Utils::FileName::fromString(envFilePath),
- true, ndkInfo.name);
+ BlackBerryConfiguration *config = new BlackBerryConfiguration(ndkInfo);
if (!addConfiguration(config)) {
delete config;
continue;
@@ -211,6 +214,23 @@ void BlackBerryConfigurationManager::clearInvalidConfigurations()
}
}
+void BlackBerryConfigurationManager::setKitsAutoDetectionSource()
+{
+ foreach (Kit *kit, KitManager::kits()) {
+ if (kit->isAutoDetected() &&
+ (DeviceTypeKitInformation::deviceTypeId(kit) == Constants::QNX_BB_CATEGORY_ICON) &&
+ kit->autoDetectionSource().isEmpty()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
+ foreach (BlackBerryConfiguration *config, m_configs) {
+ if ((version &&
+ (version->qmakeCommand() == config->qmake4BinaryFile() || version->qmakeCommand() == config->qmake5BinaryFile()))
+ && (SysRootKitInformation::sysRoot(kit) == config->sysRoot()))
+ kit->setAutoDetectionSource(config->ndkEnvFile().toString());
+ }
+ }
+ }
+}
+
// Switch to QnxToolchain for exisintg configuration using GccToolChain
void BlackBerryConfigurationManager::checkToolChainConfiguration()
{
@@ -235,14 +255,16 @@ bool BlackBerryConfigurationManager::addConfiguration(BlackBerryConfiguration *c
if (c->ndkPath() == config->ndkPath()
&& c->targetName() == config->targetName()) {
if (!config->isAutoDetected())
- QMessageBox::warning(0, tr("NDK Already Known"),
+ QMessageBox::warning(Core::ICore::mainWindow(), tr("NDK Already Known"),
tr("The NDK already has a configuration."), QMessageBox::Ok);
return false;
}
}
if (config->isValid()) {
- m_configs.append(config);
+ QList<BlackBerryConfiguration *>::iterator it = qLowerBound(m_configs.begin(), m_configs.end(),
+ config, &sortConfigurationsByVersion);
+ m_configs.insert(it, config);
return true;
}
@@ -292,6 +314,9 @@ QList<BlackBerryConfiguration *> BlackBerryConfigurationManager::activeConfigura
BlackBerryConfiguration *BlackBerryConfigurationManager::configurationFromEnvFile(const Utils::FileName &envFile) const
{
+ if (envFile.isEmpty())
+ return 0;
+
foreach (BlackBerryConfiguration *config, m_configs) {
if (config->ndkEnvFile() == envFile)
return config;
@@ -314,6 +339,9 @@ QList<Utils::EnvironmentItem> BlackBerryConfigurationManager::defaultQnxEnv()
void BlackBerryConfigurationManager::loadSettings()
{
+ // Backward compatibility: Set kit's auto detection source
+ // for existing BlackBerry kits that do not have it set yet.
+ setKitsAutoDetectionSource();
clearInvalidConfigurations();
loadAutoDetectedConfigurations();
loadManualConfigurations();
diff --git a/src/plugins/qnx/blackberryconfigurationmanager.h b/src/plugins/qnx/blackberryconfigurationmanager.h
index 97602e0633..7934a2adc6 100644
--- a/src/plugins/qnx/blackberryconfigurationmanager.h
+++ b/src/plugins/qnx/blackberryconfigurationmanager.h
@@ -84,6 +84,7 @@ private:
void saveManualConfigurations();
void saveActiveConfigurationNdkEnvPath();
void clearInvalidConfigurations();
+ void setKitsAutoDetectionSource();
QStringList activeConfigurationNdkEnvPaths();
};
diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp
index 37d8a199e2..8585cec354 100644
--- a/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp
+++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp
@@ -143,9 +143,24 @@ void BlackBerryDebugTokenRequestDialog::requestDebugToken()
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
+ bool ok;
+ const QString cskPassword = m_utils.cskPassword(this, &ok);
+
+ if (!ok) {
+ setBusy(false);
+ return;
+ }
+
+ const QString certificatePassword = m_utils.certificatePassword(this, &ok);
+
+ if (!ok) {
+ setBusy(false);
+ return;
+ }
+
m_requester->requestDebugToken(m_ui->debugTokenPath->path(),
- m_utils.cskPassword(), configuration.defaultKeystorePath(),
- m_utils.certificatePassword(), m_ui->devicePin->text());
+ cskPassword, configuration.defaultKeystorePath(),
+ certificatePassword, m_ui->devicePin->text());
}
void BlackBerryDebugTokenRequestDialog::setDefaultPath()
@@ -235,6 +250,11 @@ void BlackBerryDebugTokenRequestDialog::debugTokenArrived(int status)
break;
}
+ QFile file(m_ui->debugTokenPath->path());
+
+ if (file.exists())
+ file.remove();
+
QMessageBox::critical(this, tr("Error"), errorString);
setBusy(false);
diff --git a/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp b/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp
index 44228ec761..5f96f4c791 100644
--- a/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp
+++ b/src/plugins/qnx/blackberrydeployconfigurationfactory.cpp
@@ -32,7 +32,7 @@
#include "blackberrydeployconfigurationfactory.h"
#include "qnxconstants.h"
-#include "blackberrycheckdevmodestep.h"
+#include "blackberrycheckdebugtokenstep.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrycreatepackagestep.h"
#include "blackberrydeploystep.h"
@@ -93,7 +93,7 @@ ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::crea
return 0;
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
- dc->stepList()->insertStep(0, new BlackBerryCheckDevModeStep(dc->stepList()));
+ dc->stepList()->insertStep(0, new BlackBerryCheckDebugTokenStep(dc->stepList()));
dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList()));
dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList()));
return dc;
diff --git a/src/plugins/qnx/blackberrydeviceinformation.cpp b/src/plugins/qnx/blackberrydeviceinformation.cpp
index b9e67d3059..12d24bdb5c 100644
--- a/src/plugins/qnx/blackberrydeviceinformation.cpp
+++ b/src/plugins/qnx/blackberrydeviceinformation.cpp
@@ -68,6 +68,7 @@ void BlackBerryDeviceInformation::resetResults()
m_deviceOS.clear();
m_hardwareId.clear();
m_debugTokenAuthor.clear();
+ m_debugTokenValidationError.clear();
m_scmBundle.clear();
m_hostName.clear();
m_debugTokenValid = false;
@@ -95,6 +96,11 @@ QString BlackBerryDeviceInformation::debugTokenAuthor() const
return m_debugTokenAuthor;
}
+QString BlackBerryDeviceInformation::debugTokenValidationError() const
+{
+ return m_debugTokenValidationError;
+}
+
QString BlackBerryDeviceInformation::scmBundle() const
{
return m_scmBundle;
@@ -125,8 +131,9 @@ void BlackBerryDeviceInformation::processData(const QString &line)
static const QString devicepin = QLatin1String("devicepin::0x");
static const QString device_os = QLatin1String("device_os::");
static const QString hardwareid = QLatin1String("hardwareid::");
- static const QString debug_token_author = QLatin1String("debug_token_author::");
- static const QString debug_token_valid = QLatin1String("debug_token_valid:b:");
+ static const QString debug_token_author = QLatin1String("[n]debug_token_author::");
+ static const QString debug_token_validation_error = QLatin1String("[n]debug_token_validation_error::");
+ static const QString debug_token_valid = QLatin1String("[n]debug_token_valid:b:");
static const QString simulator = QLatin1String("simulator:b:");
static const QString scmbundle = QLatin1String("scmbundle::");
static const QString hostname = QLatin1String("hostname::");
@@ -140,6 +147,8 @@ void BlackBerryDeviceInformation::processData(const QString &line)
m_hardwareId = line.mid(hardwareid.size()).trimmed();
else if (line.startsWith(debug_token_author))
m_debugTokenAuthor = line.mid(debug_token_author.size()).trimmed();
+ else if (line.startsWith(debug_token_validation_error))
+ m_debugTokenValidationError = line.mid(debug_token_validation_error.size()).trimmed();
else if (line.startsWith(debug_token_valid))
m_debugTokenValid = line.mid(debug_token_valid.size()).trimmed() == QLatin1String("true");
else if (line.startsWith(simulator))
diff --git a/src/plugins/qnx/blackberrydeviceinformation.h b/src/plugins/qnx/blackberrydeviceinformation.h
index bbcc4ba4b3..d64f078f0c 100644
--- a/src/plugins/qnx/blackberrydeviceinformation.h
+++ b/src/plugins/qnx/blackberrydeviceinformation.h
@@ -62,6 +62,7 @@ public:
QString deviceOS() const;
QString hardwareId() const;
QString debugTokenAuthor() const;
+ QString debugTokenValidationError() const;
bool debugTokenValid() const;
QString scmBundle() const;
QString hostName() const;
@@ -75,6 +76,7 @@ private:
QString m_debugTokenAuthor;
QString m_scmBundle;
QString m_hostName;
+ QString m_debugTokenValidationError;
bool m_debugTokenValid;
bool m_isSimulator;
bool m_isProductionDevice;
diff --git a/src/plugins/qnx/blackberryinstallwizardpages.cpp b/src/plugins/qnx/blackberryinstallwizardpages.cpp
index b2bd3f5dc0..5ab46033b1 100644
--- a/src/plugins/qnx/blackberryinstallwizardpages.cpp
+++ b/src/plugins/qnx/blackberryinstallwizardpages.cpp
@@ -479,7 +479,7 @@ void BlackBerryInstallWizardFinalPage::initializePage()
BlackBerryConfiguration *config = configManager.configurationFromEnvFile(Utils::FileName::fromString(m_data.ndkPath));
if (!config) {
- config = new BlackBerryConfiguration(Utils::FileName::fromString(m_data.ndkPath), false);
+ config = new BlackBerryConfiguration(Utils::FileName::fromString(m_data.ndkPath));
if (!configManager.addConfiguration(config)) {
delete config;
// TODO: more explicit error message!
diff --git a/src/plugins/qnx/blackberrykeyspage.cpp b/src/plugins/qnx/blackberrykeyspage.cpp
index 39493bf5a0..37d5f7c2d0 100644
--- a/src/plugins/qnx/blackberrykeyspage.cpp
+++ b/src/plugins/qnx/blackberrykeyspage.cpp
@@ -51,9 +51,10 @@ BlackBerryKeysPage::BlackBerryKeysPage(QObject *parent) :
Constants::QNX_BB_CATEGORY_TR));
}
-QWidget *BlackBerryKeysPage::createPage(QWidget *parent)
+QWidget *BlackBerryKeysPage::widget()
{
- m_widget = new BlackBerryKeysWidget(parent);
+ if (!m_widget)
+ m_widget = new BlackBerryKeysWidget;
return m_widget;
}
@@ -63,6 +64,7 @@ void BlackBerryKeysPage::apply()
void BlackBerryKeysPage::finish()
{
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/qnx/blackberrykeyspage.h b/src/plugins/qnx/blackberrykeyspage.h
index 27e4423305..945ed46f9a 100644
--- a/src/plugins/qnx/blackberrykeyspage.h
+++ b/src/plugins/qnx/blackberrykeyspage.h
@@ -34,6 +34,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Qnx {
namespace Internal {
@@ -44,12 +46,12 @@ class BlackBerryKeysPage : public Core::IOptionsPage
Q_OBJECT
public:
explicit BlackBerryKeysPage(QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- BlackBerryKeysWidget *m_widget;
+ QPointer<BlackBerryKeysWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/qnx/blackberrykeyswidget.cpp b/src/plugins/qnx/blackberrykeyswidget.cpp
index 8a3715279d..4698d95895 100644
--- a/src/plugins/qnx/blackberrykeyswidget.cpp
+++ b/src/plugins/qnx/blackberrykeyswidget.cpp
@@ -68,6 +68,8 @@ void BlackBerryKeysWidget::certificateLoaded(int status)
switch (status) {
case BlackBerryCertificate::Success:
m_ui->certificateAuthor->setText(m_utils.defaultCertificate()->author());
+ m_ui->certificateAuthor->setVisible(true);
+ m_ui->authorLabel->setVisible(true);
m_ui->openCertificateButton->setVisible(false);
break;
case BlackBerryCertificate::WrongPassword:
@@ -130,9 +132,18 @@ void BlackBerryKeysWidget::updateCertificateSection()
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
m_ui->certificatePath->setText(configManager.defaultKeystorePath());
- m_ui->certificateAuthor->setText(tr("Loading..."));
- loadDefaultCertificate();
+ const BlackBerryCertificate *certificate = m_utils.defaultCertificate();
+
+ if (certificate) {
+ m_ui->certificateAuthor->setText(certificate->author());
+ m_ui->openCertificateButton->setVisible(false);
+ return;
+ }
+
+ m_ui->openCertificateButton->setVisible(true);
+ m_ui->certificateAuthor->setVisible(false);
+ m_ui->authorLabel->setVisible(false);
} else {
setCreateCertificateVisible(true);
}
@@ -157,16 +168,8 @@ void BlackBerryKeysWidget::updateKeysSection()
void BlackBerryKeysWidget::loadDefaultCertificate()
{
- const BlackBerryCertificate *certificate = m_utils.defaultCertificate();
-
- if (certificate) {
- m_ui->certificateAuthor->setText(certificate->author());
- m_ui->openCertificateButton->setVisible(false);
- return;
- }
-
connect(&m_utils, SIGNAL(defaultCertificateLoaded(int)), this, SLOT(certificateLoaded(int)));
- m_utils.openDefaultCertificate();
+ m_utils.openDefaultCertificate(this);
}
void BlackBerryKeysWidget::setCertificateError(const QString &error)
diff --git a/src/plugins/qnx/blackberryndkprocess.cpp b/src/plugins/qnx/blackberryndkprocess.cpp
index f197d4cb46..1c3cc9f3c7 100644
--- a/src/plugins/qnx/blackberryndkprocess.cpp
+++ b/src/plugins/qnx/blackberryndkprocess.cpp
@@ -49,6 +49,7 @@ BlackBerryNdkProcess::BlackBerryNdkProcess(const QString &command, QObject *pare
m_process->setEnvironment(Utils::EnvironmentItem::toStringList(
BlackBerryConfigurationManager::instance().defaultQnxEnv()));
+ connect(m_process, SIGNAL(started()), this, SIGNAL(started()));
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(processFinished()));
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
diff --git a/src/plugins/qnx/blackberryndkprocess.h b/src/plugins/qnx/blackberryndkprocess.h
index a73a3873d1..96d3279306 100644
--- a/src/plugins/qnx/blackberryndkprocess.h
+++ b/src/plugins/qnx/blackberryndkprocess.h
@@ -65,6 +65,7 @@ public:
signals:
void finished(int status);
+ void started();
protected:
explicit BlackBerryNdkProcess(const QString &command, QObject *parent = 0);
diff --git a/src/plugins/qnx/blackberryndksettingspage.cpp b/src/plugins/qnx/blackberryndksettingspage.cpp
index 5a98414d72..9077e2a403 100644
--- a/src/plugins/qnx/blackberryndksettingspage.cpp
+++ b/src/plugins/qnx/blackberryndksettingspage.cpp
@@ -45,16 +45,17 @@ BlackBerryNDKSettingsPage::BlackBerryNDKSettingsPage(QObject *parent) :
Core::IOptionsPage(parent)
{
setId(Core::Id(Constants::QNX_BB_NDK_SETTINGS_ID));
- setDisplayName(tr("NDK"));
+ setDisplayName(tr("API Level"));
setCategory(Constants::QNX_BB_CATEGORY);
setDisplayCategory(QCoreApplication::translate("BlackBerry",
Constants::QNX_BB_CATEGORY_TR));
setCategoryIcon(QLatin1String(Constants::QNX_BB_CATEGORY_ICON));
}
-QWidget *BlackBerryNDKSettingsPage::createPage(QWidget *parent)
+QWidget *BlackBerryNDKSettingsPage::widget()
{
- m_widget = new BlackBerryNDKSettingsWidget(parent);
+ if (!m_widget)
+ m_widget = new BlackBerryNDKSettingsWidget;
return m_widget;
}
@@ -73,6 +74,7 @@ void BlackBerryNDKSettingsPage::apply()
void BlackBerryNDKSettingsPage::finish()
{
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/qnx/blackberryndksettingspage.h b/src/plugins/qnx/blackberryndksettingspage.h
index 4e2de119e1..0f82480f5a 100644
--- a/src/plugins/qnx/blackberryndksettingspage.h
+++ b/src/plugins/qnx/blackberryndksettingspage.h
@@ -34,6 +34,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Qnx {
namespace Internal {
@@ -44,12 +46,12 @@ class BlackBerryNDKSettingsPage : public Core::IOptionsPage
Q_OBJECT
public:
explicit BlackBerryNDKSettingsPage(QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
private:
- BlackBerryNDKSettingsWidget *m_widget;
+ QPointer<BlackBerryNDKSettingsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/qnx/blackberryndksettingswidget.cpp b/src/plugins/qnx/blackberryndksettingswidget.cpp
index bd532bb345..eff6945e53 100644
--- a/src/plugins/qnx/blackberryndksettingswidget.cpp
+++ b/src/plugins/qnx/blackberryndksettingswidget.cpp
@@ -60,14 +60,13 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_bbConfigManager = &BlackBerryConfigurationManager::instance();
m_ui->setupUi(this);
- m_ui->activateNdkTargetButton->setEnabled(false);
- m_ui->deactivateNdkTargetButton->setEnabled(false);
+ updateInfoTable(0);
m_activatedTargets << m_bbConfigManager->activeConfigurations();
m_ui->ndksTreeWidget->header()->setResizeMode(QHeaderView::Stretch);
m_ui->ndksTreeWidget->header()->setStretchLastSection(false);
- m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("NDK") << tr("NDK Environment File")));
+ m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("API Level") << tr("Environment File")));
m_ui->ndksTreeWidget->setTextElideMode(Qt::ElideNone);
m_ui->ndksTreeWidget->setColumnCount(2);
m_autoDetectedNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
@@ -81,14 +80,14 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_ui->ndksTreeWidget->expandAll();
- updateNdkList();
-
connect(m_ui->wizardButton, SIGNAL(clicked()), this, SLOT(launchBlackBerrySetupWizard()));
connect(m_ui->addNdkButton, SIGNAL(clicked()), this, SLOT(addNdkTarget()));
connect(m_ui->removeNdkButton, SIGNAL(clicked()), this, SLOT(removeNdkTarget()));
connect(m_ui->activateNdkTargetButton, SIGNAL(clicked()), this, SLOT(activateNdkTarget()));
connect(m_ui->deactivateNdkTargetButton, SIGNAL(clicked()), this, SLOT(deactivateNdkTarget()));
connect(m_ui->ndksTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateInfoTable(QTreeWidgetItem*)));
+
+ updateNdkList();
}
void BlackBerryNDKSettingsWidget::setWizardMessageVisible(bool visible)
@@ -118,7 +117,7 @@ void BlackBerryNDKSettingsWidget::launchBlackBerrySetupWizard() const
const bool alreadyConfigured = blackBerryUtils.hasRegisteredKeys() && blackBerryUtils.hasDefaultCertificate();
if (alreadyConfigured) {
- QMessageBox::information(0, tr("Qt Creator"),
+ QMessageBox::information(Core::ICore::mainWindow(), tr("Qt Creator"),
tr("It appears that your BlackBerry environment has already been configured."));
return;
}
@@ -130,37 +129,17 @@ void BlackBerryNDKSettingsWidget::launchBlackBerrySetupWizard() const
void BlackBerryNDKSettingsWidget::updateInfoTable(QTreeWidgetItem* currentItem)
{
- if (!currentItem)
- return;
-
- QString envFilePath = currentItem->text(1);
- if (envFilePath.isEmpty()) {
- m_ui->removeNdkButton->setEnabled(false);
- m_ui->activateNdkTargetButton->setEnabled(false);
- m_ui->deactivateNdkTargetButton->setEnabled(false);
- return;
- }
-
- BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(envFilePath));
- if (!config)
- return;
+ BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(
+ Utils::FileName::fromString(currentItem ? currentItem->text(1) : QString()));
+ updateUi(currentItem, config);
- m_ui->baseNameLabel->setText(config->displayName());
- m_ui->ndkPathLabel->setText(QDir::toNativeSeparators(config->ndkPath()));
- m_ui->hostLabel->setText(QDir::toNativeSeparators(config->qnxHost()));
- m_ui->targetLabel->setText(QDir::toNativeSeparators(config->sysRoot().toString()));
- m_ui->versionLabel->clear();
- // TODO: Add a versionNumber attribute for the BlackBerryConfiguration class
- if (config->isAutoDetected()) {
- foreach (const NdkInstallInformation &ndkInfo, QnxUtils::installedNdks()) {
- if (ndkInfo.name == config->displayName()) {
- m_ui->versionLabel->setText(ndkInfo.version);
- break;
- }
- }
+ m_ui->informationBox->setVisible(config);
+ if (config) {
+ m_ui->baseNameLabel->setText(config->displayName());
+ m_ui->hostLabel->setText(QDir::toNativeSeparators(config->qnxHost()));
+ m_ui->targetLabel->setText(QDir::toNativeSeparators(config->sysRoot().toString()));
+ m_ui->versionLabel->setText(config->version().toString());
}
-
- updateUi(currentItem, config);
}
void BlackBerryNDKSettingsWidget::updateNdkList()
@@ -179,10 +158,7 @@ void BlackBerryNDKSettingsWidget::updateNdkList()
item->setFont(1, font);
}
- if (m_autoDetectedNdks->child(0)) {
- m_autoDetectedNdks->child(0)->setSelected(true);
- updateInfoTable(m_autoDetectedNdks->child(0));
- }
+ m_ui->ndksTreeWidget->setCurrentItem(m_autoDetectedNdks->child(0));
}
void BlackBerryNDKSettingsWidget::addNdkTarget()
@@ -260,17 +236,21 @@ void BlackBerryNDKSettingsWidget::deactivateNdkTarget()
void BlackBerryNDKSettingsWidget::updateUi(QTreeWidgetItem *item, BlackBerryConfiguration *config)
{
- if (!item || !config)
+ if (!item || !config) {
+ m_ui->removeNdkButton->setEnabled(false);
+ m_ui->activateNdkTargetButton->setEnabled(false);
+ m_ui->deactivateNdkTargetButton->setEnabled(false);
return;
+ }
+ const bool contains = m_activatedTargets.contains(config);
QFont font;
- font.setBold(m_activatedTargets.contains(config));
+ font.setBold(contains);
item->setFont(0, font);
item->setFont(1, font);
- m_ui->activateNdkTargetButton->setEnabled(!m_activatedTargets.contains(config));
- m_ui->deactivateNdkTargetButton->setEnabled(m_activatedTargets.contains(config)
- && m_activatedTargets.size() > 1);
+ m_ui->activateNdkTargetButton->setEnabled(!contains);
+ m_ui->deactivateNdkTargetButton->setEnabled(contains && m_activatedTargets.size() > 1);
// Disable remove button for auto detected pre-10.2 NDKs (uninstall wizard doesn't handle them)
m_ui->removeNdkButton->setEnabled(!(config->isAutoDetected()
&& QnxUtils::sdkInstallerPath(config->ndkPath()).isEmpty()));
diff --git a/src/plugins/qnx/blackberryndksettingswidget.ui b/src/plugins/qnx/blackberryndksettingswidget.ui
index 57d608b1a5..bb2cfeff11 100644
--- a/src/plugins/qnx/blackberryndksettingswidget.ui
+++ b/src/plugins/qnx/blackberryndksettingswidget.ui
@@ -150,13 +150,82 @@
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QTreeWidget" name="ndksTreeWidget">
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QTreeWidget" name="ndksTreeWidget">
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="informationBox">
+ <property name="title">
+ <string>API Level Information</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="2" column="1">
+ <widget class="QLabel" name="versionLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Version:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="hostLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="baseNameLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Host:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="targetLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -175,11 +244,20 @@
</widget>
</item>
<item>
- <widget class="Line" name="line">
+ <spacer name="verticalSpacer_2">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Vertical</enum>
</property>
- </widget>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</item>
<item>
<widget class="QPushButton" name="activateNdkTargetButton">
@@ -214,170 +292,6 @@
</item>
</layout>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>BlackBerry NDK Information</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;NDK Base Name:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="baseNameLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <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>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;NDK Path:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="ndkPathLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </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>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_9">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Version:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="versionLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <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>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Host:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="hostLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <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>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_11">
- <item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Target:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="targetLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_6">
- <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>
- </item>
</layout>
</widget>
<resources/>
diff --git a/src/plugins/qnx/blackberrysetupwizard.cpp b/src/plugins/qnx/blackberrysetupwizard.cpp
index 748b7a0b3a..6cdbd3e64e 100644
--- a/src/plugins/qnx/blackberrysetupwizard.cpp
+++ b/src/plugins/qnx/blackberrysetupwizard.cpp
@@ -217,6 +217,13 @@ void BlackBerrySetupWizard::debugTokenArrived(int status)
break;
}
+ BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
+
+ QFile dt(configuration.defaultKeystorePath());
+
+ if (dt.exists())
+ dt.remove();
+
QMessageBox::critical(this, tr("Error"), errorString);
reset();
@@ -407,8 +414,13 @@ void BlackBerrySetupWizard::requestDebugToken()
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
+ bool ok;
+ const QString cskPassword = m_utils.cskPassword(this, &ok);
+ if (!ok)
+ return;
+
m_requester->requestDebugToken(configuration.defaultDebugTokenPath(),
- m_utils.cskPassword(), configuration.defaultKeystorePath(), certificatePassword(), m_devicePin);
+ cskPassword, configuration.defaultKeystorePath(), certificatePassword(), m_devicePin);
}
void BlackBerrySetupWizard::uploadDebugToken()
diff --git a/src/plugins/qnx/blackberrysetupwizardpages.cpp b/src/plugins/qnx/blackberrysetupwizardpages.cpp
index fd66057119..3c7e167c81 100644
--- a/src/plugins/qnx/blackberrysetupwizardpages.cpp
+++ b/src/plugins/qnx/blackberrysetupwizardpages.cpp
@@ -321,7 +321,7 @@ BlackBerrySetupWizardFinishPage::BlackBerrySetupWizardFinishPage(QWidget *parent
: QWizardPage(parent),
m_ui(0)
{
- setSubTitle(tr("Your environment is ready to be configured."));
+ setTitle(tr("Your environment is ready to be configured."));
m_ui = new Ui::BlackBerrySetupWizardFinishPage;
m_ui->setupUi(this);
diff --git a/src/plugins/qnx/blackberrysigningutils.cpp b/src/plugins/qnx/blackberrysigningutils.cpp
index 9905d7515c..f9fb2b8cf0 100644
--- a/src/plugins/qnx/blackberrysigningutils.cpp
+++ b/src/plugins/qnx/blackberrysigningutils.cpp
@@ -82,18 +82,24 @@ bool BlackBerrySigningUtils::hasDefaultCertificate()
return keystore.exists();
}
-QString BlackBerrySigningUtils::cskPassword()
+QString BlackBerrySigningUtils::cskPassword(QWidget *passwordPromptParent, bool *ok)
{
if (m_cskPassword.isEmpty())
- m_cskPassword = promptPassword(tr("Please provide your bbidtoken.csk PIN."));
+ m_cskPassword = promptPassword(tr("Please provide your bbidtoken.csk PIN."), passwordPromptParent, ok);
+ else if (ok)
+ *ok = true;
return m_cskPassword;
}
-QString BlackBerrySigningUtils::certificatePassword()
+QString BlackBerrySigningUtils::certificatePassword(QWidget *passwordPromptParent, bool *ok)
{
- if (m_certificatePassword.isEmpty())
- m_certificatePassword = promptPassword(tr("Please enter your certificate password."));
+ if (m_certificatePassword.isEmpty()) {
+ m_certificatePassword =
+ promptPassword(tr("Please enter your certificate password."), passwordPromptParent, ok);
+ } else if (ok) {
+ *ok = true;
+ }
return m_certificatePassword;
}
@@ -103,14 +109,19 @@ const BlackBerryCertificate * BlackBerrySigningUtils::defaultCertificate() const
return m_defaultCertificate;
}
-void BlackBerrySigningUtils::openDefaultCertificate()
+void BlackBerrySigningUtils::openDefaultCertificate(QWidget *passwordPromptParent)
{
if (m_defaultCertificate) {
emit defaultCertificateLoaded(BlackBerryCertificate::Success);
return;
}
- const QString password = certificatePassword();
+ bool ok;
+ const QString password = certificatePassword(passwordPromptParent, &ok);
+
+ // action has been canceled
+ if (!ok)
+ return;
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
@@ -165,16 +176,24 @@ void BlackBerrySigningUtils::certificateLoaded(int status)
emit defaultCertificateLoaded(status);
}
-QString BlackBerrySigningUtils::promptPassword(const QString &message) const
+QString BlackBerrySigningUtils::promptPassword(const QString &message,
+ QWidget *dialogParent, bool *ok) const
{
- QInputDialog dialog;
+ QInputDialog dialog(dialogParent);
dialog.setWindowTitle(tr("Qt Creator"));
dialog.setInputMode(QInputDialog::TextInput);
dialog.setLabelText(message);
dialog.setTextEchoMode(QLineEdit::Password);
- if (dialog.exec() == QDialog::Rejected)
+ if (dialog.exec() == QDialog::Rejected) {
+ if (ok)
+ *ok = false;
+
return QString();
+ }
+
+ if (ok)
+ *ok = true;
return dialog.textValue();
}
diff --git a/src/plugins/qnx/blackberrysigningutils.h b/src/plugins/qnx/blackberrysigningutils.h
index c18f202245..3cf139162e 100644
--- a/src/plugins/qnx/blackberrysigningutils.h
+++ b/src/plugins/qnx/blackberrysigningutils.h
@@ -55,12 +55,12 @@ public:
bool hasLegacyKeys();
bool hasDefaultCertificate();
- QString cskPassword();
- QString certificatePassword();
+ QString cskPassword(QWidget *passwordPromptParent = 0, bool *ok = 0);
+ QString certificatePassword(QWidget *passwordPromptParent = 0, bool *ok = 0);
const BlackBerryCertificate *defaultCertificate() const;
- void openDefaultCertificate();
+ void openDefaultCertificate(QWidget *passwordPromptParent = 0);
void setDefaultCertificate(BlackBerryCertificate *certificate);
void clearCskPassword();
void clearCertificatePassword();
@@ -77,7 +77,7 @@ private:
BlackBerrySigningUtils(QObject *parent = 0);
- QString promptPassword(const QString &message) const;
+ QString promptPassword(const QString &message, QWidget *dialogParent = 0, bool *ok = 0) const;
BlackBerryCertificate *m_defaultCertificate;
diff --git a/src/plugins/qnx/blackberryversionnumber.cpp b/src/plugins/qnx/blackberryversionnumber.cpp
new file mode 100644
index 0000000000..4d198de3f6
--- /dev/null
+++ b/src/plugins/qnx/blackberryversionnumber.cpp
@@ -0,0 +1,125 @@
+/**************************************************************************
+**
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+**
+** Contact: BlackBerry (qt@blackberry.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberryversionnumber.h"
+
+#include <QDir>
+
+namespace Qnx {
+namespace Internal {
+
+static const char NONDIGIT_SEGMENT_REGEXP[] = "(?<=\\d)(?=\\D)|(?<=\\D)(?=\\d)";
+
+BlackBerryVersionNumber::BlackBerryVersionNumber(const QStringList &listNumber)
+ : m_segments(listNumber)
+{
+}
+
+BlackBerryVersionNumber::BlackBerryVersionNumber(const QString &version)
+{
+ m_segments = version.split(QLatin1Char('.'));
+}
+
+BlackBerryVersionNumber::BlackBerryVersionNumber()
+{
+}
+
+QString BlackBerryVersionNumber::toString() const
+{
+ return m_segments.join(QLatin1String("."));
+}
+
+bool BlackBerryVersionNumber::operator >(const BlackBerryVersionNumber &b) const
+{
+ int minSize = size() > b.size() ? b.size() : size();
+ for (int i = 0; i < minSize; i++) {
+ if (segment(i) != b.segment(i)) {
+ // Segment can contain digits and non digits expressions
+ QStringList aParts = segment(i).split(QLatin1String(NONDIGIT_SEGMENT_REGEXP));
+ QStringList bParts = b.segment(i).split(QLatin1String(NONDIGIT_SEGMENT_REGEXP));
+
+ int minPartSize = aParts.length() > bParts.length() ? bParts.length() : aParts.length();
+ for (int j = 0; j < minPartSize; j++) {
+ bool aOk = true;
+ bool bOk = true;
+ int aInt = aParts[j].toInt(&aOk);
+ int bInt = bParts[j].toInt(&bOk);
+
+ if (aOk && bOk)
+ return aInt > bInt;
+
+ return aParts[j].compare(bParts[j]) > 0;
+ }
+ }
+ }
+
+ return false;
+}
+
+QString BlackBerryVersionNumber::segment(int index) const
+{
+ if (index < m_segments.length())
+ return m_segments.at(index);
+
+ return QString();
+}
+
+BlackBerryVersionNumber BlackBerryVersionNumber::fromNdkEnvFileName(const QString &ndkEnvFileName)
+{
+ return fromFileName(ndkEnvFileName, QRegExp(QLatin1String("^bbndk-env_(.*)$")));
+}
+
+BlackBerryVersionNumber BlackBerryVersionNumber::fromTargetName(const QString &targetName)
+{
+ return fromFileName(targetName, QRegExp(QLatin1String("^target_(.*)$")));
+}
+
+BlackBerryVersionNumber BlackBerryVersionNumber::fromFileName(const QString &fileName, const QRegExp &regExp)
+{
+ QStringList segments;
+ if (regExp.exactMatch(fileName) && regExp.captureCount() == 1)
+ segments << regExp.cap(1).split(QLatin1Char('_'));
+
+ return BlackBerryVersionNumber(segments);
+}
+
+int BlackBerryVersionNumber::size() const
+{
+ return m_segments.length();
+}
+
+bool BlackBerryVersionNumber::isEmpty() const
+{
+ return m_segments.isEmpty();
+}
+
+} // namespace Internal
+} // namespace Qnx
diff --git a/src/plugins/qnx/blackberrycheckdevmodestep.h b/src/plugins/qnx/blackberryversionnumber.h
index 5f5e1bc9d9..738275fa50 100644
--- a/src/plugins/qnx/blackberrycheckdevmodestep.h
+++ b/src/plugins/qnx/blackberryversionnumber.h
@@ -29,35 +29,36 @@
**
****************************************************************************/
-#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
-#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
+#ifndef BLACKBERRY_VERSION_NUMBER_H
+#define BLACKBERRY_VERSION_NUMBER_H
-#include "blackberryabstractdeploystep.h"
+#include <QStringList>
namespace Qnx {
namespace Internal {
-
-class BlackBerryCheckDevModeStep : public BlackBerryAbstractDeployStep
+class BlackBerryVersionNumber
{
- Q_OBJECT
- friend class BlackBerryCheckDevModeStepFactory;
-
public:
- explicit BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl);
+ BlackBerryVersionNumber(const QStringList &segments);
+ BlackBerryVersionNumber(const QString &version);
+ BlackBerryVersionNumber();
- bool init();
- ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
+ int size() const;
+ bool isEmpty() const;
+ QString segment(int index) const;
+ QString toString() const;
-protected:
- BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDevModeStep *bs);
+ static BlackBerryVersionNumber fromNdkEnvFileName(const QString &ndkEnvFileName);
+ static BlackBerryVersionNumber fromTargetName(const QString &targetName);
+ static BlackBerryVersionNumber fromFileName(const QString &fileName, const QRegExp &regExp);
- void processStarted(const ProjectExplorer::ProcessParameters &params);
+ bool operator >(const BlackBerryVersionNumber &b) const;
private:
- QString password() const;
+ QStringList m_segments;
};
} // namespace Internal
} // namespace Qnx
-#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
+#endif // VERSIONNUMBER_H
diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro
index 2f0b403b76..25df0bf0fa 100644
--- a/src/plugins/qnx/qnx.pro
+++ b/src/plugins/qnx/qnx.pro
@@ -69,9 +69,9 @@ SOURCES += qnxplugin.cpp \
blackberrydebugtokenuploader.cpp \
blackberrydebugtokenreader.cpp \
blackberryndkprocess.cpp \
- blackberrycheckdevmodestepfactory.cpp \
- blackberrycheckdevmodestep.cpp \
- blackberrycheckdevmodestepconfigwidget.cpp \
+ blackberrycheckdebugtokenstep.cpp \
+ blackberrycheckdebugtokenstepconfigwidget.cpp \
+ blackberrycheckdebugtokenstepfactory.cpp \
blackberrydeviceconnection.cpp \
blackberrydeviceconnectionmanager.cpp \
blackberrydeviceinformation.cpp \
@@ -98,7 +98,8 @@ SOURCES += qnxplugin.cpp \
qnxdeviceprocesssignaloperation.cpp \
qnxdeviceprocesslist.cpp \
qnxtoolchain.cpp \
- slog2inforunner.cpp
+ slog2inforunner.cpp \
+ blackberryversionnumber.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
@@ -167,9 +168,9 @@ HEADERS += qnxplugin.h\
blackberrydebugtokenuploader.h \
blackberrydebugtokenreader.h \
blackberryndkprocess.h \
- blackberrycheckdevmodestepfactory.h \
- blackberrycheckdevmodestep.h \
- blackberrycheckdevmodestepconfigwidget.h \
+ blackberrycheckdebugtokenstep.h \
+ blackberrycheckdebugtokenstepconfigwidget.h \
+ blackberrycheckdebugtokenstepfactory.h \
blackberrydeviceconnection.h \
blackberrydeviceconnectionmanager.h \
blackberrydeviceinformation.h \
@@ -196,7 +197,8 @@ HEADERS += qnxplugin.h\
qnxdeviceprocesssignaloperation.h \
qnxdeviceprocesslist.h \
qnxtoolchain.h \
- slog2inforunner.h
+ slog2inforunner.h \
+ blackberryversionnumber.h
FORMS += \
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs
index da95f3c55e..a425414e93 100644
--- a/src/plugins/qnx/qnx.qbs
+++ b/src/plugins/qnx/qnx.qbs
@@ -59,12 +59,12 @@ QtcPlugin {
"blackberryabstractdeploystep.h",
"blackberryapplicationrunner.cpp",
"blackberryapplicationrunner.h",
- "blackberrycheckdevmodestep.cpp",
- "blackberrycheckdevmodestep.h",
- "blackberrycheckdevmodestepconfigwidget.cpp",
- "blackberrycheckdevmodestepconfigwidget.h",
- "blackberrycheckdevmodestepfactory.cpp",
- "blackberrycheckdevmodestepfactory.h",
+ "blackberrycheckdebugtokenstep.cpp",
+ "blackberrycheckdebugtokenstep.h",
+ "blackberrycheckdebugtokenstepconfigwidget.cpp",
+ "blackberrycheckdebugtokenstepconfigwidget.h",
+ "blackberrycheckdebugtokenstepfactory.cpp",
+ "blackberrycheckdebugtokenstepfactory.h",
"blackberryconfigurationmanager.cpp",
"blackberryconfigurationmanager.h",
"blackberrycreatepackagestep.cpp",
@@ -185,6 +185,8 @@ QtcPlugin {
"blackberrysetupwizardfinishpage.ui",
"blackberrysigningutils.cpp",
"blackberrysigningutils.h",
+ "blackberryversionnumber.cpp",
+ "blackberryversionnumber.h",
"pathchooserdelegate.cpp",
"pathchooserdelegate.h",
"qnxtoolchain.cpp",
diff --git a/src/plugins/qnx/qnxconstants.h b/src/plugins/qnx/qnxconstants.h
index 726657f748..c5c278eddd 100644
--- a/src/plugins/qnx/qnxconstants.h
+++ b/src/plugins/qnx/qnxconstants.h
@@ -69,7 +69,7 @@ const char QNX_QNX_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.QNXRunConf
const char QNX_CREATE_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxCreatePackageBuildStep";
const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep";
-const char QNX_CHECK_DEVELOPMENT_MODE_BS_ID[] = "Qt4ProjectManager.QnxCheckDevelopmentModeBuildStep";
+const char QNX_CHECK_DEBUG_TOKEN_BS_ID[] = "Qt4ProjectManager.QnxCheckDebugTokenBuildStep";
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp
index 37c4216b2e..4184e094f2 100644
--- a/src/plugins/qnx/qnxplugin.cpp
+++ b/src/plugins/qnx/qnxplugin.cpp
@@ -49,7 +49,7 @@
#include "bardescriptoreditorfactory.h"
#include "bardescriptormagicmatcher.h"
#include "blackberrykeyspage.h"
-#include "blackberrycheckdevmodestepfactory.h"
+#include "blackberrycheckdebugtokenstepfactory.h"
#include "blackberrydeviceconnectionmanager.h"
#include "blackberryconfigurationmanager.h"
#include "cascadesimport/cascadesimportwizard.h"
@@ -91,7 +91,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
addAutoReleasedObject(new BlackBerryRunControlFactory);
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
addAutoReleasedObject(new BlackBerryKeysPage);
- addAutoReleasedObject(new BlackBerryCheckDevModeStepFactory);
+ addAutoReleasedObject(new BlackBerryCheckDebugTokenStepFactory);
addAutoReleasedObject(new CascadesImportWizard);
BlackBerryDeviceConnectionManager::instance()->initialize();
diff --git a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp
index e137c63cea..1c4596d75c 100644
--- a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp
+++ b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp
@@ -55,6 +55,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
layout->setMargin(0);
m_executableChooser = new Utils::PathChooser(this);
+ m_executableChooser->setHistoryCompleter(QLatin1String("Qt.CustomExecutable.History"));
m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
layout->addRow(tr("Executable:"), m_executableChooser);
@@ -63,6 +64,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit);
m_workingDirectory = new Utils::PathChooser(this);
+ m_workingDirectory->setHistoryCompleter(QLatin1String("WorkingDir.History"));
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index 54d4ea1123..ce7e361a0f 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -181,16 +181,19 @@ public:
// gets called by declarative in separate thread
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
- Q_UNUSED(size)
QMutexLocker lock(&m_mutex);
QUrl url = QUrl::fromEncoded(id.toLatin1());
- if (!m_fetcher.asynchronousFetchData(url))
- return QImage();
- if (m_fetcher.data().isEmpty())
+ if (!m_fetcher.asynchronousFetchData(url) || m_fetcher.data().isEmpty()) {
+ if (size) {
+ size->setWidth(0);
+ size->setHeight(0);
+ }
return QImage();
+ }
+
QByteArray data = m_fetcher.data();
QBuffer imgBuffer(&data);
imgBuffer.open(QIODevice::ReadOnly);
@@ -198,7 +201,11 @@ public:
QImage img = reader.read();
m_fetcher.clearData();
- return ScreenshotCropper::croppedImage(img, id, requestedSize);
+ img = ScreenshotCropper::croppedImage(img, id, requestedSize);
+ if (size)
+ *size = img.size();
+ return img;
+
}
private:
Fetcher m_fetcher;
@@ -321,6 +328,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
PathChooser *chooser = new PathChooser;
txt->setBuddy(chooser);
chooser->setExpectedKind(PathChooser::ExistingDirectory);
+ chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History"));
QSettings *settings = Core::ICore::settings();
chooser->setPath(settings->value(QString::fromLatin1(C_FALLBACK_ROOT),
Core::DocumentManager::projectsDirectory()).toString());
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index 8ac4570e4f..e993f3c8fe 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -75,11 +75,10 @@ QtOptionsPage::QtOptionsPage()
setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
-QWidget *QtOptionsPage::createPage(QWidget *parent)
+QWidget *QtOptionsPage::widget()
{
- m_widget = new QtOptionsPageWidget(parent);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget)
+ m_widget = new QtOptionsPageWidget;
return m_widget;
}
@@ -92,9 +91,9 @@ void QtOptionsPage::apply()
m_widget->apply();
}
-bool QtOptionsPage::matches(const QString &s) const
+void QtOptionsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
//-----------------------------------------------------
@@ -1010,19 +1009,5 @@ QList<BaseQtVersion *> QtOptionsPageWidget::versions() const
return result;
}
-QString QtOptionsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream ts(&rc);
- ts << sep << m_versionUi->versionNameLabel->text()
- << sep << m_versionUi->pathLabel->text()
- << sep << m_debuggingHelperUi->gdbHelperLabel->text()
- << sep << m_debuggingHelperUi->qmlDumpLabel->text();
-
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
} // namespace Internal
} // namespace QtSupport
diff --git a/src/plugins/qtsupport/qtoptionspage.h b/src/plugins/qtsupport/qtoptionspage.h
index 5d506c3bbe..80a740a43d 100644
--- a/src/plugins/qtsupport/qtoptionspage.h
+++ b/src/plugins/qtsupport/qtoptionspage.h
@@ -33,8 +33,9 @@
#include "debugginghelperbuildtask.h"
#include <coreplugin/dialogs/ioptionspage.h>
-#include <QWidget>
#include <QIcon>
+#include <QPointer>
+#include <QWidget>
QT_BEGIN_NAMESPACE
class QTreeWidgetItem;
@@ -63,12 +64,11 @@ class QtOptionsPageWidget : public QWidget
Q_OBJECT
public:
- QtOptionsPageWidget(QWidget *parent);
+ QtOptionsPageWidget(QWidget *parent = 0);
~QtOptionsPageWidget();
QList<BaseQtVersion *> versions() const;
void finish();
void apply();
- QString searchKeywords() const;
private:
void updateDescriptionLabel();
@@ -141,14 +141,12 @@ class QtOptionsPage : public Core::IOptionsPage
public:
QtOptionsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() {}
- bool matches(const QString &) const;
+ void finish();
private:
- QtOptionsPageWidget *m_widget;
- QString m_searchKeywords;
+ QPointer<QtOptionsPageWidget> m_widget;
};
} //namespace Internal
diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp
index 42bab6995f..a4ad361e4d 100644
--- a/src/plugins/qtsupport/qtparser.cpp
+++ b/src/plugins/qtsupport/qtparser.cpp
@@ -39,10 +39,12 @@ using ProjectExplorer::Task;
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)"
QtParser::QtParser() :
- m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror):\\s(.+)$"))
+ m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror):\\s(.+)$")),
+ m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*) in '(.*)'$"))
{
setObjectName(QLatin1String("QtParser"));
m_mocRegExp.setMinimal(true);
+ m_translationRegExp.setMinimal(true);
}
void QtParser::stdError(const QString &line)
@@ -63,6 +65,17 @@ void QtParser::stdError(const QString &line)
emit addTask(task);
return;
}
+ if (m_translationRegExp.indexIn(lne) > -1) {
+ Task::TaskType type = Task::Warning;
+ if (m_translationRegExp.cap(1) == QLatin1String("Error"))
+ type = Task::Error;
+ Task task(type, m_translationRegExp.cap(2),
+ Utils::FileName::fromUserInput(m_translationRegExp.cap(3)) /* filename */,
+ -1,
+ ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
+ emit addTask(task);
+ return;
+ }
IOutputParser::stdError(line);
}
@@ -150,6 +163,15 @@ void QtSupportPlugin::testQtOutputParser_data()
Utils::FileName::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
<< QString();
+ QTest::newRow("translation")
+ << QString::fromLatin1("Warning: dropping duplicate messages in '/some/place/qtcreator_fr.qm'")
+ << OutputParserTester::STDERR
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>() << Task(Task::Warning,
+ QLatin1String("dropping duplicate messages"),
+ Utils::FileName::fromUserInput(QLatin1String("/some/place/qtcreator_fr.qm")), -1,
+ ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
+ << QString();
}
void QtSupportPlugin::testQtOutputParser()
diff --git a/src/plugins/qtsupport/qtparser.h b/src/plugins/qtsupport/qtparser.h
index a91b67e17b..a0c3738aa5 100644
--- a/src/plugins/qtsupport/qtparser.h
+++ b/src/plugins/qtsupport/qtparser.h
@@ -47,6 +47,7 @@ public:
private:
QRegExp m_mocRegExp;
+ QRegExp m_translationRegExp;
};
} // namespace ProjectExplorer
diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp
index 34959f4a1c..ac04ba6168 100644
--- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp
@@ -183,6 +183,7 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
m_ui->portsWarningLabel->setToolTip(QLatin1String("<font color=\"red\">")
+ tr("You will need at least one port.") + QLatin1String("</font>"));
m_ui->keyFileLineEdit->setExpectedKind(PathChooser::File);
+ m_ui->keyFileLineEdit->setHistoryCompleter(QLatin1String("Ssh.KeyFile.History"));
m_ui->keyFileLineEdit->lineEdit()->setMinimumWidth(0);
QRegExpValidator * const portsValidator
= new QRegExpValidator(QRegExp(PortList::regularExpression()), this);
diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp
index e23a3ff903..110a4076ac 100644
--- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp
+++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp
@@ -59,6 +59,7 @@ GenericLinuxDeviceConfigurationWizardSetupPage::GenericLinuxDeviceConfigurationW
setTitle(tr("Connection"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
d->ui.privateKeyPathChooser->setExpectedKind(PathChooser::File);
+ d->ui.privateKeyPathChooser->setHistoryCompleter(QLatin1String("Ssh.KeyFile.History"));
d->ui.privateKeyPathChooser->setPromptDialogTitle(tr("Choose a Private Key File"));
connect(d->ui.nameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
connect(d->ui.hostNameLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp
index f81f7b2a82..faef490d58 100644
--- a/src/plugins/resourceeditor/resourceeditorw.cpp
+++ b/src/plugins/resourceeditor/resourceeditorw.cpp
@@ -110,7 +110,7 @@ ResourceEditorW::ResourceEditorW(const Core::Context &context,
// (That is because this editor instance is deleted in executeOpenWithMenuAction
// in that case.)
connect(m_openWithMenu, SIGNAL(triggered(QAction*)),
- Core::DocumentManager::instance(), SLOT(slotExecuteOpenWithMenuAction(QAction*)),
+ Core::DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)),
Qt::QueuedConnection);
connect(m_resourceEditor, SIGNAL(dirtyChanged(bool)), m_resourceDocument, SLOT(dirtyChanged(bool)));
diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp
index ed69c29e37..872cf16cfe 100644
--- a/src/plugins/subversion/checkoutwizard.cpp
+++ b/src/plugins/subversion/checkoutwizard.cpp
@@ -30,6 +30,7 @@
#include "checkoutwizard.h"
#include "checkoutwizardpage.h"
#include "subversionplugin.h"
+#include "subversionclient.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/command.h>
@@ -78,7 +79,7 @@ VcsBase::Command *CheckoutWizard::createCommand(const QList<QWizardPage*> &param
if (settings.hasAuthentication()) {
const QString user = settings.stringValue(SubversionSettings::userKey);
const QString pwd = settings.stringValue(SubversionSettings::passwordKey);
- args = SubversionPlugin::addAuthenticationOptions(args, user, pwd);
+ args = SubversionClient::addAuthenticationOptions(args, user, pwd);
}
VcsBase::Command *command = new VcsBase::Command(binary, workingDirectory,
QProcessEnvironment::systemEnvironment());
diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp
index 0ab2608afa..80a7f6cfdb 100644
--- a/src/plugins/subversion/settingspage.cpp
+++ b/src/plugins/subversion/settingspage.cpp
@@ -48,6 +48,7 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
{
m_ui.setupUi(this);
m_ui.pathChooser->setExpectedKind(PathChooser::ExistingCommand);
+ m_ui.pathChooser->setHistoryCompleter(QLatin1String("Subversion.Command.History"));
m_ui.pathChooser->setPromptDialogTitle(tr("Subversion Command"));
}
@@ -81,26 +82,6 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s)
m_ui.logCountSpinBox->setValue(s.intValue(SubversionSettings::logCountKey));
}
-QString SettingsPageWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.generalGroupBox->title()
- << sep << m_ui.commandLabel->text()
- << sep << m_ui.userGroupBox->title()
- << sep << m_ui.usernameLabel->text()
- << sep << m_ui.passwordLabel->text()
- << sep << m_ui.miscGroupBox->title()
- << sep << m_ui.logCountLabel->text()
- << sep << m_ui.timeOutLabel->text()
- << sep << m_ui.promptToSubmitCheckBox->text()
- << sep << m_ui.spaceIgnorantAnnotationCheckBox->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
SettingsPage::SettingsPage() :
m_widget(0)
{
@@ -108,12 +89,12 @@ SettingsPage::SettingsPage() :
setDisplayName(tr("Subversion"));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_widget = new SettingsPageWidget(parent);
- m_widget->setSettings(SubversionPlugin::instance()->settings());
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new SettingsPageWidget;
+ m_widget->setSettings(SubversionPlugin::instance()->settings());
+ }
return m_widget;
}
@@ -122,7 +103,7 @@ void SettingsPage::apply()
SubversionPlugin::instance()->setSettings(m_widget->settings());
}
-bool SettingsPage::matches(const QString &s) const
+void SettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/subversion/settingspage.h b/src/plugins/subversion/settingspage.h
index 71438eea73..a902ccc34b 100644
--- a/src/plugins/subversion/settingspage.h
+++ b/src/plugins/subversion/settingspage.h
@@ -57,8 +57,6 @@ public:
SubversionSettings settings() const;
void setSettings(const SubversionSettings &);
- QString searchKeywords() const;
-
private:
Ui::SettingsPage m_ui;
};
@@ -71,14 +69,12 @@ class SettingsPage : public VcsBase::VcsBaseOptionsPage
public:
SettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &) const;
+ void finish();
private:
- QString m_searchKeywords;
- SettingsPageWidget* m_widget;
+ QPointer<SettingsPageWidget> m_widget;
};
} // namespace Subversion
diff --git a/src/plugins/subversion/subversion.pro b/src/plugins/subversion/subversion.pro
index 6d2d9e21c0..ae8e211b62 100644
--- a/src/plugins/subversion/subversion.pro
+++ b/src/plugins/subversion/subversion.pro
@@ -2,6 +2,7 @@ include(../../qtcreatorplugin.pri)
HEADERS += annotationhighlighter.h \
subversionplugin.h \
+ subversionclient.h \
subversioncontrol.h \
settingspage.h \
subversioneditor.h \
@@ -13,6 +14,7 @@ HEADERS += annotationhighlighter.h \
SOURCES += annotationhighlighter.cpp \
subversionplugin.cpp \
+ subversionclient.cpp \
subversioncontrol.cpp \
settingspage.cpp \
subversioneditor.cpp \
diff --git a/src/plugins/subversion/subversion.qbs b/src/plugins/subversion/subversion.qbs
index d213ce0f77..6c3c48286f 100644
--- a/src/plugins/subversion/subversion.qbs
+++ b/src/plugins/subversion/subversion.qbs
@@ -23,6 +23,8 @@ QtcPlugin {
"settingspage.h",
"settingspage.ui",
"subversion.qrc",
+ "subversionclient.cpp",
+ "subversionclient.h",
"subversionconstants.h",
"subversioncontrol.cpp",
"subversioncontrol.h",
diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp
new file mode 100644
index 0000000000..27ad0c655e
--- /dev/null
+++ b/src/plugins/subversion/subversionclient.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "subversionclient.h"
+#include "subversionsettings.h"
+
+#include <vcsbase/vcsbaseplugin.h>
+#include <vcsbase/vcsbaseconstants.h>
+#include <vcsbase/vcsbaseeditorparameterwidget.h>
+#include <utils/synchronousprocess.h>
+
+#include <QDir>
+#include <QFileInfo>
+#include <QTextStream>
+#include <QDebug>
+
+namespace Subversion {
+namespace Internal {
+
+// Collect all parameters required for a diff to be able to associate them
+// with a diff editor and re-run the diff with parameters.
+struct SubversionDiffParameters
+{
+ QString workingDir;
+ QStringList extraOptions;
+ QStringList files;
+};
+
+// Parameter widget controlling whitespace diff mode, associated with a parameter
+class SubversionDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
+{
+ Q_OBJECT
+public:
+ explicit SubversionDiffParameterWidget(SubversionClient *client,
+ const SubversionDiffParameters &p,
+ QWidget *parent = 0);
+ QStringList arguments() const;
+ void executeCommand();
+
+private:
+ SubversionClient *m_client;
+ const SubversionDiffParameters m_params;
+};
+
+SubversionDiffParameterWidget::SubversionDiffParameterWidget(SubversionClient *client,
+ const SubversionDiffParameters &p,
+ QWidget *parent)
+ : VcsBase::VcsBaseEditorParameterWidget(parent), m_client(client), m_params(p)
+{
+ mapSetting(addToggleButton(QLatin1String("w"), tr("Ignore Whitespace")),
+ client->settings()->boolPointer(SubversionSettings::diffIgnoreWhiteSpaceKey));
+}
+
+QStringList SubversionDiffParameterWidget::arguments() const
+{
+ QStringList args;
+ // Subversion wants" -x -<ext-args>", default being -u
+ const QStringList formatArguments = VcsBaseEditorParameterWidget::arguments();
+ if (!formatArguments.isEmpty()) {
+ args << QLatin1String("-x")
+ << (QLatin1String("-u") + formatArguments.join(QString()));
+ }
+ return args;
+}
+
+void SubversionDiffParameterWidget::executeCommand()
+{
+ m_client->diff(m_params.workingDir, m_params.files, m_params.extraOptions);
+}
+
+SubversionClient::SubversionClient(SubversionSettings *settings) :
+ VcsBase::VcsBaseClient(settings)
+{
+}
+
+SubversionSettings *SubversionClient::settings() const
+{
+ return dynamic_cast<SubversionSettings *>(VcsBase::VcsBaseClient::settings());
+}
+
+Core::Id SubversionClient::vcsEditorKind(VcsCommand cmd) const
+{
+ switch (cmd) {
+ case DiffCommand:
+ return "Subversion Diff Editor"; // TODO: create subversionconstants.h
+ default:
+ return Core::Id();
+ }
+}
+
+SubversionClient::Version SubversionClient::svnVersion()
+{
+ if (m_svnVersionBinary != settings()->binaryPath()) {
+ QStringList args;
+ args << QLatin1String("--version") << QLatin1String("-q");
+ const Utils::SynchronousProcessResponse response =
+ VcsBase::VcsBasePlugin::runVcs(QDir().absolutePath(), settings()->binaryPath(),
+ args, settings()->timeOutMs());
+ if (response.result == Utils::SynchronousProcessResponse::Finished &&
+ response.exitCode == 0) {
+ m_svnVersionBinary = settings()->binaryPath();
+ m_svnVersion = response.stdOut.trimmed();
+ } else {
+ m_svnVersionBinary.clear();
+ m_svnVersion.clear();
+ }
+ }
+
+ SubversionClient::Version v;
+ if (::sscanf(m_svnVersion.toLatin1().constData(), "%d.%d.%d",
+ &v.majorVersion, &v.minorVersion, &v.patchVersion) != 3) {
+ v.majorVersion = v.minorVersion = v.patchVersion = -1;
+ }
+
+ return v;
+}
+
+// Add authorization options to the command line arguments.
+// SVN pre 1.5 does not accept "--userName" for "add", which is most likely
+// an oversight. As no password is needed for the option, generally omit it.
+QStringList SubversionClient::addAuthenticationOptions(const QStringList &args,
+ const QString &userName,
+ const QString &password)
+{
+ if (userName.isEmpty())
+ return args;
+ if (!args.empty() && args.front() == QLatin1String("add"))
+ return args;
+ QStringList rc;
+ rc.push_back(QLatin1String("--username"));
+ rc.push_back(userName);
+ if (!password.isEmpty()) {
+ rc.push_back(QLatin1String("--password"));
+ rc.push_back(password);
+ }
+ rc.append(args);
+ return rc;
+}
+
+void SubversionClient::diff(const QString &workingDir, const QStringList &files,
+ const QStringList &extraOptions)
+{
+ QStringList args(extraOptions);
+ Version v = svnVersion();
+
+ // --internal-diff is new in v1.7.0
+ if (v.majorVersion > 1 || (v.majorVersion == 1 && v.minorVersion >= 7))
+ args.append(QLatin1String("--internal-diff"));
+
+ const bool hasAuth = settings()->hasAuthentication();
+ const QString userName = hasAuth ? settings()->stringValue(SubversionSettings::userKey) : QString();
+ const QString password = hasAuth ? settings()->stringValue(SubversionSettings::passwordKey) : QString();
+ args = addAuthenticationOptions(args, userName, password);
+
+ VcsBaseClient::diff(workingDir, files, args);
+}
+
+QString SubversionClient::findTopLevelForFile(const QFileInfo &file) const
+{
+ Q_UNUSED(file)
+ return QString();
+}
+
+QStringList SubversionClient::revisionSpec(const QString &revision) const
+{
+ Q_UNUSED(revision)
+ return QStringList();
+}
+
+VcsBase::VcsBaseClient::StatusItem SubversionClient::parseStatusLine(const QString &line) const
+{
+ Q_UNUSED(line)
+ return VcsBase::VcsBaseClient::StatusItem();
+}
+
+VcsBase::VcsBaseEditorParameterWidget *SubversionClient::createDiffEditor(
+ const QString &workingDir, const QStringList &files, const QStringList &extraOptions)
+{
+ Q_UNUSED(extraOptions)
+ SubversionDiffParameters p;
+ p.workingDir = workingDir;
+ p.files = files;
+ p.extraOptions = extraOptions;
+ return new SubversionDiffParameterWidget(this, p);
+}
+
+} // namespace Internal
+} // namespace Subversion
+
+#include "subversionclient.moc"
diff --git a/src/plugins/subversion/subversionclient.h b/src/plugins/subversion/subversionclient.h
new file mode 100644
index 0000000000..e95dcea2a7
--- /dev/null
+++ b/src/plugins/subversion/subversionclient.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef SUBVERSIONCLIENT_H
+#define SUBVERSIONCLIENT_H
+
+#include "subversionsettings.h"
+#include <vcsbase/vcsbaseclient.h>
+
+namespace Subversion {
+namespace Internal {
+
+class SubversionSettings;
+
+class SubversionClient : public VcsBase::VcsBaseClient
+{
+ Q_OBJECT
+
+public:
+ SubversionClient(SubversionSettings *settings);
+
+ SubversionSettings *settings() const;
+ void diff(const QString &workingDir, const QStringList &files,
+ const QStringList &extraOptions = QStringList());
+ QString findTopLevelForFile(const QFileInfo &file) const;
+ QStringList revisionSpec(const QString &revision) const;
+ StatusItem parseStatusLine(const QString &line) const;
+
+ class Version {
+ public:
+ int majorVersion;
+ int minorVersion;
+ int patchVersion;
+ };
+
+ Version svnVersion();
+
+ // Add authorization options to the command line arguments.
+ static QStringList addAuthenticationOptions(const QStringList &args,
+ const QString &userName = QString(),
+ const QString &password = QString());
+
+protected:
+ Core::Id vcsEditorKind(VcsCommand cmd) const;
+ VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
+ const QStringList &files,
+ const QStringList &extraOptions);
+private:
+ QString m_svnVersionBinary;
+ QString m_svnVersion;
+};
+
+} // namespace Internal
+} // namespace Subversion
+
+#endif // SUBVERSIONCLIENT_H
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 84d107cb6e..2ccfa4cb9c 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -33,6 +33,7 @@
#include "subversioneditor.h"
#include "subversionsubmiteditor.h"
+#include "subversionclient.h"
#include "subversionconstants.h"
#include "subversioncontrol.h"
#include "checkoutwizard.h"
@@ -209,6 +210,7 @@ SubversionPlugin::SubversionPlugin() :
SubversionPlugin::~SubversionPlugin()
{
+ delete m_client;
cleanCommitMessageFile();
}
@@ -251,6 +253,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
return false;
m_settings.readSettings(Core::ICore::settings());
+ m_client = new SubversionClient(&m_settings);
addAutoReleasedObject(new SettingsPage);
@@ -497,117 +500,7 @@ bool SubversionPlugin::submitEditorAboutToClose()
void SubversionPlugin::diffCommitFiles(const QStringList &files)
{
- svnDiff(m_commitRepository, files);
-}
-
-// Collect all parameters required for a diff to be able to associate them
-// with a diff editor and re-run the diff with parameters.
-struct SubversionDiffParameters
-{
- QString workingDir;
- QStringList arguments;
- QStringList files;
- QString diffName;
-};
-
-// Parameter widget controlling whitespace diff mode, associated with a parameter
-class SubversionDiffParameterWidget : public VcsBase::VcsBaseEditorParameterWidget
-{
- Q_OBJECT
-public:
- explicit SubversionDiffParameterWidget(const SubversionDiffParameters &p, QWidget *parent = 0);
-
-signals:
- void reRunDiff(const Subversion::Internal::SubversionDiffParameters &);
-
-private slots:
- void triggerReRun();
-
-private:
- const SubversionDiffParameters m_parameters;
-};
-
-SubversionDiffParameterWidget::SubversionDiffParameterWidget(const SubversionDiffParameters &p, QWidget *parent) :
- VcsBase::VcsBaseEditorParameterWidget(parent), m_parameters(p)
-{
- setBaseArguments(p.arguments);
- addToggleButton(QLatin1String("w"), tr("Ignore Whitespace"));
- connect(this, SIGNAL(argumentsChanged()), this, SLOT(triggerReRun()));
-}
-
-void SubversionDiffParameterWidget::triggerReRun()
-{
- SubversionDiffParameters effectiveParameters = m_parameters;
- // Subversion wants" -x -<ext-args>", default being -u
- const QStringList a = arguments();
- if (!a.isEmpty())
- effectiveParameters.arguments << QLatin1String("-x") << (QLatin1String("-u") + a.join(QString()));
- emit reRunDiff(effectiveParameters);
-}
-
-static inline void setWorkingDirectory(Core::IEditor *editor, const QString &wd)
-{
- if (VcsBase::VcsBaseEditorWidget *ve = qobject_cast<VcsBase::VcsBaseEditorWidget*>(editor->widget()))
- ve->setWorkingDirectory(wd);
-}
-
-void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &files, QString diffname)
-{
- SubversionDiffParameters p;
- p.workingDir = workingDir;
- p.files = files;
- p.diffName = diffname;
- svnDiff(p);
-}
-
-void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParameters &p)
-{
- if (Subversion::Constants::debug)
- qDebug() << Q_FUNC_INFO << p.files << p.diffName;
- const QString source = VcsBase::VcsBaseEditorWidget::getSource(p.workingDir, p.files);
- QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditorWidget::getCodec(source);
-
- const QString diffName = p.files.count() == 1 && p.diffName.isEmpty() ?
- QFileInfo(p.files.front()).fileName() : p.diffName;
-
- QStringList args(QLatin1String("diff"));
- Version v = svnVersion();
- if (v.majorVersion > 1
- || (v.majorVersion == 1 && v.minorVersion >= 7)) // --internal-diff is new in v1.7.0
- args.append(QLatin1String("--internal-diff"));
- args.append(p.arguments);
- args << p.files;
-
- const SubversionResponse response =
- runSvn(p.workingDir, args, m_settings.timeOutMs(), 0, codec);
- if (response.error)
- return;
-
- // diff of a single file? re-use an existing view if possible to support
- // the common usage pattern of continuously changing and diffing a file
- const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, p.workingDir, p.files);
- // Show in the same editor if diff has been executed before
- if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) {
- existingEditor->document()->setContents(response.stdOut.toUtf8());
- Core::EditorManager::activateEditor(existingEditor);
- setWorkingDirectory(existingEditor, p.workingDir);
- return;
- }
- const QString title = QString::fromLatin1("svn diff %1").arg(diffName);
- Core::IEditor *editor = showOutputInEditor(title, response.stdOut, VcsBase::DiffOutput, source, codec);
- setWorkingDirectory(editor, p.workingDir);
- VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag);
- SubversionEditor *diffEditorWidget = qobject_cast<SubversionEditor *>(editor->widget());
- QTC_ASSERT(diffEditorWidget, return);
-
- // Wire up the parameter widget to trigger a re-run on
- // parameter change and 'revert' from inside the diff editor.
- SubversionDiffParameterWidget *pw = new SubversionDiffParameterWidget(p);
- connect(pw, SIGNAL(reRunDiff(Subversion::Internal::SubversionDiffParameters)),
- this, SLOT(svnDiff(Subversion::Internal::SubversionDiffParameters)));
- connect(diffEditorWidget, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)),
- pw, SLOT(triggerReRun()));
- diffEditorWidget->setConfigurationWidget(pw);
+ m_client->diff(m_commitRepository, files);
}
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
@@ -724,15 +617,16 @@ void SubversionPlugin::diffProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
- svnDiff(state.currentProjectTopLevel(), QStringList(state.relativeCurrentProject()),
- state.currentProjectName());
+ const QString relativeProject = state.relativeCurrentProject();
+ m_client->diff(state.currentProjectTopLevel(),
+ relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject));
}
void SubversionPlugin::diffCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- svnDiff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
+ m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void SubversionPlugin::startCommitCurrentFile()
@@ -842,7 +736,7 @@ void SubversionPlugin::diffRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- svnDiff(state.topLevel(), QStringList());
+ m_client->diff(state.topLevel(), QStringList());
}
void SubversionPlugin::statusRepository()
@@ -1092,53 +986,6 @@ SubversionResponse
arguments, timeOut, flags, outputCodec);
}
-// Add authorization options to the command line arguments.
-// SVN pre 1.5 does not accept "--userName" for "add", which is most likely
-// an oversight. As no password is needed for the option, generally omit it.
-QStringList SubversionPlugin::addAuthenticationOptions(const QStringList &args,
- const QString &userName, const QString &password)
-{
- if (userName.isEmpty())
- return args;
- if (!args.empty() && args.front() == QLatin1String("add"))
- return args;
- QStringList rc;
- rc.push_back(QLatin1String("--username"));
- rc.push_back(userName);
- if (!password.isEmpty()) {
- rc.push_back(QLatin1String("--password"));
- rc.push_back(password);
- }
- rc.append(args);
- return rc;
-}
-
-SubversionPlugin::Version SubversionPlugin::svnVersion()
-{
- if (m_svnVersionBinary != m_settings.binaryPath()) {
- QStringList args;
- args << QLatin1String("--version") << QLatin1String("-q");
- const Utils::SynchronousProcessResponse response =
- VcsBase::VcsBasePlugin::runVcs(QDir().absolutePath(), m_settings.binaryPath(),
- args, m_settings.timeOutMs());
- if (response.result == Utils::SynchronousProcessResponse::Finished &&
- response.exitCode == 0) {
- m_svnVersionBinary = m_settings.binaryPath();
- m_svnVersion = response.stdOut.trimmed();
- } else {
- m_svnVersionBinary.clear();
- m_svnVersion.clear();
- }
- }
-
- SubversionPlugin::Version v;
- if (::sscanf(m_svnVersion.toLatin1().constData(), "%d.%d.%d",
- &v.majorVersion, &v.minorVersion, &v.patchVersion) != 3)
- v.majorVersion = v.minorVersion = v.patchVersion = -1;
-
- return v;
-}
-
SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
const QString &userName, const QString &password,
const QStringList &arguments, int timeOut,
@@ -1152,7 +999,7 @@ SubversionResponse SubversionPlugin::runSvn(const QString &workingDir,
return response;
}
- const QStringList completeArguments = SubversionPlugin::addAuthenticationOptions(arguments, userName, password);
+ const QStringList completeArguments = SubversionClient::addAuthenticationOptions(arguments, userName, password);
const Utils::SynchronousProcessResponse sp_resp =
VcsBase::VcsBasePlugin::runVcs(workingDir, executable, completeArguments, timeOut,
flags, outputCodec);
@@ -1448,4 +1295,3 @@ void SubversionPlugin::testLogResolving()
Q_EXPORT_PLUGIN(Subversion::Internal::SubversionPlugin)
-#include "subversionplugin.moc"
diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h
index 82940f1ae6..d6ddd80ce1 100644
--- a/src/plugins/subversion/subversionplugin.h
+++ b/src/plugins/subversion/subversionplugin.h
@@ -62,7 +62,7 @@ namespace Internal {
class SubversionSubmitEditor;
class SubversionControl;
-struct SubversionDiffParameters;
+class SubversionClient;
struct SubversionResponse
{
@@ -84,8 +84,6 @@ public:
bool initialize(const QStringList &arguments, QString *errorMessage);
- void svnDiff(const QString &workingDir, const QStringList &files, QString diffname = QString());
-
SubversionSubmitEditor *openSubversionSubmitEditor(const QString &fileName);
SubversionSettings settings() const;
@@ -102,24 +100,9 @@ public:
static SubversionPlugin *instance();
- // Add authorization options to the command line arguments.
- static QStringList addAuthenticationOptions(const QStringList &args,
- const QString &userName = QString(),
- const QString &password = QString());
-
- class Version {
- public:
- int majorVersion;
- int minorVersion;
- int patchVersion;
- };
-
- Version svnVersion();
-
public slots:
void vcsAnnotate(const QString &workingDir, const QString &file,
const QString &revision = QString(), int lineNumber = -1);
- void svnDiff(const Subversion::Internal::SubversionDiffParameters &p);
private slots:
void addCurrentFile();
@@ -183,6 +166,7 @@ private:
const QStringList m_svnDirectories;
SubversionSettings m_settings;
+ SubversionClient *m_client;
QString m_commitMessageFileName;
QString m_commitRepository;
@@ -214,9 +198,6 @@ private:
QAction *m_menuAction;
bool m_submitActionTriggered;
- QString m_svnVersionBinary;
- QString m_svnVersion;
-
static SubversionPlugin *m_subversionPluginInstance;
};
diff --git a/src/plugins/subversion/subversionsettings.cpp b/src/plugins/subversion/subversionsettings.cpp
index fe17e1c6bf..c066f0f7d6 100644
--- a/src/plugins/subversion/subversionsettings.cpp
+++ b/src/plugins/subversion/subversionsettings.cpp
@@ -41,6 +41,7 @@ const QLatin1String SubversionSettings::useAuthenticationKey("Authentication");
const QLatin1String SubversionSettings::userKey("User");
const QLatin1String SubversionSettings::passwordKey("Password");
const QLatin1String SubversionSettings::spaceIgnorantAnnotationKey("SpaceIgnorantAnnotation");
+const QLatin1String SubversionSettings::diffIgnoreWhiteSpaceKey("DiffIgnoreWhiteSpace");
SubversionSettings::SubversionSettings()
{
@@ -51,6 +52,7 @@ SubversionSettings::SubversionSettings()
declareKey(userKey, QLatin1String(""));
declareKey(passwordKey, QLatin1String(""));
declareKey(spaceIgnorantAnnotationKey, true);
+ declareKey(diffIgnoreWhiteSpaceKey, false);
}
bool SubversionSettings::hasAuthentication() const
diff --git a/src/plugins/subversion/subversionsettings.h b/src/plugins/subversion/subversionsettings.h
index a91d9c942d..f986f32aeb 100644
--- a/src/plugins/subversion/subversionsettings.h
+++ b/src/plugins/subversion/subversionsettings.h
@@ -42,6 +42,7 @@ public:
static const QLatin1String userKey;
static const QLatin1String passwordKey;
static const QLatin1String spaceIgnorantAnnotationKey;
+ static const QLatin1String diffIgnoreWhiteSpaceKey;
SubversionSettings();
bool hasAuthentication() const;
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 239041311c..adf2e2364d 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -92,7 +92,7 @@ BaseTextDocument::~BaseTextDocument()
delete d;
}
-QString BaseTextDocument::contents() const
+QString BaseTextDocument::plainText() const
{
return document()->toPlainText();
}
@@ -195,7 +195,7 @@ SyntaxHighlighter *BaseTextDocument::syntaxHighlighter() const
return d->m_highlighter;
}
-ITextMarkable *BaseTextDocument::documentMarker() const
+ITextMarkable *BaseTextDocument::markableInterface() const
{
BaseTextDocumentLayout *documentLayout =
qobject_cast<BaseTextDocumentLayout *>(d->m_document->documentLayout());
diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h
index a8f8f2ca7a..1a0a8ff3f5 100644
--- a/src/plugins/texteditor/basetextdocument.h
+++ b/src/plugins/texteditor/basetextdocument.h
@@ -58,7 +58,7 @@ public:
virtual ~BaseTextDocument();
// ITextEditorDocument
- QString contents() const;
+ QString plainText() const;
QString textAt(int pos, int length) const;
QChar characterAt(int pos) const;
@@ -72,7 +72,7 @@ public:
const TabSettings &tabSettings() const;
const ExtraEncodingSettings &extraEncodingSettings() const;
- ITextMarkable *documentMarker() const;
+ ITextMarkable *markableInterface() const;
// IDocument implementation.
bool save(QString *errorString, const QString &fileName, bool autoSave);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 6b9ba965e1..eddeb3ce99 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -486,11 +486,6 @@ int BaseTextEditorWidgetPrivate::visualIndent(const QTextBlock &block) const
return 0;
}
-ITextMarkable *BaseTextEditorWidget::markableInterface() const
-{
- return baseTextDocument()->documentMarker();
-}
-
BaseTextEditor *BaseTextEditorWidget::editor() const
{
if (!d->m_editor) {
@@ -498,8 +493,6 @@ BaseTextEditor *BaseTextEditorWidget::editor() const
d->m_codeAssistant->configure(d->m_editor);
connect(this, SIGNAL(textChanged()),
d->m_editor, SIGNAL(contentsChanged()));
- connect(qobject_cast<BaseTextDocument *>(d->m_editor->document()),SIGNAL(mimeTypeChanged()),
- d->m_codeAssistant.data(), SLOT(reconfigure()));
}
return d->m_editor;
}
@@ -637,7 +630,7 @@ void BaseTextEditorWidget::setChangeSet(const Utils::ChangeSet &changeSet)
}
}
-Core::IDocument *BaseTextEditorWidget::editorDocument() const
+BaseTextDocument *BaseTextEditorWidget::baseTextDocument() const
{
return d->m_document.data();
}
@@ -2089,12 +2082,6 @@ void BaseTextEditorWidget::duplicateFrom(BaseTextEditorWidget *widget)
d->m_document = widget->d->m_document;
}
-QSharedPointer<BaseTextDocument> BaseTextEditorWidget::baseTextDocument() const
-{
- return d->m_document;
-}
-
-
void BaseTextEditorWidget::setBaseTextDocument(const QSharedPointer<BaseTextDocument> &doc)
{
if (!doc.isNull()) {
@@ -2451,7 +2438,6 @@ BaseTextEditorWidgetPrivate::BaseTextEditorWidgetPrivate()
m_linkPressed(false),
m_delayedUpdateTimer(0),
m_editor(0),
- m_actionHack(0),
m_inBlockSelectionMode(false),
m_moveLineUndoHack(false),
m_findScopeVerticalBlockSelectionFirstColumn(-1),
@@ -2473,11 +2459,11 @@ BaseTextEditorWidgetPrivate::~BaseTextEditorWidgetPrivate()
void BaseTextEditorWidgetPrivate::setupDocumentSignals(const QSharedPointer<BaseTextDocument> &document)
{
- QSharedPointer<BaseTextDocument> oldDocument = q->baseTextDocument();
- if (!oldDocument.isNull()) {
+ BaseTextDocument *oldDocument = q->baseTextDocument();
+ if (oldDocument) {
q->disconnect(oldDocument->document(), 0, q, 0);
- q->disconnect(oldDocument.data(), 0, q, 0);
- q->disconnect(q, 0, oldDocument.data(), 0);
+ q->disconnect(oldDocument, 0, q, 0);
+ q->disconnect(q, 0, oldDocument, 0);
}
QTextDocument *doc = document->document();
@@ -5182,16 +5168,6 @@ void BaseTextEditorWidget::_q_highlightBlocks()
}
}
-void BaseTextEditorWidget::setActionHack(QObject *hack)
-{
- d->m_actionHack = hack;
-}
-
-QObject *BaseTextEditorWidget::actionHack() const
-{
- return d->m_actionHack;
-}
-
void BaseTextEditorWidget::changeEvent(QEvent *e)
{
QPlainTextEdit::changeEvent(e);
@@ -6147,7 +6123,7 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
if (a && a->isEnabled())
menu->addAction(a);
- QSharedPointer<BaseTextDocument> doc = baseTextDocument();
+ BaseTextDocument *doc = baseTextDocument();
if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {
a = Core::ActionManager::command(Constants::SWITCH_UTF8BOM)->action();
if (a && a->isEnabled()) {
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 6994a90e97..e5b633ddab 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -30,6 +30,7 @@
#ifndef BASETEXTEDITOR_H
#define BASETEXTEDITOR_H
+#include "basetextdocument.h"
#include "itexteditor.h"
#include "codeassist/assistenums.h"
@@ -69,7 +70,6 @@ namespace Internal {
class ITextMarkable;
-class BaseTextDocument;
class BaseTextEditor;
class FontSettings;
class BehaviorSettings;
@@ -135,12 +135,12 @@ public:
const Utils::ChangeSet &changeSet() const;
void setChangeSet(const Utils::ChangeSet &changeSet);
- // EditorInterface
- Core::IDocument *editorDocument() const;
+ BaseTextDocument *baseTextDocument() const;
+
+ // IEditor
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName);
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
-
void gotoLine(int line, int column = 0);
int position(ITextEditor::PositionOperation posOp = ITextEditor::Current,
@@ -148,7 +148,6 @@ public:
void convertPosition(int pos, int *line, int *column) const;
BaseTextEditor *editor() const;
- ITextMarkable *markableInterface() const;
void print(QPrinter *);
@@ -209,9 +208,6 @@ public:
int columnCount() const;
int rowCount() const;
- void setActionHack(QObject *hack);
- QObject *actionHack() const;
-
void setReadOnly(bool b);
void setTextCursor(const QTextCursor &cursor);
@@ -362,7 +358,6 @@ public:
void duplicateFrom(BaseTextEditorWidget *editor);
protected:
- QSharedPointer<BaseTextDocument> baseTextDocument() const;
void setBaseTextDocument(const QSharedPointer<BaseTextDocument> &doc);
void setDefaultPath(const QString &defaultPath);
@@ -597,9 +592,10 @@ public:
friend class BaseTextEditorWidget;
BaseTextEditorWidget *editorWidget() const { return m_editorWidget; }
+ BaseTextDocument *baseTextDocument() { return m_editorWidget->baseTextDocument(); }
// IEditor
- Core::IDocument *document() { return m_editorWidget->editorDocument(); }
+ Core::IDocument *document() { return m_editorWidget->baseTextDocument(); }
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
QByteArray saveState() const { return m_editorWidget->saveState(); }
@@ -624,8 +620,6 @@ public:
QString selectedText() const;
- ITextMarkable *markableInterface() { return m_editorWidget->markableInterface(); }
-
QString contextHelpId() const; // from IContext
// ITextEditor
diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h
index e21677de32..54ccd52a2b 100644
--- a/src/plugins/texteditor/basetexteditor_p.h
+++ b/src/plugins/texteditor/basetexteditor_p.h
@@ -49,7 +49,6 @@
namespace TextEditor {
class BaseTextDocument;
-class TextEditorActionHandler;
class CodeAssistant;
namespace Internal {
@@ -102,7 +101,6 @@ public:
BaseTextEditorWidgetPrivate();
~BaseTextEditorWidgetPrivate();
- void setupBasicEditActions(TextEditorActionHandler *actionHandler);
void setupDocumentSignals(const QSharedPointer<BaseTextDocument> &document);
void updateLineSelectionColor();
@@ -195,8 +193,6 @@ public:
BaseTextEditor *m_editor;
- QObject *m_actionHack;
-
QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds];
// block selection mode
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
index dd5832a7bb..f0f045dd4a 100644
--- a/src/plugins/texteditor/basetextmark.cpp
+++ b/src/plugins/texteditor/basetextmark.cpp
@@ -60,14 +60,11 @@ void BaseTextMarkRegistry::add(BaseTextMark *mark)
{
m_marks[FileName::fromString(mark->fileName())].insert(mark);
DocumentModel *documentModel = EditorManager::documentModel();
- IDocument *document = documentModel->documentForFilePath(mark->fileName());
+ ITextEditorDocument *document
+ = qobject_cast<ITextEditorDocument*>(documentModel->documentForFilePath(mark->fileName()));
if (!document)
return;
- // TODO: markableInterface should be moved to ITextEditorDocument
- if (ITextEditor *textEditor
- = qobject_cast<ITextEditor *>(documentModel->editorsForDocument(document).first())) {
- textEditor->markableInterface()->addMark(mark);
- }
+ document->markableInterface()->addMark(mark);
}
bool BaseTextMarkRegistry::remove(BaseTextMark *mark)
@@ -77,16 +74,14 @@ bool BaseTextMarkRegistry::remove(BaseTextMark *mark)
void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor)
{
- ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor);
- if (!textEditor)
+ ITextEditorDocument *document = qobject_cast<ITextEditorDocument *>(editor ? editor->document() : 0);
+ if (!document)
return;
- if (!m_marks.contains(FileName::fromString(editor->document()->filePath())))
+ if (!m_marks.contains(FileName::fromString(document->filePath())))
return;
- foreach (BaseTextMark *mark, m_marks.value(FileName::fromString(editor->document()->filePath()))) {
- ITextMarkable *markableInterface = textEditor->markableInterface();
- markableInterface->addMark(mark);
- }
+ foreach (BaseTextMark *mark, m_marks.value(FileName::fromString(document->filePath())))
+ document->markableInterface()->addMark(mark);
}
void BaseTextMarkRegistry::documentRenamed(IDocument *document, const
@@ -102,7 +97,7 @@ void BaseTextMarkRegistry::documentRenamed(IDocument *document, const
return;
QSet<BaseTextMark *> toBeMoved;
- foreach (ITextMark *mark, baseTextDocument->documentMarker()->marks())
+ foreach (ITextMark *mark, baseTextDocument->markableInterface()->marks())
if (BaseTextMark *baseTextMark = dynamic_cast<BaseTextMark *>(mark))
toBeMoved.insert(baseTextMark);
diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp
index a5a7001f0a..b9a2bc1524 100644
--- a/src/plugins/texteditor/behaviorsettingspage.cpp
+++ b/src/plugins/texteditor/behaviorsettingspage.cpp
@@ -49,6 +49,7 @@
#include <qmljseditor/qmljseditorconstants.h>
#include <qmljstools/qmljstoolsconstants.h>
+#include <QPointer>
#include <QSettings>
#include <QTextCodec>
@@ -59,6 +60,7 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
explicit BehaviorSettingsPagePrivate(const BehaviorSettingsPageParameters &p);
const BehaviorSettingsPageParameters m_parameters;
+ QPointer<QWidget> m_widget;
Internal::Ui::BehaviorSettingsPage *m_page;
void init();
@@ -70,8 +72,6 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
StorageSettings m_storageSettings;
BehaviorSettings m_behaviorSettings;
ExtraEncodingSettings m_extraEncodingSettings;
-
- QString m_searchKeywords;
};
BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate
@@ -114,30 +114,28 @@ BehaviorSettingsPage::~BehaviorSettingsPage()
delete d;
}
-QWidget *BehaviorSettingsPage::createPage(QWidget *parent)
+QWidget *BehaviorSettingsPage::widget()
{
- QWidget *w = new QWidget(parent);
- d->m_page = new Internal::Ui::BehaviorSettingsPage;
- d->m_page->setupUi(w);
- if (Utils::HostOsInfo::isMacHost())
- d->m_page->gridLayout->setContentsMargins(-1, 0, -1, 0); // don't ask.
- d->m_pageCodeStyle = new SimpleCodeStylePreferences(w);
- d->m_pageCodeStyle->setDelegatingPool(d->m_codeStyle->delegatingPool());
- d->m_pageCodeStyle->setTabSettings(d->m_codeStyle->tabSettings());
- d->m_pageCodeStyle->setCurrentDelegate(d->m_codeStyle->currentDelegate());
- d->m_page->behaviorWidget->setCodeStyle(d->m_pageCodeStyle);
-
- TabSettingsWidget *tabSettingsWidget = d->m_page->behaviorWidget->tabSettingsWidget();
- tabSettingsWidget->setCodingStyleWarningVisible(true);
- connect(tabSettingsWidget, SIGNAL(codingStyleLinkClicked(TextEditor::TabSettingsWidget::CodingStyleLink)),
- this, SLOT(openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink)));
-
- settingsToUI();
-
- if (d->m_searchKeywords.isEmpty())
- d->m_searchKeywords = d->m_page->behaviorWidget->collectUiKeywords();
-
- return w;
+ if (!d->m_widget) {
+ d->m_widget = new QWidget;
+ d->m_page = new Internal::Ui::BehaviorSettingsPage;
+ d->m_page->setupUi(d->m_widget);
+ if (Utils::HostOsInfo::isMacHost())
+ d->m_page->gridLayout->setContentsMargins(-1, 0, -1, 0); // don't ask.
+ d->m_pageCodeStyle = new SimpleCodeStylePreferences(d->m_widget);
+ d->m_pageCodeStyle->setDelegatingPool(d->m_codeStyle->delegatingPool());
+ d->m_pageCodeStyle->setTabSettings(d->m_codeStyle->tabSettings());
+ d->m_pageCodeStyle->setCurrentDelegate(d->m_codeStyle->currentDelegate());
+ d->m_page->behaviorWidget->setCodeStyle(d->m_pageCodeStyle);
+
+ TabSettingsWidget *tabSettingsWidget = d->m_page->behaviorWidget->tabSettingsWidget();
+ tabSettingsWidget->setCodingStyleWarningVisible(true);
+ connect(tabSettingsWidget, SIGNAL(codingStyleLinkClicked(TextEditor::TabSettingsWidget::CodingStyleLink)),
+ this, SLOT(openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink)));
+
+ settingsToUI();
+ }
+ return d->m_widget;
}
void BehaviorSettingsPage::apply()
@@ -227,6 +225,7 @@ void BehaviorSettingsPage::settingsToUI()
void BehaviorSettingsPage::finish()
{
+ delete d->m_widget;
if (!d->m_page) // page was never shown
return;
delete d->m_page;
@@ -263,11 +262,6 @@ const ExtraEncodingSettings &BehaviorSettingsPage::extraEncodingSettings() const
return d->m_extraEncodingSettings;
}
-bool BehaviorSettingsPage::matches(const QString &s) const
-{
- return d->m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
void BehaviorSettingsPage::openCodingStylePreferences(TabSettingsWidget::CodingStyleLink link)
{
diff --git a/src/plugins/texteditor/behaviorsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h
index ccaaaa34ef..042c9640dc 100644
--- a/src/plugins/texteditor/behaviorsettingspage.h
+++ b/src/plugins/texteditor/behaviorsettingspage.h
@@ -62,10 +62,9 @@ public:
~BehaviorSettingsPage();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
ICodeStylePreferences *codeStyle() const;
CodeStylePool *codeStylePool() const;
diff --git a/src/plugins/texteditor/behaviorsettingswidget.cpp b/src/plugins/texteditor/behaviorsettingswidget.cpp
index 044b2a328d..83571a06c3 100644
--- a/src/plugins/texteditor/behaviorsettingswidget.cpp
+++ b/src/plugins/texteditor/behaviorsettingswidget.cpp
@@ -223,35 +223,6 @@ void BehaviorSettingsWidget::assignedExtraEncodingSettings(
(ExtraEncodingSettings::Utf8BomSetting)d->m_ui.utf8BomBox->currentIndex();
}
-QString BehaviorSettingsWidget::collectUiKeywords() const
-{
- static const QLatin1Char sep(' ');
- QString keywords;
- QTextStream(&keywords)
- << sep << d->m_ui.tabPreferencesWidget->searchKeywords()
- << sep << d->m_ui.autoIndent->text()
- << sep << d->m_ui.smartBackspaceLabel->text()
- << sep << d->m_ui.tabKeyBehaviorLabel->text()
- << sep << d->m_ui.cleanWhitespace->text()
- << sep << d->m_ui.inEntireDocument->text()
- << sep << d->m_ui.cleanIndentation->text()
- << sep << d->m_ui.addFinalNewLine->text()
- << sep << d->m_ui.encodingLabel->text()
- << sep << d->m_ui.utf8BomLabel->text()
- << sep << d->m_ui.mouseNavigation->text()
- << sep << d->m_ui.scrollWheelZooming->text()
- << sep << d->m_ui.helpTooltipsLabel->text()
- << sep << d->m_ui.constrainTooltipsBox->itemText(0)
- << sep << d->m_ui.constrainTooltipsBox->itemText(1)
- << sep << d->m_ui.camelCaseNavigation->text()
- << sep << d->m_ui.keyboardTooltips->text()
- << sep << d->m_ui.groupBoxStorageSettings->title()
- << sep << d->m_ui.groupBoxEncodings->title()
- << sep << d->m_ui.groupBoxMouse->title();
- keywords.remove(QLatin1Char('&'));
- return keywords;
-}
-
TabSettingsWidget *BehaviorSettingsWidget::tabSettingsWidget() const
{
return d->m_ui.tabPreferencesWidget->tabSettingsWidget();
diff --git a/src/plugins/texteditor/behaviorsettingswidget.h b/src/plugins/texteditor/behaviorsettingswidget.h
index 7fe303da22..50420bfaca 100644
--- a/src/plugins/texteditor/behaviorsettingswidget.h
+++ b/src/plugins/texteditor/behaviorsettingswidget.h
@@ -76,8 +76,6 @@ public:
void setAssignedExtraEncodingSettings(const ExtraEncodingSettings &encodingSettings);
void assignedExtraEncodingSettings(ExtraEncodingSettings *encodingSettings) const;
- QString collectUiKeywords() const;
-
TabSettingsWidget *tabSettingsWidget() const;
signals:
diff --git a/src/plugins/texteditor/behaviorsettingswidget.ui b/src/plugins/texteditor/behaviorsettingswidget.ui
index 324313b74a..5aeb0f37c5 100644
--- a/src/plugins/texteditor/behaviorsettingswidget.ui
+++ b/src/plugins/texteditor/behaviorsettingswidget.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>802</width>
- <height>416</height>
+ <height>441</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -207,7 +207,7 @@ Specifies how backspace interacts with indentation.
</sizepolicy>
</property>
<property name="toolTip">
- <string>Clean whitespace in entire document instead of only for changed parts.</string>
+ <string>Cleans whitespace in entire document instead of only for changed parts.</string>
</property>
<property name="text">
<string>In entire &amp;document</string>
@@ -220,7 +220,7 @@ Specifies how backspace interacts with indentation.
<bool>false</bool>
</property>
<property name="toolTip">
- <string>Correct leading whitespace according to tab settings.</string>
+ <string>Corrects leading whitespace according to tab settings.</string>
</property>
<property name="text">
<string>Clean indentation</string>
@@ -230,7 +230,7 @@ Specifies how backspace interacts with indentation.
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="addFinalNewLine">
<property name="toolTip">
- <string>Always write a newline character at the end of the file.</string>
+ <string>Always writes a newline character at the end of the file.</string>
</property>
<property name="text">
<string>&amp;Ensure newline at end of file</string>
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp
index 81d5d2fc3d..c6efffae8b 100644
--- a/src/plugins/texteditor/codeassist/codeassistant.cpp
+++ b/src/plugins/texteditor/codeassist/codeassistant.cpp
@@ -185,6 +185,8 @@ void CodeAssistantPrivate::configure(BaseTextEditor *textEditor)
filterEditorSpecificProviders(&m_quickFixProviders, m_textEditor->id());
m_textEditor->editorWidget()->installEventFilter(this);
+ connect(m_textEditor->baseTextDocument(),SIGNAL(mimeTypeChanged()),
+ m_q, SLOT(reconfigure()));
}
void CodeAssistantPrivate::reconfigure()
diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp
index b5470e8ea0..010c4f9c9e 100644
--- a/src/plugins/texteditor/displaysettingspage.cpp
+++ b/src/plugins/texteditor/displaysettingspage.cpp
@@ -33,6 +33,7 @@
#include <coreplugin/icore.h>
+#include <QPointer>
#include <QTextStream>
using namespace TextEditor;
@@ -42,9 +43,9 @@ struct DisplaySettingsPage::DisplaySettingsPagePrivate
explicit DisplaySettingsPagePrivate(const DisplaySettingsPageParameters &p);
const DisplaySettingsPageParameters m_parameters;
+ QPointer<QWidget> m_widget;
Internal::Ui::DisplaySettingsPage *m_page;
DisplaySettings m_displaySettings;
- QString m_searchKeywords;
};
DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate
@@ -68,28 +69,15 @@ DisplaySettingsPage::~DisplaySettingsPage()
delete d;
}
-QWidget *DisplaySettingsPage::createPage(QWidget *parent)
+QWidget *DisplaySettingsPage::widget()
{
- QWidget *w = new QWidget(parent);
- d->m_page = new Internal::Ui::DisplaySettingsPage;
- d->m_page->setupUi(w);
- settingsToUI();
- if (d->m_searchKeywords.isEmpty()) {
- QTextStream(&d->m_searchKeywords) << d->m_page->displayLineNumbers->text()
- << ' ' << d->m_page->highlightCurrentLine->text()
- << ' ' << d->m_page->displayFoldingMarkers->text()
- << ' ' << d->m_page->highlightBlocks->text()
- << ' ' << d->m_page->visualizeWhitespace->text()
- << ' ' << d->m_page->animateMatchingParentheses->text()
- << ' ' << d->m_page->highlightMatchingParentheses->text()
- << ' ' << d->m_page->enableTextWrapping->text()
- << ' ' << d->m_page->autoFoldFirstComment->text()
- << ' ' << d->m_page->centerOnScroll->text()
- << ' ' << d->m_page->openLinksInNextSplit->text()
- << ' ' << d->m_page->displayFileEncoding->text();
- d->m_searchKeywords.remove(QLatin1Char('&'));
+ if (!d->m_widget) {
+ d->m_widget = new QWidget;
+ d->m_page = new Internal::Ui::DisplaySettingsPage;
+ d->m_page->setupUi(d->m_widget);
+ settingsToUI();
}
- return w;
+ return d->m_widget;
}
void DisplaySettingsPage::apply()
@@ -104,6 +92,7 @@ void DisplaySettingsPage::apply()
void DisplaySettingsPage::finish()
{
+ delete d->m_widget;
if (!d->m_page) // page was never shown
return;
delete d->m_page;
@@ -163,8 +152,3 @@ void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySe
emit displaySettingsChanged(newDisplaySettings);
}
}
-
-bool DisplaySettingsPage::matches(const QString &s) const
-{
- return d->m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
diff --git a/src/plugins/texteditor/displaysettingspage.h b/src/plugins/texteditor/displaysettingspage.h
index 802e303277..54f08259e3 100644
--- a/src/plugins/texteditor/displaysettingspage.h
+++ b/src/plugins/texteditor/displaysettingspage.h
@@ -55,10 +55,9 @@ public:
~DisplaySettingsPage();
// IOptionsPage
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
const DisplaySettings &displaySettings() const;
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index e3cd7e496a..a5bd146316 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -36,14 +36,15 @@
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
-#include <QDebug>
-#include <QSettings>
-#include <QTimer>
#include <QFileDialog>
#include <QFontDatabase>
#include <QInputDialog>
#include <QMessageBox>
#include <QPalette>
+#include <QPointer>
+#include <QSettings>
+#include <QTimer>
+#include <QDebug>
namespace TextEditor {
namespace Internal {
@@ -122,10 +123,10 @@ public:
TextEditor::FormatDescriptions m_descriptions;
FontSettings m_value;
FontSettings m_lastValue;
+ QPointer<QWidget> m_widget;
Ui::FontSettingsPage *m_ui;
SchemeListModel *m_schemeListModel;
bool m_refreshingSchemeList;
- QString m_searchKeywords;
};
} // namespace Internal
@@ -326,49 +327,40 @@ FontSettingsPage::~FontSettingsPage()
delete d_ptr;
}
-QWidget *FontSettingsPage::createPage(QWidget *parent)
+QWidget *FontSettingsPage::widget()
{
- QWidget *w = new QWidget(parent);
- d_ptr->m_ui = new Ui::FontSettingsPage;
- d_ptr->m_ui->setupUi(w);
- d_ptr->m_ui->schemeComboBox->setModel(d_ptr->m_schemeListModel);
+ if (!d_ptr->m_widget){
+ d_ptr->m_widget = new QWidget;
+ d_ptr->m_ui = new Ui::FontSettingsPage;
+ d_ptr->m_ui->setupUi(d_ptr->m_widget);
+ d_ptr->m_ui->schemeComboBox->setModel(d_ptr->m_schemeListModel);
- QFontDatabase db;
- const QStringList families = db.families();
- d_ptr->m_ui->familyComboBox->addItems(families);
- const int idx = families.indexOf(d_ptr->m_value.family());
- d_ptr->m_ui->familyComboBox->setCurrentIndex(idx);
+ QFontDatabase db;
+ const QStringList families = db.families();
+ d_ptr->m_ui->familyComboBox->addItems(families);
+ const int idx = families.indexOf(d_ptr->m_value.family());
+ d_ptr->m_ui->familyComboBox->setCurrentIndex(idx);
- d_ptr->m_ui->antialias->setChecked(d_ptr->m_value.antialias());
- d_ptr->m_ui->zoomSpinBox->setValue(d_ptr->m_value.fontZoom());
+ d_ptr->m_ui->antialias->setChecked(d_ptr->m_value.antialias());
+ d_ptr->m_ui->zoomSpinBox->setValue(d_ptr->m_value.fontZoom());
- d_ptr->m_ui->schemeEdit->setFormatDescriptions(d_ptr->m_descriptions);
- d_ptr->m_ui->schemeEdit->setBaseFont(d_ptr->m_value.font());
- d_ptr->m_ui->schemeEdit->setColorScheme(d_ptr->m_value.colorScheme());
+ d_ptr->m_ui->schemeEdit->setFormatDescriptions(d_ptr->m_descriptions);
+ d_ptr->m_ui->schemeEdit->setBaseFont(d_ptr->m_value.font());
+ d_ptr->m_ui->schemeEdit->setColorScheme(d_ptr->m_value.colorScheme());
- connect(d_ptr->m_ui->familyComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontFamilySelected(QString)));
- connect(d_ptr->m_ui->sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontSizeSelected(QString)));
- connect(d_ptr->m_ui->zoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fontZoomChanged()));
- connect(d_ptr->m_ui->schemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSchemeSelected(int)));
- connect(d_ptr->m_ui->copyButton, SIGNAL(clicked()), this, SLOT(copyColorScheme()));
- connect(d_ptr->m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(confirmDeleteColorScheme()));
+ connect(d_ptr->m_ui->familyComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontFamilySelected(QString)));
+ connect(d_ptr->m_ui->sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontSizeSelected(QString)));
+ connect(d_ptr->m_ui->zoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fontZoomChanged()));
+ connect(d_ptr->m_ui->schemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSchemeSelected(int)));
+ connect(d_ptr->m_ui->copyButton, SIGNAL(clicked()), this, SLOT(copyColorScheme()));
+ connect(d_ptr->m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(confirmDeleteColorScheme()));
- updatePointSizes();
- refreshColorSchemeList();
- d_ptr->m_lastValue = d_ptr->m_value;
- if (d_ptr->m_searchKeywords.isEmpty()) {
- QLatin1Char sep(' ');
- d_ptr->m_searchKeywords =
- d_ptr->m_ui->fontGroupBox->title() + sep
- + d_ptr->m_ui->familyLabel->text() + sep
- + d_ptr->m_ui->sizeLabel->text() + sep
- + d_ptr->m_ui->zoomLabel->text() + sep
- + d_ptr->m_ui->antialias->text() + sep
- + d_ptr->m_ui->colorSchemeGroupBox->title();
- d_ptr->m_searchKeywords.remove(QLatin1Char('&'));
+ updatePointSizes();
+ refreshColorSchemeList();
+ d_ptr->m_lastValue = d_ptr->m_value;
}
- return w;
+ return d_ptr->m_widget;
}
void FontSettingsPage::fontFamilySelected(const QString &family)
@@ -630,6 +622,7 @@ void FontSettingsPage::saveSettings()
void FontSettingsPage::finish()
{
+ delete d_ptr->m_widget;
if (!d_ptr->m_ui) // page was never shown
return;
// If changes were applied, these are equal. Otherwise restores last value.
@@ -642,8 +635,3 @@ const FontSettings &FontSettingsPage::fontSettings() const
{
return d_ptr->m_value;
}
-
-bool FontSettingsPage::matches(const QString &s) const
-{
- return d_ptr->m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h
index 3870904cd2..a5b9f6057f 100644
--- a/src/plugins/texteditor/fontsettingspage.h
+++ b/src/plugins/texteditor/fontsettingspage.h
@@ -92,10 +92,9 @@ public:
~FontSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &) const;
void saveSettings();
diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp
index c04a5d72e9..3aba87e3ad 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp
@@ -36,6 +36,7 @@
#include <coreplugin/icore.h>
#include <QMessageBox>
+#include <QPointer>
using namespace TextEditor;
using namespace Internal;
@@ -50,10 +51,9 @@ struct HighlighterSettingsPage::HighlighterSettingsPagePrivate
const QString m_displayName;
const QString m_settingsPrefix;
- QString m_searchKeywords;
-
HighlighterSettings m_settings;
+ QPointer<QWidget> m_widget;
Ui::HighlighterSettingsPage *m_page;
};
@@ -88,34 +88,30 @@ HighlighterSettingsPage::~HighlighterSettingsPage()
delete m_d;
}
-QWidget *HighlighterSettingsPage::createPage(QWidget *parent)
-{
- QWidget *w = new QWidget(parent);
- m_d->m_page = new Ui::HighlighterSettingsPage;
- m_d->m_page->setupUi(w);
- m_d->m_page->definitionFilesPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
- m_d->m_page->definitionFilesPath->addButton(tr("Download Definitions..."), this,
- SLOT(requestAvailableDefinitionsMetaData()));
- m_d->m_page->fallbackDefinitionFilesPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
- m_d->m_page->fallbackDefinitionFilesPath->addButton(tr("Autodetect"), this,
- SLOT(resetDefinitionsLocation()));
-
- settingsToUI();
-
- if (m_d->m_searchKeywords.isEmpty()) {
- QTextStream(&m_d->m_searchKeywords) << m_d->m_page->definitionFilesGroupBox->title()
- << m_d->m_page->locationLabel->text()
- << m_d->m_page->useFallbackLocation->text()
- << m_d->m_page->ignoreLabel->text();
+QWidget *HighlighterSettingsPage::widget()
+{
+ if (!m_d->m_widget) {
+ m_d->m_widget = new QWidget;
+ m_d->m_page = new Ui::HighlighterSettingsPage;
+ m_d->m_page->setupUi(m_d->m_widget);
+ m_d->m_page->definitionFilesPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_d->m_page->definitionFilesPath->setHistoryCompleter(QLatin1String("TextEditor.Highlighter.History"));
+ m_d->m_page->definitionFilesPath->addButton(tr("Download Definitions..."), this,
+ SLOT(requestAvailableDefinitionsMetaData()));
+ m_d->m_page->fallbackDefinitionFilesPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ m_d->m_page->fallbackDefinitionFilesPath->setHistoryCompleter(QLatin1String("TextEditor.Highlighter.History"));
+ m_d->m_page->fallbackDefinitionFilesPath->addButton(tr("Autodetect"), this,
+ SLOT(resetDefinitionsLocation()));
+
+ settingsToUI();
+
+ connect(m_d->m_page->useFallbackLocation, SIGNAL(clicked(bool)),
+ this, SLOT(setFallbackLocationState(bool)));
+ connect(m_d->m_page->definitionFilesPath, SIGNAL(validChanged(bool)),
+ this, SLOT(setDownloadDefinitionsState(bool)));
+ connect(m_d->m_widget, SIGNAL(destroyed()), this, SLOT(ignoreDownloadReply()));
}
-
- connect(m_d->m_page->useFallbackLocation, SIGNAL(clicked(bool)),
- this, SLOT(setFallbackLocationState(bool)));
- connect(m_d->m_page->definitionFilesPath, SIGNAL(validChanged(bool)),
- this, SLOT(setDownloadDefinitionsState(bool)));
- connect(w, SIGNAL(destroyed()), this, SLOT(ignoreDownloadReply()));
-
- return w;
+ return m_d->m_widget;
}
void HighlighterSettingsPage::apply()
@@ -133,17 +129,13 @@ void HighlighterSettingsPage::apply()
void HighlighterSettingsPage::finish()
{
+ delete m_d->m_widget;
if (!m_d->m_page) // page was not shown
return;
delete m_d->m_page;
m_d->m_page = 0;
}
-bool HighlighterSettingsPage::matches(const QString &s) const
-{
- return m_d->m_searchKeywords.contains(s, Qt::CaseInsensitive);
-}
-
const HighlighterSettings &HighlighterSettingsPage::highlighterSettings() const
{
m_d->ensureInitialized();
diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
index 770ef4c4cf..ef72878b48 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
+++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
@@ -52,10 +52,9 @@ public:
HighlighterSettingsPage(Core::Id id, QObject *parent);
~HighlighterSettingsPage();
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &s) const;
const HighlighterSettings &highlighterSettings() const;
diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp
index ab2b80b9b2..67a511033a 100644
--- a/src/plugins/texteditor/itexteditor.cpp
+++ b/src/plugins/texteditor/itexteditor.cpp
@@ -46,7 +46,7 @@ QMap<QString, QString> ITextEditor::openedTextDocumentContents()
if (!textEditorDocument)
continue;
QString fileName = textEditorDocument->filePath();
- workingCopy[fileName] = textEditorDocument->contents();
+ workingCopy[fileName] = textEditorDocument->plainText();
}
return workingCopy;
}
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
index 2fa63d34c1..a3ac48bd48 100644
--- a/src/plugins/texteditor/itexteditor.h
+++ b/src/plugins/texteditor/itexteditor.h
@@ -81,9 +81,11 @@ class TEXTEDITOR_EXPORT ITextEditorDocument : public Core::TextDocument
public:
explicit ITextEditorDocument(QObject *parent = 0);
- virtual QString contents() const = 0;
+ virtual QString plainText() const = 0;
virtual QString textAt(int pos, int length) const = 0;
virtual QChar characterAt(int pos) const = 0;
+
+ virtual ITextMarkable *markableInterface() const = 0;
};
class TEXTEDITOR_EXPORT ITextEditor : public Core::IEditor
@@ -126,8 +128,6 @@ public:
/*! Selects text between current cursor position and \a toPos. */
virtual void select(int toPos) = 0;
- virtual ITextMarkable *markableInterface() = 0;
-
virtual const Utils::CommentDefinition* commentDefinition() const = 0;
static QMap<QString, QString> openedTextDocumentContents();
diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp
index c664cdbafa..02f00d73bd 100644
--- a/src/plugins/texteditor/plaintexteditor.cpp
+++ b/src/plugins/texteditor/plaintexteditor.cpp
@@ -71,7 +71,7 @@ PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
m_commentDefinition.clearCommentStyles();
// If configure() is called immediately the whole document is considered modified
- connect(editorDocument(), SIGNAL(changed()), this, SLOT(configure()), Qt::QueuedConnection);
+ connect(baseTextDocument(), SIGNAL(changed()), this, SLOT(configure()), Qt::QueuedConnection);
connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure()));
}
@@ -79,7 +79,7 @@ IEditor *PlainTextEditor::duplicate(QWidget *parent)
{
PlainTextEditorWidget *newWidget = new PlainTextEditorWidget(parent);
newWidget->duplicateFrom(editorWidget());
- TextEditorPlugin::instance()->initializeEditor(newWidget);
+ TextEditorSettings::initializeEditor(newWidget);
return newWidget->editor();
}
@@ -107,8 +107,8 @@ void PlainTextEditorWidget::setTabSettings(const TextEditor::TabSettings &ts)
void PlainTextEditorWidget::configure()
{
MimeType mimeType;
- if (editorDocument())
- mimeType = MimeDatabase::findByFile(editorDocument()->filePath());
+ if (baseTextDocument())
+ mimeType = MimeDatabase::findByFile(baseTextDocument()->filePath());
configure(mimeType);
}
@@ -147,8 +147,8 @@ void PlainTextEditorWidget::configure(const MimeType &mimeType)
setCodeFoldingSupported(true);
}
- } else if (editorDocument()) {
- const QString &fileName = editorDocument()->filePath();
+ } else if (baseTextDocument()) {
+ const QString &fileName = baseTextDocument()->filePath();
if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
m_isMissingSyntaxDefinition = false;
}
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index c31d411e58..2efee71e0a 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -30,9 +30,10 @@
#include "plaintexteditorfactory.h"
#include "plaintexteditor.h"
#include "basetextdocument.h"
+#include "texteditoractionhandler.h"
#include "texteditorconstants.h"
#include "texteditorplugin.h"
-#include "texteditoractionhandler.h"
+#include "texteditorsettings.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/infobar.h>
@@ -50,22 +51,17 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
- m_actionHandler = new TextEditorActionHandler(
+ new TextEditorActionHandler(this,
TextEditor::Constants::C_TEXTEDITOR,
TextEditorActionHandler::Format |
TextEditorActionHandler::UnCommentSelection |
TextEditorActionHandler::UnCollapseAll);
}
-PlainTextEditorFactory::~PlainTextEditorFactory()
-{
- delete m_actionHandler;
-}
-
Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)
{
PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent);
- TextEditorPlugin::instance()->initializeEditor(rc);
+ TextEditorSettings::initializeEditor(rc);
connect(rc, SIGNAL(configured(Core::IEditor*)),
this, SLOT(updateEditorInfoBar(Core::IEditor*)));
updateEditorInfoBar(rc->editor());
diff --git a/src/plugins/texteditor/plaintexteditorfactory.h b/src/plugins/texteditor/plaintexteditorfactory.h
index facf43fa9b..b60a1d1fca 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.h
+++ b/src/plugins/texteditor/plaintexteditorfactory.h
@@ -35,7 +35,6 @@
#include <QStringList>
namespace TextEditor {
-class TextEditorActionHandler;
namespace Internal {
class PlainTextEditorFactory : public Core::IEditorFactory
@@ -44,17 +43,12 @@ class PlainTextEditorFactory : public Core::IEditorFactory
public:
PlainTextEditorFactory(QObject *parent = 0);
- ~PlainTextEditorFactory();
using Core::IEditorFactory::addMimeType;
Core::IEditor *createEditor(QWidget *parent);
- TextEditor::TextEditorActionHandler *actionHandler() const { return m_actionHandler; }
private slots:
void updateEditorInfoBar(Core::IEditor *editor);
-
-private:
- TextEditor::TextEditorActionHandler *m_actionHandler;
};
} // namespace Internal
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index 57dd3a9a81..c9c67c2541 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -158,7 +158,7 @@ RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileNam
{ }
RefactoringFile::RefactoringFile(BaseTextEditorWidget *editor)
- : m_fileName(editor->editorDocument()->filePath())
+ : m_fileName(editor->baseTextDocument()->filePath())
, m_document(0)
, m_editor(editor)
, m_openEditor(false)
diff --git a/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp b/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp
index 072a8a25f4..f143c249d4 100644
--- a/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp
+++ b/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp
@@ -94,11 +94,6 @@ void SimpleCodeStylePreferencesWidget::slotTabSettingsChanged(const TextEditor::
current->setTabSettings(settings);
}
-QString SimpleCodeStylePreferencesWidget::searchKeywords() const
-{
- return m_tabSettingsWidget->searchKeywords();
-}
-
void SimpleCodeStylePreferencesWidget::setFlat(bool on)
{
m_tabSettingsWidget->setFlat(on);
diff --git a/src/plugins/texteditor/simplecodestylepreferenceswidget.h b/src/plugins/texteditor/simplecodestylepreferenceswidget.h
index 2ba5a38d36..776da7a75b 100644
--- a/src/plugins/texteditor/simplecodestylepreferenceswidget.h
+++ b/src/plugins/texteditor/simplecodestylepreferenceswidget.h
@@ -52,7 +52,6 @@ public:
explicit SimpleCodeStylePreferencesWidget(QWidget *parent = 0);
void setPreferences(ICodeStylePreferences *tabPreferences);
- QString searchKeywords() const;
void setFlat(bool on);
TabSettingsWidget *tabSettingsWidget() const;
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
index c59d510f32..88bb429c3e 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
@@ -39,11 +39,12 @@
#include <texteditor/texteditorsettings.h>
#include <extensionsystem/pluginmanager.h>
-#include <QModelIndex>
#include <QAbstractTableModel>
#include <QList>
-#include <QTextStream>
#include <QMessageBox>
+#include <QModelIndex>
+#include <QPointer>
+#include <QTextStream>
namespace TextEditor {
namespace Internal {
@@ -269,12 +270,13 @@ public:
Core::Id id() const { return m_id; }
const QString &displayName() const { return m_displayName; }
- bool isKeyword(const QString &s) const { return m_keywords.contains(s, Qt::CaseInsensitive); }
void configureUi(QWidget *parent);
void apply();
void finish();
+ QPointer<QWidget> m_widget;
+
private slots:
void loadSnippetGroup(int index);
void markSnippetsCollection();
@@ -302,7 +304,6 @@ private:
const QString m_settingsPrefix;
SnippetsTableModel *m_model;
bool m_snippetsCollectionChanged;
- QString m_keywords;
SnippetsSettings m_settings;
Ui::SnippetsSettingsPage m_ui;
};
@@ -350,8 +351,6 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
m_ui.revertButton->setEnabled(false);
- QTextStream(&m_keywords) << m_displayName;
-
loadSettings();
loadSnippetGroup(m_ui.groupCombo->currentIndex());
@@ -566,16 +565,13 @@ SnippetsSettingsPage::~SnippetsSettingsPage()
delete d;
}
-bool SnippetsSettingsPage::matches(const QString &s) const
+QWidget *SnippetsSettingsPage::widget()
{
- return d->isKeyword(s);
-}
-
-QWidget *SnippetsSettingsPage::createPage(QWidget *parent)
-{
- QWidget *w = new QWidget(parent);
- d->configureUi(w);
- return w;
+ if (!d->m_widget) {
+ d->m_widget = new QWidget;
+ d->configureUi(d->m_widget);
+ }
+ return d->m_widget;
}
void SnippetsSettingsPage::apply()
@@ -586,6 +582,7 @@ void SnippetsSettingsPage::apply()
void SnippetsSettingsPage::finish()
{
d->finish();
+ delete d->m_widget;
}
} // Internal
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.h b/src/plugins/texteditor/snippets/snippetssettingspage.h
index 04737b71d3..154dbd670c 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.h
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.h
@@ -45,8 +45,7 @@ public:
SnippetsSettingsPage(Core::Id id, QObject *parent);
~SnippetsSettingsPage();
- bool matches(const QString &s) const;
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp
index 2ce5756437..3f36eef375 100644
--- a/src/plugins/texteditor/tabsettingswidget.cpp
+++ b/src/plugins/texteditor/tabsettingswidget.cpp
@@ -101,21 +101,6 @@ void TabSettingsWidget::setFlat(bool on)
ui->tabsAndIndentationGroupBox->layout()->setContentsMargins(margin, -1, margin, margin);
}
-QString TabSettingsWidget::searchKeywords() const
-{
- QString rc;
- QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << ui->tabsAndIndentationGroupBox->title()
- << sep << ui->tabPolicyLabel->text()
- << sep << ui->tabSizeLabel->text()
- << sep << ui->indentSizeLabel->text()
- << sep << ui->continuationAlignBehaviorLabel->text()
- ;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
void TabSettingsWidget::setCodingStyleWarningVisible(bool visible)
{
ui->codingStyleWarning->setVisible(visible);
diff --git a/src/plugins/texteditor/tabsettingswidget.h b/src/plugins/texteditor/tabsettingswidget.h
index 802a7933ca..41a490f783 100644
--- a/src/plugins/texteditor/tabsettingswidget.h
+++ b/src/plugins/texteditor/tabsettingswidget.h
@@ -56,7 +56,6 @@ public:
TabSettings tabSettings() const;
void setFlat(bool on);
- QString searchKeywords() const;
void setCodingStyleWarningVisible(bool visible);
public slots:
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp
index 70d6ff508c..64ed02eaf5 100644
--- a/src/plugins/texteditor/texteditoractionhandler.cpp
+++ b/src/plugins/texteditor/texteditoractionhandler.cpp
@@ -49,9 +49,9 @@
using namespace TextEditor;
using namespace TextEditor::Internal;
-TextEditorActionHandler::TextEditorActionHandler(const char *context,
+TextEditorActionHandler::TextEditorActionHandler(QObject *parent, Core::Id contextId,
uint optionalActions)
- : QObject(Core::ICore::instance()),
+ : QObject(parent),
m_undoAction(0),
m_redoAction(0),
m_copyAction(0),
@@ -103,10 +103,10 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context,
m_jumpToFileAction(0),
m_jumpToFileInNextSplitAction(0),
m_optionalActions(optionalActions),
- m_currentEditor(0),
- m_contextId(context),
- m_initialized(false)
+ m_currentEditorWidget(0),
+ m_contextId(contextId)
{
+ createActions();
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateCurrentEditor(Core::IEditor*)));
}
@@ -115,25 +115,6 @@ TextEditorActionHandler::~TextEditorActionHandler()
{
}
-void TextEditorActionHandler::setupActions(BaseTextEditorWidget *editor)
-{
- initializeActions();
- editor->setActionHack(this);
- QObject::connect(editor, SIGNAL(undoAvailable(bool)), this, SLOT(updateUndoAction()));
- QObject::connect(editor, SIGNAL(redoAvailable(bool)), this, SLOT(updateRedoAction()));
- QObject::connect(editor, SIGNAL(copyAvailable(bool)), this, SLOT(updateCopyAction()));
- QObject::connect(editor, SIGNAL(readOnlyChanged()), this, SLOT(updateActions()));
-}
-
-
-void TextEditorActionHandler::initializeActions()
-{
- if (!m_initialized) {
- createActions();
- m_initialized = true;
- }
-}
-
void TextEditorActionHandler::createActions()
{
using namespace Core::Constants;
@@ -371,6 +352,13 @@ void TextEditorActionHandler::createActions()
m_modifyingActions << m_switchUtf8bomAction;
m_modifyingActions << m_indentAction;
m_modifyingActions << m_unindentAction;
+
+ // set enabled state of optional actions
+ m_followSymbolAction->setEnabled(m_optionalActions & FollowSymbolUnderCursor);
+ m_followSymbolInNextSplitAction->setEnabled(m_optionalActions & FollowSymbolUnderCursor);
+ m_jumpToFileAction->setEnabled(m_optionalActions & JumpToFileUnderCursor);
+ m_jumpToFileInNextSplitAction->setEnabled(m_optionalActions & JumpToFileUnderCursor);
+ m_unfoldAllAction->setEnabled(m_optionalActions & UnCollapseAll);
}
QAction *TextEditorActionHandler::registerAction(const Core::Id &id,
@@ -382,7 +370,7 @@ QAction *TextEditorActionHandler::registerAction(const Core::Id &id,
Core::ActionContainer *container)
{
QAction *result = new QAction(title, this);
- Core::Command *command = Core::ActionManager::registerAction(result, id, m_contextId, scriptable);
+ Core::Command *command = Core::ActionManager::registerAction(result, id, Core::Context(m_contextId), scriptable);
if (!keySequence.isEmpty())
command->setDefaultKeySequence(keySequence);
@@ -393,34 +381,16 @@ QAction *TextEditorActionHandler::registerAction(const Core::Id &id,
return result;
}
-TextEditorActionHandler::UpdateMode TextEditorActionHandler::updateMode() const
-{
- Q_ASSERT(m_currentEditor != 0);
- return m_currentEditor->isReadOnly() ? ReadOnlyMode : WriteMode;
-}
-
void TextEditorActionHandler::updateActions()
{
- if (!m_currentEditor || !m_initialized)
- return;
- updateActions(updateMode());
-}
-
-void TextEditorActionHandler::updateActions(UpdateMode um)
-{
+ QTC_ASSERT(m_currentEditorWidget, return);
+ bool isWritable = !m_currentEditorWidget->isReadOnly();
foreach (QAction *a, m_modifyingActions)
- a->setEnabled(um != ReadOnlyMode);
- m_formatAction->setEnabled((m_optionalActions & Format) && um != ReadOnlyMode);
- m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection) && um != ReadOnlyMode);
- m_followSymbolAction->setEnabled(m_optionalActions & FollowSymbolUnderCursor);
- m_followSymbolInNextSplitAction->setEnabled(m_optionalActions & FollowSymbolUnderCursor);
- m_jumpToFileAction->setEnabled(m_optionalActions & JumpToFileUnderCursor);
- m_jumpToFileInNextSplitAction->setEnabled(m_optionalActions & JumpToFileUnderCursor);
-
- m_unfoldAllAction->setEnabled((m_optionalActions & UnCollapseAll));
- m_visualizeWhitespaceAction->setChecked(m_currentEditor->displaySettings().m_visualizeWhitespace);
- if (m_textWrappingAction)
- m_textWrappingAction->setChecked(m_currentEditor->displaySettings().m_textWrapping);
+ a->setEnabled(isWritable);
+ m_formatAction->setEnabled((m_optionalActions & Format) && isWritable);
+ m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection) && isWritable);
+ m_visualizeWhitespaceAction->setChecked(m_currentEditorWidget->displaySettings().m_visualizeWhitespace);
+ m_textWrappingAction->setChecked(m_currentEditorWidget->displaySettings().m_textWrapping);
updateRedoAction();
updateUndoAction();
@@ -429,21 +399,22 @@ void TextEditorActionHandler::updateActions(UpdateMode um)
void TextEditorActionHandler::updateRedoAction()
{
- if (m_redoAction)
- m_redoAction->setEnabled(m_currentEditor && m_currentEditor->document()->isRedoAvailable());
+ QTC_ASSERT(m_currentEditorWidget, return);
+ m_redoAction->setEnabled(m_currentEditorWidget->document()->isRedoAvailable());
}
void TextEditorActionHandler::updateUndoAction()
{
- if (m_undoAction)
- m_undoAction->setEnabled(m_currentEditor && m_currentEditor->document()->isUndoAvailable());
+ QTC_ASSERT(m_currentEditorWidget, return);
+ m_undoAction->setEnabled(m_currentEditorWidget->document()->isUndoAvailable());
}
void TextEditorActionHandler::updateCopyAction()
{
- const bool hasCopyableText = m_currentEditor && m_currentEditor->textCursor().hasSelection();
+ QTC_ASSERT(m_currentEditorWidget, return);
+ const bool hasCopyableText = m_currentEditorWidget->textCursor().hasSelection();
if (m_cutAction)
- m_cutAction->setEnabled(hasCopyableText && updateMode() == WriteMode);
+ m_cutAction->setEnabled(hasCopyableText && !m_currentEditorWidget->isReadOnly());
if (m_copyAction)
m_copyAction->setEnabled(hasCopyableText);
}
@@ -459,37 +430,37 @@ void TextEditorActionHandler::gotoAction()
void TextEditorActionHandler::printAction()
{
- if (m_currentEditor)
- m_currentEditor->print(Core::ICore::printer());
+ if (m_currentEditorWidget)
+ m_currentEditorWidget->print(Core::ICore::printer());
}
void TextEditorActionHandler::setVisualizeWhitespace(bool checked)
{
- if (m_currentEditor) {
- DisplaySettings ds = m_currentEditor->displaySettings();
+ if (m_currentEditorWidget) {
+ DisplaySettings ds = m_currentEditorWidget->displaySettings();
ds.m_visualizeWhitespace = checked;
- m_currentEditor->setDisplaySettings(ds);
+ m_currentEditorWidget->setDisplaySettings(ds);
}
}
void TextEditorActionHandler::setTextWrapping(bool checked)
{
- if (m_currentEditor) {
- DisplaySettings ds = m_currentEditor->displaySettings();
+ if (m_currentEditorWidget) {
+ DisplaySettings ds = m_currentEditorWidget->displaySettings();
ds.m_textWrapping = checked;
- m_currentEditor->setDisplaySettings(ds);
+ m_currentEditorWidget->setDisplaySettings(ds);
}
}
#define FUNCTION(funcname) void TextEditorActionHandler::funcname ()\
{\
- if (m_currentEditor)\
- m_currentEditor->funcname ();\
+ if (m_currentEditorWidget)\
+ m_currentEditorWidget->funcname ();\
}
#define FUNCTION2(funcname, funcname2) void TextEditorActionHandler::funcname ()\
{\
- if (m_currentEditor)\
- m_currentEditor->funcname2 ();\
+ if (m_currentEditorWidget)\
+ m_currentEditorWidget->funcname2 ();\
}
@@ -568,20 +539,21 @@ BaseTextEditorWidget *TextEditorActionHandler::resolveTextEditorWidget(Core::IEd
void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor)
{
- m_currentEditor = 0;
+ if (m_currentEditorWidget)
+ m_currentEditorWidget->disconnect(this);
+ m_currentEditorWidget = 0;
- if (!editor)
+ // don't need to do anything if the editor's context doesn't match
+ // (our actions will be disabled because our context will not be active)
+ if (!editor || !editor->context().contains(m_contextId))
return;
- BaseTextEditorWidget *baseEditor = resolveTextEditorWidget(editor);
-
- if (baseEditor && baseEditor->actionHack() == this) {
- m_currentEditor = baseEditor;
- updateActions();
- }
-}
-
-const QPointer<BaseTextEditorWidget> &TextEditorActionHandler::currentEditor() const
-{
- return m_currentEditor;
+ BaseTextEditorWidget *editorWidget = resolveTextEditorWidget(editor);
+ QTC_ASSERT(editorWidget, return); // editor has our context id, so shouldn't happen
+ m_currentEditorWidget = editorWidget;
+ connect(m_currentEditorWidget, SIGNAL(undoAvailable(bool)), this, SLOT(updateUndoAction()));
+ connect(m_currentEditorWidget, SIGNAL(redoAvailable(bool)), this, SLOT(updateRedoAction()));
+ connect(m_currentEditorWidget, SIGNAL(copyAvailable(bool)), this, SLOT(updateCopyAction()));
+ connect(m_currentEditorWidget, SIGNAL(readOnlyChanged()), this, SLOT(updateActions()));
+ updateActions();
}
diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h
index a09e6a3a84..bee5dc293b 100644
--- a/src/plugins/texteditor/texteditoractionhandler.h
+++ b/src/plugins/texteditor/texteditoractionhandler.h
@@ -65,23 +65,13 @@ public:
JumpToFileUnderCursor = 16
};
- explicit TextEditorActionHandler(const char *context, uint optionalActions = None);
+ explicit TextEditorActionHandler(QObject *parent, Core::Id contextId, uint optionalActions = None);
~TextEditorActionHandler();
- void setupActions(BaseTextEditorWidget *editor);
-
- void initializeActions();
-
-public slots:
- void updateActions();
- void updateRedoAction();
- void updateUndoAction();
- void updateCopyAction();
-
protected:
virtual BaseTextEditorWidget *resolveTextEditorWidget(Core::IEditor *editor) const;
- const QPointer<BaseTextEditorWidget> &currentEditor() const;
+private:
QAction *registerAction(const Core::Id &id,
const char *slot,
bool scriptable = false,
@@ -90,13 +80,14 @@ protected:
const char *menueGroup = 0,
Core::ActionContainer *container = 0);
- enum UpdateMode { ReadOnlyMode, WriteMode };
- UpdateMode updateMode() const;
-
void createActions();
- void updateActions(UpdateMode um);
private slots:
+ void updateActions();
+ void updateRedoAction();
+ void updateUndoAction();
+ void updateCopyAction();
+
void undoAction();
void redoAction();
void copyAction();
@@ -225,9 +216,8 @@ private:
QList<QAction *> m_modifyingActions;
uint m_optionalActions;
- QPointer<BaseTextEditorWidget> m_currentEditor;
- Core::Context m_contextId;
- bool m_initialized;
+ QPointer<BaseTextEditorWidget> m_currentEditorWidget;
+ Core::Id m_contextId;
};
} // namespace TextEditor
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp
index a61e82f02a..2721eac7c3 100644
--- a/src/plugins/texteditor/texteditorplugin.cpp
+++ b/src/plugins/texteditor/texteditorplugin.cpp
@@ -203,11 +203,6 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
m_outlineFactory = new OutlineFactory;
addAutoReleasedObject(m_outlineFactory);
- // We have to initialize the actions because other plugins that
- // depend upon the texteditorplugin expect that actions will be
- // registered in the action manager at plugin initialization time.
- m_editorFactory->actionHandler()->initializeActions();
-
m_baseTextMarkRegistry = new BaseTextMarkRegistry(this);
return true;
@@ -246,14 +241,6 @@ void TextEditorPlugin::extensionsInitialized()
this, SLOT(updateCurrentSelection(QString)));
}
-void TextEditorPlugin::initializeEditor(PlainTextEditorWidget *editor)
-{
- // common actions
- m_editorFactory->actionHandler()->setupActions(editor);
-
- TextEditorSettings::initializeEditor(editor);
-}
-
void TextEditorPlugin::invokeCompletion()
{
Core::IEditor *iface = Core::EditorManager::currentEditor();
diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h
index 3d19745a64..892c176816 100644
--- a/src/plugins/texteditor/texteditorplugin.h
+++ b/src/plugins/texteditor/texteditorplugin.h
@@ -64,8 +64,6 @@ public:
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
- void initializeEditor(PlainTextEditorWidget *editor);
-
PlainTextEditorFactory *editorFactory() { return m_editorFactory; }
LineNumberFilter *lineNumberFilter() { return m_lineNumberFilter; }
BaseTextMarkRegistry *baseTextMarkRegistry() { return m_baseTextMarkRegistry; }
diff --git a/src/plugins/todo/optionsdialog.ui b/src/plugins/todo/optionsdialog.ui
index d8b4f6d963..b07912b5e9 100644
--- a/src/plugins/todo/optionsdialog.ui
+++ b/src/plugins/todo/optionsdialog.ui
@@ -87,14 +87,14 @@
<bool>true</bool>
</property>
<property name="text">
- <string>Scan in the whole project</string>
+ <string>Scan the whole active project</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="scanInCurrentFileRadioButton">
<property name="text">
- <string>Scan in the current opened file</string>
+ <string>Scan only the currently edited document</string>
</property>
<property name="checked">
<bool>true</bool>
diff --git a/src/plugins/todo/optionspage.cpp b/src/plugins/todo/optionspage.cpp
index 5200853756..d1b0da3dab 100644
--- a/src/plugins/todo/optionspage.cpp
+++ b/src/plugins/todo/optionspage.cpp
@@ -45,7 +45,7 @@ namespace Internal {
OptionsPage::OptionsPage(const Settings &settings, QObject *parent) :
IOptionsPage(parent),
- m_dialog(0)
+ m_widget(0)
{
setSettings(settings);
@@ -61,16 +61,18 @@ void OptionsPage::setSettings(const Settings &settings)
m_settings = settings;
}
-QWidget *OptionsPage::createPage(QWidget *parent)
+QWidget *OptionsPage::widget()
{
- m_dialog = new OptionsDialog(parent);
- m_dialog->setSettings(m_settings);
- return m_dialog;
+ if (!m_widget) {
+ m_widget = new OptionsDialog;
+ m_widget->setSettings(m_settings);
+ }
+ return m_widget;
}
void OptionsPage::apply()
{
- Settings newSettings = m_dialog->settings();
+ Settings newSettings = m_widget->settings();
if (newSettings != m_settings) {
m_settings = newSettings;
@@ -80,11 +82,7 @@ void OptionsPage::apply()
void OptionsPage::finish()
{
-}
-
-bool OptionsPage::matches(const QString &searchKeyWord) const
-{
- return searchKeyWord == QLatin1String("todo");
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/todo/optionspage.h b/src/plugins/todo/optionspage.h
index 601a15642a..a4d989ab6a 100644
--- a/src/plugins/todo/optionspage.h
+++ b/src/plugins/todo/optionspage.h
@@ -35,6 +35,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace Todo {
namespace Internal {
@@ -49,16 +51,15 @@ public:
void setSettings(const Settings &settings);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &searchKeyWord) const;
signals:
void settingsChanged(const Settings &settings);
private:
- OptionsDialog *m_dialog;
+ QPointer<OptionsDialog> m_widget;
Settings m_settings;
};
diff --git a/src/plugins/todo/todooutputpane.cpp b/src/plugins/todo/todooutputpane.cpp
index da5bb925e1..5275bf575e 100755
--- a/src/plugins/todo/todooutputpane.cpp
+++ b/src/plugins/todo/todooutputpane.cpp
@@ -194,13 +194,13 @@ void TodoOutputPane::createScopeButtons()
{
m_currentFileButton = new QToolButton();
m_currentFileButton->setCheckable(true);
- m_currentFileButton->setText(tr("Current File"));
- m_currentFileButton->setToolTip(tr("Scan in the current opened file"));
+ m_currentFileButton->setText(tr("Current Document"));
+ m_currentFileButton->setToolTip(tr("Scan only the currently edited document."));
m_wholeProjectButton = new QToolButton();
m_wholeProjectButton->setCheckable(true);
- m_wholeProjectButton->setText(tr("Whole Project"));
- m_wholeProjectButton->setToolTip(tr("Scan in the whole project"));
+ m_wholeProjectButton->setText(tr("Active Project"));
+ m_wholeProjectButton->setToolTip(tr("Scan the whole active project."));
m_scopeButtons = new QButtonGroup();
m_scopeButtons->addButton(m_wholeProjectButton);
diff --git a/src/plugins/updateinfo/settingspage.cpp b/src/plugins/updateinfo/settingspage.cpp
index 2125baad61..b6d0de60c5 100644
--- a/src/plugins/updateinfo/settingspage.cpp
+++ b/src/plugins/updateinfo/settingspage.cpp
@@ -36,7 +36,7 @@ using namespace UpdateInfo;
using namespace UpdateInfo::Internal;
SettingsPage::SettingsPage(UpdateInfoPlugin *plugin)
- : m_page(0)
+ : m_widget(0)
, m_plugin(plugin)
{
setId(Constants::FILTER_OPTIONS_PAGE);
@@ -46,15 +46,15 @@ SettingsPage::SettingsPage(UpdateInfoPlugin *plugin)
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
}
-QWidget *SettingsPage::createPage(QWidget *parent)
+QWidget *SettingsPage::widget()
{
- m_page = new QWidget(parent);
- m_ui.setupUi(m_page);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_ui.m_info->text();
- m_ui.m_timeTable->setItemText(m_ui.m_timeTable->currentIndex(), QTime(m_plugin->scheduledUpdateTime())
- .toString(QLatin1String("hh:mm")));
- return m_page;
+ if (!m_widget) {
+ m_widget = new QWidget;
+ m_ui.setupUi(m_widget);
+ m_ui.m_timeTable->setItemText(m_ui.m_timeTable->currentIndex(), QTime(m_plugin->scheduledUpdateTime())
+ .toString(QLatin1String("hh:mm")));
+ }
+ return m_widget;
}
void SettingsPage::apply()
@@ -66,9 +66,5 @@ void SettingsPage::apply()
void SettingsPage::finish()
{
-}
-
-bool SettingsPage::matches(const QString &searchKey) const
-{
- return m_searchKeywords.contains(searchKey, Qt::CaseInsensitive);
+ delete m_widget;
}
diff --git a/src/plugins/updateinfo/settingspage.h b/src/plugins/updateinfo/settingspage.h
index 9806eafb43..dc8ded50b2 100644
--- a/src/plugins/updateinfo/settingspage.h
+++ b/src/plugins/updateinfo/settingspage.h
@@ -34,6 +34,8 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QPointer>
+
namespace UpdateInfo {
namespace Internal {
@@ -46,15 +48,13 @@ class SettingsPage : public Core::IOptionsPage
public:
explicit SettingsPage(UpdateInfoPlugin *plugin);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
void finish();
- bool matches(const QString &searchKey) const;
private:
- QWidget *m_page;
+ QPointer<QWidget> m_widget;
Ui::SettingsWidget m_ui;
- QString m_searchKeywords;
UpdateInfoPlugin *m_plugin;
};
diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp
index cd19cd6e33..97cbae7772 100644
--- a/src/plugins/valgrind/suppressiondialog.cpp
+++ b/src/plugins/valgrind/suppressiondialog.cpp
@@ -158,6 +158,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
}
m_fileChooser->setExpectedKind(Utils::PathChooser::File);
+ m_fileChooser->setHistoryCompleter(QLatin1String("Valgrind.Suppression.History"));
m_fileChooser->setPath(defaultSuppFile.fileName());
m_fileChooser->setPromptDialogFilter(QLatin1String("*.supp"));
m_fileChooser->setPromptDialogTitle(tr("Select Suppression File"));
diff --git a/src/plugins/valgrind/valgrindconfigwidget.cpp b/src/plugins/valgrind/valgrindconfigwidget.cpp
index d4f3a99dcd..611ffafbf3 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.cpp
+++ b/src/plugins/valgrind/valgrindconfigwidget.cpp
@@ -55,6 +55,7 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
m_model = new QStandardItemModel(this);
m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui->valgrindExeChooser->setHistoryCompleter(QLatin1String("Valgrind.Command.History"));
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
updateUi();
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index 3cef9593ea..90b4694f2b 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -52,6 +52,7 @@
#include <QtPlugin>
#include <QCoreApplication>
+#include <QPointer>
using namespace Analyzer;
@@ -72,14 +73,25 @@ public:
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
}
- QWidget *createPage(QWidget *parent) {
- return new ValgrindConfigWidget(theGlobalSettings, parent, true);
+ QWidget *widget()
+ {
+ if (!m_widget)
+ m_widget = new ValgrindConfigWidget(theGlobalSettings, 0, true);
+ return m_widget;
}
- void apply() {
+ void apply()
+ {
theGlobalSettings->writeSettings();
}
- void finish() {}
+
+ void finish()
+ {
+ delete m_widget;
+ }
+
+private:
+ QPointer<QWidget> m_widget;
};
class ValgrindAction : public AnalyzerAction
diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp
index ec212d9caa..5a9c9d55fe 100644
--- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp
+++ b/src/plugins/vcsbase/basecheckoutwizardpage.cpp
@@ -75,6 +75,7 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
this, SLOT(slotChanged()));
d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History"));
connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged()));
d->ui.branchComboBox->setEnabled(false);
diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp
index 9d085ab639..b44ddd1084 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcseditorfactory.cpp
@@ -54,12 +54,10 @@ public:
BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t);
const VcsBaseEditorParameters *m_type;
- TextEditor::TextEditorActionHandler *m_editorHandler;
};
BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) :
- m_type(t),
- m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
+ m_type(t)
{
}
@@ -71,6 +69,7 @@ BaseVcsEditorFactory::BaseVcsEditorFactory(const VcsBaseEditorParameters *t)
setId(t->id);
setDisplayName(QCoreApplication::translate("VCS", t->displayName));
addMimeType(t->mimeType);
+ new TextEditor::TextEditorActionHandler(this, t->context);
}
BaseVcsEditorFactory::~BaseVcsEditorFactory()
@@ -83,12 +82,8 @@ Core::IEditor *BaseVcsEditorFactory::createEditor(QWidget *parent)
VcsBaseEditorWidget *vcsEditor = createVcsBaseEditor(d->m_type, parent);
vcsEditor->setMimeType(mimeTypes().front());
- d->m_editorHandler->setupActions(vcsEditor);
- // Wire font settings and set initial values
- connect(TextEditor::TextEditorSettings::instance(), SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
- vcsEditor, SLOT(setFontSettings(TextEditor::FontSettings)));
- vcsEditor->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
+ TextEditor::TextEditorSettings::initializeEditor(vcsEditor);
return vcsEditor->editor();
}
diff --git a/src/plugins/vcsbase/commonsettingspage.cpp b/src/plugins/vcsbase/commonsettingspage.cpp
index 16ac3600cd..e280ed5300 100644
--- a/src/plugins/vcsbase/commonsettingspage.cpp
+++ b/src/plugins/vcsbase/commonsettingspage.cpp
@@ -48,13 +48,18 @@ CommonSettingsWidget::CommonSettingsWidget(QWidget *parent) :
{
m_ui->setupUi(this);
m_ui->submitMessageCheckScriptChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui->submitMessageCheckScriptChooser->setHistoryCompleter(QLatin1String("Vcs.MessageCheckScript.History"));
m_ui->nickNameFieldsFileChooser->setExpectedKind(Utils::PathChooser::File);
+ m_ui->nickNameFieldsFileChooser->setHistoryCompleter(QLatin1String("Vcs.NickFields.History"));
m_ui->nickNameMailMapChooser->setExpectedKind(Utils::PathChooser::File);
+ m_ui->nickNameMailMapChooser->setHistoryCompleter(QLatin1String("Vcs.NickMap.History"));
m_ui->sshPromptChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui->sshPromptChooser->setHistoryCompleter(QLatin1String("Vcs.SshPrompt.History"));
const QString patchToolTip = tr("Command used for reverting diff chunks");
m_ui->patchCommandLabel->setToolTip(patchToolTip);
m_ui->patchChooser->setToolTip(patchToolTip);
m_ui->patchChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui->patchChooser->setHistoryCompleter(QLatin1String("Vcs.PatchCommand.History"));
}
CommonSettingsWidget::~CommonSettingsWidget()
@@ -110,12 +115,12 @@ CommonOptionsPage::CommonOptionsPage(QObject *parent) :
setDisplayName(QCoreApplication::translate("VcsBase", Constants::VCS_COMMON_SETTINGS_NAME));
}
-QWidget *CommonOptionsPage::createPage(QWidget *parent)
+QWidget *CommonOptionsPage::widget()
{
- m_widget = new CommonSettingsWidget(parent);
- m_widget->setSettings(m_settings);
- if (m_searchKeyWords.isEmpty())
- m_searchKeyWords = m_widget->searchKeyWordMatchString();
+ if (!m_widget) {
+ m_widget = new CommonSettingsWidget;
+ m_widget->setSettings(m_settings);
+ }
return m_widget;
}
@@ -131,9 +136,9 @@ void CommonOptionsPage::apply()
}
}
-bool CommonOptionsPage::matches(const QString &key) const
+void CommonOptionsPage::finish()
{
- return m_searchKeyWords.contains(key, Qt::CaseInsensitive);
+ delete m_widget;
}
} // namespace Internal
diff --git a/src/plugins/vcsbase/commonsettingspage.h b/src/plugins/vcsbase/commonsettingspage.h
index e0d0b1e45b..7fa0768c8b 100644
--- a/src/plugins/vcsbase/commonsettingspage.h
+++ b/src/plugins/vcsbase/commonsettingspage.h
@@ -34,6 +34,7 @@
#include "vcsbaseoptionspage.h"
+#include <QPointer>
#include <QWidget>
namespace VcsBase {
@@ -65,10 +66,9 @@ class CommonOptionsPage : public VcsBaseOptionsPage
public:
explicit CommonOptionsPage(QObject *parent = 0);
- QWidget *createPage(QWidget *parent);
+ QWidget *widget();
void apply();
- void finish() { }
- bool matches(const QString &key) const;
+ void finish();
CommonVcsSettings settings() const { return m_settings; }
@@ -76,9 +76,8 @@ signals:
void settingsChanged(const VcsBase::Internal::CommonVcsSettings &s);
private:
- CommonSettingsWidget *m_widget;
+ QPointer<CommonSettingsWidget> m_widget;
CommonVcsSettings m_settings;
- QString m_searchKeyWords;
};
} // namespace Internal
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp
index 551209eaf2..540c82b421 100644
--- a/src/plugins/vcsbase/vcsbaseclient.cpp
+++ b/src/plugins/vcsbase/vcsbaseclient.cpp
@@ -367,7 +367,9 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
QStringList args;
const QStringList paramArgs = paramWidget != 0 ? paramWidget->arguments() : QStringList();
args << vcsCmdString << extraOptions << paramArgs << files;
+ QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBase::VcsBaseEditorWidget::getCodec(source);
Command *command = createCommand(workingDir, editor);
+ command->setCodec(codec);
enqueueJob(command, args, exitCodeInterpreter(DiffCommand, command));
}
diff --git a/src/qtcreatorplugin.pri b/src/qtcreatorplugin.pri
index c243fa1180..0f482d0a3d 100644
--- a/src/qtcreatorplugin.pri
+++ b/src/qtcreatorplugin.pri
@@ -112,12 +112,8 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}
macx {
- !isEmpty(TIGER_COMPAT_MODE) {
- QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
- } else {
- QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
- QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
- }
+ QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
+ QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
QMAKE_RPATHDIR += \$\$ORIGIN
diff --git a/src/rpath.pri b/src/rpath.pri
index c352a823b3..de56f11ae5 100644
--- a/src/rpath.pri
+++ b/src/rpath.pri
@@ -1,10 +1,6 @@
macx {
- !isEmpty(TIGER_COMPAT_MODE) {
- QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/
- } else {
- QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
- QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../
- }
+ QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
+ QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
# this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var
diff --git a/src/tools/buildoutputparser/buildoutputparser.pro b/src/tools/buildoutputparser/buildoutputparser.pro
new file mode 100644
index 0000000000..5b9aa4ea24
--- /dev/null
+++ b/src/tools/buildoutputparser/buildoutputparser.pro
@@ -0,0 +1,25 @@
+TEMPLATE = app
+TARGET = buildoutputparser
+QTC_LIB_DEPENDS = utils
+QTC_PLUGIN_DEPENDS = projectexplorer qtsupport qmakeprojectmanager
+
+QT = core gui
+CONFIG += console
+CONFIG -= app_bundle
+
+include(../../../qtcreator.pri)
+include(../../rpath.pri)
+
+LIBS += -L$$IDE_PLUGIN_PATH/QtProject
+win32|equals(TEST, 1):DEFINES += HAS_MSVC_PARSER
+
+DESTDIR = $$IDE_BIN_PATH
+target.path = /bin
+INSTALLS += target
+
+SOURCES = \
+ main.cpp \
+ outputprocessor.cpp
+
+HEADERS = \
+ outputprocessor.h
diff --git a/src/tools/buildoutputparser/buildoutputparser.qbs b/src/tools/buildoutputparser/buildoutputparser.qbs
new file mode 100644
index 0000000000..f1fbd8f795
--- /dev/null
+++ b/src/tools/buildoutputparser/buildoutputparser.qbs
@@ -0,0 +1,20 @@
+import qbs
+import QtcTool
+
+QtcTool {
+ name: "buildoutputparser"
+ Depends { name: "Qt"; submodules: ["core", "widgets"]; }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "QtSupport" }
+ Depends { name: "QmakeProjectManager" }
+ Depends { name: "Utils" }
+ files: [
+ "main.cpp",
+ "outputprocessor.cpp", "outputprocessor.h",
+ ]
+ cpp.rpaths: base.concat(qbs.targetOS.contains("osx")
+ ? ["@executable_path/../"]
+ : ["$ORIGIN/../" + project.ide_plugin_path + "/QtProject"])
+ cpp.defines: base.concat(qbs.targetOS.contains("windows") || project.testsEnabled
+ ? ["HAS_MSVC_PARSER"] : [])
+}
diff --git a/src/tools/buildoutputparser/main.cpp b/src/tools/buildoutputparser/main.cpp
new file mode 100644
index 0000000000..2b72b519e2
--- /dev/null
+++ b/src/tools/buildoutputparser/main.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "outputprocessor.h"
+
+#include <QCoreApplication>
+#include <QFile>
+#include <QMetaObject>
+#include <QFileInfo>
+#include <QStringList>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static void printUsage()
+{
+ fprintf(stderr, "Usage: %s [--type <compiler type>] <file>\n",
+ qPrintable(QFileInfo(QCoreApplication::applicationFilePath()).fileName()));
+ fprintf(stderr, "Possible compiler types: gcc, clang%s. Default is gcc.\n",
+#ifdef HAS_MSVC_PARSER
+ ", msvc"
+#else
+ ""
+#endif
+ );
+}
+
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ QStringList args = app.arguments().mid(1);
+ QString filePath;
+ CompilerType compilerType = CompilerTypeGcc;
+ while (filePath.isEmpty() && !args.isEmpty()) {
+ const QString currentArg = args.takeFirst();
+ if (currentArg == QLatin1String("--type")) {
+ if (args.isEmpty()) {
+ fprintf(stderr, "Error: Option --type needs argument.\n");
+ printUsage();
+ return EXIT_FAILURE;
+ }
+ const QString typeString = args.takeFirst();
+ if (typeString == QLatin1String("gcc")) {
+ compilerType = CompilerTypeGcc;
+ } else if (typeString == QLatin1String("clang")) {
+ compilerType = CompilerTypeClang;
+#ifdef HAS_MSVC_PARSER
+ } else if (typeString == QLatin1String("msvc")) {
+ compilerType = CompilerTypeMsvc;
+#endif
+ } else {
+ fprintf(stderr, "Invalid compiler type '%s'.\n", qPrintable(typeString));
+ printUsage();
+ return EXIT_FAILURE;
+ }
+ } else {
+ filePath = currentArg;
+ }
+ }
+
+ if (filePath.isEmpty()) {
+ fprintf(stderr, "Error: No file supplied.\n");
+ printUsage();
+ return EXIT_FAILURE;
+ }
+
+ if (!args.isEmpty())
+ qDebug("Ignoring extraneous parameters '%s'.\n", qPrintable(args.join(QLatin1String(" "))));
+
+ QFile compilerOutputFile(filePath);
+ if (!compilerOutputFile.open(QIODevice::ReadOnly)) {
+ fprintf(stderr, "Error opening file '%s': %s\n", qPrintable(compilerOutputFile.fileName()),
+ qPrintable(compilerOutputFile.errorString()));
+ return EXIT_FAILURE;
+ }
+ CompilerOutputProcessor cop(compilerType, compilerOutputFile);
+ QMetaObject::invokeMethod(&cop, "start", Qt::QueuedConnection);
+ return app.exec();
+}
diff --git a/src/tools/buildoutputparser/outputprocessor.cpp b/src/tools/buildoutputparser/outputprocessor.cpp
new file mode 100644
index 0000000000..4bb9166ff5
--- /dev/null
+++ b/src/tools/buildoutputparser/outputprocessor.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "outputprocessor.h"
+
+#include <projectexplorer/clangparser.h>
+#include <projectexplorer/gccparser.h>
+#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/osparser.h>
+#include <qmakeprojectmanager/qmakeparser.h>
+#include <qtsupport/qtparser.h>
+#include <utils/fileutils.h>
+
+#ifdef HAS_MSVC_PARSER
+#include <projectexplorer/msvcparser.h>
+#endif
+
+#include <QIODevice>
+#include <QTextStream>
+
+#include <stdio.h>
+
+CompilerOutputProcessor::CompilerOutputProcessor(CompilerType compilerType, QIODevice &source)
+ : m_compilerType(compilerType)
+ , m_source(source)
+ , m_ostream(new QTextStream(stdout, QIODevice::WriteOnly))
+{
+}
+
+CompilerOutputProcessor::~CompilerOutputProcessor()
+{
+ delete m_ostream;
+}
+
+void CompilerOutputProcessor::start()
+{
+ ProjectExplorer::OsParser parser;
+ parser.appendOutputParser(new QmakeProjectManager::QMakeParser);
+ parser.appendOutputParser(new ProjectExplorer::GnuMakeParser);
+ parser.appendOutputParser(new QtSupport::QtParser);
+ switch (m_compilerType) {
+ case CompilerTypeGcc:
+ parser.appendOutputParser(new ProjectExplorer::GccParser);
+ break;
+ case CompilerTypeClang:
+ parser.appendOutputParser(new ProjectExplorer::ClangParser);
+ break;
+#ifdef HAS_MSVC_PARSER
+ case CompilerTypeMsvc:
+ parser.appendOutputParser(new ProjectExplorer::MsvcParser);
+ break;
+#endif
+ }
+
+ connect(&parser, SIGNAL(addTask(ProjectExplorer::Task)),
+ SLOT(handleTask(ProjectExplorer::Task)));
+ while (!m_source.atEnd())
+ parser.stdError(QString::fromLocal8Bit(m_source.readLine().trimmed()));
+ qApp->quit();
+}
+
+void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task)
+{
+ const QString &fileName = task.file.toString();
+ if (!fileName.isEmpty()) {
+ *m_ostream << fileName;
+ if (task.line != -1)
+ *m_ostream << ':' << task.line;
+ *m_ostream << ": ";
+ }
+ *m_ostream << task.description << endl;
+}
diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h b/src/tools/buildoutputparser/outputprocessor.h
index b25a98eb44..7b9770d242 100644
--- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h
+++ b/src/tools/buildoutputparser/outputprocessor.h
@@ -27,36 +27,36 @@
**
****************************************************************************/
-#ifndef QDECLARATIVECANVASTIMER_P_H
-#define QDECLARATIVECANVASTIMER_P_H
-
-#include <QJSValue>
-#include <qtimer.h>
-#include <qlist.h>
+#include <QObject>
QT_BEGIN_NAMESPACE
+class QIODevice;
+class QTextStream;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer { class Task; }
-class CanvasTimer : public QTimer
+enum CompilerType {
+ CompilerTypeGcc,
+ CompilerTypeClang
+#ifdef HAS_MSVC_PARSER
+ , CompilerTypeMsvc
+#endif
+};
+
+class CompilerOutputProcessor : public QObject
{
Q_OBJECT
-
public:
- CanvasTimer(QObject *parent, const QJSValue &data);
+ CompilerOutputProcessor(CompilerType compilerType, QIODevice &source);
+ ~CompilerOutputProcessor();
-public Q_SLOTS:
- void handleTimeout();
- bool equals(const QJSValue &value){return m_value.equals(value);}
-
-public:
- static void createTimer(QObject *parent, const QJSValue &val, long timeout, bool singleshot);
- static void removeTimer(CanvasTimer *timer);
- static void removeTimer(const QJSValue &);
+private slots:
+ void start();
+ void handleTask(const ProjectExplorer::Task &task);
private:
- QJSValue m_value;
-
+ const CompilerType m_compilerType;
+ QIODevice &m_source;
+ QTextStream * const m_ostream;
};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVECANVASTIMER_P_H
diff --git a/src/tools/tools.pro b/src/tools/tools.pro
index 6785bb782a..de0e5d1be5 100644
--- a/src/tools/tools.pro
+++ b/src/tools/tools.pro
@@ -5,7 +5,8 @@ SUBDIRS = qtpromaker \
../plugins/cpaster/frontend \
sdktool \
valgrindfake \
- 3rdparty
+ 3rdparty \
+ buildoutputparser
win32 {
SUBDIRS += qtcdebugger
diff --git a/src/tools/tools.qbs b/src/tools/tools.qbs
index 454ee9b77f..38d2bcc20b 100644
--- a/src/tools/tools.qbs
+++ b/src/tools/tools.qbs
@@ -3,6 +3,7 @@ import qbs
Project {
name: "Tools"
references: [
+ "buildoutputparser/buildoutputparser.qbs",
"qtcdebugger/qtcdebugger.qbs",
"qtcreatorcrashhandler/qtcreatorcrashhandler.qbs",
"qtpromaker/qtpromaker.qbs",
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index cd17e2ea4d..f3b94700ca 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -7,6 +7,7 @@ SUBDIRS += \
debugger \
diff \
extensionsystem \
+ externaltool \
environment \
generichighlighter \
profilewriter \
diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp
index 1dc7383d72..dc8c329c14 100644
--- a/tests/auto/cplusplus/lexer/tst_lexer.cpp
+++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp
@@ -43,11 +43,11 @@ class tst_SimpleLexer: public QObject
Q_OBJECT
private slots:
- void doxygen_comments();
- void doxygen_comments_data();
+ void basic();
+ void basic_data();
};
-void tst_SimpleLexer::doxygen_comments()
+void tst_SimpleLexer::basic()
{
QFETCH(QByteArray, source);
QFETCH(QList<unsigned>, expectedTokenKindList);
@@ -70,7 +70,7 @@ void tst_SimpleLexer::doxygen_comments()
QVERIFY2(i == expectedTokenKindList.size(), "Less tokens than expected.");
}
-void tst_SimpleLexer::doxygen_comments_data()
+void tst_SimpleLexer::basic_data()
{
QTest::addColumn<QByteArray>("source");
QTest::addColumn<QList<unsigned> >("expectedTokenKindList");
@@ -165,6 +165,13 @@ void tst_SimpleLexer::doxygen_comments_data()
<< T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT
<< T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT << T_CPP_DOXY_COMMENT;
QTest::newRow(source) << source << expectedTokenKindList;
+
+ source = "?" "?(?" "?)?" "?<?" "?>a?b:c";
+ expectedTokenKindList = QList<unsigned>()
+ << T_LBRACKET << T_RBRACKET << T_LBRACE << T_RBRACE
+ << T_IDENTIFIER << T_QUESTION << T_IDENTIFIER << T_COLON << T_IDENTIFIER;
+ QTest::newRow(source) << source << expectedTokenKindList;
+
}
QTEST_APPLESS_MAIN(tst_SimpleLexer)
diff --git a/tests/auto/externaltool/externaltool.pro b/tests/auto/externaltool/externaltool.pro
index 5af23b7e4e..bc16a794f3 100644
--- a/tests/auto/externaltool/externaltool.pro
+++ b/tests/auto/externaltool/externaltool.pro
@@ -1,9 +1,9 @@
-IDE_BUILD_TREE = $$OUT_PWD/../../../
+QTC_PLUGIN_DEPENDS += coreplugin
include(../qttest.pri)
-include(../../../src/plugins/coreplugin/coreplugin.pri)
+include($$IDE_SOURCE_TREE/src/plugins/coreplugin/coreplugin_dependencies.pri)
+include($$IDE_SOURCE_TREE/src/libs/utils/utils_dependencies.pri)
+
LIBS *= -L$$IDE_PLUGIN_PATH/QtProject
-INCLUDEPATH *= $$IDE_SOURCE_TREE/src/plugins/coreplugin
-INCLUDEPATH *= $$IDE_BUILD_TREE/src/plugins/coreplugin
SOURCES += tst_externaltooltest.cpp \
$$IDE_SOURCE_TREE/src/plugins/coreplugin/externaltool.cpp
diff --git a/tests/auto/externaltool/tst_externaltooltest.cpp b/tests/auto/externaltool/tst_externaltooltest.cpp
index 3958a40f51..bfda597354 100644
--- a/tests/auto/externaltool/tst_externaltooltest.cpp
+++ b/tests/auto/externaltool/tst_externaltooltest.cpp
@@ -50,8 +50,7 @@ static const char TEST_XML1[] =
" <arguments>%{CurrentProjectFilePath}</arguments>"
" <workingdirectory>%{CurrentProjectPath}</workingdirectory>"
" </executable>"
-"</externaltool>"
-;
+"</externaltool>";
static const char TEST_XML2[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
@@ -213,7 +212,8 @@ void ExternaltoolTest::testReadLocale()
QCOMPARE(tool->description(), QString::fromLatin1("Grüezi"));
QCOMPARE(tool->displayName(), QString::fromLatin1("Grüezi"));
QCOMPARE(tool->displayCategory(), QString::fromLatin1("Grüezi"));
- delete tool;}
+ delete tool;
+}
QTEST_APPLESS_MAIN(ExternaltoolTest);